@danceroutine/tango-codegen 1.11.1 → 1.11.2
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/chunk-D7D4PA-g.js +13 -0
- package/dist/commands/index.d.ts +2 -6
- package/dist/commands/index.js +2 -5
- package/dist/{commands-CFAq4wXC.js → commands-pbMmQ_tn.js} +49 -58
- package/dist/commands-pbMmQ_tn.js.map +1 -0
- package/dist/domain/index.d.ts +2 -4
- package/dist/domain/index.js +7 -1
- package/dist/domain/index.js.map +1 -0
- package/dist/frameworks/index.d.ts +2 -12
- package/dist/frameworks/index.js +2 -3
- package/dist/{frameworks-BTcP3d9Q.js → frameworks-DcmEvb3N.js} +116 -158
- package/dist/frameworks-DcmEvb3N.js.map +1 -0
- package/dist/generators/index.d.ts +2 -12
- package/dist/generators/index.js +3 -4
- package/dist/{generators-DuAuGNR2.js → generators-D7GoehXD.js} +39 -40
- package/dist/generators-D7GoehXD.js.map +1 -0
- package/dist/index-DDt-Xe7q.d.ts +201 -0
- package/dist/index-DM7Ade2V.d.ts +43 -0
- package/dist/index-XicN3qCI.d.ts +82 -0
- package/dist/index-sKndVpFf.d.ts +26 -0
- package/dist/index.d.ts +18 -13
- package/dist/index.js +6 -7
- package/dist/{relations-DqDEZ6MV.js → relations-tePbGOWl.js} +33 -31
- package/dist/relations-tePbGOWl.js.map +1 -0
- package/package.json +5 -5
- package/dist/chunk-BkvOhyD0.js +0 -12
- package/dist/commands/loadProjectModule.d.ts +0 -15
- package/dist/commands/registerCodegenCommands.d.ts +0 -5
- package/dist/commands/runGenerateRelationsCommand.d.ts +0 -11
- package/dist/commands/runInitCommand.d.ts +0 -13
- package/dist/commands/runInstall.d.ts +0 -2
- package/dist/commands/runNewCommand.d.ts +0 -16
- package/dist/commands-CFAq4wXC.js.map +0 -1
- package/dist/domain/CodegenModel.d.ts +0 -19
- package/dist/domain-Cufz6y1q.js +0 -7
- package/dist/domain-Cufz6y1q.js.map +0 -1
- package/dist/frameworks/contracts/FrameworkScaffoldStrategy.d.ts +0 -40
- package/dist/frameworks/contracts/template/ScaffoldTemplate.d.ts +0 -22
- package/dist/frameworks/contracts/template/TemplateBuilder.d.ts +0 -42
- package/dist/frameworks/contracts/template/implementation/ScaffoldTemplateDescriptor.d.ts +0 -10
- package/dist/frameworks/registry/FrameworkScaffoldRegistry.d.ts +0 -23
- package/dist/frameworks/scaffold/scaffoldProject.d.ts +0 -17
- package/dist/frameworks/strategies/express/ExpressScaffoldStrategy.d.ts +0 -14
- package/dist/frameworks/strategies/express/templates/appSource.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/bootstrap.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/models.d.ts +0 -10
- package/dist/frameworks/strategies/express/templates/openapi.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/packageJson.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/readme.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/serializers.d.ts +0 -10
- package/dist/frameworks/strategies/express/templates/tangoConfig.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/tangoRegister.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/tsconfig.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/tsconfigBuild.d.ts +0 -6
- package/dist/frameworks/strategies/express/templates/viewSet.d.ts +0 -6
- package/dist/frameworks/strategies/next/NextScaffoldStrategy.d.ts +0 -14
- package/dist/frameworks/strategies/next/templates/bootstrap.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/healthRoute.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/layout.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/models.d.ts +0 -11
- package/dist/frameworks/strategies/next/templates/openapi.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/openapiRoute.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/packageJson.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/page.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/readme.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/serializers.d.ts +0 -10
- package/dist/frameworks/strategies/next/templates/tangoConfig.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/todoRoute.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/tsconfig.d.ts +0 -6
- package/dist/frameworks/strategies/next/templates/viewSet.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/NuxtScaffoldStrategy.d.ts +0 -14
- package/dist/frameworks/strategies/nuxt/templates/bootstrap.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/healthRoute.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/layout.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/models.d.ts +0 -11
- package/dist/frameworks/strategies/nuxt/templates/nuxtConfig.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/openapi.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/openapiRoute.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/packageJson.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/page.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/readme.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/serializers.d.ts +0 -10
- package/dist/frameworks/strategies/nuxt/templates/tangoConfig.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/todoRoute.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/tsconfig.d.ts +0 -6
- package/dist/frameworks/strategies/nuxt/templates/viewSet.d.ts +0 -6
- package/dist/frameworks-BTcP3d9Q.js.map +0 -1
- package/dist/generators/migration/generateMigrationFromModels.d.ts +0 -8
- package/dist/generators/migration/index.d.ts +0 -4
- package/dist/generators/model/generateModelInterface.d.ts +0 -5
- package/dist/generators/model/index.d.ts +0 -4
- package/dist/generators/relations/generateRelationRegistryArtifacts.d.ts +0 -15
- package/dist/generators/relations/index.d.ts +0 -5
- package/dist/generators/relations/writeRelationRegistryArtifacts.d.ts +0 -16
- package/dist/generators/viewset/generateViewSet.d.ts +0 -4
- package/dist/generators/viewset/index.d.ts +0 -4
- package/dist/generators-DuAuGNR2.js.map +0 -1
- package/dist/mappers/fieldType.d.ts +0 -9
- package/dist/mappers/index.d.ts +0 -4
- package/dist/relations-DqDEZ6MV.js.map +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
//#region src/frameworks/contracts/template/TemplateBuilder.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Interface for a context-bound template that the strategy's add* methods accept.
|
|
4
|
+
* Implemented by bound TemplateBuilder instances and by the return value of createStaticTemplate.
|
|
5
|
+
*/
|
|
6
|
+
interface BoundTemplate {
|
|
7
|
+
getPath(): string;
|
|
8
|
+
build(): string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Base class for scaffold template builders. Subclasses override resolveTemplate().
|
|
12
|
+
* Use new WhateverBuilder().setContext(context) for registration with add* methods.
|
|
13
|
+
* Deps logic (getTangoDependencyEntries, getTangoDevDependencyEntries) and version live here.
|
|
14
|
+
*/
|
|
15
|
+
declare abstract class TemplateBuilder implements BoundTemplate {
|
|
16
|
+
protected readonly name: string;
|
|
17
|
+
protected _context?: FrameworkScaffoldContext;
|
|
18
|
+
constructor(options: {
|
|
19
|
+
name: string;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* One-liner to install Tango + dialect deps and Tango CLI (for init success message).
|
|
23
|
+
*/
|
|
24
|
+
static getTangoInstallOneLiner(packageManager: PackageManager, dialect: 'sqlite' | 'postgres', framework: 'express' | 'next' | 'nuxt'): string;
|
|
25
|
+
static getRunScriptCommand(packageManager: PackageManager, scriptName: string, scriptArgs?: readonly string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Shorthand for static content (no subclass needed). Returns a BoundTemplate that add* methods accept.
|
|
28
|
+
*/
|
|
29
|
+
static createStaticTemplate(fileName: string, template: string | (() => string)): TemplateBuilder;
|
|
30
|
+
/** Tango package version (semver range) for scaffolded dependency entries. */
|
|
31
|
+
private static getTangoVersion;
|
|
32
|
+
private static getTangoDependencyEntriesFor;
|
|
33
|
+
private static getTangoDevDependencyEntriesFor;
|
|
34
|
+
/** Bind context and return this for chaining. Use before passing to add* methods. */
|
|
35
|
+
setContext(context: FrameworkScaffoldContext): this;
|
|
36
|
+
getPath(): string;
|
|
37
|
+
protected abstract resolveTemplate(context: FrameworkScaffoldContext): string;
|
|
38
|
+
build(): string;
|
|
39
|
+
protected getTangoDependencyEntries(context: FrameworkScaffoldContext): Record<string, string>;
|
|
40
|
+
protected getTangoDevDependencyEntries(_context: FrameworkScaffoldContext): Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/frameworks/contracts/FrameworkScaffoldStrategy.d.ts
|
|
44
|
+
declare const SUPPORTED_FRAMEWORK: {
|
|
45
|
+
readonly EXPRESS: "express";
|
|
46
|
+
readonly NEXT: "next";
|
|
47
|
+
readonly NUXT: "nuxt";
|
|
48
|
+
};
|
|
49
|
+
type SupportedFramework = (typeof SUPPORTED_FRAMEWORK)[keyof typeof SUPPORTED_FRAMEWORK];
|
|
50
|
+
declare const PACKAGE_MANAGER: {
|
|
51
|
+
readonly PNPM: "pnpm";
|
|
52
|
+
readonly NPM: "npm";
|
|
53
|
+
readonly YARN: "yarn";
|
|
54
|
+
readonly BUN: "bun";
|
|
55
|
+
};
|
|
56
|
+
type PackageManager = (typeof PACKAGE_MANAGER)[keyof typeof PACKAGE_MANAGER];
|
|
57
|
+
declare const SCAFFOLD_DATABASE_DIALECT: {
|
|
58
|
+
readonly SQLITE: "sqlite";
|
|
59
|
+
readonly POSTGRES: "postgres";
|
|
60
|
+
};
|
|
61
|
+
type ScaffoldDatabaseDialect = (typeof SCAFFOLD_DATABASE_DIALECT)[keyof typeof SCAFFOLD_DATABASE_DIALECT];
|
|
62
|
+
/**
|
|
63
|
+
* Base scaffold strategy contract and helpers for Tango framework scaffolds.
|
|
64
|
+
*
|
|
65
|
+
* Concrete strategies extend this class and assemble their template lists
|
|
66
|
+
* through the protected helpers below.
|
|
67
|
+
*/
|
|
68
|
+
declare abstract class FrameworkScaffoldStrategy {
|
|
69
|
+
abstract readonly id: SupportedFramework;
|
|
70
|
+
abstract readonly name: string;
|
|
71
|
+
abstract readonly description: string;
|
|
72
|
+
/**
|
|
73
|
+
* One-liner to install Tango + dialect deps and Tango CLI, for init success message.
|
|
74
|
+
*/
|
|
75
|
+
getTangoInstallOneLiner(packageManager: PackageManager, context: FrameworkScaffoldContext): string;
|
|
76
|
+
abstract getTemplates(): readonly ScaffoldTemplate[];
|
|
77
|
+
protected addFrameworkTemplate(template: TemplateBuilder): ScaffoldTemplate;
|
|
78
|
+
protected addTangoTemplate(template: TemplateBuilder): ScaffoldTemplate;
|
|
79
|
+
protected addInitOnlyTemplate(template: TemplateBuilder): ScaffoldTemplate;
|
|
80
|
+
private createTemplate;
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/frameworks/contracts/template/ScaffoldTemplate.d.ts
|
|
84
|
+
declare const SCAFFOLD_TEMPLATE_CATEGORY: {
|
|
85
|
+
readonly FRAMEWORK: "framework";
|
|
86
|
+
readonly TANGO: "tango";
|
|
87
|
+
readonly INIT_ONLY: "init-only";
|
|
88
|
+
};
|
|
89
|
+
type ScaffoldTemplateCategory = (typeof SCAFFOLD_TEMPLATE_CATEGORY)[keyof typeof SCAFFOLD_TEMPLATE_CATEGORY];
|
|
90
|
+
type ScaffoldMode = 'new' | 'init';
|
|
91
|
+
type FrameworkScaffoldContext = {
|
|
92
|
+
projectName: string;
|
|
93
|
+
targetDir: string;
|
|
94
|
+
framework: SupportedFramework;
|
|
95
|
+
packageManager: PackageManager;
|
|
96
|
+
dialect: ScaffoldDatabaseDialect;
|
|
97
|
+
includeSeed: boolean;
|
|
98
|
+
};
|
|
99
|
+
interface ScaffoldTemplate {
|
|
100
|
+
readonly path: string;
|
|
101
|
+
readonly category: ScaffoldTemplateCategory;
|
|
102
|
+
render(ctx: FrameworkScaffoldContext): string;
|
|
103
|
+
shouldEmit(mode: ScaffoldMode): boolean;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/frameworks/contracts/template/implementation/ScaffoldTemplateDescriptor.d.ts
|
|
107
|
+
declare class ScaffoldTemplateDescriptor implements ScaffoldTemplate {
|
|
108
|
+
readonly template: TemplateBuilder;
|
|
109
|
+
readonly category: ScaffoldTemplateCategory;
|
|
110
|
+
constructor(template: TemplateBuilder, category: ScaffoldTemplateCategory);
|
|
111
|
+
get path(): string;
|
|
112
|
+
render(ctx: FrameworkScaffoldContext): string;
|
|
113
|
+
shouldEmit(mode: ScaffoldMode): boolean;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/frameworks/registry/FrameworkScaffoldRegistry.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Registry for framework scaffolding strategies keyed by framework id.
|
|
119
|
+
*/
|
|
120
|
+
declare class FrameworkScaffoldRegistry {
|
|
121
|
+
private readonly strategies;
|
|
122
|
+
/**
|
|
123
|
+
* Create a registry preloaded with Tango's built-in framework scaffolds.
|
|
124
|
+
*/
|
|
125
|
+
static createDefault(): FrameworkScaffoldRegistry;
|
|
126
|
+
/**
|
|
127
|
+
* Register a strategy under its declared framework id.
|
|
128
|
+
*/
|
|
129
|
+
register(strategy: FrameworkScaffoldStrategy): void;
|
|
130
|
+
/**
|
|
131
|
+
* Resolve a strategy for a known framework id.
|
|
132
|
+
*/
|
|
133
|
+
get(id: SupportedFramework): FrameworkScaffoldStrategy | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* List all registered framework strategies in registration order.
|
|
136
|
+
*/
|
|
137
|
+
list(): readonly FrameworkScaffoldStrategy[];
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/frameworks/strategies/express/ExpressScaffoldStrategy.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Scaffold strategy for creating an Express-hosted Tango project.
|
|
143
|
+
*/
|
|
144
|
+
declare class ExpressScaffoldStrategy extends FrameworkScaffoldStrategy {
|
|
145
|
+
readonly id: "express";
|
|
146
|
+
readonly name = "Express";
|
|
147
|
+
readonly description = "Bootstrap a Tango application hosted by Express.";
|
|
148
|
+
/**
|
|
149
|
+
* Return the file templates needed for the generated Express project.
|
|
150
|
+
*/
|
|
151
|
+
getTemplates(): readonly ScaffoldTemplate[];
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/frameworks/strategies/next/NextScaffoldStrategy.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Scaffold strategy for creating a Next.js-hosted Tango project.
|
|
157
|
+
*/
|
|
158
|
+
declare class NextScaffoldStrategy extends FrameworkScaffoldStrategy {
|
|
159
|
+
readonly id: "next";
|
|
160
|
+
readonly name = "Next.js";
|
|
161
|
+
readonly description = "Bootstrap a Tango application hosted by Next.js App Router.";
|
|
162
|
+
/**
|
|
163
|
+
* Return the file templates needed for the generated Next.js project.
|
|
164
|
+
*/
|
|
165
|
+
getTemplates(): readonly ScaffoldTemplate[];
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/frameworks/strategies/nuxt/NuxtScaffoldStrategy.d.ts
|
|
169
|
+
/**
|
|
170
|
+
* Scaffold strategy for creating a Nuxt-hosted Tango project.
|
|
171
|
+
*/
|
|
172
|
+
declare class NuxtScaffoldStrategy extends FrameworkScaffoldStrategy {
|
|
173
|
+
readonly id: "nuxt";
|
|
174
|
+
readonly name = "Nuxt";
|
|
175
|
+
readonly description = "Bootstrap a Tango application hosted by Nuxt Nitro and SSR pages.";
|
|
176
|
+
/**
|
|
177
|
+
* Return the file templates needed for the generated Nuxt project.
|
|
178
|
+
*/
|
|
179
|
+
getTemplates(): readonly ScaffoldTemplate[];
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/frameworks/scaffold/scaffoldProject.d.ts
|
|
183
|
+
type ScaffoldProjectOptions = {
|
|
184
|
+
force?: boolean; /** 'new' = full scaffold; 'init' = only Tango + init-only files. Default 'new'. */
|
|
185
|
+
mode?: ScaffoldMode; /** When true, do not overwrite existing files. Default true when mode === 'init', otherwise false. */
|
|
186
|
+
skipExisting?: boolean;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Write a framework scaffold into a target directory after basic safety checks.
|
|
190
|
+
*
|
|
191
|
+
* The selected strategy controls which files are created, while this helper
|
|
192
|
+
* owns directory validation and filesystem writes. With mode 'init', only
|
|
193
|
+
* Tango and init-only templates are emitted, and existing files can be skipped.
|
|
194
|
+
*/
|
|
195
|
+
declare function scaffoldProject(context: FrameworkScaffoldContext, strategy: FrameworkScaffoldStrategy, options?: ScaffoldProjectOptions): Promise<void>;
|
|
196
|
+
declare namespace index_d_exports {
|
|
197
|
+
export { ExpressScaffoldStrategy, FrameworkScaffoldContext, FrameworkScaffoldRegistry, FrameworkScaffoldStrategy, NextScaffoldStrategy, NuxtScaffoldStrategy, PackageManager, SCAFFOLD_TEMPLATE_CATEGORY, ScaffoldDatabaseDialect as ScaffoldDialect, ScaffoldMode, ScaffoldProjectOptions, ScaffoldTemplate, ScaffoldTemplateCategory, ScaffoldTemplateDescriptor, SupportedFramework, scaffoldProject };
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
export { SupportedFramework as _, NextScaffoldStrategy as a, ScaffoldTemplateDescriptor as c, ScaffoldMode as d, ScaffoldTemplate as f, ScaffoldDatabaseDialect as g, PackageManager as h, NuxtScaffoldStrategy as i, FrameworkScaffoldContext as l, FrameworkScaffoldStrategy as m, ScaffoldProjectOptions as n, ExpressScaffoldStrategy as o, ScaffoldTemplateCategory as p, scaffoldProject as r, FrameworkScaffoldRegistry as s, index_d_exports as t, SCAFFOLD_TEMPLATE_CATEGORY as u };
|
|
201
|
+
//# sourceMappingURL=index-DDt-Xe7q.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ModelRegistry } from "@danceroutine/tango-schema";
|
|
2
|
+
import { Argv } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/registerCodegenCommands.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Register Tango project scaffolding commands on an existing CLI parser.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerCodegenCommands(parser: Argv): Argv;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/commands/loadProjectModule.d.ts
|
|
11
|
+
type ProjectModuleLoadResult = {
|
|
12
|
+
loaded: Record<string, unknown>;
|
|
13
|
+
modelTypeAccessors: Record<string, string>;
|
|
14
|
+
registry: ModelRegistry;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Load a Tango app module and discover model export accessors suitable for
|
|
18
|
+
* generated ambient type references.
|
|
19
|
+
*/
|
|
20
|
+
declare function loadProjectModule(modulePath: string, options?: {
|
|
21
|
+
projectRoot?: string;
|
|
22
|
+
outputDir?: string;
|
|
23
|
+
}): Promise<ProjectModuleLoadResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/commands/runGenerateRelationsCommand.d.ts
|
|
26
|
+
type GenerateRelationsCommandArgs = {
|
|
27
|
+
models: string;
|
|
28
|
+
outDir: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Generate the app-local ambient relation registry from a finalized model graph.
|
|
32
|
+
*/
|
|
33
|
+
declare function runGenerateRelationsCommand({
|
|
34
|
+
models,
|
|
35
|
+
outDir
|
|
36
|
+
}: GenerateRelationsCommandArgs): Promise<void>;
|
|
37
|
+
declare function withGenerateRelationsCommand(parser: Argv): Argv;
|
|
38
|
+
declare namespace index_d_exports {
|
|
39
|
+
export { loadProjectModule, registerCodegenCommands, runGenerateRelationsCommand, withGenerateRelationsCommand };
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { registerCodegenCommands as a, loadProjectModule as i, runGenerateRelationsCommand as n, withGenerateRelationsCommand as r, index_d_exports as t };
|
|
43
|
+
//# sourceMappingURL=index-DM7Ade2V.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { r as CodegenModel } from "./index-sKndVpFf.js";
|
|
2
|
+
import { GeneratedRelationRegistryArtifact, ModelRegistry, ResolvedRelationGraphSnapshot } from "@danceroutine/tango-schema";
|
|
3
|
+
|
|
4
|
+
//#region src/generators/migration/generateMigrationFromModels.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generate a class-based Tango migration source file from model metadata.
|
|
7
|
+
*
|
|
8
|
+
* The generated migration creates one table per model in `up()` and drops
|
|
9
|
+
* those tables in reverse order in `down()` to keep teardown deterministic.
|
|
10
|
+
*/
|
|
11
|
+
declare function generateMigrationFromModels(models: CodegenModel[]): string;
|
|
12
|
+
declare namespace index_d_exports$4 {
|
|
13
|
+
export { generateMigrationFromModels };
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/generators/model/generateModelInterface.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Generate a TypeScript interface string from a Tango codegen model.
|
|
19
|
+
*/
|
|
20
|
+
declare function generateModelInterface(model: CodegenModel): string;
|
|
21
|
+
declare namespace index_d_exports$3 {
|
|
22
|
+
export { generateModelInterface };
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/generators/relations/generateRelationRegistryArtifacts.d.ts
|
|
26
|
+
type GenerateRelationRegistryArtifactsInput = {
|
|
27
|
+
snapshot: ResolvedRelationGraphSnapshot;
|
|
28
|
+
fingerprint: string;
|
|
29
|
+
modelTypeAccessors: Readonly<Record<string, string>>;
|
|
30
|
+
};
|
|
31
|
+
type GeneratedRelationRegistryArtifacts = {
|
|
32
|
+
declaration: string;
|
|
33
|
+
metadata: GeneratedRelationRegistryArtifact;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Generate the ambient relation registry declaration and metadata payload from
|
|
37
|
+
* a finalized relation-graph snapshot.
|
|
38
|
+
*/
|
|
39
|
+
declare function generateRelationRegistryArtifacts({
|
|
40
|
+
snapshot,
|
|
41
|
+
fingerprint,
|
|
42
|
+
modelTypeAccessors
|
|
43
|
+
}: GenerateRelationRegistryArtifactsInput): GeneratedRelationRegistryArtifacts;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/generators/relations/writeRelationRegistryArtifacts.d.ts
|
|
46
|
+
type WriteRelationRegistryArtifactsInput = {
|
|
47
|
+
registry: ModelRegistry;
|
|
48
|
+
modelTypeAccessors: Readonly<Record<string, string>>;
|
|
49
|
+
outputDir?: string;
|
|
50
|
+
};
|
|
51
|
+
type WrittenRelationRegistryArtifacts = {
|
|
52
|
+
outputDir: string;
|
|
53
|
+
typesFilepath: string;
|
|
54
|
+
metadataFilepath: string;
|
|
55
|
+
fingerprint: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Write the generated relation typing declaration and metadata files to disk.
|
|
59
|
+
*/
|
|
60
|
+
declare function writeRelationRegistryArtifacts({
|
|
61
|
+
registry,
|
|
62
|
+
modelTypeAccessors,
|
|
63
|
+
outputDir
|
|
64
|
+
}: WriteRelationRegistryArtifactsInput): Promise<WrittenRelationRegistryArtifacts>;
|
|
65
|
+
declare namespace index_d_exports$2 {
|
|
66
|
+
export { GenerateRelationRegistryArtifactsInput, GeneratedRelationRegistryArtifacts, WriteRelationRegistryArtifactsInput, WrittenRelationRegistryArtifacts, generateRelationRegistryArtifacts, writeRelationRegistryArtifacts };
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/generators/viewset/generateViewSet.d.ts
|
|
70
|
+
/**
|
|
71
|
+
* Generate a `ModelViewSet` scaffold wired directly to a Tango model.
|
|
72
|
+
*/
|
|
73
|
+
declare function generateViewSet(modelName: string): string;
|
|
74
|
+
declare namespace index_d_exports$1 {
|
|
75
|
+
export { generateViewSet };
|
|
76
|
+
}
|
|
77
|
+
declare namespace index_d_exports {
|
|
78
|
+
export { generateMigrationFromModels, generateModelInterface, generateRelationRegistryArtifacts, generateViewSet, index_d_exports$4 as migration, index_d_exports$3 as model, index_d_exports$2 as relations, index_d_exports$1 as viewset, writeRelationRegistryArtifacts };
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { writeRelationRegistryArtifacts as a, generateModelInterface as c, index_d_exports$2 as i, index_d_exports$4 as l, index_d_exports$1 as n, generateRelationRegistryArtifacts as o, generateViewSet as r, index_d_exports$3 as s, index_d_exports as t, generateMigrationFromModels as u };
|
|
82
|
+
//# sourceMappingURL=index-XicN3qCI.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/domain/CodegenModel.d.ts
|
|
2
|
+
type CodegenFieldMeta = {
|
|
3
|
+
type: string;
|
|
4
|
+
dbType?: string;
|
|
5
|
+
primaryKey?: boolean;
|
|
6
|
+
unique?: boolean;
|
|
7
|
+
nullable?: boolean;
|
|
8
|
+
default?: unknown;
|
|
9
|
+
};
|
|
10
|
+
type CodegenModel = {
|
|
11
|
+
name: string;
|
|
12
|
+
fields: Record<string, CodegenFieldMeta> | Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
primaryKey?: boolean;
|
|
16
|
+
unique?: boolean;
|
|
17
|
+
notNull?: boolean;
|
|
18
|
+
default?: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
declare namespace index_d_exports {
|
|
22
|
+
export { CodegenFieldMeta, CodegenModel };
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CodegenFieldMeta as n, CodegenModel as r, index_d_exports as t };
|
|
26
|
+
//# sourceMappingURL=index-sKndVpFf.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import { a as registerCodegenCommands, i as loadProjectModule, n as runGenerateRelationsCommand, t as index_d_exports } from "./index-DM7Ade2V.js";
|
|
2
|
+
import { n as CodegenFieldMeta, r as CodegenModel, t as index_d_exports$1 } from "./index-sKndVpFf.js";
|
|
3
|
+
import { _ as SupportedFramework, a as NextScaffoldStrategy, g as ScaffoldDatabaseDialect, h as PackageManager, i as NuxtScaffoldStrategy, l as FrameworkScaffoldContext, m as FrameworkScaffoldStrategy, o as ExpressScaffoldStrategy, r as scaffoldProject, s as FrameworkScaffoldRegistry, t as index_d_exports$2 } from "./index-DDt-Xe7q.js";
|
|
4
|
+
import { a as writeRelationRegistryArtifacts, c as generateModelInterface, o as generateRelationRegistryArtifacts, r as generateViewSet, t as index_d_exports$3, u as generateMigrationFromModels } from "./index-XicN3qCI.js";
|
|
5
|
+
|
|
6
|
+
//#region src/mappers/fieldType.d.ts
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
3
|
-
* top-level symbols for TS-native ergonomic imports.
|
|
8
|
+
* Map Tango field metadata to the TypeScript type used in generated source.
|
|
4
9
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type
|
|
15
|
-
|
|
10
|
+
declare function mapFieldTypeToTS(type: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Normalize field metadata into a stable iterable shape for generators.
|
|
13
|
+
*/
|
|
14
|
+
declare function normalizeFields(fields: CodegenModel['fields']): Array<[string, CodegenFieldMeta]>;
|
|
15
|
+
declare namespace index_d_exports$4 {
|
|
16
|
+
export { mapFieldTypeToTS, normalizeFields };
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { type CodegenFieldMeta, type CodegenModel, ExpressScaffoldStrategy, type FrameworkScaffoldContext, FrameworkScaffoldRegistry, type FrameworkScaffoldStrategy, NextScaffoldStrategy, NuxtScaffoldStrategy, type PackageManager, type ScaffoldDatabaseDialect as ScaffoldDialect, type SupportedFramework, index_d_exports as commands, index_d_exports$1 as domain, index_d_exports$2 as frameworks, generateMigrationFromModels, generateModelInterface, generateRelationRegistryArtifacts, generateViewSet, index_d_exports$3 as generators, loadProjectModule, mapFieldTypeToTS, index_d_exports$4 as mappers, normalizeFields, registerCodegenCommands, runGenerateRelationsCommand, scaffoldProject, writeRelationRegistryArtifacts };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { domain_exports } from "./domain
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export { ExpressScaffoldStrategy, FrameworkScaffoldRegistry, NextScaffoldStrategy, NuxtScaffoldStrategy, commands_exports as commands, domain_exports as domain, frameworks_exports as frameworks, generateMigrationFromModels, generateModelInterface, generateRelationRegistryArtifacts, generateViewSet, generators_exports as generators, loadProjectModule, mapFieldTypeToTS, mappers_exports as mappers, normalizeFields, registerCodegenCommands, runGenerateRelationsCommand, scaffoldProject, writeRelationRegistryArtifacts };
|
|
1
|
+
import { t as domain_exports } from "./domain/index.js";
|
|
2
|
+
import { a as generateModelInterface, c as mappers_exports, l as mapFieldTypeToTS, r as generateViewSet, s as generateMigrationFromModels, t as generators_exports, u as normalizeFields } from "./generators-D7GoehXD.js";
|
|
3
|
+
import { n as writeRelationRegistryArtifacts, r as generateRelationRegistryArtifacts } from "./relations-tePbGOWl.js";
|
|
4
|
+
import { a as NextScaffoldStrategy, i as NuxtScaffoldStrategy, n as scaffoldProject, o as ExpressScaffoldStrategy, r as FrameworkScaffoldRegistry, t as frameworks_exports } from "./frameworks-DcmEvb3N.js";
|
|
5
|
+
import { a as loadProjectModule, n as registerCodegenCommands, r as runGenerateRelationsCommand, t as commands_exports } from "./commands-pbMmQ_tn.js";
|
|
6
|
+
export { ExpressScaffoldStrategy, FrameworkScaffoldRegistry, NextScaffoldStrategy, NuxtScaffoldStrategy, commands_exports as commands, domain_exports as domain, frameworks_exports as frameworks, generateMigrationFromModels, generateModelInterface, generateRelationRegistryArtifacts, generateViewSet, generators_exports as generators, loadProjectModule, mapFieldTypeToTS, mappers_exports as mappers, normalizeFields, registerCodegenCommands, runGenerateRelationsCommand, scaffoldProject, writeRelationRegistryArtifacts };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
2
2
|
import { GENERATED_RELATION_REGISTRY_DIRNAME, GENERATED_RELATION_REGISTRY_METADATA_FILENAME, GENERATED_RELATION_REGISTRY_METADATA_VERSION, GENERATED_RELATION_REGISTRY_TYPES_FILENAME, ImplicitManyToManyIdentifier } from "@danceroutine/tango-schema";
|
|
3
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
-
|
|
6
5
|
//#region src/generators/relations/generateRelationRegistryArtifacts.ts
|
|
6
|
+
/**
|
|
7
|
+
* Generate the ambient relation registry declaration and metadata payload from
|
|
8
|
+
* a finalized relation-graph snapshot.
|
|
9
|
+
*/
|
|
7
10
|
function generateRelationRegistryArtifacts({ snapshot, fingerprint, modelTypeAccessors }) {
|
|
8
11
|
const publicModels = snapshot.models.filter((model) => !ImplicitManyToManyIdentifier.isImplicitManyToManyModel(model.key));
|
|
9
12
|
for (const model of publicModels) for (const relation of model.relations) {
|
|
@@ -11,29 +14,28 @@ function generateRelationRegistryArtifacts({ snapshot, fingerprint, modelTypeAcc
|
|
|
11
14
|
if (!relation.capabilities.hydratable) continue;
|
|
12
15
|
if (!modelTypeAccessors[relation.targetModelKey]) throw new Error(`Unable to generate relation typing for '${relation.targetModelKey}'. Ensure the models module exports that model directly or through a one-level object export.`);
|
|
13
16
|
}
|
|
14
|
-
const declarationLines = [
|
|
15
|
-
"/**",
|
|
16
|
-
" * Generated by `tango codegen relations`.",
|
|
17
|
-
" * Do not edit this file directly.",
|
|
18
|
-
" */",
|
|
19
|
-
"declare global {",
|
|
20
|
-
" interface TangoGeneratedRelationRegistry {",
|
|
21
|
-
...publicModels.map((model) => {
|
|
22
|
-
const hydratableRelations = model.relations.filter((relation) => relation.capabilities.hydratable && !ImplicitManyToManyIdentifier.isImplicitManyToManyModel(relation.targetModelKey));
|
|
23
|
-
const relationLines = hydratableRelations.length === 0 ? [" [key: string]: never;"] : hydratableRelations.map((relation) => ` ${JSON.stringify(relation.name)}: { target: ${modelTypeAccessors[relation.targetModelKey]}; cardinality: ${JSON.stringify(relation.cardinality)}; kind: ${JSON.stringify(relation.kind)} };`);
|
|
24
|
-
return [
|
|
25
|
-
` ${JSON.stringify(model.key)}: {`,
|
|
26
|
-
...relationLines,
|
|
27
|
-
" };"
|
|
28
|
-
].join("\n");
|
|
29
|
-
}),
|
|
30
|
-
" }",
|
|
31
|
-
"}",
|
|
32
|
-
"export type __TangoGeneratedRelationRegistryModule = TangoGeneratedRelationRegistry;",
|
|
33
|
-
""
|
|
34
|
-
];
|
|
35
17
|
return {
|
|
36
|
-
declaration:
|
|
18
|
+
declaration: [
|
|
19
|
+
"/**",
|
|
20
|
+
" * Generated by `tango codegen relations`.",
|
|
21
|
+
" * Do not edit this file directly.",
|
|
22
|
+
" */",
|
|
23
|
+
"declare global {",
|
|
24
|
+
" interface TangoGeneratedRelationRegistry {",
|
|
25
|
+
...publicModels.map((model) => {
|
|
26
|
+
const hydratableRelations = model.relations.filter((relation) => relation.capabilities.hydratable && !ImplicitManyToManyIdentifier.isImplicitManyToManyModel(relation.targetModelKey));
|
|
27
|
+
const relationLines = hydratableRelations.length === 0 ? [" [key: string]: never;"] : hydratableRelations.map((relation) => ` ${JSON.stringify(relation.name)}: { target: ${modelTypeAccessors[relation.targetModelKey]}; cardinality: ${JSON.stringify(relation.cardinality)}; kind: ${JSON.stringify(relation.kind)} };`);
|
|
28
|
+
return [
|
|
29
|
+
` ${JSON.stringify(model.key)}: {`,
|
|
30
|
+
...relationLines,
|
|
31
|
+
" };"
|
|
32
|
+
].join("\n");
|
|
33
|
+
}),
|
|
34
|
+
" }",
|
|
35
|
+
"}",
|
|
36
|
+
"export type __TangoGeneratedRelationRegistryModule = TangoGeneratedRelationRegistry;",
|
|
37
|
+
""
|
|
38
|
+
].join("\n"),
|
|
37
39
|
metadata: {
|
|
38
40
|
version: GENERATED_RELATION_REGISTRY_METADATA_VERSION,
|
|
39
41
|
fingerprint,
|
|
@@ -41,9 +43,11 @@ function generateRelationRegistryArtifacts({ snapshot, fingerprint, modelTypeAcc
|
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
|
|
45
46
|
//#endregion
|
|
46
47
|
//#region src/generators/relations/writeRelationRegistryArtifacts.ts
|
|
48
|
+
/**
|
|
49
|
+
* Write the generated relation typing declaration and metadata files to disk.
|
|
50
|
+
*/
|
|
47
51
|
async function writeRelationRegistryArtifacts({ registry, modelTypeAccessors, outputDir = resolve(process.cwd(), GENERATED_RELATION_REGISTRY_DIRNAME) }) {
|
|
48
52
|
const snapshot = registry.getResolvedRelationGraphSnapshot();
|
|
49
53
|
const fingerprint = registry.getResolvedRelationGraphFingerprint();
|
|
@@ -64,15 +68,13 @@ async function writeRelationRegistryArtifacts({ registry, modelTypeAccessors, ou
|
|
|
64
68
|
fingerprint
|
|
65
69
|
};
|
|
66
70
|
}
|
|
67
|
-
|
|
68
71
|
//#endregion
|
|
69
72
|
//#region src/generators/relations/index.ts
|
|
70
|
-
var relations_exports = {
|
|
71
|
-
__export(relations_exports, {
|
|
73
|
+
var relations_exports = /* @__PURE__ */ __exportAll({
|
|
72
74
|
generateRelationRegistryArtifacts: () => generateRelationRegistryArtifacts,
|
|
73
75
|
writeRelationRegistryArtifacts: () => writeRelationRegistryArtifacts
|
|
74
76
|
});
|
|
75
|
-
|
|
76
77
|
//#endregion
|
|
77
|
-
export { generateRelationRegistryArtifacts, relations_exports
|
|
78
|
-
|
|
78
|
+
export { writeRelationRegistryArtifacts as n, generateRelationRegistryArtifacts as r, relations_exports as t };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=relations-tePbGOWl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations-tePbGOWl.js","names":[],"sources":["../src/generators/relations/generateRelationRegistryArtifacts.ts","../src/generators/relations/writeRelationRegistryArtifacts.ts","../src/generators/relations/index.ts"],"sourcesContent":["import {\n GENERATED_RELATION_REGISTRY_METADATA_VERSION,\n ImplicitManyToManyIdentifier,\n type GeneratedRelationRegistryArtifact,\n type ResolvedRelationGraphSnapshot,\n} from '@danceroutine/tango-schema';\n\nexport type GenerateRelationRegistryArtifactsInput = {\n snapshot: ResolvedRelationGraphSnapshot;\n fingerprint: string;\n modelTypeAccessors: Readonly<Record<string, string>>;\n};\n\nexport type GeneratedRelationRegistryArtifacts = {\n declaration: string;\n metadata: GeneratedRelationRegistryArtifact;\n};\n\n/**\n * Generate the ambient relation registry declaration and metadata payload from\n * a finalized relation-graph snapshot.\n */\nexport function generateRelationRegistryArtifacts({\n snapshot,\n fingerprint,\n modelTypeAccessors,\n}: GenerateRelationRegistryArtifactsInput): GeneratedRelationRegistryArtifacts {\n const publicModels = snapshot.models.filter(\n (model) => !ImplicitManyToManyIdentifier.isImplicitManyToManyModel(model.key)\n );\n\n for (const model of publicModels) {\n for (const relation of model.relations) {\n if (ImplicitManyToManyIdentifier.isImplicitManyToManyModel(relation.targetModelKey)) {\n continue;\n }\n if (!relation.capabilities.hydratable) {\n continue;\n }\n if (!modelTypeAccessors[relation.targetModelKey]) {\n throw new Error(\n `Unable to generate relation typing for '${relation.targetModelKey}'. Ensure the models module exports that model directly or through a one-level object export.`\n );\n }\n }\n }\n\n const declarationLines = [\n '/**',\n ' * Generated by `tango codegen relations`.',\n ' * Do not edit this file directly.',\n ' */',\n 'declare global {',\n ' interface TangoGeneratedRelationRegistry {',\n ...publicModels.map((model: ResolvedRelationGraphSnapshot['models'][number]) => {\n const hydratableRelations = model.relations.filter(\n (relation) =>\n relation.capabilities.hydratable &&\n !ImplicitManyToManyIdentifier.isImplicitManyToManyModel(relation.targetModelKey)\n );\n const relationLines =\n hydratableRelations.length === 0\n ? [' [key: string]: never;']\n : hydratableRelations.map(\n (relation: ResolvedRelationGraphSnapshot['models'][number]['relations'][number]) =>\n ` ${JSON.stringify(relation.name)}: { target: ${modelTypeAccessors[relation.targetModelKey]}; cardinality: ${JSON.stringify(relation.cardinality)}; kind: ${JSON.stringify(relation.kind)} };`\n );\n\n return [` ${JSON.stringify(model.key)}: {`, ...relationLines, ' };'].join('\\n');\n }),\n ' }',\n '}',\n 'export type __TangoGeneratedRelationRegistryModule = TangoGeneratedRelationRegistry;',\n '',\n ];\n\n return {\n declaration: declarationLines.join('\\n'),\n metadata: {\n version: GENERATED_RELATION_REGISTRY_METADATA_VERSION,\n fingerprint,\n snapshot,\n },\n };\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport {\n GENERATED_RELATION_REGISTRY_DIRNAME,\n GENERATED_RELATION_REGISTRY_METADATA_FILENAME,\n GENERATED_RELATION_REGISTRY_TYPES_FILENAME,\n type ModelRegistry,\n} from '@danceroutine/tango-schema';\nimport { generateRelationRegistryArtifacts } from './generateRelationRegistryArtifacts';\n\nexport type WriteRelationRegistryArtifactsInput = {\n registry: ModelRegistry;\n modelTypeAccessors: Readonly<Record<string, string>>;\n outputDir?: string;\n};\n\nexport type WrittenRelationRegistryArtifacts = {\n outputDir: string;\n typesFilepath: string;\n metadataFilepath: string;\n fingerprint: string;\n};\n\n/**\n * Write the generated relation typing declaration and metadata files to disk.\n */\nexport async function writeRelationRegistryArtifacts({\n registry,\n modelTypeAccessors,\n outputDir = resolve(process.cwd(), GENERATED_RELATION_REGISTRY_DIRNAME),\n}: WriteRelationRegistryArtifactsInput): Promise<WrittenRelationRegistryArtifacts> {\n const snapshot = registry.getResolvedRelationGraphSnapshot();\n const fingerprint = registry.getResolvedRelationGraphFingerprint();\n const artifacts = generateRelationRegistryArtifacts({\n snapshot,\n fingerprint,\n modelTypeAccessors,\n });\n\n await mkdir(outputDir, { recursive: true });\n\n const typesFilepath = resolve(outputDir, GENERATED_RELATION_REGISTRY_TYPES_FILENAME);\n const metadataFilepath = resolve(outputDir, GENERATED_RELATION_REGISTRY_METADATA_FILENAME);\n\n await writeFile(typesFilepath, artifacts.declaration, 'utf8');\n await writeFile(metadataFilepath, `${JSON.stringify(artifacts.metadata, null, 2)}\\n`, 'utf8');\n\n return {\n outputDir,\n typesFilepath,\n metadataFilepath,\n fingerprint,\n };\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport {\n generateRelationRegistryArtifacts,\n type GenerateRelationRegistryArtifactsInput,\n type GeneratedRelationRegistryArtifacts,\n} from './generateRelationRegistryArtifacts';\nexport {\n writeRelationRegistryArtifacts,\n type WriteRelationRegistryArtifactsInput,\n type WrittenRelationRegistryArtifacts,\n} from './writeRelationRegistryArtifacts';\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,kCAAkC,EAC9C,UACA,aACA,sBAC2E;CAC3E,MAAM,eAAe,SAAS,OAAO,QAChC,UAAU,CAAC,6BAA6B,0BAA0B,MAAM,GAAG,CAChF;CAEA,KAAK,MAAM,SAAS,cAChB,KAAK,MAAM,YAAY,MAAM,WAAW;EACpC,IAAI,6BAA6B,0BAA0B,SAAS,cAAc,GAC9E;EAEJ,IAAI,CAAC,SAAS,aAAa,YACvB;EAEJ,IAAI,CAAC,mBAAmB,SAAS,iBAC7B,MAAM,IAAI,MACN,2CAA2C,SAAS,eAAe,8FACvE;CAER;CAgCJ,OAAO;EACH,aAAa;GA7Bb;GACA;GACA;GACA;GACA;GACA;GACA,GAAG,aAAa,KAAK,UAA2D;IAC5E,MAAM,sBAAsB,MAAM,UAAU,QACvC,aACG,SAAS,aAAa,cACtB,CAAC,6BAA6B,0BAA0B,SAAS,cAAc,CACvF;IACA,MAAM,gBACF,oBAAoB,WAAW,IACzB,CAAC,mCAAmC,IACpC,oBAAoB,KACf,aACG,eAAe,KAAK,UAAU,SAAS,IAAI,EAAE,cAAc,mBAAmB,SAAS,gBAAgB,iBAAiB,KAAK,UAAU,SAAS,WAAW,EAAE,UAAU,KAAK,UAAU,SAAS,IAAI,EAAE,IAC7M;IAEV,OAAO;KAAC,WAAW,KAAK,UAAU,MAAM,GAAG,EAAE;KAAM,GAAG;KAAe;IAAY,EAAE,KAAK,IAAI;GAChG,CAAC;GACD;GACA;GACA;GACA;EAI4B,EAAE,KAAK,IAAI;EACvC,UAAU;GACN,SAAS;GACT;GACA;EACJ;CACJ;AACJ;;;;;;AC1DA,eAAsB,+BAA+B,EACjD,UACA,oBACA,YAAY,QAAQ,QAAQ,IAAI,GAAG,mCAAmC,KACS;CAC/E,MAAM,WAAW,SAAS,iCAAiC;CAC3D,MAAM,cAAc,SAAS,oCAAoC;CACjE,MAAM,YAAY,kCAAkC;EAChD;EACA;EACA;CACJ,CAAC;CAED,MAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;CAE1C,MAAM,gBAAgB,QAAQ,WAAW,0CAA0C;CACnF,MAAM,mBAAmB,QAAQ,WAAW,6CAA6C;CAEzF,MAAM,UAAU,eAAe,UAAU,aAAa,MAAM;CAC5D,MAAM,UAAU,kBAAkB,GAAG,KAAK,UAAU,UAAU,UAAU,MAAM,CAAC,EAAE,KAAK,MAAM;CAE5F,OAAO;EACH;EACA;EACA;EACA;CACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danceroutine/tango-codegen",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"description": "CLI for generating repositories, types, migrations, and OpenAPI specs for Tango",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"jiti": "^2.6.1",
|
|
49
49
|
"yargs": "^18.0.0",
|
|
50
|
-
"@danceroutine/tango-core": "1.11.
|
|
51
|
-
"@danceroutine/tango-schema": "1.11.
|
|
50
|
+
"@danceroutine/tango-core": "1.11.2",
|
|
51
|
+
"@danceroutine/tango-schema": "1.11.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/yargs": "^17.0.33",
|
|
55
55
|
"@types/node": "^22.9.0",
|
|
56
|
-
"tsdown": "^0.
|
|
56
|
+
"tsdown": "^0.22.1",
|
|
57
57
|
"typescript": "^5.6.3",
|
|
58
58
|
"vitest": "^4.1.7",
|
|
59
59
|
"zod": "^4.0.0",
|
|
60
|
-
"@danceroutine/tango-testing": "1.11.
|
|
60
|
+
"@danceroutine/tango-testing": "1.11.2"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|
package/dist/chunk-BkvOhyD0.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ModelRegistry } from '@danceroutine/tango-schema';
|
|
2
|
-
type ProjectModuleLoadResult = {
|
|
3
|
-
loaded: Record<string, unknown>;
|
|
4
|
-
modelTypeAccessors: Record<string, string>;
|
|
5
|
-
registry: ModelRegistry;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Load a Tango app module and discover model export accessors suitable for
|
|
9
|
-
* generated ambient type references.
|
|
10
|
-
*/
|
|
11
|
-
export declare function loadProjectModule(modulePath: string, options?: {
|
|
12
|
-
projectRoot?: string;
|
|
13
|
-
outputDir?: string;
|
|
14
|
-
}): Promise<ProjectModuleLoadResult>;
|
|
15
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs';
|
|
2
|
-
type GenerateRelationsCommandArgs = {
|
|
3
|
-
models: string;
|
|
4
|
-
outDir: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Generate the app-local ambient relation registry from a finalized model graph.
|
|
8
|
-
*/
|
|
9
|
-
export declare function runGenerateRelationsCommand({ models, outDir }: GenerateRelationsCommandArgs): Promise<void>;
|
|
10
|
-
export declare function withGenerateRelationsCommand(parser: Argv): Argv;
|
|
11
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type SupportedFramework } from '../frameworks';
|
|
2
|
-
import { type ScaffoldDatabaseDialect } from '../frameworks/contracts/FrameworkScaffoldStrategy';
|
|
3
|
-
import type { Argv } from 'yargs';
|
|
4
|
-
type InitCommandArgs = {
|
|
5
|
-
framework: SupportedFramework;
|
|
6
|
-
path: string;
|
|
7
|
-
dialect: ScaffoldDatabaseDialect;
|
|
8
|
-
skipExisting: boolean;
|
|
9
|
-
force: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function runInitCommand({ framework, path, dialect, skipExisting, force, }: InitCommandArgs): Promise<void>;
|
|
12
|
-
export declare function withInitCommand(parser: Argv): Argv;
|
|
13
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type SupportedFramework, type PackageManager } from '../frameworks';
|
|
2
|
-
import { type ScaffoldDatabaseDialect } from '../frameworks/contracts/FrameworkScaffoldStrategy';
|
|
3
|
-
import type { Argv } from 'yargs';
|
|
4
|
-
type NewCommandArgs = {
|
|
5
|
-
name?: string;
|
|
6
|
-
framework: SupportedFramework;
|
|
7
|
-
path?: string;
|
|
8
|
-
packageManager: PackageManager;
|
|
9
|
-
dialect: ScaffoldDatabaseDialect;
|
|
10
|
-
install: boolean;
|
|
11
|
-
force: boolean;
|
|
12
|
-
seed: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare function runNewCommand({ path, name, framework, packageManager, dialect, install, force, seed: includeSeed, }: NewCommandArgs): Promise<void>;
|
|
15
|
-
export declare function withNewCommand(parser: Argv): Argv;
|
|
16
|
-
export {};
|