@prisma-next/postgres 0.4.0-dev.2 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":[],"mappings":";;;;UAciB,qBAAA;;EAAA,SAAA,EAAA,CAAA,EAAA;IAmBD,SAAA,UAAY,CAAA,EAAU,MAAA;;iCAdL;;;;;iBAcjB,YAAA,UAAsB,wBAAwB"}
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,EAAA,MAAU;;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, { assembleAuthoringContributions, assemblePslInterpretationContributions } from "@prisma-next/family-sql/control";
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({ composedExtensionPacks: extensions.map((e) => e.id) });
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 } : {}
@@ -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, {\n assembleAuthoringContributions,\n assemblePslInterpretationContributions,\n} 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 authoringContributions = assembleAuthoringContributions([\n postgres,\n postgresAdapter,\n ...extensions,\n ]);\n const pslContributions = assemblePslInterpretationContributions([\n postgres,\n postgresAdapter,\n ...extensions,\n ]);\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 () => {\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({\n composedExtensionPacks: extensions.map((e) => e.id),\n });\n },\n output,\n }\n : prismaContract(options.contract, {\n output,\n target: postgres,\n authoringContributions,\n scalarTypeDescriptors: pslContributions.scalarTypeDescriptors,\n controlMutationDefaults: {\n defaultFunctionRegistry: pslContributions.defaultFunctionRegistry,\n generatorDescriptors: pslContributions.generatorDescriptors,\n },\n composedExtensionPacks: extensions.map((e) => e.id),\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":";;;;;;;;;;AAyBA,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,yBAAyB,+BAA+B;EAC5D;EACA;EACA,GAAG;EACJ,CAAC;CACF,MAAM,mBAAmB,uCAAuC;EAC9D;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,uBAAuB,WAAW,QAAQ,SAAS,GACrD,QAAQ,WACR,QAAQ,QAAQ,KAAK,EAAE,QAAQ,SAAS;AA6B5C,QAAOA,eAAiB;EACtB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,gBAAgB;EAChB,UAhCA,QAAQ,QACJ;GACE,QAAQ,YAAY;IAClB,MAAM,EAAE,uBAAuB,MAAM,OACnC;IAEF,MAAM,MAAM,MAAM,OAAO,cAAc,qBAAqB,CAAC;AAE7D,WAAO,mBADU,IAAI,WAAW,IAAI,UACA,OAAO,CAAC,OAAO,EACjD,wBAAwB,WAAW,KAAK,MAAM,EAAE,GAAG,EACpD,CAAC;;GAEJ;GACD,GACD,eAAe,QAAQ,UAAU;GAC/B;GACA,QAAQ;GACR;GACA,uBAAuB,iBAAiB;GACxC,yBAAyB;IACvB,yBAAyB,iBAAiB;IAC1C,sBAAsB,iBAAiB;IACxC;GACD,wBAAwB,WAAW,KAAK,MAAM,EAAE,GAAG;GACpD,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"}
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,35 +1,35 @@
1
1
  {
2
2
  "name": "@prisma-next/postgres",
3
- "version": "0.4.0-dev.2",
3
+ "version": "0.4.0-dev.4",
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/contract": "0.4.0-dev.2",
11
- "@prisma-next/config": "0.4.0-dev.2",
12
- "@prisma-next/family-sql": "0.4.0-dev.2",
13
- "@prisma-next/driver-postgres": "0.4.0-dev.2",
14
- "@prisma-next/adapter-postgres": "0.4.0-dev.2",
15
- "@prisma-next/framework-components": "0.4.0-dev.2",
16
- "@prisma-next/sql-contract": "0.4.0-dev.2",
17
- "@prisma-next/sql-contract-ts": "0.4.0-dev.2",
18
- "@prisma-next/sql-contract-psl": "0.4.0-dev.2",
19
- "@prisma-next/sql-orm-client": "0.4.0-dev.2",
20
- "@prisma-next/sql-relational-core": "0.4.0-dev.2",
21
- "@prisma-next/target-postgres": "0.4.0-dev.2",
22
- "@prisma-next/sql-runtime": "0.4.0-dev.2",
23
- "@prisma-next/sql-builder": "0.4.0-dev.2"
10
+ "@prisma-next/config": "0.4.0-dev.4",
11
+ "@prisma-next/adapter-postgres": "0.4.0-dev.4",
12
+ "@prisma-next/contract": "0.4.0-dev.4",
13
+ "@prisma-next/driver-postgres": "0.4.0-dev.4",
14
+ "@prisma-next/sql-contract": "0.4.0-dev.4",
15
+ "@prisma-next/framework-components": "0.4.0-dev.4",
16
+ "@prisma-next/family-sql": "0.4.0-dev.4",
17
+ "@prisma-next/sql-contract-psl": "0.4.0-dev.4",
18
+ "@prisma-next/sql-contract-ts": "0.4.0-dev.4",
19
+ "@prisma-next/sql-relational-core": "0.4.0-dev.4",
20
+ "@prisma-next/sql-orm-client": "0.4.0-dev.4",
21
+ "@prisma-next/sql-runtime": "0.4.0-dev.4",
22
+ "@prisma-next/target-postgres": "0.4.0-dev.4",
23
+ "@prisma-next/sql-builder": "0.4.0-dev.4"
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/tsdown": "0.0.0",
30
31
  "@prisma-next/tsconfig": "0.0.0",
31
- "@prisma-next/test-utils": "0.0.1",
32
- "@prisma-next/tsdown": "0.0.0"
32
+ "@prisma-next/test-utils": "0.0.1"
33
33
  },
34
34
  "files": [
35
35
  "dist",
@@ -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({