the-forest/client/node_modules/.cache/babel-loader/d3b028b9465f1d222f2a11b65bb54d5c6170cdb3f054ee89babbbd0d1c9bce0e.json
2024-09-17 20:35:18 -04:00

1 line
8.5 KiB
JSON

{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.valueFromProto = exports.valueToProto = void 0;\nconst errors_js_1 = require(\"./errors.js\");\nconst util_js_1 = require(\"./util.js\");\nfunction valueToProto(value) {\n if (value === null) {\n return null;\n } else if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new RangeError(\"Only finite numbers (not Infinity or NaN) can be passed as arguments\");\n }\n return value;\n } else if (typeof value === \"bigint\") {\n if (value < minInteger || value > maxInteger) {\n throw new RangeError(\"This bigint value is too large to be represented as a 64-bit integer and passed as argument\");\n }\n return value;\n } else if (typeof value === \"boolean\") {\n return value ? 1n : 0n;\n } else if (value instanceof ArrayBuffer) {\n return new Uint8Array(value);\n } else if (value instanceof Uint8Array) {\n return value;\n } else if (value instanceof Date) {\n return +value.valueOf();\n } else if (typeof value === \"object\") {\n return \"\" + value.toString();\n } else {\n throw new TypeError(\"Unsupported type of value\");\n }\n}\nexports.valueToProto = valueToProto;\nconst minInteger = -9223372036854775808n;\nconst maxInteger = 9223372036854775807n;\nfunction valueFromProto(value, intMode) {\n if (value === null) {\n return null;\n } else if (typeof value === \"number\") {\n return value;\n } else if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"bigint\") {\n if (intMode === \"number\") {\n const num = Number(value);\n if (!Number.isSafeInteger(num)) {\n throw new RangeError(\"Received integer which is too large to be safely represented as a JavaScript number\");\n }\n return num;\n } else if (intMode === \"bigint\") {\n return value;\n } else if (intMode === \"string\") {\n return \"\" + value;\n } else {\n throw new errors_js_1.MisuseError(\"Invalid value for IntMode\");\n }\n } else if (value instanceof Uint8Array) {\n // TODO: we need to copy data from `Uint8Array` to return an `ArrayBuffer`. Perhaps we should add a\n // `blobMode` parameter, similar to `intMode`, which would allow the user to choose between receiving\n // `ArrayBuffer` (default, convenient) and `Uint8Array` (zero copy)?\n return value.slice().buffer;\n } else if (value === undefined) {\n throw new errors_js_1.ProtoError(\"Received unrecognized type of Value\");\n } else {\n throw (0, util_js_1.impossible)(value, \"Impossible type of Value\");\n }\n}\nexports.valueFromProto = valueFromProto;","map":{"version":3,"names":["Object","defineProperty","exports","value","valueFromProto","valueToProto","errors_js_1","require","util_js_1","Number","isFinite","RangeError","minInteger","maxInteger","ArrayBuffer","Uint8Array","Date","valueOf","toString","TypeError","intMode","num","isSafeInteger","MisuseError","slice","buffer","undefined","ProtoError","impossible"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/value.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.valueFromProto = exports.valueToProto = void 0;\nconst errors_js_1 = require(\"./errors.js\");\nconst util_js_1 = require(\"./util.js\");\nfunction valueToProto(value) {\n if (value === null) {\n return null;\n }\n else if (typeof value === \"string\") {\n return value;\n }\n else if (typeof value === \"number\") {\n if (!Number.isFinite(value)) {\n throw new RangeError(\"Only finite numbers (not Infinity or NaN) can be passed as arguments\");\n }\n return value;\n }\n else if (typeof value === \"bigint\") {\n if (value < minInteger || value > maxInteger) {\n throw new RangeError(\"This bigint value is too large to be represented as a 64-bit integer and passed as argument\");\n }\n return value;\n }\n else if (typeof value === \"boolean\") {\n return value ? 1n : 0n;\n }\n else if (value instanceof ArrayBuffer) {\n return new Uint8Array(value);\n }\n else if (value instanceof Uint8Array) {\n return value;\n }\n else if (value instanceof Date) {\n return +value.valueOf();\n }\n else if (typeof value === \"object\") {\n return \"\" + value.toString();\n }\n else {\n throw new TypeError(\"Unsupported type of value\");\n }\n}\nexports.valueToProto = valueToProto;\nconst minInteger = -9223372036854775808n;\nconst maxInteger = 9223372036854775807n;\nfunction valueFromProto(value, intMode) {\n if (value === null) {\n return null;\n }\n else if (typeof value === \"number\") {\n return value;\n }\n else if (typeof value === \"string\") {\n return value;\n }\n else if (typeof value === \"bigint\") {\n if (intMode === \"number\") {\n const num = Number(value);\n if (!Number.isSafeInteger(num)) {\n throw new RangeError(\"Received integer which is too large to be safely represented as a JavaScript number\");\n }\n return num;\n }\n else if (intMode === \"bigint\") {\n return value;\n }\n else if (intMode === \"string\") {\n return \"\" + value;\n }\n else {\n throw new errors_js_1.MisuseError(\"Invalid value for IntMode\");\n }\n }\n else if (value instanceof Uint8Array) {\n // TODO: we need to copy data from `Uint8Array` to return an `ArrayBuffer`. Perhaps we should add a\n // `blobMode` parameter, similar to `intMode`, which would allow the user to choose between receiving\n // `ArrayBuffer` (default, convenient) and `Uint8Array` (zero copy)?\n return value.slice().buffer;\n }\n else if (value === undefined) {\n throw new errors_js_1.ProtoError(\"Received unrecognized type of Value\");\n }\n else {\n throw (0, util_js_1.impossible)(value, \"Impossible type of Value\");\n }\n}\nexports.valueFromProto = valueFromProto;\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,cAAc,GAAGF,OAAO,CAACG,YAAY,GAAG,KAAK,CAAC;AACtD,MAAMC,WAAW,GAAGC,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAMC,SAAS,GAAGD,OAAO,CAAC,WAAW,CAAC;AACtC,SAASF,YAAYA,CAACF,KAAK,EAAE;EACzB,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,IAAI;EACf,CAAC,MACI,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAChC,OAAOA,KAAK;EAChB,CAAC,MACI,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAChC,IAAI,CAACM,MAAM,CAACC,QAAQ,CAACP,KAAK,CAAC,EAAE;MACzB,MAAM,IAAIQ,UAAU,CAAC,sEAAsE,CAAC;IAChG;IACA,OAA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