@danceroutine/tango-schema 1.3.0 → 1.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.
- package/dist/domain/ModelWriteHooks.d.ts +14 -0
- package/dist/domain/index.d.ts +1 -1
- package/dist/domain-Cufz6y1q.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/model/index.d.ts +1 -1
- package/dist/model/index.js +2 -2
- package/dist/model/internal/InternalSchemaModel.d.ts +2 -4
- package/dist/model/registry/GeneratedRelationRegistryArtifact.d.ts +10 -0
- package/dist/model/registry/ModelRegistry.d.ts +31 -4
- package/dist/model/registry/ResolvedRelationGraphArtifactFactory.d.ts +13 -0
- package/dist/model/registry/ResolvedRelationGraphSnapshot.d.ts +26 -0
- package/dist/model/registry/index.d.ts +4 -0
- package/dist/model/relations/ResolvedRelationGraphBuilder.d.ts +6 -0
- package/dist/{model-YLW1ydkV.js → model-BxkSqwrt.js} +218 -24
- package/dist/model-BxkSqwrt.js.map +1 -0
- package/dist/resolveSchemaModuleEntrypoint.d.ts +20 -0
- package/package.json +2 -2
- package/dist/model-YLW1ydkV.js.map +0 -1
|
@@ -4,6 +4,12 @@ export interface ModelWriteHookManager<TModel extends Record<string, unknown>> {
|
|
|
4
4
|
delete(id: TModel[keyof TModel]): Promise<void>;
|
|
5
5
|
bulkCreate(inputs: Partial<TModel>[]): Promise<TModel[]>;
|
|
6
6
|
}
|
|
7
|
+
export interface ModelWriteHookOnCommitOptions {
|
|
8
|
+
robust?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelWriteHookTransaction {
|
|
11
|
+
onCommit(callback: () => void, options?: ModelWriteHookOnCommitOptions): void;
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Structural model contract passed into write lifecycle hooks.
|
|
9
15
|
*/
|
|
@@ -20,11 +26,13 @@ export interface BeforeCreateHookArgs<TModel extends Record<string, unknown>> {
|
|
|
20
26
|
data: Partial<TModel>;
|
|
21
27
|
model: ModelHookModel<TModel>;
|
|
22
28
|
manager: ModelWriteHookManager<TModel>;
|
|
29
|
+
transaction?: ModelWriteHookTransaction;
|
|
23
30
|
}
|
|
24
31
|
export interface AfterCreateHookArgs<TModel extends Record<string, unknown>> {
|
|
25
32
|
record: TModel;
|
|
26
33
|
model: ModelHookModel<TModel>;
|
|
27
34
|
manager: ModelWriteHookManager<TModel>;
|
|
35
|
+
transaction?: ModelWriteHookTransaction;
|
|
28
36
|
}
|
|
29
37
|
export interface BeforeUpdateHookArgs<TModel extends Record<string, unknown>> {
|
|
30
38
|
id: TModel[keyof TModel];
|
|
@@ -32,6 +40,7 @@ export interface BeforeUpdateHookArgs<TModel extends Record<string, unknown>> {
|
|
|
32
40
|
current: TModel;
|
|
33
41
|
model: ModelHookModel<TModel>;
|
|
34
42
|
manager: ModelWriteHookManager<TModel>;
|
|
43
|
+
transaction?: ModelWriteHookTransaction;
|
|
35
44
|
}
|
|
36
45
|
export interface AfterUpdateHookArgs<TModel extends Record<string, unknown>> {
|
|
37
46
|
id: TModel[keyof TModel];
|
|
@@ -40,28 +49,33 @@ export interface AfterUpdateHookArgs<TModel extends Record<string, unknown>> {
|
|
|
40
49
|
record: TModel;
|
|
41
50
|
model: ModelHookModel<TModel>;
|
|
42
51
|
manager: ModelWriteHookManager<TModel>;
|
|
52
|
+
transaction?: ModelWriteHookTransaction;
|
|
43
53
|
}
|
|
44
54
|
export interface BeforeDeleteHookArgs<TModel extends Record<string, unknown>> {
|
|
45
55
|
id: TModel[keyof TModel];
|
|
46
56
|
current: TModel;
|
|
47
57
|
model: ModelHookModel<TModel>;
|
|
48
58
|
manager: ModelWriteHookManager<TModel>;
|
|
59
|
+
transaction?: ModelWriteHookTransaction;
|
|
49
60
|
}
|
|
50
61
|
export interface AfterDeleteHookArgs<TModel extends Record<string, unknown>> {
|
|
51
62
|
id: TModel[keyof TModel];
|
|
52
63
|
previous: TModel;
|
|
53
64
|
model: ModelHookModel<TModel>;
|
|
54
65
|
manager: ModelWriteHookManager<TModel>;
|
|
66
|
+
transaction?: ModelWriteHookTransaction;
|
|
55
67
|
}
|
|
56
68
|
export interface BeforeBulkCreateHookArgs<TModel extends Record<string, unknown>> {
|
|
57
69
|
rows: Partial<TModel>[];
|
|
58
70
|
model: ModelHookModel<TModel>;
|
|
59
71
|
manager: ModelWriteHookManager<TModel>;
|
|
72
|
+
transaction?: ModelWriteHookTransaction;
|
|
60
73
|
}
|
|
61
74
|
export interface AfterBulkCreateHookArgs<TModel extends Record<string, unknown>> {
|
|
62
75
|
records: TModel[];
|
|
63
76
|
model: ModelHookModel<TModel>;
|
|
64
77
|
manager: ModelWriteHookManager<TModel>;
|
|
78
|
+
transaction?: ModelWriteHookTransaction;
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
67
81
|
* Async-capable model-owned write lifecycle hooks.
|
package/dist/domain/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export type { IndexDef } from './IndexDef';
|
|
|
10
10
|
export type { RelationDef } from './RelationDef';
|
|
11
11
|
export type { ModelMetadata } from './ModelMetadata';
|
|
12
12
|
export type { Model, ModelAugmentations, ModelKeyOf, PersistedModelOutput } from './Model';
|
|
13
|
-
export type { ModelHookModel, ModelWriteHookManager, ModelWriteHooks, BeforeCreateHookArgs, AfterCreateHookArgs, BeforeUpdateHookArgs, AfterUpdateHookArgs, BeforeDeleteHookArgs, AfterDeleteHookArgs, BeforeBulkCreateHookArgs, AfterBulkCreateHookArgs, } from './ModelWriteHooks';
|
|
13
|
+
export type { ModelHookModel, ModelWriteHookOnCommitOptions, ModelWriteHookManager, ModelWriteHookTransaction, ModelWriteHooks, BeforeCreateHookArgs, AfterCreateHookArgs, BeforeUpdateHookArgs, AfterUpdateHookArgs, BeforeDeleteHookArgs, AfterDeleteHookArgs, BeforeBulkCreateHookArgs, AfterBulkCreateHookArgs, } from './ModelWriteHooks';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-Cufz6y1q.js","names":[],"sources":["../src/domain/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport type { FieldType } from './FieldType';\nexport type { DeleteReferentialAction } from './DeleteReferentialAction';\nexport type { UpdateReferentialAction } from './UpdateReferentialAction';\nexport type { RelationType } from './RelationType';\nexport type { Field } from './Field';\nexport type { IndexDef } from './IndexDef';\nexport type { RelationDef } from './RelationDef';\nexport type { ModelMetadata } from './ModelMetadata';\nexport type { Model, ModelAugmentations, ModelKeyOf, PersistedModelOutput } from './Model';\nexport type {\n ModelHookModel,\n ModelWriteHookManager,\n ModelWriteHooks,\n BeforeCreateHookArgs,\n AfterCreateHookArgs,\n BeforeUpdateHookArgs,\n AfterUpdateHookArgs,\n BeforeDeleteHookArgs,\n AfterDeleteHookArgs,\n BeforeBulkCreateHookArgs,\n AfterBulkCreateHookArgs,\n} from './ModelWriteHooks';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"domain-Cufz6y1q.js","names":[],"sources":["../src/domain/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport type { FieldType } from './FieldType';\nexport type { DeleteReferentialAction } from './DeleteReferentialAction';\nexport type { UpdateReferentialAction } from './UpdateReferentialAction';\nexport type { RelationType } from './RelationType';\nexport type { Field } from './Field';\nexport type { IndexDef } from './IndexDef';\nexport type { RelationDef } from './RelationDef';\nexport type { ModelMetadata } from './ModelMetadata';\nexport type { Model, ModelAugmentations, ModelKeyOf, PersistedModelOutput } from './Model';\nexport type {\n ModelHookModel,\n ModelWriteHookOnCommitOptions,\n ModelWriteHookManager,\n ModelWriteHookTransaction,\n ModelWriteHooks,\n BeforeCreateHookArgs,\n AfterCreateHookArgs,\n BeforeUpdateHookArgs,\n AfterUpdateHookArgs,\n BeforeDeleteHookArgs,\n AfterDeleteHookArgs,\n BeforeBulkCreateHookArgs,\n AfterBulkCreateHookArgs,\n} from './ModelWriteHooks';\n"],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
export * as domain from './domain/index';
|
|
6
6
|
export * as model from './model/index';
|
|
7
7
|
export type { DeleteReferentialAction, Field, FieldType, IndexDef, ModelHookModel, ModelKeyOf, ModelAugmentations, ModelMetadata, PersistedModelOutput, ModelWriteHookManager, ModelWriteHooks, BeforeCreateHookArgs, AfterCreateHookArgs, BeforeUpdateHookArgs, AfterUpdateHookArgs, BeforeDeleteHookArgs, AfterDeleteHookArgs, BeforeBulkCreateHookArgs, AfterBulkCreateHookArgs, RelationDef, RelationType, UpdateReferentialAction, } from './domain/index';
|
|
8
|
-
export { Model, RelationBuilder, ModelRegistry, registerModelAugmentor, Constraints, Decorators, Indexes, Meta, c, i, m, t, type ModelDefinition, type ForeignKeyDecoratorConfig, type FieldDecoratorBuilder, type DecoratedFieldKind, type ManyToManyDecoratorConfig, type ModelRef, type ModelRefTarget, type OneToOneDecoratorConfig, type RelationDecoratedSchema, type TypedModelRef, } from './model/index';
|
|
8
|
+
export { Model, RelationBuilder, ModelRegistry, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, ResolvedRelationGraphArtifactFactory, registerModelAugmentor, Constraints, Decorators, Indexes, Meta, c, i, m, t, type ModelDefinition, type ForeignKeyDecoratorConfig, type FieldDecoratorBuilder, type DecoratedFieldKind, type ManyToManyDecoratorConfig, type ModelRef, type ModelRefTarget, type GeneratedRelationRegistryArtifact, type OneToOneDecoratorConfig, type RelationDecoratedSchema, type ResolvedRelationGraphSnapshot, type ResolvedRelationGraphSnapshotModel, type ResolvedRelationGraphSnapshotRelation, type TypedModelRef, } from './model/index';
|
|
9
|
+
export { createSchemaModuleAliases, resolveSchemaModuleEntrypoint } from './resolveSchemaModuleEntrypoint';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Constraints, Decorators, Indexes, Meta, Model, ModelRegistry, RelationBuilder, model_exports, registerModelAugmentor } from "./model-
|
|
1
|
+
import { Constraints, Decorators, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, Indexes, Meta, Model, ModelRegistry, RelationBuilder, ResolvedRelationGraphArtifactFactory, createSchemaModuleAliases, model_exports, registerModelAugmentor, resolveSchemaModuleEntrypoint } from "./model-BxkSqwrt.js";
|
|
2
2
|
import { domain_exports } from "./domain-Cufz6y1q.js";
|
|
3
3
|
|
|
4
|
-
export { Constraints, Decorators, Indexes, Meta, Model, ModelRegistry, RelationBuilder, Constraints as c, domain_exports as domain, Indexes as i, Meta as m, model_exports as model, registerModelAugmentor, Decorators as t };
|
|
4
|
+
export { Constraints, Decorators, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, Indexes, Meta, Model, ModelRegistry, RelationBuilder, ResolvedRelationGraphArtifactFactory, Constraints as c, createSchemaModuleAliases, domain_exports as domain, Indexes as i, Meta as m, model_exports as model, registerModelAugmentor, resolveSchemaModuleEntrypoint, Decorators as t };
|
package/dist/model/index.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export { Meta, m } from './meta/index';
|
|
|
21
21
|
export type { ModelConstraint, ModelMetaFragment } from './meta/index';
|
|
22
22
|
export { Constraints, Indexes, c, i } from './constraints/index';
|
|
23
23
|
export type { ConstraintDefinition } from './constraints/index';
|
|
24
|
-
export { ModelRegistry } from './registry/index';
|
|
24
|
+
export { ModelRegistry, createSchemaModuleAliases, resolveSchemaModuleEntrypoint, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, ResolvedRelationGraphArtifactFactory, type GeneratedRelationRegistryArtifact, type ResolvedRelationGraphSnapshot, type ResolvedRelationGraphSnapshotModel, type ResolvedRelationGraphSnapshotRelation, } from './registry/index';
|
package/dist/model/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Constraints, Decorators, Indexes, InternalDecoratedFieldKind, Meta, Model, ModelRegistry, RelationBuilder, constraints_exports, createTypedModelRef, decorators_exports, isTypedModelRef, meta_exports, registerModelAugmentor, registry_exports, relations_exports } from "../model-
|
|
1
|
+
import { Constraints, Decorators, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, Indexes, InternalDecoratedFieldKind, Meta, Model, ModelRegistry, RelationBuilder, ResolvedRelationGraphArtifactFactory, constraints_exports, createSchemaModuleAliases, createTypedModelRef, decorators_exports, isTypedModelRef, meta_exports, registerModelAugmentor, registry_exports, relations_exports, resolveSchemaModuleEntrypoint } from "../model-BxkSqwrt.js";
|
|
2
2
|
|
|
3
|
-
export { Constraints, Decorators, Indexes, InternalDecoratedFieldKind, Meta, Model, ModelRegistry, RelationBuilder, Constraints as c, constraints_exports as constraints, createTypedModelRef, decorators_exports as decorators, Indexes as i, isTypedModelRef, Meta as m, meta_exports as meta, registerModelAugmentor, registry_exports as registry, relations_exports as relations, Decorators as t };
|
|
3
|
+
export { Constraints, Decorators, GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, Indexes, InternalDecoratedFieldKind, Meta, Model, ModelRegistry, RelationBuilder, ResolvedRelationGraphArtifactFactory, Constraints as c, constraints_exports as constraints, createSchemaModuleAliases, createTypedModelRef, decorators_exports as decorators, Indexes as i, isTypedModelRef, Meta as m, meta_exports as meta, registerModelAugmentor, registry_exports as registry, relations_exports as relations, resolveSchemaModuleEntrypoint, Decorators as t };
|
|
@@ -14,10 +14,6 @@ export declare class InternalSchemaModel<TSchema extends z.ZodObject<z.ZodRawSha
|
|
|
14
14
|
readonly objects: ModelAugmentations<TSchema, TKey> extends {
|
|
15
15
|
readonly objects: infer TObject;
|
|
16
16
|
} ? TObject : never;
|
|
17
|
-
private readonly registry;
|
|
18
|
-
private readonly normalizedRelations;
|
|
19
|
-
private readonly explicitFields?;
|
|
20
|
-
private readonly explicitRelations?;
|
|
21
17
|
private constructor();
|
|
22
18
|
static create<TSchema extends z.ZodObject<z.ZodRawShape>>(definition: ModelDefinition<TSchema>, registry: ModelRegistry): InternalSchemaModel<TSchema>;
|
|
23
19
|
static isInternalSchemaModel(value: unknown): value is AnyInternalSchemaModel;
|
|
@@ -27,5 +23,7 @@ export declare class InternalSchemaModel<TSchema extends z.ZodObject<z.ZodRawSha
|
|
|
27
23
|
static getExplicitRelations(model: AnySchemaModel): Readonly<Record<string, RelationDef>> | undefined;
|
|
28
24
|
private static validateDefinition;
|
|
29
25
|
private static require;
|
|
26
|
+
private static carrier;
|
|
27
|
+
private static attachInternals;
|
|
30
28
|
}
|
|
31
29
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ResolvedRelationGraphSnapshot } from './ResolvedRelationGraphSnapshot';
|
|
2
|
+
export declare const GENERATED_RELATION_REGISTRY_DIRNAME = ".tango";
|
|
3
|
+
export declare const GENERATED_RELATION_REGISTRY_TYPES_FILENAME = "relations.generated.d.ts";
|
|
4
|
+
export declare const GENERATED_RELATION_REGISTRY_METADATA_FILENAME = "relations.generated.json";
|
|
5
|
+
export declare const GENERATED_RELATION_REGISTRY_METADATA_VERSION = 1;
|
|
6
|
+
export type GeneratedRelationRegistryArtifact = {
|
|
7
|
+
version: typeof GENERATED_RELATION_REGISTRY_METADATA_VERSION;
|
|
8
|
+
fingerprint: string;
|
|
9
|
+
snapshot: ResolvedRelationGraphSnapshot;
|
|
10
|
+
};
|
|
@@ -2,11 +2,15 @@ import type { Field, Model } from '../../domain/index';
|
|
|
2
2
|
import { type ModelRef } from '../decorators/domain/ModelRef';
|
|
3
3
|
import type { FinalizedStorageArtifacts } from '../fields/FinalizedStorageArtifacts';
|
|
4
4
|
import type { ResolvedRelationGraph } from '../relations/ResolvedRelationGraph';
|
|
5
|
+
import type { ResolvedRelationGraphSnapshot } from './ResolvedRelationGraphSnapshot';
|
|
5
6
|
/**
|
|
6
7
|
* Registry that resolves Tango models by stable identity.
|
|
7
8
|
*
|
|
8
|
-
* The
|
|
9
|
-
* dedicated instances are useful in
|
|
9
|
+
* The default shared registry is convenient for application bootstrapping
|
|
10
|
+
* within one schema package instance, while dedicated instances are useful in
|
|
11
|
+
* tests and tooling. Explicit active-registry binding stays process-shared so
|
|
12
|
+
* tooling can construct models across separate schema package copies without
|
|
13
|
+
* relying on the ambient default registry.
|
|
10
14
|
*/
|
|
11
15
|
export declare class ModelRegistry {
|
|
12
16
|
private static globalRegistry?;
|
|
@@ -14,12 +18,17 @@ export declare class ModelRegistry {
|
|
|
14
18
|
private version;
|
|
15
19
|
private storageCache?;
|
|
16
20
|
private relationGraphCache?;
|
|
21
|
+
private lastRelationRegistryDriftCheckVersion?;
|
|
17
22
|
/**
|
|
18
|
-
* Return the shared
|
|
23
|
+
* Return the shared default registry used by `Model(...)` for this schema
|
|
24
|
+
* package instance.
|
|
19
25
|
*/
|
|
20
26
|
static global(): ModelRegistry;
|
|
21
27
|
/**
|
|
22
28
|
* Return the registry currently bound to model construction work.
|
|
29
|
+
*
|
|
30
|
+
* This explicit binding is process-shared so code that imports separate
|
|
31
|
+
* schema package copies can still participate in one construction flow.
|
|
23
32
|
*/
|
|
24
33
|
static active(): ModelRegistry;
|
|
25
34
|
/**
|
|
@@ -53,7 +62,13 @@ export declare class ModelRegistry {
|
|
|
53
62
|
/**
|
|
54
63
|
* Return the owning registry for a model.
|
|
55
64
|
*/
|
|
56
|
-
static getOwner(model:
|
|
65
|
+
static getOwner(model: {
|
|
66
|
+
metadata: {
|
|
67
|
+
key?: string;
|
|
68
|
+
};
|
|
69
|
+
} & object): ModelRegistry;
|
|
70
|
+
private static runtimeGlobal;
|
|
71
|
+
private static activeRegistryStorage;
|
|
57
72
|
/**
|
|
58
73
|
* Register a model on this registry instance.
|
|
59
74
|
*/
|
|
@@ -86,6 +101,14 @@ export declare class ModelRegistry {
|
|
|
86
101
|
* Resolve the registry's relation graph from finalized storage artifacts.
|
|
87
102
|
*/
|
|
88
103
|
getResolvedRelationGraph(): ResolvedRelationGraph;
|
|
104
|
+
/**
|
|
105
|
+
* Return a canonical snapshot of the resolved relation graph.
|
|
106
|
+
*/
|
|
107
|
+
getResolvedRelationGraphSnapshot(): ResolvedRelationGraphSnapshot;
|
|
108
|
+
/**
|
|
109
|
+
* Return a deterministic fingerprint for the resolved relation graph.
|
|
110
|
+
*/
|
|
111
|
+
getResolvedRelationGraphFingerprint(): string;
|
|
89
112
|
/**
|
|
90
113
|
* Remove all registered models from this registry instance.
|
|
91
114
|
*/
|
|
@@ -98,4 +121,8 @@ export declare class ModelRegistry {
|
|
|
98
121
|
private freezeFields;
|
|
99
122
|
private inferPrimaryKeyName;
|
|
100
123
|
private mergeStorageFields;
|
|
124
|
+
private warnOnGeneratedRelationRegistryDrift;
|
|
125
|
+
private shouldCheckGeneratedRelationRegistry;
|
|
126
|
+
private readGeneratedRelationRegistryArtifact;
|
|
127
|
+
private isPartialRegistrySnapshot;
|
|
101
128
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ResolvedRelationGraph } from '../relations/ResolvedRelationGraph';
|
|
2
|
+
import type { ResolvedRelationGraphSnapshot } from './ResolvedRelationGraphSnapshot';
|
|
3
|
+
/**
|
|
4
|
+
* Build canonical serialized artifacts from a resolved relation graph.
|
|
5
|
+
*
|
|
6
|
+
* Generation, drift detection, and related tooling all need the same stable
|
|
7
|
+
* snapshot shape and fingerprinting rules, so that work lives behind one class
|
|
8
|
+
* instead of a pair of free functions.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ResolvedRelationGraphArtifactFactory {
|
|
11
|
+
static createSnapshot(graph: ResolvedRelationGraph): ResolvedRelationGraphSnapshot;
|
|
12
|
+
static createFingerprint(value: ResolvedRelationGraph | ResolvedRelationGraphSnapshot): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RelationCardinality, RelationPublicKind, RelationStorageStrategy } from '../relations/RelationSpec';
|
|
2
|
+
export type ResolvedRelationGraphSnapshotRelation = {
|
|
3
|
+
edgeId: string;
|
|
4
|
+
sourceModelKey: string;
|
|
5
|
+
targetModelKey: string;
|
|
6
|
+
name: string;
|
|
7
|
+
inverseEdgeId?: string;
|
|
8
|
+
kind: RelationPublicKind;
|
|
9
|
+
storageStrategy: RelationStorageStrategy;
|
|
10
|
+
cardinality: RelationCardinality;
|
|
11
|
+
localFieldName?: string;
|
|
12
|
+
targetFieldName?: string;
|
|
13
|
+
alias: string;
|
|
14
|
+
capabilities: {
|
|
15
|
+
migratable: boolean;
|
|
16
|
+
queryable: boolean;
|
|
17
|
+
hydratable: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type ResolvedRelationGraphSnapshotModel = {
|
|
21
|
+
key: string;
|
|
22
|
+
relations: ResolvedRelationGraphSnapshotRelation[];
|
|
23
|
+
};
|
|
24
|
+
export type ResolvedRelationGraphSnapshot = {
|
|
25
|
+
models: ResolvedRelationGraphSnapshotModel[];
|
|
26
|
+
};
|
|
@@ -2,3 +2,7 @@
|
|
|
2
2
|
* Domain boundary barrel: centralizes this subdomain's public contract.
|
|
3
3
|
*/
|
|
4
4
|
export { ModelRegistry } from './ModelRegistry';
|
|
5
|
+
export { createSchemaModuleAliases, resolveSchemaModuleEntrypoint } from '../../resolveSchemaModuleEntrypoint';
|
|
6
|
+
export { GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, type GeneratedRelationRegistryArtifact, } from './GeneratedRelationRegistryArtifact';
|
|
7
|
+
export { ResolvedRelationGraphArtifactFactory } from './ResolvedRelationGraphArtifactFactory';
|
|
8
|
+
export { type ResolvedRelationGraphSnapshot, type ResolvedRelationGraphSnapshotModel, type ResolvedRelationGraphSnapshotRelation, } from './ResolvedRelationGraphSnapshot';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Model } from '../../domain/index';
|
|
2
2
|
import type { FinalizedStorageArtifacts } from '../fields/FinalizedStorageArtifacts';
|
|
3
|
+
import type { ResolvedRelationGraphSnapshot } from '../registry/ResolvedRelationGraphSnapshot';
|
|
3
4
|
import type { NormalizedRelationStorageDescriptor } from './NormalizedRelationStorageDescriptor';
|
|
4
5
|
import type { ResolvedRelationGraph } from './ResolvedRelationGraph';
|
|
5
6
|
type GraphBuilderOptions = {
|
|
@@ -28,6 +29,11 @@ export declare class ResolvedRelationGraphBuilder {
|
|
|
28
29
|
private readonly matchedOverrides;
|
|
29
30
|
constructor(options: GraphBuilderOptions);
|
|
30
31
|
static build(options: GraphBuilderOptions): ResolvedRelationGraph;
|
|
32
|
+
/**
|
|
33
|
+
* Serialize a resolved graph into the canonical snapshot shape used by
|
|
34
|
+
* relation-registry code generation and fingerprinting.
|
|
35
|
+
*/
|
|
36
|
+
static createSnapshot(graph: ResolvedRelationGraph): ResolvedRelationGraphSnapshot;
|
|
31
37
|
/**
|
|
32
38
|
* Resolve every model's normalized relation descriptors into a single
|
|
33
39
|
* registry-scoped graph and fail when authoring ambiguity remains.
|