@prisma/orm-family-mongo 8.0.0-rc.11-dev.53 → 8.0.0-rc.11-dev.55

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,9 +1,9 @@
1
1
  import { t as contractError } from "./contract-errors-BCN6RVI5-kMurtAbI.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { ok } from "@prisma/orm-framework/utils/result";
4
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
5
4
  import { pathToFileURL } from "node:url";
6
5
  import { applySpecifierDefaultControlPolicy } from "@prisma/orm-framework/contract/apply-specifier-default-control-policy";
6
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
7
7
  //#region ../../../2-mongo-family/2-authoring/contract-ts/dist/config-types.mjs
8
8
  function typescriptContract(contract, output, options) {
9
9
  return {
@@ -21,7 +21,7 @@ function typescriptContractFromPath(contractPath, output, options) {
21
21
  inputs: [contractPath],
22
22
  load: async (context) => {
23
23
  const [absolutePath] = context.resolvedInputs;
24
- if (absolutePath === void 0) throw new InternalError("typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.");
24
+ if (absolutePath === void 0) throw new InternalError("typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it from source.inputs.");
25
25
  const mod = await import(pathToFileURL(absolutePath).href);
26
26
  const contract = mod.default ?? mod.contract;
27
27
  if (contract === void 0) throw contractError("CONTRACT.MODULE_EXPORT_MISSING", `typescriptContractFromPath: module at "${absolutePath}" has no "default" or "contract" export.`, { meta: { path: absolutePath } });
@@ -34,4 +34,4 @@ function typescriptContractFromPath(contractPath, output, options) {
34
34
  //#endregion
35
35
  export { typescriptContractFromPath as n, typescriptContract as t };
36
36
 
37
- //# sourceMappingURL=config-types-CFDf9ivE.mjs.map
37
+ //# sourceMappingURL=config-types-v_AdyJzO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-types-v_AdyJzO.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { pathToFileURL } from \"node:url\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/config-types.ts\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it from source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n//#endregion\nexport { typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,mBAAmB,UAAU,QAAQ,SAAS;CACtD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;EACjG;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,2BAA2B,cAAc,QAAQ,SAAS;CAClE,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAK,GAAG,MAAM,IAAI,cAAc,2HAA2H;IAChL,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,0CAA0C,aAAa,2CAA2C,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,CAAC;IACjN,OAAO,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;GACtF;EACD;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD"}
@@ -27,7 +27,7 @@ declare function derivePolymorphicJsonSchema(baseFields: Record<string, Contract
27
27
  //#endregion
28
28
  //#region src/interpreter.d.ts
29
29
  interface InterpretPslDocumentToMongoContractInput {
30
- readonly document: DocumentAst;
30
+ readonly documents: readonly DocumentAst[];
31
31
  readonly symbolTable: SymbolTable;
32
32
  readonly sources: PslSources;
33
33
  readonly scalarTypeCodecIds: ReadonlyMap<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"contract-psl.d.mts","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;KAeK,iBAAiB;WACX,iBAAiB;;iBAEX,iBAAiB,QAAQ,eAAe,gBAAgB,eAAe,eAAe,sBAAsB,cAAc,aAAa,YAAY,iBAAiB;UAC3K;WACC;WACA,QAAQ,eAAe;;iBAEjB,4BAA4B,YAAY,eAAe,gBAAgB,4BAA4B,mBAAmB,sBAAsB,eAAe,eAAe,sBAAsB,cAAc,aAAa,YAAY,iBAAiB;;;UAG/P;WACC,UAAU;WACV,aAAa;WACb,SAAS;WACT,oBAAoB;WACpB,yBAAyB;WACzB,cAAc;WACd,2BAA2B;WAC3B,yBAAyB;;WAEzB;aACE;aACA;;;iBAGI,oCAAoC,OAAO,2CAA2C,OAAO,UAAU;;;iBAGvG,iBAAiB;EAChC,qCAAqC,wBAAwB;EAC7D;GACC;cACW;WACH;aACE,MAAM,KAAK,yBAAyB;MAC3C;OACC;aACM,gBAAgB,KAAK,yBAAyB;MACrD;OACC;aACM,aAAa;aACb,QAAQ,KAAK,yBAAyB;MAC7C,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT;eACA;eACA;eACA;OACR;aACM,SAAS,KAAK,yBAAyB;MAC9C,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT;eACA;eACA;eACA;OACR;aACM,YAAY,KAAK,yBAAyB;MACjD,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT,UAAU;eACV;eACA;OACR;;WAEI;aACE,KAAK,KAAK,8BAA8B,kBAAkB;aAC1D,SAAS,KAAK,8BAA8B,kBAAkB;aAC9D,MAAM,KAAK,8BAA8B;MAChD;OACC;aACM,WAAW,KAAK,8BAA8B;MACrD;eACS;eACA;OACR"}
1
+ {"version":3,"file":"contract-psl.d.mts","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;KAeK,iBAAiB;WACX,iBAAiB;;iBAEX,iBAAiB,QAAQ,eAAe,gBAAgB,eAAe,eAAe,sBAAsB,cAAc,aAAa,YAAY,iBAAiB;UAC3K;WACC;WACA,QAAQ,eAAe;;iBAEjB,4BAA4B,YAAY,eAAe,gBAAgB,4BAA4B,mBAAmB,sBAAsB,eAAe,eAAe,sBAAsB,cAAc,aAAa,YAAY,iBAAiB;;;UAG/P;WACC,oBAAoB;WACpB,aAAa;WACb,SAAS;WACT,oBAAoB;WACpB,yBAAyB;WACzB,cAAc;WACd,2BAA2B;WAC3B,yBAAyB;;WAEzB;aACE;aACA;;;iBAGI,oCAAoC,OAAO,2CAA2C,OAAO,UAAU;;;iBAGvG,iBAAiB;EAChC,qCAAqC,wBAAwB;EAC7D;GACC;cACW;WACH;aACE,MAAM,KAAK,yBAAyB;MAC3C;OACC;aACM,gBAAgB,KAAK,yBAAyB;MACrD;OACC;aACM,aAAa;aACb,QAAQ,KAAK,yBAAyB;MAC7C,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT;eACA;eACA;eACA;OACR;aACM,SAAS,KAAK,yBAAyB;MAC9C,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT;eACA;eACA;eACA;OACR;aACM,YAAY,KAAK,yBAAyB;MACjD,kBAAkB;eACT;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA;eACA,SAAS;eACT,UAAU;eACV;eACA;OACR;;WAEI;aACE,KAAK,KAAK,8BAA8B,kBAAkB;aAC1D,SAAS,KAAK,8BAA8B,kBAAkB;aAC9D,MAAM,KAAK,8BAA8B;MAChD;OACC;aACM,WAAW,KAAK,8BAA8B;MACrD;eACS;eACA;OACR"}
@@ -1,12 +1,12 @@
1
1
  import { r as interpretPslDocumentToMongoContract } from "./interpreter-BsGn9AR--DggjzYPT.mjs";
2
2
  import { collectScalarTypeConstructors } from "@prisma/orm-framework/components/authoring";
3
- import { buildSymbolTable, mapPslDiagnostics } from "@prisma/orm-framework/psl-parser";
3
+ import { buildSymbolTable, isPrismaNextSchema, mapPslDiagnostics } from "@prisma/orm-framework/psl-parser";
4
4
  import { withSeedDiagnostics } from "@prisma/orm-framework/psl-parser/interpret";
5
+ import { assertDefined } from "@prisma/orm-framework/utils/assertions";
5
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
7
  import { notOk } from "@prisma/orm-framework/utils/result";
7
8
  import { readFile } from "node:fs/promises";
8
9
  import { parse } from "@prisma/orm-framework/psl-parser/syntax";
9
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
10
10
  //#region ../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs
11
11
  function collectScalarTypeCodecIds(namespace) {
12
12
  return new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));
@@ -18,7 +18,7 @@ function mongoContract(schemaPath, options) {
18
18
  inputs: [schemaPath],
19
19
  interpret(input, context) {
20
20
  return interpretPslDocumentToMongoContract({
21
- document: input.document,
21
+ documents: input.documents,
22
22
  symbolTable: input.symbolTable,
23
23
  sources: input.sources,
24
24
  seedDiagnostics: [],
@@ -33,36 +33,64 @@ function mongoContract(schemaPath, options) {
33
33
  });
34
34
  },
35
35
  async load(context) {
36
- const [absoluteSchemaPath] = context.resolvedInputs;
37
- if (absoluteSchemaPath === void 0) throw new InternalError("mongoContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.");
38
- let schema;
39
- try {
40
- schema = await readFile(absoluteSchemaPath, "utf-8");
41
- } catch (error) {
42
- const message = String(error);
43
- return notOk({
44
- summary: `Failed to read Prisma schema at "${schemaPath}"`,
45
- diagnostics: [{
36
+ const candidates = [...new Set(context.resolvedInputs)].sort();
37
+ if (candidates.length === 0) return notOk({
38
+ summary: "No schema files matched the configured contract source",
39
+ diagnostics: [{
40
+ code: "PSL_NO_SCHEMA_FILES_MATCHED",
41
+ message: `No files matched the configured pattern "${schemaPath}"`,
42
+ sourceId: schemaPath
43
+ }]
44
+ });
45
+ const readDiagnostics = [];
46
+ const members = [];
47
+ const undirected = [];
48
+ for (const path of candidates) {
49
+ let text;
50
+ try {
51
+ text = await readFile(path, "utf-8");
52
+ } catch (error) {
53
+ const message = String(error);
54
+ readDiagnostics.push({
46
55
  code: "PSL_SCHEMA_READ_FAILED",
47
56
  message,
57
+ sourceId: path
58
+ });
59
+ continue;
60
+ }
61
+ if (isPrismaNextSchema(text)) members.push({
62
+ path,
63
+ text
64
+ });
65
+ else undirected.push(path);
66
+ }
67
+ if (members.length === 0) {
68
+ if (undirected.length === 0) return notOk({
69
+ summary: "Failed to read Prisma schema files",
70
+ diagnostics: readDiagnostics
71
+ });
72
+ return notOk({
73
+ summary: "No schema file carries the \"// use prisma-8\" directive",
74
+ diagnostics: [...readDiagnostics, {
75
+ code: "PSL_NO_OPTED_IN_SCHEMA_FILES",
76
+ message: `None of the matched files carry the "// use prisma-8" directive: ${undirected.join(", ")}`,
48
77
  sourceId: schemaPath
49
- }],
50
- meta: {
51
- schemaPath,
52
- absoluteSchemaPath,
53
- cause: message
54
- }
78
+ }]
55
79
  });
56
80
  }
57
- const { document, sources, diagnostics: parseDiagnostics } = parse(schema, schemaPath);
81
+ const parsed = members.map(({ path, text }) => parse(text, path));
82
+ const documents = parsed.map(({ document }) => document);
83
+ const [firstSources, ...restSources] = parsed.map(({ sources }) => sources);
84
+ assertDefined(firstSources, "mongoContract requires at least one parsed schema file");
85
+ const sources = firstSources.merge(...restSources);
58
86
  const { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({
59
- documents: [document],
87
+ documents,
60
88
  sources,
61
89
  pslBlockDescriptors: context.authoringContributions.pslBlockDescriptors
62
90
  });
63
- const seedDiagnostics = mapPslDiagnostics([...parseDiagnostics, ...symbolTableDiagnostics], sources);
91
+ const seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics([...parsed.flatMap(({ diagnostics }) => diagnostics), ...symbolTableDiagnostics], sources)];
64
92
  return withSeedDiagnostics(this.interpret({
65
- document,
93
+ documents,
66
94
  sources,
67
95
  symbolTable
68
96
  }, context), seedDiagnostics);
@@ -1 +1 @@
1
- {"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-BsGn9AR-.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/provider.ts\nfunction collectScalarTypeCodecIds(namespace) {\n\treturn new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));\n}\nfunction mongoContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\tdocument: input.document,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tscalarTypeCodecIds: collectScalarTypeCodecIds(context.authoringContributions.type),\n\t\t\t\t\tcontrolMutationDefaults: {\n\t\t\t\t\t\t...context.controlMutationDefaults,\n\t\t\t\t\t\tdataTypeEntries: context.authoringContributions.dataTypes\n\t\t\t\t\t},\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options?.enumInferenceCodecs)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst [absoluteSchemaPath] = context.resolvedInputs;\n\t\t\t\tif (absoluteSchemaPath === void 0) throw new InternalError(\"mongoContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tlet schema;\n\t\t\t\ttry {\n\t\t\t\t\tschema = await readFile(absoluteSchemaPath, \"utf-8\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error);\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: `Failed to read Prisma schema at \"${schemaPath}\"`,\n\t\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}],\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tschemaPath,\n\t\t\t\t\t\t\tabsoluteSchemaPath,\n\t\t\t\t\t\t\tcause: message\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst { document, sources, diagnostics: parseDiagnostics } = parse(schema, schemaPath);\n\t\t\t\tconst { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocuments: [document],\n\t\t\t\t\tsources,\n\t\t\t\t\tpslBlockDescriptors: context.authoringContributions.pslBlockDescriptors\n\t\t\t\t});\n\t\t\t\tconst seedDiagnostics = mapPslDiagnostics([...parseDiagnostics, ...symbolTableDiagnostics], sources);\n\t\t\t\treturn withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsources,\n\t\t\t\t\tsymbolTable\n\t\t\t\t}, context), seedDiagnostics);\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options?.output)\n\t};\n}\n//#endregion\nexport { mongoContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,0BAA0B,WAAW;CAC7C,OAAO,IAAI,IAAI,CAAC,GAAG,8BAA8B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAC7G;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,UAAU,MAAM;KAChB,aAAa,MAAM;KACnB,SAAS,MAAM;KACf,iBAAiB,CAAC;KAClB,oBAAoB,0BAA0B,QAAQ,uBAAuB,IAAI;KACjF,yBAAyB;MACxB,GAAG,QAAQ;MACX,iBAAiB,QAAQ,uBAAuB;KACjD;KACA,aAAa,QAAQ;KACrB,wBAAwB,QAAQ;KAChC,GAAG,UAAU,uBAAuB,SAAS,mBAAmB;IACjE,CAAC;GACF;GACA,MAAM,KAAK,SAAS;IACnB,MAAM,CAAC,sBAAsB,QAAQ;IACrC,IAAI,uBAAuB,KAAK,GAAG,MAAM,IAAI,cAAc,iIAAiI;IAC5L,IAAI;IACJ,IAAI;KACH,SAAS,MAAM,SAAS,oBAAoB,OAAO;IACpD,SAAS,OAAO;KACf,MAAM,UAAU,OAAO,KAAK;KAC5B,OAAO,MAAM;MACZ,SAAS,oCAAoC,WAAW;MACxD,aAAa,CAAC;OACb,MAAM;OACN;OACA,UAAU;MACX,CAAC;MACD,MAAM;OACL;OACA;OACA,OAAO;MACR;KACD,CAAC;IACF;IACA,MAAM,EAAE,UAAU,SAAS,aAAa,qBAAqB,MAAM,QAAQ,UAAU;IACrF,MAAM,EAAE,aAAa,aAAa,2BAA2B,iBAAiB;KAC7E,WAAW,CAAC,QAAQ;KACpB;KACA,qBAAqB,QAAQ,uBAAuB;IACrD,CAAC;IACD,MAAM,kBAAkB,kBAAkB,CAAC,GAAG,kBAAkB,GAAG,sBAAsB,GAAG,OAAO;IACnG,OAAO,oBAAoB,KAAK,UAAU;KACzC;KACA;KACA;IACD,GAAG,OAAO,GAAG,eAAe;GAC7B;EACD;EACA,GAAG,UAAU,UAAU,SAAS,MAAM;CACvC;AACD"}
1
+ {"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-BsGn9AR-.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, isPrismaNextSchema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { parse } from \"@internal/psl-parser/syntax\";\n//#region src/provider.ts\nfunction collectScalarTypeCodecIds(namespace) {\n\treturn new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));\n}\nfunction mongoContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\tdocuments: input.documents,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tscalarTypeCodecIds: collectScalarTypeCodecIds(context.authoringContributions.type),\n\t\t\t\t\tcontrolMutationDefaults: {\n\t\t\t\t\t\t...context.controlMutationDefaults,\n\t\t\t\t\t\tdataTypeEntries: context.authoringContributions.dataTypes\n\t\t\t\t\t},\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options?.enumInferenceCodecs)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst candidates = [...new Set(context.resolvedInputs)].sort();\n\t\t\t\tif (candidates.length === 0) return notOk({\n\t\t\t\t\tsummary: \"No schema files matched the configured contract source\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PSL_NO_SCHEMA_FILES_MATCHED\",\n\t\t\t\t\t\tmessage: `No files matched the configured pattern \"${schemaPath}\"`,\n\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t\tconst readDiagnostics = [];\n\t\t\t\tconst members = [];\n\t\t\t\tconst undirected = [];\n\t\t\t\tfor (const path of candidates) {\n\t\t\t\t\tlet text;\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttext = await readFile(path, \"utf-8\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = String(error);\n\t\t\t\t\t\treadDiagnostics.push({\n\t\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tsourceId: path\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (isPrismaNextSchema(text)) members.push({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttext\n\t\t\t\t\t});\n\t\t\t\t\telse undirected.push(path);\n\t\t\t\t}\n\t\t\t\tif (members.length === 0) {\n\t\t\t\t\tif (undirected.length === 0) return notOk({\n\t\t\t\t\t\tsummary: \"Failed to read Prisma schema files\",\n\t\t\t\t\t\tdiagnostics: readDiagnostics\n\t\t\t\t\t});\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: \"No schema file carries the \\\"// use prisma-8\\\" directive\",\n\t\t\t\t\t\tdiagnostics: [...readDiagnostics, {\n\t\t\t\t\t\t\tcode: \"PSL_NO_OPTED_IN_SCHEMA_FILES\",\n\t\t\t\t\t\t\tmessage: `None of the matched files carry the \"// use prisma-8\" directive: ${undirected.join(\", \")}`,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst parsed = members.map(({ path, text }) => parse(text, path));\n\t\t\t\tconst documents = parsed.map(({ document }) => document);\n\t\t\t\tconst [firstSources, ...restSources] = parsed.map(({ sources }) => sources);\n\t\t\t\tassertDefined(firstSources, \"mongoContract requires at least one parsed schema file\");\n\t\t\t\tconst sources = firstSources.merge(...restSources);\n\t\t\t\tconst { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tpslBlockDescriptors: context.authoringContributions.pslBlockDescriptors\n\t\t\t\t});\n\t\t\t\tconst seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics([...parsed.flatMap(({ diagnostics }) => diagnostics), ...symbolTableDiagnostics], sources)];\n\t\t\t\treturn withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tsymbolTable\n\t\t\t\t}, context), seedDiagnostics);\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options?.output)\n\t};\n}\n//#endregion\nexport { mongoContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,0BAA0B,WAAW;CAC7C,OAAO,IAAI,IAAI,CAAC,GAAG,8BAA8B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAC7G;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,WAAW,MAAM;KACjB,aAAa,MAAM;KACnB,SAAS,MAAM;KACf,iBAAiB,CAAC;KAClB,oBAAoB,0BAA0B,QAAQ,uBAAuB,IAAI;KACjF,yBAAyB;MACxB,GAAG,QAAQ;MACX,iBAAiB,QAAQ,uBAAuB;KACjD;KACA,aAAa,QAAQ;KACrB,wBAAwB,QAAQ;KAChC,GAAG,UAAU,uBAAuB,SAAS,mBAAmB;IACjE,CAAC;GACF;GACA,MAAM,KAAK,SAAS;IACnB,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAK;IAC7D,IAAI,WAAW,WAAW,GAAG,OAAO,MAAM;KACzC,SAAS;KACT,aAAa,CAAC;MACb,MAAM;MACN,SAAS,4CAA4C,WAAW;MAChE,UAAU;KACX,CAAC;IACF,CAAC;IACD,MAAM,kBAAkB,CAAC;IACzB,MAAM,UAAU,CAAC;IACjB,MAAM,aAAa,CAAC;IACpB,KAAK,MAAM,QAAQ,YAAY;KAC9B,IAAI;KACJ,IAAI;MACH,OAAO,MAAM,SAAS,MAAM,OAAO;KACpC,SAAS,OAAO;MACf,MAAM,UAAU,OAAO,KAAK;MAC5B,gBAAgB,KAAK;OACpB,MAAM;OACN;OACA,UAAU;MACX,CAAC;MACD;KACD;KACA,IAAI,mBAAmB,IAAI,GAAG,QAAQ,KAAK;MAC1C;MACA;KACD,CAAC;UACI,WAAW,KAAK,IAAI;IAC1B;IACA,IAAI,QAAQ,WAAW,GAAG;KACzB,IAAI,WAAW,WAAW,GAAG,OAAO,MAAM;MACzC,SAAS;MACT,aAAa;KACd,CAAC;KACD,OAAO,MAAM;MACZ,SAAS;MACT,aAAa,CAAC,GAAG,iBAAiB;OACjC,MAAM;OACN,SAAS,oEAAoE,WAAW,KAAK,IAAI;OACjG,UAAU;MACX,CAAC;KACF,CAAC;IACF;IACA,MAAM,SAAS,QAAQ,KAAK,EAAE,MAAM,WAAW,MAAM,MAAM,IAAI,CAAC;IAChE,MAAM,YAAY,OAAO,KAAK,EAAE,eAAe,QAAQ;IACvD,MAAM,CAAC,cAAc,GAAG,eAAe,OAAO,KAAK,EAAE,cAAc,OAAO;IAC1E,cAAc,cAAc,wDAAwD;IACpF,MAAM,UAAU,aAAa,MAAM,GAAG,WAAW;IACjD,MAAM,EAAE,aAAa,aAAa,2BAA2B,iBAAiB;KAC7E;KACA;KACA,qBAAqB,QAAQ,uBAAuB;IACrD,CAAC;IACD,MAAM,kBAAkB,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,OAAO,SAAS,EAAE,kBAAkB,WAAW,GAAG,GAAG,sBAAsB,GAAG,OAAO,CAAC;IAC5J,OAAO,oBAAoB,KAAK,UAAU;KACzC;KACA;KACA;IACD,GAAG,OAAO,GAAG,eAAe;GAC7B;EACD;EACA,GAAG,UAAU,UAAU,SAAS,MAAM;CACvC;AACD"}
@@ -1,3 +1,3 @@
1
- import { n as typescriptContractFromPath, t as typescriptContract } from "./config-types-CFDf9ivE.mjs";
1
+ import { n as typescriptContractFromPath, t as typescriptContract } from "./config-types-v_AdyJzO.mjs";
2
2
  import { a as field, c as member, d as valueObject, i as enumType, l as model, n as buildBoundContract, o as index, r as defineContract, s as isEnumTypeHandle, t as bindEnumType, u as rel } from "./contract-builder-DeB13CGv.mjs";
3
3
  export { bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, typescriptContract, typescriptContractFromPath, valueObject };
@@ -1,2 +1,2 @@
1
- import { n as typescriptContractFromPath, t as typescriptContract } from "./config-types-CFDf9ivE.mjs";
1
+ import { n as typescriptContractFromPath, t as typescriptContract } from "./config-types-v_AdyJzO.mjs";
2
2
  export { typescriptContract, typescriptContractFromPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.11-dev.53",
3
+ "version": "8.0.0-rc.11-dev.55",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,29 +9,29 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.11-dev.53",
13
- "@prisma/orm-toolchain": "8.0.0-rc.11-dev.53",
12
+ "@prisma/orm-framework": "8.0.0-rc.11-dev.55",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.11-dev.55",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/family-mongo": "8.0.0-rc.11-dev.53",
20
- "@internal/mongo-codec": "8.0.0-rc.11-dev.53",
21
- "@internal/mongo-contract": "8.0.0-rc.11-dev.53",
22
- "@internal/mongo-contract-psl": "8.0.0-rc.11-dev.53",
23
- "@internal/mongo-contract-ts": "8.0.0-rc.11-dev.53",
24
- "@internal/mongo-emitter": "8.0.0-rc.11-dev.53",
25
- "@internal/mongo-lowering": "8.0.0-rc.11-dev.53",
26
- "@internal/mongo-orm": "8.0.0-rc.11-dev.53",
27
- "@internal/mongo-query-ast": "8.0.0-rc.11-dev.53",
28
- "@internal/mongo-query-builder": "8.0.0-rc.11-dev.53",
29
- "@internal/mongo-runtime": "8.0.0-rc.11-dev.53",
30
- "@internal/mongo-schema-ir": "8.0.0-rc.11-dev.53",
31
- "@internal/mongo-value": "8.0.0-rc.11-dev.53",
32
- "@internal/mongo-wire": "8.0.0-rc.11-dev.53",
33
- "@repo/tsconfig": "8.0.0-rc.11-dev.53",
34
- "@repo/tsdown": "8.0.0-rc.11-dev.53",
19
+ "@internal/family-mongo": "8.0.0-rc.11-dev.55",
20
+ "@internal/mongo-codec": "8.0.0-rc.11-dev.55",
21
+ "@internal/mongo-contract": "8.0.0-rc.11-dev.55",
22
+ "@internal/mongo-contract-psl": "8.0.0-rc.11-dev.55",
23
+ "@internal/mongo-contract-ts": "8.0.0-rc.11-dev.55",
24
+ "@internal/mongo-emitter": "8.0.0-rc.11-dev.55",
25
+ "@internal/mongo-lowering": "8.0.0-rc.11-dev.55",
26
+ "@internal/mongo-orm": "8.0.0-rc.11-dev.55",
27
+ "@internal/mongo-query-ast": "8.0.0-rc.11-dev.55",
28
+ "@internal/mongo-query-builder": "8.0.0-rc.11-dev.55",
29
+ "@internal/mongo-runtime": "8.0.0-rc.11-dev.55",
30
+ "@internal/mongo-schema-ir": "8.0.0-rc.11-dev.55",
31
+ "@internal/mongo-value": "8.0.0-rc.11-dev.55",
32
+ "@internal/mongo-wire": "8.0.0-rc.11-dev.55",
33
+ "@repo/tsconfig": "8.0.0-rc.11-dev.55",
34
+ "@repo/tsdown": "8.0.0-rc.11-dev.55",
35
35
  "tsdown": "0.22.14",
36
36
  "typescript": "5.9.3"
37
37
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-types-CFDf9ivE.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { pathToFileURL } from \"node:url\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/config-types.ts\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n//#endregion\nexport { typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,mBAAmB,UAAU,QAAQ,SAAS;CACtD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;EACjG;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,2BAA2B,cAAc,QAAQ,SAAS;CAClE,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAK,GAAG,MAAM,IAAI,cAAc,8IAA8I;IACnM,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,0CAA0C,aAAa,2CAA2C,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,CAAC;IACjN,OAAO,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;GACtF;EACD;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD"}