@sequenceholdings/orm 2.3.0 → 2.5.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 (59) hide show
  1. package/dist/authoring.cjs +53 -7
  2. package/dist/authoring.cjs.map +1 -1
  3. package/dist/authoring.d.cts +11 -7
  4. package/dist/authoring.d.ts +11 -7
  5. package/dist/authoring.js +53 -7
  6. package/dist/authoring.js.map +1 -1
  7. package/dist/canonical.cjs +48 -2
  8. package/dist/canonical.cjs.map +1 -1
  9. package/dist/canonical.d.cts +72 -72
  10. package/dist/canonical.d.ts +72 -72
  11. package/dist/canonical.js +48 -2
  12. package/dist/canonical.js.map +1 -1
  13. package/dist/cli.cjs +337 -86
  14. package/dist/cli.cjs.map +1 -1
  15. package/dist/cli.js +337 -86
  16. package/dist/cli.js.map +1 -1
  17. package/dist/client.cjs +1 -1
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.d.cts +1 -1
  20. package/dist/client.d.ts +1 -1
  21. package/dist/client.js +1 -1
  22. package/dist/client.js.map +1 -1
  23. package/dist/compiler.cjs +493 -52
  24. package/dist/compiler.cjs.map +1 -1
  25. package/dist/compiler.d.cts +22 -7
  26. package/dist/compiler.d.ts +22 -7
  27. package/dist/compiler.js +493 -53
  28. package/dist/compiler.js.map +1 -1
  29. package/dist/{constants-C6EG6Wq7.d.cts → constants-Dou1RkTo.d.cts} +7 -2
  30. package/dist/{constants-C6EG6Wq7.d.ts → constants-Dou1RkTo.d.ts} +7 -2
  31. package/dist/dynamic-input.d.cts +1 -1
  32. package/dist/dynamic-input.d.ts +1 -1
  33. package/dist/index.cjs +329 -130
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +66 -58
  36. package/dist/index.d.ts +66 -58
  37. package/dist/index.js +329 -131
  38. package/dist/index.js.map +1 -1
  39. package/dist/ir.cjs +50 -3
  40. package/dist/ir.cjs.map +1 -1
  41. package/dist/ir.d.cts +71 -71
  42. package/dist/ir.d.ts +71 -71
  43. package/dist/ir.js +50 -3
  44. package/dist/ir.js.map +1 -1
  45. package/dist/predicate-v2.cjs +145 -22
  46. package/dist/predicate-v2.cjs.map +1 -1
  47. package/dist/predicate-v2.d.cts +41 -4
  48. package/dist/predicate-v2.d.ts +41 -4
  49. package/dist/predicate-v2.js +145 -22
  50. package/dist/predicate-v2.js.map +1 -1
  51. package/dist/sdl.cjs +53 -3
  52. package/dist/sdl.cjs.map +1 -1
  53. package/dist/sdl.d.cts +3 -1
  54. package/dist/sdl.d.ts +3 -1
  55. package/dist/sdl.js +53 -3
  56. package/dist/sdl.js.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/{definition-DjfC7Lll.d.cts → definition-B99BsOAO.d.cts} +4 -4
  59. package/dist/{definition-DjfC7Lll.d.ts → definition-B99BsOAO.d.ts} +4 -4
@@ -2,11 +2,11 @@ import { CanonicalEnum, CanonicalDefinition } from './canonical.cjs';
2
2
  import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation, CompiledArtifact, VariableIr, OrderIr, SelectionIr } from './ir.cjs';
3
3
  import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode, GraphQLSchema, ValueNode, SelectionSetNode } from 'graphql';
4
4
  export { DynamicInputIssue, DynamicInputResult, NormalizedBoolExp, NormalizedOnConflict, NormalizedOrderBy, NormalizedRow, ORDER_BY_DIRECTIONS, ScalarKind, allowedBoolExpOperators, allowedOps, validateAppendInput, validateBoolExpInput, validateInsertInput, validateOnConflictInput, validateOrderByInput, validateSelectColumns, validateSetInput } from './dynamic-input.cjs';
5
- export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.cjs';
5
+ export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyAccess, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.cjs';
6
6
  import { z } from 'zod';
7
7
  export { P as PLATFORM_USER_TYPENAME, c as camelCase, g as enumTypeName, p as pascalCase } from './naming-CU9ThP_E.cjs';
8
- export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.cjs';
9
- import './constants-C6EG6Wq7.cjs';
8
+ export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-B99BsOAO.cjs';
9
+ import './constants-Dou1RkTo.cjs';
10
10
  import './policy-1iZbGnZZ.cjs';
11
11
 
12
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -50,9 +50,11 @@ declare class NamespaceCompileError extends Error {
50
50
  * - document-authored relationship predicates (exists/aggPredicate) get the
51
51
  * TARGET table's read policy injected too, so filtering through a link
52
52
  * can't become an existence oracle on rows the caller can't read;
53
- * - write policy AND-ed into update/delete row filters, and set as the
54
- * insert check for inserts (claims + inserted-values only in v2.0 — an
55
- * exists() write policy makes a table un-insertable, loudly);
53
+ * - write policy AND-ed into update/delete row filters, set as the insert
54
+ * check for inserts, and re-checked against the NEW rows of every update.
55
+ * Link-traversing (exists/visible) write policies are evaluated by the data
56
+ * plane against the proposed rows in the same statement, so "only on a
57
+ * parent the caller can see" holds for inserts and FK-changing updates;
56
58
  * - `col = claim(k)` AND-conjuncts of the write policy become pinned columns
57
59
  * merged into every inserted row (and excluded from insertable/settable).
58
60
  */
@@ -316,6 +318,8 @@ interface RestrictedOperation {
316
318
  name: string;
317
319
  kind: 'query' | 'mutation';
318
320
  requires: CompiledOperation['requires'];
321
+ /** Literal namespace-author ceiling; never taken from execution variables. */
322
+ readBudget?: number;
319
323
  variables: VariableIr[];
320
324
  definition: OperationDefinitionNode;
321
325
  }
@@ -337,6 +341,7 @@ declare const MAX_LIMIT = 1000;
337
341
  declare class OperationLowerer {
338
342
  private readonly ctx;
339
343
  private readonly variables;
344
+ private readonly maxRows;
340
345
  constructor(ctx: CompileContext, restricted: RestrictedOperation);
341
346
  private meta;
342
347
  /** A data column — cell-metadata columns are reachable only through `cells { … }`. */
@@ -493,4 +498,14 @@ declare const DATASET_PREVIEW_LIMIT = 100;
493
498
  */
494
499
  declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
495
500
 
496
- export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, DATASET_PREVIEW_LIMIT, DEFAULT_LIMIT, type DiagnosticSeverity, DocumentCompileError, MAX_LIMIT, type MutationOp, type MutationRootInfo, NamespaceCompileError, OperationLowerer, PLATFORM_USER_TABLE, type ParseDocumentsResult, type ParsedDocument, type PinnedColumn, type QueryRootInfo, type RestrictedOperation, type SourceDocument, type SqlQueryInput, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, sqlQueryInputSchema, typeNameForTable, walkPred };
501
+ /**
502
+ * PostgreSQL omits pinned builtins from pg_depend, so catalog checks cannot
503
+ * enforce the function boundary alone. Parse every expression before either
504
+ * admission or DDL, including nested queries and aggregate/window clauses.
505
+ * Catalog validation remains responsible for resolved functions/operators.
506
+ */
507
+ declare function validateManagedViewQueries({ canonical }: {
508
+ canonical: CanonicalDefinition;
509
+ }): Promise<void>;
510
+
511
+ export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, DATASET_PREVIEW_LIMIT, DEFAULT_LIMIT, type DiagnosticSeverity, DocumentCompileError, MAX_LIMIT, type MutationOp, type MutationRootInfo, NamespaceCompileError, OperationLowerer, PLATFORM_USER_TABLE, type ParseDocumentsResult, type ParsedDocument, type PinnedColumn, type QueryRootInfo, type RestrictedOperation, type SourceDocument, type SqlQueryInput, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, sqlQueryInputSchema, typeNameForTable, validateManagedViewQueries, walkPred };
@@ -2,11 +2,11 @@ import { CanonicalEnum, CanonicalDefinition } from './canonical.js';
2
2
  import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation, CompiledArtifact, VariableIr, OrderIr, SelectionIr } from './ir.js';
3
3
  import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode, GraphQLSchema, ValueNode, SelectionSetNode } from 'graphql';
4
4
  export { DynamicInputIssue, DynamicInputResult, NormalizedBoolExp, NormalizedOnConflict, NormalizedOrderBy, NormalizedRow, ORDER_BY_DIRECTIONS, ScalarKind, allowedBoolExpOperators, allowedOps, validateAppendInput, validateBoolExpInput, validateInsertInput, validateOnConflictInput, validateOrderByInput, validateSelectColumns, validateSetInput } from './dynamic-input.js';
5
- export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.js';
5
+ export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyAccess, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.js';
6
6
  import { z } from 'zod';
7
7
  export { P as PLATFORM_USER_TYPENAME, c as camelCase, g as enumTypeName, p as pascalCase } from './naming-CPfx7EfF.js';
8
- export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.js';
9
- import './constants-C6EG6Wq7.js';
8
+ export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-B99BsOAO.js';
9
+ import './constants-Dou1RkTo.js';
10
10
  import './policy-1iZbGnZZ.js';
11
11
 
12
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -50,9 +50,11 @@ declare class NamespaceCompileError extends Error {
50
50
  * - document-authored relationship predicates (exists/aggPredicate) get the
51
51
  * TARGET table's read policy injected too, so filtering through a link
52
52
  * can't become an existence oracle on rows the caller can't read;
53
- * - write policy AND-ed into update/delete row filters, and set as the
54
- * insert check for inserts (claims + inserted-values only in v2.0 — an
55
- * exists() write policy makes a table un-insertable, loudly);
53
+ * - write policy AND-ed into update/delete row filters, set as the insert
54
+ * check for inserts, and re-checked against the NEW rows of every update.
55
+ * Link-traversing (exists/visible) write policies are evaluated by the data
56
+ * plane against the proposed rows in the same statement, so "only on a
57
+ * parent the caller can see" holds for inserts and FK-changing updates;
56
58
  * - `col = claim(k)` AND-conjuncts of the write policy become pinned columns
57
59
  * merged into every inserted row (and excluded from insertable/settable).
58
60
  */
@@ -316,6 +318,8 @@ interface RestrictedOperation {
316
318
  name: string;
317
319
  kind: 'query' | 'mutation';
318
320
  requires: CompiledOperation['requires'];
321
+ /** Literal namespace-author ceiling; never taken from execution variables. */
322
+ readBudget?: number;
319
323
  variables: VariableIr[];
320
324
  definition: OperationDefinitionNode;
321
325
  }
@@ -337,6 +341,7 @@ declare const MAX_LIMIT = 1000;
337
341
  declare class OperationLowerer {
338
342
  private readonly ctx;
339
343
  private readonly variables;
344
+ private readonly maxRows;
340
345
  constructor(ctx: CompileContext, restricted: RestrictedOperation);
341
346
  private meta;
342
347
  /** A data column — cell-metadata columns are reachable only through `cells { … }`. */
@@ -493,4 +498,14 @@ declare const DATASET_PREVIEW_LIMIT = 100;
493
498
  */
494
499
  declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
495
500
 
496
- export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, DATASET_PREVIEW_LIMIT, DEFAULT_LIMIT, type DiagnosticSeverity, DocumentCompileError, MAX_LIMIT, type MutationOp, type MutationRootInfo, NamespaceCompileError, OperationLowerer, PLATFORM_USER_TABLE, type ParseDocumentsResult, type ParsedDocument, type PinnedColumn, type QueryRootInfo, type RestrictedOperation, type SourceDocument, type SqlQueryInput, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, sqlQueryInputSchema, typeNameForTable, walkPred };
501
+ /**
502
+ * PostgreSQL omits pinned builtins from pg_depend, so catalog checks cannot
503
+ * enforce the function boundary alone. Parse every expression before either
504
+ * admission or DDL, including nested queries and aggregate/window clauses.
505
+ * Catalog validation remains responsible for resolved functions/operators.
506
+ */
507
+ declare function validateManagedViewQueries({ canonical }: {
508
+ canonical: CanonicalDefinition;
509
+ }): Promise<void>;
510
+
511
+ export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, DATASET_PREVIEW_LIMIT, DEFAULT_LIMIT, type DiagnosticSeverity, DocumentCompileError, MAX_LIMIT, type MutationOp, type MutationRootInfo, NamespaceCompileError, OperationLowerer, PLATFORM_USER_TABLE, type ParseDocumentsResult, type ParsedDocument, type PinnedColumn, type QueryRootInfo, type RestrictedOperation, type SourceDocument, type SqlQueryInput, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, sqlQueryInputSchema, typeNameForTable, validateManagedViewQueries, walkPred };