@prisma/orm-target-mongo 8.0.0-rc.12-dev.9 → 8.0.0-rc.12-dev.10

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.
Files changed (95) hide show
  1. package/dist/adapter.d.mts +1 -1
  2. package/dist/adapter.mjs +2 -2
  3. package/dist/adapter.mjs.map +1 -1
  4. package/dist/adapter__control.d.mts +208 -3
  5. package/dist/adapter__control.d.mts.map +1 -0
  6. package/dist/adapter__control.mjs +516 -3
  7. package/dist/adapter__control.mjs.map +1 -0
  8. package/dist/adapter__runtime.mjs +2 -2
  9. package/dist/adapter__runtime.mjs.map +1 -1
  10. package/dist/codec-ids-Bz230VLx-Dbi_KV7J.mjs +16 -0
  11. package/dist/codec-ids-Bz230VLx-Dbi_KV7J.mjs.map +1 -0
  12. package/dist/codec-ids-Ck-Z63jY.d.mts +16 -0
  13. package/dist/codec-ids-Ck-Z63jY.d.mts.map +1 -0
  14. package/dist/{adapter__codec-types.d.mts → codec-types-KM2ikqd7.d.mts} +20 -3
  15. package/dist/codec-types-KM2ikqd7.d.mts.map +1 -0
  16. package/dist/codecs-ChbLv6Rd-BmoC4ktF.mjs +393 -0
  17. package/dist/codecs-ChbLv6Rd-BmoC4ktF.mjs.map +1 -0
  18. package/dist/codecs-DsyGq31F.d.mts +33 -0
  19. package/dist/codecs-DsyGq31F.d.mts.map +1 -0
  20. package/dist/{control-CDO-vU3z.d.mts → control-Cfov50jX.d.mts} +82 -82
  21. package/dist/control-Cfov50jX.d.mts.map +1 -0
  22. package/dist/{control-BD0vuF-d.mjs → control-DESRWr7S.mjs} +140 -145
  23. package/dist/control-DESRWr7S.mjs.map +1 -0
  24. package/dist/{data-types-CxW7xs7P-Dxj3sc0T.mjs → data-types-B2WnpO9e-D97kwz96.mjs} +12 -4
  25. package/dist/data-types-B2WnpO9e-D97kwz96.mjs.map +1 -0
  26. package/dist/data-types-Kd9NIobH.d.mts +18 -0
  27. package/dist/data-types-Kd9NIobH.d.mts.map +1 -0
  28. package/dist/{descriptor-meta-BQRniVcn-8meGwEZr.mjs → descriptor-meta-CSm-03KE-DDeX4NIT.mjs} +4 -4
  29. package/dist/descriptor-meta-CSm-03KE-DDeX4NIT.mjs.map +1 -0
  30. package/dist/driver.mjs +1 -1
  31. package/dist/driver__control.d.mts +1 -1
  32. package/dist/driver__control.mjs +2 -2
  33. package/dist/driver__control.mjs.map +1 -1
  34. package/dist/{migration-BkqcE2Uv.d.mts → migration-DeZyk0tl.d.mts} +3 -3
  35. package/dist/{migration-BkqcE2Uv.d.mts.map → migration-DeZyk0tl.d.mts.map} +1 -1
  36. package/dist/{migration-factories-CqjDpXHw-fxXh_wY1.mjs → migration-factories-BwvR6Mvk-Ba1ywTUZ.mjs} +2 -2
  37. package/dist/migration-factories-BwvR6Mvk-Ba1ywTUZ.mjs.map +1 -0
  38. package/dist/{mongo-adapter-NKwUwPku-Bqm1kySe.mjs → mongo-adapter-Dx9Gs2Lj-CA6H_zbI.mjs} +10 -5
  39. package/dist/mongo-adapter-Dx9Gs2Lj-CA6H_zbI.mjs.map +1 -0
  40. package/dist/{mongo-adapter-CjJU3S9o-BIJruFYW.d.mts → mongo-adapter-wvK2fQOZ-BXo5NxEB.d.mts} +2 -2
  41. package/dist/mongo-adapter-wvK2fQOZ-BXo5NxEB.d.mts.map +1 -0
  42. package/dist/{mongo-driver-rOqx7iOY-PzNY9sC9.mjs → mongo-driver-CZDo4GWY-CDmclLXI.mjs} +3 -3
  43. package/dist/mongo-driver-CZDo4GWY-CDmclLXI.mjs.map +1 -0
  44. package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts → op-factory-call-DV0hKDUc-DHt1CB5L.d.mts} +3 -3
  45. package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map → op-factory-call-DV0hKDUc-DHt1CB5L.d.mts.map} +1 -1
  46. package/dist/{pack-MK8ZQfrL.d.mts → pack-CPxA9byH.d.mts} +2 -2
  47. package/dist/{pack-MK8ZQfrL.d.mts.map → pack-CPxA9byH.d.mts.map} +1 -1
  48. package/dist/target.d.mts +9 -7
  49. package/dist/target.mjs +6 -3
  50. package/dist/target__codec-ids.d.mts +2 -0
  51. package/dist/target__codec-ids.mjs +2 -0
  52. package/dist/target__codec-types.d.mts +2 -2
  53. package/dist/target__codecs.d.mts +2 -0
  54. package/dist/target__codecs.mjs +2 -0
  55. package/dist/target__control.d.mts +3 -4
  56. package/dist/target__control.mjs +1 -1
  57. package/dist/target__data-types.d.mts +2 -0
  58. package/dist/target__data-types.mjs +2 -0
  59. package/dist/target__migration.d.mts +1 -1
  60. package/dist/target__migration.mjs +1 -1
  61. package/dist/target__pack.d.mts +1 -1
  62. package/dist/target__pack.mjs +1 -1
  63. package/dist/target__pack.mjs.map +1 -1
  64. package/dist/target__runtime.mjs +1 -1
  65. package/dist/target__runtime.mjs.map +1 -1
  66. package/package.json +13 -14
  67. package/dist/adapter__codec-ids.d.mts +0 -12
  68. package/dist/adapter__codec-ids.d.mts.map +0 -1
  69. package/dist/adapter__codec-ids.mjs +0 -2
  70. package/dist/adapter__codec-types.d.mts.map +0 -1
  71. package/dist/adapter__codec-types.mjs +0 -1
  72. package/dist/adapter__codecs.d.mts +0 -14
  73. package/dist/adapter__codecs.d.mts.map +0 -1
  74. package/dist/adapter__codecs.mjs +0 -2
  75. package/dist/adapter__data-types.d.mts +0 -14
  76. package/dist/adapter__data-types.d.mts.map +0 -1
  77. package/dist/adapter__data-types.mjs +0 -2
  78. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +0 -12
  79. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +0 -1
  80. package/dist/codec-types-Bx2fHyq_.d.mts +0 -35
  81. package/dist/codec-types-Bx2fHyq_.d.mts.map +0 -1
  82. package/dist/codecs-0ilNxnkk-P6rdFjk0.mjs +0 -179
  83. package/dist/codecs-0ilNxnkk-P6rdFjk0.mjs.map +0 -1
  84. package/dist/control-BD0vuF-d.mjs.map +0 -1
  85. package/dist/control-BDevch6o.mjs +0 -443
  86. package/dist/control-BDevch6o.mjs.map +0 -1
  87. package/dist/control-CDO-vU3z.d.mts.map +0 -1
  88. package/dist/control-CbxqWOJS.d.mts +0 -176
  89. package/dist/control-CbxqWOJS.d.mts.map +0 -1
  90. package/dist/data-types-CxW7xs7P-Dxj3sc0T.mjs.map +0 -1
  91. package/dist/descriptor-meta-BQRniVcn-8meGwEZr.mjs.map +0 -1
  92. package/dist/migration-factories-CqjDpXHw-fxXh_wY1.mjs.map +0 -1
  93. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +0 -1
  94. package/dist/mongo-adapter-NKwUwPku-Bqm1kySe.mjs.map +0 -1
  95. package/dist/mongo-driver-rOqx7iOY-PzNY9sC9.mjs.map +0 -1
@@ -1,4 +1,5 @@
1
- //#region ../../../3-mongo-target/2-mongo-adapter/dist/codec-types.d.mts
1
+ import { JsonValue } from "@prisma/orm-framework/contract/types";
2
+ //#region ../../../3-mongo-target/1-mongo-target/dist/codec-types.d.mts
2
3
  //#region src/exports/codec-types.d.ts
3
4
  type Vector<N extends number = number> = readonly number[] & {
4
5
  readonly __vectorLength?: N;
@@ -32,7 +33,23 @@ type CodecTypes = {
32
33
  readonly input: readonly number[];
33
34
  readonly output: readonly number[];
34
35
  };
36
+ readonly 'mongo/int64@1': {
37
+ readonly input: bigint;
38
+ readonly output: bigint;
39
+ };
40
+ readonly 'mongo/decimal128@1': {
41
+ readonly input: string;
42
+ readonly output: string;
43
+ };
44
+ readonly 'mongo/binary@1': {
45
+ readonly input: Uint8Array;
46
+ readonly output: Uint8Array;
47
+ };
48
+ readonly 'mongo/json@1': {
49
+ readonly input: JsonValue;
50
+ readonly output: JsonValue;
51
+ };
35
52
  };
36
53
  //#endregion
37
- export { CodecTypes, Vector };
38
- //# sourceMappingURL=adapter__codec-types.d.mts.map
54
+ export { Vector as n, CodecTypes as t };
55
+ //# sourceMappingURL=codec-types-KM2ikqd7.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-KM2ikqd7.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codec-types.d.mts"],"mappings":";;;KAEK,OAAO;WACD,iBAAiB;;KAEvB;WACM;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;;WAEV;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;;WAEV;aACE,OAAO;aACP,QAAQ"}
@@ -0,0 +1,393 @@
1
+ import { a as MONGO_DOUBLE_CODEC_ID, c as MONGO_JSON_CODEC_ID, d as MONGO_VECTOR_CODEC_ID, i as MONGO_DECIMAL128_CODEC_ID, l as MONGO_OBJECTID_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_INT32_CODEC_ID, r as MONGO_DATE_CODEC_ID, s as MONGO_INT64_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_STRING_CODEC_ID } from "./codec-ids-Bz230VLx-Dbi_KV7J.mjs";
2
+ import { a as mongoDecimal128, c as mongoInt64, d as mongoString, f as mongoVector, i as mongoDate, l as mongoJson, n as mongoBool, o as mongoDouble, s as mongoInt32, t as mongoBinary, u as mongoObjectId } from "./data-types-B2WnpO9e-D97kwz96.mjs";
3
+ import { renderTsLiteral } from "@prisma/orm-framework/components/codec";
4
+ import { mongoCodec, newMongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
5
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
+ import { Binary, Decimal128, Long, ObjectId } from "bson";
7
+ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
8
+ //#region ../../../3-mongo-target/1-mongo-target/dist/codecs-ChbLv6Rd.mjs
9
+ function mongoTargetError(code, message, options) {
10
+ return structuredError(code, message, options);
11
+ }
12
+ const DECIMAL_INTEGER = /^-?\d+$/;
13
+ const CANONICAL_DECIMAL_TEXT = /^(?:-?\d+(?:\.\d+)?|NaN|-?Infinity)$/;
14
+ const DECIMAL128_TEXT = /^(-?)(\d+)(?:\.(\d+))?(?:E([+-]\d+))?$/;
15
+ const BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
16
+ /**
17
+ * Checks the BSON type tag rather than `instanceof`: the driver deserialises with its own load of `bson` (CommonJS, where this module may be loaded as ESM), so a value read from the database need not be an instance of the class imported here.
18
+ */
19
+ function hasBsonTypeTag(value, tag) {
20
+ return typeof value === "object" && value !== null && "_bsontype" in value && value._bsontype === tag;
21
+ }
22
+ function isLong(value) {
23
+ return hasBsonTypeTag(value, "Long");
24
+ }
25
+ function isDecimal128(value) {
26
+ return hasBsonTypeTag(value, "Decimal128");
27
+ }
28
+ function isBinary(value) {
29
+ return hasBsonTypeTag(value, "Binary");
30
+ }
31
+ function decodeFailed(codecId, message, received) {
32
+ throw mongoTargetError("RUNTIME.DECODE_FAILED", `${codecId} ${message}`, { meta: {
33
+ codecId,
34
+ received: typeof received
35
+ } });
36
+ }
37
+ const RECEIVED_PREVIEW_LIMIT = 100;
38
+ function encodeFailed(codecId, message, received) {
39
+ throw mongoTargetError("RUNTIME.ENCODE_FAILED", `${codecId} ${message}`, { meta: {
40
+ codecId,
41
+ received: String(received).slice(0, RECEIVED_PREVIEW_LIMIT)
42
+ } });
43
+ }
44
+ const INT64_MIN = -(2n ** 63n);
45
+ const INT64_MAX = 2n ** 63n - 1n;
46
+ /**
47
+ * `Long.fromBigInt` keeps the low 64 bits of any bigint, so an out-of-range value would be stored as a different number without error.
48
+ */
49
+ function isInt64(value) {
50
+ return value >= INT64_MIN && value <= INT64_MAX;
51
+ }
52
+ function requireInt64(codecId, value) {
53
+ if (!isInt64(value)) encodeFailed(codecId, "value is outside the signed 64-bit range", value);
54
+ return value;
55
+ }
56
+ function int64Encode(codecId, value) {
57
+ if (typeof value !== "bigint") encodeFailed(codecId, "value must be a bigint", value);
58
+ return Long.fromBigInt(requireInt64(codecId, value));
59
+ }
60
+ /**
61
+ * The driver promotes a stored `long` that fits in 53 bits to a `number`, and hands larger ones over as `Long`, so both arrive here.
62
+ */
63
+ function int64Decode(codecId, wire) {
64
+ if (typeof wire === "bigint") return wire;
65
+ if (isLong(wire)) return wire.toBigInt();
66
+ if (typeof wire === "number" && Number.isSafeInteger(wire)) return BigInt(wire);
67
+ return decodeFailed(codecId, "wire value must be a Long or a safe integer", wire);
68
+ }
69
+ /**
70
+ * A schema-written default arrives as a `number`; one that is a safe integer names its value exactly, so it is accepted like `pg/int8@1` accepts it.
71
+ */
72
+ function int64EncodeJson(codecId, value) {
73
+ if (typeof value === "bigint") return requireInt64(codecId, value).toString();
74
+ if (typeof value === "number" && Number.isSafeInteger(value)) return BigInt(value).toString();
75
+ return encodeFailed(codecId, "value must be a bigint or a safe integer", value);
76
+ }
77
+ function int64DecodeJson(codecId, json) {
78
+ if (typeof json !== "string" || !DECIMAL_INTEGER.test(json)) return decodeFailed(codecId, "JSON value must be decimal integer text", json);
79
+ const value = BigInt(json);
80
+ if (!isInt64(value)) return decodeFailed(codecId, "JSON value is outside the signed 64-bit range", json);
81
+ return value;
82
+ }
83
+ function decimalTextBigintLiteral(value) {
84
+ return typeof value === "string" && DECIMAL_INTEGER.test(value) ? `${value}n` : void 0;
85
+ }
86
+ /**
87
+ * `Decimal128.toString()` writes some values with an exponent (`1E+3`, `1.23E+40`). The application value is decimal text without one, as for Postgres `numeric`: the point moves to where the exponent puts it, trailing zeros stay, and the sign of zero goes.
88
+ */
89
+ function canonicalDecimalText(text) {
90
+ if (text === "NaN" || text === "Infinity" || text === "-Infinity") return text;
91
+ const match = DECIMAL128_TEXT.exec(text);
92
+ if (match === null) return void 0;
93
+ const [, sign = "", whole = "", fraction = "", exponent = "0"] = match;
94
+ const digits = `${whole}${fraction}`;
95
+ const point = whole.length + Number(exponent);
96
+ let integerPart;
97
+ let fractionPart;
98
+ if (point <= 0) {
99
+ integerPart = "0";
100
+ fractionPart = `${"0".repeat(-point)}${digits}`;
101
+ } else if (point >= digits.length) {
102
+ integerPart = `${digits}${"0".repeat(point - digits.length)}`;
103
+ fractionPart = "";
104
+ } else {
105
+ integerPart = digits.slice(0, point);
106
+ fractionPart = digits.slice(point);
107
+ }
108
+ const trimmedInteger = integerPart.replace(/^0+(?=\d)/, "");
109
+ const unsigned = fractionPart === "" ? trimmedInteger : `${trimmedInteger}.${fractionPart}`;
110
+ return /^[0.]+$/.test(unsigned) ? unsigned : `${sign}${unsigned}`;
111
+ }
112
+ function requireCanonicalDecimalText(codecId, value) {
113
+ if (typeof value !== "string" || !CANONICAL_DECIMAL_TEXT.test(value)) encodeFailed(codecId, "value must be decimal text without an exponent, or NaN, Infinity or -Infinity", value);
114
+ return value;
115
+ }
116
+ function decimal128Encode(codecId, value) {
117
+ requireCanonicalDecimalText(codecId, value);
118
+ try {
119
+ return Decimal128.fromString(value);
120
+ } catch (error) {
121
+ return encodeFailed(codecId, `value cannot be stored as a Decimal128 exactly: ${error instanceof Error ? error.message : String(error)}`, value);
122
+ }
123
+ }
124
+ function decimal128Decode(codecId, wire) {
125
+ if (!isDecimal128(wire)) return decodeFailed(codecId, "wire value must be a Decimal128", wire);
126
+ const text = canonicalDecimalText(wire.toString());
127
+ if (text === void 0) return decodeFailed(codecId, "wire value is not decimal text", wire);
128
+ return text;
129
+ }
130
+ function decimal128EncodeJson(codecId, value) {
131
+ return requireCanonicalDecimalText(codecId, value);
132
+ }
133
+ /**
134
+ * The JSON form is what `encodeJson` writes, so it follows the encode rule: canonical decimal text (no exponent), or `NaN`, `Infinity` or `-Infinity`, that a Decimal128 holds exactly.
135
+ */
136
+ function decimal128DecodeJson(codecId, json) {
137
+ if (typeof json !== "string" || !CANONICAL_DECIMAL_TEXT.test(json)) return decodeFailed(codecId, "JSON value must be decimal text without an exponent, or NaN, Infinity or -Infinity", json);
138
+ try {
139
+ Decimal128.fromString(json);
140
+ } catch {
141
+ return decodeFailed(codecId, "JSON value cannot be stored as a Decimal128 exactly", json);
142
+ }
143
+ return json;
144
+ }
145
+ function binaryEncode(codecId, value) {
146
+ if (!(value instanceof Uint8Array)) encodeFailed(codecId, "value must be a Uint8Array", value);
147
+ return new Binary(value);
148
+ }
149
+ function binaryDecode(codecId, wire) {
150
+ if (!isBinary(wire)) return decodeFailed(codecId, "wire value must be a Binary", wire);
151
+ return new Uint8Array(wire.value());
152
+ }
153
+ function binaryEncodeJson(value) {
154
+ return Buffer.from(value).toString("base64");
155
+ }
156
+ function binaryDecodeJson(codecId, json) {
157
+ if (typeof json !== "string" || !BASE64_TEXT.test(json)) return decodeFailed(codecId, "JSON value must be base64 text", json);
158
+ return new Uint8Array(Buffer.from(json, "base64"));
159
+ }
160
+ const mongoObjectIdCodec = mongoCodec({
161
+ typeId: MONGO_OBJECTID_CODEC_ID,
162
+ decode: (wire) => wire.toHexString(),
163
+ encode: (value) => new ObjectId(value)
164
+ });
165
+ const mongoStringCodec = mongoCodec({
166
+ typeId: MONGO_STRING_CODEC_ID,
167
+ decode: (wire) => wire,
168
+ encode: (value) => value
169
+ });
170
+ const mongoDoubleCodec = mongoCodec({
171
+ typeId: MONGO_DOUBLE_CODEC_ID,
172
+ decode: (wire) => wire,
173
+ encode: (value) => value
174
+ });
175
+ const mongoInt32Codec = mongoCodec({
176
+ typeId: MONGO_INT32_CODEC_ID,
177
+ decode: (wire) => wire,
178
+ encode: (value) => value
179
+ });
180
+ const mongoBooleanCodec = mongoCodec({
181
+ typeId: MONGO_BOOLEAN_CODEC_ID,
182
+ decode: (wire) => wire,
183
+ encode: (value) => value
184
+ });
185
+ const mongoDateCodec = mongoCodec({
186
+ typeId: MONGO_DATE_CODEC_ID,
187
+ decode: (wire) => wire,
188
+ encode: (value) => value,
189
+ encodeJson: (value) => value.toISOString(),
190
+ decodeJson: (json) => {
191
+ if (typeof json !== "string") throw mongoTargetError("RUNTIME.DECODE_FAILED", "expected ISO date string", { meta: {
192
+ codecId: MONGO_DATE_CODEC_ID,
193
+ received: typeof json
194
+ } });
195
+ return new Date(json);
196
+ }
197
+ });
198
+ const mongoVectorCodec = mongoCodec({
199
+ typeId: MONGO_VECTOR_CODEC_ID,
200
+ decode: (wire) => wire,
201
+ encode: (value) => value
202
+ });
203
+ /**
204
+ * A BSON `long`. The application value is a `bigint`, because a `number` cannot hold the full 64-bit range; its JSON form is decimal text.
205
+ */
206
+ const mongoInt64Codec = mongoCodec({
207
+ typeId: MONGO_INT64_CODEC_ID,
208
+ decode: (wire) => int64Decode(MONGO_INT64_CODEC_ID, wire),
209
+ encode: (value) => int64Encode(MONGO_INT64_CODEC_ID, value),
210
+ encodeJson: (value) => int64EncodeJson(MONGO_INT64_CODEC_ID, value),
211
+ decodeJson: (json) => int64DecodeJson(MONGO_INT64_CODEC_ID, json)
212
+ });
213
+ /**
214
+ * A BSON `decimal`. The application value and its JSON form are the same decimal text, written without an exponent.
215
+ */
216
+ const mongoDecimal128Codec = mongoCodec({
217
+ typeId: MONGO_DECIMAL128_CODEC_ID,
218
+ decode: (wire) => decimal128Decode(MONGO_DECIMAL128_CODEC_ID, wire),
219
+ encode: (value) => decimal128Encode(MONGO_DECIMAL128_CODEC_ID, value),
220
+ encodeJson: (value) => decimal128EncodeJson(MONGO_DECIMAL128_CODEC_ID, value),
221
+ decodeJson: (json) => decimal128DecodeJson(MONGO_DECIMAL128_CODEC_ID, json)
222
+ });
223
+ /**
224
+ * BSON `binData`. The application value is a `Uint8Array`; its JSON form is unwrapped base64.
225
+ */
226
+ const mongoBinaryCodec = mongoCodec({
227
+ typeId: MONGO_BINARY_CODEC_ID,
228
+ decode: (wire) => binaryDecode(MONGO_BINARY_CODEC_ID, wire),
229
+ encode: (value) => binaryEncode(MONGO_BINARY_CODEC_ID, value),
230
+ encodeJson: binaryEncodeJson,
231
+ decodeJson: (json) => binaryDecodeJson(MONGO_BINARY_CODEC_ID, json)
232
+ });
233
+ /**
234
+ * Any JSON value, stored as the BSON document, array or scalar it maps to.
235
+ */
236
+ const mongoJsonCodec = mongoCodec({
237
+ typeId: MONGO_JSON_CODEC_ID,
238
+ decode: (wire) => wire,
239
+ encode: (value) => value
240
+ });
241
+ /**
242
+ * The canonical set of Mongo wire-type codecs.
243
+ *
244
+ * Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.
245
+ */
246
+ const mongoStandardCodecs = [
247
+ mongoObjectIdCodec,
248
+ mongoStringCodec,
249
+ mongoDoubleCodec,
250
+ mongoInt32Codec,
251
+ mongoBooleanCodec,
252
+ mongoDateCodec,
253
+ mongoVectorCodec,
254
+ mongoInt64Codec,
255
+ mongoDecimal128Codec,
256
+ mongoBinaryCodec,
257
+ mongoJsonCodec
258
+ ];
259
+ /**
260
+ * Build a {@link CodecDescriptor} for a Mongo wire-type codec.
261
+ *
262
+ * Wraps an existing {@link MongoCodec} instance into a descriptor whose factory hands out the same shared codec. 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.
263
+ */
264
+ function descriptorFor(codec, metadata) {
265
+ const renderOutputType = metadata.renderOutputType;
266
+ return {
267
+ codecId: codec.id,
268
+ dataType: metadata.dataType,
269
+ traits: metadata.traits,
270
+ targetTypes: metadata.targetTypes,
271
+ paramsSchema: void 0,
272
+ isParameterized: false,
273
+ factory: (() => () => codec),
274
+ ...ifDefined("renderOutputType", renderOutputType),
275
+ ...ifDefined("renderValueLiteral", metadata.renderValueLiteral)
276
+ };
277
+ }
278
+ const renderVectorOutputType = (typeParams) => {
279
+ const length = typeParams["length"];
280
+ if (length === void 0) return void 0;
281
+ if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length) || length <= 0) throw mongoTargetError("RUNTIME.TYPE_PARAMS_INVALID", "renderOutputType: expected positive integer \"length\" for Vector", { meta: {
282
+ nativeType: "Vector",
283
+ param: "length",
284
+ received: length
285
+ } });
286
+ return `Vector<${length}>`;
287
+ };
288
+ /**
289
+ * Mongo wire-type codec descriptors. Static metadata for `traits`, `targetTypes`, and `renderOutputType` lives here (the descriptor shape) — `MongoCodec` itself is narrow and only carries the four conversion methods (TML-2357).
290
+ */
291
+ const mongoCodecDescriptors = [
292
+ descriptorFor(mongoObjectIdCodec, {
293
+ dataType: mongoObjectId.id,
294
+ traits: ["equality"],
295
+ targetTypes: ["objectId"]
296
+ }),
297
+ descriptorFor(mongoStringCodec, {
298
+ dataType: mongoString.id,
299
+ traits: [
300
+ "equality",
301
+ "order",
302
+ "textual"
303
+ ],
304
+ targetTypes: ["string"],
305
+ renderValueLiteral: renderTsLiteral
306
+ }),
307
+ descriptorFor(mongoDoubleCodec, {
308
+ dataType: mongoDouble.id,
309
+ traits: [
310
+ "equality",
311
+ "order",
312
+ "numeric"
313
+ ],
314
+ targetTypes: ["double"],
315
+ renderValueLiteral: renderTsLiteral
316
+ }),
317
+ descriptorFor(mongoInt32Codec, {
318
+ dataType: mongoInt32.id,
319
+ traits: [
320
+ "equality",
321
+ "order",
322
+ "numeric"
323
+ ],
324
+ targetTypes: ["int"],
325
+ renderValueLiteral: renderTsLiteral
326
+ }),
327
+ descriptorFor(mongoBooleanCodec, {
328
+ dataType: mongoBool.id,
329
+ traits: ["equality", "boolean"],
330
+ targetTypes: ["bool"],
331
+ renderValueLiteral: renderTsLiteral
332
+ }),
333
+ descriptorFor(mongoDateCodec, {
334
+ dataType: mongoDate.id,
335
+ traits: ["equality", "order"],
336
+ targetTypes: ["date"]
337
+ }),
338
+ descriptorFor(mongoVectorCodec, {
339
+ dataType: mongoVector.id,
340
+ traits: ["equality"],
341
+ targetTypes: ["vector"],
342
+ renderOutputType: renderVectorOutputType
343
+ }),
344
+ descriptorFor(mongoInt64Codec, {
345
+ dataType: mongoInt64.id,
346
+ traits: [
347
+ "equality",
348
+ "order",
349
+ "numeric"
350
+ ],
351
+ targetTypes: ["long"],
352
+ renderValueLiteral: decimalTextBigintLiteral
353
+ }),
354
+ descriptorFor(mongoDecimal128Codec, {
355
+ dataType: mongoDecimal128.id,
356
+ traits: [
357
+ "equality",
358
+ "order",
359
+ "numeric"
360
+ ],
361
+ targetTypes: ["decimal"]
362
+ }),
363
+ descriptorFor(mongoBinaryCodec, {
364
+ dataType: mongoBinary.id,
365
+ traits: ["equality"],
366
+ targetTypes: ["binData"]
367
+ }),
368
+ descriptorFor(mongoJsonCodec, {
369
+ dataType: mongoJson.id,
370
+ traits: [],
371
+ targetTypes: []
372
+ })
373
+ ];
374
+ /**
375
+ * Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.
376
+ */
377
+ function mongoDescriptorById(codecId) {
378
+ return mongoCodecDescriptors.find((d) => d.codecId === codecId);
379
+ }
380
+ /**
381
+ * Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.
382
+ *
383
+ * 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.
384
+ */
385
+ function buildStandardCodecRegistry() {
386
+ const registry = newMongoCodecRegistry();
387
+ for (const codec of mongoStandardCodecs) registry.register(codec);
388
+ return registry;
389
+ }
390
+ //#endregion
391
+ export { mongoTargetError as a, mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };
392
+
393
+ //# sourceMappingURL=codecs-ChbLv6Rd-BmoC4ktF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-ChbLv6Rd-BmoC4ktF.mjs","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codecs-ChbLv6Rd.mjs"],"sourcesContent":["import { a as MONGO_DOUBLE_CODEC_ID, c as MONGO_JSON_CODEC_ID, d as MONGO_VECTOR_CODEC_ID, i as MONGO_DECIMAL128_CODEC_ID, l as MONGO_OBJECTID_CODEC_ID, n as MONGO_BOOLEAN_CODEC_ID, o as MONGO_INT32_CODEC_ID, r as MONGO_DATE_CODEC_ID, s as MONGO_INT64_CODEC_ID, t as MONGO_BINARY_CODEC_ID, u as MONGO_STRING_CODEC_ID } from \"./codec-ids-Bz230VLx.mjs\";\nimport { a as mongoDecimal128, c as mongoInt64, d as mongoString, f as mongoVector, i as mongoDate, l as mongoJson, n as mongoBool, o as mongoDouble, s as mongoInt32, t as mongoBinary, u as mongoObjectId } from \"./data-types-B2WnpO9e.mjs\";\nimport { renderTsLiteral } from \"@internal/framework-components/codec\";\nimport { mongoCodec, newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { Binary, Decimal128, Long, ObjectId } from \"bson\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/mongo-target-errors.ts\nfunction mongoTargetError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/core/bson-scalar-helpers.ts\nconst DECIMAL_INTEGER = /^-?\\d+$/;\nconst CANONICAL_DECIMAL_TEXT = /^(?:-?\\d+(?:\\.\\d+)?|NaN|-?Infinity)$/;\nconst DECIMAL128_TEXT = /^(-?)(\\d+)(?:\\.(\\d+))?(?:E([+-]\\d+))?$/;\nconst BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\n/**\n* Checks the BSON type tag rather than `instanceof`: the driver deserialises with its own load of `bson` (CommonJS, where this module may be loaded as ESM), so a value read from the database need not be an instance of the class imported here.\n*/\nfunction hasBsonTypeTag(value, tag) {\n\treturn typeof value === \"object\" && value !== null && \"_bsontype\" in value && value._bsontype === tag;\n}\nfunction isLong(value) {\n\treturn hasBsonTypeTag(value, \"Long\");\n}\nfunction isDecimal128(value) {\n\treturn hasBsonTypeTag(value, \"Decimal128\");\n}\nfunction isBinary(value) {\n\treturn hasBsonTypeTag(value, \"Binary\");\n}\nfunction decodeFailed(codecId, message, received) {\n\tthrow mongoTargetError(\"RUNTIME.DECODE_FAILED\", `${codecId} ${message}`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof received\n\t} });\n}\nconst RECEIVED_PREVIEW_LIMIT = 100;\nfunction encodeFailed(codecId, message, received) {\n\tthrow mongoTargetError(\"RUNTIME.ENCODE_FAILED\", `${codecId} ${message}`, { meta: {\n\t\tcodecId,\n\t\treceived: String(received).slice(0, RECEIVED_PREVIEW_LIMIT)\n\t} });\n}\nconst INT64_MIN = -(2n ** 63n);\nconst INT64_MAX = 2n ** 63n - 1n;\n/**\n* `Long.fromBigInt` keeps the low 64 bits of any bigint, so an out-of-range value would be stored as a different number without error.\n*/\nfunction isInt64(value) {\n\treturn value >= INT64_MIN && value <= INT64_MAX;\n}\nfunction requireInt64(codecId, value) {\n\tif (!isInt64(value)) encodeFailed(codecId, \"value is outside the signed 64-bit range\", value);\n\treturn value;\n}\nfunction int64Encode(codecId, value) {\n\tif (typeof value !== \"bigint\") encodeFailed(codecId, \"value must be a bigint\", value);\n\treturn Long.fromBigInt(requireInt64(codecId, value));\n}\n/**\n* The driver promotes a stored `long` that fits in 53 bits to a `number`, and hands larger ones over as `Long`, so both arrive here.\n*/\nfunction int64Decode(codecId, wire) {\n\tif (typeof wire === \"bigint\") return wire;\n\tif (isLong(wire)) return wire.toBigInt();\n\tif (typeof wire === \"number\" && Number.isSafeInteger(wire)) return BigInt(wire);\n\treturn decodeFailed(codecId, \"wire value must be a Long or a safe integer\", wire);\n}\n/**\n* A schema-written default arrives as a `number`; one that is a safe integer names its value exactly, so it is accepted like `pg/int8@1` accepts it.\n*/\nfunction int64EncodeJson(codecId, value) {\n\tif (typeof value === \"bigint\") return requireInt64(codecId, value).toString();\n\tif (typeof value === \"number\" && Number.isSafeInteger(value)) return BigInt(value).toString();\n\treturn encodeFailed(codecId, \"value must be a bigint or a safe integer\", value);\n}\nfunction int64DecodeJson(codecId, json) {\n\tif (typeof json !== \"string\" || !DECIMAL_INTEGER.test(json)) return decodeFailed(codecId, \"JSON value must be decimal integer text\", json);\n\tconst value = BigInt(json);\n\tif (!isInt64(value)) return decodeFailed(codecId, \"JSON value is outside the signed 64-bit range\", json);\n\treturn value;\n}\nfunction decimalTextBigintLiteral(value) {\n\treturn typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? `${value}n` : void 0;\n}\n/**\n* `Decimal128.toString()` writes some values with an exponent (`1E+3`, `1.23E+40`). The application value is decimal text without one, as for Postgres `numeric`: the point moves to where the exponent puts it, trailing zeros stay, and the sign of zero goes.\n*/\nfunction canonicalDecimalText(text) {\n\tif (text === \"NaN\" || text === \"Infinity\" || text === \"-Infinity\") return text;\n\tconst match = DECIMAL128_TEXT.exec(text);\n\tif (match === null) return void 0;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\", exponent = \"0\"] = match;\n\tconst digits = `${whole}${fraction}`;\n\tconst point = whole.length + Number(exponent);\n\tlet integerPart;\n\tlet fractionPart;\n\tif (point <= 0) {\n\t\tintegerPart = \"0\";\n\t\tfractionPart = `${\"0\".repeat(-point)}${digits}`;\n\t} else if (point >= digits.length) {\n\t\tintegerPart = `${digits}${\"0\".repeat(point - digits.length)}`;\n\t\tfractionPart = \"\";\n\t} else {\n\t\tintegerPart = digits.slice(0, point);\n\t\tfractionPart = digits.slice(point);\n\t}\n\tconst trimmedInteger = integerPart.replace(/^0+(?=\\d)/, \"\");\n\tconst unsigned = fractionPart === \"\" ? trimmedInteger : `${trimmedInteger}.${fractionPart}`;\n\treturn /^[0.]+$/.test(unsigned) ? unsigned : `${sign}${unsigned}`;\n}\nfunction requireCanonicalDecimalText(codecId, value) {\n\tif (typeof value !== \"string\" || !CANONICAL_DECIMAL_TEXT.test(value)) encodeFailed(codecId, \"value must be decimal text without an exponent, or NaN, Infinity or -Infinity\", value);\n\treturn value;\n}\nfunction decimal128Encode(codecId, value) {\n\trequireCanonicalDecimalText(codecId, value);\n\ttry {\n\t\treturn Decimal128.fromString(value);\n\t} catch (error) {\n\t\treturn encodeFailed(codecId, `value cannot be stored as a Decimal128 exactly: ${error instanceof Error ? error.message : String(error)}`, value);\n\t}\n}\nfunction decimal128Decode(codecId, wire) {\n\tif (!isDecimal128(wire)) return decodeFailed(codecId, \"wire value must be a Decimal128\", wire);\n\tconst text = canonicalDecimalText(wire.toString());\n\tif (text === void 0) return decodeFailed(codecId, \"wire value is not decimal text\", wire);\n\treturn text;\n}\nfunction decimal128EncodeJson(codecId, value) {\n\treturn requireCanonicalDecimalText(codecId, value);\n}\n/**\n* The JSON form is what `encodeJson` writes, so it follows the encode rule: canonical decimal text (no exponent), or `NaN`, `Infinity` or `-Infinity`, that a Decimal128 holds exactly.\n*/\nfunction decimal128DecodeJson(codecId, json) {\n\tif (typeof json !== \"string\" || !CANONICAL_DECIMAL_TEXT.test(json)) return decodeFailed(codecId, \"JSON value must be decimal text without an exponent, or NaN, Infinity or -Infinity\", json);\n\ttry {\n\t\tDecimal128.fromString(json);\n\t} catch {\n\t\treturn decodeFailed(codecId, \"JSON value cannot be stored as a Decimal128 exactly\", json);\n\t}\n\treturn json;\n}\nfunction binaryEncode(codecId, value) {\n\tif (!(value instanceof Uint8Array)) encodeFailed(codecId, \"value must be a Uint8Array\", value);\n\treturn new Binary(value);\n}\nfunction binaryDecode(codecId, wire) {\n\tif (!isBinary(wire)) return decodeFailed(codecId, \"wire value must be a Binary\", wire);\n\treturn new Uint8Array(wire.value());\n}\nfunction binaryEncodeJson(value) {\n\treturn Buffer.from(value).toString(\"base64\");\n}\nfunction binaryDecodeJson(codecId, json) {\n\tif (typeof json !== \"string\" || !BASE64_TEXT.test(json)) return decodeFailed(codecId, \"JSON value must be base64 text\", json);\n\treturn new Uint8Array(Buffer.from(json, \"base64\"));\n}\n//#endregion\n//#region src/core/codecs.ts\nconst mongoObjectIdCodec = mongoCodec({\n\ttypeId: MONGO_OBJECTID_CODEC_ID,\n\tdecode: (wire) => wire.toHexString(),\n\tencode: (value) => new ObjectId(value)\n});\nconst mongoStringCodec = mongoCodec({\n\ttypeId: MONGO_STRING_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value\n});\nconst mongoDoubleCodec = mongoCodec({\n\ttypeId: MONGO_DOUBLE_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value\n});\nconst mongoInt32Codec = mongoCodec({\n\ttypeId: MONGO_INT32_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value\n});\nconst mongoBooleanCodec = mongoCodec({\n\ttypeId: MONGO_BOOLEAN_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value\n});\nconst mongoDateCodec = mongoCodec({\n\ttypeId: MONGO_DATE_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value,\n\tencodeJson: (value) => value.toISOString(),\n\tdecodeJson: (json) => {\n\t\tif (typeof json !== \"string\") throw mongoTargetError(\"RUNTIME.DECODE_FAILED\", \"expected ISO date string\", { meta: {\n\t\t\tcodecId: MONGO_DATE_CODEC_ID,\n\t\t\treceived: typeof json\n\t\t} });\n\t\treturn new Date(json);\n\t}\n});\nconst mongoVectorCodec = mongoCodec({\n\ttypeId: MONGO_VECTOR_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (value) => value\n});\n/**\n* A BSON `long`. The application value is a `bigint`, because a `number` cannot hold the full 64-bit range; its JSON form is decimal text.\n*/\nconst mongoInt64Codec = mongoCodec({\n\ttypeId: MONGO_INT64_CODEC_ID,\n\tdecode: (wire) => int64Decode(MONGO_INT64_CODEC_ID, wire),\n\tencode: (value) => int64Encode(MONGO_INT64_CODEC_ID, value),\n\tencodeJson: (value) => int64EncodeJson(MONGO_INT64_CODEC_ID, value),\n\tdecodeJson: (json) => int64DecodeJson(MONGO_INT64_CODEC_ID, json)\n});\n/**\n* A BSON `decimal`. The application value and its JSON form are the same decimal text, written without an exponent.\n*/\nconst mongoDecimal128Codec = mongoCodec({\n\ttypeId: MONGO_DECIMAL128_CODEC_ID,\n\tdecode: (wire) => decimal128Decode(MONGO_DECIMAL128_CODEC_ID, wire),\n\tencode: (value) => decimal128Encode(MONGO_DECIMAL128_CODEC_ID, value),\n\tencodeJson: (value) => decimal128EncodeJson(MONGO_DECIMAL128_CODEC_ID, value),\n\tdecodeJson: (json) => decimal128DecodeJson(MONGO_DECIMAL128_CODEC_ID, json)\n});\n/**\n* BSON `binData`. The application value is a `Uint8Array`; its JSON form is unwrapped base64.\n*/\nconst mongoBinaryCodec = mongoCodec({\n\ttypeId: MONGO_BINARY_CODEC_ID,\n\tdecode: (wire) => binaryDecode(MONGO_BINARY_CODEC_ID, wire),\n\tencode: (value) => binaryEncode(MONGO_BINARY_CODEC_ID, value),\n\tencodeJson: binaryEncodeJson,\n\tdecodeJson: (json) => binaryDecodeJson(MONGO_BINARY_CODEC_ID, json)\n});\n/**\n* Any JSON value, stored as the BSON document, array or scalar it maps to.\n*/\nconst mongoJsonCodec = mongoCodec({\n\ttypeId: MONGO_JSON_CODEC_ID,\n\tdecode: (wire) => wire,\n\tencode: (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\tmongoDecimal128Codec,\n\tmongoBinaryCodec,\n\tmongoJsonCodec\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. 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\tconst renderOutputType = metadata.renderOutputType;\n\treturn {\n\t\tcodecId: codec.id,\n\t\tdataType: metadata.dataType,\n\t\ttraits: metadata.traits,\n\t\ttargetTypes: metadata.targetTypes,\n\t\tparamsSchema: void 0,\n\t\tisParameterized: false,\n\t\tfactory: (() => () => codec),\n\t\t...ifDefined(\"renderOutputType\", renderOutputType),\n\t\t...ifDefined(\"renderValueLiteral\", metadata.renderValueLiteral)\n\t};\n}\nconst renderVectorOutputType = (typeParams) => {\n\tconst length = typeParams[\"length\"];\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length) || length <= 0) throw mongoTargetError(\"RUNTIME.TYPE_PARAMS_INVALID\", \"renderOutputType: expected positive integer \\\"length\\\" for Vector\", { meta: {\n\t\tnativeType: \"Vector\",\n\t\tparam: \"length\",\n\t\treceived: length\n\t} });\n\treturn `Vector<${length}>`;\n};\n/**\n* Mongo wire-type codec descriptors. Static metadata for `traits`, `targetTypes`, and `renderOutputType` lives here (the descriptor shape) — `MongoCodec` itself is narrow and only carries the four conversion methods (TML-2357).\n*/\nconst mongoCodecDescriptors = [\n\tdescriptorFor(mongoObjectIdCodec, {\n\t\tdataType: mongoObjectId.id,\n\t\ttraits: [\"equality\"],\n\t\ttargetTypes: [\"objectId\"]\n\t}),\n\tdescriptorFor(mongoStringCodec, {\n\t\tdataType: mongoString.id,\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"textual\"\n\t\t],\n\t\ttargetTypes: [\"string\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDoubleCodec, {\n\t\tdataType: mongoDouble.id,\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\ttargetTypes: [\"double\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoInt32Codec, {\n\t\tdataType: mongoInt32.id,\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\ttargetTypes: [\"int\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoBooleanCodec, {\n\t\tdataType: mongoBool.id,\n\t\ttraits: [\"equality\", \"boolean\"],\n\t\ttargetTypes: [\"bool\"],\n\t\trenderValueLiteral: renderTsLiteral\n\t}),\n\tdescriptorFor(mongoDateCodec, {\n\t\tdataType: mongoDate.id,\n\t\ttraits: [\"equality\", \"order\"],\n\t\ttargetTypes: [\"date\"]\n\t}),\n\tdescriptorFor(mongoVectorCodec, {\n\t\tdataType: mongoVector.id,\n\t\ttraits: [\"equality\"],\n\t\ttargetTypes: [\"vector\"],\n\t\trenderOutputType: renderVectorOutputType\n\t}),\n\tdescriptorFor(mongoInt64Codec, {\n\t\tdataType: mongoInt64.id,\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\ttargetTypes: [\"long\"],\n\t\trenderValueLiteral: decimalTextBigintLiteral\n\t}),\n\tdescriptorFor(mongoDecimal128Codec, {\n\t\tdataType: mongoDecimal128.id,\n\t\ttraits: [\n\t\t\t\"equality\",\n\t\t\t\"order\",\n\t\t\t\"numeric\"\n\t\t],\n\t\ttargetTypes: [\"decimal\"]\n\t}),\n\tdescriptorFor(mongoBinaryCodec, {\n\t\tdataType: mongoBinary.id,\n\t\ttraits: [\"equality\"],\n\t\ttargetTypes: [\"binData\"]\n\t}),\n\tdescriptorFor(mongoJsonCodec, {\n\t\tdataType: mongoJson.id,\n\t\ttraits: [],\n\t\ttargetTypes: []\n\t})\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 { mongoTargetError as a, mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };\n\n//# sourceMappingURL=codecs-ChbLv6Rd.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,iBAAiB,MAAM,SAAS,SAAS;CACjD,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,MAAM,kBAAkB;AACxB,MAAM,yBAAyB;AAC/B,MAAM,kBAAkB;AACxB,MAAM,cAAc;;;;AAIpB,SAAS,eAAe,OAAO,KAAK;CACnC,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe,SAAS,MAAM,cAAc;AACnG;AACA,SAAS,OAAO,OAAO;CACtB,OAAO,eAAe,OAAO,MAAM;AACpC;AACA,SAAS,aAAa,OAAO;CAC5B,OAAO,eAAe,OAAO,YAAY;AAC1C;AACA,SAAS,SAAS,OAAO;CACxB,OAAO,eAAe,OAAO,QAAQ;AACtC;AACA,SAAS,aAAa,SAAS,SAAS,UAAU;CACjD,MAAM,iBAAiB,yBAAyB,GAAG,QAAQ,GAAG,WAAW,EAAE,MAAM;EAChF;EACA,UAAU,OAAO;CAClB,EAAE,CAAC;AACJ;AACA,MAAM,yBAAyB;AAC/B,SAAS,aAAa,SAAS,SAAS,UAAU;CACjD,MAAM,iBAAiB,yBAAyB,GAAG,QAAQ,GAAG,WAAW,EAAE,MAAM;EAChF;EACA,UAAU,OAAO,QAAQ,CAAC,CAAC,MAAM,GAAG,sBAAsB;CAC3D,EAAE,CAAC;AACJ;AACA,MAAM,YAAY,EAAE,MAAM;AAC1B,MAAM,YAAY,MAAM,MAAM;;;;AAI9B,SAAS,QAAQ,OAAO;CACvB,OAAO,SAAS,aAAa,SAAS;AACvC;AACA,SAAS,aAAa,SAAS,OAAO;CACrC,IAAI,CAAC,QAAQ,KAAK,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CACrB,CAAC;CACD,cAAc,kBAAkB;EAC/B,UAAU,YAAY;EACtB,QAAQ,CAAC,UAAU;EACnB,aAAa,CAAC,QAAQ;EACtB,kBAAkB;CACnB,CAAC;CACD,cAAc,iBAAiB;EAC9B,UAAU,WAAW;EACrB,QAAQ;GACP;GACA;GACA;EACD;EACA,aAAa,CAAC,MAAM;EACpB,oBAAoB;CACrB,CAAC;CACD,cAAc,sBAAsB;EACnC,UAAU,gBAAgB;EAC1B,QAAQ;GACP;GACA;GACA;EACD;EACA,aAAa,CAAC,SAAS;CACxB,CAAC;CACD,cAAc,kBAAkB;EAC/B,UAAU,YAAY;EACtB,QAAQ,CAAC,UAAU;EACnB,aAAa,CAAC,SAAS;CACxB,CAAC;CACD,cAAc,gBAAgB;EAC7B,UAAU,UAAU;EACpB,QAAQ,CAAC;EACT,aAAa,CAAC;CACf,CAAC;AACF;;;;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,33 @@
1
+ import { CodecDescriptor } from "@prisma/orm-framework/components/codec";
2
+ import { MongoCodec, MongoCodecRegistry } from "@prisma/orm-family-mongo/codec";
3
+ import { Binary, Decimal128, Long, ObjectId } from "bson";
4
+ import { JsonValue } from "@prisma/orm-framework/contract/types";
5
+ //#region ../../../3-mongo-target/1-mongo-target/dist/codecs.d.mts
6
+ //#region src/core/codecs.d.ts
7
+ /**
8
+ * The canonical set of Mongo wire-type codecs.
9
+ *
10
+ * Single source of truth for both control- and runtime-plane adapter descriptors. Don't duplicate this list — import it.
11
+ */
12
+ declare const mongoStandardCodecs: readonly [MongoCodec<"mongo/objectId@1", readonly [], ObjectId, string>, MongoCodec<"mongo/string@1", readonly [], string, string>, MongoCodec<"mongo/double@1", readonly [], number, number>, MongoCodec<"mongo/int32@1", readonly [], number, number>, MongoCodec<"mongo/bool@1", readonly [], boolean, boolean>, MongoCodec<"mongo/date@1", readonly [], Date, Date>, MongoCodec<"mongo/vector@1", readonly [], readonly number[], readonly number[]>, MongoCodec<"mongo/int64@1", readonly [], number | bigint | Long, bigint>, MongoCodec<"mongo/decimal128@1", readonly [], Decimal128, string>, MongoCodec<"mongo/binary@1", readonly [], Binary, Uint8Array<ArrayBufferLike>>, MongoCodec<"mongo/json@1", readonly [], string | number | boolean | {
13
+ readonly [key: string]: JsonValue;
14
+ } | readonly JsonValue[] | null, string | number | boolean | {
15
+ readonly [key: string]: JsonValue;
16
+ } | readonly JsonValue[] | null>];
17
+ /**
18
+ * Mongo wire-type codec descriptors. Static metadata for `traits`, `targetTypes`, and `renderOutputType` lives here (the descriptor shape) — `MongoCodec` itself is narrow and only carries the four conversion methods (TML-2357).
19
+ */
20
+ declare const mongoCodecDescriptors: ReadonlyArray<CodecDescriptor>;
21
+ /**
22
+ * Lookup descriptor metadata by codec id — used by tests and for descriptor-side reads of static metadata.
23
+ */
24
+ declare function mongoDescriptorById(codecId: string): CodecDescriptor | undefined;
25
+ /**
26
+ * Build a {@link MongoCodecRegistry} preloaded with the standard Mongo wire-type codecs.
27
+ *
28
+ * 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.
29
+ */
30
+ declare function buildStandardCodecRegistry(): MongoCodecRegistry;
31
+ //#endregion
32
+ export { mongoStandardCodecs as i, mongoCodecDescriptors as n, mongoDescriptorById as r, buildStandardCodecRegistry as t };
33
+ //# sourceMappingURL=codecs-DsyGq31F.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-DsyGq31F.d.mts","names":[],"sources":["../../../../3-mongo-target/1-mongo-target/dist/codecs.d.mts"],"mappings":";;;;;;;;;;;cAUc,+BAA+B,4CAA4C,mBAAmB,2DAA2D,2DAA2D,0DAA0D,2DAA2D,wCAAwC,MAAM,OAAO,iFAAiF,2DAA2D,eAAe,8CAA8C,qBAAqB,0CAA0C,QAAQ,WAAW,mBAAmB;YAC9qB,cAAc;aACb;YACD,cAAc;aACb;;;;cAIC,uBAAuB,cAAc;;;;iBAIlC,oBAAoB,kBAAkB;;;;;;iBAMtC,8BAA8B"}