@prisma-next/contract 0.5.0-dev.51 → 0.5.0-dev.52

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.
@@ -122,6 +122,15 @@ type JsonValue = JsonPrimitive | {
122
122
  } | readonly JsonValue[];
123
123
  type ColumnDefaultLiteralValue = JsonValue;
124
124
  type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
125
+ /**
126
+ * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
127
+ * resolve template values from caller-supplied args (typed `unknown` at the
128
+ * boundary) and need to validate before constructing a `ColumnDefault`.
129
+ * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
130
+ * instances. Rejects functions, class instances (other than `Date`),
131
+ * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
132
+ */
133
+ declare function isColumnDefaultLiteralInputValue(value: unknown): value is ColumnDefaultLiteralInputValue;
125
134
  type ColumnDefault = {
126
135
  readonly kind: 'literal';
127
136
  readonly value: ColumnDefaultLiteralInputValue;
@@ -129,11 +138,13 @@ type ColumnDefault = {
129
138
  readonly kind: 'function';
130
139
  readonly expression: string;
131
140
  };
141
+ declare function isColumnDefault(value: unknown): value is ColumnDefault;
132
142
  type ExecutionMutationDefaultValue = {
133
143
  readonly kind: 'generator';
134
144
  readonly id: GeneratedValueSpec['id'];
135
145
  readonly params?: Record<string, unknown>;
136
146
  };
147
+ declare function isExecutionMutationDefaultValue(value: unknown): value is ExecutionMutationDefaultValue;
137
148
  type ExecutionMutationDefault = {
138
149
  readonly ref: {
139
150
  readonly table: string;
@@ -142,6 +153,11 @@ type ExecutionMutationDefault = {
142
153
  readonly onCreate?: ExecutionMutationDefaultValue;
143
154
  readonly onUpdate?: ExecutionMutationDefaultValue;
144
155
  };
156
+ /**
157
+ * `ExecutionMutationDefault` minus its `ref` — the per-field phases value
158
+ * authoring layers attach to a column before the column ref is known.
159
+ */
160
+ type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;
145
161
  type ExecutionSection<THash extends string = string> = {
146
162
  readonly executionHash: ExecutionHashBase<THash>;
147
163
  readonly mutations: {
@@ -247,5 +263,5 @@ interface Contract<TStorage extends StorageBase = StorageBase, TModels extends R
247
263
  readonly meta: Record<string, unknown>;
248
264
  }
249
265
  //#endregion
250
- export { ContractField as A, ModelStorageBase as B, StorageBase as C, profileHash as D, executionHash as E, ContractRelation as F, ScalarFieldType as H, ContractRelationOn as I, ContractValueObject as L, ContractModel as M, ContractModelBase as N, ContractDiscriminator as O, ContractReferenceRelation as P, ContractVariantEntry as R, Source as S, coreHash as T, UnionFieldType as U, ReferenceRelationKeys as V, ValueObjectFieldType as W, GeneratedValueSpec as _, ColumnDefault as a, PlanMeta as b, ContractMarkerRecord as c, ExecutionHashBase as d, ExecutionMutationDefault as f, FieldType as g, Expr as h, Brand as i, ContractFieldType as j, ContractEmbedRelation as k, DocCollection as l, ExecutionSection as m, ContractExecutionSection as n, ColumnDefaultLiteralInputValue as o, ExecutionMutationDefaultValue as p, $ as r, ColumnDefaultLiteralValue as s, Contract as t, DocIndex as u, JsonPrimitive as v, StorageHashBase as w, ProfileHashBase as x, JsonValue as y, EmbedRelationKeys as z };
251
- //# sourceMappingURL=contract-types-DULFYxpd.d.mts.map
266
+ export { isExecutionMutationDefaultValue as A, ContractRelationOn as B, Source as C, executionHash as D, coreHash as E, ContractFieldType as F, ReferenceRelationKeys as G, ContractVariantEntry as H, ContractModel as I, ValueObjectFieldType as J, ScalarFieldType as K, ContractModelBase as L, ContractDiscriminator as M, ContractEmbedRelation as N, isColumnDefault as O, ContractField as P, ContractReferenceRelation as R, ProfileHashBase as S, StorageHashBase as T, EmbedRelationKeys as U, ContractValueObject as V, ModelStorageBase as W, FieldType as _, ColumnDefault as a, JsonValue as b, ContractMarkerRecord as c, ExecutionHashBase as d, ExecutionMutationDefault as f, Expr as g, ExecutionSection as h, Brand as i, profileHash as j, isColumnDefaultLiteralInputValue as k, DocCollection as l, ExecutionMutationDefaultValue as m, ContractExecutionSection as n, ColumnDefaultLiteralInputValue as o, ExecutionMutationDefaultPhases as p, UnionFieldType as q, $ as r, ColumnDefaultLiteralValue as s, Contract as t, DocIndex as u, GeneratedValueSpec as v, StorageBase as w, PlanMeta as x, JsonPrimitive as y, ContractRelation as z };
267
+ //# sourceMappingURL=contract-types-Bjujh4Fu.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-types-DULFYxpd.d.mts","names":[],"sources":["../src/domain-types.ts","../src/types.ts","../src/contract-types.ts"],"sourcesContent":[],"mappings":";KAAY,eAAA;EAAA,SAAA,IAAA,EAAA,QAAe;EAMf,SAAA,OAAA,EAAA,MAAoB;EAKpB,SAAA,UAAc,CAAA,EARF,MAQE,CAAA,MAAA,EAAA,OAAA,CAAA;CAEQ;AAAkB,KAPxC,oBAAA,GAOwC;EAAhC,SAAA,IAAA,EAAA,aAAA;EAAa,SAAA,IAAA,EAAA,MAAA;AAGjC,CAAA;AAAgC,KALpB,cAAA,GAKoB;EAAkB,SAAA,IAAA,EAAA,OAAA;EAAuB,SAAA,OAAA,EAHrD,aAGqD,CAHvC,eAGuC,GAHrB,oBAGqB,CAAA;CAAc;AAE3E,KAFA,iBAAA,GAAoB,eAIf,GAJiC,oBAIhB,GAJuC,cAIvC;AAKtB,KAPA,aAAA,GAOkB;EAKlB,SAAA,QAAA,EAAA,OAAA;EAMA,SAAA,IAAA,EAhBK,iBAgBgB;EAKrB,SAAA,IAAA,CAAA,EAAA,IAAgB;EAEhB,SAAA,IAAA,CAAA,EAAA,IAAA;AAIZ,CAAA;AAIY,KA1BA,kBAAA,GA0BmB;EAInB,SAAA,WAAgB,EAAA,SAAY,MAAA,EAAT;EAEd,SAAA,YAAiB,EAAA,SAAA,MAAA,EAAA;CAAuB;AAAmB,KA3BhE,yBAAA,GA2BgE;EAC1C,SAAA,EAAA,EAAA,MAAA;EAAf,SAAA,WAAA,EAAA,KAAA,GAAA,KAAA,GAAA,KAAA;E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AQ,EAAA,SAAA,MAAA,EAAA;;;;AFjCzB;AAKA;;;;;AAKA;;;AAAyE,KEC7D,wBFD6D,CAAA,cAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EAAc,SAAA,aAAA,EEE7D,iBFF6D,CEE3C,KFF2C,CAAA;EAE3E,SAAA,SAAa,EAAA;IAOb,SAAA,QAAkB,EELP,aFKO,CELO,wBFKP,CAAA;EAKlB,CAAA;AAMZ,CAAA;AAKA;AAEA;AAIA;AAIA;AAIA;AAEA;;;;;;;;;;AAKsB,UEvBL,QFuBK,CAAA,iBEtBH,WFsBG,GEtBW,WFsBX,EAAA,gBErBJ,MFqBI,CAAA,MAAA,EErBW,iBFqBX,CAAA,GErBgC,MFqBhC,CAAA,MAAA,EErB+C,iBFqB/C,CAAA,CAAA,CAAA;EAAM,SAAA,MAAA,EAAA,MAAA;EAKX,SAAA,YAAa,EAAA,MAAA;EAAuB,SAAA,KAAA,EEtBnC,MFsBmC,CAAA,MAAA,EAAA,MAAA,CAAA;EAAmB,SAAA,MAAA,EErBrD,OFqBqD;EAC5C,SAAA,YAAA,CAAA,EErBF,MFqBE,CAAA,MAAA,EErBa,mBFqBb,CAAA;EACM,SAAA,OAAA,EErBd,QFqBc;EAAf,SAAA,YAAA,EEpBM,MFoBN,CAAA,MAAA,EEpBqB,MFoBrB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EADT,SAAA,cAAA,EElBiB,MFkBjB,CAAA,MAAA,EAAA,OAAA,CAAA;EAAiB,SAAA,SAAA,CAAA,EEjBJ,wBFiBI;EAMtB,SAAA,WAAA,EEtBmB,eFsBG,CAAA,MAAA,CAAA;EAC4C,SAAA,IAAA,EEtBtD,MFsBsD,CAAA,MAAA,EAAA,OAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import { d as ExecutionHashBase, t as Contract, w as StorageHashBase, x as ProfileHashBase } from "./contract-types-DULFYxpd.mjs";
1
+ import { S as ProfileHashBase, T as StorageHashBase, d as ExecutionHashBase, t as Contract } from "./contract-types-Bjujh4Fu.mjs";
2
2
 
3
3
  //#region src/canonicalization.d.ts
4
4
  declare function canonicalizeContractToObject(contract: Contract, options?: {
@@ -1,4 +1,4 @@
1
- import { B as ModelStorageBase, C as StorageBase, L as ContractValueObject, M as ContractModel, N as ContractModelBase, m as ExecutionSection, t as Contract, w as StorageHashBase, x as ProfileHashBase } from "./contract-types-DULFYxpd.mjs";
1
+ import { I as ContractModel, L as ContractModelBase, S as ProfileHashBase, T as StorageHashBase, V as ContractValueObject, W as ModelStorageBase, h as ExecutionSection, t as Contract, w as StorageBase } from "./contract-types-Bjujh4Fu.mjs";
2
2
 
3
3
  //#region src/testing-factories.d.ts
4
4
  type ContractOverrides<TStorage extends StorageBase = StorageBase, TModels extends Record<string, ContractModelBase> = Record<string, ContractModel>> = {
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as coreHash } from "./types-aMyNgejf.mjs";
1
+ import { t as coreHash } from "./types-BfYvmUes.mjs";
2
2
  import { n as computeProfileHash, r as computeStorageHash, t as computeExecutionHash } from "./hashing-CyaA_Qvf.mjs";
3
3
  import { ifDefined } from "@prisma-next/utils/defined";
4
4
 
@@ -0,0 +1,46 @@
1
+ //#region src/types.ts
2
+ function executionHash(value) {
3
+ return value;
4
+ }
5
+ function coreHash(value) {
6
+ return value;
7
+ }
8
+ function profileHash(value) {
9
+ return value;
10
+ }
11
+ /**
12
+ * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
13
+ * resolve template values from caller-supplied args (typed `unknown` at the
14
+ * boundary) and need to validate before constructing a `ColumnDefault`.
15
+ * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
16
+ * instances. Rejects functions, class instances (other than `Date`),
17
+ * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
18
+ */
19
+ function isColumnDefaultLiteralInputValue(value) {
20
+ if (value === null) return true;
21
+ const t = typeof value;
22
+ if (t === "string" || t === "number" || t === "boolean") return true;
23
+ if (value instanceof Date) return true;
24
+ if (Array.isArray(value)) return value.every(isColumnDefaultLiteralInputValue);
25
+ if (t === "object" && Object.getPrototypeOf(value) === Object.prototype) return Object.values(value).every(isColumnDefaultLiteralInputValue);
26
+ return false;
27
+ }
28
+ function isColumnDefault(value) {
29
+ if (typeof value !== "object" || value === null) return false;
30
+ const kind = value.kind;
31
+ if (kind === "literal") return "value" in value;
32
+ if (kind === "function") return typeof value.expression === "string";
33
+ return false;
34
+ }
35
+ function isExecutionMutationDefaultValue(value) {
36
+ if (typeof value !== "object" || value === null) return false;
37
+ const candidate = value;
38
+ if (candidate.kind !== "generator") return false;
39
+ if (typeof candidate.id !== "string") return false;
40
+ if (candidate.params !== void 0 && (typeof candidate.params !== "object" || candidate.params === null || Array.isArray(candidate.params))) return false;
41
+ return true;
42
+ }
43
+
44
+ //#endregion
45
+ export { isExecutionMutationDefaultValue as a, isColumnDefaultLiteralInputValue as i, executionHash as n, profileHash as o, isColumnDefault as r, coreHash as t };
46
+ //# sourceMappingURL=types-BfYvmUes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BfYvmUes.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;\n\n/**\n * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers\n * resolve template values from caller-supplied args (typed `unknown` at the\n * boundary) and need to validate before constructing a `ColumnDefault`.\n * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`\n * instances. Rejects functions, class instances (other than `Date`),\n * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.\n */\nexport function isColumnDefaultLiteralInputValue(\n value: unknown,\n): value is ColumnDefaultLiteralInputValue {\n if (value === null) return true;\n const t = typeof value;\n if (t === 'string' || t === 'number' || t === 'boolean') return true;\n if (value instanceof Date) return true;\n if (Array.isArray(value)) return value.every(isColumnDefaultLiteralInputValue);\n if (t === 'object' && Object.getPrototypeOf(value) === Object.prototype) {\n return Object.values(value as Record<string, unknown>).every(isColumnDefaultLiteralInputValue);\n }\n return false;\n}\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport function isColumnDefault(value: unknown): value is ColumnDefault {\n if (typeof value !== 'object' || value === null) return false;\n const kind = (value as { kind?: unknown }).kind;\n if (kind === 'literal') {\n return 'value' in value;\n }\n if (kind === 'function') {\n return typeof (value as { expression?: unknown }).expression === 'string';\n }\n return false;\n}\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport function isExecutionMutationDefaultValue(\n value: unknown,\n): value is ExecutionMutationDefaultValue {\n if (typeof value !== 'object' || value === null) return false;\n const candidate = value as {\n kind?: unknown;\n id?: unknown;\n params?: unknown;\n };\n if (candidate.kind !== 'generator') return false;\n if (typeof candidate.id !== 'string') return false;\n if (\n candidate.params !== undefined &&\n (typeof candidate.params !== 'object' ||\n candidate.params === null ||\n Array.isArray(candidate.params))\n ) {\n return false;\n }\n return true;\n}\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\n/**\n * `ExecutionMutationDefault` minus its `ref` — the per-field phases value\n * authoring layers attach to a column before the column ref is known.\n */\nexport type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;\n\nexport type ExecutionSection<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n readonly [key: string]: unknown;\n };\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n readonly invariants: readonly string[];\n}\n"],"mappings":";AA+BA,SAAgB,cAAsC,OAAgC;AACpF,QAAO;;AAGT,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO;;;;;;;;;;AA2CT,SAAgB,iCACd,OACyC;AACzC,KAAI,UAAU,KAAM,QAAO;CAC3B,MAAM,IAAI,OAAO;AACjB,KAAI,MAAM,YAAY,MAAM,YAAY,MAAM,UAAW,QAAO;AAChE,KAAI,iBAAiB,KAAM,QAAO;AAClC,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,MAAM,iCAAiC;AAC9E,KAAI,MAAM,YAAY,OAAO,eAAe,MAAM,KAAK,OAAO,UAC5D,QAAO,OAAO,OAAO,MAAiC,CAAC,MAAM,iCAAiC;AAEhG,QAAO;;AAUT,SAAgB,gBAAgB,OAAwC;AACtE,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,OAAQ,MAA6B;AAC3C,KAAI,SAAS,UACX,QAAO,WAAW;AAEpB,KAAI,SAAS,WACX,QAAO,OAAQ,MAAmC,eAAe;AAEnE,QAAO;;AAST,SAAgB,gCACd,OACwC;AACxC,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,YAAY;AAKlB,KAAI,UAAU,SAAS,YAAa,QAAO;AAC3C,KAAI,OAAO,UAAU,OAAO,SAAU,QAAO;AAC7C,KACE,UAAU,WAAW,WACpB,OAAO,UAAU,WAAW,YAC3B,UAAU,WAAW,QACrB,MAAM,QAAQ,UAAU,OAAO,EAEjC,QAAO;AAET,QAAO"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as ContractField, B as ModelStorageBase, C as StorageBase, D as profileHash, E as executionHash, F as ContractRelation, H as ScalarFieldType, I as ContractRelationOn, L as ContractValueObject, M as ContractModel, N as ContractModelBase, O as ContractDiscriminator, P as ContractReferenceRelation, R as ContractVariantEntry, S as Source, T as coreHash, U as UnionFieldType, V as ReferenceRelationKeys, W as ValueObjectFieldType, _ as GeneratedValueSpec, a as ColumnDefault, b as PlanMeta, c as ContractMarkerRecord, d as ExecutionHashBase, f as ExecutionMutationDefault, g as FieldType, h as Expr, i as Brand, j as ContractFieldType, k as ContractEmbedRelation, l as DocCollection, m as ExecutionSection, n as ContractExecutionSection, o as ColumnDefaultLiteralInputValue, p as ExecutionMutationDefaultValue, r as $, s as ColumnDefaultLiteralValue, t as Contract, u as DocIndex, v as JsonPrimitive, w as StorageHashBase, x as ProfileHashBase, y as JsonValue, z as EmbedRelationKeys } from "./contract-types-DULFYxpd.mjs";
2
- export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractVariantEntry, type DocCollection, type DocIndex, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type PlanMeta, type ProfileHashBase, type ReferenceRelationKeys, type ScalarFieldType, type Source, type StorageBase, type StorageHashBase, type UnionFieldType, type ValueObjectFieldType, coreHash, executionHash, profileHash };
1
+ import { A as isExecutionMutationDefaultValue, B as ContractRelationOn, C as Source, D as executionHash, E as coreHash, F as ContractFieldType, G as ReferenceRelationKeys, H as ContractVariantEntry, I as ContractModel, J as ValueObjectFieldType, K as ScalarFieldType, L as ContractModelBase, M as ContractDiscriminator, N as ContractEmbedRelation, O as isColumnDefault, P as ContractField, R as ContractReferenceRelation, S as ProfileHashBase, T as StorageHashBase, U as EmbedRelationKeys, V as ContractValueObject, W as ModelStorageBase, _ as FieldType, a as ColumnDefault, b as JsonValue, c as ContractMarkerRecord, d as ExecutionHashBase, f as ExecutionMutationDefault, g as Expr, h as ExecutionSection, i as Brand, j as profileHash, k as isColumnDefaultLiteralInputValue, l as DocCollection, m as ExecutionMutationDefaultValue, n as ContractExecutionSection, o as ColumnDefaultLiteralInputValue, p as ExecutionMutationDefaultPhases, q as UnionFieldType, r as $, s as ColumnDefaultLiteralValue, t as Contract, u as DocIndex, v as GeneratedValueSpec, w as StorageBase, x as PlanMeta, y as JsonPrimitive, z as ContractRelation } from "./contract-types-Bjujh4Fu.mjs";
2
+ export { type $, type Brand, type ColumnDefault, type ColumnDefaultLiteralInputValue, type ColumnDefaultLiteralValue, type Contract, type ContractDiscriminator, type ContractEmbedRelation, type ContractExecutionSection, type ContractField, type ContractFieldType, type ContractMarkerRecord, type ContractModel, type ContractModelBase, type ContractReferenceRelation, type ContractRelation, type ContractRelationOn, type ContractValueObject, type ContractVariantEntry, type DocCollection, type DocIndex, type EmbedRelationKeys, type ExecutionHashBase, type ExecutionMutationDefault, type ExecutionMutationDefaultPhases, type ExecutionMutationDefaultValue, type ExecutionSection, type Expr, type FieldType, type GeneratedValueSpec, type JsonPrimitive, type JsonValue, type ModelStorageBase, type PlanMeta, type ProfileHashBase, type ReferenceRelationKeys, type ScalarFieldType, type Source, type StorageBase, type StorageHashBase, type UnionFieldType, type ValueObjectFieldType, coreHash, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash };
package/dist/types.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as executionHash, r as profileHash, t as coreHash } from "./types-aMyNgejf.mjs";
1
+ import { a as isExecutionMutationDefaultValue, i as isColumnDefaultLiteralInputValue, n as executionHash, o as profileHash, r as isColumnDefault, t as coreHash } from "./types-BfYvmUes.mjs";
2
2
 
3
- export { coreHash, executionHash, profileHash };
3
+ export { coreHash, executionHash, isColumnDefault, isColumnDefaultLiteralInputValue, isExecutionMutationDefaultValue, profileHash };
@@ -1,4 +1,4 @@
1
- import { t as Contract } from "./contract-types-DULFYxpd.mjs";
1
+ import { t as Contract } from "./contract-types-Bjujh4Fu.mjs";
2
2
 
3
3
  //#region src/validate-contract.d.ts
4
4
  type ContractValidationPhase = 'structural' | 'domain' | 'storage';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@prisma-next/contract",
3
- "version": "0.5.0-dev.51",
3
+ "version": "0.5.0-dev.52",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Data contract type definitions and JSON schema for Prisma Next",
7
7
  "dependencies": {
8
8
  "arktype": "^2.1.29",
9
- "@prisma-next/utils": "0.5.0-dev.51"
9
+ "@prisma-next/utils": "0.5.0-dev.52"
10
10
  },
11
11
  "devDependencies": {
12
12
  "tsdown": "0.18.4",
13
13
  "typescript": "5.9.3",
14
14
  "vitest": "4.0.17",
15
15
  "@prisma-next/test-utils": "0.0.1",
16
- "@prisma-next/tsconfig": "0.0.0",
17
- "@prisma-next/tsdown": "0.0.0"
16
+ "@prisma-next/tsdown": "0.0.0",
17
+ "@prisma-next/tsconfig": "0.0.0"
18
18
  },
19
19
  "files": [
20
20
  "dist",
@@ -29,6 +29,7 @@ export type {
29
29
  DocIndex,
30
30
  ExecutionHashBase,
31
31
  ExecutionMutationDefault,
32
+ ExecutionMutationDefaultPhases,
32
33
  ExecutionMutationDefaultValue,
33
34
  ExecutionSection,
34
35
  Expr,
@@ -42,4 +43,11 @@ export type {
42
43
  StorageBase,
43
44
  StorageHashBase,
44
45
  } from '../types';
45
- export { coreHash, executionHash, profileHash } from '../types';
46
+ export {
47
+ coreHash,
48
+ executionHash,
49
+ isColumnDefault,
50
+ isColumnDefaultLiteralInputValue,
51
+ isExecutionMutationDefaultValue,
52
+ profileHash,
53
+ } from '../types';
package/src/types.ts CHANGED
@@ -80,6 +80,28 @@ export type ColumnDefaultLiteralValue = JsonValue;
80
80
 
81
81
  export type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
82
82
 
83
+ /**
84
+ * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
85
+ * resolve template values from caller-supplied args (typed `unknown` at the
86
+ * boundary) and need to validate before constructing a `ColumnDefault`.
87
+ * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
88
+ * instances. Rejects functions, class instances (other than `Date`),
89
+ * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
90
+ */
91
+ export function isColumnDefaultLiteralInputValue(
92
+ value: unknown,
93
+ ): value is ColumnDefaultLiteralInputValue {
94
+ if (value === null) return true;
95
+ const t = typeof value;
96
+ if (t === 'string' || t === 'number' || t === 'boolean') return true;
97
+ if (value instanceof Date) return true;
98
+ if (Array.isArray(value)) return value.every(isColumnDefaultLiteralInputValue);
99
+ if (t === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
100
+ return Object.values(value as Record<string, unknown>).every(isColumnDefaultLiteralInputValue);
101
+ }
102
+ return false;
103
+ }
104
+
83
105
  export type ColumnDefault =
84
106
  | {
85
107
  readonly kind: 'literal';
@@ -87,18 +109,58 @@ export type ColumnDefault =
87
109
  }
88
110
  | { readonly kind: 'function'; readonly expression: string };
89
111
 
112
+ export function isColumnDefault(value: unknown): value is ColumnDefault {
113
+ if (typeof value !== 'object' || value === null) return false;
114
+ const kind = (value as { kind?: unknown }).kind;
115
+ if (kind === 'literal') {
116
+ return 'value' in value;
117
+ }
118
+ if (kind === 'function') {
119
+ return typeof (value as { expression?: unknown }).expression === 'string';
120
+ }
121
+ return false;
122
+ }
123
+
90
124
  export type ExecutionMutationDefaultValue = {
91
125
  readonly kind: 'generator';
92
126
  readonly id: GeneratedValueSpec['id'];
93
127
  readonly params?: Record<string, unknown>;
94
128
  };
95
129
 
130
+ export function isExecutionMutationDefaultValue(
131
+ value: unknown,
132
+ ): value is ExecutionMutationDefaultValue {
133
+ if (typeof value !== 'object' || value === null) return false;
134
+ const candidate = value as {
135
+ kind?: unknown;
136
+ id?: unknown;
137
+ params?: unknown;
138
+ };
139
+ if (candidate.kind !== 'generator') return false;
140
+ if (typeof candidate.id !== 'string') return false;
141
+ if (
142
+ candidate.params !== undefined &&
143
+ (typeof candidate.params !== 'object' ||
144
+ candidate.params === null ||
145
+ Array.isArray(candidate.params))
146
+ ) {
147
+ return false;
148
+ }
149
+ return true;
150
+ }
151
+
96
152
  export type ExecutionMutationDefault = {
97
153
  readonly ref: { readonly table: string; readonly column: string };
98
154
  readonly onCreate?: ExecutionMutationDefaultValue;
99
155
  readonly onUpdate?: ExecutionMutationDefaultValue;
100
156
  };
101
157
 
158
+ /**
159
+ * `ExecutionMutationDefault` minus its `ref` — the per-field phases value
160
+ * authoring layers attach to a column before the column ref is known.
161
+ */
162
+ export type ExecutionMutationDefaultPhases = Omit<ExecutionMutationDefault, 'ref'>;
163
+
102
164
  export type ExecutionSection<THash extends string = string> = {
103
165
  readonly executionHash: ExecutionHashBase<THash>;
104
166
  readonly mutations: {
@@ -1,14 +0,0 @@
1
- //#region src/types.ts
2
- function executionHash(value) {
3
- return value;
4
- }
5
- function coreHash(value) {
6
- return value;
7
- }
8
- function profileHash(value) {
9
- return value;
10
- }
11
-
12
- //#endregion
13
- export { executionHash as n, profileHash as r, coreHash as t };
14
- //# sourceMappingURL=types-aMyNgejf.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-aMyNgejf.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Unique symbol used as the key for branding types.\n */\nexport const $: unique symbol = Symbol('__prisma_next_brand__');\n\n/**\n * A helper type to brand a given type with a unique identifier.\n *\n * @template TKey Text used as the brand key.\n * @template TValue Optional value associated with the brand key. Defaults to `true`.\n */\nexport type Brand<TKey extends string | number | symbol, TValue = true> = {\n [$]: {\n [K in TKey]: TValue;\n };\n};\n\n/**\n * Base type for storage contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type StorageHash = StorageHashBase<'sha256:abc123...'>`\n */\nexport type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;\n\n/**\n * Base type for execution contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`\n */\nexport type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;\n\nexport function executionHash<const T extends string>(value: T): ExecutionHashBase<T> {\n return value as ExecutionHashBase<T>;\n}\n\nexport function coreHash<const T extends string>(value: T): StorageHashBase<T> {\n return value as StorageHashBase<T>;\n}\n\n/**\n * Base type for profile contract hashes.\n * Emitted contract.d.ts files use this with the hash value as a type parameter:\n * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`\n */\nexport type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;\n\nexport function profileHash<const T extends string>(value: T): ProfileHashBase<T> {\n return value as ProfileHashBase<T>;\n}\n\n/**\n * Base type for family-specific storage blocks.\n * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the\n * storage hash alongside family-specific data (tables, collections, etc.).\n */\nexport interface StorageBase<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n}\n\nexport interface FieldType {\n readonly type: string;\n readonly nullable: boolean;\n readonly items?: FieldType;\n readonly properties?: Record<string, FieldType>;\n}\n\nexport type GeneratedValueSpec = {\n readonly id: string;\n readonly params?: Record<string, unknown>;\n};\n\nexport type JsonPrimitive = string | number | boolean | null;\n\nexport type JsonValue =\n | JsonPrimitive\n | { readonly [key: string]: JsonValue }\n | readonly JsonValue[];\n\nexport type ColumnDefaultLiteralValue = JsonValue;\n\nexport type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;\n\nexport type ColumnDefault =\n | {\n readonly kind: 'literal';\n readonly value: ColumnDefaultLiteralInputValue;\n }\n | { readonly kind: 'function'; readonly expression: string };\n\nexport type ExecutionMutationDefaultValue = {\n readonly kind: 'generator';\n readonly id: GeneratedValueSpec['id'];\n readonly params?: Record<string, unknown>;\n};\n\nexport type ExecutionMutationDefault = {\n readonly ref: { readonly table: string; readonly column: string };\n readonly onCreate?: ExecutionMutationDefaultValue;\n readonly onUpdate?: ExecutionMutationDefaultValue;\n};\n\nexport type ExecutionSection<THash extends string = string> = {\n readonly executionHash: ExecutionHashBase<THash>;\n readonly mutations: {\n readonly defaults: ReadonlyArray<ExecutionMutationDefault>;\n };\n};\n\nexport interface Source {\n readonly readOnly: boolean;\n readonly projection: Record<string, FieldType>;\n readonly origin?: Record<string, unknown>;\n readonly capabilities?: Record<string, boolean>;\n}\n\n// Document family types\nexport interface DocIndex {\n readonly name: string;\n readonly keys: Record<string, 'asc' | 'desc'>;\n readonly unique?: boolean;\n readonly where?: Expr;\n}\n\nexport type Expr =\n | { readonly kind: 'eq'; readonly path: ReadonlyArray<string>; readonly value: unknown }\n | { readonly kind: 'exists'; readonly path: ReadonlyArray<string> };\n\nexport interface DocCollection {\n readonly name: string;\n readonly id?: {\n readonly strategy: 'auto' | 'client' | 'uuid' | 'objectId';\n };\n readonly fields: Record<string, FieldType>;\n readonly indexes?: ReadonlyArray<DocIndex>;\n readonly readOnly?: boolean;\n}\n\nexport interface PlanMeta {\n readonly target: string;\n readonly targetFamily?: string;\n readonly storageHash: string;\n readonly profileHash?: string;\n readonly lane: string;\n readonly annotations?: {\n readonly [key: string]: unknown;\n };\n}\n\n/**\n * Contract marker record stored in the database.\n * Represents the current contract identity for a database.\n */\nexport interface ContractMarkerRecord {\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson: unknown | null;\n readonly canonicalVersion: number | null;\n readonly updatedAt: Date;\n readonly appTag: string | null;\n readonly meta: Record<string, unknown>;\n readonly invariants: readonly string[];\n}\n"],"mappings":";AA+BA,SAAgB,cAAsC,OAAgC;AACpF,QAAO;;AAGT,SAAgB,SAAiC,OAA8B;AAC7E,QAAO;;AAUT,SAAgB,YAAoC,OAA8B;AAChF,QAAO"}