@prisma-next/mongo-contract-ts 0.14.0-dev.2 → 0.14.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-types.d.mts.map +1 -1
- package/dist/config-types.mjs +5 -1
- package/dist/config-types.mjs.map +1 -1
- package/package.json +10 -10
- package/src/config-types.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.d.mts","names":[],"sources":["../src/config-types.ts"],"mappings":";;;;UAOiB,kCAAA;EAAA,SACN,oBAAA,GAAuB,aAAa;AAAA;AAAA,iBAK/B,kBAAA,CACd,QAAA,EAAU,QAAA,EACV,MAAA,WACA,OAAA,GAAU,kCAAA,GACT,gBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"config-types.d.mts","names":[],"sources":["../src/config-types.ts"],"mappings":";;;;UAOiB,kCAAA;EAAA,SACN,oBAAA,GAAuB,aAAa;AAAA;AAAA,iBAK/B,kBAAA,CACd,QAAA,EAAU,QAAA,EACV,MAAA,WACA,OAAA,GAAU,kCAAA,GACT,gBAAA;AAAA,iBAWa,0BAAA,CACd,YAAA,UACA,MAAA,WACA,OAAA,GAAU,kCAAA,GACT,gBAAc"}
|
package/dist/config-types.mjs
CHANGED
|
@@ -5,13 +5,17 @@ import { ok } from "@prisma-next/utils/result";
|
|
|
5
5
|
//#region src/config-types.ts
|
|
6
6
|
function typescriptContract(contract, output, options) {
|
|
7
7
|
return {
|
|
8
|
-
source: {
|
|
8
|
+
source: {
|
|
9
|
+
sourceFormat: "typescript",
|
|
10
|
+
load: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))
|
|
11
|
+
},
|
|
9
12
|
...ifDefined("output", output)
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
function typescriptContractFromPath(contractPath, output, options) {
|
|
13
16
|
return {
|
|
14
17
|
source: {
|
|
18
|
+
sourceFormat: "typescript",
|
|
15
19
|
inputs: [contractPath],
|
|
16
20
|
load: async (context) => {
|
|
17
21
|
const [absolutePath] = context.resolvedInputs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.mjs","names":[],"sources":["../src/config-types.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport type { ContractConfig } from '@prisma-next/config/config-types';\nimport { applySpecifierDefaultControlPolicy } from '@prisma-next/contract/apply-specifier-default-control-policy';\nimport type { Contract, ControlPolicy } from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok } from '@prisma-next/utils/result';\n\nexport interface TypeScriptContractSpecifierOptions {\n readonly defaultControlPolicy?: ControlPolicy;\n}\n\n// This helper stays family-agnostic and intentionally accepts the base Contract shape even when\n// re-exported from a Mongo-specific package.\nexport function typescriptContract(\n contract: Contract,\n output?: string,\n options?: TypeScriptContractSpecifierOptions,\n): ContractConfig {\n return {\n source: {\n load: async () =>\n ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy)),\n },\n ...ifDefined('output', output),\n };\n}\n\nexport function typescriptContractFromPath(\n contractPath: string,\n output?: string,\n options?: TypeScriptContractSpecifierOptions,\n): ContractConfig {\n return {\n source: {\n inputs: [contractPath],\n load: async (context) => {\n const [absolutePath] = context.resolvedInputs;\n if (absolutePath === undefined) {\n throw new Error(\n 'typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.',\n );\n }\n const mod = await import(pathToFileURL(absolutePath).href);\n const contract: Contract | undefined = mod.default ?? mod.contract;\n if (contract === undefined) {\n throw new Error(\n `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`,\n );\n }\n return ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n },\n },\n ...ifDefined('output', output),\n };\n}\n"],"mappings":";;;;;AAaA,SAAgB,mBACd,UACA,QACA,SACgB;CAChB,OAAO;EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"config-types.mjs","names":[],"sources":["../src/config-types.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport type { ContractConfig } from '@prisma-next/config/config-types';\nimport { applySpecifierDefaultControlPolicy } from '@prisma-next/contract/apply-specifier-default-control-policy';\nimport type { Contract, ControlPolicy } from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok } from '@prisma-next/utils/result';\n\nexport interface TypeScriptContractSpecifierOptions {\n readonly defaultControlPolicy?: ControlPolicy;\n}\n\n// This helper stays family-agnostic and intentionally accepts the base Contract shape even when\n// re-exported from a Mongo-specific package.\nexport function typescriptContract(\n contract: Contract,\n output?: string,\n options?: TypeScriptContractSpecifierOptions,\n): ContractConfig {\n return {\n source: {\n sourceFormat: 'typescript',\n load: async () =>\n ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy)),\n },\n ...ifDefined('output', output),\n };\n}\n\nexport function typescriptContractFromPath(\n contractPath: string,\n output?: string,\n options?: TypeScriptContractSpecifierOptions,\n): ContractConfig {\n return {\n source: {\n sourceFormat: 'typescript',\n inputs: [contractPath],\n load: async (context) => {\n const [absolutePath] = context.resolvedInputs;\n if (absolutePath === undefined) {\n throw new Error(\n 'typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.',\n );\n }\n const mod = await import(pathToFileURL(absolutePath).href);\n const contract: Contract | undefined = mod.default ?? mod.contract;\n if (contract === undefined) {\n throw new Error(\n `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`,\n );\n }\n return ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n },\n },\n ...ifDefined('output', output),\n };\n}\n"],"mappings":";;;;;AAaA,SAAgB,mBACd,UACA,QACA,SACgB;CAChB,OAAO;EACL,QAAQ;GACN,cAAc;GACd,MAAM,YACJ,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;EAClF;EACA,GAAG,UAAU,UAAU,MAAM;CAC/B;AACF;AAEA,SAAgB,2BACd,cACA,QACA,SACgB;CAChB,OAAO;EACL,QAAQ;GACN,cAAc;GACd,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAA,GACnB,MAAM,IAAI,MACR,8IACF;IAEF,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAiC,IAAI,WAAW,IAAI;IAC1D,IAAI,aAAa,KAAA,GACf,MAAM,IAAI,MACR,0CAA0C,aAAa,yCACzD;IAEF,OAAO,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;GACvF;EACF;EACA,GAAG,UAAU,UAAU,MAAM;CAC/B;AACF"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/mongo-contract-ts",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Mongo-specific TypeScript contract authoring surface for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/config": "0.14.0-dev.
|
|
10
|
-
"@prisma-next/contract": "0.14.0-dev.
|
|
11
|
-
"@prisma-next/contract-authoring": "0.14.0-dev.
|
|
12
|
-
"@prisma-next/framework-components": "0.14.0-dev.
|
|
13
|
-
"@prisma-next/mongo-contract": "0.14.0-dev.
|
|
14
|
-
"@prisma-next/utils": "0.14.0-dev.
|
|
9
|
+
"@prisma-next/config": "0.14.0-dev.4",
|
|
10
|
+
"@prisma-next/contract": "0.14.0-dev.4",
|
|
11
|
+
"@prisma-next/contract-authoring": "0.14.0-dev.4",
|
|
12
|
+
"@prisma-next/framework-components": "0.14.0-dev.4",
|
|
13
|
+
"@prisma-next/mongo-contract": "0.14.0-dev.4",
|
|
14
|
+
"@prisma-next/utils": "0.14.0-dev.4",
|
|
15
15
|
"pathe": "^2.0.3"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@prisma-next/test-utils": "0.14.0-dev.
|
|
19
|
-
"@prisma-next/tsconfig": "0.14.0-dev.
|
|
20
|
-
"@prisma-next/tsdown": "0.14.0-dev.
|
|
18
|
+
"@prisma-next/test-utils": "0.14.0-dev.4",
|
|
19
|
+
"@prisma-next/tsconfig": "0.14.0-dev.4",
|
|
20
|
+
"@prisma-next/tsdown": "0.14.0-dev.4",
|
|
21
21
|
"tsdown": "0.22.1",
|
|
22
22
|
"typescript": "5.9.3",
|
|
23
23
|
"vitest": "4.1.8"
|
package/src/config-types.ts
CHANGED
|
@@ -18,6 +18,7 @@ export function typescriptContract(
|
|
|
18
18
|
): ContractConfig {
|
|
19
19
|
return {
|
|
20
20
|
source: {
|
|
21
|
+
sourceFormat: 'typescript',
|
|
21
22
|
load: async () =>
|
|
22
23
|
ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy)),
|
|
23
24
|
},
|
|
@@ -32,6 +33,7 @@ export function typescriptContractFromPath(
|
|
|
32
33
|
): ContractConfig {
|
|
33
34
|
return {
|
|
34
35
|
source: {
|
|
36
|
+
sourceFormat: 'typescript',
|
|
35
37
|
inputs: [contractPath],
|
|
36
38
|
load: async (context) => {
|
|
37
39
|
const [absolutePath] = context.resolvedInputs;
|