@sequenceholdings/orm 2.6.1 → 2.7.0

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 (48) hide show
  1. package/README.md +76 -2
  2. package/dist/authoring.d.cts +1 -1
  3. package/dist/authoring.d.ts +1 -1
  4. package/dist/canonical.d.cts +71 -71
  5. package/dist/canonical.d.ts +71 -71
  6. package/dist/cli.cjs +81 -29
  7. package/dist/cli.cjs.map +1 -1
  8. package/dist/cli.js +81 -29
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.cjs +79 -13
  11. package/dist/client.cjs.map +1 -1
  12. package/dist/client.d.cts +26 -4
  13. package/dist/client.d.ts +26 -4
  14. package/dist/client.js +79 -13
  15. package/dist/client.js.map +1 -1
  16. package/dist/compiler.cjs +68 -29
  17. package/dist/compiler.cjs.map +1 -1
  18. package/dist/compiler.d.cts +1 -1
  19. package/dist/compiler.d.ts +1 -1
  20. package/dist/compiler.js +68 -29
  21. package/dist/compiler.js.map +1 -1
  22. package/dist/index.cjs +73 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +63 -61
  25. package/dist/index.d.ts +63 -61
  26. package/dist/index.js +72 -5
  27. package/dist/index.js.map +1 -1
  28. package/dist/ir.cjs +19 -3
  29. package/dist/ir.cjs.map +1 -1
  30. package/dist/ir.d.cts +83 -76
  31. package/dist/ir.d.ts +83 -76
  32. package/dist/ir.js +18 -4
  33. package/dist/ir.js.map +1 -1
  34. package/dist/predicate-v2.cjs +24 -2
  35. package/dist/predicate-v2.cjs.map +1 -1
  36. package/dist/predicate-v2.d.cts +4 -0
  37. package/dist/predicate-v2.d.ts +4 -0
  38. package/dist/predicate-v2.js +24 -2
  39. package/dist/predicate-v2.js.map +1 -1
  40. package/dist/sdl.cjs +16 -2
  41. package/dist/sdl.cjs.map +1 -1
  42. package/dist/sdl.js +16 -2
  43. package/dist/sdl.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/codegen-gql/preset.cjs +45 -8
  46. package/templates/orm-namespace/codegen.ts +5 -0
  47. package/dist/{definition-B99BsOAO.d.cts → definition-DjfC7Lll.d.cts} +4 -4
  48. package/dist/{definition-B99BsOAO.d.ts → definition-DjfC7Lll.d.ts} +4 -4
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export { AuthoringContext, AuthoringRegistration, COLUMN_BRAND, COLUMN_DEFAULT_FNS, CatalogFolders, CheckInput, ColumnBuilder, ColumnDefaultFn, ColumnDefaultLiteral, ColumnTypeSpec, Comparator, CowMutationInput, DrizzleRelation, DurationInput, ENUM_BRAND, EnumRef, EtlSourceInput, ExternalObjectRef, ForeignKeyInput, FunctionRef, IndexInput, LINK_BRAND, LinkKind, LoadNamespaceOptions, LoadedNamespaceV2, ManualSourceInput, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, NamespaceCapabilitiesInput, NamespaceCatalog, NamespaceConfigInput, ORM_TO_PIPELINE_TYPE, OrmContractColumnMap, OrmContractPipelineColumn, OrmSyncedTableContract, OrmToPipelineType, OverlayTableRef, OverlayWinsUnionInput, OverrideRowMutationInput, PolicyInput, PolicyVariantInput, PolicyWithVariantsInput, PrefetchSourceInput, ReferentialAction, RelationRef, ResolvedSourceInput, ResolvedTableConfig, ResolvedTablePoliciesInput, RevertOverlayMutationInput, SCHEMA_DIR, SYNCED_CONTRACT_HASH_DOMAIN, SeqLink, SeqNamespaceConfig, SeqTable, SeqView, SerializeNamespaceInput, SyncedTableConfig, SyncedTablePoliciesInput, TABLE_BRAND, TableConfig, TablePoliciesInput, TableRef, ToManyOptions, ToOneOptions, ToPlatformUserOptions, TypedSyncedTableConfig, VIEW_BRAND, ViewConfig, ViewPoliciesInput, ViewQueryContext, ViewSelectQuery, activeAuthoringContext, beginAuthoringContext, computeCanonicalHash, computeSyncedContractHash, custom, defineEnum, defineNamespace, defineResolvedTable, defineSyncedTable, defineTable, defineView, deriveColumnName, endAuthoringContext, etlSource, extractOrmSyncedTableContract, highest, isColumnBuilder, isEnumRef, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, latest, loadNamespaceFromDir, lowest, managedFn, manualSource, nonNullFirst, objectRef, overlayWinsUnion, overrideRowMutation, prefetchSource, priority, revertOverlayMutation, serializeNamespace, syncedContractSurface, t, toMany, toOne, toPlatformUser, validateNamespaceCatalog } from './authoring.js';
2
- export { S as SqlOperationDefinition, d as defineOperation } from './definition-B99BsOAO.js';
2
+ export { S as SqlOperationDefinition, d as defineOperation } from './definition-DjfC7Lll.js';
3
3
  import { CanonicalDefinition } from './canonical.js';
4
4
  export { CANONICAL_FORMAT, CanonicalColumn, CanonicalEnum, CanonicalLink, CanonicalTable, CanonicalView, IDENTIFIER_RE, OntologyContract, canonicalActionSchema, canonicalColumnSchema, canonicalDefinitionSchema, canonicalEnumSchema, canonicalIndexSchema, canonicalLinkSchema, canonicalPoliciesSchema, canonicalRelations, canonicalTableSchema, canonicalViewSchema, normalizeCanonical, ontologyContractSchema, readOntologyContract } from './canonical.js';
5
5
  import { CustomRolesBlock } from '@sequenceholdings/custom-roles-manifest';
6
6
  export { CustomRolesBlock, capabilityPinsSchema, customRolesBlockSchema, customRolesDeclared, parseCapabilityPin, validateCapabilityPins } from '@sequenceholdings/custom-roles-manifest';
7
7
  import { z } from 'zod';
8
- import { PredIr } from './ir.js';
9
- export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, CellSelectionIr, ClaimKey, CmpOp, CompiledArtifact, CompiledOperation, DATE_BUCKETS, DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, ExternalPolicyClaimKey, GUARDED_IR_VERSION, GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, InputRefKind, IrVersionError, LEGACY_IR_VERSION, LimitIr, OrderIr, PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, ResolvedMetaIr, ResolvedSourceIr, RootIr, SQL_IR_VERSION, SelectionIr, TableMetaIr, ValueIr, VariableDefaultIr, VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema } from './ir.js';
8
+ import { PredIr, TableMetaIr } from './ir.js';
9
+ export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, CellSelectionIr, ClaimKey, CmpOp, CompiledArtifact, CompiledOperation, DATE_BUCKETS, DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, ExternalPolicyClaimKey, GUARDED_IR_VERSION, GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, InputRefKind, IrVersionError, LEGACY_IR_VERSION, LimitIr, OrderIr, PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, ResolvedMetaIr, ResolvedSourceIr, RootIr, SERVICE_PRINCIPAL_IR_VERSION, SQL_IR_VERSION, SelectionIr, ValueIr, VariableDefaultIr, VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, usesServicePrincipal, valueIrSchema, variableDefaultIrSchema, variableIrSchema } from './ir.js';
10
10
  export { e as CAPABILITY_KEY_PATTERN, C as CELLS_FIELD, a as CELL_PARTS, f as CELL_PART_SUFFIX, g as CLAIM_KEY_PATTERN, h as COLUMN_IDENTIFIER_PATTERN, i as CONSUMER_ROLE_SUFFIX, b as CellPart, D as DEFINITION_FILE_EXTENSIONS, H as HASH_DOMAIN, I as IDENTIFIER_PATTERN, M as MATERIALIZE_ACTOR, j as MATERIALIZE_CLAIMS_JSON, k as MAX_DEFINITION_FILE_BYTES, l as MAX_GENERATED_SDL_BYTES, m as MAX_IDENTIFIER_LENGTH, n as MAX_PERSISTED_READ_ROWS, o as MAX_TRACKED_COLUMN_NAME, p as NAMESPACE_CONFIG_FILENAMES, N as NAMESPACE_PATTERN, O as ORM_DATA_TOKEN_HEADER, q as ORM_REGISTRATION_MAX_BYTES, r as ORM_SCHEMA_PREFIX, d as ORM_SERVICE_DATA_TOKEN_HEADER, Q as QUALIFIED_TABLE_PATTERN, R as RESERVED_COLUMN_NAMES, s as RESERVED_TABLE_NAMES, S as SYNCED_SOURCE_PATTERN, c as cellColumnName, t as consumerRoleName, u as materializeLockKey, v as materializedRefreshFunctionName, w as ormSchemaName } from './constants-Dou1RkTo.js';
11
11
  import { generateDrizzleJson } from 'drizzle-kit/api';
12
12
  import { PgTableWithColumns } from 'drizzle-orm/pg-core';
@@ -53,13 +53,13 @@ declare const actionParamSchema: z.ZodObject<{
53
53
  bigint: "bigint";
54
54
  boolean: "boolean";
55
55
  date: "date";
56
- uuid: "uuid";
57
56
  text: "text";
57
+ timestamptz: "timestamptz";
58
+ jsonb: "jsonb";
59
+ uuid: "uuid";
58
60
  integer: "integer";
59
61
  numeric: "numeric";
60
62
  double: "double";
61
- timestamptz: "timestamptz";
62
- jsonb: "jsonb";
63
63
  }>;
64
64
  optional: z.ZodOptional<z.ZodBoolean>;
65
65
  description: z.ZodOptional<z.ZodString>;
@@ -78,13 +78,13 @@ declare const actionSchema: z.ZodObject<{
78
78
  bigint: "bigint";
79
79
  boolean: "boolean";
80
80
  date: "date";
81
- uuid: "uuid";
82
81
  text: "text";
82
+ timestamptz: "timestamptz";
83
+ jsonb: "jsonb";
84
+ uuid: "uuid";
83
85
  integer: "integer";
84
86
  numeric: "numeric";
85
87
  double: "double";
86
- timestamptz: "timestamptz";
87
- jsonb: "jsonb";
88
88
  }>;
89
89
  optional: z.ZodOptional<z.ZodBoolean>;
90
90
  description: z.ZodOptional<z.ZodString>;
@@ -95,19 +95,19 @@ declare const actionSchema: z.ZodObject<{
95
95
  bigint: "bigint";
96
96
  boolean: "boolean";
97
97
  date: "date";
98
- uuid: "uuid";
99
98
  text: "text";
99
+ timestamptz: "timestamptz";
100
+ jsonb: "jsonb";
101
+ uuid: "uuid";
100
102
  integer: "integer";
101
103
  numeric: "numeric";
102
104
  double: "double";
103
- timestamptz: "timestamptz";
104
- jsonb: "jsonb";
105
105
  }>>>;
106
106
  audit: z.ZodOptional<z.ZodObject<{
107
107
  action: z.ZodEnum<{
108
108
  update: "update";
109
- delete: "delete";
110
109
  create: "create";
110
+ delete: "delete";
111
111
  }>;
112
112
  resource: z.ZodOptional<z.ZodString>;
113
113
  }, z.core.$strict>>;
@@ -130,13 +130,13 @@ declare const columnTypeSchema: z.ZodEnum<{
130
130
  bigint: "bigint";
131
131
  boolean: "boolean";
132
132
  date: "date";
133
- uuid: "uuid";
134
133
  text: "text";
134
+ timestamptz: "timestamptz";
135
+ jsonb: "jsonb";
136
+ uuid: "uuid";
135
137
  integer: "integer";
136
138
  numeric: "numeric";
137
139
  double: "double";
138
- timestamptz: "timestamptz";
139
- jsonb: "jsonb";
140
140
  }>;
141
141
  /**
142
142
  * True when the default is one of the allowlisted SQL function calls for its
@@ -162,13 +162,13 @@ declare const columnSchema: z.ZodObject<{
162
162
  bigint: "bigint";
163
163
  boolean: "boolean";
164
164
  date: "date";
165
- uuid: "uuid";
166
165
  text: "text";
166
+ timestamptz: "timestamptz";
167
+ jsonb: "jsonb";
168
+ uuid: "uuid";
167
169
  integer: "integer";
168
170
  numeric: "numeric";
169
171
  double: "double";
170
- timestamptz: "timestamptz";
171
- jsonb: "jsonb";
172
172
  }>;
173
173
  primary_key: z.ZodOptional<z.ZodBoolean>;
174
174
  nullable: z.ZodOptional<z.ZodBoolean>;
@@ -212,13 +212,13 @@ declare const tableFileSchema: z.ZodObject<{
212
212
  bigint: "bigint";
213
213
  boolean: "boolean";
214
214
  date: "date";
215
- uuid: "uuid";
216
215
  text: "text";
216
+ timestamptz: "timestamptz";
217
+ jsonb: "jsonb";
218
+ uuid: "uuid";
217
219
  integer: "integer";
218
220
  numeric: "numeric";
219
221
  double: "double";
220
- timestamptz: "timestamptz";
221
- jsonb: "jsonb";
222
222
  }>;
223
223
  primary_key: z.ZodOptional<z.ZodBoolean>;
224
224
  nullable: z.ZodOptional<z.ZodBoolean>;
@@ -263,13 +263,13 @@ declare const tableFileSchema: z.ZodObject<{
263
263
  bigint: "bigint";
264
264
  boolean: "boolean";
265
265
  date: "date";
266
- uuid: "uuid";
267
266
  text: "text";
267
+ timestamptz: "timestamptz";
268
+ jsonb: "jsonb";
269
+ uuid: "uuid";
268
270
  integer: "integer";
269
271
  numeric: "numeric";
270
272
  double: "double";
271
- timestamptz: "timestamptz";
272
- jsonb: "jsonb";
273
273
  }>;
274
274
  optional: z.ZodOptional<z.ZodBoolean>;
275
275
  description: z.ZodOptional<z.ZodString>;
@@ -280,19 +280,19 @@ declare const tableFileSchema: z.ZodObject<{
280
280
  bigint: "bigint";
281
281
  boolean: "boolean";
282
282
  date: "date";
283
- uuid: "uuid";
284
283
  text: "text";
284
+ timestamptz: "timestamptz";
285
+ jsonb: "jsonb";
286
+ uuid: "uuid";
285
287
  integer: "integer";
286
288
  numeric: "numeric";
287
289
  double: "double";
288
- timestamptz: "timestamptz";
289
- jsonb: "jsonb";
290
290
  }>>>;
291
291
  audit: z.ZodOptional<z.ZodObject<{
292
292
  action: z.ZodEnum<{
293
293
  update: "update";
294
- delete: "delete";
295
294
  create: "create";
295
+ delete: "delete";
296
296
  }>;
297
297
  resource: z.ZodOptional<z.ZodString>;
298
298
  }, z.core.$strict>>;
@@ -592,11 +592,13 @@ interface SyncedBacking {
592
592
  * SELECT before CREATE VIEW, or preserve a separately verified publisher grant.
593
593
  */
594
594
  declare const SYNCED_VIEW_EXECUTION_OWNER_ROLE = "orm_exec";
595
- declare function syncedViewStatements({ definition, backings, readPolicyIrByTable, columnNamesByTable, columnTypesByTable, executionOwnerRole, backingPrivileges, viewPrivileges, statementClaimChecks, }: {
595
+ declare function syncedViewStatements({ definition, backings, readPolicyIrByTable, policyTables, columnNamesByTable, columnTypesByTable, executionOwnerRole, backingPrivileges, viewPrivileges, statementClaimChecks, }: {
596
596
  definition: NamespaceDefinition;
597
597
  backings: readonly SyncedBacking[];
598
598
  /** v2 compiled read policies (preserves capability/role variants). */
599
599
  readPolicyIrByTable?: ReadonlyMap<string, PredIr>;
600
+ /** Shared compiler metadata, including qualified imported targets and platform users. */
601
+ policyTables?: Readonly<Record<string, TableMetaIr>>;
600
602
  /** Logical column name → physical backing column name per synced table. */
601
603
  columnNamesByTable?: ReadonlyMap<string, Readonly<Record<string, string>>>;
602
604
  /**
@@ -802,13 +804,13 @@ declare const ormMigrationExportSchema: z.ZodObject<{
802
804
  bigint: "bigint";
803
805
  boolean: "boolean";
804
806
  date: "date";
805
- uuid: "uuid";
806
807
  text: "text";
808
+ timestamptz: "timestamptz";
809
+ jsonb: "jsonb";
810
+ uuid: "uuid";
807
811
  integer: "integer";
808
812
  numeric: "numeric";
809
813
  double: "double";
810
- timestamptz: "timestamptz";
811
- jsonb: "jsonb";
812
814
  }>, z.ZodObject<{
813
815
  enum: z.ZodString;
814
816
  }, z.core.$strip>]>;
@@ -830,10 +832,10 @@ declare const ormMigrationExportSchema: z.ZodObject<{
830
832
  of: z.ZodString;
831
833
  part: z.ZodEnum<{
832
834
  at: "at";
833
- source: "source";
834
835
  by: "by";
835
- conflicts: "conflicts";
836
836
  rev: "rev";
837
+ source: "source";
838
+ conflicts: "conflicts";
837
839
  }>;
838
840
  }, z.core.$strict>>;
839
841
  }, z.core.$strip>>>;
@@ -917,21 +919,21 @@ declare const ormMigrationExportSchema: z.ZodObject<{
917
919
  bigint: "bigint";
918
920
  boolean: "boolean";
919
921
  date: "date";
920
- uuid: "uuid";
921
922
  text: "text";
923
+ timestamptz: "timestamptz";
924
+ jsonb: "jsonb";
925
+ uuid: "uuid";
922
926
  integer: "integer";
923
927
  numeric: "numeric";
924
928
  double: "double";
925
- timestamptz: "timestamptz";
926
- jsonb: "jsonb";
927
929
  }>;
928
930
  nullable: z.ZodDefault<z.ZodBoolean>;
929
931
  }, z.core.$strip>>>;
930
932
  executes: z.ZodString;
931
933
  returns: z.ZodDefault<z.ZodEnum<{
932
934
  rows: "rows";
933
- scalar: "scalar";
934
935
  rowsAffected: "rowsAffected";
936
+ scalar: "scalar";
935
937
  }>>;
936
938
  audit: z.ZodOptional<z.ZodObject<{
937
939
  action: z.ZodString;
@@ -987,13 +989,13 @@ declare const ormMigrationExportSchema: z.ZodObject<{
987
989
  bigint: "bigint";
988
990
  boolean: "boolean";
989
991
  date: "date";
990
- uuid: "uuid";
991
992
  text: "text";
993
+ timestamptz: "timestamptz";
994
+ jsonb: "jsonb";
995
+ uuid: "uuid";
992
996
  integer: "integer";
993
997
  numeric: "numeric";
994
998
  double: "double";
995
- timestamptz: "timestamptz";
996
- jsonb: "jsonb";
997
999
  }>, z.ZodObject<{
998
1000
  enum: z.ZodString;
999
1001
  }, z.core.$strip>]>;
@@ -1015,10 +1017,10 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1015
1017
  of: z.ZodString;
1016
1018
  part: z.ZodEnum<{
1017
1019
  at: "at";
1018
- source: "source";
1019
1020
  by: "by";
1020
- conflicts: "conflicts";
1021
1021
  rev: "rev";
1022
+ source: "source";
1023
+ conflicts: "conflicts";
1022
1024
  }>;
1023
1025
  }, z.core.$strict>>;
1024
1026
  }, z.core.$strip>>;
@@ -1067,8 +1069,8 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1067
1069
  sources: z.ZodArray<z.ZodObject<{
1068
1070
  name: z.ZodString;
1069
1071
  kind: z.ZodEnum<{
1070
- prefetch: "prefetch";
1071
1072
  manual: "manual";
1073
+ prefetch: "prefetch";
1072
1074
  etl: "etl";
1073
1075
  }>;
1074
1076
  table: z.ZodString;
@@ -1190,13 +1192,13 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1190
1192
  bigint: "bigint";
1191
1193
  boolean: "boolean";
1192
1194
  date: "date";
1193
- uuid: "uuid";
1194
1195
  text: "text";
1196
+ timestamptz: "timestamptz";
1197
+ jsonb: "jsonb";
1198
+ uuid: "uuid";
1195
1199
  integer: "integer";
1196
1200
  numeric: "numeric";
1197
1201
  double: "double";
1198
- timestamptz: "timestamptz";
1199
- jsonb: "jsonb";
1200
1202
  }>, z.ZodObject<{
1201
1203
  enum: z.ZodString;
1202
1204
  }, z.core.$strip>]>;
@@ -1218,10 +1220,10 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1218
1220
  of: z.ZodString;
1219
1221
  part: z.ZodEnum<{
1220
1222
  at: "at";
1221
- source: "source";
1222
1223
  by: "by";
1223
- conflicts: "conflicts";
1224
1224
  rev: "rev";
1225
+ source: "source";
1226
+ conflicts: "conflicts";
1225
1227
  }>;
1226
1228
  }, z.core.$strict>>;
1227
1229
  }, z.core.$strip>>>;
@@ -1305,21 +1307,21 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1305
1307
  bigint: "bigint";
1306
1308
  boolean: "boolean";
1307
1309
  date: "date";
1308
- uuid: "uuid";
1309
1310
  text: "text";
1311
+ timestamptz: "timestamptz";
1312
+ jsonb: "jsonb";
1313
+ uuid: "uuid";
1310
1314
  integer: "integer";
1311
1315
  numeric: "numeric";
1312
1316
  double: "double";
1313
- timestamptz: "timestamptz";
1314
- jsonb: "jsonb";
1315
1317
  }>;
1316
1318
  nullable: z.ZodDefault<z.ZodBoolean>;
1317
1319
  }, z.core.$strip>>>;
1318
1320
  executes: z.ZodString;
1319
1321
  returns: z.ZodDefault<z.ZodEnum<{
1320
1322
  rows: "rows";
1321
- scalar: "scalar";
1322
1323
  rowsAffected: "rowsAffected";
1324
+ scalar: "scalar";
1323
1325
  }>>;
1324
1326
  audit: z.ZodOptional<z.ZodObject<{
1325
1327
  action: z.ZodString;
@@ -1375,13 +1377,13 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1375
1377
  bigint: "bigint";
1376
1378
  boolean: "boolean";
1377
1379
  date: "date";
1378
- uuid: "uuid";
1379
1380
  text: "text";
1381
+ timestamptz: "timestamptz";
1382
+ jsonb: "jsonb";
1383
+ uuid: "uuid";
1380
1384
  integer: "integer";
1381
1385
  numeric: "numeric";
1382
1386
  double: "double";
1383
- timestamptz: "timestamptz";
1384
- jsonb: "jsonb";
1385
1387
  }>, z.ZodObject<{
1386
1388
  enum: z.ZodString;
1387
1389
  }, z.core.$strip>]>;
@@ -1403,10 +1405,10 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1403
1405
  of: z.ZodString;
1404
1406
  part: z.ZodEnum<{
1405
1407
  at: "at";
1406
- source: "source";
1407
1408
  by: "by";
1408
- conflicts: "conflicts";
1409
1409
  rev: "rev";
1410
+ source: "source";
1411
+ conflicts: "conflicts";
1410
1412
  }>;
1411
1413
  }, z.core.$strict>>;
1412
1414
  }, z.core.$strip>>;
@@ -1455,8 +1457,8 @@ declare const ormMigrationExportSchema: z.ZodObject<{
1455
1457
  sources: z.ZodArray<z.ZodObject<{
1456
1458
  name: z.ZodString;
1457
1459
  kind: z.ZodEnum<{
1458
- prefetch: "prefetch";
1459
1460
  manual: "manual";
1461
+ prefetch: "prefetch";
1460
1462
  etl: "etl";
1461
1463
  }>;
1462
1464
  table: z.ZodString;
@@ -1877,4 +1879,4 @@ declare function planTableImport({ definition, spec, after, }: {
1877
1879
  after?: string;
1878
1880
  }): ImportPlanResult;
1879
1881
 
1880
- export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, type ActionDefinition, CAPABILITIES_CLAIM_KEY, CLAIMS_SETTING, COLUMN_TYPES, COMPARE_OPS, CanonicalDefinition, type ColumnDefault, type ColumnDefinition, type ColumnType, type CommittedChainEntry, type CommittedMigration, type CompareOp, type CompilePredIrToSqlOptions, type CompiledStatement, type DefinitionFile, type DefinitionSource, type DestructiveStatement, type DiffOptions, type DrizzleEntities, IMPORT_CONFLICT_MODES, type ImportConflictMode, type ImportPlan, type ImportPlanResult, type ImportSpec, type IndexDefinition, type JournalEntry, type LinkDefinition, type LoadedNamespace, MIGRATIONS_DIRNAME, type MigrationJournal, type MigrationWorkspace, type NamespaceCapabilities, type NamespaceConfig, type NamespaceDefinition, type NamespaceSnapshot, ORM_MIGRATION_EXPORT_FILE, ORM_MIGRATION_EXPORT_MAX_BYTES, type Operand, OrmDefinitionError, type OrmMigrationExport, type ParsedPredicate, type PlannedMigration, PredIr, type Predicate, type PredicateColumnTypes, PredicateParseError, ROLES_CLAIM_KEY, type RebaseEntry, type RebaseEntryInput, type RebaseNoopOptions, STATEMENT_KINDS, SYNCED_VIEW_EXECUTION_OWNER_ROLE, type StatementKind, type SyncedBacking, type SyncedColumnType, type SyncedPredicateColumnTypes, type TableFile, type ValidatesEntry, type WrittenMigration, actionFunctionName, actionFunctionStatements, actionParamArg, actionParamOrder, actionParamSchema, actionPrepareChecks, actionSchema, actionWriteTargets, actionsInterfaceName, applyMigrationHints, applyMigrationHintsV2, assertSyncedViewDefinitionMatches, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalizeDefinition, capabilityExpression, castParts, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, computeDefinitionHash, convertV1DefinitionToCanonical, createOrmMigrationExport, declaredCapabilityKeys, diffCommand, diffStatements, emptyJournal, emptySnapshot, extractNamedParams, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, identifierSchema, importSpecSchema, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, migrationName, namespaceConfigSchema, namespaceSchema, normalizeSnapshot, ormMigrationExportSchema, parseCanonicalDefinition, parseDefinitionSources, parseOrmMigrationExport, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planCommittedMigrationV2, planMigration, planMigrationV2, planTableImport, predicateOperands, quoteIdentifier, quoteLiteral, readMigrationSql, readMigrationWorkspace, readSnapshot, rebaseViolations, referencedCapabilities, referencedColumns, renderMigrationSql, renderOrmMigrationExport, rewriteSyncedSourceRelationsInViewQuery, roleExpression, securityStatements, sqlTypeName, stableJson, syncedBackingRevokeStatements, syncedTables, syncedViewDropStatements, syncedViewStatements, tableFileSchema, tableReferenceSchema, typesInterfaceName, validateViewCatalogStatement, verifyRebaseIsNoop, walkPredicate, writeMigration };
1882
+ export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, type ActionDefinition, CAPABILITIES_CLAIM_KEY, CLAIMS_SETTING, COLUMN_TYPES, COMPARE_OPS, CanonicalDefinition, type ColumnDefault, type ColumnDefinition, type ColumnType, type CommittedChainEntry, type CommittedMigration, type CompareOp, type CompilePredIrToSqlOptions, type CompiledStatement, type DefinitionFile, type DefinitionSource, type DestructiveStatement, type DiffOptions, type DrizzleEntities, IMPORT_CONFLICT_MODES, type ImportConflictMode, type ImportPlan, type ImportPlanResult, type ImportSpec, type IndexDefinition, type JournalEntry, type LinkDefinition, type LoadedNamespace, MIGRATIONS_DIRNAME, type MigrationJournal, type MigrationWorkspace, type NamespaceCapabilities, type NamespaceConfig, type NamespaceDefinition, type NamespaceSnapshot, ORM_MIGRATION_EXPORT_FILE, ORM_MIGRATION_EXPORT_MAX_BYTES, type Operand, OrmDefinitionError, type OrmMigrationExport, type ParsedPredicate, type PlannedMigration, PredIr, type Predicate, type PredicateColumnTypes, PredicateParseError, ROLES_CLAIM_KEY, type RebaseEntry, type RebaseEntryInput, type RebaseNoopOptions, STATEMENT_KINDS, SYNCED_VIEW_EXECUTION_OWNER_ROLE, type StatementKind, type SyncedBacking, type SyncedColumnType, type SyncedPredicateColumnTypes, type TableFile, TableMetaIr, type ValidatesEntry, type WrittenMigration, actionFunctionName, actionFunctionStatements, actionParamArg, actionParamOrder, actionParamSchema, actionPrepareChecks, actionSchema, actionWriteTargets, actionsInterfaceName, applyMigrationHints, applyMigrationHintsV2, assertSyncedViewDefinitionMatches, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalizeDefinition, capabilityExpression, castParts, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, computeDefinitionHash, convertV1DefinitionToCanonical, createOrmMigrationExport, declaredCapabilityKeys, diffCommand, diffStatements, emptyJournal, emptySnapshot, extractNamedParams, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, identifierSchema, importSpecSchema, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, migrationName, namespaceConfigSchema, namespaceSchema, normalizeSnapshot, ormMigrationExportSchema, parseCanonicalDefinition, parseDefinitionSources, parseOrmMigrationExport, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planCommittedMigrationV2, planMigration, planMigrationV2, planTableImport, predicateOperands, quoteIdentifier, quoteLiteral, readMigrationSql, readMigrationWorkspace, readSnapshot, rebaseViolations, referencedCapabilities, referencedColumns, renderMigrationSql, renderOrmMigrationExport, rewriteSyncedSourceRelationsInViewQuery, roleExpression, securityStatements, sqlTypeName, stableJson, syncedBackingRevokeStatements, syncedTables, syncedViewDropStatements, syncedViewStatements, tableFileSchema, tableReferenceSchema, typesInterfaceName, validateViewCatalogStatement, verifyRebaseIsNoop, walkPredicate, writeMigration };
package/dist/index.js CHANGED
@@ -4218,6 +4218,8 @@ function compilePredIrToSql(pred, options = {}) {
4218
4218
  return `(NOT ${compilePredIrToSql(pred.operand, options)})`;
4219
4219
  case "cmp":
4220
4220
  return compileCmp(pred.op, pred.column, pred.value, options);
4221
+ case "servicePrincipal":
4222
+ return `coalesce(${claimExpression("servicePrincipal")} = 'true', false)`;
4221
4223
  case "capability":
4222
4224
  return `(${options.statementClaimChecks ? "SELECT " : ""}${capabilityExpression(pred.key, pred.namespace ?? options.namespace)})`;
4223
4225
  case "role":
@@ -4445,6 +4447,39 @@ function resolveValidatesTarget(definition, entry) {
4445
4447
  }
4446
4448
  return { schema: ormSchemaName(definition.namespace), table: entry.table, key };
4447
4449
  }
4450
+
4451
+ // src/compiler/static-policy-sql.ts
4452
+ function compileStaticPolicySql({ table, predicate, tables, namespace, alias, rootRelation, statementClaimChecks, onRead }) {
4453
+ let sequence = 0;
4454
+ const aliases = new Set([alias, rootRelation].filter((value) => value !== void 0));
4455
+ const column = (meta, qualifier, name2) => {
4456
+ const found = meta.columns.find((c) => c.name === name2 || c.columnName === name2);
4457
+ if (!found) throw new OrmDefinitionError("Static policy relationship column is unavailable");
4458
+ return `${quoteIdentifier(qualifier)}.${quoteIdentifier(found.columnName)}`;
4459
+ };
4460
+ const render = (meta, pred, qualifier, outerRelation) => compilePredIrToSql(pred, {
4461
+ alias: qualifier,
4462
+ namespace: meta.namespace ?? namespace,
4463
+ statementClaimChecks,
4464
+ columnNames: Object.fromEntries(meta.columns.map((c) => [c.name, c.columnName])),
4465
+ columnTypes: Object.fromEntries(meta.columns.map((c) => [c.name, c.type])),
4466
+ exists: (node) => {
4467
+ const link = meta.links.find((candidate) => candidate.name === node.link);
4468
+ const target = link?.target ? tables[link.target] : void 0;
4469
+ const parent = qualifier ?? outerRelation;
4470
+ if (!link || !target || !parent) throw new OrmDefinitionError("Static policy relationship metadata is unavailable");
4471
+ onRead?.(target);
4472
+ let child;
4473
+ do {
4474
+ child = `policy_${++sequence}`;
4475
+ } while (aliases.has(child));
4476
+ aliases.add(child);
4477
+ const join4 = link.kind === "toMany" ? `${column(target, child, link.on)} = ${column(meta, parent, link.references)}` : `${column(meta, parent, link.on)} = ${column(target, child, link.references)}`;
4478
+ return `EXISTS (SELECT 1 FROM ${quoteIdentifier(target.schema)}.${quoteIdentifier(target.table)} AS ${quoteIdentifier(child)} WHERE ${join4} AND (${render(target, node.where, child)}))`;
4479
+ }
4480
+ });
4481
+ return render(table, predicate, alias, rootRelation);
4482
+ }
4448
4483
  var linkSchema = z.strictObject({
4449
4484
  to: tableReferenceSchema,
4450
4485
  on: identifierSchema,
@@ -4794,6 +4829,7 @@ function syncedViewStatements({
4794
4829
  definition,
4795
4830
  backings,
4796
4831
  readPolicyIrByTable,
4832
+ policyTables,
4797
4833
  columnNamesByTable,
4798
4834
  columnTypesByTable,
4799
4835
  executionOwnerRole = SYNCED_VIEW_EXECUTION_OWNER_ROLE,
@@ -4840,7 +4876,15 @@ function syncedViewStatements({
4840
4876
  });
4841
4877
  const readPolicyIr = readPolicyIrByTable?.get(table.table);
4842
4878
  const readPolicy = table.policies?.read;
4843
- const policyClause = readPolicyIr ? ` WHERE ${compilePredIrToSql(readPolicyIr, {
4879
+ const policyTable = policyTables?.[table.table];
4880
+ const policyClause = readPolicyIr ? ` WHERE ${policyTable && policyTables ? compileStaticPolicySql({
4881
+ table: policyTable,
4882
+ predicate: readPolicyIr,
4883
+ tables: policyTables,
4884
+ namespace: definition.namespace,
4885
+ rootRelation: physical2.table,
4886
+ statementClaimChecks
4887
+ }) : compilePredIrToSql(readPolicyIr, {
4844
4888
  namespace: definition.namespace,
4845
4889
  statementClaimChecks,
4846
4890
  columnTypes,
@@ -6425,6 +6469,15 @@ function correctIntrospectionQuery(query) {
6425
6469
  if (!is(query, SQL)) return query;
6426
6470
  const compiled = new PgDialect().sqlToQuery(query);
6427
6471
  let text4 = compiled.sql;
6472
+ if (text4.includes("JOIN information_schema.constraint_column_usage AS ccu USING (constraint_schema, constraint_name)")) {
6473
+ text4 = text4.replace(/;\s*$/, "") + ` ORDER BY tc.constraint_name,
6474
+ (SELECT key_usage.ordinal_position FROM information_schema.key_column_usage AS key_usage
6475
+ WHERE key_usage.constraint_schema = tc.constraint_schema
6476
+ AND key_usage.constraint_name = tc.constraint_name
6477
+ AND key_usage.table_schema = tc.table_schema
6478
+ AND key_usage.table_name = tc.table_name
6479
+ AND key_usage.column_name = c.column_name)`;
6480
+ }
6428
6481
  const indexJoin = "pg_constraint con ON con.conindid = idx.indexrelid";
6429
6482
  if (text4.includes("AS generated_by_constraint") && text4.includes(indexJoin)) {
6430
6483
  text4 = text4.replace(indexJoin, `${indexJoin} AND con.contype IN ('p', 'u', 'x')`);
@@ -6657,14 +6710,21 @@ function renderOrmMigrationExport(exported) {
6657
6710
  var BUILTIN_SQL_READ_HASH = "sha256:a50c477c952a5e0fe68ed158a4530e4aab573c09bcbb1a8ac454dc88a39a6258";
6658
6711
 
6659
6712
  // src/ir/index.ts
6660
- var IR_VERSION = 5;
6713
+ var IR_VERSION = 6;
6661
6714
  var LEGACY_IR_VERSION = 1;
6662
6715
  var GUARDED_IR_VERSION = 2;
6663
6716
  var COMPOSED_IR_VERSION = 3;
6664
6717
  var SQL_IR_VERSION = 4;
6665
6718
  var RUNTIME_SQL_IR_VERSION = 5;
6666
- var irVersionSchema = z.union([z.literal(LEGACY_IR_VERSION), z.literal(GUARDED_IR_VERSION), z.literal(COMPOSED_IR_VERSION), z.literal(SQL_IR_VERSION), z.literal(RUNTIME_SQL_IR_VERSION)]);
6719
+ var SERVICE_PRINCIPAL_IR_VERSION = 6;
6720
+ var irVersionSchema = z.union([z.literal(LEGACY_IR_VERSION), z.literal(GUARDED_IR_VERSION), z.literal(COMPOSED_IR_VERSION), z.literal(SQL_IR_VERSION), z.literal(RUNTIME_SQL_IR_VERSION), z.literal(SERVICE_PRINCIPAL_IR_VERSION)]);
6667
6721
  var operationVersionSchema = z.object({ irVersion: irVersionSchema });
6722
+ function usesServicePrincipal(value) {
6723
+ if (value === null || typeof value !== "object") return false;
6724
+ if (Array.isArray(value)) return value.some(usesServicePrincipal);
6725
+ const row = value;
6726
+ return row.kind === "servicePrincipal" || Object.values(row).some(usesServicePrincipal);
6727
+ }
6668
6728
  function requiredArtifactIrVersion(operations) {
6669
6729
  let required = LEGACY_IR_VERSION;
6670
6730
  for (const operation of operations) {
@@ -6724,6 +6784,7 @@ var predIrSchema = z.lazy(
6724
6784
  z.object({ kind: z.literal("capability"), key: z.string(), namespace: z.string().optional() }),
6725
6785
  z.object({ kind: z.literal("role"), key: z.string(), namespace: z.string().optional() }),
6726
6786
  z.object({ kind: z.literal("dynamicFilter"), slot: z.string() }),
6787
+ z.object({ kind: z.literal("servicePrincipal") }).strict(),
6727
6788
  z.object({ kind: z.literal("const"), value: z.boolean() })
6728
6789
  ])
6729
6790
  );
@@ -6949,7 +7010,7 @@ var variableIrSchema = z.object({
6949
7010
  /** Absent = no default declared; see {@link variableDefaultIrSchema}. */
6950
7011
  defaultValue: variableDefaultIrSchema.optional()
6951
7012
  });
6952
- var sqlColumnSchema = z.object({ name: z.string(), type: z.enum(["text", "boolean", "integer", "bigint", "numeric", "double", "uuid", "date", "timestamptz"]), nullable: z.boolean() });
7013
+ var sqlColumnSchema = z.object({ name: z.string(), type: z.enum(["text", "boolean", "integer", "bigint", "numeric", "double", "uuid", "date", "timestamptz", "jsonb"]), nullable: z.boolean() });
6953
7014
  var compiledOperationSchema = z.object({
6954
7015
  language: z.literal("sql").optional(),
6955
7016
  /** Server-compiled object catalog and permission ceiling, never caller SQL. */
@@ -6987,6 +7048,9 @@ var compiledOperationSchema = z.object({
6987
7048
  tableSet: z.array(z.string()).min(1),
6988
7049
  roots: z.array(rootIrSchema)
6989
7050
  }).superRefine((operation, ctx) => {
7051
+ if (operation.irVersion < SERVICE_PRINCIPAL_IR_VERSION && usesServicePrincipal(operation.roots)) {
7052
+ ctx.addIssue({ code: "custom", message: "servicePrincipal() requires IR v6" });
7053
+ }
6990
7054
  if (operation.language === "sql") {
6991
7055
  const validPlan = operation.sqlQuery ? !operation.sql && operation.irVersion === RUNTIME_SQL_IR_VERSION : !!operation.sql && operation.irVersion === SQL_IR_VERSION;
6992
7056
  const builtin = operation.name === "BuiltinSqlRead" && operation.opHash === BUILTIN_SQL_READ_HASH && operation.requires === null;
@@ -7119,6 +7183,9 @@ var compiledArtifactSchema = z.object({
7119
7183
  tables: z.record(z.string(), tableMetaIrSchema),
7120
7184
  operations: z.record(z.string(), compiledOperationSchema)
7121
7185
  }).superRefine((artifact, ctx) => {
7186
+ if (artifact.irVersion < SERVICE_PRINCIPAL_IR_VERSION && usesServicePrincipal(artifact)) {
7187
+ ctx.addIssue({ code: "custom", message: "servicePrincipal() requires IR v6" });
7188
+ }
7122
7189
  if (Object.keys(artifact.dependencies ?? {}).length > 0 && artifact.irVersion < COMPOSED_IR_VERSION) {
7123
7190
  ctx.addIssue({ code: "custom", path: ["irVersion"], message: "cross-namespace dependencies require IR v3" });
7124
7191
  }
@@ -8361,6 +8428,6 @@ function resumeArguments({
8361
8428
  return [literal2.sql];
8362
8429
  }
8363
8430
 
8364
- export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, CANONICAL_FORMAT, CAPABILITIES_CLAIM_KEY, CAPABILITY_KEY_PATTERN, CELLS_FIELD, CELL_PARTS, CELL_PART_SUFFIX, CLAIMS_CONTRACT, CLAIMS_SETTING, CLAIM_KEY_PATTERN, CMP_OPS, COLUMN_BRAND, COLUMN_DEFAULT_FNS, COLUMN_IDENTIFIER_PATTERN, COLUMN_TYPES2 as COLUMN_TYPES, COMPARE_OPS, COMPOSED_IR_VERSION, CONSUMER_ROLE_SUFFIX, ColumnBuilder, DATE_BUCKETS, DEFINITION_FILE_EXTENSIONS, ENUM_BRAND, EXTERNAL_POLICY_CLAIM_KEYS, GUARDED_IR_VERSION, HASH_DOMAIN, IDENTIFIER_PATTERN, IDENTIFIER_RE, IMPORT_CONFLICT_MODES, INPUT_REF_KINDS, IR_VERSION, IrVersionError, LEGACY_IR_VERSION, LINK_BRAND, MATERIALIZE_ACTOR, MATERIALIZE_CLAIMS_JSON, MAX_DEFINITION_FILE_BYTES, MAX_GENERATED_SDL_BYTES, MAX_IDENTIFIER_LENGTH, MAX_PERSISTED_READ_ROWS, MAX_TRACKED_COLUMN_NAME, MIGRATIONS_DIRNAME, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, NAMESPACE_CONFIG_FILENAMES, NAMESPACE_PATTERN, ORM_DATA_TOKEN_HEADER, ORM_MIGRATION_EXPORT_FILE, ORM_MIGRATION_EXPORT_MAX_BYTES, ORM_REGISTRATION_MAX_BYTES, ORM_SCHEMA_PREFIX, ORM_SERVICE_DATA_TOKEN_HEADER, ORM_TO_PIPELINE_TYPE, OrmDefinitionError, PredicateParseError, QUALIFIED_TABLE_PATTERN, RESERVED_COLUMN_NAMES, RESERVED_TABLE_NAMES, ROLES_CLAIM_KEY, RUNTIME_SQL_IR_VERSION, SCHEMA_DIR, SQL_IR_VERSION, STATEMENT_KINDS, SYNCED_CONTRACT_HASH_DOMAIN, SYNCED_SOURCE_PATTERN, SYNCED_VIEW_EXECUTION_OWNER_ROLE, TABLE_BRAND, VIEW_BRAND, actionFunctionName, actionFunctionStatements, actionParamArg, actionParamOrder, actionParamSchema, actionPrepareChecks, actionSchema, actionWriteTargets, actionsInterfaceName, activeAuthoringContext, applyMigrationHints, applyMigrationHintsV2, assertSyncedViewDefinitionMatches, beginAuthoringContext, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalActionSchema, canonicalColumnSchema, canonicalDefinitionSchema, canonicalEnumSchema, canonicalIndexSchema, canonicalLinkSchema, canonicalPoliciesSchema, canonicalRelations, canonicalTableSchema, canonicalViewSchema, canonicalizeDefinition, capabilityExpression, castParts, cellColumnName, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema2 as columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, compiledArtifactSchema, compiledOperationSchema, computeCanonicalHash, computeDefinitionHash, computeSyncedContractHash, consumerRoleName, convertV1DefinitionToCanonical, createOrmMigrationExport, custom, declaredCapabilityKeys, defineEnum, defineNamespace, defineOperation, defineResolvedTable, defineSyncedTable, defineTable, defineView, deriveColumnName, diffCommand, diffStatements, emptyJournal, emptySnapshot, endAuthoringContext, etlSource, extractNamedParams, extractOrmSyncedTableContract, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, highest, identifierSchema, importSpecSchema, indexByHash, isColumnBuilder, isEnumRef, isExternalPolicyClaimKey, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, latest, limitIrSchema, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, loadNamespaceFromDir, lowest, managedFn, manualSource, materializeLockKey, materializedRefreshFunctionName, migrationName, namespaceConfigSchema, namespaceSchema, nonNullFirst, normalizeCanonical, normalizeIr, normalizeSnapshot, objectRef, ontologyContractSchema, orderIrSchema, ormMigrationExportSchema, ormSchemaName, overlayWinsUnion, overrideRowMutation, parseCanonicalDefinition, parseDefinitionSources, parseOrmMigrationExport, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planCommittedMigrationV2, planMigration, planMigrationV2, planTableImport, policyExpressionSchema, policyVariantSchema, predIrSchema, predicateOperands, prefetchPlanIrSchema, prefetchSource, priority, quoteIdentifier, quoteLiteral, readMigrationSql, readMigrationWorkspace, readOntologyContract, readSnapshot, rebaseViolations, referencedCapabilities, referencedColumns, renderMigrationSql, renderOrmMigrationExport, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, revertOverlayMutation, rewriteSyncedSourceRelationsInViewQuery, roleExpression, rootIrSchema, securityStatements, selectionIrSchema, serializeNamespace, sqlTypeName, stableJson, syncedBackingRevokeStatements, syncedContractSurface, syncedTables, syncedViewDropStatements, syncedViewStatements, t, tableFileSchema, tableMetaIrSchema, tableReferenceSchema, toMany, toOne, toPlatformUser, typesInterfaceName, validateNamespaceCatalog, validateViewCatalogStatement, valueIrSchema, variableDefaultIrSchema, variableIrSchema, verifyRebaseIsNoop, walkPredicate, writeMigration };
8431
+ export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, CANONICAL_FORMAT, CAPABILITIES_CLAIM_KEY, CAPABILITY_KEY_PATTERN, CELLS_FIELD, CELL_PARTS, CELL_PART_SUFFIX, CLAIMS_CONTRACT, CLAIMS_SETTING, CLAIM_KEY_PATTERN, CMP_OPS, COLUMN_BRAND, COLUMN_DEFAULT_FNS, COLUMN_IDENTIFIER_PATTERN, COLUMN_TYPES2 as COLUMN_TYPES, COMPARE_OPS, COMPOSED_IR_VERSION, CONSUMER_ROLE_SUFFIX, ColumnBuilder, DATE_BUCKETS, DEFINITION_FILE_EXTENSIONS, ENUM_BRAND, EXTERNAL_POLICY_CLAIM_KEYS, GUARDED_IR_VERSION, HASH_DOMAIN, IDENTIFIER_PATTERN, IDENTIFIER_RE, IMPORT_CONFLICT_MODES, INPUT_REF_KINDS, IR_VERSION, IrVersionError, LEGACY_IR_VERSION, LINK_BRAND, MATERIALIZE_ACTOR, MATERIALIZE_CLAIMS_JSON, MAX_DEFINITION_FILE_BYTES, MAX_GENERATED_SDL_BYTES, MAX_IDENTIFIER_LENGTH, MAX_PERSISTED_READ_ROWS, MAX_TRACKED_COLUMN_NAME, MIGRATIONS_DIRNAME, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, NAMESPACE_CONFIG_FILENAMES, NAMESPACE_PATTERN, ORM_DATA_TOKEN_HEADER, ORM_MIGRATION_EXPORT_FILE, ORM_MIGRATION_EXPORT_MAX_BYTES, ORM_REGISTRATION_MAX_BYTES, ORM_SCHEMA_PREFIX, ORM_SERVICE_DATA_TOKEN_HEADER, ORM_TO_PIPELINE_TYPE, OrmDefinitionError, PredicateParseError, QUALIFIED_TABLE_PATTERN, RESERVED_COLUMN_NAMES, RESERVED_TABLE_NAMES, ROLES_CLAIM_KEY, RUNTIME_SQL_IR_VERSION, SCHEMA_DIR, SERVICE_PRINCIPAL_IR_VERSION, SQL_IR_VERSION, STATEMENT_KINDS, SYNCED_CONTRACT_HASH_DOMAIN, SYNCED_SOURCE_PATTERN, SYNCED_VIEW_EXECUTION_OWNER_ROLE, TABLE_BRAND, VIEW_BRAND, actionFunctionName, actionFunctionStatements, actionParamArg, actionParamOrder, actionParamSchema, actionPrepareChecks, actionSchema, actionWriteTargets, actionsInterfaceName, activeAuthoringContext, applyMigrationHints, applyMigrationHintsV2, assertSyncedViewDefinitionMatches, beginAuthoringContext, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalActionSchema, canonicalColumnSchema, canonicalDefinitionSchema, canonicalEnumSchema, canonicalIndexSchema, canonicalLinkSchema, canonicalPoliciesSchema, canonicalRelations, canonicalTableSchema, canonicalViewSchema, canonicalizeDefinition, capabilityExpression, castParts, cellColumnName, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema2 as columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, compiledArtifactSchema, compiledOperationSchema, computeCanonicalHash, computeDefinitionHash, computeSyncedContractHash, consumerRoleName, convertV1DefinitionToCanonical, createOrmMigrationExport, custom, declaredCapabilityKeys, defineEnum, defineNamespace, defineOperation, defineResolvedTable, defineSyncedTable, defineTable, defineView, deriveColumnName, diffCommand, diffStatements, emptyJournal, emptySnapshot, endAuthoringContext, etlSource, extractNamedParams, extractOrmSyncedTableContract, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, highest, identifierSchema, importSpecSchema, indexByHash, isColumnBuilder, isEnumRef, isExternalPolicyClaimKey, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, latest, limitIrSchema, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, loadNamespaceFromDir, lowest, managedFn, manualSource, materializeLockKey, materializedRefreshFunctionName, migrationName, namespaceConfigSchema, namespaceSchema, nonNullFirst, normalizeCanonical, normalizeIr, normalizeSnapshot, objectRef, ontologyContractSchema, orderIrSchema, ormMigrationExportSchema, ormSchemaName, overlayWinsUnion, overrideRowMutation, parseCanonicalDefinition, parseDefinitionSources, parseOrmMigrationExport, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planCommittedMigrationV2, planMigration, planMigrationV2, planTableImport, policyExpressionSchema, policyVariantSchema, predIrSchema, predicateOperands, prefetchPlanIrSchema, prefetchSource, priority, quoteIdentifier, quoteLiteral, readMigrationSql, readMigrationWorkspace, readOntologyContract, readSnapshot, rebaseViolations, referencedCapabilities, referencedColumns, renderMigrationSql, renderOrmMigrationExport, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, revertOverlayMutation, rewriteSyncedSourceRelationsInViewQuery, roleExpression, rootIrSchema, securityStatements, selectionIrSchema, serializeNamespace, sqlTypeName, stableJson, syncedBackingRevokeStatements, syncedContractSurface, syncedTables, syncedViewDropStatements, syncedViewStatements, t, tableFileSchema, tableMetaIrSchema, tableReferenceSchema, toMany, toOne, toPlatformUser, typesInterfaceName, usesServicePrincipal, validateNamespaceCatalog, validateViewCatalogStatement, valueIrSchema, variableDefaultIrSchema, variableIrSchema, verifyRebaseIsNoop, walkPredicate, writeMigration };
8365
8432
  //# sourceMappingURL=index.js.map
8366
8433
  //# sourceMappingURL=index.js.map