@danceroutine/tango-schema 1.1.3 → 1.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.
Files changed (38) hide show
  1. package/dist/domain/Model.d.ts +7 -1
  2. package/dist/domain/index.d.ts +1 -1
  3. package/dist/domain-Cufz6y1q.js.map +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +1 -1
  6. package/dist/model/Model.d.ts +1 -1
  7. package/dist/model/ModelDefinition.d.ts +5 -3
  8. package/dist/model/decorators/Decorators.d.ts +46 -6
  9. package/dist/model/decorators/domain/DecoratedFieldKind.d.ts +6 -0
  10. package/dist/model/decorators/domain/ManyToManyDecoratedSchema.d.ts +4 -0
  11. package/dist/model/decorators/domain/ModelRef.d.ts +2 -0
  12. package/dist/model/decorators/domain/RelationDecoratedSchema.d.ts +9 -0
  13. package/dist/model/decorators/domain/RelationDecoratorConfig.d.ts +35 -0
  14. package/dist/model/decorators/{types.d.ts → domain/TangoFieldMeta.d.ts} +6 -5
  15. package/dist/model/decorators/domain/ZodTypeAny.d.ts +2 -0
  16. package/dist/model/decorators/index.d.ts +5 -2
  17. package/dist/model/{internal → fields}/FieldMetadataStore.d.ts +2 -1
  18. package/dist/model/fields/FinalizedStorageArtifacts.d.ts +11 -0
  19. package/dist/model/{inferFields.d.ts → fields/inferFieldsFromSchema.d.ts} +7 -2
  20. package/dist/model/index.d.ts +12 -3
  21. package/dist/model/index.js +2 -2
  22. package/dist/model/internal/InternalSchemaModel.d.ts +31 -0
  23. package/dist/model/registry/ModelRegistry.d.ts +35 -2
  24. package/dist/model/registry/index.d.ts +4 -0
  25. package/dist/model/relations/NormalizedRelationStorageDescriptor.d.ts +36 -0
  26. package/dist/model/relations/RelationBuilder.d.ts +19 -0
  27. package/dist/model/relations/RelationDescriptorNormalizer.d.ts +30 -0
  28. package/dist/model/relations/RelationSpec.d.ts +48 -0
  29. package/dist/model/relations/ResolvedRelationGraph.d.ts +43 -0
  30. package/dist/model/relations/ResolvedRelationGraphBuilder.d.ts +48 -0
  31. package/dist/model/relations/SchemaNaming.d.ts +11 -0
  32. package/dist/model/relations/index.d.ts +13 -0
  33. package/dist/model-CJbsYdkM.js +1124 -0
  34. package/dist/model-CJbsYdkM.js.map +1 -0
  35. package/package.json +3 -2
  36. package/dist/model/RelationBuilder.d.ts +0 -12
  37. package/dist/model-DI8lQH1W.js +0 -585
  38. package/dist/model-DI8lQH1W.js.map +0 -1
@@ -0,0 +1,48 @@
1
+ import type { Model } from '../../domain/index';
2
+ import type { FinalizedStorageArtifacts } from '../fields/FinalizedStorageArtifacts';
3
+ import type { NormalizedRelationStorageDescriptor } from './NormalizedRelationStorageDescriptor';
4
+ import type { ResolvedRelationGraph } from './ResolvedRelationGraph';
5
+ type GraphBuilderOptions = {
6
+ version: number;
7
+ models: readonly Model[];
8
+ storage: FinalizedStorageArtifacts;
9
+ resolveRef: (ref: NormalizedRelationStorageDescriptor['targetRef']) => Model;
10
+ };
11
+ /**
12
+ * Resolution-stage builder that turns normalized relation descriptors into the
13
+ * registry-scoped resolved relation graph.
14
+ *
15
+ * This is the final pipeline stage in the relations subdomain. It combines:
16
+ *
17
+ * - normalized field-authored relation descriptors
18
+ * - explicit model-level relation names from `RelationBuilder`
19
+ * - finalized storage artifacts from the registry
20
+ *
21
+ * The result is the canonical named relation graph used by ORM-facing
22
+ * consumers.
23
+ */
24
+ export declare class ResolvedRelationGraphBuilder {
25
+ private readonly options;
26
+ private readonly byModel;
27
+ private readonly byEdgeId;
28
+ private readonly matchedOverrides;
29
+ constructor(options: GraphBuilderOptions);
30
+ static build(options: GraphBuilderOptions): ResolvedRelationGraph;
31
+ /**
32
+ * Resolve every model's normalized relation descriptors into a single
33
+ * registry-scoped graph and fail when authoring ambiguity remains.
34
+ */
35
+ build(): ResolvedRelationGraph;
36
+ private addModelRelations;
37
+ private addReferenceRelations;
38
+ private findForwardOverride;
39
+ private findReverseOverride;
40
+ private assertAllOverridesMatched;
41
+ private addResolvedRelation;
42
+ private getPrimaryKey;
43
+ private markOverrideMatched;
44
+ private buildOverrideMarker;
45
+ private resolveRelationTargetKey;
46
+ private deriveReverseName;
47
+ }
48
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shared naming policy for the model and relations subdomains.
3
+ *
4
+ * These helpers are not an authoring or graph stage on their own. They are the
5
+ * cross-cutting policy layer used by both model construction and relation
6
+ * resolution when Tango derives table names, aliases, and synthesized relation
7
+ * names in a Django-style shape.
8
+ */
9
+ export declare function toSnakeCase(value: string): string;
10
+ export declare function pluralize(value: string): string;
11
+ export declare function deriveTableName(name: string): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Domain boundary barrel for relation authoring.
3
+ *
4
+ * The relations subdomain has three internal layers:
5
+ *
6
+ * - authoring: `RelationBuilder`
7
+ * - normalization: field-authored relations become normalized descriptors
8
+ * - resolution: normalized descriptors become the registry-scoped relation graph
9
+ *
10
+ * Only the authoring surface is exported here. The later pipeline stages stay
11
+ * internal until Tango intentionally publishes them as supported contracts.
12
+ */
13
+ export { RelationBuilder } from './RelationBuilder';