@prisma-next/postgres 0.4.0-dev.2 → 0.4.0-dev.3
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.d.mts.map +1 -1
- package/dist/config.mjs +4 -21
- package/dist/config.mjs.map +1 -1
- package/package.json +16 -16
- package/src/config/define-config.ts +4 -27
package/dist/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":[],"mappings":";;;;UAWiB,qBAAA;;EAAA,SAAA,EAAA,CAAA,EAAA;IAmBD,SAAA,UAAY,CAAA,EAAU,MAAA;;iCAdL;;;;;iBAcjB,YAAA,UAAsB,wBAAwB"}
|
package/dist/config.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { pathToFileURL } from "node:url";
|
|
|
2
2
|
import postgresAdapter from "@prisma-next/adapter-postgres/control";
|
|
3
3
|
import { defineConfig as defineConfig$1 } from "@prisma-next/config/config-types";
|
|
4
4
|
import postgresDriver from "@prisma-next/driver-postgres/control";
|
|
5
|
-
import sql
|
|
5
|
+
import sql from "@prisma-next/family-sql/control";
|
|
6
6
|
import { prismaContract } from "@prisma-next/sql-contract-psl/provider";
|
|
7
7
|
import postgres from "@prisma-next/target-postgres/control";
|
|
8
8
|
import { extname, isAbsolute, resolve } from "pathe";
|
|
@@ -17,16 +17,6 @@ function defineConfig(options) {
|
|
|
17
17
|
const extensions = options.extensions ?? [];
|
|
18
18
|
const output = deriveOutputPath(options.contract);
|
|
19
19
|
const ext = extname(options.contract);
|
|
20
|
-
const authoringContributions = assembleAuthoringContributions([
|
|
21
|
-
postgres,
|
|
22
|
-
postgresAdapter,
|
|
23
|
-
...extensions
|
|
24
|
-
]);
|
|
25
|
-
const pslContributions = assemblePslInterpretationContributions([
|
|
26
|
-
postgres,
|
|
27
|
-
postgresAdapter,
|
|
28
|
-
...extensions
|
|
29
|
-
]);
|
|
30
20
|
const absoluteContractPath = isAbsolute(options.contract) ? options.contract : resolve(process.cwd(), options.contract);
|
|
31
21
|
return defineConfig$1({
|
|
32
22
|
family: sql,
|
|
@@ -35,22 +25,15 @@ function defineConfig(options) {
|
|
|
35
25
|
driver: postgresDriver,
|
|
36
26
|
extensionPacks: extensions,
|
|
37
27
|
contract: ext === ".ts" ? {
|
|
38
|
-
source: async () => {
|
|
28
|
+
source: async (context) => {
|
|
39
29
|
const { typescriptContract } = await import("@prisma-next/sql-contract-ts/config-types");
|
|
40
30
|
const mod = await import(pathToFileURL(absoluteContractPath).href);
|
|
41
|
-
return typescriptContract(mod.default ?? mod.contract, output).source(
|
|
31
|
+
return typescriptContract(mod.default ?? mod.contract, output).source(context);
|
|
42
32
|
},
|
|
43
33
|
output
|
|
44
34
|
} : prismaContract(options.contract, {
|
|
45
35
|
output,
|
|
46
|
-
target: postgres
|
|
47
|
-
authoringContributions,
|
|
48
|
-
scalarTypeDescriptors: pslContributions.scalarTypeDescriptors,
|
|
49
|
-
controlMutationDefaults: {
|
|
50
|
-
defaultFunctionRegistry: pslContributions.defaultFunctionRegistry,
|
|
51
|
-
generatorDescriptors: pslContributions.generatorDescriptors
|
|
52
|
-
},
|
|
53
|
-
composedExtensionPacks: extensions.map((e) => e.id)
|
|
36
|
+
target: postgres
|
|
54
37
|
}),
|
|
55
38
|
...options.db !== void 0 ? { db: options.db } : {},
|
|
56
39
|
...options.migrations !== void 0 ? { migrations: options.migrations } : {}
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":["coreDefineConfig"],"sources":["../src/config/define-config.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport postgresAdapter from '@prisma-next/adapter-postgres/control';\nimport type { PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';\nimport postgresDriver from '@prisma-next/driver-postgres/control';\nimport sql
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["coreDefineConfig"],"sources":["../src/config/define-config.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport postgresAdapter from '@prisma-next/adapter-postgres/control';\nimport type { ContractSourceContext, PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';\nimport postgresDriver from '@prisma-next/driver-postgres/control';\nimport sql from '@prisma-next/family-sql/control';\nimport type { ControlExtensionDescriptor } from '@prisma-next/framework-components/control';\nimport { prismaContract } from '@prisma-next/sql-contract-psl/provider';\nimport postgres from '@prisma-next/target-postgres/control';\nimport { extname, isAbsolute, resolve } from 'pathe';\n\nexport interface PostgresConfigOptions {\n readonly contract: string;\n readonly db?: {\n readonly connection?: string;\n };\n readonly extensions?: readonly ControlExtensionDescriptor<'sql', 'postgres'>[];\n readonly migrations?: {\n readonly dir?: string;\n };\n}\n\nfunction deriveOutputPath(contractPath: string): string {\n const ext = extname(contractPath);\n if (ext.length === 0) {\n return `${contractPath}.json`;\n }\n return `${contractPath.slice(0, -ext.length)}.json`;\n}\n\nexport function defineConfig(options: PostgresConfigOptions): PrismaNextConfig<'sql', 'postgres'> {\n const extensions = options.extensions ?? [];\n const output = deriveOutputPath(options.contract);\n const ext = extname(options.contract);\n\n const absoluteContractPath = isAbsolute(options.contract)\n ? options.contract\n : resolve(process.cwd(), options.contract);\n\n const contractConfig =\n ext === '.ts'\n ? {\n source: async (context: ContractSourceContext) => {\n const { typescriptContract } = await import(\n '@prisma-next/sql-contract-ts/config-types'\n );\n const mod = await import(pathToFileURL(absoluteContractPath).href);\n const contract = mod.default ?? mod.contract;\n return typescriptContract(contract, output).source(context);\n },\n output,\n }\n : prismaContract(options.contract, {\n output,\n target: postgres,\n });\n\n return coreDefineConfig({\n family: sql,\n target: postgres,\n adapter: postgresAdapter,\n driver: postgresDriver,\n extensionPacks: extensions,\n contract: contractConfig,\n ...(options.db !== undefined ? { db: options.db } : {}),\n ...(options.migrations !== undefined ? { migrations: options.migrations } : {}),\n });\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAS,iBAAiB,cAA8B;CACtD,MAAM,MAAM,QAAQ,aAAa;AACjC,KAAI,IAAI,WAAW,EACjB,QAAO,GAAG,aAAa;AAEzB,QAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC;;AAG/C,SAAgB,aAAa,SAAqE;CAChG,MAAM,aAAa,QAAQ,cAAc,EAAE;CAC3C,MAAM,SAAS,iBAAiB,QAAQ,SAAS;CACjD,MAAM,MAAM,QAAQ,QAAQ,SAAS;CAErC,MAAM,uBAAuB,WAAW,QAAQ,SAAS,GACrD,QAAQ,WACR,QAAQ,QAAQ,KAAK,EAAE,QAAQ,SAAS;AAoB5C,QAAOA,eAAiB;EACtB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,gBAAgB;EAChB,UAvBA,QAAQ,QACJ;GACE,QAAQ,OAAO,YAAmC;IAChD,MAAM,EAAE,uBAAuB,MAAM,OACnC;IAEF,MAAM,MAAM,MAAM,OAAO,cAAc,qBAAqB,CAAC;AAE7D,WAAO,mBADU,IAAI,WAAW,IAAI,UACA,OAAO,CAAC,OAAO,QAAQ;;GAE7D;GACD,GACD,eAAe,QAAQ,UAAU;GAC/B;GACA,QAAQ;GACT,CAAC;EASN,GAAI,QAAQ,OAAO,SAAY,EAAE,IAAI,QAAQ,IAAI,GAAG,EAAE;EACtD,GAAI,QAAQ,eAAe,SAAY,EAAE,YAAY,QAAQ,YAAY,GAAG,EAAE;EAC/E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/postgres",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "One-liner lazy Postgres client composition for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"pathe": "^2.0.3",
|
|
9
9
|
"pg": "8.16.3",
|
|
10
|
-
"@prisma-next/
|
|
11
|
-
"@prisma-next/config": "0.4.0-dev.
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/
|
|
17
|
-
"@prisma-next/sql-contract-
|
|
18
|
-
"@prisma-next/sql-contract-
|
|
19
|
-
"@prisma-next/sql-orm-client": "0.4.0-dev.
|
|
20
|
-
"@prisma-next/sql-
|
|
21
|
-
"@prisma-next/
|
|
22
|
-
"@prisma-next/sql-
|
|
23
|
-
"@prisma-next/
|
|
10
|
+
"@prisma-next/adapter-postgres": "0.4.0-dev.3",
|
|
11
|
+
"@prisma-next/config": "0.4.0-dev.3",
|
|
12
|
+
"@prisma-next/contract": "0.4.0-dev.3",
|
|
13
|
+
"@prisma-next/family-sql": "0.4.0-dev.3",
|
|
14
|
+
"@prisma-next/framework-components": "0.4.0-dev.3",
|
|
15
|
+
"@prisma-next/sql-contract": "0.4.0-dev.3",
|
|
16
|
+
"@prisma-next/driver-postgres": "0.4.0-dev.3",
|
|
17
|
+
"@prisma-next/sql-contract-psl": "0.4.0-dev.3",
|
|
18
|
+
"@prisma-next/sql-contract-ts": "0.4.0-dev.3",
|
|
19
|
+
"@prisma-next/sql-orm-client": "0.4.0-dev.3",
|
|
20
|
+
"@prisma-next/sql-runtime": "0.4.0-dev.3",
|
|
21
|
+
"@prisma-next/sql-builder": "0.4.0-dev.3",
|
|
22
|
+
"@prisma-next/sql-relational-core": "0.4.0-dev.3",
|
|
23
|
+
"@prisma-next/target-postgres": "0.4.0-dev.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/pg": "8.16.0",
|
|
27
27
|
"tsdown": "0.18.4",
|
|
28
28
|
"typescript": "5.9.3",
|
|
29
29
|
"vitest": "4.0.17",
|
|
30
|
-
"@prisma-next/tsconfig": "0.0.0",
|
|
31
30
|
"@prisma-next/test-utils": "0.0.1",
|
|
31
|
+
"@prisma-next/tsconfig": "0.0.0",
|
|
32
32
|
"@prisma-next/tsdown": "0.0.0"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { pathToFileURL } from 'node:url';
|
|
2
2
|
import postgresAdapter from '@prisma-next/adapter-postgres/control';
|
|
3
|
-
import type { PrismaNextConfig } from '@prisma-next/config/config-types';
|
|
3
|
+
import type { ContractSourceContext, PrismaNextConfig } from '@prisma-next/config/config-types';
|
|
4
4
|
import { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';
|
|
5
5
|
import postgresDriver from '@prisma-next/driver-postgres/control';
|
|
6
|
-
import sql
|
|
7
|
-
assembleAuthoringContributions,
|
|
8
|
-
assemblePslInterpretationContributions,
|
|
9
|
-
} from '@prisma-next/family-sql/control';
|
|
6
|
+
import sql from '@prisma-next/family-sql/control';
|
|
10
7
|
import type { ControlExtensionDescriptor } from '@prisma-next/framework-components/control';
|
|
11
8
|
import { prismaContract } from '@prisma-next/sql-contract-psl/provider';
|
|
12
9
|
import postgres from '@prisma-next/target-postgres/control';
|
|
@@ -36,17 +33,6 @@ export function defineConfig(options: PostgresConfigOptions): PrismaNextConfig<'
|
|
|
36
33
|
const output = deriveOutputPath(options.contract);
|
|
37
34
|
const ext = extname(options.contract);
|
|
38
35
|
|
|
39
|
-
const authoringContributions = assembleAuthoringContributions([
|
|
40
|
-
postgres,
|
|
41
|
-
postgresAdapter,
|
|
42
|
-
...extensions,
|
|
43
|
-
]);
|
|
44
|
-
const pslContributions = assemblePslInterpretationContributions([
|
|
45
|
-
postgres,
|
|
46
|
-
postgresAdapter,
|
|
47
|
-
...extensions,
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
36
|
const absoluteContractPath = isAbsolute(options.contract)
|
|
51
37
|
? options.contract
|
|
52
38
|
: resolve(process.cwd(), options.contract);
|
|
@@ -54,28 +40,19 @@ export function defineConfig(options: PostgresConfigOptions): PrismaNextConfig<'
|
|
|
54
40
|
const contractConfig =
|
|
55
41
|
ext === '.ts'
|
|
56
42
|
? {
|
|
57
|
-
source: async () => {
|
|
43
|
+
source: async (context: ContractSourceContext) => {
|
|
58
44
|
const { typescriptContract } = await import(
|
|
59
45
|
'@prisma-next/sql-contract-ts/config-types'
|
|
60
46
|
);
|
|
61
47
|
const mod = await import(pathToFileURL(absoluteContractPath).href);
|
|
62
48
|
const contract = mod.default ?? mod.contract;
|
|
63
|
-
return typescriptContract(contract, output).source(
|
|
64
|
-
composedExtensionPacks: extensions.map((e) => e.id),
|
|
65
|
-
});
|
|
49
|
+
return typescriptContract(contract, output).source(context);
|
|
66
50
|
},
|
|
67
51
|
output,
|
|
68
52
|
}
|
|
69
53
|
: prismaContract(options.contract, {
|
|
70
54
|
output,
|
|
71
55
|
target: postgres,
|
|
72
|
-
authoringContributions,
|
|
73
|
-
scalarTypeDescriptors: pslContributions.scalarTypeDescriptors,
|
|
74
|
-
controlMutationDefaults: {
|
|
75
|
-
defaultFunctionRegistry: pslContributions.defaultFunctionRegistry,
|
|
76
|
-
generatorDescriptors: pslContributions.generatorDescriptors,
|
|
77
|
-
},
|
|
78
|
-
composedExtensionPacks: extensions.map((e) => e.id),
|
|
79
56
|
});
|
|
80
57
|
|
|
81
58
|
return coreDefineConfig({
|