@sequenceholdings/orm 2.4.0 → 2.6.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 (58) hide show
  1. package/README.md +23 -0
  2. package/dist/authoring.cjs +53 -7
  3. package/dist/authoring.cjs.map +1 -1
  4. package/dist/authoring.d.cts +10 -6
  5. package/dist/authoring.d.ts +10 -6
  6. package/dist/authoring.js +53 -7
  7. package/dist/authoring.js.map +1 -1
  8. package/dist/canonical.cjs +48 -2
  9. package/dist/canonical.cjs.map +1 -1
  10. package/dist/canonical.d.cts +1 -1
  11. package/dist/canonical.d.ts +1 -1
  12. package/dist/canonical.js +48 -2
  13. package/dist/canonical.js.map +1 -1
  14. package/dist/cli.cjs +260 -31
  15. package/dist/cli.cjs.map +1 -1
  16. package/dist/cli.js +260 -31
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client.cjs +11 -6
  19. package/dist/client.cjs.map +1 -1
  20. package/dist/client.d.cts +38 -31
  21. package/dist/client.d.ts +38 -31
  22. package/dist/client.js +11 -7
  23. package/dist/client.js.map +1 -1
  24. package/dist/compiler.cjs +513 -23
  25. package/dist/compiler.cjs.map +1 -1
  26. package/dist/compiler.d.cts +39 -3
  27. package/dist/compiler.d.ts +39 -3
  28. package/dist/compiler.js +510 -24
  29. package/dist/compiler.js.map +1 -1
  30. package/dist/{constants-C6EG6Wq7.d.cts → constants-Dou1RkTo.d.cts} +7 -2
  31. package/dist/{constants-C6EG6Wq7.d.ts → constants-Dou1RkTo.d.ts} +7 -2
  32. package/dist/dynamic-input.d.cts +1 -1
  33. package/dist/dynamic-input.d.ts +1 -1
  34. package/dist/index.cjs +461 -140
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +34 -4
  37. package/dist/index.d.ts +34 -4
  38. package/dist/index.js +460 -141
  39. package/dist/index.js.map +1 -1
  40. package/dist/ir.cjs +55 -4
  41. package/dist/ir.cjs.map +1 -1
  42. package/dist/ir.d.cts +1 -1
  43. package/dist/ir.d.ts +1 -1
  44. package/dist/ir.js +55 -4
  45. package/dist/ir.js.map +1 -1
  46. package/dist/predicate-v2.cjs +55 -4
  47. package/dist/predicate-v2.cjs.map +1 -1
  48. package/dist/predicate-v2.d.cts +1 -1
  49. package/dist/predicate-v2.d.ts +1 -1
  50. package/dist/predicate-v2.js +55 -4
  51. package/dist/predicate-v2.js.map +1 -1
  52. package/dist/sdl.cjs +60 -4
  53. package/dist/sdl.cjs.map +1 -1
  54. package/dist/sdl.d.cts +3 -1
  55. package/dist/sdl.d.ts +3 -1
  56. package/dist/sdl.js +60 -4
  57. package/dist/sdl.js.map +1 -1
  58. package/package.json +1 -1
@@ -6,7 +6,7 @@ export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_M
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
8
  export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.cjs';
9
- import './constants-C6EG6Wq7.cjs';
9
+ import './constants-Dou1RkTo.cjs';
10
10
  import './policy-1iZbGnZZ.cjs';
11
11
 
12
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -318,6 +318,8 @@ interface RestrictedOperation {
318
318
  name: string;
319
319
  kind: 'query' | 'mutation';
320
320
  requires: CompiledOperation['requires'];
321
+ /** Literal namespace-author ceiling; never taken from execution variables. */
322
+ readBudget?: number;
321
323
  variables: VariableIr[];
322
324
  definition: OperationDefinitionNode;
323
325
  }
@@ -339,6 +341,7 @@ declare const MAX_LIMIT = 1000;
339
341
  declare class OperationLowerer {
340
342
  private readonly ctx;
341
343
  private readonly variables;
344
+ private readonly maxRows;
342
345
  constructor(ctx: CompileContext, restricted: RestrictedOperation);
343
346
  private meta;
344
347
  /** A data column — cell-metadata columns are reachable only through `cells { … }`. */
@@ -481,11 +484,34 @@ declare const sqlQueryInputSchema: z.ZodObject<{
481
484
  }, z.core.$strict>;
482
485
  type SqlQueryInput = z.infer<typeof sqlQueryInputSchema>;
483
486
  /** The returned plan contains no bound parameter values or caller identity. */
484
- declare function compileRuntimeSql({ operation, input }: {
487
+ declare function compileRuntimeSql({ operation, input, qualified }: {
485
488
  operation: CompiledOperation;
486
489
  input: SqlQueryInput;
490
+ qualified?: boolean;
487
491
  }): Promise<CompiledOperation>;
488
492
 
493
+ /** Discover identities from parsed syntax only; the closed compiler validates
494
+ * every clause before execution. Unqualified names may be CTEs, never objects. */
495
+ declare function referencedSqlObjects({ sql }: {
496
+ sql: string;
497
+ }): Promise<string[]>;
498
+
499
+ /** Replace named binds only in SQL code, never strings, identifiers, or comments. */
500
+ declare function bindNamedParameters({ sql, names }: {
501
+ sql: string;
502
+ names: string[];
503
+ }): string;
504
+
505
+ /** Compose SQL metadata by qualified identity. GraphQL's bare-name composition
506
+ * is deliberately not used across unrelated namespace catalogs. */
507
+ declare function compileBuiltinSqlArtifact({ namespace, definitions, read, unbackedObjects, executionTarget }: {
508
+ namespace: string;
509
+ definitions: readonly CanonicalDefinition[];
510
+ read: readonly string[];
511
+ unbackedObjects?: readonly string[];
512
+ executionTarget?: string;
513
+ }): CompiledArtifact;
514
+
489
515
  declare const DATASET_PREVIEW_LIMIT = 100;
490
516
  /**
491
517
  * Fixed runtime-owned reads, separate from the published operation manifest.
@@ -495,4 +521,14 @@ declare const DATASET_PREVIEW_LIMIT = 100;
495
521
  */
496
522
  declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
497
523
 
498
- 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 };
524
+ /**
525
+ * PostgreSQL omits pinned builtins from pg_depend, so catalog checks cannot
526
+ * enforce the function boundary alone. Parse every expression before either
527
+ * admission or DDL, including nested queries and aggregate/window clauses.
528
+ * Catalog validation remains responsible for resolved functions/operators.
529
+ */
530
+ declare function validateManagedViewQueries({ canonical }: {
531
+ canonical: CanonicalDefinition;
532
+ }): Promise<void>;
533
+
534
+ 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, bindNamedParameters, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileBuiltinSqlArtifact, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, referencedSqlObjects, restrictOperation, sqlQueryInputSchema, typeNameForTable, validateManagedViewQueries, walkPred };
@@ -6,7 +6,7 @@ export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_M
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
8
  export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.js';
9
- import './constants-C6EG6Wq7.js';
9
+ import './constants-Dou1RkTo.js';
10
10
  import './policy-1iZbGnZZ.js';
11
11
 
12
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -318,6 +318,8 @@ interface RestrictedOperation {
318
318
  name: string;
319
319
  kind: 'query' | 'mutation';
320
320
  requires: CompiledOperation['requires'];
321
+ /** Literal namespace-author ceiling; never taken from execution variables. */
322
+ readBudget?: number;
321
323
  variables: VariableIr[];
322
324
  definition: OperationDefinitionNode;
323
325
  }
@@ -339,6 +341,7 @@ declare const MAX_LIMIT = 1000;
339
341
  declare class OperationLowerer {
340
342
  private readonly ctx;
341
343
  private readonly variables;
344
+ private readonly maxRows;
342
345
  constructor(ctx: CompileContext, restricted: RestrictedOperation);
343
346
  private meta;
344
347
  /** A data column — cell-metadata columns are reachable only through `cells { … }`. */
@@ -481,11 +484,34 @@ declare const sqlQueryInputSchema: z.ZodObject<{
481
484
  }, z.core.$strict>;
482
485
  type SqlQueryInput = z.infer<typeof sqlQueryInputSchema>;
483
486
  /** The returned plan contains no bound parameter values or caller identity. */
484
- declare function compileRuntimeSql({ operation, input }: {
487
+ declare function compileRuntimeSql({ operation, input, qualified }: {
485
488
  operation: CompiledOperation;
486
489
  input: SqlQueryInput;
490
+ qualified?: boolean;
487
491
  }): Promise<CompiledOperation>;
488
492
 
493
+ /** Discover identities from parsed syntax only; the closed compiler validates
494
+ * every clause before execution. Unqualified names may be CTEs, never objects. */
495
+ declare function referencedSqlObjects({ sql }: {
496
+ sql: string;
497
+ }): Promise<string[]>;
498
+
499
+ /** Replace named binds only in SQL code, never strings, identifiers, or comments. */
500
+ declare function bindNamedParameters({ sql, names }: {
501
+ sql: string;
502
+ names: string[];
503
+ }): string;
504
+
505
+ /** Compose SQL metadata by qualified identity. GraphQL's bare-name composition
506
+ * is deliberately not used across unrelated namespace catalogs. */
507
+ declare function compileBuiltinSqlArtifact({ namespace, definitions, read, unbackedObjects, executionTarget }: {
508
+ namespace: string;
509
+ definitions: readonly CanonicalDefinition[];
510
+ read: readonly string[];
511
+ unbackedObjects?: readonly string[];
512
+ executionTarget?: string;
513
+ }): CompiledArtifact;
514
+
489
515
  declare const DATASET_PREVIEW_LIMIT = 100;
490
516
  /**
491
517
  * Fixed runtime-owned reads, separate from the published operation manifest.
@@ -495,4 +521,14 @@ declare const DATASET_PREVIEW_LIMIT = 100;
495
521
  */
496
522
  declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
497
523
 
498
- 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 };
524
+ /**
525
+ * PostgreSQL omits pinned builtins from pg_depend, so catalog checks cannot
526
+ * enforce the function boundary alone. Parse every expression before either
527
+ * admission or DDL, including nested queries and aggregate/window clauses.
528
+ * Catalog validation remains responsible for resolved functions/operators.
529
+ */
530
+ declare function validateManagedViewQueries({ canonical }: {
531
+ canonical: CanonicalDefinition;
532
+ }): Promise<void>;
533
+
534
+ 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, bindNamedParameters, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileBuiltinSqlArtifact, compileDatasetPreviews, compileNamespace, compileNamespaceOrThrow, compileOperationDocuments, compileRuntimeSql, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, isSqlOperationDocument, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, referencedSqlObjects, restrictOperation, sqlQueryInputSchema, typeNameForTable, validateManagedViewQueries, walkPred };