@sequenceholdings/orm 2.6.2 → 2.7.1

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.
package/dist/ir.d.cts CHANGED
@@ -24,14 +24,17 @@ export { C as CELLS_FIELD, a as CELL_PARTS, b as CellPart, c as cellColumnName }
24
24
  */
25
25
 
26
26
  /** Maximum supported version; emit the oldest version that preserves semantics. */
27
- declare const IR_VERSION: 5;
27
+ declare const IR_VERSION: 6;
28
28
  declare const LEGACY_IR_VERSION: 1;
29
29
  declare const GUARDED_IR_VERSION: 2;
30
30
  /** Older v2 executors must not strip namespace-scoped authorization. */
31
31
  declare const COMPOSED_IR_VERSION: 3;
32
32
  declare const SQL_IR_VERSION: 4;
33
33
  declare const RUNTIME_SQL_IR_VERSION: 5;
34
- declare const irVersionSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
34
+ declare const SERVICE_PRINCIPAL_IR_VERSION: 6;
35
+ declare const irVersionSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
36
+ /** Every carrier of a service identity predicate must require the new executor. */
37
+ declare function usesServicePrincipal(value: unknown): boolean;
35
38
  /** Keep v1 artifact identity when assembling only legacy operations from registry rows. */
36
39
  declare function requiredArtifactIrVersion(operations: readonly unknown[]): z.infer<typeof irVersionSchema>;
37
40
  /**
@@ -113,6 +116,8 @@ type PredIr = {
113
116
  kind: 'role';
114
117
  key: string;
115
118
  namespace?: string;
119
+ } | {
120
+ kind: 'servicePrincipal';
116
121
  }
117
122
  /** §4f: a client-supplied BoolExp variable lands here, validated + lowered at runtime. */
118
123
  | {
@@ -733,6 +738,7 @@ declare const compiledOperationSchema: z.ZodObject<{
733
738
  date: "date";
734
739
  text: "text";
735
740
  timestamptz: "timestamptz";
741
+ jsonb: "jsonb";
736
742
  uuid: "uuid";
737
743
  integer: "integer";
738
744
  numeric: "numeric";
@@ -744,7 +750,7 @@ declare const compiledOperationSchema: z.ZodObject<{
744
750
  read: z.ZodArray<z.ZodString>;
745
751
  maxRows: z.ZodNumber;
746
752
  }, z.core.$strict>>;
747
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
753
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
748
754
  name: z.ZodString;
749
755
  opHash: z.ZodString;
750
756
  kind: z.ZodEnum<{
@@ -1391,7 +1397,7 @@ declare const tableMetaIrSchema: z.ZodObject<{
1391
1397
  }, z.core.$strip>;
1392
1398
  type TableMetaIr = z.infer<typeof tableMetaIrSchema>;
1393
1399
  declare const compiledArtifactSchema: z.ZodObject<{
1394
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1400
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
1395
1401
  namespace: z.ZodString;
1396
1402
  schemaHash: z.ZodString;
1397
1403
  ownSchemaHash: z.ZodOptional<z.ZodString>;
@@ -1553,6 +1559,7 @@ declare const compiledArtifactSchema: z.ZodObject<{
1553
1559
  date: "date";
1554
1560
  text: "text";
1555
1561
  timestamptz: "timestamptz";
1562
+ jsonb: "jsonb";
1556
1563
  uuid: "uuid";
1557
1564
  integer: "integer";
1558
1565
  numeric: "numeric";
@@ -1564,7 +1571,7 @@ declare const compiledArtifactSchema: z.ZodObject<{
1564
1571
  read: z.ZodArray<z.ZodString>;
1565
1572
  maxRows: z.ZodNumber;
1566
1573
  }, z.core.$strict>>;
1567
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1574
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
1568
1575
  name: z.ZodString;
1569
1576
  opHash: z.ZodString;
1570
1577
  kind: z.ZodEnum<{
@@ -2001,4 +2008,4 @@ declare function normalizeIr(raw: unknown): CompiledArtifact;
2001
2008
  /** Index an artifact's operations by opHash (the wire selector). */
2002
2009
  declare function indexByHash(artifact: CompiledArtifact): Map<string, CompiledOperation>;
2003
2010
 
2004
- export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, type CellSelectionIr, type ClaimKey, type CmpOp, type CompiledArtifact, type CompiledOperation, DATE_BUCKETS, type DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, type ExternalPolicyClaimKey, GUARDED_IR_VERSION, type GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, type InputRefKind, IrVersionError, LEGACY_IR_VERSION, type LimitIr, type OrderIr, type PredIr, type PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, type ResolvedMetaIr, type ResolvedSourceIr, type RootIr, SQL_IR_VERSION, type SelectionIr, type TableMetaIr, type ValueIr, type VariableDefaultIr, type VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
2011
+ export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, type CellSelectionIr, type ClaimKey, type CmpOp, type CompiledArtifact, type CompiledOperation, DATE_BUCKETS, type DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, type ExternalPolicyClaimKey, GUARDED_IR_VERSION, type GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, type InputRefKind, IrVersionError, LEGACY_IR_VERSION, type LimitIr, type OrderIr, type PredIr, type PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, type ResolvedMetaIr, type ResolvedSourceIr, type RootIr, SERVICE_PRINCIPAL_IR_VERSION, SQL_IR_VERSION, type SelectionIr, type TableMetaIr, type ValueIr, type VariableDefaultIr, type VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, usesServicePrincipal, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
package/dist/ir.d.ts CHANGED
@@ -24,14 +24,17 @@ export { C as CELLS_FIELD, a as CELL_PARTS, b as CellPart, c as cellColumnName }
24
24
  */
25
25
 
26
26
  /** Maximum supported version; emit the oldest version that preserves semantics. */
27
- declare const IR_VERSION: 5;
27
+ declare const IR_VERSION: 6;
28
28
  declare const LEGACY_IR_VERSION: 1;
29
29
  declare const GUARDED_IR_VERSION: 2;
30
30
  /** Older v2 executors must not strip namespace-scoped authorization. */
31
31
  declare const COMPOSED_IR_VERSION: 3;
32
32
  declare const SQL_IR_VERSION: 4;
33
33
  declare const RUNTIME_SQL_IR_VERSION: 5;
34
- declare const irVersionSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
34
+ declare const SERVICE_PRINCIPAL_IR_VERSION: 6;
35
+ declare const irVersionSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
36
+ /** Every carrier of a service identity predicate must require the new executor. */
37
+ declare function usesServicePrincipal(value: unknown): boolean;
35
38
  /** Keep v1 artifact identity when assembling only legacy operations from registry rows. */
36
39
  declare function requiredArtifactIrVersion(operations: readonly unknown[]): z.infer<typeof irVersionSchema>;
37
40
  /**
@@ -113,6 +116,8 @@ type PredIr = {
113
116
  kind: 'role';
114
117
  key: string;
115
118
  namespace?: string;
119
+ } | {
120
+ kind: 'servicePrincipal';
116
121
  }
117
122
  /** §4f: a client-supplied BoolExp variable lands here, validated + lowered at runtime. */
118
123
  | {
@@ -733,6 +738,7 @@ declare const compiledOperationSchema: z.ZodObject<{
733
738
  date: "date";
734
739
  text: "text";
735
740
  timestamptz: "timestamptz";
741
+ jsonb: "jsonb";
736
742
  uuid: "uuid";
737
743
  integer: "integer";
738
744
  numeric: "numeric";
@@ -744,7 +750,7 @@ declare const compiledOperationSchema: z.ZodObject<{
744
750
  read: z.ZodArray<z.ZodString>;
745
751
  maxRows: z.ZodNumber;
746
752
  }, z.core.$strict>>;
747
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
753
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
748
754
  name: z.ZodString;
749
755
  opHash: z.ZodString;
750
756
  kind: z.ZodEnum<{
@@ -1391,7 +1397,7 @@ declare const tableMetaIrSchema: z.ZodObject<{
1391
1397
  }, z.core.$strip>;
1392
1398
  type TableMetaIr = z.infer<typeof tableMetaIrSchema>;
1393
1399
  declare const compiledArtifactSchema: z.ZodObject<{
1394
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1400
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
1395
1401
  namespace: z.ZodString;
1396
1402
  schemaHash: z.ZodString;
1397
1403
  ownSchemaHash: z.ZodOptional<z.ZodString>;
@@ -1553,6 +1559,7 @@ declare const compiledArtifactSchema: z.ZodObject<{
1553
1559
  date: "date";
1554
1560
  text: "text";
1555
1561
  timestamptz: "timestamptz";
1562
+ jsonb: "jsonb";
1556
1563
  uuid: "uuid";
1557
1564
  integer: "integer";
1558
1565
  numeric: "numeric";
@@ -1564,7 +1571,7 @@ declare const compiledArtifactSchema: z.ZodObject<{
1564
1571
  read: z.ZodArray<z.ZodString>;
1565
1572
  maxRows: z.ZodNumber;
1566
1573
  }, z.core.$strict>>;
1567
- irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1574
+ irVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
1568
1575
  name: z.ZodString;
1569
1576
  opHash: z.ZodString;
1570
1577
  kind: z.ZodEnum<{
@@ -2001,4 +2008,4 @@ declare function normalizeIr(raw: unknown): CompiledArtifact;
2001
2008
  /** Index an artifact's operations by opHash (the wire selector). */
2002
2009
  declare function indexByHash(artifact: CompiledArtifact): Map<string, CompiledOperation>;
2003
2010
 
2004
- export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, type CellSelectionIr, type ClaimKey, type CmpOp, type CompiledArtifact, type CompiledOperation, DATE_BUCKETS, type DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, type ExternalPolicyClaimKey, GUARDED_IR_VERSION, type GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, type InputRefKind, IrVersionError, LEGACY_IR_VERSION, type LimitIr, type OrderIr, type PredIr, type PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, type ResolvedMetaIr, type ResolvedSourceIr, type RootIr, SQL_IR_VERSION, type SelectionIr, type TableMetaIr, type ValueIr, type VariableDefaultIr, type VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
2011
+ export { CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, type CellSelectionIr, type ClaimKey, type CmpOp, type CompiledArtifact, type CompiledOperation, DATE_BUCKETS, type DateBucket, EXTERNAL_POLICY_CLAIM_KEYS, type ExternalPolicyClaimKey, GUARDED_IR_VERSION, type GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, type InputRefKind, IrVersionError, LEGACY_IR_VERSION, type LimitIr, type OrderIr, type PredIr, type PrefetchPlanIr, RUNTIME_SQL_IR_VERSION, type ResolvedMetaIr, type ResolvedSourceIr, type RootIr, SERVICE_PRINCIPAL_IR_VERSION, SQL_IR_VERSION, type SelectionIr, type TableMetaIr, type ValueIr, type VariableDefaultIr, type VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, usesServicePrincipal, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
package/dist/ir.js CHANGED
@@ -1070,14 +1070,21 @@ localDefinitionSchema.safeExtend({
1070
1070
  var BUILTIN_SQL_READ_HASH = "sha256:a50c477c952a5e0fe68ed158a4530e4aab573c09bcbb1a8ac454dc88a39a6258";
1071
1071
 
1072
1072
  // src/ir/index.ts
1073
- var IR_VERSION = 5;
1073
+ var IR_VERSION = 6;
1074
1074
  var LEGACY_IR_VERSION = 1;
1075
1075
  var GUARDED_IR_VERSION = 2;
1076
1076
  var COMPOSED_IR_VERSION = 3;
1077
1077
  var SQL_IR_VERSION = 4;
1078
1078
  var RUNTIME_SQL_IR_VERSION = 5;
1079
- 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)]);
1079
+ var SERVICE_PRINCIPAL_IR_VERSION = 6;
1080
+ 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)]);
1080
1081
  var operationVersionSchema = z.object({ irVersion: irVersionSchema });
1082
+ function usesServicePrincipal(value) {
1083
+ if (value === null || typeof value !== "object") return false;
1084
+ if (Array.isArray(value)) return value.some(usesServicePrincipal);
1085
+ const row = value;
1086
+ return row.kind === "servicePrincipal" || Object.values(row).some(usesServicePrincipal);
1087
+ }
1081
1088
  function requiredArtifactIrVersion(operations) {
1082
1089
  let required = LEGACY_IR_VERSION;
1083
1090
  for (const operation of operations) {
@@ -1137,6 +1144,7 @@ var predIrSchema = z.lazy(
1137
1144
  z.object({ kind: z.literal("capability"), key: z.string(), namespace: z.string().optional() }),
1138
1145
  z.object({ kind: z.literal("role"), key: z.string(), namespace: z.string().optional() }),
1139
1146
  z.object({ kind: z.literal("dynamicFilter"), slot: z.string() }),
1147
+ z.object({ kind: z.literal("servicePrincipal") }).strict(),
1140
1148
  z.object({ kind: z.literal("const"), value: z.boolean() })
1141
1149
  ])
1142
1150
  );
@@ -1362,7 +1370,7 @@ var variableIrSchema = z.object({
1362
1370
  /** Absent = no default declared; see {@link variableDefaultIrSchema}. */
1363
1371
  defaultValue: variableDefaultIrSchema.optional()
1364
1372
  });
1365
- var sqlColumnSchema = z.object({ name: z.string(), type: z.enum(["text", "boolean", "integer", "bigint", "numeric", "double", "uuid", "date", "timestamptz"]), nullable: z.boolean() });
1373
+ var sqlColumnSchema = z.object({ name: z.string(), type: z.enum(["text", "boolean", "integer", "bigint", "numeric", "double", "uuid", "date", "timestamptz", "jsonb"]), nullable: z.boolean() });
1366
1374
  var compiledOperationSchema = z.object({
1367
1375
  language: z.literal("sql").optional(),
1368
1376
  /** Server-compiled object catalog and permission ceiling, never caller SQL. */
@@ -1400,6 +1408,9 @@ var compiledOperationSchema = z.object({
1400
1408
  tableSet: z.array(z.string()).min(1),
1401
1409
  roots: z.array(rootIrSchema)
1402
1410
  }).superRefine((operation, ctx) => {
1411
+ if (operation.irVersion < SERVICE_PRINCIPAL_IR_VERSION && usesServicePrincipal(operation.roots)) {
1412
+ ctx.addIssue({ code: "custom", message: "servicePrincipal() requires IR v6" });
1413
+ }
1403
1414
  if (operation.language === "sql") {
1404
1415
  const validPlan = operation.sqlQuery ? !operation.sql && operation.irVersion === RUNTIME_SQL_IR_VERSION : !!operation.sql && operation.irVersion === SQL_IR_VERSION;
1405
1416
  const builtin = operation.name === "BuiltinSqlRead" && operation.opHash === BUILTIN_SQL_READ_HASH && operation.requires === null;
@@ -1532,6 +1543,9 @@ var compiledArtifactSchema = z.object({
1532
1543
  tables: z.record(z.string(), tableMetaIrSchema),
1533
1544
  operations: z.record(z.string(), compiledOperationSchema)
1534
1545
  }).superRefine((artifact, ctx) => {
1546
+ if (artifact.irVersion < SERVICE_PRINCIPAL_IR_VERSION && usesServicePrincipal(artifact)) {
1547
+ ctx.addIssue({ code: "custom", message: "servicePrincipal() requires IR v6" });
1548
+ }
1535
1549
  if (Object.keys(artifact.dependencies ?? {}).length > 0 && artifact.irVersion < COMPOSED_IR_VERSION) {
1536
1550
  ctx.addIssue({ code: "custom", path: ["irVersion"], message: "cross-namespace dependencies require IR v3" });
1537
1551
  }
@@ -1559,6 +1573,6 @@ function indexByHash(artifact) {
1559
1573
  return map;
1560
1574
  }
1561
1575
 
1562
- export { CELLS_FIELD, CELL_PARTS, CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, DATE_BUCKETS, EXTERNAL_POLICY_CLAIM_KEYS, GUARDED_IR_VERSION, INPUT_REF_KINDS, IR_VERSION, IrVersionError, LEGACY_IR_VERSION, RUNTIME_SQL_IR_VERSION, SQL_IR_VERSION, cellColumnName, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
1576
+ export { CELLS_FIELD, CELL_PARTS, CLAIMS_CONTRACT, CMP_OPS, COMPOSED_IR_VERSION, DATE_BUCKETS, EXTERNAL_POLICY_CLAIM_KEYS, GUARDED_IR_VERSION, INPUT_REF_KINDS, IR_VERSION, IrVersionError, LEGACY_IR_VERSION, RUNTIME_SQL_IR_VERSION, SERVICE_PRINCIPAL_IR_VERSION, SQL_IR_VERSION, cellColumnName, compiledArtifactSchema, compiledOperationSchema, indexByHash, isExternalPolicyClaimKey, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, prefetchPlanIrSchema, requiredArtifactIrVersion, resolvedMetaIrSchema, resolvedSourceIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, usesServicePrincipal, valueIrSchema, variableDefaultIrSchema, variableIrSchema };
1563
1577
  //# sourceMappingURL=ir.js.map
1564
1578
  //# sourceMappingURL=ir.js.map