@prisma-next/sql-contract-psl 0.11.0-dev.71 → 0.11.0-dev.73

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/package.json CHANGED
@@ -1,40 +1,51 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-contract-psl",
3
- "version": "0.11.0-dev.71",
3
+ "version": "0.11.0-dev.73",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "PSL-to-SQL ContractIR interpreter for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/config": "0.11.0-dev.71",
10
- "@prisma-next/contract": "0.11.0-dev.71",
11
- "@prisma-next/framework-components": "0.11.0-dev.71",
12
- "@prisma-next/psl-parser": "0.11.0-dev.71",
13
- "@prisma-next/sql-contract": "0.11.0-dev.71",
14
- "@prisma-next/sql-contract-ts": "0.11.0-dev.71",
15
- "@prisma-next/utils": "0.11.0-dev.71",
9
+ "@prisma-next/config": "0.11.0-dev.73",
10
+ "@prisma-next/contract": "0.11.0-dev.73",
11
+ "@prisma-next/framework-components": "0.11.0-dev.73",
12
+ "@prisma-next/psl-parser": "0.11.0-dev.73",
13
+ "@prisma-next/sql-contract": "0.11.0-dev.73",
14
+ "@prisma-next/sql-contract-ts": "0.11.0-dev.73",
15
+ "@prisma-next/utils": "0.11.0-dev.73",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@prisma-next/contract-authoring": "0.11.0-dev.71",
20
- "@prisma-next/test-utils": "0.11.0-dev.71",
21
- "@prisma-next/tsconfig": "0.11.0-dev.71",
22
- "@prisma-next/tsdown": "0.11.0-dev.71",
19
+ "@prisma-next/contract-authoring": "0.11.0-dev.73",
20
+ "@prisma-next/test-utils": "0.11.0-dev.73",
21
+ "@prisma-next/tsconfig": "0.11.0-dev.73",
22
+ "@prisma-next/tsdown": "0.11.0-dev.73",
23
23
  "arktype": "^2.2.0",
24
24
  "tsdown": "0.22.0",
25
25
  "typescript": "5.9.3",
26
26
  "vitest": "4.1.6"
27
27
  },
28
+ "peerDependencies": {
29
+ "typescript": ">=5.9"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "typescript": {
33
+ "optional": true
34
+ }
35
+ },
28
36
  "files": [
29
37
  "dist",
30
38
  "src"
31
39
  ],
40
+ "types": "./dist/index.d.mts",
32
41
  "exports": {
33
42
  ".": "./dist/index.mjs",
34
43
  "./provider": "./dist/provider.mjs",
35
44
  "./package.json": "./package.json"
36
45
  },
37
- "types": "./dist/index.d.mts",
46
+ "engines": {
47
+ "node": ">=24"
48
+ },
38
49
  "repository": {
39
50
  "type": "git",
40
51
  "url": "https://github.com/prisma/prisma-next.git",
@@ -229,6 +229,10 @@ const UNSPECIFIED_PSL_NAMESPACE_NAME = '__unspecified__';
229
229
  * slot empty (which means the late-bound default at the `StorageTable`
230
230
  * layer; emitted JSON omits the field).
231
231
  */
232
+ function defaultSqlNamespaceIdForTarget(targetId: string): string {
233
+ return targetId === 'postgres' ? 'public' : UNBOUND_NAMESPACE_ID;
234
+ }
235
+
232
236
  function resolveNamespaceIdForSqlTarget(input: {
233
237
  readonly bucketName: string;
234
238
  readonly targetId: string;
@@ -237,7 +241,7 @@ function resolveNamespaceIdForSqlTarget(input: {
237
241
  return undefined;
238
242
  }
239
243
  if (input.bucketName === UNSPECIFIED_PSL_NAMESPACE_NAME) {
240
- return undefined;
244
+ return 'public';
241
245
  }
242
246
  if (input.bucketName === 'unbound') {
243
247
  return '__unbound__';
@@ -1306,6 +1310,7 @@ function resolvePolymorphism(
1306
1310
  modelNames: Set<string>,
1307
1311
  modelMappings: ReadonlyMap<string, ModelNameMapping>,
1308
1312
  modelNamespaceIds: ReadonlyMap<string, string>,
1313
+ targetId: string,
1309
1314
  sourceId: string,
1310
1315
  diagnostics: ContractSourceDiagnostic[],
1311
1316
  ): Record<string, ContractModel> {
@@ -1411,7 +1416,7 @@ function resolvePolymorphism(
1411
1416
  ...variantModel,
1412
1417
  base: crossRef(
1413
1418
  baseDecl.baseName,
1414
- modelNamespaceIds.get(baseDecl.baseName) ?? UNBOUND_NAMESPACE_ID,
1419
+ modelNamespaceIds.get(baseDecl.baseName) ?? defaultSqlNamespaceIdForTarget(targetId),
1415
1420
  ),
1416
1421
  ...(resolvedTable ? { storage: { ...variantModel.storage, table: resolvedTable } } : {}),
1417
1422
  },
@@ -1695,6 +1700,7 @@ export function interpretPslDocumentToSqlContract(
1695
1700
  modelNames,
1696
1701
  modelMappings,
1697
1702
  modelNamespaceIds,
1703
+ input.target.targetId,
1698
1704
  sourceId,
1699
1705
  polyDiagnostics,
1700
1706
  );
@@ -1730,7 +1736,8 @@ export function interpretPslDocumentToSqlContract(
1730
1736
  ...(namespaceSlice.valueObjects !== undefined
1731
1737
  ? { valueObjects: namespaceSlice.valueObjects }
1732
1738
  : {}),
1733
- ...(namespaceId === UNBOUND_NAMESPACE_ID && Object.keys(valueObjects).length > 0
1739
+ ...(namespaceId === defaultSqlNamespaceIdForTarget(input.target.targetId) &&
1740
+ Object.keys(valueObjects).length > 0
1734
1741
  ? { valueObjects }
1735
1742
  : {}),
1736
1743
  },