@prisma-next/family-sql 0.14.0-dev.36 → 0.14.0-dev.37

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,55 +1,32 @@
1
+ import { resolveEnumCodecId } from "@prisma-next/framework-components/authoring";
1
2
  import { enumType } from "@prisma-next/sql-contract-ts/contract-builder";
2
3
  import { blindCast } from "@prisma-next/utils/casts";
3
- //#region src/core/authoring-entity-types.ts
4
- function parseQuotedString(raw) {
5
- if (raw.startsWith("\"") && raw.endsWith("\"") && raw.length >= 2) return raw.slice(1, -1);
6
- }
7
4
  const sqlFamilyEntityTypes = { enum: {
8
5
  kind: "entity",
9
6
  discriminator: "enum",
10
7
  output: { factory: (block, ctx) => {
11
8
  const sourceId = ctx.sourceId ?? "unknown";
12
9
  const diagnostics = ctx.diagnostics;
13
- const typeAttr = block.blockAttributes.find((a) => a.name === "type");
14
- if (!typeAttr) {
15
- diagnostics?.push({
16
- code: "PSL_ENUM_MISSING_TYPE",
17
- message: `enum "${block.name}" is missing a @@type("codecId") attribute`,
18
- sourceId,
19
- span: block.span
20
- });
21
- return;
22
- }
23
- const rawCodecArg = typeAttr.args[0]?.value;
24
- const codecId = rawCodecArg !== void 0 ? parseQuotedString(rawCodecArg) : void 0;
25
- if (!codecId) {
26
- diagnostics?.push({
27
- code: "PSL_ENUM_MISSING_TYPE",
28
- message: `enum "${block.name}" @@type attribute must have a quoted codec id argument`,
29
- sourceId,
30
- span: typeAttr.span
31
- });
32
- return;
33
- }
10
+ const resolved = resolveEnumCodecId(block, ctx);
11
+ if (resolved === void 0) return;
12
+ const { codecId, codecSpan } = resolved;
34
13
  const nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];
35
14
  if (nativeType === void 0) {
36
- const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;
37
15
  diagnostics?.push({
38
16
  code: "PSL_EXTENSION_INVALID_VALUE",
39
17
  message: `enum "${block.name}" @@type references unknown codec "${codecId}"`,
40
18
  sourceId,
41
- span: typeArgSpan
19
+ span: codecSpan
42
20
  });
43
21
  return;
44
22
  }
45
23
  const codec = ctx.codecLookup?.get(codecId);
46
24
  if (codec === void 0) {
47
- const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;
48
25
  diagnostics?.push({
49
26
  code: "PSL_EXTENSION_INVALID_VALUE",
50
27
  message: `enum "${block.name}" @@type codec "${codecId}" resolves in targetTypesFor but is absent from codecLookup.get`,
51
28
  sourceId,
52
- span: typeArgSpan
29
+ span: codecSpan
53
30
  });
54
31
  return;
55
32
  }
@@ -339,4 +316,4 @@ const sqlFamilyAuthoringTypes = { sql: { String: {
339
316
  //#endregion
340
317
  export { sqlFamilyPslBlockDescriptors as i, sqlFamilyAuthoringFieldPresets as n, sqlFamilyEntityTypes as r, sqlFamilyAuthoringTypes as t };
341
318
 
342
- //# sourceMappingURL=authoring-type-constructors-CjFfO6LM.mjs.map
319
+ //# sourceMappingURL=authoring-type-constructors-CXd-8ydc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-type-constructors-CXd-8ydc.mjs","names":[],"sources":["../src/core/authoring-entity-types.ts","../src/core/authoring-field-presets.ts","../src/core/authoring-type-constructors.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AuthoringEntityContext,\n type AuthoringEntityTypeDescriptor,\n type AuthoringEntityTypeNamespace,\n type AuthoringPslBlockDescriptorNamespace,\n type PslExtensionBlock,\n resolveEnumCodecId,\n} from '@prisma-next/framework-components/authoring';\nimport { type EnumTypeHandle, enumType } from '@prisma-next/sql-contract-ts/contract-builder';\nimport { blindCast } from '@prisma-next/utils/casts';\n\nexport const sqlFamilyEnumEntityDescriptor = {\n kind: 'entity' as const,\n discriminator: 'enum',\n output: {\n factory: (\n block: PslExtensionBlock,\n ctx: AuthoringEntityContext,\n ): EnumTypeHandle | undefined => {\n const sourceId = ctx.sourceId ?? 'unknown';\n const diagnostics = ctx.diagnostics;\n\n const resolved = resolveEnumCodecId(block, ctx);\n if (resolved === undefined) {\n return undefined;\n }\n const { codecId, codecSpan } = resolved;\n\n const nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];\n if (nativeType === undefined) {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n sourceId,\n span: codecSpan,\n });\n return undefined;\n }\n\n const codec = ctx.codecLookup?.get(codecId);\n if (codec === undefined) {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" @@type codec \"${codecId}\" resolves in targetTypesFor but is absent from codecLookup.get`,\n sourceId,\n span: codecSpan,\n });\n return undefined;\n }\n\n const seenValues = new Set<string>();\n const members: { name: string; value: unknown }[] = [];\n let memberError = false;\n\n for (const [memberName, paramValue] of Object.entries(block.parameters)) {\n let value: unknown;\n if (paramValue.kind === 'bare') {\n try {\n value = codec.decodeJson(memberName);\n } catch {\n diagnostics?.push({\n code: 'PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC',\n message: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n } else if (paramValue.kind === 'value') {\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(paramValue.raw);\n } catch {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" member \"${memberName}\" value \"${paramValue.raw}\" is not valid JSON`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n try {\n value = codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n } else {\n continue;\n }\n\n const valueKey = String(value);\n if (seenValues.has(valueKey)) {\n diagnostics?.push({\n code: 'PSL_ENUM_DUPLICATE_MEMBER_VALUE',\n message: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n seenValues.add(valueKey);\n members.push({ name: memberName, value });\n }\n\n if (memberError) return undefined;\n\n if (members.length === 0) {\n diagnostics?.push({\n code: 'PSL_ENUM_MISSING_TYPE',\n message: `enum \"${block.name}\" must have at least one member`,\n sourceId,\n span: block.span,\n });\n return undefined;\n }\n\n return enumType(\n block.name,\n { codecId, nativeType },\n ...members.map((m) => ({ name: m.name, value: m.value })),\n );\n },\n },\n} satisfies AuthoringEntityTypeDescriptor;\n\nexport const sqlFamilyEntityTypes: AuthoringEntityTypeNamespace = {\n enum: sqlFamilyEnumEntityDescriptor,\n};\n\nexport const sqlFamilyPslBlockDescriptors = {\n enum: {\n kind: 'pslBlock',\n keyword: 'enum',\n discriminator: 'enum',\n name: { required: true },\n parameters: {},\n variadicParameters: true,\n },\n} as const satisfies AuthoringPslBlockDescriptorNamespace;\n","import type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\n/**\n * Family-level SQL authoring field presets.\n *\n * Only presets whose codec IDs align with the ID generator metadata live here\n * (see `@prisma-next/ids`). These presets are target-agnostic because the\n * generator metadata fixes their codec/native-type to `sql/char@1`\n * (`character`) regardless of target, and the PSL interpreter lets the\n * generator override the scalar descriptor.\n *\n * The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID\n * values as `character(36)` — portable across all SQL targets. For a native\n * Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /\n * `id.uuidv7Native` from `@prisma-next/target-postgres`.\n *\n * Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n * `boolean`, `dateTime`) are contributed by the target pack (see\n * `postgresAuthoringFieldPresets` in `@prisma-next/target-postgres`) so the\n * TS callback surface and the PSL scalar surface lower to byte-identical\n * contracts for the active target.\n */\n\nconst CHARACTER_CODEC_ID = 'sql/char@1';\nconst CHARACTER_NATIVE_TYPE = 'character';\n\nconst nanoidOptionsArgument = {\n kind: 'object',\n optional: true,\n properties: {\n size: {\n kind: 'number',\n optional: true,\n integer: true,\n minimum: 2,\n maximum: 255,\n },\n },\n} as const;\n\nexport const sqlFamilyAuthoringFieldPresets = {\n uuidString: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n },\n },\n id: {\n uuidv4String: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7String: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ulid',\n },\n },\n id: true,\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'nanoid',\n params: {\n size: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n },\n },\n },\n },\n id: true,\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'cuid2',\n },\n },\n id: true,\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ksuid',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqlFamilyAuthoringTypes = {\n sql: {\n String: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, maximum: 10485760 }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: {\n length: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n"],"mappings":";;;AA2IA,MAAa,uBAAqD,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,SAAS;IACX,EACF;IACA,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACJ,QAAQ,EACN,MAAM;MACJ,MAAM;MACN,OAAO;MACP,MAAM,CAAC,MAAM;KACf,EACF;IACF,EACF;IACA,IAAI;GACN;EACF;EACA,OAAO;GACL,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,GACV;IACA,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;IACN,EACF;IACA,IAAI;GACN;EACF;EACA,OAAO;GACL,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,GACV;IACA,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;IACN,EACF;IACA,IAAI;GACN;EACF;CACF;AACF;;;ACpNA,MAAa,0BAA0B,EACrC,KAAK,EACH,QAAQ;CACN,MAAM;CACN,MAAM,CAAC;EAAE,MAAM;EAAU,MAAM;EAAU,SAAS;EAAM,SAAS;EAAG,SAAS;CAAS,CAAC;CACvF,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;EAAE,EAClC;CACF;AACF,EACF,EACF"}
package/dist/control.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-CjFfO6LM.mjs";
1
+ import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-CXd-8ydc.mjs";
2
2
  import { t as SqlContractSerializer } from "./sql-contract-serializer-CYtXg_zs.mjs";
3
3
  import { a as contractToSchemaIR, c as extractCodecControlHooks, o as detectDestructiveChanges, s as resolveValueSetValues, t as verifySqlSchema } from "./verify-sql-schema-CEY7b78t.mjs";
4
4
  import { t as collectSupportedCodecTypeIds } from "./verify-C-G0obRm.mjs";
package/dist/pack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-CjFfO6LM.mjs";
1
+ import { i as sqlFamilyPslBlockDescriptors, n as sqlFamilyAuthoringFieldPresets, r as sqlFamilyEntityTypes, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-CXd-8ydc.mjs";
2
2
  //#region src/exports/pack.ts
3
3
  const sqlFamilyPack = {
4
4
  kind: "family",
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "@prisma-next/family-sql",
3
- "version": "0.14.0-dev.36",
3
+ "version": "0.14.0-dev.37",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL family descriptor for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/contract": "0.14.0-dev.36",
10
- "@prisma-next/emitter": "0.14.0-dev.36",
11
- "@prisma-next/framework-components": "0.14.0-dev.36",
12
- "@prisma-next/migration-tools": "0.14.0-dev.36",
13
- "@prisma-next/operations": "0.14.0-dev.36",
14
- "@prisma-next/sql-contract": "0.14.0-dev.36",
15
- "@prisma-next/sql-contract-emitter": "0.14.0-dev.36",
16
- "@prisma-next/sql-contract-ts": "0.14.0-dev.36",
17
- "@prisma-next/sql-operations": "0.14.0-dev.36",
18
- "@prisma-next/sql-relational-core": "0.14.0-dev.36",
19
- "@prisma-next/sql-runtime": "0.14.0-dev.36",
20
- "@prisma-next/sql-schema-ir": "0.14.0-dev.36",
21
- "@prisma-next/utils": "0.14.0-dev.36",
9
+ "@prisma-next/contract": "0.14.0-dev.37",
10
+ "@prisma-next/emitter": "0.14.0-dev.37",
11
+ "@prisma-next/framework-components": "0.14.0-dev.37",
12
+ "@prisma-next/migration-tools": "0.14.0-dev.37",
13
+ "@prisma-next/operations": "0.14.0-dev.37",
14
+ "@prisma-next/sql-contract": "0.14.0-dev.37",
15
+ "@prisma-next/sql-contract-emitter": "0.14.0-dev.37",
16
+ "@prisma-next/sql-contract-ts": "0.14.0-dev.37",
17
+ "@prisma-next/sql-operations": "0.14.0-dev.37",
18
+ "@prisma-next/sql-relational-core": "0.14.0-dev.37",
19
+ "@prisma-next/sql-runtime": "0.14.0-dev.37",
20
+ "@prisma-next/sql-schema-ir": "0.14.0-dev.37",
21
+ "@prisma-next/utils": "0.14.0-dev.37",
22
22
  "arktype": "^2.2.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@prisma-next/driver-postgres": "0.14.0-dev.36",
26
- "@prisma-next/psl-parser": "0.14.0-dev.36",
27
- "@prisma-next/psl-printer": "0.14.0-dev.36",
28
- "@prisma-next/sql-contract-psl": "0.14.0-dev.36",
29
- "@prisma-next/test-utils": "0.14.0-dev.36",
30
- "@prisma-next/tsconfig": "0.14.0-dev.36",
31
- "@prisma-next/tsdown": "0.14.0-dev.36",
25
+ "@prisma-next/driver-postgres": "0.14.0-dev.37",
26
+ "@prisma-next/psl-parser": "0.14.0-dev.37",
27
+ "@prisma-next/psl-printer": "0.14.0-dev.37",
28
+ "@prisma-next/sql-contract-psl": "0.14.0-dev.37",
29
+ "@prisma-next/test-utils": "0.14.0-dev.37",
30
+ "@prisma-next/tsconfig": "0.14.0-dev.37",
31
+ "@prisma-next/tsdown": "0.14.0-dev.37",
32
32
  "tsdown": "0.22.1",
33
33
  "typescript": "5.9.3",
34
34
  "vitest": "4.1.8"
@@ -1,21 +1,15 @@
1
1
  import type { JsonValue } from '@prisma-next/contract/types';
2
- import type {
3
- AuthoringEntityContext,
4
- AuthoringEntityTypeDescriptor,
5
- AuthoringEntityTypeNamespace,
6
- AuthoringPslBlockDescriptorNamespace,
7
- PslExtensionBlock,
2
+ import {
3
+ type AuthoringEntityContext,
4
+ type AuthoringEntityTypeDescriptor,
5
+ type AuthoringEntityTypeNamespace,
6
+ type AuthoringPslBlockDescriptorNamespace,
7
+ type PslExtensionBlock,
8
+ resolveEnumCodecId,
8
9
  } from '@prisma-next/framework-components/authoring';
9
10
  import { type EnumTypeHandle, enumType } from '@prisma-next/sql-contract-ts/contract-builder';
10
11
  import { blindCast } from '@prisma-next/utils/casts';
11
12
 
12
- function parseQuotedString(raw: string): string | undefined {
13
- if (raw.startsWith('"') && raw.endsWith('"') && raw.length >= 2) {
14
- return raw.slice(1, -1);
15
- }
16
- return undefined;
17
- }
18
-
19
13
  export const sqlFamilyEnumEntityDescriptor = {
20
14
  kind: 'entity' as const,
21
15
  discriminator: 'enum',
@@ -27,49 +21,30 @@ export const sqlFamilyEnumEntityDescriptor = {
27
21
  const sourceId = ctx.sourceId ?? 'unknown';
28
22
  const diagnostics = ctx.diagnostics;
29
23
 
30
- const typeAttr = block.blockAttributes.find((a) => a.name === 'type');
31
- if (!typeAttr) {
32
- diagnostics?.push({
33
- code: 'PSL_ENUM_MISSING_TYPE',
34
- message: `enum "${block.name}" is missing a @@type("codecId") attribute`,
35
- sourceId,
36
- span: block.span,
37
- });
38
- return undefined;
39
- }
40
-
41
- const rawCodecArg = typeAttr.args[0]?.value;
42
- const codecId = rawCodecArg !== undefined ? parseQuotedString(rawCodecArg) : undefined;
43
- if (!codecId) {
44
- diagnostics?.push({
45
- code: 'PSL_ENUM_MISSING_TYPE',
46
- message: `enum "${block.name}" @@type attribute must have a quoted codec id argument`,
47
- sourceId,
48
- span: typeAttr.span,
49
- });
24
+ const resolved = resolveEnumCodecId(block, ctx);
25
+ if (resolved === undefined) {
50
26
  return undefined;
51
27
  }
28
+ const { codecId, codecSpan } = resolved;
52
29
 
53
30
  const nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];
54
31
  if (nativeType === undefined) {
55
- const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;
56
32
  diagnostics?.push({
57
33
  code: 'PSL_EXTENSION_INVALID_VALUE',
58
34
  message: `enum "${block.name}" @@type references unknown codec "${codecId}"`,
59
35
  sourceId,
60
- span: typeArgSpan,
36
+ span: codecSpan,
61
37
  });
62
38
  return undefined;
63
39
  }
64
40
 
65
41
  const codec = ctx.codecLookup?.get(codecId);
66
42
  if (codec === undefined) {
67
- const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;
68
43
  diagnostics?.push({
69
44
  code: 'PSL_EXTENSION_INVALID_VALUE',
70
45
  message: `enum "${block.name}" @@type codec "${codecId}" resolves in targetTypesFor but is absent from codecLookup.get`,
71
46
  sourceId,
72
- span: typeArgSpan,
47
+ span: codecSpan,
73
48
  });
74
49
  return undefined;
75
50
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-type-constructors-CjFfO6LM.mjs","names":[],"sources":["../src/core/authoring-entity-types.ts","../src/core/authoring-field-presets.ts","../src/core/authoring-type-constructors.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type {\n AuthoringEntityContext,\n AuthoringEntityTypeDescriptor,\n AuthoringEntityTypeNamespace,\n AuthoringPslBlockDescriptorNamespace,\n PslExtensionBlock,\n} from '@prisma-next/framework-components/authoring';\nimport { type EnumTypeHandle, enumType } from '@prisma-next/sql-contract-ts/contract-builder';\nimport { blindCast } from '@prisma-next/utils/casts';\n\nfunction parseQuotedString(raw: string): string | undefined {\n if (raw.startsWith('\"') && raw.endsWith('\"') && raw.length >= 2) {\n return raw.slice(1, -1);\n }\n return undefined;\n}\n\nexport const sqlFamilyEnumEntityDescriptor = {\n kind: 'entity' as const,\n discriminator: 'enum',\n output: {\n factory: (\n block: PslExtensionBlock,\n ctx: AuthoringEntityContext,\n ): EnumTypeHandle | undefined => {\n const sourceId = ctx.sourceId ?? 'unknown';\n const diagnostics = ctx.diagnostics;\n\n const typeAttr = block.blockAttributes.find((a) => a.name === 'type');\n if (!typeAttr) {\n diagnostics?.push({\n code: 'PSL_ENUM_MISSING_TYPE',\n message: `enum \"${block.name}\" is missing a @@type(\"codecId\") attribute`,\n sourceId,\n span: block.span,\n });\n return undefined;\n }\n\n const rawCodecArg = typeAttr.args[0]?.value;\n const codecId = rawCodecArg !== undefined ? parseQuotedString(rawCodecArg) : undefined;\n if (!codecId) {\n diagnostics?.push({\n code: 'PSL_ENUM_MISSING_TYPE',\n message: `enum \"${block.name}\" @@type attribute must have a quoted codec id argument`,\n sourceId,\n span: typeAttr.span,\n });\n return undefined;\n }\n\n const nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];\n if (nativeType === undefined) {\n const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n sourceId,\n span: typeArgSpan,\n });\n return undefined;\n }\n\n const codec = ctx.codecLookup?.get(codecId);\n if (codec === undefined) {\n const typeArgSpan = typeAttr.args[0]?.span ?? typeAttr.span;\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" @@type codec \"${codecId}\" resolves in targetTypesFor but is absent from codecLookup.get`,\n sourceId,\n span: typeArgSpan,\n });\n return undefined;\n }\n\n const seenValues = new Set<string>();\n const members: { name: string; value: unknown }[] = [];\n let memberError = false;\n\n for (const [memberName, paramValue] of Object.entries(block.parameters)) {\n let value: unknown;\n if (paramValue.kind === 'bare') {\n try {\n value = codec.decodeJson(memberName);\n } catch {\n diagnostics?.push({\n code: 'PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC',\n message: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n } else if (paramValue.kind === 'value') {\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(paramValue.raw);\n } catch {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" member \"${memberName}\" value \"${paramValue.raw}\" is not valid JSON`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n try {\n value = codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n } else {\n continue;\n }\n\n const valueKey = String(value);\n if (seenValues.has(valueKey)) {\n diagnostics?.push({\n code: 'PSL_ENUM_DUPLICATE_MEMBER_VALUE',\n message: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n sourceId,\n span: paramValue.span,\n });\n memberError = true;\n continue;\n }\n seenValues.add(valueKey);\n members.push({ name: memberName, value });\n }\n\n if (memberError) return undefined;\n\n if (members.length === 0) {\n diagnostics?.push({\n code: 'PSL_ENUM_MISSING_TYPE',\n message: `enum \"${block.name}\" must have at least one member`,\n sourceId,\n span: block.span,\n });\n return undefined;\n }\n\n return enumType(\n block.name,\n { codecId, nativeType },\n ...members.map((m) => ({ name: m.name, value: m.value })),\n );\n },\n },\n} satisfies AuthoringEntityTypeDescriptor;\n\nexport const sqlFamilyEntityTypes: AuthoringEntityTypeNamespace = {\n enum: sqlFamilyEnumEntityDescriptor,\n};\n\nexport const sqlFamilyPslBlockDescriptors = {\n enum: {\n kind: 'pslBlock',\n keyword: 'enum',\n discriminator: 'enum',\n name: { required: true },\n parameters: {},\n variadicParameters: true,\n },\n} as const satisfies AuthoringPslBlockDescriptorNamespace;\n","import type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\n/**\n * Family-level SQL authoring field presets.\n *\n * Only presets whose codec IDs align with the ID generator metadata live here\n * (see `@prisma-next/ids`). These presets are target-agnostic because the\n * generator metadata fixes their codec/native-type to `sql/char@1`\n * (`character`) regardless of target, and the PSL interpreter lets the\n * generator override the scalar descriptor.\n *\n * The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID\n * values as `character(36)` — portable across all SQL targets. For a native\n * Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /\n * `id.uuidv7Native` from `@prisma-next/target-postgres`.\n *\n * Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n * `boolean`, `dateTime`) are contributed by the target pack (see\n * `postgresAuthoringFieldPresets` in `@prisma-next/target-postgres`) so the\n * TS callback surface and the PSL scalar surface lower to byte-identical\n * contracts for the active target.\n */\n\nconst CHARACTER_CODEC_ID = 'sql/char@1';\nconst CHARACTER_NATIVE_TYPE = 'character';\n\nconst nanoidOptionsArgument = {\n kind: 'object',\n optional: true,\n properties: {\n size: {\n kind: 'number',\n optional: true,\n integer: true,\n minimum: 2,\n maximum: 255,\n },\n },\n} as const;\n\nexport const sqlFamilyAuthoringFieldPresets = {\n uuidString: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n },\n },\n id: {\n uuidv4String: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7String: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ulid',\n },\n },\n id: true,\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'nanoid',\n params: {\n size: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n },\n },\n },\n },\n id: true,\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'cuid2',\n },\n },\n id: true,\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ksuid',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqlFamilyAuthoringTypes = {\n sql: {\n String: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, maximum: 10485760 }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: {\n length: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n"],"mappings":";;;AAWA,SAAS,kBAAkB,KAAiC;CAC1D,IAAI,IAAI,WAAW,IAAG,KAAK,IAAI,SAAS,IAAG,KAAK,IAAI,UAAU,GAC5D,OAAO,IAAI,MAAM,GAAG,EAAE;AAG1B;AAoJA,MAAa,uBAAqD,EAChE,MAAM;CAlJN,MAAM;CACN,eAAe;CACf,QAAQ,EACN,UACE,OACA,QAC+B;EAC/B,MAAM,WAAW,IAAI,YAAY;EACjC,MAAM,cAAc,IAAI;EAExB,MAAM,WAAW,MAAM,gBAAgB,MAAM,MAAM,EAAE,SAAS,MAAM;EACpE,IAAI,CAAC,UAAU;GACb,aAAa,KAAK;IAChB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK;IAC7B;IACA,MAAM,MAAM;GACd,CAAC;GACD;EACF;EAEA,MAAM,cAAc,SAAS,KAAK,EAAE,EAAE;EACtC,MAAM,UAAU,gBAAgB,KAAA,IAAY,kBAAkB,WAAW,IAAI,KAAA;EAC7E,IAAI,CAAC,SAAS;GACZ,aAAa,KAAK;IAChB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK;IAC7B;IACA,MAAM,SAAS;GACjB,CAAC;GACD;EACF;EAEA,MAAM,aAAa,IAAI,aAAa,eAAe,OAAO,CAAC,GAAG;EAC9D,IAAI,eAAe,KAAA,GAAW;GAC5B,MAAM,cAAc,SAAS,KAAK,EAAE,EAAE,QAAQ,SAAS;GACvD,aAAa,KAAK;IAChB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,qCAAqC,QAAQ;IAC1E;IACA,MAAM;GACR,CAAC;GACD;EACF;EAEA,MAAM,QAAQ,I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