@prisma-next/sql-contract-ts 0.4.0-dev.9 → 0.4.2
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
CHANGED
|
@@ -3,6 +3,7 @@ import { ContractConfig, ContractConfig as ContractConfig$1 } from "@prisma-next
|
|
|
3
3
|
|
|
4
4
|
//#region src/config-types.d.ts
|
|
5
5
|
declare function typescriptContract(contract: Contract, output?: string): ContractConfig$1;
|
|
6
|
+
declare function typescriptContractFromPath(contractPath: string, output?: string): ContractConfig$1;
|
|
6
7
|
//#endregion
|
|
7
|
-
export { type ContractConfig, typescriptContract };
|
|
8
|
+
export { type ContractConfig, typescriptContract, typescriptContractFromPath };
|
|
8
9
|
//# sourceMappingURL=config-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.d.mts","names":[],"sources":["../src/config-types.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"config-types.d.mts","names":[],"sources":["../src/config-types.ts"],"sourcesContent":[],"mappings":";;;;iBAMgB,kBAAA,WAA6B,4BAA4B;iBASzD,0BAAA,yCAAmE"}
|
package/dist/config-types.mjs
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
2
3
|
import { ok } from "@prisma-next/utils/result";
|
|
3
4
|
|
|
4
5
|
//#region src/config-types.ts
|
|
5
6
|
function typescriptContract(contract, output) {
|
|
6
7
|
return {
|
|
7
|
-
source: async (
|
|
8
|
+
source: { load: async () => ok(contract) },
|
|
9
|
+
...ifDefined("output", output)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function typescriptContractFromPath(contractPath, output) {
|
|
13
|
+
return {
|
|
14
|
+
source: {
|
|
15
|
+
inputs: [contractPath],
|
|
16
|
+
load: async (context) => {
|
|
17
|
+
const [absolutePath] = context.resolvedInputs;
|
|
18
|
+
if (absolutePath === void 0) throw new Error("typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.");
|
|
19
|
+
const mod = await import(pathToFileURL(absolutePath).href);
|
|
20
|
+
const contract = mod.default ?? mod.contract;
|
|
21
|
+
if (contract === void 0) throw new Error(`typescriptContractFromPath: module at "${absolutePath}" has no "default" or "contract" export.`);
|
|
22
|
+
return ok(contract);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
8
25
|
...ifDefined("output", output)
|
|
9
26
|
};
|
|
10
27
|
}
|
|
11
28
|
|
|
12
29
|
//#endregion
|
|
13
|
-
export { typescriptContract };
|
|
30
|
+
export { typescriptContract, typescriptContractFromPath };
|
|
14
31
|
//# sourceMappingURL=config-types.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.mjs","names":[],"sources":["../src/config-types.ts"],"sourcesContent":["import type { ContractConfig } from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok } from '@prisma-next/utils/result';\n\nexport function typescriptContract(contract: Contract, output?: string): ContractConfig {\n return {\n source: async (
|
|
1
|
+
{"version":3,"file":"config-types.mjs","names":["contract: Contract | undefined"],"sources":["../src/config-types.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport type { ContractConfig } from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { ok } from '@prisma-next/utils/result';\n\nexport function typescriptContract(contract: Contract, output?: string): ContractConfig {\n return {\n source: {\n load: async () => ok(contract),\n },\n ...ifDefined('output', output),\n };\n}\n\nexport function typescriptContractFromPath(contractPath: string, output?: string): 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(contract);\n },\n },\n ...ifDefined('output', output),\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,mBAAmB,UAAoB,QAAiC;AACtF,QAAO;EACL,QAAQ,EACN,MAAM,YAAY,GAAG,SAAS,EAC/B;EACD,GAAG,UAAU,UAAU,OAAO;EAC/B;;AAGH,SAAgB,2BAA2B,cAAsB,QAAiC;AAChG,QAAO;EACL,QAAQ;GACN,QAAQ,CAAC,aAAa;GACtB,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,gBAAgB,QAAQ;AAC/B,QAAI,iBAAiB,OACnB,OAAM,IAAI,MACR,+IACD;IAEH,MAAM,MAAM,MAAM,OAAO,cAAc,aAAa,CAAC;IACrD,MAAMA,WAAiC,IAAI,WAAW,IAAI;AAC1D,QAAI,aAAa,OACf,OAAM,IAAI,MACR,0CAA0C,aAAa,0CACxD;AAEH,WAAO,GAAG,SAAS;;GAEtB;EACD,GAAG,UAAU,UAAU,OAAO;EAC/B"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-contract-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "SQL-specific TypeScript contract authoring surface for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.25",
|
|
9
|
+
"pathe": "^2.0.3",
|
|
9
10
|
"ts-toolbelt": "^9.6.0",
|
|
10
|
-
"@prisma-next/
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/contract
|
|
13
|
-
"@prisma-next/framework-components": "0.4.
|
|
14
|
-
"@prisma-next/sql-contract": "0.4.
|
|
15
|
-
"@prisma-next/utils": "0.4.
|
|
11
|
+
"@prisma-next/config": "0.4.2",
|
|
12
|
+
"@prisma-next/contract-authoring": "0.4.2",
|
|
13
|
+
"@prisma-next/contract": "0.4.2",
|
|
14
|
+
"@prisma-next/framework-components": "0.4.2",
|
|
15
|
+
"@prisma-next/sql-contract": "0.4.2",
|
|
16
|
+
"@prisma-next/utils": "0.4.2"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@types/pg": "8.16.0",
|
|
@@ -20,9 +21,9 @@
|
|
|
20
21
|
"tsdown": "0.18.4",
|
|
21
22
|
"typescript": "5.9.3",
|
|
22
23
|
"vitest": "4.0.17",
|
|
23
|
-
"@prisma-next/
|
|
24
|
+
"@prisma-next/test-utils": "0.0.1",
|
|
24
25
|
"@prisma-next/tsconfig": "0.0.0",
|
|
25
|
-
"@prisma-next/
|
|
26
|
+
"@prisma-next/tsdown": "0.0.0"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"dist",
|
package/src/config-types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url';
|
|
1
2
|
import type { ContractConfig } from '@prisma-next/config/config-types';
|
|
2
3
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
4
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
@@ -5,7 +6,34 @@ import { ok } from '@prisma-next/utils/result';
|
|
|
5
6
|
|
|
6
7
|
export function typescriptContract(contract: Contract, output?: string): ContractConfig {
|
|
7
8
|
return {
|
|
8
|
-
source:
|
|
9
|
+
source: {
|
|
10
|
+
load: async () => ok(contract),
|
|
11
|
+
},
|
|
12
|
+
...ifDefined('output', output),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function typescriptContractFromPath(contractPath: string, output?: string): ContractConfig {
|
|
17
|
+
return {
|
|
18
|
+
source: {
|
|
19
|
+
inputs: [contractPath],
|
|
20
|
+
load: async (context) => {
|
|
21
|
+
const [absolutePath] = context.resolvedInputs;
|
|
22
|
+
if (absolutePath === undefined) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
'typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const mod = await import(pathToFileURL(absolutePath).href);
|
|
28
|
+
const contract: Contract | undefined = mod.default ?? mod.contract;
|
|
29
|
+
if (contract === undefined) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`typescriptContractFromPath: module at "${absolutePath}" has no "default" or "contract" export.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return ok(contract);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
9
37
|
...ifDefined('output', output),
|
|
10
38
|
};
|
|
11
39
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { ContractConfig } from '@prisma-next/config/config-types';
|
|
2
|
-
export { typescriptContract } from '../config-types';
|
|
2
|
+
export { typescriptContract, typescriptContractFromPath } from '../config-types';
|