@prisma-next/adapter-mongo 0.3.0-dev.146 → 0.3.0-dev.147

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.
@@ -1,11 +1,12 @@
1
1
  //#region src/core/codec-ids.ts
2
2
  const MONGO_OBJECTID_CODEC_ID = "mongo/objectId@1";
3
3
  const MONGO_STRING_CODEC_ID = "mongo/string@1";
4
+ const MONGO_DOUBLE_CODEC_ID = "mongo/double@1";
4
5
  const MONGO_INT32_CODEC_ID = "mongo/int32@1";
5
6
  const MONGO_BOOLEAN_CODEC_ID = "mongo/bool@1";
6
7
  const MONGO_DATE_CODEC_ID = "mongo/date@1";
7
8
  const MONGO_VECTOR_CODEC_ID = "mongo/vector@1";
8
9
 
9
10
  //#endregion
10
- export { MONGO_STRING_CODEC_ID as a, MONGO_OBJECTID_CODEC_ID as i, MONGO_DATE_CODEC_ID as n, MONGO_VECTOR_CODEC_ID as o, MONGO_INT32_CODEC_ID as r, MONGO_BOOLEAN_CODEC_ID as t };
11
- //# sourceMappingURL=codec-ids-B-QSSwbW.mjs.map
11
+ export { MONGO_OBJECTID_CODEC_ID as a, MONGO_INT32_CODEC_ID as i, MONGO_DATE_CODEC_ID as n, MONGO_STRING_CODEC_ID as o, MONGO_DOUBLE_CODEC_ID as r, MONGO_VECTOR_CODEC_ID as s, MONGO_BOOLEAN_CODEC_ID as t };
12
+ //# sourceMappingURL=codec-ids-FBmJhfq-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-ids-FBmJhfq-.mjs","names":[],"sources":["../src/core/codec-ids.ts"],"sourcesContent":["export const MONGO_OBJECTID_CODEC_ID = 'mongo/objectId@1' as const;\nexport const MONGO_STRING_CODEC_ID = 'mongo/string@1' as const;\nexport const MONGO_DOUBLE_CODEC_ID = 'mongo/double@1' as const;\nexport const MONGO_INT32_CODEC_ID = 'mongo/int32@1' as const;\nexport const MONGO_BOOLEAN_CODEC_ID = 'mongo/bool@1' as const;\nexport const MONGO_DATE_CODEC_ID = 'mongo/date@1' as const;\nexport const MONGO_VECTOR_CODEC_ID = 'mongo/vector@1' as const;\n"],"mappings":";AAAA,MAAa,0BAA0B;AACvC,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;AACrC,MAAa,uBAAuB;AACpC,MAAa,yBAAyB;AACtC,MAAa,sBAAsB;AACnC,MAAa,wBAAwB"}
@@ -11,6 +11,10 @@ type CodecTypes = {
11
11
  readonly input: string;
12
12
  readonly output: string;
13
13
  };
14
+ readonly 'mongo/double@1': {
15
+ readonly input: number;
16
+ readonly output: number;
17
+ };
14
18
  readonly 'mongo/int32@1': {
15
19
  readonly input: number;
16
20
  readonly output: number;
@@ -1 +1 @@
1
- {"version":3,"file":"codec-types.d.mts","names":[],"sources":["../src/exports/codec-types.ts"],"sourcesContent":[],"mappings":";KAAY;EAAA,SAAM,cACW,CAAA,EAAD,CAAC;AAG7B,CAAA;KAAY,UAAA;;;;;;;;;;;;;;;;;;oBAKiC;qBAAuB"}
1
+ {"version":3,"file":"codec-types.d.mts","names":[],"sources":["../src/exports/codec-types.ts"],"sourcesContent":[],"mappings":";KAAY;EAAA,SAAM,cACW,CAAA,EAAD,CAAC;AAG7B,CAAA;KAAY,UAAA;;;;;;;;;;;;;;;;;;;;;;oBAMiC;qBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;cAUM,wBAAwB"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;cAWM,wBAAwB"}
package/dist/control.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MONGO_STRING_CODEC_ID, i as MONGO_OBJECTID_CODEC_ID, n as MONGO_DATE_CODEC_ID, o as MONGO_VECTOR_CODEC_ID, r as MONGO_INT32_CODEC_ID, t as MONGO_BOOLEAN_CODEC_ID } from "./codec-ids-B-QSSwbW.mjs";
1
+ import { a as MONGO_OBJECTID_CODEC_ID, i as MONGO_INT32_CODEC_ID, n as MONGO_DATE_CODEC_ID, o as MONGO_STRING_CODEC_ID, r as MONGO_DOUBLE_CODEC_ID, s as MONGO_VECTOR_CODEC_ID, t as MONGO_BOOLEAN_CODEC_ID } from "./codec-ids-FBmJhfq-.mjs";
2
2
  import { mongoCodec } from "@prisma-next/mongo-codec";
3
3
  import { ObjectId } from "mongodb";
4
4
 
@@ -21,6 +21,17 @@ const mongoStringCodec = mongoCodec({
21
21
  decode: (wire) => wire,
22
22
  encode: (value) => value
23
23
  });
24
+ const mongoDoubleCodec = mongoCodec({
25
+ typeId: MONGO_DOUBLE_CODEC_ID,
26
+ targetTypes: ["float"],
27
+ traits: [
28
+ "equality",
29
+ "order",
30
+ "numeric"
31
+ ],
32
+ decode: (wire) => wire,
33
+ encode: (value) => value
34
+ });
24
35
  const mongoInt32Codec = mongoCodec({
25
36
  typeId: MONGO_INT32_CODEC_ID,
26
37
  targetTypes: ["int"],
@@ -72,6 +83,7 @@ const mongoAdapterDescriptor = {
72
83
  codecInstances: [
73
84
  mongoObjectIdCodec,
74
85
  mongoStringCodec,
86
+ mongoDoubleCodec,
75
87
  mongoInt32Codec,
76
88
  mongoBooleanCodec,
77
89
  mongoDateCodec,
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["mongoAdapterDescriptor: ControlAdapterDescriptor<'mongo', 'mongo'>"],"sources":["../src/core/codecs.ts","../src/exports/control.ts"],"sourcesContent":["import { mongoCodec } from '@prisma-next/mongo-codec';\nimport { ObjectId } from 'mongodb';\nimport {\n MONGO_BOOLEAN_CODEC_ID,\n MONGO_DATE_CODEC_ID,\n MONGO_INT32_CODEC_ID,\n MONGO_OBJECTID_CODEC_ID,\n MONGO_STRING_CODEC_ID,\n MONGO_VECTOR_CODEC_ID,\n} from './codec-ids';\n\nexport const mongoObjectIdCodec = mongoCodec({\n typeId: MONGO_OBJECTID_CODEC_ID,\n targetTypes: ['objectId'],\n traits: ['equality'],\n decode: (wire: ObjectId) => wire.toHexString(),\n encode: (value: string) => new ObjectId(value),\n});\n\nexport const mongoStringCodec = mongoCodec({\n typeId: MONGO_STRING_CODEC_ID,\n targetTypes: ['string'],\n traits: ['equality', 'order', 'textual'],\n decode: (wire: string) => wire,\n encode: (value: string) => value,\n});\n\nexport const mongoInt32Codec = mongoCodec({\n typeId: MONGO_INT32_CODEC_ID,\n targetTypes: ['int'],\n traits: ['equality', 'order', 'numeric'],\n decode: (wire: number) => wire,\n encode: (value: number) => value,\n});\n\nexport const mongoBooleanCodec = mongoCodec({\n typeId: MONGO_BOOLEAN_CODEC_ID,\n targetTypes: ['bool'],\n traits: ['equality', 'boolean'],\n decode: (wire: boolean) => wire,\n encode: (value: boolean) => value,\n});\n\nexport const mongoDateCodec = mongoCodec({\n typeId: MONGO_DATE_CODEC_ID,\n targetTypes: ['date'],\n traits: ['equality', 'order'],\n decode: (wire: Date) => wire,\n encode: (value: Date) => value,\n});\n\nexport const mongoVectorCodec = mongoCodec({\n typeId: MONGO_VECTOR_CODEC_ID,\n targetTypes: ['vector'],\n traits: ['equality'],\n decode: (wire: readonly number[]) => wire,\n encode: (value: readonly number[]) => value,\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error('renderOutputType: expected positive integer \"length\" for Vector');\n }\n return `Vector<${length}>`;\n },\n});\n","import type { ControlAdapterDescriptor } from '@prisma-next/framework-components/control';\nimport {\n mongoBooleanCodec,\n mongoDateCodec,\n mongoInt32Codec,\n mongoObjectIdCodec,\n mongoStringCodec,\n mongoVectorCodec,\n} from '../core/codecs';\n\nconst mongoAdapterDescriptor: ControlAdapterDescriptor<'mongo', 'mongo'> = {\n kind: 'adapter',\n id: 'mongo',\n familyId: 'mongo',\n targetId: 'mongo',\n version: '0.0.1',\n types: {\n codecTypes: {\n codecInstances: [\n mongoObjectIdCodec,\n mongoStringCodec,\n mongoInt32Codec,\n mongoBooleanCodec,\n mongoDateCodec,\n mongoVectorCodec,\n ],\n import: {\n package: '@prisma-next/adapter-mongo/codec-types',\n named: 'CodecTypes',\n alias: 'MongoCodecTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/adapter-mongo/codec-types',\n named: 'Vector',\n alias: 'Vector',\n },\n ],\n },\n },\n create() {\n return { familyId: 'mongo' as const, targetId: 'mongo' as const };\n },\n};\n\nexport default mongoAdapterDescriptor;\n"],"mappings":";;;;;AAWA,MAAa,qBAAqB,WAAW;CAC3C,QAAQ;CACR,aAAa,CAAC,WAAW;CACzB,QAAQ,CAAC,WAAW;CACpB,SAAS,SAAmB,KAAK,aAAa;CAC9C,SAAS,UAAkB,IAAI,SAAS,MAAM;CAC/C,CAAC;AAEF,MAAa,mBAAmB,WAAW;CACzC,QAAQ;CACR,aAAa,CAAC,SAAS;CACvB,QAAQ;EAAC;EAAY;EAAS;EAAU;CACxC,SAAS,SAAiB;CAC1B,SAAS,UAAkB;CAC5B,CAAC;AAEF,MAAa,kBAAkB,WAAW;CACxC,QAAQ;CACR,aAAa,CAAC,MAAM;CACpB,QAAQ;EAAC;EAAY;EAAS;EAAU;CACxC,SAAS,SAAiB;CAC1B,SAAS,UAAkB;CAC5B,CAAC;AAEF,MAAa,oBAAoB,WAAW;CAC1C,QAAQ;CACR,aAAa,CAAC,OAAO;CACrB,QAAQ,CAAC,YAAY,UAAU;CAC/B,SAAS,SAAkB;CAC3B,SAAS,UAAmB;CAC7B,CAAC;AAEF,MAAa,iBAAiB,WAAW;CACvC,QAAQ;CACR,aAAa,CAAC,OAAO;CACrB,QAAQ,CAAC,YAAY,QAAQ;CAC7B,SAAS,SAAe;CACxB,SAAS,UAAgB;CAC1B,CAAC;AAEF,MAAa,mBAAmB,WAAW;CACzC,QAAQ;CACR,aAAa,CAAC,SAAS;CACvB,QAAQ,CAAC,WAAW;CACpB,SAAS,SAA4B;CACrC,SAAS,UAA6B;CACtC,mBAAmB,eAAe;EAChC,MAAM,SAAS,WAAW;AAC1B,MAAI,WAAW,OAAW,QAAO;AACjC,MAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,OAAO,IAAI,CAAC,OAAO,UAAU,OAAO,CACrF,OAAM,IAAI,MAAM,oEAAkE;AAEpF,SAAO,UAAU,OAAO;;CAE3B,CAAC;;;;ACvDF,MAAMA,yBAAqE;CACzE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO,EACL,YAAY;EACV,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACD;EACD,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;GACR;EACD,aAAa,CACX;GACE,SAAS;GACT,OAAO;GACP,OAAO;GACR,CACF;EACF,EACF;CACD,SAAS;AACP,SAAO;GAAE,UAAU;GAAkB,UAAU;GAAkB;;CAEpE;AAED,sBAAe"}
1
+ {"version":3,"file":"control.mjs","names":["mongoAdapterDescriptor: ControlAdapterDescriptor<'mongo', 'mongo'>"],"sources":["../src/core/codecs.ts","../src/exports/control.ts"],"sourcesContent":["import { mongoCodec } from '@prisma-next/mongo-codec';\nimport { ObjectId } from 'mongodb';\nimport {\n MONGO_BOOLEAN_CODEC_ID,\n MONGO_DATE_CODEC_ID,\n MONGO_DOUBLE_CODEC_ID,\n MONGO_INT32_CODEC_ID,\n MONGO_OBJECTID_CODEC_ID,\n MONGO_STRING_CODEC_ID,\n MONGO_VECTOR_CODEC_ID,\n} from './codec-ids';\n\nexport const mongoObjectIdCodec = mongoCodec({\n typeId: MONGO_OBJECTID_CODEC_ID,\n targetTypes: ['objectId'],\n traits: ['equality'],\n decode: (wire: ObjectId) => wire.toHexString(),\n encode: (value: string) => new ObjectId(value),\n});\n\nexport const mongoStringCodec = mongoCodec({\n typeId: MONGO_STRING_CODEC_ID,\n targetTypes: ['string'],\n traits: ['equality', 'order', 'textual'],\n decode: (wire: string) => wire,\n encode: (value: string) => value,\n});\n\nexport const mongoDoubleCodec = mongoCodec({\n typeId: MONGO_DOUBLE_CODEC_ID,\n targetTypes: ['float'],\n traits: ['equality', 'order', 'numeric'],\n decode: (wire: number) => wire,\n encode: (value: number) => value,\n});\n\nexport const mongoInt32Codec = mongoCodec({\n typeId: MONGO_INT32_CODEC_ID,\n targetTypes: ['int'],\n traits: ['equality', 'order', 'numeric'],\n decode: (wire: number) => wire,\n encode: (value: number) => value,\n});\n\nexport const mongoBooleanCodec = mongoCodec({\n typeId: MONGO_BOOLEAN_CODEC_ID,\n targetTypes: ['bool'],\n traits: ['equality', 'boolean'],\n decode: (wire: boolean) => wire,\n encode: (value: boolean) => value,\n});\n\nexport const mongoDateCodec = mongoCodec({\n typeId: MONGO_DATE_CODEC_ID,\n targetTypes: ['date'],\n traits: ['equality', 'order'],\n decode: (wire: Date) => wire,\n encode: (value: Date) => value,\n});\n\nexport const mongoVectorCodec = mongoCodec({\n typeId: MONGO_VECTOR_CODEC_ID,\n targetTypes: ['vector'],\n traits: ['equality'],\n decode: (wire: readonly number[]) => wire,\n encode: (value: readonly number[]) => value,\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error('renderOutputType: expected positive integer \"length\" for Vector');\n }\n return `Vector<${length}>`;\n },\n});\n","import type { ControlAdapterDescriptor } from '@prisma-next/framework-components/control';\nimport {\n mongoBooleanCodec,\n mongoDateCodec,\n mongoDoubleCodec,\n mongoInt32Codec,\n mongoObjectIdCodec,\n mongoStringCodec,\n mongoVectorCodec,\n} from '../core/codecs';\n\nconst mongoAdapterDescriptor: ControlAdapterDescriptor<'mongo', 'mongo'> = {\n kind: 'adapter',\n id: 'mongo',\n familyId: 'mongo',\n targetId: 'mongo',\n version: '0.0.1',\n types: {\n codecTypes: {\n codecInstances: [\n mongoObjectIdCodec,\n mongoStringCodec,\n mongoDoubleCodec,\n mongoInt32Codec,\n mongoBooleanCodec,\n mongoDateCodec,\n mongoVectorCodec,\n ],\n import: {\n package: '@prisma-next/adapter-mongo/codec-types',\n named: 'CodecTypes',\n alias: 'MongoCodecTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/adapter-mongo/codec-types',\n named: 'Vector',\n alias: 'Vector',\n },\n ],\n },\n },\n create() {\n return { familyId: 'mongo' as const, targetId: 'mongo' as const };\n },\n};\n\nexport default mongoAdapterDescriptor;\n"],"mappings":";;;;;AAYA,MAAa,qBAAqB,WAAW;CAC3C,QAAQ;CACR,aAAa,CAAC,WAAW;CACzB,QAAQ,CAAC,WAAW;CACpB,SAAS,SAAmB,KAAK,aAAa;CAC9C,SAAS,UAAkB,IAAI,SAAS,MAAM;CAC/C,CAAC;AAEF,MAAa,mBAAmB,WAAW;CACzC,QAAQ;CACR,aAAa,CAAC,SAAS;CACvB,QAAQ;EAAC;EAAY;EAAS;EAAU;CACxC,SAAS,SAAiB;CAC1B,SAAS,UAAkB;CAC5B,CAAC;AAEF,MAAa,mBAAmB,WAAW;CACzC,QAAQ;CACR,aAAa,CAAC,QAAQ;CACtB,QAAQ;EAAC;EAAY;EAAS;EAAU;CACxC,SAAS,SAAiB;CAC1B,SAAS,UAAkB;CAC5B,CAAC;AAEF,MAAa,kBAAkB,WAAW;CACxC,QAAQ;CACR,aAAa,CAAC,MAAM;CACpB,QAAQ;EAAC;EAAY;EAAS;EAAU;CACxC,SAAS,SAAiB;CAC1B,SAAS,UAAkB;CAC5B,CAAC;AAEF,MAAa,oBAAoB,WAAW;CAC1C,QAAQ;CACR,aAAa,CAAC,OAAO;CACrB,QAAQ,CAAC,YAAY,UAAU;CAC/B,SAAS,SAAkB;CAC3B,SAAS,UAAmB;CAC7B,CAAC;AAEF,MAAa,iBAAiB,WAAW;CACvC,QAAQ;CACR,aAAa,CAAC,OAAO;CACrB,QAAQ,CAAC,YAAY,QAAQ;CAC7B,SAAS,SAAe;CACxB,SAAS,UAAgB;CAC1B,CAAC;AAEF,MAAa,mBAAmB,WAAW;CACzC,QAAQ;CACR,aAAa,CAAC,SAAS;CACvB,QAAQ,CAAC,WAAW;CACpB,SAAS,SAA4B;CACrC,SAAS,UAA6B;CACtC,mBAAmB,eAAe;EAChC,MAAM,SAAS,WAAW;AAC1B,MAAI,WAAW,OAAW,QAAO;AACjC,MAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,OAAO,IAAI,CAAC,OAAO,UAAU,OAAO,CACrF,OAAM,IAAI,MAAM,oEAAkE;AAEpF,SAAO,UAAU,OAAO;;CAE3B,CAAC;;;;AC/DF,MAAMA,yBAAqE;CACzE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO,EACL,YAAY;EACV,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;GACR;EACD,aAAa,CACX;GACE,SAAS;GACT,OAAO;GACP,OAAO;GACR,CACF;EACF,EACF;CACD,SAAS;AACP,SAAO;GAAE,UAAU;GAAkB,UAAU;GAAkB;;CAEpE;AAED,sBAAe"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { o as MONGO_VECTOR_CODEC_ID, r as MONGO_INT32_CODEC_ID } from "./codec-ids-B-QSSwbW.mjs";
1
+ import { i as MONGO_INT32_CODEC_ID, s as MONGO_VECTOR_CODEC_ID } from "./codec-ids-FBmJhfq-.mjs";
2
2
  import { isExprArray, isRecordArgs } from "@prisma-next/mongo-query-ast";
3
3
  import { MongoParamRef } from "@prisma-next/mongo-value";
4
4
  import { AggregateWireCommand, DeleteManyWireCommand, DeleteOneWireCommand, FindOneAndDeleteWireCommand, FindOneAndUpdateWireCommand, InsertManyWireCommand, InsertOneWireCommand, UpdateManyWireCommand, UpdateOneWireCommand } from "@prisma-next/mongo-wire";
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "name": "@prisma-next/adapter-mongo",
3
- "version": "0.3.0-dev.146",
3
+ "version": "0.3.0-dev.147",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "MongoDB adapter for Prisma Next (lowers commands to wire format)",
7
7
  "dependencies": {
8
8
  "mongodb": "^6.16.0",
9
- "@prisma-next/config": "0.3.0-dev.146",
10
- "@prisma-next/framework-components": "0.3.0-dev.146",
11
- "@prisma-next/mongo-codec": "0.3.0-dev.146",
12
- "@prisma-next/mongo-lowering": "0.3.0-dev.146",
13
- "@prisma-next/mongo-query-ast": "0.3.0-dev.146",
14
- "@prisma-next/mongo-wire": "0.3.0-dev.146",
15
- "@prisma-next/operations": "0.3.0-dev.146",
16
- "@prisma-next/mongo-value": "0.3.0-dev.146"
9
+ "@prisma-next/config": "0.3.0-dev.147",
10
+ "@prisma-next/framework-components": "0.3.0-dev.147",
11
+ "@prisma-next/mongo-lowering": "0.3.0-dev.147",
12
+ "@prisma-next/mongo-value": "0.3.0-dev.147",
13
+ "@prisma-next/mongo-codec": "0.3.0-dev.147",
14
+ "@prisma-next/mongo-query-ast": "0.3.0-dev.147",
15
+ "@prisma-next/operations": "0.3.0-dev.147",
16
+ "@prisma-next/mongo-wire": "0.3.0-dev.147"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsdown": "0.18.4",
20
20
  "typescript": "5.9.3",
21
21
  "vitest": "4.0.17",
22
- "@prisma-next/contract": "0.3.0-dev.146",
22
+ "@prisma-next/contract": "0.3.0-dev.147",
23
+ "@prisma-next/tsconfig": "0.0.0",
23
24
  "@prisma-next/test-utils": "0.0.1",
24
- "@prisma-next/tsdown": "0.0.0",
25
- "@prisma-next/tsconfig": "0.0.0"
25
+ "@prisma-next/tsdown": "0.0.0"
26
26
  },
27
27
  "files": [
28
28
  "dist",
@@ -1,5 +1,6 @@
1
1
  export const MONGO_OBJECTID_CODEC_ID = 'mongo/objectId@1' as const;
2
2
  export const MONGO_STRING_CODEC_ID = 'mongo/string@1' as const;
3
+ export const MONGO_DOUBLE_CODEC_ID = 'mongo/double@1' as const;
3
4
  export const MONGO_INT32_CODEC_ID = 'mongo/int32@1' as const;
4
5
  export const MONGO_BOOLEAN_CODEC_ID = 'mongo/bool@1' as const;
5
6
  export const MONGO_DATE_CODEC_ID = 'mongo/date@1' as const;
@@ -3,6 +3,7 @@ import { ObjectId } from 'mongodb';
3
3
  import {
4
4
  MONGO_BOOLEAN_CODEC_ID,
5
5
  MONGO_DATE_CODEC_ID,
6
+ MONGO_DOUBLE_CODEC_ID,
6
7
  MONGO_INT32_CODEC_ID,
7
8
  MONGO_OBJECTID_CODEC_ID,
8
9
  MONGO_STRING_CODEC_ID,
@@ -25,6 +26,14 @@ export const mongoStringCodec = mongoCodec({
25
26
  encode: (value: string) => value,
26
27
  });
27
28
 
29
+ export const mongoDoubleCodec = mongoCodec({
30
+ typeId: MONGO_DOUBLE_CODEC_ID,
31
+ targetTypes: ['float'],
32
+ traits: ['equality', 'order', 'numeric'],
33
+ decode: (wire: number) => wire,
34
+ encode: (value: number) => value,
35
+ });
36
+
28
37
  export const mongoInt32Codec = mongoCodec({
29
38
  typeId: MONGO_INT32_CODEC_ID,
30
39
  targetTypes: ['int'],
@@ -5,6 +5,7 @@ export type Vector<N extends number = number> = readonly number[] & {
5
5
  export type CodecTypes = {
6
6
  readonly 'mongo/objectId@1': { readonly input: string; readonly output: string };
7
7
  readonly 'mongo/string@1': { readonly input: string; readonly output: string };
8
+ readonly 'mongo/double@1': { readonly input: number; readonly output: number };
8
9
  readonly 'mongo/int32@1': { readonly input: number; readonly output: number };
9
10
  readonly 'mongo/bool@1': { readonly input: boolean; readonly output: boolean };
10
11
  readonly 'mongo/date@1': { readonly input: Date; readonly output: Date };
@@ -2,6 +2,7 @@ import type { ControlAdapterDescriptor } from '@prisma-next/framework-components
2
2
  import {
3
3
  mongoBooleanCodec,
4
4
  mongoDateCodec,
5
+ mongoDoubleCodec,
5
6
  mongoInt32Codec,
6
7
  mongoObjectIdCodec,
7
8
  mongoStringCodec,
@@ -19,6 +20,7 @@ const mongoAdapterDescriptor: ControlAdapterDescriptor<'mongo', 'mongo'> = {
19
20
  codecInstances: [
20
21
  mongoObjectIdCodec,
21
22
  mongoStringCodec,
23
+ mongoDoubleCodec,
22
24
  mongoInt32Codec,
23
25
  mongoBooleanCodec,
24
26
  mongoDateCodec,
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-ids-B-QSSwbW.mjs","names":[],"sources":["../src/core/codec-ids.ts"],"sourcesContent":["export const MONGO_OBJECTID_CODEC_ID = 'mongo/objectId@1' as const;\nexport const MONGO_STRING_CODEC_ID = 'mongo/string@1' as const;\nexport const MONGO_INT32_CODEC_ID = 'mongo/int32@1' as const;\nexport const MONGO_BOOLEAN_CODEC_ID = 'mongo/bool@1' as const;\nexport const MONGO_DATE_CODEC_ID = 'mongo/date@1' as const;\nexport const MONGO_VECTOR_CODEC_ID = 'mongo/vector@1' as const;\n"],"mappings":";AAAA,MAAa,0BAA0B;AACvC,MAAa,wBAAwB;AACrC,MAAa,uBAAuB;AACpC,MAAa,yBAAyB;AACtC,MAAa,sBAAsB;AACnC,MAAa,wBAAwB"}