@prisma/orm-target-mongo 8.0.0-rc.2-dev.2 → 8.0.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/dist/adapter.d.mts +2 -2
- package/dist/adapter.d.mts.map +1 -1
- package/dist/adapter.mjs +3 -3
- package/dist/adapter.mjs.map +1 -1
- package/dist/adapter__control.d.mts +204 -3
- package/dist/adapter__control.d.mts.map +1 -0
- package/dist/adapter__control.mjs +481 -3
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__runtime.d.mts +3 -1
- package/dist/adapter__runtime.d.mts.map +1 -1
- package/dist/adapter__runtime.mjs +5 -3
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/codec-ids-BKQbXhZt.d.mts +18 -0
- package/dist/codec-ids-BKQbXhZt.d.mts.map +1 -0
- package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs +18 -0
- package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs.map +1 -0
- package/dist/codec-types-oKxM85p-.d.mts +89 -0
- package/dist/codec-types-oKxM85p-.d.mts.map +1 -0
- package/dist/codecs-B1ab7vfj-QL33tkm2.mjs +392 -0
- package/dist/codecs-B1ab7vfj-QL33tkm2.mjs.map +1 -0
- package/dist/codecs-Y5GYsLPj.d.mts +36 -0
- package/dist/codecs-Y5GYsLPj.d.mts.map +1 -0
- package/dist/control-Cq6qWohQ.mjs +2421 -0
- package/dist/control-Cq6qWohQ.mjs.map +1 -0
- package/dist/{control-CxXmTy_h.d.mts → control-CrFS8bqh.d.mts} +133 -95
- package/dist/control-CrFS8bqh.d.mts.map +1 -0
- package/dist/data-types-LShlnAUM.d.mts +25 -0
- package/dist/data-types-LShlnAUM.d.mts.map +1 -0
- package/dist/data-types-hoKLBrYZ-h9cAgbOy.mjs +624 -0
- package/dist/data-types-hoKLBrYZ-h9cAgbOy.mjs.map +1 -0
- package/dist/descriptor-meta-DTj807jv-CjvK2XDD.mjs +146 -0
- package/dist/descriptor-meta-DTj807jv-CjvK2XDD.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-BaRbjvD7-D0786_Lv.mjs +20 -0
- package/dist/descriptor-meta-runtime-BaRbjvD7-D0786_Lv.mjs.map +1 -0
- package/dist/driver.d.mts +1 -1
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.d.mts +4 -3
- package/dist/driver__control.d.mts.map +1 -1
- package/dist/driver__control.mjs +5 -2
- package/dist/driver__control.mjs.map +1 -1
- package/dist/{migration-BkqcE2Uv.d.mts → migration-C4m4Uj8E.d.mts} +15 -7
- package/dist/migration-C4m4Uj8E.d.mts.map +1 -0
- package/dist/migration-factories-BqROEHRs-CfExMr9r.mjs +406 -0
- package/dist/migration-factories-BqROEHRs-CfExMr9r.mjs.map +1 -0
- package/dist/{mongo-adapter-B2HEyX0b-CQt2HH_o.mjs → mongo-adapter-Bo6ciURK-DIMJdC7y.mjs} +37 -18
- package/dist/mongo-adapter-Bo6ciURK-DIMJdC7y.mjs.map +1 -0
- package/dist/{mongo-adapter-CjJU3S9o-BIJruFYW.d.mts → mongo-adapter-wvK2fQOZ-FswLS-PJ.d.mts} +2 -2
- package/dist/mongo-adapter-wvK2fQOZ-FswLS-PJ.d.mts.map +1 -0
- package/dist/{mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts → mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts} +9 -4
- package/dist/mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts.map +1 -0
- package/dist/{mongo-driver-CMzJAzeQ-B3Q4RoHN.mjs → mongo-driver-Cu6FP6OU-DhOzFM2D.mjs} +34 -8
- package/dist/mongo-driver-Cu6FP6OU-DhOzFM2D.mjs.map +1 -0
- package/dist/mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs +9 -0
- package/dist/mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs.map +1 -0
- package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts → op-factory-call-BoYr7vvM-CjA8nx36.d.mts} +43 -9
- package/dist/op-factory-call-BoYr7vvM-CjA8nx36.d.mts.map +1 -0
- package/dist/pack-CIfujQmd.d.mts +266 -0
- package/dist/pack-CIfujQmd.d.mts.map +1 -0
- package/dist/prisma6-binding-DhnqslLT.d.mts +54 -0
- package/dist/prisma6-binding-DhnqslLT.d.mts.map +1 -0
- package/dist/prisma6-binding-vt4tbT-Z.mjs +45 -0
- package/dist/prisma6-binding-vt4tbT-Z.mjs.map +1 -0
- package/dist/{runtime-B9_-kjBX.d.mts → runtime-DbFgyDql.d.mts} +2 -2
- package/dist/runtime-DbFgyDql.d.mts.map +1 -0
- package/dist/target.d.mts +11 -8
- package/dist/target.mjs +7 -3
- package/dist/target__codec-ids.d.mts +2 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +2 -2
- package/dist/target__codecs.d.mts +2 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__control.d.mts +3 -4
- package/dist/target__control.mjs +2 -2
- package/dist/target__data-types.d.mts +2 -0
- package/dist/target__data-types.mjs +2 -0
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__pack.d.mts +3 -2
- package/dist/target__pack.mjs +2 -2
- package/dist/target__pack.mjs.map +1 -1
- package/dist/target__prisma6-binding.d.mts +2 -0
- package/dist/target__prisma6-binding.mjs +2 -0
- package/dist/target__runtime.d.mts +1 -1
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/package.json +16 -15
- package/dist/adapter__codec-ids.d.mts +0 -12
- package/dist/adapter__codec-ids.d.mts.map +0 -1
- package/dist/adapter__codec-ids.mjs +0 -2
- package/dist/adapter__codec-types.d.mts +0 -38
- package/dist/adapter__codec-types.d.mts.map +0 -1
- package/dist/adapter__codec-types.mjs +0 -1
- package/dist/adapter__codecs.d.mts +0 -14
- package/dist/adapter__codecs.d.mts.map +0 -1
- package/dist/adapter__codecs.mjs +0 -2
- package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +0 -12
- package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +0 -1
- package/dist/codec-types-Bx2fHyq_.d.mts +0 -35
- package/dist/codec-types-Bx2fHyq_.d.mts.map +0 -1
- package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs +0 -170
- package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs.map +0 -1
- package/dist/control-CxXmTy_h.d.mts.map +0 -1
- package/dist/control-DQD76x-1.mjs +0 -437
- package/dist/control-DQD76x-1.mjs.map +0 -1
- package/dist/control-Dfe3dqw9.mjs +0 -1563
- package/dist/control-Dfe3dqw9.mjs.map +0 -1
- package/dist/control-rPM2HNxW.d.mts +0 -170
- package/dist/control-rPM2HNxW.d.mts.map +0 -1
- package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs +0 -17
- package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs.map +0 -1
- package/dist/migration-BkqcE2Uv.d.mts.map +0 -1
- package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs +0 -201
- package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs.map +0 -1
- package/dist/mongo-adapter-B2HEyX0b-CQt2HH_o.mjs.map +0 -1
- package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +0 -1
- package/dist/mongo-driver-CMzJAzeQ-B3Q4RoHN.mjs.map +0 -1
- package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts.map +0 -1
- package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map +0 -1
- package/dist/pack-MK8ZQfrL.d.mts +0 -22
- package/dist/pack-MK8ZQfrL.d.mts.map +0 -1
- package/dist/runtime-B9_-kjBX.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-ids-WdrumsYA-CZVjuKW8.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/codec-ids-WdrumsYA.mjs"],"sourcesContent":["//#region src/core/codec-ids.ts\nconst MONGO_OBJECTID_CODEC_ID = \"mongo/objectId@1\";\nconst MONGO_STRING_CODEC_ID = \"mongo/string@1\";\nconst MONGO_DOUBLE_CODEC_ID = \"mongo/double@1\";\nconst MONGO_INT32_CODEC_ID = \"mongo/int32@1\";\nconst MONGO_BOOLEAN_CODEC_ID = \"mongo/bool@1\";\nconst MONGO_DATE_CODEC_ID = \"mongo/date@1\";\nconst MONGO_VECTOR_CODEC_ID = \"mongo/vector@1\";\nconst MONGO_INT64_CODEC_ID = \"mongo/int64@1\";\nconst MONGO_INT64_NUMBER_CODEC_ID = \"mongo/int64Number@1\";\nconst MONGO_DECIMAL128_CODEC_ID = \"mongo/decimal128@1\";\nconst MONGO_BINARY_CODEC_ID = \"mongo/binary@1\";\nconst MONGO_JSON_CODEC_ID = \"mongo/json@1\";\nconst MONGO_BSON_CODEC_ID = \"mongo/bson@1\";\n//#endregion\nexport { MONGO_DECIMAL128_CODEC_ID as a, MONGO_INT64_CODEC_ID as c, MONGO_OBJECTID_CODEC_ID as d, MONGO_STRING_CODEC_ID as f, MONGO_DATE_CODEC_ID as i, MONGO_INT64_NUMBER_CODEC_ID as l, MONGO_BOOLEAN_CODEC_ID as n, MONGO_DOUBLE_CODEC_ID as o, MONGO_VECTOR_CODEC_ID as p, MONGO_BSON_CODEC_ID as r, MONGO_INT32_CODEC_ID as s, MONGO_BINARY_CODEC_ID as t, MONGO_JSON_CODEC_ID as u };\n\n//# sourceMappingURL=codec-ids-WdrumsYA.mjs.map"],"mappings":";AACA,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,uBAAuB;AAC7B,MAAM,yBAAyB;AAC/B,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,uBAAuB;AAC7B,MAAM,8BAA8B;AACpC,MAAM,4BAA4B;AAClC,MAAM,wBAAwB;AAC9B,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { JsonValue, ParameterizedOutputTypesFunction } from "@prisma/orm-framework/contract/types";
|
|
2
|
+
import { BsonInputValue, BsonInputValue as BsonInputValue$1, BsonScalar, BsonValue, BsonValue as BsonValue$1 } from "@prisma/orm-family-mongo/value";
|
|
3
|
+
//#region ../../../3-targets/mongo/1-target/dist/codec-types.d.mts
|
|
4
|
+
//#region src/exports/codec-types.d.ts
|
|
5
|
+
type Vector<N extends number = number> = readonly number[] & {
|
|
6
|
+
readonly __vectorLength?: N;
|
|
7
|
+
};
|
|
8
|
+
type CodecTypes = {
|
|
9
|
+
readonly 'mongo/objectId@1': {
|
|
10
|
+
readonly input: string;
|
|
11
|
+
readonly output: string;
|
|
12
|
+
readonly traits: 'equality';
|
|
13
|
+
};
|
|
14
|
+
readonly 'mongo/string@1': {
|
|
15
|
+
readonly input: string;
|
|
16
|
+
readonly output: string;
|
|
17
|
+
readonly traits: 'equality' | 'order' | 'textual';
|
|
18
|
+
};
|
|
19
|
+
readonly 'mongo/double@1': {
|
|
20
|
+
readonly input: number;
|
|
21
|
+
readonly output: number;
|
|
22
|
+
readonly traits: 'equality' | 'order' | 'numeric';
|
|
23
|
+
};
|
|
24
|
+
readonly 'mongo/int32@1': {
|
|
25
|
+
readonly input: number;
|
|
26
|
+
readonly output: number;
|
|
27
|
+
readonly traits: 'equality' | 'order' | 'numeric';
|
|
28
|
+
};
|
|
29
|
+
readonly 'mongo/bool@1': {
|
|
30
|
+
readonly input: boolean;
|
|
31
|
+
readonly output: boolean;
|
|
32
|
+
readonly traits: 'equality' | 'boolean';
|
|
33
|
+
};
|
|
34
|
+
readonly 'mongo/date@1': {
|
|
35
|
+
readonly input: Date;
|
|
36
|
+
readonly output: Date;
|
|
37
|
+
readonly traits: 'equality' | 'order';
|
|
38
|
+
};
|
|
39
|
+
readonly 'mongo/vector@1': {
|
|
40
|
+
readonly input: readonly number[];
|
|
41
|
+
readonly output: readonly number[];
|
|
42
|
+
readonly traits: 'equality';
|
|
43
|
+
};
|
|
44
|
+
readonly 'mongo/int64@1': {
|
|
45
|
+
readonly input: bigint;
|
|
46
|
+
readonly output: bigint;
|
|
47
|
+
readonly traits: 'equality' | 'order' | 'numeric';
|
|
48
|
+
};
|
|
49
|
+
readonly 'mongo/int64Number@1': {
|
|
50
|
+
readonly input: number;
|
|
51
|
+
readonly output: number;
|
|
52
|
+
readonly traits: 'equality' | 'order' | 'numeric';
|
|
53
|
+
};
|
|
54
|
+
readonly 'mongo/decimal128@1': {
|
|
55
|
+
readonly input: string;
|
|
56
|
+
readonly output: string;
|
|
57
|
+
readonly traits: 'equality' | 'order' | 'numeric';
|
|
58
|
+
readonly keepsWrittenForm: true;
|
|
59
|
+
};
|
|
60
|
+
readonly 'mongo/binary@1': {
|
|
61
|
+
readonly input: Uint8Array;
|
|
62
|
+
readonly output: Uint8Array;
|
|
63
|
+
readonly traits: 'equality';
|
|
64
|
+
};
|
|
65
|
+
readonly 'mongo/json@1': {
|
|
66
|
+
readonly input: JsonValue;
|
|
67
|
+
readonly output: JsonValue;
|
|
68
|
+
readonly traits: never;
|
|
69
|
+
};
|
|
70
|
+
readonly 'mongo/bson@1': {
|
|
71
|
+
readonly input: BsonInputValue;
|
|
72
|
+
readonly output: BsonValue;
|
|
73
|
+
readonly traits: never;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
type OutputTypeMap<TypeParams> = {
|
|
77
|
+
readonly 'mongo/vector@1': TypeParams extends {
|
|
78
|
+
readonly length: infer N extends number;
|
|
79
|
+
} ? Vector<N> : never;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The output type of a vector field with a `length` type parameter, `Vector<N>`: the only declaration of it, which a contract written with `defineContract` and the `contract.d.ts` that `prisma contract emit` writes both apply.
|
|
83
|
+
*/
|
|
84
|
+
interface ParameterizedOutputTypesForTypeParams extends ParameterizedOutputTypesFunction {
|
|
85
|
+
readonly outputTypes: OutputTypeMap<this['typeParams']>;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { ParameterizedOutputTypesForTypeParams as a, CodecTypes as i, BsonScalar as n, Vector as o, BsonValue$1 as r, BsonInputValue$1 as t };
|
|
89
|
+
//# sourceMappingURL=codec-types-oKxM85p-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-oKxM85p-.d.mts","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/codec-types.d.mts"],"mappings":";;;;KAGK,OAAO;WACD,iBAAiB;;KAEvB;WACM;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;;KAGR,cAAc;WACR,kBAAkB;aAChB,cAAc;MACrB,OAAO;;;;;UAKH,8CAA8C;WAC7C,aAAa"}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, p as MONGO_VECTOR_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from "./codec-ids-WdrumsYA-CZVjuKW8.mjs";
|
|
2
|
+
import { t as mongoTargetError } from "./mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs";
|
|
3
|
+
import { $ as where, B as mongoInt32, C as int64Decode, D as int64NumberFromDigits, E as int64NumberEncode, F as mongoBson, H as mongoJson, J as objectIdEncode, K as mongoVector, L as mongoDate, M as isPlainObject, N as mongoBinary, O as int64NumberToJson, P as mongoBool, Q as vectorEncode, R as mongoDecimal128, S as int32ToJson, T as int64NumberDecode, U as mongoObjectId, V as mongoInt64, W as mongoString, X as readBsonJson, Y as objectIdToJson, Z as stringEncode, _ as decimal128ToJson, a as booleanEncode, b as encodeBsonValue, c as bsonTypeTag, d as dateEncode, f as dateToJson, h as decimal128Encode, i as binaryToBase64, j as isPlainArray, k as int64ToJson, l as child, m as decimal128Decode, n as binaryEncode, o as bsonClassTag, p as dbRefEntries, r as binaryFromBase64, s as bsonToJson, t as binaryDecode, u as constructorName, v as decodeBsonValue, w as int64Encode, x as int32Encode, y as doubleEncode, z as mongoDouble } from "./data-types-hoKLBrYZ-h9cAgbOy.mjs";
|
|
4
|
+
import { decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, readJsonFloat, renderTsLiteral } from "@prisma/orm-framework/components/codec";
|
|
5
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
|
+
import { mongoCodec, newMongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
|
|
7
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
8
|
+
//#region ../../../3-targets/mongo/1-target/dist/codecs-B1ab7vfj.mjs
|
|
9
|
+
const BSON_TYPE_BY_TAG = {
|
|
10
|
+
ObjectId: "objectId",
|
|
11
|
+
Decimal128: "decimal",
|
|
12
|
+
Binary: "binData",
|
|
13
|
+
BSONRegExp: "regex",
|
|
14
|
+
Timestamp: "timestamp",
|
|
15
|
+
BSONSymbol: "symbol",
|
|
16
|
+
Code: "javascript",
|
|
17
|
+
MinKey: "minKey",
|
|
18
|
+
MaxKey: "maxKey"
|
|
19
|
+
};
|
|
20
|
+
const NOT_FINITE_FIX = "JSON has no NaN or Infinity; store null or a string, or declare the field Bson.";
|
|
21
|
+
const BSON_FIX = "Declare the field Bson to store BSON values.";
|
|
22
|
+
const PLAIN_VALUE_FIX = "Convert it to a plain object or array.";
|
|
23
|
+
const ENCODE_FIX_BY_RECEIVED = {
|
|
24
|
+
Date: "Store the date as an ISO 8601 string, or declare the field Bson.",
|
|
25
|
+
bigint: "Store it as a number in the safe-integer range or as decimal text, or declare the field Int64 or Bson.",
|
|
26
|
+
NaN: NOT_FINITE_FIX,
|
|
27
|
+
Infinity: NOT_FINITE_FIX,
|
|
28
|
+
"-Infinity": NOT_FINITE_FIX,
|
|
29
|
+
undefined: "Leave the key out, or store null.",
|
|
30
|
+
Uint8Array: "Store the bytes as a base64 string, or declare the field Binary or Bson.",
|
|
31
|
+
Buffer: "Store the bytes as a base64 string, or declare the field Binary or Bson.",
|
|
32
|
+
Binary: "Store the bytes as a base64 string, or declare the field Binary or Bson.",
|
|
33
|
+
ObjectId: "Store its hex string, or declare the field ObjectId or Bson.",
|
|
34
|
+
Long: "Store a number in the safe-integer range or decimal text, or declare the field Int64 or Bson.",
|
|
35
|
+
Decimal128: "Store the decimal text, or declare the field Decimal128 or Bson.",
|
|
36
|
+
Int32: "Pass a plain number.",
|
|
37
|
+
Double: "Pass a plain number.",
|
|
38
|
+
RegExp: "Store the pattern as a string, or declare the field Bson.",
|
|
39
|
+
BSONRegExp: "Store the pattern as a string, or declare the field Bson.",
|
|
40
|
+
symbol: "Store a string instead.",
|
|
41
|
+
function: "Store data, not a function.",
|
|
42
|
+
"circular reference": "Remove the cycle; a JSON value is a tree.",
|
|
43
|
+
"sparse array hole": "Fill the hole with null.",
|
|
44
|
+
DBRef: "Write it as a { $ref, $id } document instead."
|
|
45
|
+
};
|
|
46
|
+
function encodeFix(received) {
|
|
47
|
+
return ENCODE_FIX_BY_RECEIVED[received] ?? (Object.hasOwn(BSON_TYPE_BY_TAG, received) ? BSON_FIX : PLAIN_VALUE_FIX);
|
|
48
|
+
}
|
|
49
|
+
function encodeRefused(received, path) {
|
|
50
|
+
throw mongoTargetError("RUNTIME.ENCODE_FAILED", `${MONGO_JSON_CODEC_ID} value must be a JSON value; received ${received} at ${where(path)}. ${encodeFix(received)}`, { meta: {
|
|
51
|
+
codecId: MONGO_JSON_CODEC_ID,
|
|
52
|
+
received,
|
|
53
|
+
valuePath: path
|
|
54
|
+
} });
|
|
55
|
+
}
|
|
56
|
+
function describeNonJson(value) {
|
|
57
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return void 0;
|
|
58
|
+
if (typeof value === "number") return Number.isFinite(value) ? void 0 : String(value);
|
|
59
|
+
if (typeof value !== "object") return typeof value;
|
|
60
|
+
const tag = bsonTypeTag(value);
|
|
61
|
+
if (tag !== void 0) return tag;
|
|
62
|
+
if (value instanceof Date) return "Date";
|
|
63
|
+
if (isPlainArray(value)) return void 0;
|
|
64
|
+
return isPlainObject(value) ? void 0 : constructorName(value);
|
|
65
|
+
}
|
|
66
|
+
function assertJsonValue(value, path, ancestors) {
|
|
67
|
+
const received = describeNonJson(value);
|
|
68
|
+
if (received !== void 0) encodeRefused(received, path);
|
|
69
|
+
if (typeof value !== "object" || value === null) return;
|
|
70
|
+
if (ancestors.has(value)) encodeRefused("circular reference", path);
|
|
71
|
+
ancestors.add(value);
|
|
72
|
+
if (Array.isArray(value)) for (let index = 0; index < value.length; index++) {
|
|
73
|
+
if (!(index in value)) encodeRefused("sparse array hole", child(path, index));
|
|
74
|
+
assertJsonValue(value[index], child(path, index), ancestors);
|
|
75
|
+
}
|
|
76
|
+
else for (const [key, entry] of Object.entries(value)) assertJsonValue(entry, child(path, key), ancestors);
|
|
77
|
+
ancestors.delete(value);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns `value` unchanged when it is a plain JSON value at every depth, and throws `RUNTIME.ENCODE_FAILED` naming the first value that is not, with its path.
|
|
81
|
+
*/
|
|
82
|
+
function encodeJsonValue(value) {
|
|
83
|
+
assertJsonValue(value, "", /* @__PURE__ */ new Set());
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
function decodeRefused(bsonType, path) {
|
|
87
|
+
throw mongoTargetError("RUNTIME.DECODE_FAILED", `${MONGO_JSON_CODEC_ID} wire value contains a non-JSON BSON ${bsonType} at ${where(path)}`, { meta: {
|
|
88
|
+
codecId: MONGO_JSON_CODEC_ID,
|
|
89
|
+
received: bsonType,
|
|
90
|
+
valuePath: path
|
|
91
|
+
} });
|
|
92
|
+
}
|
|
93
|
+
function safeLong(value, path) {
|
|
94
|
+
const number = Number(value);
|
|
95
|
+
return Number.isSafeInteger(number) && BigInt(number) === value ? number : decodeRefused("long", path);
|
|
96
|
+
}
|
|
97
|
+
function finiteDouble(value, path) {
|
|
98
|
+
if (Number.isFinite(value)) return value;
|
|
99
|
+
const received = String(value);
|
|
100
|
+
throw mongoTargetError("RUNTIME.DECODE_FAILED", `${MONGO_JSON_CODEC_ID} wire value contains ${received} at ${where(path)}; a JSON number cannot be NaN or Infinity`, { meta: {
|
|
101
|
+
codecId: MONGO_JSON_CODEC_ID,
|
|
102
|
+
received,
|
|
103
|
+
valuePath: path
|
|
104
|
+
} });
|
|
105
|
+
}
|
|
106
|
+
function decodeEntries(entries, path) {
|
|
107
|
+
return Object.fromEntries(entries.map(([key, entry]) => [key, decodeValue(entry, child(path, key))]));
|
|
108
|
+
}
|
|
109
|
+
function decodeTagged(value, tag, path) {
|
|
110
|
+
switch (tag) {
|
|
111
|
+
case "DBRef": return decodeEntries(dbRefEntries(value), path);
|
|
112
|
+
case "Long": return safeLong(blindCast(value).toBigInt(), path);
|
|
113
|
+
case "Int32":
|
|
114
|
+
case "Double": return finiteDouble(Number(value.valueOf()), path);
|
|
115
|
+
}
|
|
116
|
+
return decodeRefused(BSON_TYPE_BY_TAG[tag] ?? tag, path);
|
|
117
|
+
}
|
|
118
|
+
function decodeValue(value, path) {
|
|
119
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
120
|
+
if (typeof value === "number") return finiteDouble(value, path);
|
|
121
|
+
if (typeof value === "bigint") return safeLong(value, path);
|
|
122
|
+
if (typeof value === "undefined") return decodeRefused("undefined", path);
|
|
123
|
+
if (typeof value === "symbol") return decodeRefused("symbol", path);
|
|
124
|
+
if (typeof value === "function") return decodeRefused("javascript", path);
|
|
125
|
+
const tag = bsonClassTag(value);
|
|
126
|
+
if (tag !== void 0) return decodeTagged(value, tag, path);
|
|
127
|
+
if (value instanceof Date) return decodeRefused("date", path);
|
|
128
|
+
if (value instanceof RegExp) return decodeRefused("regex", path);
|
|
129
|
+
if (value instanceof Uint8Array) return decodeRefused("binData", path);
|
|
130
|
+
if (Array.isArray(value)) {
|
|
131
|
+
const decoded = value.map((entry, index) => decodeValue(entry, child(path, index)));
|
|
132
|
+
return decoded.some((entry, index) => entry !== value[index]) ? decoded : value;
|
|
133
|
+
}
|
|
134
|
+
if (!isPlainObject(value)) return decodeRefused(constructorName(value), path);
|
|
135
|
+
const entries = Object.entries(value);
|
|
136
|
+
const decoded = decodeEntries(entries, path);
|
|
137
|
+
return entries.some(([key, entry]) => decoded[key] !== entry) ? decoded : blindCast(value);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Decodes a wire value to the JSON value it holds: a `long` in the safe-integer range and the driver's `Int32` and `Double` wrappers become numbers. Only the objects and arrays around a converted value are copied; a wire value that is already JSON is returned as the same object. Throws `RUNTIME.DECODE_FAILED` naming the BSON type and path of the first value that is not JSON.
|
|
141
|
+
*/
|
|
142
|
+
function decodeJsonValue(wire) {
|
|
143
|
+
return decodeValue(wire, "");
|
|
144
|
+
}
|
|
145
|
+
const mongoObjectIdCodec = mongoCodec({
|
|
146
|
+
typeId: MONGO_OBJECTID_CODEC_ID,
|
|
147
|
+
dataType: mongoObjectId,
|
|
148
|
+
fromWire: (wire) => wire.toHexString(),
|
|
149
|
+
toWire: (value) => objectIdEncode(MONGO_OBJECTID_CODEC_ID, value),
|
|
150
|
+
toDataTypeValue: (value) => mongoObjectId.valueFrom(objectIdToJson(MONGO_OBJECTID_CODEC_ID, value), {}),
|
|
151
|
+
fromDataTypeValue: (value) => value.value
|
|
152
|
+
});
|
|
153
|
+
const mongoStringCodec = mongoCodec({
|
|
154
|
+
typeId: MONGO_STRING_CODEC_ID,
|
|
155
|
+
dataType: mongoString,
|
|
156
|
+
fromWire: (wire) => wire,
|
|
157
|
+
toWire: (value) => stringEncode(MONGO_STRING_CODEC_ID, value),
|
|
158
|
+
fromDataTypeValue: (value) => value.value
|
|
159
|
+
});
|
|
160
|
+
const mongoDoubleCodec = mongoCodec({
|
|
161
|
+
typeId: MONGO_DOUBLE_CODEC_ID,
|
|
162
|
+
dataType: mongoDouble,
|
|
163
|
+
fromWire: (wire) => Number(wire),
|
|
164
|
+
toWire: (value) => doubleEncode(MONGO_DOUBLE_CODEC_ID, value),
|
|
165
|
+
toDataTypeValue: (value) => mongoDouble.valueFrom(floatToJson(value), {}),
|
|
166
|
+
fromDataTypeValue: (value) => readJsonFloat(MONGO_DOUBLE_CODEC_ID, value.value)
|
|
167
|
+
});
|
|
168
|
+
const mongoInt32Codec = mongoCodec({
|
|
169
|
+
typeId: MONGO_INT32_CODEC_ID,
|
|
170
|
+
dataType: mongoInt32,
|
|
171
|
+
fromWire: (wire) => wire,
|
|
172
|
+
toWire: (value) => int32Encode(MONGO_INT32_CODEC_ID, value),
|
|
173
|
+
toDataTypeValue: (value) => mongoInt32.valueFrom(int32ToJson(MONGO_INT32_CODEC_ID, value), {}),
|
|
174
|
+
fromDataTypeValue: (value) => value.value
|
|
175
|
+
});
|
|
176
|
+
const mongoBooleanCodec = mongoCodec({
|
|
177
|
+
typeId: MONGO_BOOLEAN_CODEC_ID,
|
|
178
|
+
dataType: mongoBool,
|
|
179
|
+
fromWire: (wire) => wire,
|
|
180
|
+
toWire: (value) => booleanEncode(MONGO_BOOLEAN_CODEC_ID, value),
|
|
181
|
+
fromDataTypeValue: (value) => value.value
|
|
182
|
+
});
|
|
183
|
+
const mongoDateCodec = mongoCodec({
|
|
184
|
+
typeId: MONGO_DATE_CODEC_ID,
|
|
185
|
+
dataType: mongoDate,
|
|
186
|
+
fromWire: (wire) => wire,
|
|
187
|
+
toWire: (value) => dateEncode(MONGO_DATE_CODEC_ID, value),
|
|
188
|
+
toDataTypeValue: (value) => mongoDate.valueFrom(dateToJson(MONGO_DATE_CODEC_ID, value), {}),
|
|
189
|
+
fromDataTypeValue: (value) => new Date(value.value)
|
|
190
|
+
});
|
|
191
|
+
/** The vector codec for a column of `mongo/vector` with `params`. The dimension reaches only the TypeScript type `Vector<n>`. */
|
|
192
|
+
function vectorCodec(params) {
|
|
193
|
+
return mongoCodec({
|
|
194
|
+
typeId: MONGO_VECTOR_CODEC_ID,
|
|
195
|
+
dataType: mongoVector,
|
|
196
|
+
...ifDefined("params", params),
|
|
197
|
+
fromWire: (wire) => wire,
|
|
198
|
+
toWire: (value) => vectorEncode(MONGO_VECTOR_CODEC_ID, value),
|
|
199
|
+
fromDataTypeValue: (value) => value.value
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
const mongoVectorCodec = vectorCodec();
|
|
203
|
+
/**
|
|
204
|
+
* A BSON `long`. The application value is a `bigint`, because a `number` cannot hold the full 64-bit range; its stored form is decimal text.
|
|
205
|
+
*/
|
|
206
|
+
const mongoInt64Codec = mongoCodec({
|
|
207
|
+
typeId: MONGO_INT64_CODEC_ID,
|
|
208
|
+
dataType: mongoInt64,
|
|
209
|
+
fromWire: (wire) => int64Decode(MONGO_INT64_CODEC_ID, wire),
|
|
210
|
+
toWire: (value) => int64Encode(MONGO_INT64_CODEC_ID, value),
|
|
211
|
+
toDataTypeValue: (value) => mongoInt64.valueFrom(int64ToJson(MONGO_INT64_CODEC_ID, value), {}),
|
|
212
|
+
fromDataTypeValue: (value) => BigInt(value.value)
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* A BSON `long` read and written as a `number` from -(2^53 - 1) to 2^53 - 1, the value a Prisma 6 `Int` presents. A value outside that range, or with a fraction, is refused rather than rounded.
|
|
216
|
+
*/
|
|
217
|
+
const mongoInt64NumberCodec = mongoCodec({
|
|
218
|
+
typeId: MONGO_INT64_NUMBER_CODEC_ID,
|
|
219
|
+
dataType: mongoInt64,
|
|
220
|
+
fromWire: (wire) => int64NumberDecode(MONGO_INT64_NUMBER_CODEC_ID, wire),
|
|
221
|
+
toWire: (value) => int64NumberEncode(MONGO_INT64_NUMBER_CODEC_ID, value),
|
|
222
|
+
toDataTypeValue: (value) => mongoInt64.valueFrom(int64NumberToJson(MONGO_INT64_NUMBER_CODEC_ID, value), {}),
|
|
223
|
+
fromDataTypeValue: (value) => int64NumberFromDigits(MONGO_INT64_NUMBER_CODEC_ID, value.value)
|
|
224
|
+
});
|
|
225
|
+
/**
|
|
226
|
+
* A BSON `decimal`. The application value and its stored form are the same decimal text, written without an exponent.
|
|
227
|
+
*/
|
|
228
|
+
const mongoDecimal128Codec = mongoCodec({
|
|
229
|
+
typeId: MONGO_DECIMAL128_CODEC_ID,
|
|
230
|
+
dataType: mongoDecimal128,
|
|
231
|
+
fromWire: (wire) => decimal128Decode(MONGO_DECIMAL128_CODEC_ID, wire),
|
|
232
|
+
toWire: (value) => decimal128Encode(MONGO_DECIMAL128_CODEC_ID, value),
|
|
233
|
+
toDataTypeValue: (value) => mongoDecimal128.valueFrom(decimal128ToJson(MONGO_DECIMAL128_CODEC_ID, value), {}),
|
|
234
|
+
fromDataTypeValue: (value) => value.value
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* BSON `binData`. The application value is a `Uint8Array`; its stored form is unwrapped base64.
|
|
238
|
+
*/
|
|
239
|
+
const mongoBinaryCodec = mongoCodec({
|
|
240
|
+
typeId: MONGO_BINARY_CODEC_ID,
|
|
241
|
+
dataType: mongoBinary,
|
|
242
|
+
fromWire: (wire) => binaryDecode(MONGO_BINARY_CODEC_ID, wire),
|
|
243
|
+
toWire: (value) => binaryEncode(MONGO_BINARY_CODEC_ID, value),
|
|
244
|
+
toDataTypeValue: (value) => mongoBinary.valueFrom(binaryToBase64(value), {}),
|
|
245
|
+
fromDataTypeValue: (value) => binaryFromBase64(value.value)
|
|
246
|
+
});
|
|
247
|
+
/**
|
|
248
|
+
* A JSON value, stored as the BSON object, array, string, number, boolean or null it maps to. Encode and decode refuse any other value at any depth, naming its path.
|
|
249
|
+
*/
|
|
250
|
+
const mongoJsonCodec = mongoCodec({
|
|
251
|
+
typeId: MONGO_JSON_CODEC_ID,
|
|
252
|
+
dataType: mongoJson,
|
|
253
|
+
fromWire: (wire) => decodeJsonValue(wire),
|
|
254
|
+
toWire: (value) => encodeJsonValue(value)
|
|
255
|
+
});
|
|
256
|
+
/**
|
|
257
|
+
* Any BSON value, passed through unchanged except that decode turns a `DBRef` back into the `{ $ref, $id }` document it was stored as. Encode takes a `BsonInputValue` and decode returns a `BsonValue`. Its stored form is canonical MongoDB Extended JSON v2, written with each number and `Uint8Array` as the BSON type the driver stores, so a round trip keeps the BSON bytes but may return wrapper classes such as `Int32` and `Double`.
|
|
258
|
+
*/
|
|
259
|
+
const mongoBsonCodec = mongoCodec({
|
|
260
|
+
typeId: MONGO_BSON_CODEC_ID,
|
|
261
|
+
dataType: mongoBson,
|
|
262
|
+
fromWire: (wire) => decodeBsonValue(wire),
|
|
263
|
+
toWire: (value) => encodeBsonValue(value),
|
|
264
|
+
toDataTypeValue: (value) => mongoBson.valueFrom(bsonToJson(value), {}),
|
|
265
|
+
fromDataTypeValue: (value) => readBsonJson(MONGO_BSON_CODEC_ID, value.value)
|
|
266
|
+
});
|
|
267
|
+
/**
|
|
268
|
+
* The canonical set of Mongo wire-type codecs.
|
|
269
|
+
*
|
|
270
|
+
* Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.
|
|
271
|
+
*/
|
|
272
|
+
const mongoStandardCodecs = [
|
|
273
|
+
mongoObjectIdCodec,
|
|
274
|
+
mongoStringCodec,
|
|
275
|
+
mongoDoubleCodec,
|
|
276
|
+
mongoInt32Codec,
|
|
277
|
+
mongoBooleanCodec,
|
|
278
|
+
mongoDateCodec,
|
|
279
|
+
mongoVectorCodec,
|
|
280
|
+
mongoInt64Codec,
|
|
281
|
+
mongoInt64NumberCodec,
|
|
282
|
+
mongoDecimal128Codec,
|
|
283
|
+
mongoBinaryCodec,
|
|
284
|
+
mongoJsonCodec,
|
|
285
|
+
mongoBsonCodec
|
|
286
|
+
];
|
|
287
|
+
/**
|
|
288
|
+
* Build a {@link CodecDescriptor} for a Mongo wire-type codec.
|
|
289
|
+
*
|
|
290
|
+
* Wraps an existing {@link MongoCodec} instance into a descriptor whose factory hands out the same shared codec, or, for a codec whose data type has parameters, one built for the column's parameters. Mongo's full migration to descriptor-first authoring is tracked under TML-2324; for now the descriptor view is composed from the existing `mongoCodec()` outputs.
|
|
291
|
+
*/
|
|
292
|
+
function descriptorFor(codec, metadata) {
|
|
293
|
+
return {
|
|
294
|
+
codecId: codec.id,
|
|
295
|
+
dataType: codec.dataType.id,
|
|
296
|
+
traits: metadata.traits,
|
|
297
|
+
paramsSchema: blindCast(codec.dataType.params),
|
|
298
|
+
isParameterized: codec.dataType.params !== void 0,
|
|
299
|
+
factory: blindCast((params) => {
|
|
300
|
+
const built = metadata.withParams === void 0 || params === void 0 ? codec : metadata.withParams(params);
|
|
301
|
+
return () => built;
|
|
302
|
+
}),
|
|
303
|
+
...ifDefined("renderValueLiteral", metadata.renderValueLiteral),
|
|
304
|
+
...ifDefined("keepsWrittenForm", metadata.keepsWrittenForm)
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Mongo wire-type codec descriptors. Static metadata such as `traits` lives here (the descriptor shape) — `MongoCodec` itself carries its data type and the four conversion methods (TML-2357).
|
|
309
|
+
*/
|
|
310
|
+
const mongoCodecDescriptors = [
|
|
311
|
+
descriptorFor(mongoObjectIdCodec, { traits: ["equality"] }),
|
|
312
|
+
descriptorFor(mongoStringCodec, {
|
|
313
|
+
traits: [
|
|
314
|
+
"equality",
|
|
315
|
+
"order",
|
|
316
|
+
"textual"
|
|
317
|
+
],
|
|
318
|
+
renderValueLiteral: renderTsLiteral
|
|
319
|
+
}),
|
|
320
|
+
descriptorFor(mongoDoubleCodec, {
|
|
321
|
+
traits: [
|
|
322
|
+
"equality",
|
|
323
|
+
"order",
|
|
324
|
+
"numeric"
|
|
325
|
+
],
|
|
326
|
+
renderValueLiteral: floatNumberLiteral
|
|
327
|
+
}),
|
|
328
|
+
descriptorFor(mongoInt32Codec, {
|
|
329
|
+
traits: [
|
|
330
|
+
"equality",
|
|
331
|
+
"order",
|
|
332
|
+
"numeric"
|
|
333
|
+
],
|
|
334
|
+
renderValueLiteral: renderTsLiteral
|
|
335
|
+
}),
|
|
336
|
+
descriptorFor(mongoBooleanCodec, {
|
|
337
|
+
traits: ["equality", "boolean"],
|
|
338
|
+
renderValueLiteral: renderTsLiteral
|
|
339
|
+
}),
|
|
340
|
+
descriptorFor(mongoDateCodec, { traits: ["equality", "order"] }),
|
|
341
|
+
descriptorFor(mongoVectorCodec, {
|
|
342
|
+
traits: ["equality"],
|
|
343
|
+
withParams: vectorCodec
|
|
344
|
+
}),
|
|
345
|
+
descriptorFor(mongoInt64Codec, {
|
|
346
|
+
traits: [
|
|
347
|
+
"equality",
|
|
348
|
+
"order",
|
|
349
|
+
"numeric"
|
|
350
|
+
],
|
|
351
|
+
renderValueLiteral: decimalTextBigintLiteral
|
|
352
|
+
}),
|
|
353
|
+
descriptorFor(mongoInt64NumberCodec, {
|
|
354
|
+
traits: [
|
|
355
|
+
"equality",
|
|
356
|
+
"order",
|
|
357
|
+
"numeric"
|
|
358
|
+
],
|
|
359
|
+
renderValueLiteral: decimalTextNumberLiteral
|
|
360
|
+
}),
|
|
361
|
+
descriptorFor(mongoDecimal128Codec, {
|
|
362
|
+
traits: [
|
|
363
|
+
"equality",
|
|
364
|
+
"order",
|
|
365
|
+
"numeric"
|
|
366
|
+
],
|
|
367
|
+
keepsWrittenForm: true
|
|
368
|
+
}),
|
|
369
|
+
descriptorFor(mongoBinaryCodec, { traits: ["equality"] }),
|
|
370
|
+
descriptorFor(mongoJsonCodec, { traits: [] }),
|
|
371
|
+
descriptorFor(mongoBsonCodec, { traits: [] })
|
|
372
|
+
];
|
|
373
|
+
/**
|
|
374
|
+
* Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.
|
|
375
|
+
*/
|
|
376
|
+
function mongoDescriptorById(codecId) {
|
|
377
|
+
return mongoCodecDescriptors.find((d) => d.codecId === codecId);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.
|
|
381
|
+
*
|
|
382
|
+
* Single point of truth for adapter-side codec construction: used by the legacy synchronous `createMongoAdapter()` factory and by the runtime adapter descriptor's `codecs()` getter. Userland code obtains a registry via the framework's execution-stack composition (see `createMongoExecutionContext`) instead of calling this directly.
|
|
383
|
+
*/
|
|
384
|
+
function buildStandardCodecRegistry() {
|
|
385
|
+
const registry = newMongoCodecRegistry();
|
|
386
|
+
for (const codec of mongoStandardCodecs) registry.register(codec);
|
|
387
|
+
return registry;
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
export { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };
|
|
391
|
+
|
|
392
|
+
//# sourceMappingURL=codecs-B1ab7vfj-QL33tkm2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs-B1ab7vfj-QL33tkm2.mjs","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/codecs-B1ab7vfj.mjs"],"sourcesContent":["import { a as MONGO_DECIMAL128_CODEC_ID, c as MONGO_INT64_CODEC_ID, d as MONGO_OBJECTID_CODEC_ID, f as MONGO_STRING_CODEC_ID, i as MONGO_DATE_CODEC_ID, l as MONGO_INT64_NUMBER_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_DOUBLE_CODEC_ID, p as MONGO_VECTOR_CODEC_ID, r as MONGO_BSON_CODEC_ID, s as MONGO_INT32_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_JSON_CODEC_ID } from \"./codec-ids-WdrumsYA.mjs\";\nimport { t as mongoTargetError } from \"./mongo-target-errors-Btf3ML1w.mjs\";\nimport { $ as vectorEncode, A as binaryFromBase64, B as int32Encode, C as constructorName, D as where, E as isPlainObject, F as decimal128Decode, G as int64NumberEncode, H as int64Decode, I as decimal128Encode, J as int64ToJson, K as int64NumberFromDigits, M as booleanEncode, N as dateEncode, O as binaryDecode, P as dateToJson, Q as stringEncode, R as decimal128ToJson, S as child, T as isPlainArray, U as int64Encode, V as int32ToJson, W as int64NumberDecode, X as objectIdEncode, Z as objectIdToJson, _ as decodeBsonValue, a as mongoDate, b as bsonClassTag, c as mongoInt32, d as mongoObjectId, f as mongoString, g as bsonToJson, j as binaryToBase64, k as binaryEncode, l as mongoInt64, m as mongoVector, n as mongoBool, o as mongoDecimal128, q as int64NumberToJson, r as mongoBson, s as mongoDouble, t as mongoBinary, u as mongoJson, v as encodeBsonValue, w as dbRefEntries, x as bsonTypeTag, y as readBsonJson, z as doubleEncode } from \"./data-types-hoKLBrYZ.mjs\";\nimport { decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, readJsonFloat, renderTsLiteral } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { mongoCodec, newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/json-codec-helpers.ts\nconst BSON_TYPE_BY_TAG = {\n\tObjectId: \"objectId\",\n\tDecimal128: \"decimal\",\n\tBinary: \"binData\",\n\tBSONRegExp: \"regex\",\n\tTimestamp: \"timestamp\",\n\tBSONSymbol: \"symbol\",\n\tCode: \"javascript\",\n\tMinKey: \"minKey\",\n\tMaxKey: \"maxKey\"\n};\nconst NOT_FINITE_FIX = \"JSON has no NaN or Infinity; store null or a string, or declare the field Bson.\";\nconst BSON_FIX = \"Declare the field Bson to store BSON values.\";\nconst PLAIN_VALUE_FIX = \"Convert it to a plain object or array.\";\nconst ENCODE_FIX_BY_RECEIVED = {\n\tDate: \"Store the date as an ISO 8601 string, or declare the field Bson.\",\n\tbigint: \"Store it as a number in the safe-integer range or as decimal text, or declare the field Int64 or Bson.\",\n\tNaN: NOT_FINITE_FIX,\n\tInfinity: NOT_FINITE_FIX,\n\t\"-Infinity\": NOT_FINITE_FIX,\n\tundefined: \"Leave the key out, or store null.\",\n\tUint8Array: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tBuffer: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tBinary: \"Store the bytes as a base64 string, or declare the field Binary or Bson.\",\n\tObjectId: \"Store its hex string, or declare the field ObjectId or Bson.\",\n\tLong: \"Store a number in the safe-integer range or decimal text, or declare the field Int64 or Bson.\",\n\tDecimal128: \"Store the decimal text, or declare the field Decimal128 or Bson.\",\n\tInt32: \"Pass a plain number.\",\n\tDouble: \"Pass a plain number.\",\n\tRegExp: \"Store the pattern as a string, or declare the field Bson.\",\n\tBSONRegExp: \"Store the pattern as a string, or declare the field Bson.\",\n\tsymbol: \"Store a string instead.\",\n\tfunction: \"Store data, not a function.\",\n\t\"circular reference\": \"Remove the cycle; a JSON value is a tree.\",\n\t\"sparse array hole\": \"Fill the hole with null.\",\n\tDBRef: \"Write it as a { $ref, $id } document instead.\"\n};\nfunction encodeFix(received) {\n\treturn ENCODE_FIX_BY_RECEIVED[received] ?? (Object.hasOwn(BSON_TYPE_BY_TAG, received) ? BSON_FIX : PLAIN_VALUE_FIX);\n}\nfunction encodeRefused(received, path) {\n\tthrow mongoTargetError(\"RUNTIME.ENCODE_FAILED\", `${MONGO_JSON_CODEC_ID} value must be a JSON value; received ${received} at ${where(path)}. ${encodeFix(received)}`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived,\n\t\tvaluePath: path\n\t} });\n}\nfunction describeNonJson(value) {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return void 0;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? void 0 : String(value);\n\tif (typeof value !== \"object\") return typeof value;\n\tconst tag = bsonTypeTag(value);\n\tif (tag !== void 0) return tag;\n\tif (value instanceof Date) return \"Date\";\n\tif (isPlainArray(value)) return void 0;\n\treturn isPlainObject(value) ? void 0 : constructorName(value);\n}\nfunction assertJsonValue(value, path, ancestors) {\n\tconst received = describeNonJson(value);\n\tif (received !== void 0) encodeRefused(received, path);\n\tif (typeof value !== \"object\" || value === null) return;\n\tif (ancestors.has(value)) encodeRefused(\"circular reference\", path);\n\tancestors.add(value);\n\tif (Array.isArray(value)) for (let index = 0; index < value.length; index++) {\n\t\tif (!(index in value)) encodeRefused(\"sparse array hole\", child(path, index));\n\t\tassertJsonValue(value[index], child(path, index), ancestors);\n\t}\n\telse for (const [key, entry] of Object.entries(value)) assertJsonValue(entry, child(path, key), ancestors);\n\tancestors.delete(value);\n}\n/**\n* Returns `value` unchanged when it is a plain JSON value at every depth, and throws `RUNTIME.ENCODE_FAILED` naming the first value that is not, with its path.\n*/\nfunction encodeJsonValue(value) {\n\tassertJsonValue(value, \"\", /* @__PURE__ */ new Set());\n\treturn value;\n}\nfunction decodeRefused(bsonType, path) {\n\tthrow mongoTargetError(\"RUNTIME.DECODE_FAILED\", `${MONGO_JSON_CODEC_ID} wire value contains a non-JSON BSON ${bsonType} at ${where(path)}`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived: bsonType,\n\t\tvaluePath: path\n\t} });\n}\nfunction safeLong(value, path) {\n\tconst number = Number(value);\n\treturn Number.isSafeInteger(number) && BigInt(number) === value ? number : decodeRefused(\"long\", path);\n}\nfunction finiteDouble(value, path) {\n\tif (Number.isFinite(value)) return value;\n\tconst received = String(value);\n\tthrow mongoTargetError(\"RUNTIME.DECODE_FAILED\", `${MONGO_JSON_CODEC_ID} wire value contains ${received} at ${where(path)}; a JSON number cannot be NaN or Infinity`, { meta: {\n\t\tcodecId: MONGO_JSON_CODEC_ID,\n\t\treceived,\n\t\tvaluePath: path\n\t} });\n}\nfunction decodeEntries(entries, path) {\n\treturn Object.fromEntries(entries.map(([key, entry]) => [key, decodeValue(entry, child(path, key))]));\n}\nfunction decodeTagged(value, tag, path) {\n\tswitch (tag) {\n\t\tcase \"DBRef\": return decodeEntries(dbRefEntries(value), path);\n\t\tcase \"Long\": return safeLong(blindCast(value).toBigInt(), path);\n\t\tcase \"Int32\":\n\t\tcase \"Double\": return finiteDouble(Number(value.valueOf()), path);\n\t}\n\treturn decodeRefused(BSON_TYPE_BY_TAG[tag] ?? tag, path);\n}\nfunction decodeValue(value, path) {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return finiteDouble(value, path);\n\tif (typeof value === \"bigint\") return safeLong(value, path);\n\tif (typeof value === \"undefined\") return decodeRefused(\"undefined\", path);\n\tif (typeof value === \"symbol\") return decodeRefused(\"symbol\", path);\n\tif (typeof value === \"function\") return decodeRefused(\"javascript\", path);\n\tconst tag = bsonClassTag(value);\n\tif (tag !== void 0) return decodeTagged(value, tag, path);\n\tif (value instanceof Date) return decodeRefused(\"date\", path);\n\tif (value instanceof RegExp) return decodeRefused(\"regex\", path);\n\tif (value instanceof Uint8Array) return decodeRefused(\"binData\", path);\n\tif (Array.isArray(value)) {\n\t\tconst decoded = value.map((entry, index) => decodeValue(entry, child(path, index)));\n\t\treturn decoded.some((entry, index) => entry !== value[index]) ? decoded : value;\n\t}\n\tif (!isPlainObject(value)) return decodeRefused(constructorName(value), path);\n\tconst entries = Object.entries(value);\n\tconst decoded = decodeEntries(entries, path);\n\treturn entries.some(([key, entry]) => decoded[key] !== entry) ? decoded : blindCast(value);\n}\n/**\n* Decodes a wire value to the JSON value it holds: a `long` in the safe-integer range and the driver's `Int32` and `Double` wrappers become numbers. Only the objects and arrays around a converted value are copied; a wire value that is already JSON is returned as the same object. Throws `RUNTIME.DECODE_FAILED` naming the BSON type and path of the first value that is not JSON.\n*/\nfunction decodeJsonValue(wire) {\n\treturn decodeValue(wire, \"\");\n}\n//#endregion\n//#region src/core/codecs.ts\nconst mongoObjectIdCodec = mongoCodec({\n\ttypeId: MONGO_OBJECTID_CODEC_ID,\n\tdataType: mongoObjectId,\n\tfromWire: (wire) => wire.toHexString(),\n\ttoWire: (value) => objectIdEncode(MONGO_OBJECTID_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoObjectId.valueFrom(objectIdToJson(MONGO_OBJECTID_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoStringCodec = mongoCodec({\n\ttypeId: MONGO_STRING_CODEC_ID,\n\tdataType: mongoString,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => stringEncode(MONGO_STRING_CODEC_ID, value),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoDoubleCodec = mongoCodec({\n\ttypeId: MONGO_DOUBLE_CODEC_ID,\n\tdataType: mongoDouble,\n\tfromWire: (wire) => Number(wire),\n\ttoWire: (value) => doubleEncode(MONGO_DOUBLE_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDouble.valueFrom(floatToJson(value), {}),\n\tfromDataTypeValue: (value) => readJsonFloat(MONGO_DOUBLE_CODEC_ID, value.value)\n});\nconst mongoInt32Codec = mongoCodec({\n\ttypeId: MONGO_INT32_CODEC_ID,\n\tdataType: mongoInt32,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => int32Encode(MONGO_INT32_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt32.valueFrom(int32ToJson(MONGO_INT32_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoBooleanCodec = mongoCodec({\n\ttypeId: MONGO_BOOLEAN_CODEC_ID,\n\tdataType: mongoBool,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => booleanEncode(MONGO_BOOLEAN_CODEC_ID, value),\n\tfromDataTypeValue: (value) => value.value\n});\nconst mongoDateCodec = mongoCodec({\n\ttypeId: MONGO_DATE_CODEC_ID,\n\tdataType: mongoDate,\n\tfromWire: (wire) => wire,\n\ttoWire: (value) => dateEncode(MONGO_DATE_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDate.valueFrom(dateToJson(MONGO_DATE_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => new Date(value.value)\n});\n/** The vector codec for a column of `mongo/vector` with `params`. The dimension reaches only the TypeScript type `Vector<n>`. */\nfunction vectorCodec(params) {\n\treturn mongoCodec({\n\t\ttypeId: MONGO_VECTOR_CODEC_ID,\n\t\tdataType: mongoVector,\n\t\t...ifDefined(\"params\", params),\n\t\tfromWire: (wire) => wire,\n\t\ttoWire: (value) => vectorEncode(MONGO_VECTOR_CODEC_ID, value),\n\t\tfromDataTypeValue: (value) => value.value\n\t});\n}\nconst mongoVectorCodec = vectorCodec();\n/**\n* A BSON `long`. The application value is a `bigint`, because a `number` cannot hold the full 64-bit range; its stored form is decimal text.\n*/\nconst mongoInt64Codec = mongoCodec({\n\ttypeId: MONGO_INT64_CODEC_ID,\n\tdataType: mongoInt64,\n\tfromWire: (wire) => int64Decode(MONGO_INT64_CODEC_ID, wire),\n\ttoWire: (value) => int64Encode(MONGO_INT64_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt64.valueFrom(int64ToJson(MONGO_INT64_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => BigInt(value.value)\n});\n/**\n* A BSON `long` read and written as a `number` from -(2^53 - 1) to 2^53 - 1, the value a Prisma 6 `Int` presents. A value outside that range, or with a fraction, is refused rather than rounded.\n*/\nconst mongoInt64NumberCodec = mongoCodec({\n\ttypeId: MONGO_INT64_NUMBER_CODEC_ID,\n\tdataType: mongoInt64,\n\tfromWire: (wire) => int64NumberDecode(MONGO_INT64_NUMBER_CODEC_ID, wire),\n\ttoWire: (value) => int64NumberEncode(MONGO_INT64_NUMBER_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoInt64.valueFrom(int64NumberToJson(MONGO_INT64_NUMBER_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => int64NumberFromDigits(MONGO_INT64_NUMBER_CODEC_ID, value.value)\n});\n/**\n* A BSON `decimal`. The application value and its stored form are the same decimal text, written without an exponent.\n*/\nconst mongoDecimal128Codec = mongoCodec({\n\ttypeId: MONGO_DECIMAL128_CODEC_ID,\n\tdataType: mongoDecimal128,\n\tfromWire: (wire) => decimal128Decode(MONGO_DECIMAL128_CODEC_ID, wire),\n\ttoWire: (value) => decimal128Encode(MONGO_DECIMAL128_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoDecimal128.valueFrom(decimal128ToJson(MONGO_DECIMAL128_CODEC_ID, value), {}),\n\tfromDataTypeValue: (value) => value.value\n});\n/**\n* BSON `binData`. The application value is a `Uint8Array`; its stored form is unwrapped base64.\n*/\nconst mongoBinaryCodec = mongoCodec({\n\ttypeId: MONGO_BINARY_CODEC_ID,\n\tdataType: mongoBinary,\n\tfromWire: (wire) => binaryDecode(MONGO_BINARY_CODEC_ID, wire),\n\ttoWire: (value) => binaryEncode(MONGO_BINARY_CODEC_ID, value),\n\ttoDataTypeValue: (value) => mongoBinary.valueFrom(binaryToBase64(value), {}),\n\tfromDataTypeValue: (value) => binaryFromBase64(value.value)\n});\n/**\n* A JSON value, stored as the BSON object, array, string, number, boolean or null it maps to. Encode and decode refuse any other value at any depth, naming its path.\n*/\nconst mongoJsonCodec = mongoCodec({\n\ttypeId: MONGO_JSON_CODEC_ID,\n\tdataType: mongoJson,\n\tfromWire: (wire) => decodeJsonValue(wire),\n\ttoWire: (value) => encodeJsonValue(value)\n});\n/**\n* Any BSON value, passed through unchanged except that decode turns a `DBRef` back into the `{ $ref, $id }` document it was stored as. Encode takes a `BsonInputValue` and decode returns a `BsonValue`. Its stored form is canonical MongoDB Extended JSON v2, written with each number and `Uint8Array` as the BSON type the driver stores, so a round trip keeps the BSON bytes but may return wrapper classes such as `Int32` and `Double`.\n*/\nconst mongoBsonCodec = mongoCodec({\n\ttypeId: MONGO_BSON_CODEC_ID,\n\tdataType: mongoBson,\n\tfromWire: (wire) => decodeBsonValue(wire),\n\ttoWire: (value) => encodeBsonValue(value),\n\ttoDataTypeValue: (value) => mongoBson.valueFrom(bsonToJson(value), {}),\n\tfromDataTypeValue: (value) => readBsonJson(MONGO_BSON_CODEC_ID, value.value)\n});\n/**\n* The canonical set of Mongo wire-type codecs.\n*\n* Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.\n*/\nconst mongoStandardCodecs = [\n\tmongoObjectIdCodec,\n\tmongoStringCodec,\n\tmongoDoubleCodec,\n\tmongoInt32Codec,\n\tmongoBooleanCodec,\n\tmongoDateCodec,\n\tmongoVectorCodec,\n\tmongoInt64Codec,\n\tmongoInt64NumberCodec,\n\tmongoDecimal128Codec,\n\tmongoBinaryCodec,\n\tmongoJsonCodec,\n\tmongoBsonCodec\n];\n/**\n* Build a {@link CodecDescriptor} for a Mongo wire-type codec.\n*\n* Wraps an existing {@link MongoCodec} instance into a descriptor whose factory hands out the same shared codec, or, for a codec whose data type has parameters, one built for the column's parameters. Mongo's full migration to descriptor-first authoring is tracked under TML-2324; for now the descriptor view is composed from the existing `mongoCodec()` outputs.\n*/\nfunction descriptorFor(codec, metadata) {\n\treturn {\n\t\tcodecId: codec.id,\n\t\tdataType: codec.dataType.id,\n\t\ttraits: metadata.traits,\n\t\tparamsSchema: blindCast(codec.dataType.params),\n\t\tisParameterized: codec.dataType.params !== void 0,\n\t\tfactory: blindCast((params) => {\n\t\t\tconst built = metadata.withParams === void 0 || params === void 0 ? codec : metadata.withParams(params);\n\t\t\treturn () => built;\n\t\t}),\n\t\t...ifDefined(\"renderValueLiteral\", metadata.renderValueLiteral),\n\t\t...ifDefined(\"keepsWrittenForm\", metadata.keepsWrittenForm)\n\t};\n}\n/**\n* Mongo wire-type codec descriptors. Static metadata such as `traits` lives here (the descriptor shape) — `MongoCodec` itself carries its data type and the four conversion methods (TML-2357).\n*/\nconst mongoCodecDescriptors = [\n\tdescriptorFor(mongoObjectIdCodec, { traits: [\"equality\"] }),\n\tdescriptorFor(mongoStringCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"textual\"\n\t\t],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDoubleCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: floatNumberLiteral\n\t}),\n\tdescriptorFor(mongoInt32Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoBooleanCodec, {\n\t\ttraits: [\"equality\", \"boolean\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDateCodec, { traits: [\"equality\", \"order\"] }),\n\tdescriptorFor(mongoVectorCodec, {\n\t\ttraits: [\"equality\"],\n\t\twithParams: vectorCodec\n\t}),\n\tdescriptorFor(mongoInt64Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: decimalTextBigintLiteral\n\t}),\n\tdescriptorFor(mongoInt64NumberCodec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\trenderValueLiteral: decimalTextNumberLiteral\n\t}),\n\tdescriptorFor(mongoDecimal128Codec, {\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\tkeepsWrittenForm: true\n\t}),\n\tdescriptorFor(mongoBinaryCodec, { traits: [\"equality\"] }),\n\tdescriptorFor(mongoJsonCodec, { traits: [] }),\n\tdescriptorFor(mongoBsonCodec, { traits: [] })\n];\n/**\n* Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.\n*/\nfunction mongoDescriptorById(codecId) {\n\treturn mongoCodecDescriptors.find((d) => d.codecId === codecId);\n}\n/**\n* Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.\n*\n* Single point of truth for adapter-side codec construction: used by the legacy synchronous `createMongoAdapter()` factory and by the runtime adapter descriptor's `codecs()` getter. Userland code obtains a registry via the framework's execution-stack composition (see `createMongoExecutionContext`) instead of calling this directly.\n*/\nfunction buildStandardCodecRegistry() {\n\tconst registry = newMongoCodecRegistry();\n\tfor (const codec of mongoStandardCodecs) registry.register(codec);\n\treturn registry;\n}\n//#endregion\nexport { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };\n\n//# sourceMappingURL=codecs-B1ab7vfj.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,mBAAmB;CACxB,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,QAAQ;AACT;AACA,MAAM,iBAAiB;AACvB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,MAAM,yBAAyB;CAC9B,MAAM;CACN,QAAQ;CACR,KAAK;CACL,UAAU;CACV,aAAa;CACb,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,MAAM;CACN,YAAY;CACZ,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,QAAQ;CACR,UAAU;CACV,sBAAsB;CACtB,qBAAqB;CACrB,OAAO;AACR;AACA,SAAS,UAAU,UAAU;CAC5B,OAAO,uBAAuB,cAAc,OAAO,OAAO,kBAAkB,QAAQ,IAAI,WAAW;AACpG;AACA,SAAS,cAAc,UAAU,MAAM;CACtC,MAAM,iBAAi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A;EACD;EACA,oBAAoB;CACrB,CAAC;CACD,cAAc,uBAAuB;EACpC,QAAQ;GACP;GACA;GACA;EACD;EACA,oBAAoB;CACrB,CAAC;CACD,cAAc,sBAAsB;EACnC,QAAQ;GACP;GACA;GACA;EACD;EACA,kBAAkB;CACnB,CAAC;CACD,cAAc,kBAAkB,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC;CACxD,cAAc,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC;CAC5C,cAAc,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC7C;;;;AAIA,SAAS,oBAAoB,SAAS;CACrC,OAAO,sBAAsB,MAAM,MAAM,EAAE,YAAY,OAAO;AAC/D;;;;;;AAMA,SAAS,6BAA6B;CACrC,MAAM,WAAW,sBAAsB;CACvC,KAAK,MAAM,SAAS,qBAAqB,SAAS,SAAS,KAAK;CAChE,OAAO;AACR"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CodecDescriptor } from "@prisma/orm-framework/components/codec";
|
|
2
|
+
import { Binary, Decimal128, Double, Long, ObjectId } from "bson";
|
|
3
|
+
import { MongoCodec, MongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
|
|
4
|
+
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
5
|
+
import { BsonInputValue, BsonValue } from "@prisma/orm-family-mongo/value";
|
|
6
|
+
//#region ../../../3-targets/mongo/1-target/dist/codecs.d.mts
|
|
7
|
+
//#region src/core/codecs.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The canonical set of Mongo wire-type codecs.
|
|
10
|
+
*
|
|
11
|
+
* Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.
|
|
12
|
+
*/
|
|
13
|
+
declare const mongoStandardCodecs: readonly [MongoCodec<"mongo/objectId@1", readonly [], ObjectId, string, string>, MongoCodec<"mongo/string@1", readonly [], string, string, string>, MongoCodec<"mongo/double@1", readonly [], number | Double, number, number>, MongoCodec<"mongo/int32@1", readonly [], number, number, number>, MongoCodec<"mongo/bool@1", readonly [], boolean, boolean, boolean>, MongoCodec<"mongo/date@1", readonly [], Date, Date, Date>, MongoCodec<"mongo/vector@1", readonly [], readonly number[], readonly number[], readonly number[]>, MongoCodec<"mongo/int64@1", readonly [], number | bigint | Long, bigint, bigint>, MongoCodec<"mongo/int64Number@1", readonly [], number | bigint | Long, number, number>, MongoCodec<"mongo/decimal128@1", readonly [], Decimal128, string, string>, MongoCodec<"mongo/binary@1", readonly [], Binary | Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, MongoCodec<"mongo/json@1", readonly [], string | number | boolean | {
|
|
14
|
+
readonly [key: string]: JsonValue;
|
|
15
|
+
} | readonly JsonValue[] | null, string | number | boolean | {
|
|
16
|
+
readonly [key: string]: JsonValue;
|
|
17
|
+
} | readonly JsonValue[] | null, string | number | boolean | {
|
|
18
|
+
readonly [key: string]: JsonValue;
|
|
19
|
+
} | readonly JsonValue[] | null>, MongoCodec<"mongo/bson@1", readonly [], BsonInputValue, BsonInputValue, BsonValue>];
|
|
20
|
+
/**
|
|
21
|
+
* Mongo wire-type codec descriptors. Static metadata such as `traits` lives here (the descriptor shape) — `MongoCodec` itself carries its data type and the four conversion methods (TML-2357).
|
|
22
|
+
*/
|
|
23
|
+
declare const mongoCodecDescriptors: ReadonlyArray<CodecDescriptor>;
|
|
24
|
+
/**
|
|
25
|
+
* Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.
|
|
26
|
+
*/
|
|
27
|
+
declare function mongoDescriptorById(codecId: string): CodecDescriptor | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.
|
|
30
|
+
*
|
|
31
|
+
* Single point of truth for adapter-side codec construction: used by the legacy synchronous `createMongoAdapter()` factory and by the runtime adapter descriptor's `codecs()` getter. Userland code obtains a registry via the framework's execution-stack composition (see `createMongoExecutionContext`) instead of calling this directly.
|
|
32
|
+
*/
|
|
33
|
+
declare function buildStandardCodecRegistry(): MongoCodecRegistry;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };
|
|
36
|
+
//# sourceMappingURL=codecs-Y5GYsLPj.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs-Y5GYsLPj.d.mts","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/codecs.d.mts"],"mappings":";;;;;;;;;;;;cAWc,+BAA+B,4CAA4C,2BAA2B,mEAAmE,mDAAmD,yBAAyB,kEAAkE,oEAAoE,wCAAwC,MAAM,MAAM,OAAO,oGAAoG,2DAA2D,uBAAuB,iEAAiE,uBAAuB,8CAA8C,6BAA6B,0CAA0C,SAAS,WAAW,kBAAkB,WAAW,kBAAkB,WAAW,mBAAmB;YAC55B,cAAc;aACb;YACD,cAAc;aACb;YACD,cAAc;aACb,qBAAqB,wCAAwC,gBAAgB,gBAAgB;;;;cAI5F,uBAAuB,cAAc;;;;iBAIlC,oBAAoB,kBAAkB;;;;;;iBAMtC,8BAA8B"}
|