@sequenceholdings/orm 2.1.1 → 2.3.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 (68) hide show
  1. package/README.md +3 -1
  2. package/dist/authoring.cjs +284 -99
  3. package/dist/authoring.cjs.map +1 -1
  4. package/dist/authoring.d.cts +31 -8
  5. package/dist/authoring.d.ts +31 -8
  6. package/dist/authoring.js +282 -100
  7. package/dist/authoring.js.map +1 -1
  8. package/dist/canonical.cjs +51 -3
  9. package/dist/canonical.cjs.map +1 -1
  10. package/dist/canonical.d.cts +838 -12
  11. package/dist/canonical.d.ts +838 -12
  12. package/dist/canonical.js +47 -4
  13. package/dist/canonical.js.map +1 -1
  14. package/dist/cli.cjs +5876 -4198
  15. package/dist/cli.cjs.map +1 -1
  16. package/dist/cli.js +5876 -4198
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client.cjs +49 -32
  19. package/dist/client.cjs.map +1 -1
  20. package/dist/client.d.cts +49 -6
  21. package/dist/client.d.ts +49 -6
  22. package/dist/client.js +49 -32
  23. package/dist/client.js.map +1 -1
  24. package/dist/compiler.cjs +1275 -264
  25. package/dist/compiler.cjs.map +1 -1
  26. package/dist/compiler.d.cts +57 -3
  27. package/dist/compiler.d.ts +57 -3
  28. package/dist/compiler.js +1268 -265
  29. package/dist/compiler.js.map +1 -1
  30. package/dist/{constants-YoFGjIBM.d.cts → constants-C6EG6Wq7.d.cts} +1 -1
  31. package/dist/{constants-YoFGjIBM.d.ts → constants-C6EG6Wq7.d.ts} +1 -1
  32. package/dist/definition-DjfC7Lll.d.cts +91 -0
  33. package/dist/definition-DjfC7Lll.d.ts +91 -0
  34. package/dist/dynamic-input.cjs +2 -1
  35. package/dist/dynamic-input.cjs.map +1 -1
  36. package/dist/dynamic-input.d.cts +9 -2
  37. package/dist/dynamic-input.d.ts +9 -2
  38. package/dist/dynamic-input.js +2 -1
  39. package/dist/dynamic-input.js.map +1 -1
  40. package/dist/index.cjs +1103 -322
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +479 -19
  43. package/dist/index.d.ts +479 -19
  44. package/dist/index.js +1090 -323
  45. package/dist/index.js.map +1 -1
  46. package/dist/ir.cjs +93 -11
  47. package/dist/ir.cjs.map +1 -1
  48. package/dist/ir.d.cts +226 -15
  49. package/dist/ir.d.ts +226 -15
  50. package/dist/ir.js +88 -12
  51. package/dist/ir.js.map +1 -1
  52. package/dist/predicate-v2.cjs +116 -10
  53. package/dist/predicate-v2.cjs.map +1 -1
  54. package/dist/predicate-v2.d.cts +11 -3
  55. package/dist/predicate-v2.d.ts +11 -3
  56. package/dist/predicate-v2.js +116 -10
  57. package/dist/predicate-v2.js.map +1 -1
  58. package/dist/sdl.cjs +158 -22
  59. package/dist/sdl.cjs.map +1 -1
  60. package/dist/sdl.d.cts +8 -1
  61. package/dist/sdl.d.ts +8 -1
  62. package/dist/sdl.js +158 -22
  63. package/dist/sdl.js.map +1 -1
  64. package/package.json +5 -4
  65. package/src/codegen-gql/server-fns.cjs +2 -2
  66. package/templates/orm-namespace/AGENTS.md +10 -0
  67. package/templates/orm-namespace/CLAUDE.md +1 -84
  68. package/templates/orm-namespace/package.json +1 -1
@@ -3,9 +3,10 @@ import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation,
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
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';
6
+ import { z } from 'zod';
6
7
  export { P as PLATFORM_USER_TYPENAME, c as camelCase, g as enumTypeName, p as pascalCase } from './naming-CU9ThP_E.cjs';
7
- import 'zod';
8
- import './constants-YoFGjIBM.cjs';
8
+ export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.cjs';
9
+ import './constants-C6EG6Wq7.cjs';
9
10
  import './policy-1iZbGnZZ.cjs';
10
11
 
11
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -168,6 +169,7 @@ interface ResolvedMutationRootInfo {
168
169
  type MutationRootInfo = CrudMutationRootInfo | CowMutationRootInfo | ResolvedMutationRootInfo;
169
170
  interface CompileContext {
170
171
  namespace: string;
172
+ composed: boolean;
171
173
  tables: Record<string, TableMetaIr>;
172
174
  /** GraphQL object type name → table name. */
173
175
  tableByTypename: Map<string, string>;
@@ -439,4 +441,56 @@ declare function predContainsExists(pred: PredIr): boolean;
439
441
  /** Structural containment: does `haystack` carry `needle` as a subtree? */
440
442
  declare function predContains(haystack: PredIr, needle: PredIr): boolean;
441
443
 
442
- export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, 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, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileNamespace, compileNamespaceOrThrow, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, typeNameForTable, walkPred };
444
+ declare function isSqlOperationDocument(path: string, contents?: string): boolean;
445
+ /** Additive language dispatch. GraphQL still uses its original compiler/hash. */
446
+ declare function compileOperationDocuments(input: CompileNamespaceInput): Promise<CompileNamespaceResult>;
447
+
448
+ /** This is deliberately not an arbitrary JSON variable: types and size are bounded. */
449
+ declare const sqlQueryInputSchema: z.ZodObject<{
450
+ sql: z.ZodString;
451
+ parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
452
+ type: z.ZodLiteral<"text">;
453
+ value: z.ZodNullable<z.ZodString>;
454
+ }, z.core.$strict>, z.ZodObject<{
455
+ type: z.ZodLiteral<"uuid">;
456
+ value: z.ZodNullable<z.ZodGUID>;
457
+ }, z.core.$strict>, z.ZodObject<{
458
+ type: z.ZodLiteral<"date">;
459
+ value: z.ZodNullable<z.ZodString>;
460
+ }, z.core.$strict>, z.ZodObject<{
461
+ type: z.ZodLiteral<"timestamptz">;
462
+ value: z.ZodNullable<z.ZodString>;
463
+ }, z.core.$strict>, z.ZodObject<{
464
+ type: z.ZodLiteral<"numeric">;
465
+ value: z.ZodNullable<z.ZodString>;
466
+ }, z.core.$strict>, z.ZodObject<{
467
+ type: z.ZodLiteral<"bigint">;
468
+ value: z.ZodNullable<z.ZodString>;
469
+ }, z.core.$strict>, z.ZodObject<{
470
+ type: z.ZodLiteral<"integer">;
471
+ value: z.ZodNullable<z.ZodNumber>;
472
+ }, z.core.$strict>, z.ZodObject<{
473
+ type: z.ZodLiteral<"double">;
474
+ value: z.ZodNullable<z.ZodNumber>;
475
+ }, z.core.$strict>, z.ZodObject<{
476
+ type: z.ZodLiteral<"boolean">;
477
+ value: z.ZodNullable<z.ZodBoolean>;
478
+ }, z.core.$strict>], "type">>>;
479
+ }, z.core.$strict>;
480
+ type SqlQueryInput = z.infer<typeof sqlQueryInputSchema>;
481
+ /** The returned plan contains no bound parameter values or caller identity. */
482
+ declare function compileRuntimeSql({ operation, input }: {
483
+ operation: CompiledOperation;
484
+ input: SqlQueryInput;
485
+ }): Promise<CompiledOperation>;
486
+
487
+ declare const DATASET_PREVIEW_LIMIT = 100;
488
+ /**
489
+ * Fixed runtime-owned reads, separate from the published operation manifest.
490
+ * Use logical column identities directly (no GraphQL naming conversion) and
491
+ * the normal compiler context/policy pass. Like generated GraphQL, internal
492
+ * source tables, raw synced backings, and cell metadata are not exposed.
493
+ */
494
+ declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
495
+
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 };
@@ -3,9 +3,10 @@ import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation,
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
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';
6
+ import { z } from 'zod';
6
7
  export { P as PLATFORM_USER_TYPENAME, c as camelCase, g as enumTypeName, p as pascalCase } from './naming-CPfx7EfF.js';
7
- import 'zod';
8
- import './constants-YoFGjIBM.js';
8
+ export { S as SqlOperationDefinition, d as defineOperation, s as sqlOperationDefinitionSchema } from './definition-DjfC7Lll.js';
9
+ import './constants-C6EG6Wq7.js';
9
10
  import './policy-1iZbGnZZ.js';
10
11
 
11
12
  type DiagnosticSeverity = 'error' | 'warning';
@@ -168,6 +169,7 @@ interface ResolvedMutationRootInfo {
168
169
  type MutationRootInfo = CrudMutationRootInfo | CowMutationRootInfo | ResolvedMutationRootInfo;
169
170
  interface CompileContext {
170
171
  namespace: string;
172
+ composed: boolean;
171
173
  tables: Record<string, TableMetaIr>;
172
174
  /** GraphQL object type name → table name. */
173
175
  tableByTypename: Map<string, string>;
@@ -439,4 +441,56 @@ declare function predContainsExists(pred: PredIr): boolean;
439
441
  /** Structural containment: does `haystack` carry `needle` as a subtree? */
440
442
  declare function predContains(haystack: PredIr, needle: PredIr): boolean;
441
443
 
442
- export { type BuildContextResult, COMPILER_MAJOR, CONST_TRUE, type ClientManifest, type ClientManifestOperation, type CompileContext, type CompileNamespaceInput, type CompileNamespaceResult, type CompilerDiagnostic, 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, andPred, buildCompileContext, canonicalOperationText, classifyInputType, collectPinnedColumns, compileNamespace, compileNamespaceOrThrow, computeOpHash, computeOpsHash, computePinnedColumnsByTable, computeSchemaHash, flattenOperation, injectPolicies, inputTypeName, lowerOperation, mutationRootNames, parseDocuments, parseSdl, platformUserMeta, predContains, predContainsExists, queryRootNames, restrictOperation, typeNameForTable, walkPred };
444
+ declare function isSqlOperationDocument(path: string, contents?: string): boolean;
445
+ /** Additive language dispatch. GraphQL still uses its original compiler/hash. */
446
+ declare function compileOperationDocuments(input: CompileNamespaceInput): Promise<CompileNamespaceResult>;
447
+
448
+ /** This is deliberately not an arbitrary JSON variable: types and size are bounded. */
449
+ declare const sqlQueryInputSchema: z.ZodObject<{
450
+ sql: z.ZodString;
451
+ parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
452
+ type: z.ZodLiteral<"text">;
453
+ value: z.ZodNullable<z.ZodString>;
454
+ }, z.core.$strict>, z.ZodObject<{
455
+ type: z.ZodLiteral<"uuid">;
456
+ value: z.ZodNullable<z.ZodGUID>;
457
+ }, z.core.$strict>, z.ZodObject<{
458
+ type: z.ZodLiteral<"date">;
459
+ value: z.ZodNullable<z.ZodString>;
460
+ }, z.core.$strict>, z.ZodObject<{
461
+ type: z.ZodLiteral<"timestamptz">;
462
+ value: z.ZodNullable<z.ZodString>;
463
+ }, z.core.$strict>, z.ZodObject<{
464
+ type: z.ZodLiteral<"numeric">;
465
+ value: z.ZodNullable<z.ZodString>;
466
+ }, z.core.$strict>, z.ZodObject<{
467
+ type: z.ZodLiteral<"bigint">;
468
+ value: z.ZodNullable<z.ZodString>;
469
+ }, z.core.$strict>, z.ZodObject<{
470
+ type: z.ZodLiteral<"integer">;
471
+ value: z.ZodNullable<z.ZodNumber>;
472
+ }, z.core.$strict>, z.ZodObject<{
473
+ type: z.ZodLiteral<"double">;
474
+ value: z.ZodNullable<z.ZodNumber>;
475
+ }, z.core.$strict>, z.ZodObject<{
476
+ type: z.ZodLiteral<"boolean">;
477
+ value: z.ZodNullable<z.ZodBoolean>;
478
+ }, z.core.$strict>], "type">>>;
479
+ }, z.core.$strict>;
480
+ type SqlQueryInput = z.infer<typeof sqlQueryInputSchema>;
481
+ /** The returned plan contains no bound parameter values or caller identity. */
482
+ declare function compileRuntimeSql({ operation, input }: {
483
+ operation: CompiledOperation;
484
+ input: SqlQueryInput;
485
+ }): Promise<CompiledOperation>;
486
+
487
+ declare const DATASET_PREVIEW_LIMIT = 100;
488
+ /**
489
+ * Fixed runtime-owned reads, separate from the published operation manifest.
490
+ * Use logical column identities directly (no GraphQL naming conversion) and
491
+ * the normal compiler context/policy pass. Like generated GraphQL, internal
492
+ * source tables, raw synced backings, and cell metadata are not exposed.
493
+ */
494
+ declare function compileDatasetPreviews(input: CanonicalDefinition): Record<string, CompiledOperation>;
495
+
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 };