@sequenceholdings/orm 0.1.3 → 2.1.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/README.md +108 -38
  2. package/dist/authoring.cjs +128 -16
  3. package/dist/authoring.cjs.map +1 -1
  4. package/dist/authoring.d.cts +21 -4
  5. package/dist/authoring.d.ts +21 -4
  6. package/dist/authoring.js +128 -16
  7. package/dist/authoring.js.map +1 -1
  8. package/dist/canonical.cjs +83 -9
  9. package/dist/canonical.cjs.map +1 -1
  10. package/dist/canonical.d.cts +47 -1
  11. package/dist/canonical.d.ts +47 -1
  12. package/dist/canonical.js +83 -10
  13. package/dist/canonical.js.map +1 -1
  14. package/dist/cli.cjs +816 -134
  15. package/dist/cli.cjs.map +1 -1
  16. package/dist/cli.js +818 -136
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.js.map +1 -1
  20. package/dist/compiler.cjs +488 -96
  21. package/dist/compiler.cjs.map +1 -1
  22. package/dist/compiler.d.cts +34 -2
  23. package/dist/compiler.d.ts +34 -2
  24. package/dist/compiler.js +489 -97
  25. package/dist/compiler.js.map +1 -1
  26. package/dist/index.cjs +420 -71
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +266 -9
  29. package/dist/index.d.ts +266 -9
  30. package/dist/index.js +410 -73
  31. package/dist/index.js.map +1 -1
  32. package/dist/ir.cjs +146 -12
  33. package/dist/ir.cjs.map +1 -1
  34. package/dist/ir.d.cts +161 -5
  35. package/dist/ir.d.ts +161 -5
  36. package/dist/ir.js +144 -13
  37. package/dist/ir.js.map +1 -1
  38. package/dist/{naming-CTvWSRTf.d.ts → naming-DCn94LJ4.d.ts} +15 -1
  39. package/dist/{naming-DRyinU4u.d.cts → naming-DPglwzkB.d.cts} +15 -1
  40. package/dist/predicate-v2.cjs +136 -11
  41. package/dist/predicate-v2.cjs.map +1 -1
  42. package/dist/predicate-v2.d.cts +3 -0
  43. package/dist/predicate-v2.d.ts +3 -0
  44. package/dist/predicate-v2.js +136 -11
  45. package/dist/predicate-v2.js.map +1 -1
  46. package/dist/sdl.cjs +460 -13
  47. package/dist/sdl.cjs.map +1 -1
  48. package/dist/sdl.d.cts +1 -1
  49. package/dist/sdl.d.ts +1 -1
  50. package/dist/sdl.js +459 -14
  51. package/dist/sdl.js.map +1 -1
  52. package/package.json +6 -4
  53. package/src/codegen-gql/preset.cjs +64 -0
  54. package/src/codegen-gql/server-fns.cjs +11 -6
  55. package/templates/orm-namespace/codegen.preset.cjs +17 -0
  56. package/templates/orm-namespace/codegen.ts +1 -1
  57. package/templates/orm-namespace/package.json +3 -0
  58. package/templates/orm-namespace/schema/tables.ts +1 -1
  59. package/templates/orm-namespace/sequence.config.ts +1 -1
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { AuthoringContext, AuthoringRegistration, COLUMN_BRAND, COLUMN_DEFAULT_FNS, ColumnBuilder, ColumnDefaultFn, ColumnDefaultLiteral, ColumnTypeSpec, CowMutationInput, DrizzleRelation, ENUM_BRAND, EnumRef, IndexInput, LINK_BRAND, LinkKind, LoadNamespaceOptions, LoadedNamespaceV2, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, NamespaceCapabilitiesInput, NamespaceConfigInput, ORM_TO_PIPELINE_TYPE, OrmContractColumnMap, OrmContractPipelineColumn, OrmSyncedTableContract, OrmToPipelineType, OverlayTableRef, OverlayWinsUnionInput, OverrideRowMutationInput, PolicyInput, PolicyVariantInput, PolicyWithVariantsInput, RelationRef, 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, defineEnum, defineNamespace, defineSyncedTable, defineTable, defineView, deriveColumnName, endAuthoringContext, extractOrmSyncedTableContract, isColumnBuilder, isEnumRef, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, loadNamespaceFromDir, overlayWinsUnion, overrideRowMutation, revertOverlayMutation, serializeNamespace, syncedContractSurface, t, toMany, toOne, toPlatformUser } from './authoring.js';
1
+ export { AuthoringContext, AuthoringRegistration, COLUMN_BRAND, COLUMN_DEFAULT_FNS, ColumnBuilder, ColumnDefaultFn, ColumnDefaultLiteral, ColumnTypeSpec, CowMutationInput, DrizzleRelation, ENUM_BRAND, EnumRef, ForeignKeyInput, IndexInput, LINK_BRAND, LinkKind, LoadNamespaceOptions, LoadedNamespaceV2, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, NamespaceCapabilitiesInput, NamespaceConfigInput, ORM_TO_PIPELINE_TYPE, OrmContractColumnMap, OrmContractPipelineColumn, OrmSyncedTableContract, OrmToPipelineType, OverlayTableRef, OverlayWinsUnionInput, OverrideRowMutationInput, PolicyInput, PolicyVariantInput, PolicyWithVariantsInput, RelationRef, 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, defineEnum, defineNamespace, defineSyncedTable, defineTable, defineView, deriveColumnName, endAuthoringContext, extractOrmSyncedTableContract, isColumnBuilder, isEnumRef, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, loadNamespaceFromDir, overlayWinsUnion, overrideRowMutation, revertOverlayMutation, serializeNamespace, syncedContractSurface, t, toMany, toOne, toPlatformUser } from './authoring.js';
2
2
  import { CanonicalDefinition } from './canonical.js';
3
3
  export { CANONICAL_FORMAT, CanonicalColumn, CanonicalEnum, CanonicalLink, CanonicalTable, CanonicalView, IDENTIFIER_RE, PolicyExpression, canonicalActionSchema, canonicalColumnSchema, canonicalDefinitionSchema, canonicalEnumSchema, canonicalIndexSchema, canonicalLinkSchema, canonicalPoliciesSchema, canonicalRelations, canonicalTableSchema, canonicalViewSchema, normalizeCanonical, policyExpressionSchema, policyVariantSchema } from './canonical.js';
4
4
  import { CustomRolesBlock } from '@sequenceholdings/custom-roles-manifest';
5
5
  export { CustomRolesBlock, capabilityPinsSchema, customRolesBlockSchema, customRolesDeclared, parseCapabilityPin, validateCapabilityPins } from '@sequenceholdings/custom-roles-manifest';
6
6
  import { z } from 'zod';
7
7
  import { PredIr } from './ir.js';
8
- export { CLAIMS_CONTRACT, CMP_OPS, ClaimKey, CmpOp, CompiledArtifact, CompiledOperation, INPUT_REF_KINDS, IR_VERSION, InputRefKind, IrVersionError, LimitIr, OrderIr, RootIr, SelectionIr, TableMetaIr, ValueIr, VariableDefaultIr, VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema } from './ir.js';
8
+ export { CLAIMS_CONTRACT, CMP_OPS, ClaimKey, CmpOp, CompiledArtifact, CompiledOperation, DATE_BUCKETS, DateBucket, GroupByKeyIr, INPUT_REF_KINDS, IR_VERSION, InputRefKind, IrVersionError, LEGACY_IR_VERSION, LimitIr, OrderIr, RootIr, SelectionIr, TableMetaIr, ValueIr, VariableDefaultIr, VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, requiredArtifactIrVersion, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema } from './ir.js';
9
9
  import { generateDrizzleJson } from 'drizzle-kit/api';
10
10
  import { PgTableWithColumns } from 'drizzle-orm/pg-core';
11
11
  import 'drizzle-orm';
@@ -431,6 +431,8 @@ declare const roleExpression: (key: string) => string;
431
431
  /** Namespace names become Postgres identifiers (`orm_<ns>` schema, `orm_<ns>_consumer` role) — the tight grammar is a security control, not cosmetics. */
432
432
  declare const NAMESPACE_PATTERN: RegExp;
433
433
  declare const IDENTIFIER_PATTERN: RegExp;
434
+ /** Native source columns may have one leading underscore; relation names may not. */
435
+ declare const COLUMN_IDENTIFIER_PATTERN: RegExp;
434
436
  declare const MAX_IDENTIFIER_LENGTH = 63;
435
437
  /**
436
438
  * The Data API carries a delegated, attenuated data token on this header (not
@@ -472,12 +474,15 @@ declare const DEFINITION_FILE_EXTENSIONS: readonly [".yml", ".yaml"];
472
474
  declare const NAMESPACE_CONFIG_FILENAMES: Set<string>;
473
475
  declare const HASH_DOMAIN = "sequence-orm-definitions\0";
474
476
  /**
475
- * The one size guard the package owns: a per-file byte cap where the loader
476
- * reads untrusted YAML into memory — a real failure mode, not a product
477
+ * A per-file byte cap where the loader reads untrusted YAML into memory — a real failure mode, not a product
477
478
  * limit. Counts of tables/indexes/params and policy/SQL lengths are
478
479
  * deliberately uncapped; Postgres enforces its own limits loudly at apply.
479
480
  */
480
481
  declare const MAX_DEFINITION_FILE_BYTES: number;
482
+ /** Generated SDL aggregates every table/view; it is not an individual source file. */
483
+ declare const MAX_GENERATED_SDL_BYTES: number;
484
+ /** Registration and reviewed exports carry SDL, canonical metadata, snapshots and migrations. */
485
+ declare const ORM_REGISTRATION_MAX_BYTES: number;
481
486
  /** `/api/data/<ns>/actions/…` and `/api/data/<ns>/query` share the table path segment. */
482
487
  declare const RESERVED_TABLE_NAMES: Set<string>;
483
488
  /**
@@ -626,11 +631,11 @@ interface SyncedBacking {
626
631
  */
627
632
  /**
628
633
  * Atlas reassigns every relation in `orm_<ns>` to this role after apply.
629
- * Synced views resolve backing access as their owner, so the emitter must
630
- * grant this role narrow SELECT on each physical relation before CREATE VIEW.
634
+ * Synced views resolve backing access as their owner. Grant this role narrow
635
+ * SELECT before CREATE VIEW, or preserve a separately verified publisher grant.
631
636
  */
632
637
  declare const SYNCED_VIEW_EXECUTION_OWNER_ROLE = "orm_exec";
633
- declare function syncedViewStatements({ definition, backings, readPolicyIrByTable, columnNamesByTable, columnTypesByTable, executionOwnerRole, }: {
638
+ declare function syncedViewStatements({ definition, backings, readPolicyIrByTable, columnNamesByTable, columnTypesByTable, executionOwnerRole, backingPrivileges, }: {
634
639
  definition: NamespaceDefinition;
635
640
  backings: readonly SyncedBacking[];
636
641
  /** v2 compiled read policies (preserves capability/role variants). */
@@ -645,6 +650,11 @@ declare function syncedViewStatements({ definition, backings, readPolicyIrByTabl
645
650
  columnTypesByTable?: ReadonlyMap<string, SyncedPredicateColumnTypes>;
646
651
  /** Role that will own the view after ensureExecutionOwner (default orm_exec). */
647
652
  executionOwnerRole?: string;
653
+ /** Preserve privileges managed by a separate immutable backing publisher.
654
+ * The caller must verify the owner's existing SELECT/USAGE grants and create
655
+ * the views as that owner. This option does not grant backing access.
656
+ */
657
+ backingPrivileges?: 'grant' | 'preserve';
648
658
  }): string[];
649
659
  /**
650
660
  * Drop synced views — idempotent cleanup for apply retries and removal.
@@ -696,7 +706,9 @@ declare const compileNamespace: (definition: NamespaceDefinition) => Promise<Pla
696
706
  * Canonical v2 → the in-memory schema bag drizzle-kit snapshots plus typed
697
707
  * table handles — the same `DrizzleEntities` shape engine/snapshot.ts consumes.
698
708
  */
699
- declare function buildDrizzleEntitiesV2(definition: CanonicalDefinition): DrizzleEntities;
709
+ declare function buildDrizzleEntitiesV2(definition: CanonicalDefinition, options?: {
710
+ introspection?: boolean;
711
+ }): DrizzleEntities;
700
712
  declare function rewriteSyncedSourceRelationsInViewQuery({ query, canonical, schemaName, dependencies, }: {
701
713
  query: string;
702
714
  canonical: CanonicalDefinition;
@@ -769,6 +781,251 @@ declare function stableJson(value: unknown): string;
769
781
  declare function canonicalizeDefinition(definition: NamespaceDefinition): JsonValue;
770
782
  declare function computeDefinitionHash(definition: NamespaceDefinition): string;
771
783
 
784
+ declare const ORM_MIGRATION_EXPORT_FILE = "orm.migration.json";
785
+ declare const ORM_MIGRATION_EXPORT_MAX_BYTES: number;
786
+ declare const ormMigrationExportSchema: z.ZodObject<{
787
+ schema_version: z.ZodLiteral<1>;
788
+ schema_hash: z.ZodString;
789
+ payload: z.ZodObject<{
790
+ canonical_definition: z.ZodObject<{
791
+ definition_format: z.ZodLiteral<2>;
792
+ namespace: z.ZodString;
793
+ description: z.ZodOptional<z.ZodString>;
794
+ enums: z.ZodDefault<z.ZodArray<z.ZodObject<{
795
+ name: z.ZodString;
796
+ values: z.ZodArray<z.ZodString>;
797
+ }, z.core.$strip>>>;
798
+ tables: z.ZodArray<z.ZodObject<{
799
+ table: z.ZodString;
800
+ description: z.ZodOptional<z.ZodString>;
801
+ renamedFrom: z.ZodOptional<z.ZodString>;
802
+ source: z.ZodOptional<z.ZodString>;
803
+ columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
804
+ name: z.ZodString;
805
+ columnName: z.ZodString;
806
+ type: z.ZodUnion<readonly [z.ZodEnum<{
807
+ bigint: "bigint";
808
+ boolean: "boolean";
809
+ uuid: "uuid";
810
+ text: "text";
811
+ integer: "integer";
812
+ numeric: "numeric";
813
+ double: "double";
814
+ timestamptz: "timestamptz";
815
+ date: "date";
816
+ jsonb: "jsonb";
817
+ }>, z.ZodObject<{
818
+ enum: z.ZodString;
819
+ }, z.core.$strip>]>;
820
+ nullable: z.ZodDefault<z.ZodBoolean>;
821
+ unique: z.ZodDefault<z.ZodBoolean>;
822
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
823
+ defaultFn: z.ZodOptional<z.ZodEnum<{
824
+ "gen_random_uuid()": "gen_random_uuid()";
825
+ "now()": "now()";
826
+ }>>;
827
+ onUpdateFn: z.ZodOptional<z.ZodEnum<{
828
+ "now()": "now()";
829
+ }>>;
830
+ description: z.ZodOptional<z.ZodString>;
831
+ renamedFrom: z.ZodOptional<z.ZodString>;
832
+ cast: z.ZodOptional<z.ZodString>;
833
+ deprecated: z.ZodDefault<z.ZodBoolean>;
834
+ }, z.core.$strip>>>;
835
+ primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
836
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
837
+ name: z.ZodString;
838
+ kind: z.ZodEnum<{
839
+ toOne: "toOne";
840
+ toMany: "toMany";
841
+ toPlatformUser: "toPlatformUser";
842
+ }>;
843
+ target: z.ZodOptional<z.ZodString>;
844
+ on: z.ZodString;
845
+ references: z.ZodOptional<z.ZodString>;
846
+ enforce: z.ZodDefault<z.ZodBoolean>;
847
+ description: z.ZodOptional<z.ZodString>;
848
+ }, z.core.$strip>>>;
849
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
850
+ columns: z.ZodArray<z.ZodString>;
851
+ unique: z.ZodDefault<z.ZodBoolean>;
852
+ name: z.ZodOptional<z.ZodString>;
853
+ }, z.core.$strip>>>;
854
+ policies: z.ZodDefault<z.ZodObject<{
855
+ read: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
856
+ default: z.ZodString;
857
+ variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
858
+ when: z.ZodString;
859
+ allow: z.ZodOptional<z.ZodLiteral<true>>;
860
+ policy: z.ZodOptional<z.ZodString>;
861
+ }, z.core.$strip>>>;
862
+ }, z.core.$strip>]>>;
863
+ write: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
864
+ default: z.ZodString;
865
+ variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
866
+ when: z.ZodString;
867
+ allow: z.ZodOptional<z.ZodLiteral<true>>;
868
+ policy: z.ZodOptional<z.ZodString>;
869
+ }, z.core.$strip>>>;
870
+ }, z.core.$strip>]>>;
871
+ insert: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
872
+ default: z.ZodString;
873
+ variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
874
+ when: z.ZodString;
875
+ allow: z.ZodOptional<z.ZodLiteral<true>>;
876
+ policy: z.ZodOptional<z.ZodString>;
877
+ }, z.core.$strip>>>;
878
+ }, z.core.$strip>]>>;
879
+ update: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
880
+ default: z.ZodString;
881
+ variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
882
+ when: z.ZodString;
883
+ allow: z.ZodOptional<z.ZodLiteral<true>>;
884
+ policy: z.ZodOptional<z.ZodString>;
885
+ }, z.core.$strip>>>;
886
+ }, z.core.$strip>]>>;
887
+ }, z.core.$strip>>;
888
+ actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
889
+ name: z.ZodString;
890
+ requires: z.ZodOptional<z.ZodString>;
891
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
892
+ type: z.ZodEnum<{
893
+ bigint: "bigint";
894
+ boolean: "boolean";
895
+ uuid: "uuid";
896
+ text: "text";
897
+ integer: "integer";
898
+ numeric: "numeric";
899
+ double: "double";
900
+ timestamptz: "timestamptz";
901
+ date: "date";
902
+ jsonb: "jsonb";
903
+ }>;
904
+ nullable: z.ZodDefault<z.ZodBoolean>;
905
+ }, z.core.$strip>>>;
906
+ executes: z.ZodString;
907
+ returns: z.ZodDefault<z.ZodEnum<{
908
+ rows: "rows";
909
+ rowsAffected: "rowsAffected";
910
+ scalar: "scalar";
911
+ }>>;
912
+ audit: z.ZodOptional<z.ZodObject<{
913
+ action: z.ZodString;
914
+ resource: z.ZodString;
915
+ }, z.core.$strip>>;
916
+ }, z.core.$strip>>>;
917
+ cowMutations: z.ZodOptional<z.ZodArray<z.ZodObject<{
918
+ kind: z.ZodEnum<{
919
+ override: "override";
920
+ revert: "revert";
921
+ }>;
922
+ name: z.ZodString;
923
+ synced: z.ZodString;
924
+ pk: z.ZodString;
925
+ copy: z.ZodDefault<z.ZodArray<z.ZodString>>;
926
+ set: z.ZodDefault<z.ZodArray<z.ZodString>>;
927
+ }, z.core.$strip>>>;
928
+ foreignKeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
929
+ name: z.ZodString;
930
+ columns: z.ZodArray<z.ZodString>;
931
+ target: z.ZodString;
932
+ references: z.ZodArray<z.ZodString>;
933
+ deferrable: z.ZodOptional<z.ZodEnum<{
934
+ "initially-immediate": "initially-immediate";
935
+ "initially-deferred": "initially-deferred";
936
+ }>>;
937
+ }, z.core.$strict>>>;
938
+ }, z.core.$strip>>;
939
+ views: z.ZodOptional<z.ZodArray<z.ZodObject<{
940
+ view: z.ZodString;
941
+ description: z.ZodOptional<z.ZodString>;
942
+ columns: z.ZodArray<z.ZodObject<{
943
+ name: z.ZodString;
944
+ columnName: z.ZodString;
945
+ type: z.ZodUnion<readonly [z.ZodEnum<{
946
+ bigint: "bigint";
947
+ boolean: "boolean";
948
+ uuid: "uuid";
949
+ text: "text";
950
+ integer: "integer";
951
+ numeric: "numeric";
952
+ double: "double";
953
+ timestamptz: "timestamptz";
954
+ date: "date";
955
+ jsonb: "jsonb";
956
+ }>, z.ZodObject<{
957
+ enum: z.ZodString;
958
+ }, z.core.$strip>]>;
959
+ nullable: z.ZodDefault<z.ZodBoolean>;
960
+ unique: z.ZodDefault<z.ZodBoolean>;
961
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
962
+ defaultFn: z.ZodOptional<z.ZodEnum<{
963
+ "gen_random_uuid()": "gen_random_uuid()";
964
+ "now()": "now()";
965
+ }>>;
966
+ onUpdateFn: z.ZodOptional<z.ZodEnum<{
967
+ "now()": "now()";
968
+ }>>;
969
+ description: z.ZodOptional<z.ZodString>;
970
+ renamedFrom: z.ZodOptional<z.ZodString>;
971
+ cast: z.ZodOptional<z.ZodString>;
972
+ deprecated: z.ZodDefault<z.ZodBoolean>;
973
+ }, z.core.$strip>>;
974
+ primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
975
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
976
+ name: z.ZodString;
977
+ kind: z.ZodEnum<{
978
+ toOne: "toOne";
979
+ toMany: "toMany";
980
+ toPlatformUser: "toPlatformUser";
981
+ }>;
982
+ target: z.ZodOptional<z.ZodString>;
983
+ on: z.ZodString;
984
+ references: z.ZodOptional<z.ZodString>;
985
+ enforce: z.ZodDefault<z.ZodBoolean>;
986
+ description: z.ZodOptional<z.ZodString>;
987
+ }, z.core.$strip>>>;
988
+ policies: z.ZodObject<{
989
+ read: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
990
+ default: z.ZodString;
991
+ variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
992
+ when: z.ZodString;
993
+ allow: z.ZodOptional<z.ZodLiteral<true>>;
994
+ policy: z.ZodOptional<z.ZodString>;
995
+ }, z.core.$strip>>>;
996
+ }, z.core.$strip>]>;
997
+ }, z.core.$strict>;
998
+ query: z.ZodString;
999
+ dependencies: z.ZodArray<z.ZodString>;
1000
+ }, z.core.$strip>>>;
1001
+ capabilities: z.ZodDefault<z.ZodObject<{
1002
+ roles: z.ZodOptional<z.ZodUnknown>;
1003
+ uses: z.ZodDefault<z.ZodArray<z.ZodString>>;
1004
+ }, z.core.$strip>>;
1005
+ }, z.core.$strip>;
1006
+ documents: z.ZodArray<z.ZodObject<{
1007
+ path: z.ZodString;
1008
+ contents: z.ZodString;
1009
+ }, z.core.$strict>>;
1010
+ client_manifest: z.ZodObject<{
1011
+ ops_hash: z.ZodString;
1012
+ operations: z.ZodRecord<z.ZodString, z.ZodString>;
1013
+ }, z.core.$strict>;
1014
+ sdl: z.ZodString;
1015
+ schema_snapshot: z.ZodJSONSchema;
1016
+ migration: z.ZodOptional<z.ZodJSONSchema>;
1017
+ }, z.core.$strict>;
1018
+ checksum: z.ZodString;
1019
+ }, z.core.$strict>;
1020
+ type OrmMigrationExport = z.infer<typeof ormMigrationExportSchema>;
1021
+ declare function createOrmMigrationExport({ schemaHash, payload }: {
1022
+ schemaHash: string;
1023
+ payload: unknown;
1024
+ }): OrmMigrationExport;
1025
+ /** Git pins provenance; this checksum detects inconsistent bytes, not authorship. */
1026
+ declare function parseOrmMigrationExport(text: string): OrmMigrationExport;
1027
+ declare function renderOrmMigrationExport(exported: OrmMigrationExport): string;
1028
+
772
1029
  interface LoadedNamespace {
773
1030
  readonly definition: NamespaceDefinition;
774
1031
  readonly contentHash: string;
@@ -1013,4 +1270,4 @@ declare function parseCanonicalDefinition(value: unknown): NamespaceDefinition;
1013
1270
 
1014
1271
  declare const parsedPredicateSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ParsedPredicate, string>>;
1015
1272
 
1016
- export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, type ActionDefinition, CAPABILITIES_CLAIM_KEY, CAPABILITY_KEY_PATTERN, CLAIMS_SETTING, CLAIM_KEY_PATTERN, COLUMN_TYPES, COMPARE_OPS, CONSUMER_ROLE_SUFFIX, CanonicalDefinition, type ColumnDefault, type ColumnDefinition, type ColumnType, type CommittedChainEntry, type CommittedMigration, type CompareOp, type CompilePredIrToSqlOptions, type CompiledStatement, DEFINITION_FILE_EXTENSIONS, type DefinitionFile, type DefinitionSource, type DestructiveStatement, type DiffOptions, type DrizzleEntities, HASH_DOMAIN, IDENTIFIER_PATTERN, type IndexDefinition, type JournalEntry, type LinkDefinition, type LoadedNamespace, MAX_DEFINITION_FILE_BYTES, MAX_IDENTIFIER_LENGTH, MIGRATIONS_DIRNAME, type MigrationJournal, type MigrationWorkspace, NAMESPACE_CONFIG_FILENAMES, NAMESPACE_PATTERN, type NamespaceCapabilities, type NamespaceConfig, type NamespaceDefinition, type NamespaceSnapshot, ORM_DATA_TOKEN_HEADER, ORM_SCHEMA_PREFIX, ORM_SERVICE_DATA_TOKEN_HEADER, type Operand, OrmDefinitionError, type ParsedPredicate, type PlannedMigration, PredIr, type Predicate, type PredicateColumnTypes, PredicateParseError, QUALIFIED_TABLE_PATTERN, RESERVED_COLUMN_NAMES, RESERVED_TABLE_NAMES, ROLES_CLAIM_KEY, type RebaseEntry, type RebaseEntryInput, type RebaseNoopOptions, STATEMENT_KINDS, SYNCED_SOURCE_PATTERN, 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, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalizeDefinition, capabilityExpression, castParts, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, computeDefinitionHash, consumerRoleName, convertV1DefinitionToCanonical, declaredCapabilityKeys, diffCommand, diffStatements, emptyJournal, emptySnapshot, extractNamedParams, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, identifierSchema, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, migrationName, namespaceConfigSchema, namespaceSchema, normalizeSnapshot, ormSchemaName, parseCanonicalDefinition, parseDefinitionSources, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planMigration, planMigrationV2, predicateOperands, quoteIdentifier, quoteLiteral, readMigrationSql, readMigrationWorkspace, readSnapshot, rebaseViolations, referencedCapabilities, referencedColumns, renderMigrationSql, rewriteSyncedSourceRelationsInViewQuery, roleExpression, securityStatements, sqlTypeName, stableJson, syncedBackingRevokeStatements, syncedTables, syncedViewDropStatements, syncedViewStatements, tableFileSchema, tableReferenceSchema, typesInterfaceName, validateViewCatalogStatement, verifyRebaseIsNoop, walkPredicate, writeMigration };
1273
+ export { ACTION_REQUIRES_DENIED_SQLSTATE, ACTION_VALIDATES_FAILED_SQLSTATE, AUDIT_ACTIONS, type ActionDefinition, CAPABILITIES_CLAIM_KEY, CAPABILITY_KEY_PATTERN, CLAIMS_SETTING, CLAIM_KEY_PATTERN, COLUMN_IDENTIFIER_PATTERN, COLUMN_TYPES, COMPARE_OPS, CONSUMER_ROLE_SUFFIX, CanonicalDefinition, type ColumnDefault, type ColumnDefinition, type ColumnType, type CommittedChainEntry, type CommittedMigration, type CompareOp, type CompilePredIrToSqlOptions, type CompiledStatement, DEFINITION_FILE_EXTENSIONS, type DefinitionFile, type DefinitionSource, type DestructiveStatement, type DiffOptions, type DrizzleEntities, HASH_DOMAIN, IDENTIFIER_PATTERN, type IndexDefinition, type JournalEntry, type LinkDefinition, type LoadedNamespace, MAX_DEFINITION_FILE_BYTES, MAX_GENERATED_SDL_BYTES, MAX_IDENTIFIER_LENGTH, MIGRATIONS_DIRNAME, type MigrationJournal, type MigrationWorkspace, NAMESPACE_CONFIG_FILENAMES, NAMESPACE_PATTERN, type NamespaceCapabilities, type NamespaceConfig, type NamespaceDefinition, type NamespaceSnapshot, 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, type Operand, OrmDefinitionError, type OrmMigrationExport, type ParsedPredicate, type PlannedMigration, PredIr, type Predicate, type PredicateColumnTypes, PredicateParseError, QUALIFIED_TABLE_PATTERN, RESERVED_COLUMN_NAMES, RESERVED_TABLE_NAMES, ROLES_CLAIM_KEY, type RebaseEntry, type RebaseEntryInput, type RebaseNoopOptions, STATEMENT_KINDS, SYNCED_SOURCE_PATTERN, 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, buildActionParamsSchema, buildDrizzleEntities, buildDrizzleEntitiesV2, buildNamespaceDefinition, buildRebaseJournalEntry, canonicalizeDefinition, capabilityExpression, castParts, checksumOf, claimExpression, classifyDestructive, columnSchema, columnTypeSchema, compileActionRequires, compileActionStatements, compileNamespace, compilePredIrToSql, compilePredicate, computeDefinitionHash, consumerRoleName, convertV1DefinitionToCanonical, createOrmMigrationExport, declaredCapabilityKeys, diffCommand, diffStatements, emptyJournal, emptySnapshot, extractNamedParams, generateNamespaceTypes, generateSnapshot, generateSnapshotV2, identifierSchema, isFunctionDefault, isOwnedStatement, isOwnedStatementV2, isQualifiedReference, loadCommittedMigrations, loadCommittedTipMigration, loadNamespaceDefinition, migrationName, namespaceConfigSchema, namespaceSchema, normalizeSnapshot, ormMigrationExportSchema, ormSchemaName, parseCanonicalDefinition, parseDefinitionSources, parseOrmMigrationExport, parsePredicate, parseTableFile, parsedPredicateSchema, pendingKitStatements, pendingKitStatementsV2, planMigration, planMigrationV2, 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 };