@sequenceholdings/orm 2.1.1 → 2.2.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.
- package/README.md +3 -1
- package/dist/authoring.cjs +284 -99
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +31 -8
- package/dist/authoring.d.ts +31 -8
- package/dist/authoring.js +282 -100
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +51 -3
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +838 -12
- package/dist/canonical.d.ts +838 -12
- package/dist/canonical.js +47 -4
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +5838 -4197
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +5838 -4197
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs +49 -32
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +49 -6
- package/dist/client.d.ts +49 -6
- package/dist/client.js +49 -32
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +1237 -263
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +57 -3
- package/dist/compiler.d.ts +57 -3
- package/dist/compiler.js +1230 -264
- package/dist/compiler.js.map +1 -1
- package/dist/{constants-YoFGjIBM.d.cts → constants-C6EG6Wq7.d.cts} +1 -1
- package/dist/{constants-YoFGjIBM.d.ts → constants-C6EG6Wq7.d.ts} +1 -1
- package/dist/definition-DjfC7Lll.d.cts +91 -0
- package/dist/definition-DjfC7Lll.d.ts +91 -0
- package/dist/dynamic-input.cjs +2 -1
- package/dist/dynamic-input.cjs.map +1 -1
- package/dist/dynamic-input.d.cts +9 -2
- package/dist/dynamic-input.d.ts +9 -2
- package/dist/dynamic-input.js +2 -1
- package/dist/dynamic-input.js.map +1 -1
- package/dist/index.cjs +1094 -321
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +479 -19
- package/dist/index.d.ts +479 -19
- package/dist/index.js +1083 -322
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +84 -10
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +138 -13
- package/dist/ir.d.ts +138 -13
- package/dist/ir.js +81 -11
- package/dist/ir.js.map +1 -1
- package/dist/predicate-v2.cjs +78 -9
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.d.cts +1 -1
- package/dist/predicate-v2.d.ts +1 -1
- package/dist/predicate-v2.js +78 -9
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +156 -21
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +8 -1
- package/dist/sdl.d.ts +8 -1
- package/dist/sdl.js +156 -21
- package/dist/sdl.js.map +1 -1
- package/package.json +5 -4
- package/src/codegen-gql/server-fns.cjs +2 -2
- package/templates/orm-namespace/AGENTS.md +10 -0
- package/templates/orm-namespace/CLAUDE.md +1 -84
- package/templates/orm-namespace/package.json +1 -1
package/dist/authoring.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColumnType, CanonicalColumn, ComparatorKind, CanonicalFunctionRef, CanonicalFetchShape, CanonicalDefinition, CanonicalTable } from './canonical.cjs';
|
|
2
|
-
import { b as CellPart } from './constants-
|
|
2
|
+
import { b as CellPart } from './constants-C6EG6Wq7.cjs';
|
|
3
3
|
import { ColumnsSelection } from 'drizzle-orm';
|
|
4
4
|
import { TypedQueryBuilder } from 'drizzle-orm/query-builders/query-builder';
|
|
5
5
|
import { QueryBuilder, PgView, PgTable, AnyPgColumn } from 'drizzle-orm/pg-core';
|
|
6
|
+
export { S as SqlOperationDefinition, d as defineOperation } from './definition-DjfC7Lll.cjs';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import './policy-1iZbGnZZ.cjs';
|
|
8
9
|
|
|
@@ -121,7 +122,7 @@ interface CowMutationInput {
|
|
|
121
122
|
interface OverrideRowMutationInput<TOverlay extends OverlayTableRef = OverlayTableRef, TSynced extends SeqTable = SeqTable> {
|
|
122
123
|
/** Writable ORM overlay table (or `{ tableName, columns }` descriptor). */
|
|
123
124
|
overlay: TOverlay;
|
|
124
|
-
/** Read-only synced table reflecting
|
|
125
|
+
/** Read-only synced table reflecting its qualified source relation. */
|
|
125
126
|
synced: TSynced;
|
|
126
127
|
/**
|
|
127
128
|
* Property name of the single-column primary key shared by both tables.
|
|
@@ -411,7 +412,7 @@ declare function defineView<const TColumns extends Record<string, ColumnBuilder>
|
|
|
411
412
|
interface OverlayWinsUnionInput<TOverlay extends SeqTable = SeqTable, TSynced extends SeqTable = SeqTable> {
|
|
412
413
|
/** The ORM overlay table (writable, has `tombstone` if soft-delete is used). */
|
|
413
414
|
overlay: TOverlay;
|
|
414
|
-
/** The synced (read-only) table reflecting
|
|
415
|
+
/** The synced (read-only) table reflecting its qualified source relation. */
|
|
415
416
|
synced: TSynced;
|
|
416
417
|
/**
|
|
417
418
|
* Property name of the single-column primary key shared by both tables.
|
|
@@ -451,7 +452,14 @@ declare const LINK_BRAND: "seq-link";
|
|
|
451
452
|
/** A link target: a managed table/view, or a lazy thunk for forward/cyclic references. */
|
|
452
453
|
type RelationRef = SeqTable | SeqView | (() => SeqTable | SeqView);
|
|
453
454
|
/** Backward-compatible alias retained for existing consumers. */
|
|
454
|
-
type TableRef = RelationRef;
|
|
455
|
+
type TableRef = RelationRef | ExternalObjectRef;
|
|
456
|
+
interface ExternalObjectRef {
|
|
457
|
+
readonly kind: 'seq-external-object';
|
|
458
|
+
readonly namespace: string;
|
|
459
|
+
readonly table: string;
|
|
460
|
+
}
|
|
461
|
+
/** Qualified identity resolved against a pinned namespace contract at compile time. */
|
|
462
|
+
declare function objectRef(namespace: string, table: string): ExternalObjectRef;
|
|
455
463
|
type LinkKind = 'toOne' | 'toMany' | 'toPlatformUser';
|
|
456
464
|
type ReferentialAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';
|
|
457
465
|
interface SeqLink {
|
|
@@ -537,6 +545,7 @@ interface ForeignKeyInput {
|
|
|
537
545
|
onUpdate?: ReferentialAction;
|
|
538
546
|
}
|
|
539
547
|
interface TableConfig {
|
|
548
|
+
displayName?: string;
|
|
540
549
|
description?: string;
|
|
541
550
|
/** Table-level migration rename hint (new in v2). */
|
|
542
551
|
renamedFrom?: string;
|
|
@@ -583,7 +592,7 @@ interface SeqTable<TColumns extends Record<string, ColumnBuilder> = Record<strin
|
|
|
583
592
|
readonly tableName: string;
|
|
584
593
|
readonly columns: Readonly<TColumns>;
|
|
585
594
|
readonly config: TableConfig;
|
|
586
|
-
/** Synced reflected source (`
|
|
595
|
+
/** Synced reflected source (`schema.table`) — set only by defineSyncedTable. */
|
|
587
596
|
readonly source: string | undefined;
|
|
588
597
|
/** Consumer file that defined the table (set when loaded via loadNamespaceFromDir). */
|
|
589
598
|
readonly file: string | undefined;
|
|
@@ -595,11 +604,11 @@ interface SyncedTablePoliciesInput {
|
|
|
595
604
|
read?: PolicyInput;
|
|
596
605
|
}
|
|
597
606
|
/**
|
|
598
|
-
* Config for a read-only
|
|
607
|
+
* Config for a read-only qualified-source reflection. Columns (typed overload) are a contract
|
|
599
608
|
* for views/clients — ORM does not own synced DDL.
|
|
600
609
|
*/
|
|
601
610
|
interface SyncedTableConfig {
|
|
602
|
-
/** Reflected read-only source
|
|
611
|
+
/** Reflected read-only source as a safe qualified identifier: `<schema>.<table>`. */
|
|
603
612
|
source: string;
|
|
604
613
|
description?: string;
|
|
605
614
|
/** Composite primary key: property names (or column names). Mutually exclusive with column-level `.primaryKey()`. */
|
|
@@ -632,12 +641,16 @@ interface NamespaceConfigInput {
|
|
|
632
641
|
namespace: string;
|
|
633
642
|
description?: string;
|
|
634
643
|
capabilities?: NamespaceCapabilitiesInput;
|
|
644
|
+
imports?: readonly unknown[];
|
|
645
|
+
exports?: CanonicalDefinition['exports'];
|
|
635
646
|
}
|
|
636
647
|
interface SeqNamespaceConfig {
|
|
637
648
|
readonly kind: typeof NAMESPACE_CONFIG_BRAND;
|
|
638
649
|
readonly namespace: string;
|
|
639
650
|
readonly description: string | undefined;
|
|
640
651
|
readonly capabilities: NamespaceCapabilitiesInput;
|
|
652
|
+
readonly imports?: readonly unknown[];
|
|
653
|
+
readonly exports?: CanonicalDefinition['exports'];
|
|
641
654
|
readonly file: string | undefined;
|
|
642
655
|
}
|
|
643
656
|
declare function isSeqNamespaceConfig(value: unknown): value is SeqNamespaceConfig;
|
|
@@ -774,4 +787,14 @@ declare function beginAuthoringContext(): AuthoringContext;
|
|
|
774
787
|
declare function endAuthoringContext(context: AuthoringContext): void;
|
|
775
788
|
declare function activeAuthoringContext(): AuthoringContext | undefined;
|
|
776
789
|
|
|
777
|
-
|
|
790
|
+
interface CatalogFolders {
|
|
791
|
+
[name: string]: CatalogFolders | null;
|
|
792
|
+
}
|
|
793
|
+
/** Presentation-only organization; never included in the canonical schema hash. */
|
|
794
|
+
interface NamespaceCatalog {
|
|
795
|
+
folders: CatalogFolders;
|
|
796
|
+
objects: Record<string, string>;
|
|
797
|
+
}
|
|
798
|
+
declare function validateNamespaceCatalog(catalog: NamespaceCatalog, file?: string): void;
|
|
799
|
+
|
|
800
|
+
export { type AuthoringContext, type AuthoringRegistration, COLUMN_BRAND, COLUMN_DEFAULT_FNS, type CatalogFolders, type CheckInput, ColumnBuilder, type ColumnDefaultFn, type ColumnDefaultLiteral, type ColumnTypeSpec, type Comparator, type CowMutationInput, type DrizzleRelation, type DurationInput, ENUM_BRAND, type EnumRef, type EtlSourceInput, type ExternalObjectRef, type ForeignKeyInput, type FunctionRef, type IndexInput, LINK_BRAND, type LinkKind, type LoadNamespaceOptions, type LoadedNamespaceV2, type ManualSourceInput, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, type NamespaceCapabilitiesInput, type NamespaceCatalog, type NamespaceConfigInput, ORM_TO_PIPELINE_TYPE, type OrmContractColumnMap, type OrmContractPipelineColumn, type OrmSyncedTableContract, type OrmToPipelineType, type OverlayTableRef, type OverlayWinsUnionInput, type OverrideRowMutationInput, type PolicyInput, type PolicyVariantInput, type PolicyWithVariantsInput, type PrefetchSourceInput, type ReferentialAction, type RelationRef, type ResolvedSourceInput, type ResolvedTableConfig, type ResolvedTablePoliciesInput, type RevertOverlayMutationInput, SCHEMA_DIR, SYNCED_CONTRACT_HASH_DOMAIN, type SeqLink, type SeqNamespaceConfig, type SeqTable, type SeqView, type SerializeNamespaceInput, type SyncedTableConfig, type SyncedTablePoliciesInput, TABLE_BRAND, type TableConfig, type TablePoliciesInput, type TableRef, type ToManyOptions, type ToOneOptions, type ToPlatformUserOptions, type TypedSyncedTableConfig, VIEW_BRAND, type ViewConfig, type ViewPoliciesInput, type ViewQueryContext, type ViewSelectQuery, activeAuthoringContext, beginAuthoringContext, computeCanonicalHash, computeSyncedContractHash, custom, defineEnum, defineNamespace, defineResolvedTable, defineSyncedTable, defineTable, defineView, deriveColumnName, endAuthoringContext, etlSource, extractOrmSyncedTableContract, highest, isColumnBuilder, isEnumRef, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, latest, loadNamespaceFromDir, lowest, managedFn, manualSource, nonNullFirst, objectRef, overlayWinsUnion, overrideRowMutation, prefetchSource, priority, revertOverlayMutation, serializeNamespace, syncedContractSurface, t, toMany, toOne, toPlatformUser, validateNamespaceCatalog };
|
package/dist/authoring.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColumnType, CanonicalColumn, ComparatorKind, CanonicalFunctionRef, CanonicalFetchShape, CanonicalDefinition, CanonicalTable } from './canonical.js';
|
|
2
|
-
import { b as CellPart } from './constants-
|
|
2
|
+
import { b as CellPart } from './constants-C6EG6Wq7.js';
|
|
3
3
|
import { ColumnsSelection } from 'drizzle-orm';
|
|
4
4
|
import { TypedQueryBuilder } from 'drizzle-orm/query-builders/query-builder';
|
|
5
5
|
import { QueryBuilder, PgView, PgTable, AnyPgColumn } from 'drizzle-orm/pg-core';
|
|
6
|
+
export { S as SqlOperationDefinition, d as defineOperation } from './definition-DjfC7Lll.js';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import './policy-1iZbGnZZ.js';
|
|
8
9
|
|
|
@@ -121,7 +122,7 @@ interface CowMutationInput {
|
|
|
121
122
|
interface OverrideRowMutationInput<TOverlay extends OverlayTableRef = OverlayTableRef, TSynced extends SeqTable = SeqTable> {
|
|
122
123
|
/** Writable ORM overlay table (or `{ tableName, columns }` descriptor). */
|
|
123
124
|
overlay: TOverlay;
|
|
124
|
-
/** Read-only synced table reflecting
|
|
125
|
+
/** Read-only synced table reflecting its qualified source relation. */
|
|
125
126
|
synced: TSynced;
|
|
126
127
|
/**
|
|
127
128
|
* Property name of the single-column primary key shared by both tables.
|
|
@@ -411,7 +412,7 @@ declare function defineView<const TColumns extends Record<string, ColumnBuilder>
|
|
|
411
412
|
interface OverlayWinsUnionInput<TOverlay extends SeqTable = SeqTable, TSynced extends SeqTable = SeqTable> {
|
|
412
413
|
/** The ORM overlay table (writable, has `tombstone` if soft-delete is used). */
|
|
413
414
|
overlay: TOverlay;
|
|
414
|
-
/** The synced (read-only) table reflecting
|
|
415
|
+
/** The synced (read-only) table reflecting its qualified source relation. */
|
|
415
416
|
synced: TSynced;
|
|
416
417
|
/**
|
|
417
418
|
* Property name of the single-column primary key shared by both tables.
|
|
@@ -451,7 +452,14 @@ declare const LINK_BRAND: "seq-link";
|
|
|
451
452
|
/** A link target: a managed table/view, or a lazy thunk for forward/cyclic references. */
|
|
452
453
|
type RelationRef = SeqTable | SeqView | (() => SeqTable | SeqView);
|
|
453
454
|
/** Backward-compatible alias retained for existing consumers. */
|
|
454
|
-
type TableRef = RelationRef;
|
|
455
|
+
type TableRef = RelationRef | ExternalObjectRef;
|
|
456
|
+
interface ExternalObjectRef {
|
|
457
|
+
readonly kind: 'seq-external-object';
|
|
458
|
+
readonly namespace: string;
|
|
459
|
+
readonly table: string;
|
|
460
|
+
}
|
|
461
|
+
/** Qualified identity resolved against a pinned namespace contract at compile time. */
|
|
462
|
+
declare function objectRef(namespace: string, table: string): ExternalObjectRef;
|
|
455
463
|
type LinkKind = 'toOne' | 'toMany' | 'toPlatformUser';
|
|
456
464
|
type ReferentialAction = 'cascade' | 'restrict' | 'no action' | 'set null' | 'set default';
|
|
457
465
|
interface SeqLink {
|
|
@@ -537,6 +545,7 @@ interface ForeignKeyInput {
|
|
|
537
545
|
onUpdate?: ReferentialAction;
|
|
538
546
|
}
|
|
539
547
|
interface TableConfig {
|
|
548
|
+
displayName?: string;
|
|
540
549
|
description?: string;
|
|
541
550
|
/** Table-level migration rename hint (new in v2). */
|
|
542
551
|
renamedFrom?: string;
|
|
@@ -583,7 +592,7 @@ interface SeqTable<TColumns extends Record<string, ColumnBuilder> = Record<strin
|
|
|
583
592
|
readonly tableName: string;
|
|
584
593
|
readonly columns: Readonly<TColumns>;
|
|
585
594
|
readonly config: TableConfig;
|
|
586
|
-
/** Synced reflected source (`
|
|
595
|
+
/** Synced reflected source (`schema.table`) — set only by defineSyncedTable. */
|
|
587
596
|
readonly source: string | undefined;
|
|
588
597
|
/** Consumer file that defined the table (set when loaded via loadNamespaceFromDir). */
|
|
589
598
|
readonly file: string | undefined;
|
|
@@ -595,11 +604,11 @@ interface SyncedTablePoliciesInput {
|
|
|
595
604
|
read?: PolicyInput;
|
|
596
605
|
}
|
|
597
606
|
/**
|
|
598
|
-
* Config for a read-only
|
|
607
|
+
* Config for a read-only qualified-source reflection. Columns (typed overload) are a contract
|
|
599
608
|
* for views/clients — ORM does not own synced DDL.
|
|
600
609
|
*/
|
|
601
610
|
interface SyncedTableConfig {
|
|
602
|
-
/** Reflected read-only source
|
|
611
|
+
/** Reflected read-only source as a safe qualified identifier: `<schema>.<table>`. */
|
|
603
612
|
source: string;
|
|
604
613
|
description?: string;
|
|
605
614
|
/** Composite primary key: property names (or column names). Mutually exclusive with column-level `.primaryKey()`. */
|
|
@@ -632,12 +641,16 @@ interface NamespaceConfigInput {
|
|
|
632
641
|
namespace: string;
|
|
633
642
|
description?: string;
|
|
634
643
|
capabilities?: NamespaceCapabilitiesInput;
|
|
644
|
+
imports?: readonly unknown[];
|
|
645
|
+
exports?: CanonicalDefinition['exports'];
|
|
635
646
|
}
|
|
636
647
|
interface SeqNamespaceConfig {
|
|
637
648
|
readonly kind: typeof NAMESPACE_CONFIG_BRAND;
|
|
638
649
|
readonly namespace: string;
|
|
639
650
|
readonly description: string | undefined;
|
|
640
651
|
readonly capabilities: NamespaceCapabilitiesInput;
|
|
652
|
+
readonly imports?: readonly unknown[];
|
|
653
|
+
readonly exports?: CanonicalDefinition['exports'];
|
|
641
654
|
readonly file: string | undefined;
|
|
642
655
|
}
|
|
643
656
|
declare function isSeqNamespaceConfig(value: unknown): value is SeqNamespaceConfig;
|
|
@@ -774,4 +787,14 @@ declare function beginAuthoringContext(): AuthoringContext;
|
|
|
774
787
|
declare function endAuthoringContext(context: AuthoringContext): void;
|
|
775
788
|
declare function activeAuthoringContext(): AuthoringContext | undefined;
|
|
776
789
|
|
|
777
|
-
|
|
790
|
+
interface CatalogFolders {
|
|
791
|
+
[name: string]: CatalogFolders | null;
|
|
792
|
+
}
|
|
793
|
+
/** Presentation-only organization; never included in the canonical schema hash. */
|
|
794
|
+
interface NamespaceCatalog {
|
|
795
|
+
folders: CatalogFolders;
|
|
796
|
+
objects: Record<string, string>;
|
|
797
|
+
}
|
|
798
|
+
declare function validateNamespaceCatalog(catalog: NamespaceCatalog, file?: string): void;
|
|
799
|
+
|
|
800
|
+
export { type AuthoringContext, type AuthoringRegistration, COLUMN_BRAND, COLUMN_DEFAULT_FNS, type CatalogFolders, type CheckInput, ColumnBuilder, type ColumnDefaultFn, type ColumnDefaultLiteral, type ColumnTypeSpec, type Comparator, type CowMutationInput, type DrizzleRelation, type DurationInput, ENUM_BRAND, type EnumRef, type EtlSourceInput, type ExternalObjectRef, type ForeignKeyInput, type FunctionRef, type IndexInput, LINK_BRAND, type LinkKind, type LoadNamespaceOptions, type LoadedNamespaceV2, type ManualSourceInput, NAMESPACE_CONFIG_BRAND, NAMESPACE_CONFIG_FILE, type NamespaceCapabilitiesInput, type NamespaceCatalog, type NamespaceConfigInput, ORM_TO_PIPELINE_TYPE, type OrmContractColumnMap, type OrmContractPipelineColumn, type OrmSyncedTableContract, type OrmToPipelineType, type OverlayTableRef, type OverlayWinsUnionInput, type OverrideRowMutationInput, type PolicyInput, type PolicyVariantInput, type PolicyWithVariantsInput, type PrefetchSourceInput, type ReferentialAction, type RelationRef, type ResolvedSourceInput, type ResolvedTableConfig, type ResolvedTablePoliciesInput, type RevertOverlayMutationInput, SCHEMA_DIR, SYNCED_CONTRACT_HASH_DOMAIN, type SeqLink, type SeqNamespaceConfig, type SeqTable, type SeqView, type SerializeNamespaceInput, type SyncedTableConfig, type SyncedTablePoliciesInput, TABLE_BRAND, type TableConfig, type TablePoliciesInput, type TableRef, type ToManyOptions, type ToOneOptions, type ToPlatformUserOptions, type TypedSyncedTableConfig, VIEW_BRAND, type ViewConfig, type ViewPoliciesInput, type ViewQueryContext, type ViewSelectQuery, activeAuthoringContext, beginAuthoringContext, computeCanonicalHash, computeSyncedContractHash, custom, defineEnum, defineNamespace, defineResolvedTable, defineSyncedTable, defineTable, defineView, deriveColumnName, endAuthoringContext, etlSource, extractOrmSyncedTableContract, highest, isColumnBuilder, isEnumRef, isSeqLink, isSeqNamespaceConfig, isSeqTable, isSeqView, latest, loadNamespaceFromDir, lowest, managedFn, manualSource, nonNullFirst, objectRef, overlayWinsUnion, overrideRowMutation, prefetchSource, priority, revertOverlayMutation, serializeNamespace, syncedContractSurface, t, toMany, toOne, toPlatformUser, validateNamespaceCatalog };
|