@prisma/orm-family-sql 8.0.0-rc.8-dev.18 → 8.0.0-rc.8-dev.20

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 (32) hide show
  1. package/dist/{authoring-type-constructors-Blqoa2Ua-CFFAzyES.mjs → authoring-type-constructors-BD-XuavC-CB5uCmck.mjs} +9 -3
  2. package/dist/authoring-type-constructors-BD-XuavC-CB5uCmck.mjs.map +1 -0
  3. package/dist/contract-psl.mjs +1 -1
  4. package/dist/contract-psl__attribute-specs.d.mts +15 -15
  5. package/dist/contract-psl__attribute-specs.d.mts.map +1 -1
  6. package/dist/contract-psl__attribute-specs.mjs +1 -1
  7. package/dist/contract-psl__provider.mjs +1 -1
  8. package/dist/contract-psl__provider.mjs.map +1 -1
  9. package/dist/{control-DheONC4E.mjs → control-DJi35XO2.mjs} +3 -3
  10. package/dist/{control-DheONC4E.mjs.map → control-DJi35XO2.mjs.map} +1 -1
  11. package/dist/{control-CCQP4VFK.d.mts → control-_b_fvUSh.d.mts} +35 -31
  12. package/dist/control-_b_fvUSh.d.mts.map +1 -0
  13. package/dist/family.d.mts +1 -2
  14. package/dist/family.mjs +1 -1
  15. package/dist/family__control.d.mts +1 -1
  16. package/dist/family__control.mjs +1 -1
  17. package/dist/family__pack.d.mts +321 -2
  18. package/dist/family__pack.d.mts.map +1 -0
  19. package/dist/family__pack.mjs +2 -2
  20. package/dist/family__pack.mjs.map +1 -1
  21. package/dist/{interpreter-DQIdQxL1-DyNYhhep.mjs → interpreter-BPl_7Cv5-B8FaNBLQ.mjs} +3 -3
  22. package/dist/{interpreter-DQIdQxL1-DyNYhhep.mjs.map → interpreter-BPl_7Cv5-B8FaNBLQ.mjs.map} +1 -1
  23. package/dist/{sql-attribute-specs-Cr8_u9ma-ENY2C_np.mjs → sql-attribute-specs-BbZ53xbF-CiX6O5aY.mjs} +18 -25
  24. package/dist/sql-attribute-specs-BbZ53xbF-CiX6O5aY.mjs.map +1 -0
  25. package/package.json +17 -17
  26. package/dist/authoring-type-constructors-Blqoa2Ua-CFFAzyES.mjs.map +0 -1
  27. package/dist/control-CCQP4VFK.d.mts.map +0 -1
  28. package/dist/index-DrcrDbOI-BlARY_6q.d.mts +0 -536
  29. package/dist/index-DrcrDbOI-BlARY_6q.d.mts.map +0 -1
  30. package/dist/pack-Chia4J0l.d.mts +0 -317
  31. package/dist/pack-Chia4J0l.d.mts.map +0 -1
  32. package/dist/sql-attribute-specs-Cr8_u9ma-ENY2C_np.mjs.map +0 -1
@@ -1,317 +0,0 @@
1
- import { n as FieldAttributeSpecContext, r as TypedFuncCall, t as AttributeSpec } from "./index-DrcrDbOI-BlARY_6q.mjs";
2
- //#region ../../../2-sql/9-family/dist/pack.d.mts
3
- //#region src/exports/pack.d.ts
4
- declare const sqlFamilyPack: {
5
- readonly kind: "family";
6
- readonly id: "sql";
7
- readonly familyId: "sql";
8
- readonly version: "0.0.1";
9
- readonly authoring: {
10
- readonly field: {
11
- readonly uuidString: {
12
- readonly kind: "fieldPreset";
13
- readonly output: {
14
- readonly codecId: "sql/char@1";
15
- readonly nativeType: "character";
16
- readonly typeParams: {
17
- readonly length: 36;
18
- };
19
- };
20
- };
21
- readonly ulid: {
22
- readonly kind: "fieldPreset";
23
- readonly output: {
24
- readonly codecId: "sql/char@1";
25
- readonly nativeType: "character";
26
- readonly typeParams: {
27
- readonly length: 26;
28
- };
29
- };
30
- };
31
- readonly nanoid: {
32
- readonly kind: "fieldPreset";
33
- readonly args: readonly [{
34
- readonly kind: "object";
35
- readonly optional: true;
36
- readonly properties: {
37
- readonly size: {
38
- readonly kind: "number";
39
- readonly optional: true;
40
- readonly integer: true;
41
- readonly minimum: 2;
42
- readonly maximum: 255;
43
- };
44
- };
45
- }];
46
- readonly output: {
47
- readonly codecId: "sql/char@1";
48
- readonly nativeType: "character";
49
- readonly typeParams: {
50
- readonly length: {
51
- readonly kind: "arg";
52
- readonly index: 0;
53
- readonly path: readonly ["size"];
54
- readonly default: 21;
55
- };
56
- };
57
- };
58
- };
59
- readonly cuid2: {
60
- readonly kind: "fieldPreset";
61
- readonly output: {
62
- readonly codecId: "sql/char@1";
63
- readonly nativeType: "character";
64
- readonly typeParams: {
65
- readonly length: 24;
66
- };
67
- };
68
- };
69
- readonly ksuid: {
70
- readonly kind: "fieldPreset";
71
- readonly output: {
72
- readonly codecId: "sql/char@1";
73
- readonly nativeType: "character";
74
- readonly typeParams: {
75
- readonly length: 27;
76
- };
77
- };
78
- };
79
- readonly id: {
80
- readonly uuidv4String: {
81
- readonly kind: "fieldPreset";
82
- readonly output: {
83
- readonly codecId: "sql/char@1";
84
- readonly nativeType: "character";
85
- readonly typeParams: {
86
- readonly length: 36;
87
- };
88
- readonly executionDefaults: {
89
- readonly onCreate: {
90
- readonly kind: "generator";
91
- readonly id: "uuidv4";
92
- };
93
- };
94
- readonly id: true;
95
- };
96
- };
97
- readonly uuidv7String: {
98
- readonly kind: "fieldPreset";
99
- readonly output: {
100
- readonly codecId: "sql/char@1";
101
- readonly nativeType: "character";
102
- readonly typeParams: {
103
- readonly length: 36;
104
- };
105
- readonly executionDefaults: {
106
- readonly onCreate: {
107
- readonly kind: "generator";
108
- readonly id: "uuidv7";
109
- };
110
- };
111
- readonly id: true;
112
- };
113
- };
114
- readonly ulid: {
115
- readonly kind: "fieldPreset";
116
- readonly output: {
117
- readonly codecId: "sql/char@1";
118
- readonly nativeType: "character";
119
- readonly typeParams: {
120
- readonly length: 26;
121
- };
122
- readonly executionDefaults: {
123
- readonly onCreate: {
124
- readonly kind: "generator";
125
- readonly id: "ulid";
126
- };
127
- };
128
- readonly id: true;
129
- };
130
- };
131
- readonly nanoid: {
132
- readonly kind: "fieldPreset";
133
- readonly args: readonly [{
134
- readonly kind: "object";
135
- readonly optional: true;
136
- readonly properties: {
137
- readonly size: {
138
- readonly kind: "number";
139
- readonly optional: true;
140
- readonly integer: true;
141
- readonly minimum: 2;
142
- readonly maximum: 255;
143
- };
144
- };
145
- }];
146
- readonly output: {
147
- readonly codecId: "sql/char@1";
148
- readonly nativeType: "character";
149
- readonly typeParams: {
150
- readonly length: {
151
- readonly kind: "arg";
152
- readonly index: 0;
153
- readonly path: readonly ["size"];
154
- readonly default: 21;
155
- };
156
- };
157
- readonly executionDefaults: {
158
- readonly onCreate: {
159
- readonly kind: "generator";
160
- readonly id: "nanoid";
161
- readonly params: {
162
- readonly size: {
163
- readonly kind: "arg";
164
- readonly index: 0;
165
- readonly path: readonly ["size"];
166
- };
167
- };
168
- };
169
- };
170
- readonly id: true;
171
- };
172
- };
173
- readonly cuid2: {
174
- readonly kind: "fieldPreset";
175
- readonly output: {
176
- readonly codecId: "sql/char@1";
177
- readonly nativeType: "character";
178
- readonly typeParams: {
179
- readonly length: 24;
180
- };
181
- readonly executionDefaults: {
182
- readonly onCreate: {
183
- readonly kind: "generator";
184
- readonly id: "cuid2";
185
- };
186
- };
187
- readonly id: true;
188
- };
189
- };
190
- readonly ksuid: {
191
- readonly kind: "fieldPreset";
192
- readonly output: {
193
- readonly codecId: "sql/char@1";
194
- readonly nativeType: "character";
195
- readonly typeParams: {
196
- readonly length: 27;
197
- };
198
- readonly executionDefaults: {
199
- readonly onCreate: {
200
- readonly kind: "generator";
201
- readonly id: "ksuid";
202
- };
203
- };
204
- readonly id: true;
205
- };
206
- };
207
- };
208
- };
209
- readonly type: {
210
- readonly sql: {
211
- readonly String: {
212
- readonly kind: "typeConstructor";
213
- readonly args: readonly [{
214
- readonly kind: "number";
215
- readonly name: "length";
216
- readonly integer: true;
217
- readonly minimum: 1;
218
- readonly maximum: 10485760;
219
- }];
220
- readonly output: {
221
- readonly codecId: "sql/varchar@1";
222
- readonly nativeType: "character varying";
223
- readonly typeParams: {
224
- readonly length: {
225
- readonly kind: "arg";
226
- readonly index: 0;
227
- };
228
- };
229
- };
230
- };
231
- };
232
- };
233
- readonly entityTypes: import("@prisma/orm-framework/components/authoring").AuthoringEntityTypeNamespace;
234
- readonly pslBlockDescriptors: {
235
- readonly enum: {
236
- readonly kind: "pslBlock";
237
- readonly keyword: "enum";
238
- readonly discriminator: "enum";
239
- readonly name: {
240
- readonly required: true;
241
- };
242
- readonly parameters: {};
243
- readonly variadicParameters: true;
244
- };
245
- };
246
- readonly attributeSpecs: {
247
- readonly model: {
248
- readonly map: () => AttributeSpec<{
249
- name: string;
250
- }>;
251
- readonly id: () => AttributeSpec<{
252
- fields: string[];
253
- readonly map?: string;
254
- }>;
255
- readonly unique: () => AttributeSpec<{
256
- fields: string[];
257
- readonly map?: string;
258
- }>;
259
- readonly index: () => AttributeSpec<{
260
- fields?: string[];
261
- readonly expression?: string;
262
- readonly where?: string;
263
- readonly unique?: boolean;
264
- readonly name?: string;
265
- readonly map?: string;
266
- readonly type?: string;
267
- readonly options?: Record<string, string>;
268
- }>;
269
- readonly check: () => AttributeSpec<{
270
- readonly expression: string;
271
- readonly name?: string;
272
- readonly map?: string;
273
- }>;
274
- readonly control: () => AttributeSpec<{
275
- policy: "managed" | "tolerated" | "external" | "observed";
276
- }>;
277
- readonly discriminator: () => AttributeSpec<{
278
- field: string;
279
- }>;
280
- readonly base: () => AttributeSpec<{
281
- base: string;
282
- value: string;
283
- }>;
284
- };
285
- readonly field: {
286
- readonly map: () => AttributeSpec<{
287
- name: string;
288
- }>;
289
- readonly id: () => AttributeSpec<{
290
- readonly map?: string;
291
- }>;
292
- readonly unique: () => AttributeSpec<{
293
- readonly map?: string;
294
- }>;
295
- readonly noCheck: () => AttributeSpec<{
296
- first?: "membership" | "elementNotNull";
297
- second?: "membership" | "elementNotNull";
298
- }>;
299
- readonly relation: () => AttributeSpec<{
300
- name?: string;
301
- readonly fields?: string[];
302
- readonly references?: string[];
303
- readonly map?: string;
304
- readonly onDelete?: "NoAction" | "Restrict" | "Cascade" | "SetNull" | "SetDefault";
305
- readonly onUpdate?: "NoAction" | "Restrict" | "Cascade" | "SetNull" | "SetDefault";
306
- readonly index?: boolean;
307
- }>;
308
- readonly default: (ctx: FieldAttributeSpecContext) => AttributeSpec<{
309
- value: string | number | boolean | (string | number | boolean)[] | TypedFuncCall;
310
- }>;
311
- };
312
- };
313
- };
314
- };
315
- //#endregion
316
- export { sqlFamilyPack as t };
317
- //# sourceMappingURL=pack-Chia4J0l.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack-Chia4J0l.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/pack.d.mts"],"mappings":";;;cAEc;WACH;WACA;WACA;WACA;WACA;aACE;eACE;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;uBACA;;;;iBAIN;mBACE;mBACA;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;;;;;eAKR;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;;;;eAIN;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;yBACA;;;;mBAIN;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;6BACA;;;;;qBAKR;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;;;;;aAOZ,gEAAgE;aAChE;eACE;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;iBACA;;;aAGJ;eACE;iBACE,WAAW;UAClB;;iBAEO,UAAU;UACjB;mBACS;;iBAEF,cAAc;UACrB;mBACS;;iBAEF,aAAa;UACpB;mBACS;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA,UAAU;;iBAEZ,aAAa;mBACX;mBACA;mBACA;;iBAEF,eAAe;UACtB;;iBAEO,qBAAqB;UAC5B;;iBAEO,YAAY;UACnB;UACA;;;eAGK;iBACE,WAAW;UAClB;;iBAEO,UAAU;mBACR;;iBAEF,cAAc;mBACZ;;iBAEF,eAAe;UACtB;UACA;;iBAEO,gBAAgB;UACvB;mBACS;mBACA;mBACA;mBACA;mBACA;mBACA;;iBAEF,UAAU,KAAK,8BAA8B;UACpD,mEAAmE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sql-attribute-specs-Cr8_u9ma-ENY2C_np.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-Cr8_u9ma.mjs"],"sourcesContent":["import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, str } from \"@internal/psl-parser\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/sql-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelInterpretCtx(input) {\n\treturn {\n\t\tlevel: \"model\",\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: () => void 0\n\t};\n}\nfunction buildFieldInterpretCtx(input) {\n\treturn {\n\t\tlevel: \"field\",\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelInterpretCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldInterpretCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst mapFieldSpec = fieldAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nfunction scalarDefaultArms(isList, registry) {\n\tconst literal = () => oneOf(str(), num(), bool());\n\tconst funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));\n\treturn isList ? [list(literal()), ...funcArms] : [\n\t\tstr(),\n\t\tnum(),\n\t\tbool(),\n\t\t...funcArms\n\t];\n}\nfunction noEnumMember() {\n\treturn {\n\t\tkind: \"identifier\",\n\t\tlabel: \"enum member\",\n\t\tparse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, \"Enum declares no members\")])\n\t};\n}\nfunction enumMemberNames(ctx) {\n\tconst block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];\n\tif (block === void 0 || block.keyword !== \"enum\") return void 0;\n\treturn Object.keys(block.block.parameters);\n}\nfunction enumDefaultArms(members) {\n\tconst [first, ...rest] = members;\n\tif (first === void 0) return [noEnumMember()];\n\treturn [identifier(first), ...rest.map((name) => identifier(name))];\n}\nfunction defaultFieldSpec(ctx) {\n\tconst members = enumMemberNames(ctx);\n\treturn fieldAttribute(\"default\", { positional: [{\n\t\tkey: \"value\",\n\t\ttype: oneOf(...members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members))\n\t}] });\n}\nconst idFieldSpec = fieldAttribute(\"id\", { named: { map: optional(str()) } });\nconst uniqueFieldSpec = fieldAttribute(\"unique\", { named: { map: optional(str()) } });\nconst noCheckKindArgument = () => oneOf(identifier(\"membership\"), identifier(\"elementNotNull\"));\n/**\n* `@noCheck` waives generated CHECK constraints on one column: bare for every\n* kind the column's shape derives, or naming concrete kinds. Two optional\n* positional slots cover the whole kind vocabulary; a third argument is\n* necessarily a duplicate and fails as excess arity.\n*/\nconst noCheckFieldSpec = fieldAttribute(\"noCheck\", {\n\tpositional: [{\n\t\tkey: \"first\",\n\t\ttype: optional(noCheckKindArgument())\n\t}, {\n\t\tkey: \"second\",\n\t\ttype: optional(noCheckKindArgument())\n\t}],\n\trefine: (value, ctx, attributeNode) => {\n\t\tif (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, \"`@noCheck` names the same kind twice\")];\n\t\treturn [];\n\t}\n});\nconst idModelSpec = modelAttribute(\"id\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(\"self\"), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst uniqueModelSpec = modelAttribute(\"unique\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(\"self\"), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst PSL_INDEX_FIELDS_XOR_EXPRESSION = \"PSL_INDEX_FIELDS_XOR_EXPRESSION\";\nconst PSL_INDEX_EXPRESSION_REQUIRES_NAME = \"PSL_INDEX_EXPRESSION_REQUIRES_NAME\";\nconst PSL_INDEX_NAME_XOR_MAP = \"PSL_INDEX_NAME_XOR_MAP\";\nconst indexModelSpec = modelAttribute(\"index\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: optional(list(fieldRef(\"self\"), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t}))\n\t}],\n\tnamed: {\n\t\texpression: optional(str()),\n\t\twhere: optional(str()),\n\t\tunique: optional(bool()),\n\t\tname: optional(str()),\n\t\tmap: optional(str()),\n\t\ttype: optional(str()),\n\t\toptions: optional(record(str()))\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` requires exactly one of a fields list or an `expression` argument\", PSL_INDEX_FIELDS_XOR_EXPRESSION));\n\t\tif (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)\", PSL_INDEX_EXPRESSION_REQUIRES_NAME));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` takes at most one of `name` and `map`\", PSL_INDEX_NAME_XOR_MAP));\n\t\tif (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` options argument requires a type argument\"));\n\t\treturn diagnostics;\n\t}\n});\nconst PSL_CHECK_REQUIRES_NAME_OR_MAP = \"PSL_CHECK_REQUIRES_NAME_OR_MAP\";\nconst PSL_CHECK_NAME_XOR_MAP = \"PSL_CHECK_NAME_XOR_MAP\";\nconst PSL_CHECK_EXPRESSION_EMPTY = \"PSL_CHECK_EXPRESSION_EMPTY\";\n/**\n* A single-table-inheritance variant (`@@base` with no own `@@map`) shares\n* its base model's storage table and has no table of its own to declare a\n* check on — raised from {@link interpretPslDocumentToSqlContract}, not from\n* this spec's own `refine`, because the rule needs the model's `@@base`\n* declaration, which a single attribute's `refine` cannot see.\n*/\nconst PSL_CHECK_ON_STI_VARIANT = \"PSL_CHECK_ON_STI_VARIANT\";\nconst checkModelSpec = modelAttribute(\"check\", {\n\tnamed: {\n\t\texpression: str(),\n\t\tname: optional(str()),\n\t\tmap: optional(str())\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` expression must not be empty — an empty predicate is not a constraint\", PSL_CHECK_EXPRESSION_EMPTY));\n\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)\", PSL_CHECK_REQUIRES_NAME_OR_MAP));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` takes at most one of `name` and `map`\", PSL_CHECK_NAME_XOR_MAP));\n\t\treturn diagnostics;\n\t}\n});\nconst controlModelSpec = modelAttribute(\"control\", { positional: [{\n\tkey: \"policy\",\n\ttype: oneOf(identifier(\"managed\"), identifier(\"tolerated\"), identifier(\"external\"), identifier(\"observed\"))\n}] });\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", { positional: [{\n\tkey: \"field\",\n\ttype: fieldRef(\"self\")\n}] });\nconst baseModelSpec = modelAttribute(\"base\", { positional: [{\n\tkey: \"base\",\n\ttype: entityRef()\n}, {\n\tkey: \"value\",\n\ttype: str()\n}] });\nfunction relationAttributeSpan(ctx) {\n\tconst field = ctx.field;\n\tif (field !== void 0) {\n\t\tconst node = findFieldAttributeNode(field, \"relation\");\n\t\tif (node !== void 0) return nodePslSpan(node.syntax, ctx.sourceFile);\n\t\treturn field.span;\n\t}\n\treturn ctx.selfModel.span;\n}\nfunction relationInvariants(parsed, ctx) {\n\tif (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_SYNTAX\",\n\t\tmessage: `Relation field \"${ctx.selfModel.name}.${ctx.field?.name ?? \"\"}\" requires fields and references arguments`,\n\t\tsourceId: ctx.sourceId,\n\t\tspan: relationAttributeSpan(ctx)\n\t}];\n\treturn [];\n}\nconst referentialActionArgument = () => oneOf(identifier(\"NoAction\"), identifier(\"Restrict\"), identifier(\"Cascade\"), identifier(\"SetNull\"), identifier(\"SetDefault\"));\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str())\n\t}],\n\tnamed: {\n\t\tname: optional(str()),\n\t\tfields: optional(list(fieldRef(\"self\"), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t})),\n\t\treferences: optional(list(fieldRef(\"referenced\"), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t})),\n\t\tmap: optional(str()),\n\t\tonDelete: optional(referentialActionArgument()),\n\t\tonUpdate: optional(referentialActionArgument()),\n\t\tindex: optional(bool())\n\t},\n\trefine: relationInvariants\n});\nfunction fieldSpecContext(input) {\n\treturn {\n\t\tsymbols: input.symbols,\n\t\tmodel: input.model,\n\t\tfield: input.field,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t};\n}\nconst sqlAttributeSpecs = {\n\tmodel: {\n\t\tmap: () => mapModelSpec,\n\t\tid: () => idModelSpec,\n\t\tunique: () => uniqueModelSpec,\n\t\tindex: () => indexModelSpec,\n\t\tcheck: () => checkModelSpec,\n\t\tcontrol: () => controlModelSpec,\n\t\tdiscriminator: () => discriminatorModelSpec,\n\t\tbase: () => baseModelSpec\n\t},\n\tfield: {\n\t\tmap: () => mapFieldSpec,\n\t\tid: () => idFieldSpec,\n\t\tunique: () => uniqueFieldSpec,\n\t\tnoCheck: () => noCheckFieldSpec,\n\t\trelation: () => relationFieldSpec,\n\t\tdefault: defaultFieldSpec\n\t}\n};\n//#endregion\nexport { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };\n\n//# sourceMappingURL=sql-attribute-specs-Cr8_u9ma.mjs.map"],"mappings":";;;;AAIA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,OAAO;EACP,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,8BAA8B,KAAK;CACpC;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,OAAO;EACP,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB,wBAAwB,MAAM,iCAAiC,KAAK;EACpE,OAAO,MAAM;CACd;AACD;AACA,SAAS,wBAAwB,OAAO;CACvC,MAAM,SAAS,mBAAmB,MAAM,MAAM,MAAM,MAAM,uBAAuB;EAChF,WAAW,MAAM;EACjB,YAAY,MAAM;EAClB,UAAU,MAAM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