@prisma-next/framework-components 0.5.0-dev.6 → 0.5.0-dev.61

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.
Files changed (92) hide show
  1. package/README.md +63 -3
  2. package/dist/authoring.d.mts +2 -2
  3. package/dist/authoring.mjs +2 -121
  4. package/dist/codec-BUBJeOk4.d.mts +168 -0
  5. package/dist/codec-BUBJeOk4.d.mts.map +1 -0
  6. package/dist/codec.d.mts +49 -2
  7. package/dist/codec.d.mts.map +1 -0
  8. package/dist/codec.mjs +68 -3
  9. package/dist/codec.mjs.map +1 -1
  10. package/dist/components.d.mts +3 -1
  11. package/dist/components.mjs +1 -1
  12. package/dist/control.d.mts +110 -71
  13. package/dist/control.d.mts.map +1 -1
  14. package/dist/control.mjs +47 -45
  15. package/dist/control.mjs.map +1 -1
  16. package/dist/emission-types-DzNgwiFC.d.mts +39 -0
  17. package/dist/emission-types-DzNgwiFC.d.mts.map +1 -0
  18. package/dist/emission.d.mts +2 -2
  19. package/dist/execution.d.mts +7 -5
  20. package/dist/execution.d.mts.map +1 -1
  21. package/dist/execution.mjs +3 -3
  22. package/dist/execution.mjs.map +1 -1
  23. package/dist/{framework-authoring-D1-JZ37B.d.mts → framework-authoring-DJbiXhmf.d.mts} +41 -12
  24. package/dist/framework-authoring-DJbiXhmf.d.mts.map +1 -0
  25. package/dist/framework-authoring-gi_BJlNO.mjs +206 -0
  26. package/dist/framework-authoring-gi_BJlNO.mjs.map +1 -0
  27. package/dist/{framework-components-EJXe-pum.d.mts → framework-components-BVqm1I48.d.mts} +45 -55
  28. package/dist/framework-components-BVqm1I48.d.mts.map +1 -0
  29. package/dist/{framework-components-C8ZhSwXe.mjs → framework-components-BsWST1Rn.mjs} +2 -2
  30. package/dist/framework-components-BsWST1Rn.mjs.map +1 -0
  31. package/dist/psl-ast-BlDveJZ4.d.mts +159 -0
  32. package/dist/psl-ast-BlDveJZ4.d.mts.map +1 -0
  33. package/dist/psl-ast.d.mts +2 -0
  34. package/dist/psl-ast.mjs +1 -0
  35. package/dist/runtime.d.mts +346 -19
  36. package/dist/runtime.d.mts.map +1 -1
  37. package/dist/runtime.mjs +256 -4
  38. package/dist/runtime.mjs.map +1 -1
  39. package/dist/{types-import-spec-C4sc7wbb.d.mts → types-import-spec-CPhrNJIV.d.mts} +2 -2
  40. package/dist/types-import-spec-CPhrNJIV.d.mts.map +1 -0
  41. package/package.json +7 -4
  42. package/src/control/control-capabilities.ts +71 -0
  43. package/src/{control-descriptors.ts → control/control-descriptors.ts} +7 -7
  44. package/src/{control-instances.ts → control/control-instances.ts} +6 -6
  45. package/src/{control-migration-types.ts → control/control-migration-types.ts} +57 -60
  46. package/src/control/control-operation-preview.ts +23 -0
  47. package/src/{control-stack.ts → control/control-stack.ts} +77 -94
  48. package/src/control/emission-types.ts +49 -0
  49. package/src/control/psl-ast.ts +193 -0
  50. package/src/{execution-descriptors.ts → execution/execution-descriptors.ts} +7 -7
  51. package/src/{execution-instances.ts → execution/execution-instances.ts} +1 -1
  52. package/src/{execution-requirements.ts → execution/execution-requirements.ts} +1 -1
  53. package/src/execution/query-plan.ts +53 -0
  54. package/src/execution/race-against-abort.ts +85 -0
  55. package/src/execution/run-with-middleware.ts +132 -0
  56. package/src/execution/runtime-core.ts +133 -0
  57. package/src/execution/runtime-error.ts +83 -0
  58. package/src/execution/runtime-middleware.ts +182 -0
  59. package/src/exports/authoring.ts +5 -2
  60. package/src/exports/codec.ts +27 -2
  61. package/src/exports/components.ts +2 -2
  62. package/src/exports/control.ts +26 -13
  63. package/src/exports/emission.ts +2 -2
  64. package/src/exports/execution.ts +5 -5
  65. package/src/exports/psl-ast.ts +1 -0
  66. package/src/exports/runtime.ts +17 -5
  67. package/src/shared/codec-descriptor.ts +87 -0
  68. package/src/shared/codec-types.ts +79 -0
  69. package/src/shared/codec.ts +80 -0
  70. package/src/shared/column-spec.ts +83 -0
  71. package/src/{framework-authoring.ts → shared/framework-authoring.ts} +202 -23
  72. package/src/{framework-components.ts → shared/framework-components.ts} +22 -48
  73. package/src/{mutation-default-types.ts → shared/mutation-default-types.ts} +22 -2
  74. package/dist/authoring.mjs.map +0 -1
  75. package/dist/codec-types-B58nCJiu.d.mts +0 -40
  76. package/dist/codec-types-B58nCJiu.d.mts.map +0 -1
  77. package/dist/emission-types-BPAALJbF.d.mts +0 -24
  78. package/dist/emission-types-BPAALJbF.d.mts.map +0 -1
  79. package/dist/framework-authoring-D1-JZ37B.d.mts.map +0 -1
  80. package/dist/framework-components-C8ZhSwXe.mjs.map +0 -1
  81. package/dist/framework-components-EJXe-pum.d.mts.map +0 -1
  82. package/dist/types-import-spec-C4sc7wbb.d.mts.map +0 -1
  83. package/src/codec-types.ts +0 -46
  84. package/src/control-capabilities.ts +0 -34
  85. package/src/emission-types.ts +0 -28
  86. package/src/runtime-error.ts +0 -39
  87. package/src/runtime-middleware.ts +0 -83
  88. /package/src/{control-result-types.ts → control/control-result-types.ts} +0 -0
  89. /package/src/{control-schema-view.ts → control/control-schema-view.ts} +0 -0
  90. /package/src/{async-iterable-result.ts → execution/async-iterable-result.ts} +0 -0
  91. /package/src/{execution-stack.ts → execution/execution-stack.ts} +0 -0
  92. /package/src/{types-import-spec.ts → shared/types-import-spec.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-authoring-gi_BJlNO.mjs","names":["paths: string[]","resolved: Record<string, unknown>"],"sources":["../src/shared/framework-authoring.ts"],"sourcesContent":["import type {\n ColumnDefault,\n ExecutionMutationDefaultPhases,\n ExecutionMutationDefaultValue,\n} from '@prisma-next/contract/types';\nimport {\n isColumnDefaultLiteralInputValue,\n isExecutionMutationDefaultValue,\n} from '@prisma-next/contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\nexport type AuthoringArgRef = {\n readonly kind: 'arg';\n readonly index: number;\n readonly path?: readonly string[];\n readonly default?: AuthoringTemplateValue;\n};\n\nexport type AuthoringTemplateValue =\n | string\n | number\n | boolean\n | null\n | AuthoringArgRef\n | readonly AuthoringTemplateValue[]\n | { readonly [key: string]: AuthoringTemplateValue };\n\ninterface AuthoringArgumentDescriptorCommon {\n readonly name?: string;\n readonly optional?: boolean;\n}\n\nexport type AuthoringArgumentDescriptor = AuthoringArgumentDescriptorCommon &\n (\n | { readonly kind: 'string' }\n | {\n readonly kind: 'number';\n readonly integer?: boolean;\n readonly minimum?: number;\n readonly maximum?: number;\n }\n | { readonly kind: 'stringArray' }\n | {\n readonly kind: 'object';\n readonly properties: Record<string, AuthoringArgumentDescriptor>;\n }\n );\n\nexport interface AuthoringStorageTypeTemplate {\n readonly codecId: string;\n readonly nativeType: AuthoringTemplateValue;\n readonly typeParams?: Record<string, AuthoringTemplateValue>;\n}\n\nexport interface AuthoringTypeConstructorDescriptor {\n readonly kind: 'typeConstructor';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringStorageTypeTemplate;\n}\n\nexport interface AuthoringColumnDefaultTemplateLiteral {\n readonly kind: 'literal';\n readonly value: AuthoringTemplateValue;\n}\n\nexport interface AuthoringColumnDefaultTemplateFunction {\n readonly kind: 'function';\n readonly expression: AuthoringTemplateValue;\n}\n\nexport type AuthoringColumnDefaultTemplate =\n | AuthoringColumnDefaultTemplateLiteral\n | AuthoringColumnDefaultTemplateFunction;\n\nexport interface AuthoringExecutionDefaultsTemplate {\n readonly onCreate?: AuthoringTemplateValue;\n readonly onUpdate?: AuthoringTemplateValue;\n}\n\nexport interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {\n readonly nullable?: boolean;\n readonly default?: AuthoringColumnDefaultTemplate;\n readonly executionDefaults?: AuthoringExecutionDefaultsTemplate;\n readonly id?: boolean;\n readonly unique?: boolean;\n}\n\nexport interface AuthoringFieldPresetDescriptor {\n readonly kind: 'fieldPreset';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringFieldPresetOutput;\n}\n\nexport type AuthoringTypeNamespace = {\n readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;\n};\n\nexport type AuthoringFieldNamespace = {\n readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;\n};\n\nexport interface AuthoringContributions {\n readonly type?: AuthoringTypeNamespace;\n readonly field?: AuthoringFieldNamespace;\n}\n\nexport function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {\n if (typeof value !== 'object' || value === null || (value as { kind?: unknown }).kind !== 'arg') {\n return false;\n }\n const { index, path } = value as { index?: unknown; path?: unknown };\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {\n return false;\n }\n if (path !== undefined && (!Array.isArray(path) || path.some((s) => typeof s !== 'string'))) {\n return false;\n }\n return true;\n}\n\nfunction isAuthoringTemplateRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function isAuthoringTypeConstructorDescriptor(\n value: unknown,\n): value is AuthoringTypeConstructorDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'typeConstructor' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function isAuthoringFieldPresetDescriptor(\n value: unknown,\n): value is AuthoringFieldPresetDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'fieldPreset' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\n/**\n * Returns true when `namespace` is a non-leaf key in `contributions.field`.\n *\n * `AuthoringFieldNamespace` permits a leaf descriptor at any depth — including\n * the root — so a top-level `field: { Foo: { kind: 'fieldPreset', ... } }`\n * registration must NOT be treated as a \"namespace\" with sub-paths. Callers\n * use this predicate to gate dot-namespaced lookups (e.g. PSL `@Foo.bar`).\n */\nexport function hasRegisteredFieldNamespace(\n contributions: AuthoringContributions | undefined,\n namespace: string,\n): boolean {\n if (contributions?.field === undefined || !Object.hasOwn(contributions.field, namespace)) {\n return false;\n }\n return !isAuthoringFieldPresetDescriptor(contributions.field[namespace]);\n}\n\nfunction isPlainNamespaceObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Merges `source` into `target` recursively at the descriptor-namespace\n * level. `leafGuard` decides which values are descriptors (terminal\n * merge points; same-path registrations across components are reported\n * as duplicates) versus sub-namespaces (recursion targets).\n *\n * Path segments are validated against prototype-pollution names\n * (`__proto__`, `constructor`, `prototype`). A value that is neither a\n * recognized leaf nor a plain object — e.g. a malformed descriptor\n * where the canonical leaf guard rejected it for missing `output` —\n * is reported as an invalid contribution rather than recursed into,\n * which would either silently mangle state or infinite-loop on\n * primitive properties.\n *\n * Within-registry duplicate detection is this walker's job;\n * cross-registry detection runs separately via\n * `assertNoCrossRegistryCollisions` after merging completes.\n */\nexport function mergeAuthoringNamespaces(\n target: Record<string, unknown>,\n source: Record<string, unknown>,\n path: readonly string[],\n leafGuard: (value: unknown) => boolean,\n label: string,\n): void {\n const assertSafePath = (currentPath: readonly string[]) => {\n const blockedSegment = currentPath.find(\n (segment) => segment === '__proto__' || segment === 'constructor' || segment === 'prototype',\n );\n if (blockedSegment) {\n throw new Error(\n `Invalid authoring ${label} helper \"${currentPath.join('.')}\". Helper path segments must not use \"${blockedSegment}\".`,\n );\n }\n };\n\n for (const [key, sourceValue] of Object.entries(source)) {\n const currentPath = [...path, key];\n assertSafePath(currentPath);\n const hasExistingValue = Object.hasOwn(target, key);\n const existingValue = hasExistingValue ? target[key] : undefined;\n\n if (!hasExistingValue) {\n target[key] = sourceValue;\n continue;\n }\n\n const existingIsLeaf = leafGuard(existingValue);\n const sourceIsLeaf = leafGuard(sourceValue);\n\n if (existingIsLeaf || sourceIsLeaf) {\n throw new Error(\n `Duplicate authoring ${label} helper \"${currentPath.join('.')}\". Helper names must be unique across composed packs.`,\n );\n }\n\n if (!isPlainNamespaceObject(existingValue) || !isPlainNamespaceObject(sourceValue)) {\n throw new Error(\n `Invalid authoring ${label} helper \"${currentPath.join('.')}\". Expected a sub-namespace object or a recognized descriptor; received a malformed value.`,\n );\n }\n\n mergeAuthoringNamespaces(existingValue, sourceValue, currentPath, leafGuard, label);\n }\n}\n\nfunction collectAuthoringLeafPaths(\n namespace: Readonly<Record<string, unknown>>,\n isLeaf: (value: unknown) => boolean,\n path: readonly string[] = [],\n): string[] {\n const paths: string[] = [];\n for (const [key, value] of Object.entries(namespace)) {\n const currentPath = [...path, key];\n if (isLeaf(value)) {\n paths.push(currentPath.join('.'));\n continue;\n }\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n paths.push(\n ...collectAuthoringLeafPaths(\n value as Readonly<Record<string, unknown>>,\n isLeaf,\n currentPath,\n ),\n );\n }\n }\n return paths;\n}\n\nexport function assertNoCrossRegistryCollisions(\n typeNamespace: AuthoringTypeNamespace,\n fieldNamespace: AuthoringFieldNamespace,\n): void {\n const typePaths = new Set(\n collectAuthoringLeafPaths(typeNamespace, isAuthoringTypeConstructorDescriptor),\n );\n // Within-registry duplicate detection is handled upstream by the merge\n // walker (`mergeAuthoringNamespaces` in control-stack.ts and\n // `mergeHelperNamespaces` in composed-authoring-helpers.ts), which throws\n // on same-path registrations within either registry before this check\n // runs. This function only handles the cross-registry case — and an\n // empty type namespace makes a cross-registry collision structurally\n // impossible, so the early-out is sound.\n if (typePaths.size === 0) {\n return;\n }\n for (const fieldPath of collectAuthoringLeafPaths(\n fieldNamespace,\n isAuthoringFieldPresetDescriptor,\n )) {\n if (typePaths.has(fieldPath)) {\n throw new Error(\n `Ambiguous authoring registry path \"${fieldPath}\". The same path is registered as both a type constructor and a field preset; PSL resolution would be ambiguous. Register each path in only one of authoringContributions.field / authoringContributions.type.`,\n );\n }\n }\n}\n\nexport function resolveAuthoringTemplateValue(\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): unknown {\n if (isAuthoringArgRef(template)) {\n let value = args[template.index];\n\n for (const segment of template.path ?? []) {\n if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n\n if (value === undefined && template.default !== undefined) {\n return resolveAuthoringTemplateValue(template.default, args);\n }\n\n return value;\n }\n if (Array.isArray(template)) {\n return template.map((value) => resolveAuthoringTemplateValue(value, args));\n }\n if (typeof template === 'object' && template !== null) {\n const resolved: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(template)) {\n const resolvedValue = resolveAuthoringTemplateValue(value, args);\n if (resolvedValue !== undefined) {\n resolved[key] = resolvedValue;\n }\n }\n return resolved;\n }\n return template;\n}\n\nfunction validateAuthoringArgument(\n descriptor: AuthoringArgumentDescriptor,\n value: unknown,\n path: string,\n): void {\n if (value === undefined) {\n if (descriptor.optional) {\n return;\n }\n throw new Error(`Missing required authoring helper argument at ${path}`);\n }\n\n if (descriptor.kind === 'string') {\n if (typeof value !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be a string`);\n }\n return;\n }\n\n if (descriptor.kind === 'stringArray') {\n if (!Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n for (const entry of value) {\n if (typeof entry !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n }\n return;\n }\n\n if (descriptor.kind === 'object') {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an object`);\n }\n\n const input = value as Record<string, unknown>;\n const expectedKeys = new Set(Object.keys(descriptor.properties));\n\n for (const key of Object.keys(input)) {\n if (!expectedKeys.has(key)) {\n throw new Error(`Authoring helper argument at ${path} contains unknown property \"${key}\"`);\n }\n }\n\n for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) {\n validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);\n }\n\n return;\n }\n\n if (typeof value !== 'number' || Number.isNaN(value)) {\n throw new Error(`Authoring helper argument at ${path} must be a number`);\n }\n\n if (descriptor.integer && !Number.isInteger(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an integer`);\n }\n if (descriptor.minimum !== undefined && value < descriptor.minimum) {\n throw new Error(\n `Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`,\n );\n }\n if (descriptor.maximum !== undefined && value > descriptor.maximum) {\n throw new Error(\n `Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`,\n );\n }\n}\n\nexport function validateAuthoringHelperArguments(\n helperPath: string,\n descriptors: readonly AuthoringArgumentDescriptor[] | undefined,\n args: readonly unknown[],\n): void {\n const expected = descriptors ?? [];\n const minimumArgs = expected.reduce(\n (count, descriptor, index) => (descriptor.optional ? count : index + 1),\n 0,\n );\n if (args.length < minimumArgs || args.length > expected.length) {\n throw new Error(\n `${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`,\n );\n }\n\n expected.forEach((descriptor, index) => {\n validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);\n });\n}\n\nfunction resolveAuthoringStorageTypeTemplate(\n template: AuthoringStorageTypeTemplate,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);\n if (typeof nativeType !== 'string') {\n throw new Error(\n `Resolved authoring nativeType must be a string for codec \"${template.codecId}\", received ${String(nativeType)}`,\n );\n }\n const typeParams =\n template.typeParams === undefined\n ? undefined\n : resolveAuthoringTemplateValue(template.typeParams, args);\n if (typeParams !== undefined && !isAuthoringTemplateRecord(typeParams)) {\n throw new Error(\n `Resolved authoring typeParams must be an object for codec \"${template.codecId}\", received ${String(typeParams)}`,\n );\n }\n\n return {\n codecId: template.codecId,\n nativeType,\n ...(typeParams === undefined ? {} : { typeParams }),\n };\n}\n\nfunction resolveAuthoringColumnDefaultTemplate(\n template: AuthoringColumnDefaultTemplate,\n args: readonly unknown[],\n): ColumnDefault {\n if (template.kind === 'literal') {\n const value = resolveAuthoringTemplateValue(template.value, args);\n if (value === undefined) {\n throw new Error('Resolved authoring literal default must not be undefined');\n }\n if (!isColumnDefaultLiteralInputValue(value)) {\n throw new Error(\n `Resolved authoring literal default must be a JSON-serializable value or Date, received ${String(value)}`,\n );\n }\n return {\n kind: 'literal',\n value,\n };\n }\n\n const expression = resolveAuthoringTemplateValue(template.expression, args);\n if (expression === undefined || (typeof expression === 'object' && expression !== null)) {\n throw new Error(\n `Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`,\n );\n }\n return {\n kind: 'function',\n expression: String(expression),\n };\n}\n\nfunction resolveExecutionMutationDefaultPhase(\n phase: 'onCreate' | 'onUpdate',\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): ExecutionMutationDefaultValue {\n const value = resolveAuthoringTemplateValue(template, args);\n if (!isExecutionMutationDefaultValue(value)) {\n throw new Error(\n `Authoring preset executionDefaults.${phase} did not resolve to a valid generator descriptor (kind: 'generator', id: string).`,\n );\n }\n return value;\n}\n\nfunction resolveAuthoringExecutionDefaultsTemplate(\n template: AuthoringExecutionDefaultsTemplate,\n args: readonly unknown[],\n): ExecutionMutationDefaultPhases {\n return {\n ...ifDefined(\n 'onCreate',\n template.onCreate !== undefined\n ? resolveExecutionMutationDefaultPhase('onCreate', template.onCreate, args)\n : undefined,\n ),\n ...ifDefined(\n 'onUpdate',\n template.onUpdate !== undefined\n ? resolveExecutionMutationDefaultPhase('onUpdate', template.onUpdate, args)\n : undefined,\n ),\n };\n}\n\nexport function instantiateAuthoringTypeConstructor(\n descriptor: AuthoringTypeConstructorDescriptor,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n return resolveAuthoringStorageTypeTemplate(descriptor.output, args);\n}\n\nexport function instantiateAuthoringFieldPreset(\n descriptor: AuthoringFieldPresetDescriptor,\n args: readonly unknown[],\n): {\n readonly descriptor: {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n };\n readonly nullable: boolean;\n readonly default?: ColumnDefault;\n readonly executionDefaults?: ExecutionMutationDefaultPhases;\n readonly id: boolean;\n readonly unique: boolean;\n} {\n return {\n descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),\n nullable: descriptor.output.nullable ?? false,\n ...ifDefined(\n 'default',\n descriptor.output.default !== undefined\n ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args)\n : undefined,\n ),\n ...ifDefined(\n 'executionDefaults',\n descriptor.output.executionDefaults !== undefined\n ? resolveAuthoringExecutionDefaultsTemplate(descriptor.output.executionDefaults, args)\n : undefined,\n ),\n id: descriptor.output.id ?? false,\n unique: descriptor.output.unique ?? false,\n };\n}\n"],"mappings":";;;;AA0GA,SAAgB,kBAAkB,OAA0C;AAC1E,KAAI,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,MACxF,QAAO;CAET,MAAM,EAAE,OAAO,SAAS;AACxB,KAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,MAAM,IAAI,QAAQ,EACnE,QAAO;AAET,KAAI,SAAS,WAAc,CAAC,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,MAAM,OAAO,MAAM,SAAS,EACxF,QAAO;AAET,QAAO;;AAGT,SAAS,0BAA0B,OAAkD;AACnF,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,qCACd,OAC6C;AAC7C,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,qBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;AAI/C,SAAgB,iCACd,OACyC;AACzC,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,iBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;;;;;;;;;AAY/C,SAAgB,4BACd,eACA,WACS;AACT,KAAI,eAAe,UAAU,UAAa,CAAC,OAAO,OAAO,cAAc,OAA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,KAChF,OAAM,IAAI,MACR,wFAAwF,OAAO,WAAW,GAC3G;AAEH,QAAO;EACL,MAAM;EACN,YAAY,OAAO,WAAW;EAC/B;;AAGH,SAAS,qCACP,OACA,UACA,MAC+B;CAC/B,MAAM,QAAQ,8BAA8B,UAAU,KAAK;AAC3D,KAAI,CAAC,gCAAgC,MAAM,CACzC,OAAM,IAAI,MACR,sCAAsC,MAAM,mFAC7C;AAEH,QAAO;;AAGT,SAAS,0CACP,UACA,MACgC;AAChC,QAAO;EACL,GAAG,UACD,YACA,SAAS,aAAa,SAClB,qCAAqC,YAAY,SAAS,UAAU,KAAK,GACzE,OACL;EACD,GAAG,UACD,YACA,SAAS,aAAa,SAClB,qCAAqC,YAAY,SAAS,UAAU,KAAK,GACzE,OACL;EACF;;AAGH,SAAgB,oCACd,YACA,MAKA;AACA,QAAO,oCAAoC,WAAW,QAAQ,KAAK;;AAGrE,SAAgB,gCACd,YACA,MAYA;AACA,QAAO;EACL,YAAY,oCAAoC,WAAW,QAAQ,KAAK;EACxE,UAAU,WAAW,OAAO,YAAY;EACxC,GAAG,UACD,WACA,WAAW,OAAO,YAAY,SAC1B,sCAAsC,WAAW,OAAO,SAAS,KAAK,GACtE,OACL;EACD,GAAG,UACD,qBACA,WAAW,OAAO,sBAAsB,SACpC,0CAA0C,WAAW,OAAO,mBAAmB,KAAK,GACpF,OACL;EACD,IAAI,WAAW,OAAO,MAAM;EAC5B,QAAQ,WAAW,OAAO,UAAU;EACrC"}
@@ -1,9 +1,9 @@
1
- import { i as AuthoringContributions } from "./framework-authoring-D1-JZ37B.mjs";
2
- import { t as Codec } from "./codec-types-B58nCJiu.mjs";
3
- import { t as TypesImportSpec } from "./types-import-spec-C4sc7wbb.mjs";
4
- import { ColumnDefault, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
1
+ import { i as AuthoringContributions } from "./framework-authoring-DJbiXhmf.mjs";
2
+ import { r as AnyCodecDescriptor } from "./codec-BUBJeOk4.mjs";
3
+ import { t as TypesImportSpec } from "./types-import-spec-CPhrNJIV.mjs";
4
+ import { ColumnDefault, ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
5
5
 
6
- //#region src/mutation-default-types.d.ts
6
+ //#region src/shared/mutation-default-types.d.ts
7
7
  interface SourcePosition {
8
8
  readonly offset: number;
9
9
  readonly line: number;
@@ -61,7 +61,16 @@ interface DefaultFunctionRegistryEntry {
61
61
  type DefaultFunctionRegistry = ReadonlyMap<string, DefaultFunctionRegistryEntry>;
62
62
  interface MutationDefaultGeneratorDescriptor {
63
63
  readonly id: string;
64
- readonly applicableCodecIds: readonly string[];
64
+ /**
65
+ * Codec ids the generator is compatible with when the codec choice
66
+ * and the generator choice are made independently by the contract
67
+ * author. Set when the registry-coherence check is meaningful
68
+ * (the codec and the generator can be paired arbitrarily by the
69
+ * caller); omitted when the generator is only reachable through a
70
+ * descriptor that co-registers a fixed codec, so coherence is
71
+ * structural and the list would be tautological.
72
+ */
73
+ readonly applicableCodecIds?: readonly string[];
65
74
  readonly resolveGeneratedColumnDescriptor?: (input: {
66
75
  readonly generated: ExecutionMutationDefaultValue;
67
76
  }) => {
@@ -70,6 +79,13 @@ interface MutationDefaultGeneratorDescriptor {
70
79
  readonly typeRef?: string;
71
80
  readonly typeParams?: Record<string, unknown>;
72
81
  } | undefined;
82
+ /**
83
+ * Construct the `onCreate`/`onUpdate` phases value owned by this
84
+ * generator. Authoring layers (PSL `temporal.updatedAt()`, TS field presets) call
85
+ * this instead of building the literal inline so PSL/TS-authored
86
+ * contracts stay byte-equivalent for any future params-bearing generator.
87
+ */
88
+ readonly buildPhases?: (args?: Record<string, unknown>) => ExecutionMutationDefaultPhases;
73
89
  }
74
90
  interface ControlMutationDefaultEntry {
75
91
  readonly lower: (input: {
@@ -84,7 +100,7 @@ interface ControlMutationDefaults {
84
100
  readonly generatorDescriptors: readonly MutationDefaultGeneratorDescriptor[];
85
101
  }
86
102
  //#endregion
87
- //#region src/framework-components.d.ts
103
+ //#region src/shared/framework-components.d.ts
88
104
  /**
89
105
  * Declarative fields that describe component metadata.
90
106
  */
@@ -94,39 +110,32 @@ interface ComponentMetadata {
94
110
  /**
95
111
  * Capabilities this component provides.
96
112
  *
97
- * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into
98
- * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);
99
- * keep these declarations in sync. Targets are identifiers/descriptors and typically do not
100
- * declare capabilities.
113
+ * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities.
101
114
  */
102
115
  readonly capabilities?: Record<string, unknown>;
103
116
  /** Type imports for contract.d.ts generation */
104
117
  readonly types?: {
105
118
  readonly codecTypes?: {
106
119
  /**
107
- * Base codec types import spec.
108
- * Optional: adapters typically provide this, extensions usually don't.
120
+ * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't.
109
121
  */
110
122
  readonly import?: TypesImportSpec;
111
123
  /**
112
124
  * Additional type-only imports for parameterized codec branded types.
113
125
  *
114
- * These imports are included in generated `contract.d.ts` but are NOT treated as
115
- * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
126
+ * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).
116
127
  *
117
128
  * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`
118
129
  */
119
130
  readonly typeImports?: ReadonlyArray<TypesImportSpec>;
120
131
  /**
121
- * Optional control-plane hooks keyed by codecId.
122
- * Used by family-specific planners/verifiers to handle storage types.
132
+ * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types.
123
133
  */
124
134
  readonly controlPlaneHooks?: Record<string, unknown>;
125
135
  /**
126
- * Codec instances contributed by this component.
127
- * Used to build a CodecLookup for codec-dispatched type rendering during emission.
136
+ * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.
128
137
  */
129
- readonly codecInstances?: ReadonlyArray<Codec>;
138
+ readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;
130
139
  };
131
140
  readonly operationTypes?: {
132
141
  readonly import: TypesImportSpec;
@@ -144,32 +153,24 @@ interface ComponentMetadata {
144
153
  /**
145
154
  * Optional pure-data authoring contributions exposed by this component.
146
155
  *
147
- * These contributions are safe to include on pack refs and descriptors because
148
- * they contain only declarative metadata. Higher-level authoring packages may
149
- * project them into concrete helper functions for TS-first workflows.
156
+ * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.
150
157
  */
151
158
  readonly authoring?: AuthoringContributions;
152
159
  /**
153
- * Scalar type name to codec ID mapping contributed by this component.
154
- * Assembled by `createControlStack` with duplicate detection.
160
+ * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.
155
161
  */
156
162
  readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;
157
163
  /**
158
- * Mutation default function handlers and generator descriptors contributed
159
- * by this component. Assembled by `createControlStack` with duplicate detection.
164
+ * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.
160
165
  */
161
166
  readonly controlMutationDefaults?: ControlMutationDefaults;
162
167
  }
163
168
  /**
164
169
  * Base descriptor for any framework component.
165
170
  *
166
- * All component descriptors share these fundamental properties that identify
167
- * the component and provide its metadata. This interface is extended by
168
- * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
171
+ * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).
169
172
  *
170
- * @template Kind - Discriminator literal identifying the component type.
171
- * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',
172
- * but the type accepts any string to allow ecosystem extensions.
173
+ * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions.
173
174
  *
174
175
  * @example
175
176
  * ```ts
@@ -210,14 +211,12 @@ declare function checkContractComponentRequirements(input: ContractComponentRequ
210
211
  /**
211
212
  * Descriptor for a family component.
212
213
  *
213
- * A "family" represents a category of data sources with shared semantics
214
- * (e.g., SQL databases, document stores). Families define:
214
+ * A "family" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define:
215
215
  * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)
216
216
  * - Contract structure (tables vs collections, columns vs fields)
217
217
  * - Type system and codecs
218
218
  *
219
- * Families are the top-level grouping. Each family contains multiple targets
220
- * (e.g., SQL family contains Postgres, MySQL, SQLite targets).
219
+ * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets).
221
220
  *
222
221
  * Extended by plane-specific descriptors:
223
222
  * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations
@@ -241,13 +240,11 @@ interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor
241
240
  /**
242
241
  * Descriptor for a target component.
243
242
  *
244
- * A "target" represents a specific database or data store within a family
245
- * (e.g., Postgres, MySQL, MongoDB). Targets define:
243
+ * A "target" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define:
246
244
  * - Native type mappings (e.g., Postgres int4 → TypeScript number)
247
245
  * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)
248
246
  *
249
- * Targets are bound to a family and provide the target-specific implementation
250
- * details that adapters and drivers use.
247
+ * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use.
251
248
  *
252
249
  * Extended by plane-specific descriptors:
253
250
  * - `ControlTargetDescriptor` - adds optional `migrations` capability
@@ -272,8 +269,7 @@ interface TargetDescriptor<TFamilyId extends string, TTargetId extends string> e
272
269
  readonly targetId: TTargetId;
273
270
  }
274
271
  /**
275
- * Base shape for any pack reference.
276
- * Pack refs are pure JSON-friendly objects safe to import in authoring flows.
272
+ * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows.
277
273
  */
278
274
  interface PackRefBase<Kind extends string, TFamilyId extends string> extends ComponentMetadata {
279
275
  readonly kind: Kind;
@@ -298,14 +294,12 @@ type DriverPackRef<TFamilyId extends string = string, TTargetId extends string =
298
294
  /**
299
295
  * Descriptor for an adapter component.
300
296
  *
301
- * An "adapter" provides the protocol and dialect implementation for a target.
302
- * Adapters handle:
297
+ * An "adapter" provides the protocol and dialect implementation for a target. Adapters handle:
303
298
  * - SQL/query generation (lowering AST to target-specific syntax)
304
299
  * - Codec registration (encoding/decoding between JS and wire types)
305
300
  * - Type mappings and coercions
306
301
  *
307
- * Adapters are bound to a specific family+target combination and work with
308
- * any compatible driver for that target.
302
+ * Adapters are bound to a specific family+target combination and work with any compatible driver for that target.
309
303
  *
310
304
  * Extended by plane-specific descriptors:
311
305
  * - `ControlAdapterDescriptor` - control-plane factory
@@ -332,16 +326,13 @@ interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>
332
326
  /**
333
327
  * Descriptor for a driver component.
334
328
  *
335
- * A "driver" provides the connection and execution layer for a target.
336
- * Drivers handle:
329
+ * A "driver" provides the connection and execution layer for a target. Drivers handle:
337
330
  * - Connection management (pooling, timeouts, retries)
338
331
  * - Query execution (sending SQL/commands, receiving results)
339
332
  * - Transaction management
340
333
  * - Wire protocol communication
341
334
  *
342
- * Drivers are bound to a specific family+target and work with any compatible
343
- * adapter. Multiple drivers can exist for the same target (e.g., node-postgres
344
- * vs postgres.js for Postgres).
335
+ * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres).
345
336
  *
346
337
  * Extended by plane-specific descriptors:
347
338
  * - `ControlDriverDescriptor` - creates driver from connection URL
@@ -373,8 +364,7 @@ interface DriverDescriptor<TFamilyId extends string, TTargetId extends string> e
373
364
  * - Custom types and codecs (e.g., vector type)
374
365
  * - Extended query capabilities
375
366
  *
376
- * Extensions are bound to a specific family+target and are registered in the
377
- * config alongside the core components. Multiple extensions can be used together.
367
+ * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together.
378
368
  *
379
369
  * Extended by plane-specific descriptors:
380
370
  * - `ControlExtensionDescriptor` - control-plane extension factory
@@ -421,4 +411,4 @@ interface ExtensionInstance<TFamilyId extends string, TTargetId extends string>
421
411
  }
422
412
  //#endregion
423
413
  export { LoweredDefaultResult as A, ControlMutationDefaultEntry as C, DefaultFunctionLoweringHandler as D, DefaultFunctionLoweringContext as E, SourceSpan as F, MutationDefaultGeneratorDescriptor as M, ParsedDefaultFunctionCall as N, DefaultFunctionRegistry as O, SourceDiagnostic as P, checkContractComponentRequirements as S, ControlMutationDefaults as T, PackRefBase as _, ComponentMetadata as a, TargetInstance as b, DriverDescriptor as c, ExtensionDescriptor as d, ExtensionInstance as f, FamilyPackRef as g, FamilyInstance as h, ComponentDescriptor as i, LoweredDefaultValue as j, DefaultFunctionRegistryEntry as k, DriverInstance as l, FamilyDescriptor as m, AdapterInstance as n, ContractComponentRequirementsCheckInput as o, ExtensionPackRef as p, AdapterPackRef as r, ContractComponentRequirementsCheckResult as s, AdapterDescriptor as t, DriverPackRef as u, TargetBoundComponentDescriptor as v, ControlMutationDefaultRegistry as w, TargetPackRef as x, TargetDescriptor as y };
424
- //# sourceMappingURL=framework-components-EJXe-pum.d.mts.map
414
+ //# sourceMappingURL=framework-components-BVqm1I48.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-BVqm1I48.d.mts","names":[],"sources":["../src/shared/mutation-default-types.ts","../src/shared/framework-components.ts"],"sourcesContent":[],"mappings":";;;;;;UAMU,cAAA;;;;;AAAA,UAMO,UAAA,CANO;EAMP,SAAA,KAAU,EACT,cAAA;EAID,SAAA,GAAA,EAHD,cAGiB;;AAKN,UALV,gBAAA,CAKU;EAAT,SAAA,IAA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GJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
@@ -1,4 +1,4 @@
1
- //#region src/framework-components.ts
1
+ //#region src/shared/framework-components.ts
2
2
  function checkContractComponentRequirements(input) {
3
3
  const providedIds = /* @__PURE__ */ new Set();
4
4
  for (const id of input.providedComponentIds) providedIds.add(id);
@@ -24,4 +24,4 @@ function checkContractComponentRequirements(input) {
24
24
 
25
25
  //#endregion
26
26
  export { checkContractComponentRequirements as t };
27
- //# sourceMappingURL=framework-components-C8ZhSwXe.mjs.map
27
+ //# sourceMappingURL=framework-components-BsWST1Rn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-components-BsWST1Rn.mjs","names":[],"sources":["../src/shared/framework-components.ts"],"sourcesContent":["import type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { AuthoringContributions } from './framework-authoring';\nimport type { ControlMutationDefaults } from './mutation-default-types';\nimport type { TypesImportSpec } from './types-import-spec';\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`); keep these declarations in sync. Targets are identifiers/descriptors and typically do not declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec. Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Additional type-only imports for parameterized codec branded types.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector codecs that emit `Vector<1536>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId. Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n /**\n * Codec descriptors contributed by this component. Source of truth for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`, `renderOutputType`) consumed by `extractCodecLookup`, and used to materialize representative `Codec` instances for codec-dispatched type rendering during emission.\n */\n readonly codecDescriptors?: ReadonlyArray<AnyCodecDescriptor>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly queryOperationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because they contain only declarative metadata. Higher-level authoring packages may project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n\n /**\n * Scalar type name to codec ID mapping contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly scalarTypeDescriptors?: ReadonlyMap<string, string>;\n\n /**\n * Mutation default function handlers and generator descriptors contributed by this component. Assembled by `createControlStack` with duplicate detection.\n */\n readonly controlMutationDefaults?: ControlMutationDefaults;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify the component and provide its metadata. This interface is extended by specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type. Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension', but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `emission` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference. Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target. Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target. Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible adapter. Multiple drivers can exist for the same target (e.g., node-postgres vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";AA+GA,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
@@ -0,0 +1,159 @@
1
+ //#region src/control/psl-ast.d.ts
2
+ interface PslPosition {
3
+ readonly offset: number;
4
+ readonly line: number;
5
+ readonly column: number;
6
+ }
7
+ interface PslSpan {
8
+ readonly start: PslPosition;
9
+ readonly end: PslPosition;
10
+ }
11
+ type PslDiagnosticCode = 'PSL_UNTERMINATED_BLOCK' | 'PSL_UNSUPPORTED_TOP_LEVEL_BLOCK' | 'PSL_INVALID_ATTRIBUTE_SYNTAX' | 'PSL_INVALID_MODEL_MEMBER' | 'PSL_UNSUPPORTED_MODEL_ATTRIBUTE' | 'PSL_UNSUPPORTED_FIELD_ATTRIBUTE' | 'PSL_INVALID_RELATION_ATTRIBUTE' | 'PSL_INVALID_REFERENTIAL_ACTION' | 'PSL_INVALID_DEFAULT_VALUE' | 'PSL_INVALID_ENUM_MEMBER' | 'PSL_INVALID_TYPES_MEMBER';
12
+ interface PslDiagnostic {
13
+ readonly code: PslDiagnosticCode;
14
+ readonly message: string;
15
+ readonly sourceId: string;
16
+ readonly span: PslSpan;
17
+ }
18
+ interface PslDefaultFunctionValue {
19
+ readonly kind: 'function';
20
+ readonly name: 'autoincrement' | 'now';
21
+ }
22
+ interface PslDefaultLiteralValue {
23
+ readonly kind: 'literal';
24
+ readonly value: string | number | boolean;
25
+ }
26
+ type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;
27
+ type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';
28
+ interface PslAttributePositionalArgument {
29
+ readonly kind: 'positional';
30
+ readonly value: string;
31
+ readonly span: PslSpan;
32
+ }
33
+ interface PslAttributeNamedArgument {
34
+ readonly kind: 'named';
35
+ readonly name: string;
36
+ readonly value: string;
37
+ readonly span: PslSpan;
38
+ }
39
+ type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;
40
+ interface PslTypeConstructorCall {
41
+ readonly kind: 'typeConstructor';
42
+ readonly path: readonly string[];
43
+ readonly args: readonly PslAttributeArgument[];
44
+ readonly span: PslSpan;
45
+ }
46
+ interface PslAttribute {
47
+ readonly kind: 'attribute';
48
+ readonly target: PslAttributeTarget;
49
+ readonly name: string;
50
+ readonly args: readonly PslAttributeArgument[];
51
+ readonly span: PslSpan;
52
+ }
53
+ type PslReferentialAction = string;
54
+ type PslFieldAttribute = PslAttribute;
55
+ interface PslField {
56
+ readonly kind: 'field';
57
+ readonly name: string;
58
+ readonly typeName: string;
59
+ readonly typeConstructor?: PslTypeConstructorCall;
60
+ readonly optional: boolean;
61
+ readonly list: boolean;
62
+ readonly typeRef?: string;
63
+ readonly attributes: readonly PslFieldAttribute[];
64
+ readonly span: PslSpan;
65
+ }
66
+ interface PslUniqueConstraint {
67
+ readonly kind: 'unique';
68
+ readonly fields: readonly string[];
69
+ readonly span: PslSpan;
70
+ }
71
+ interface PslIndexConstraint {
72
+ readonly kind: 'index';
73
+ readonly fields: readonly string[];
74
+ readonly span: PslSpan;
75
+ }
76
+ type PslModelAttribute = PslAttribute;
77
+ interface PslModel {
78
+ readonly kind: 'model';
79
+ readonly name: string;
80
+ readonly fields: readonly PslField[];
81
+ readonly attributes: readonly PslModelAttribute[];
82
+ readonly span: PslSpan;
83
+ /**
84
+ * Optional leading comment line emitted above the `model` keyword by the
85
+ * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection
86
+ * advisories such as "// WARNING: This table has no primary key in the
87
+ * database" here. The parser leaves this field unset; round-tripping a
88
+ * parsed schema does not re-attach comments.
89
+ */
90
+ readonly comment?: string;
91
+ }
92
+ interface PslEnumValue {
93
+ readonly kind: 'enumValue';
94
+ readonly name: string;
95
+ /**
96
+ * Optional storage label for the enum member, captured from a trailing
97
+ * `@map("...")` attribute on the member line. The parser populates this
98
+ * when the source PSL carries an explicit `@map`. Producers (e.g.
99
+ * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)`
100
+ * automatically when normalisation would change the printed member name
101
+ * (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")`
102
+ * in PSL, preserving the round-trip).
103
+ */
104
+ readonly mapName?: string;
105
+ readonly span: PslSpan;
106
+ }
107
+ interface PslEnum {
108
+ readonly kind: 'enum';
109
+ readonly name: string;
110
+ readonly values: readonly PslEnumValue[];
111
+ readonly attributes: readonly PslAttribute[];
112
+ readonly span: PslSpan;
113
+ }
114
+ interface PslCompositeType {
115
+ readonly kind: 'compositeType';
116
+ readonly name: string;
117
+ readonly fields: readonly PslField[];
118
+ readonly attributes: readonly PslAttribute[];
119
+ readonly span: PslSpan;
120
+ }
121
+ interface PslNamedTypeDeclaration {
122
+ readonly kind: 'namedType';
123
+ readonly name: string;
124
+ /**
125
+ * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.
126
+ * Expressing this as a discriminated union trips TypeScript narrowing when
127
+ * the declaration flows through helpers that accept the full union.
128
+ */
129
+ readonly baseType?: string;
130
+ readonly typeConstructor?: PslTypeConstructorCall;
131
+ readonly attributes: readonly PslAttribute[];
132
+ readonly span: PslSpan;
133
+ }
134
+ interface PslTypesBlock {
135
+ readonly kind: 'types';
136
+ readonly declarations: readonly PslNamedTypeDeclaration[];
137
+ readonly span: PslSpan;
138
+ }
139
+ interface PslDocumentAst {
140
+ readonly kind: 'document';
141
+ readonly sourceId: string;
142
+ readonly models: readonly PslModel[];
143
+ readonly enums: readonly PslEnum[];
144
+ readonly compositeTypes: readonly PslCompositeType[];
145
+ readonly types?: PslTypesBlock;
146
+ readonly span: PslSpan;
147
+ }
148
+ interface ParsePslDocumentInput {
149
+ readonly schema: string;
150
+ readonly sourceId: string;
151
+ }
152
+ interface ParsePslDocumentResult {
153
+ readonly ast: PslDocumentAst;
154
+ readonly diagnostics: readonly PslDiagnostic[];
155
+ readonly ok: boolean;
156
+ }
157
+ //#endregion
158
+ export { PslPosition as C, PslTypesBlock as D, PslTypeConstructorCall as E, PslUniqueConstraint as O, PslNamedTypeDeclaration as S, PslSpan as T, PslField as _, PslAttributeNamedArgument as a, PslModel as b, PslCompositeType as c, PslDefaultValue as d, PslDiagnostic as f, PslEnumValue as g, PslEnum as h, PslAttributeArgument as i, PslDefaultFunctionValue as l, PslDocumentAst as m, ParsePslDocumentResult as n, PslAttributePositionalArgument as o, PslDiagnosticCode as p, PslAttribute as r, PslAttributeTarget as s, ParsePslDocumentInput as t, PslDefaultLiteralValue as u, PslFieldAttribute as v, PslReferentialAction as w, PslModelAttribute as x, PslIndexConstraint as y };
159
+ //# sourceMappingURL=psl-ast-BlDveJZ4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-ast-BlDveJZ4.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"sourcesContent":[],"mappings":";UAAiB,WAAA;EAAA,SAAA,MAAW,EAAA,MAAA;EAMX,SAAA,IAAO,EAAA,MACN;EAIN,SAAA,MAAA,EAAA,MAAiB;AAa7B;AAOiB,UAzBA,OAAA,CAyBA;EAKA,SAAA,KAAA,EA7BC,WA6BqB;EAK3B,SAAA,GAAA,EAjCI,WAiCW;AAE3B;AAEiB,KAlCL,iBAAA,GAkCK,wBAGO,GAAA,iCAAA,GAAA,8BAAA,GAAA,0BAAA,GAAA,iCAAA,GAAA,iCAAA,GAAA,gCAAA,GAAA,gCAAA,GAAA,2BAAA,GAAA,yBAAA,GAAA,0BAAA;AAGP,UA3BA,aAAA,CA2BA;EAOL,SAAA,IAAA,EAjCK,iBAiCe;EAEf,SAAA,OAAA,EAAA,MAAA;EAOA,SAAA,QAAY,EAAA,MAAA;EAEV,SAAA,IAAA,EAzCF,OAyCE;;AAGF,UAzCA,uBAAA,CAyCA;EAAO,SAAA,IAAA,EAAA,UAAA;EAGZ,SAAA,IAAA,EAAA,eAAoB,GAAA,KAAA;AAEhC;AAEiB,UA3CA,sBAAA,CA2CQ;EAII,SAAA,IAAA,EAAA,SAAA;EAIG,SAAA,KAAA,EAAA,MAAA,GAAA,MAAA,GAAA,OAAA;;AACR,KA/CZ,eAAA,GAAkB,uBA+CN,GA/CgC,sBA+ChC;AAGP,KAhDL,kBAAA,GAgDwB,OAGnB,GAAA,OAAO,GAAA,MAAA,GAAA,WAAA;AAGP,UApDA,8BAAA,CAuDO;EAGZ,SAAA,IAAA,EAAA,YAAiB;EAEZ,SAAA,KAAQ,EAAA,MAAA;EAGG,SAAA,IAAA,EA5DX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UAKA,sBAAA;gBACD;iCACiB"}
@@ -0,0 +1,2 @@
1
+ import { C as PslPosition, D as PslTypesBlock, E as PslTypeConstructorCall, O as PslUniqueConstraint, S as PslNamedTypeDeclaration, T as PslSpan, _ as PslField, a as PslAttributeNamedArgument, b as PslModel, c as PslCompositeType, d as PslDefaultValue, f as PslDiagnostic, g as PslEnumValue, h as PslEnum, i as PslAttributeArgument, l as PslDefaultFunctionValue, m as PslDocumentAst, n as ParsePslDocumentResult, o as PslAttributePositionalArgument, p as PslDiagnosticCode, r as PslAttribute, s as PslAttributeTarget, t as ParsePslDocumentInput, u as PslDefaultLiteralValue, v as PslFieldAttribute, w as PslReferentialAction, x as PslModelAttribute, y as PslIndexConstraint } from "./psl-ast-BlDveJZ4.mjs";
2
+ export { ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, PslDiagnosticCode, PslDocumentAst, PslEnum, PslEnumValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslPosition, PslReferentialAction, PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint };
@@ -0,0 +1 @@
1
+ export { };