@veloxts/cli 0.4.0 → 0.4.1
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/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/generate.d.ts +17 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +219 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/migrate.d.ts +8 -3
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +17 -123
- package/dist/commands/migrate.js.map +1 -1
- package/dist/generators/base.d.ts +76 -0
- package/dist/generators/base.d.ts.map +1 -0
- package/dist/generators/base.js +271 -0
- package/dist/generators/base.js.map +1 -0
- package/dist/generators/generators/index.d.ts +17 -0
- package/dist/generators/generators/index.d.ts.map +1 -0
- package/dist/generators/generators/index.js +43 -0
- package/dist/generators/generators/index.js.map +1 -0
- package/dist/generators/generators/migration.d.ts +43 -0
- package/dist/generators/generators/migration.d.ts.map +1 -0
- package/dist/generators/generators/migration.js +121 -0
- package/dist/generators/generators/migration.js.map +1 -0
- package/dist/generators/generators/model.d.ts +38 -0
- package/dist/generators/generators/model.d.ts.map +1 -0
- package/dist/generators/generators/model.js +108 -0
- package/dist/generators/generators/model.js.map +1 -0
- package/dist/generators/generators/procedure.d.ts +37 -0
- package/dist/generators/generators/procedure.d.ts.map +1 -0
- package/dist/generators/generators/procedure.js +99 -0
- package/dist/generators/generators/procedure.js.map +1 -0
- package/dist/generators/generators/resource.d.ts +29 -0
- package/dist/generators/generators/resource.d.ts.map +1 -0
- package/dist/generators/generators/resource.js +124 -0
- package/dist/generators/generators/resource.js.map +1 -0
- package/dist/generators/generators/schema.d.ts +28 -0
- package/dist/generators/generators/schema.d.ts.map +1 -0
- package/dist/generators/generators/schema.js +83 -0
- package/dist/generators/generators/schema.js.map +1 -0
- package/dist/generators/generators/test.d.ts +28 -0
- package/dist/generators/generators/test.d.ts.map +1 -0
- package/dist/generators/generators/test.js +96 -0
- package/dist/generators/generators/test.js.map +1 -0
- package/dist/generators/index.d.ts +16 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +16 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/registry.d.ts +97 -0
- package/dist/generators/registry.d.ts.map +1 -0
- package/dist/generators/registry.js +253 -0
- package/dist/generators/registry.js.map +1 -0
- package/dist/generators/templates/migration.d.ts +23 -0
- package/dist/generators/templates/migration.d.ts.map +1 -0
- package/dist/generators/templates/migration.js +389 -0
- package/dist/generators/templates/migration.js.map +1 -0
- package/dist/generators/templates/model.d.ts +37 -0
- package/dist/generators/templates/model.d.ts.map +1 -0
- package/dist/generators/templates/model.js +374 -0
- package/dist/generators/templates/model.js.map +1 -0
- package/dist/generators/templates/procedure.d.ts +25 -0
- package/dist/generators/templates/procedure.d.ts.map +1 -0
- package/dist/generators/templates/procedure.js +274 -0
- package/dist/generators/templates/procedure.js.map +1 -0
- package/dist/generators/templates/resource.d.ts +34 -0
- package/dist/generators/templates/resource.d.ts.map +1 -0
- package/dist/generators/templates/resource.js +550 -0
- package/dist/generators/templates/resource.js.map +1 -0
- package/dist/generators/templates/schema.d.ts +33 -0
- package/dist/generators/templates/schema.d.ts.map +1 -0
- package/dist/generators/templates/schema.js +248 -0
- package/dist/generators/templates/schema.js.map +1 -0
- package/dist/generators/templates/test.d.ts +31 -0
- package/dist/generators/templates/test.d.ts.map +1 -0
- package/dist/generators/templates/test.js +882 -0
- package/dist/generators/templates/test.js.map +1 -0
- package/dist/generators/types.d.ts +211 -0
- package/dist/generators/types.d.ts.map +1 -0
- package/dist/generators/types.js +54 -0
- package/dist/generators/types.js.map +1 -0
- package/dist/generators/utils/filesystem.d.ts +68 -0
- package/dist/generators/utils/filesystem.d.ts.map +1 -0
- package/dist/generators/utils/filesystem.js +217 -0
- package/dist/generators/utils/filesystem.js.map +1 -0
- package/dist/generators/utils/naming.d.ts +122 -0
- package/dist/generators/utils/naming.d.ts.map +1 -0
- package/dist/generators/utils/naming.js +198 -0
- package/dist/generators/utils/naming.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations/commands/fresh.d.ts +11 -0
- package/dist/migrations/commands/fresh.d.ts.map +1 -0
- package/dist/migrations/commands/fresh.js +164 -0
- package/dist/migrations/commands/fresh.js.map +1 -0
- package/dist/migrations/commands/index.d.ts +11 -0
- package/dist/migrations/commands/index.d.ts.map +1 -0
- package/dist/migrations/commands/index.js +11 -0
- package/dist/migrations/commands/index.js.map +1 -0
- package/dist/migrations/commands/reset.d.ts +11 -0
- package/dist/migrations/commands/reset.d.ts.map +1 -0
- package/dist/migrations/commands/reset.js +258 -0
- package/dist/migrations/commands/reset.js.map +1 -0
- package/dist/migrations/commands/rollback.d.ts +11 -0
- package/dist/migrations/commands/rollback.d.ts.map +1 -0
- package/dist/migrations/commands/rollback.js +241 -0
- package/dist/migrations/commands/rollback.js.map +1 -0
- package/dist/migrations/commands/run.d.ts +11 -0
- package/dist/migrations/commands/run.d.ts.map +1 -0
- package/dist/migrations/commands/run.js +183 -0
- package/dist/migrations/commands/run.js.map +1 -0
- package/dist/migrations/commands/status.d.ts +11 -0
- package/dist/migrations/commands/status.d.ts.map +1 -0
- package/dist/migrations/commands/status.js +154 -0
- package/dist/migrations/commands/status.js.map +1 -0
- package/dist/migrations/errors.d.ts +74 -0
- package/dist/migrations/errors.d.ts.map +1 -0
- package/dist/migrations/errors.js +155 -0
- package/dist/migrations/errors.js.map +1 -0
- package/dist/migrations/index.d.ts +13 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +17 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/loader.d.ts +44 -0
- package/dist/migrations/loader.d.ts.map +1 -0
- package/dist/migrations/loader.js +181 -0
- package/dist/migrations/loader.js.map +1 -0
- package/dist/migrations/prisma-wrapper.d.ts +60 -0
- package/dist/migrations/prisma-wrapper.d.ts.map +1 -0
- package/dist/migrations/prisma-wrapper.js +184 -0
- package/dist/migrations/prisma-wrapper.js.map +1 -0
- package/dist/migrations/rollback-runner.d.ts +40 -0
- package/dist/migrations/rollback-runner.d.ts.map +1 -0
- package/dist/migrations/rollback-runner.js +191 -0
- package/dist/migrations/rollback-runner.js.map +1 -0
- package/dist/migrations/types.d.ts +214 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +19 -0
- package/dist/migrations/types.js.map +1 -0
- package/package.json +29 -8
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema Template
|
|
3
|
+
*
|
|
4
|
+
* Generates Zod validation schemas for VeloxTS applications.
|
|
5
|
+
*/
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Template Functions
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* Generate base schema content
|
|
11
|
+
*/
|
|
12
|
+
function generateBaseSchema(entity, options) {
|
|
13
|
+
const { pascal, camel } = entity;
|
|
14
|
+
const { softDelete, timestamps } = options;
|
|
15
|
+
const timestampFields = timestamps
|
|
16
|
+
? `
|
|
17
|
+
createdAt: z.date(),
|
|
18
|
+
updatedAt: z.date(),`
|
|
19
|
+
: '';
|
|
20
|
+
const softDeleteFields = softDelete
|
|
21
|
+
? `
|
|
22
|
+
deletedAt: z.date().nullable(),`
|
|
23
|
+
: '';
|
|
24
|
+
return `/**
|
|
25
|
+
* ${pascal} Schema
|
|
26
|
+
*
|
|
27
|
+
* Zod validation schemas for ${pascal} entity.
|
|
28
|
+
* Generated by VeloxTS CLI.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { z } from 'zod';
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Base Schema
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* ${pascal} - Full entity schema with all fields
|
|
39
|
+
*/
|
|
40
|
+
export const ${camel}Schema = z.object({
|
|
41
|
+
id: z.string().uuid(),
|
|
42
|
+
// TODO: Add your fields here
|
|
43
|
+
// name: z.string().min(1).max(255),
|
|
44
|
+
// email: z.string().email(),
|
|
45
|
+
// status: z.enum(['active', 'inactive', 'pending']),${timestampFields}${softDeleteFields}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type ${pascal} = z.infer<typeof ${camel}Schema>;
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generate CRUD schemas
|
|
53
|
+
*/
|
|
54
|
+
function generateCrudSchemas(entity, options) {
|
|
55
|
+
const { pascal, camel } = entity;
|
|
56
|
+
const { softDelete, timestamps } = options;
|
|
57
|
+
// Fields to omit for create schema
|
|
58
|
+
const createOmitFields = ['id'];
|
|
59
|
+
if (timestamps) {
|
|
60
|
+
createOmitFields.push('createdAt', 'updatedAt');
|
|
61
|
+
}
|
|
62
|
+
if (softDelete) {
|
|
63
|
+
createOmitFields.push('deletedAt');
|
|
64
|
+
}
|
|
65
|
+
return `
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Input Schemas (for API validation)
|
|
68
|
+
// ============================================================================
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create${pascal}Input - Schema for creating a new ${pascal}
|
|
72
|
+
* Omits auto-generated fields: ${createOmitFields.join(', ')}
|
|
73
|
+
*/
|
|
74
|
+
export const create${pascal}InputSchema = ${camel}Schema.omit({
|
|
75
|
+
${createOmitFields.map((f) => `${f}: true`).join(',\n ')},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export type Create${pascal}Input = z.infer<typeof create${pascal}InputSchema>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Update${pascal}Input - Schema for full update (PUT)
|
|
82
|
+
* Omits auto-generated fields: ${createOmitFields.join(', ')}
|
|
83
|
+
*/
|
|
84
|
+
export const update${pascal}InputSchema = ${camel}Schema.omit({
|
|
85
|
+
${createOmitFields.map((f) => `${f}: true`).join(',\n ')},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export type Update${pascal}Input = z.infer<typeof update${pascal}InputSchema>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Patch${pascal}Input - Schema for partial update (PATCH)
|
|
92
|
+
* All fields are optional
|
|
93
|
+
*/
|
|
94
|
+
export const patch${pascal}InputSchema = update${pascal}InputSchema.partial();
|
|
95
|
+
|
|
96
|
+
export type Patch${pascal}Input = z.infer<typeof patch${pascal}InputSchema>;
|
|
97
|
+
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// Query Schemas
|
|
100
|
+
// ============================================================================
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* ${pascal}IdParam - Schema for ID parameter
|
|
104
|
+
*/
|
|
105
|
+
export const ${camel}IdParamSchema = z.object({
|
|
106
|
+
id: z.string().uuid(),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export type ${pascal}IdParam = z.infer<typeof ${camel}IdParamSchema>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* ${pascal}ListQuery - Schema for list/search query parameters
|
|
113
|
+
*/
|
|
114
|
+
export const ${camel}ListQuerySchema = z.object({
|
|
115
|
+
page: z.coerce.number().int().positive().default(1),
|
|
116
|
+
limit: z.coerce.number().int().positive().max(100).default(20),
|
|
117
|
+
sortBy: z.string().optional(),
|
|
118
|
+
sortOrder: z.enum(['asc', 'desc']).default('desc'),
|
|
119
|
+
search: z.string().optional(),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export type ${pascal}ListQuery = z.infer<typeof ${camel}ListQuerySchema>;
|
|
123
|
+
|
|
124
|
+
// ============================================================================
|
|
125
|
+
// Response Schemas
|
|
126
|
+
// ============================================================================
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* ${pascal}Response - Single entity response
|
|
130
|
+
*/
|
|
131
|
+
export const ${camel}ResponseSchema = ${camel}Schema;
|
|
132
|
+
|
|
133
|
+
export type ${pascal}Response = z.infer<typeof ${camel}ResponseSchema>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* ${pascal}ListResponse - Paginated list response
|
|
137
|
+
*/
|
|
138
|
+
export const ${camel}ListResponseSchema = z.object({
|
|
139
|
+
data: z.array(${camel}Schema),
|
|
140
|
+
meta: z.object({
|
|
141
|
+
total: z.number(),
|
|
142
|
+
page: z.number(),
|
|
143
|
+
limit: z.number(),
|
|
144
|
+
totalPages: z.number(),
|
|
145
|
+
}),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export type ${pascal}ListResponse = z.infer<typeof ${camel}ListResponseSchema>;
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Generate simple response schemas (non-CRUD)
|
|
153
|
+
*/
|
|
154
|
+
function generateSimpleResponseSchemas(entity) {
|
|
155
|
+
const { pascal, camel } = entity;
|
|
156
|
+
return `
|
|
157
|
+
// ============================================================================
|
|
158
|
+
// Query Schemas
|
|
159
|
+
// ============================================================================
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* ${pascal}IdParam - Schema for ID parameter
|
|
163
|
+
*/
|
|
164
|
+
export const ${camel}IdParamSchema = z.object({
|
|
165
|
+
id: z.string().uuid(),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export type ${pascal}IdParam = z.infer<typeof ${camel}IdParamSchema>;
|
|
169
|
+
|
|
170
|
+
// ============================================================================
|
|
171
|
+
// Response Schemas
|
|
172
|
+
// ============================================================================
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* ${pascal}Response - Single entity response
|
|
176
|
+
*/
|
|
177
|
+
export const ${camel}ResponseSchema = ${camel}Schema;
|
|
178
|
+
|
|
179
|
+
export type ${pascal}Response = z.infer<typeof ${camel}ResponseSchema>;
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// Template Export
|
|
184
|
+
// ============================================================================
|
|
185
|
+
/**
|
|
186
|
+
* Schema template function
|
|
187
|
+
*/
|
|
188
|
+
export const schemaTemplate = (ctx) => {
|
|
189
|
+
const base = generateBaseSchema(ctx.entity, ctx.options);
|
|
190
|
+
if (ctx.options.crud) {
|
|
191
|
+
return base + generateCrudSchemas(ctx.entity, ctx.options);
|
|
192
|
+
}
|
|
193
|
+
return base + generateSimpleResponseSchemas(ctx.entity);
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Get output path for schema file
|
|
197
|
+
*/
|
|
198
|
+
export function getSchemaPath(entity) {
|
|
199
|
+
return `src/schemas/${entity.kebab}.schema.ts`;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Generate all files for a schema
|
|
203
|
+
*/
|
|
204
|
+
export function generateSchemaFiles(ctx) {
|
|
205
|
+
const content = schemaTemplate(ctx);
|
|
206
|
+
return [
|
|
207
|
+
{
|
|
208
|
+
path: getSchemaPath(ctx.entity),
|
|
209
|
+
content,
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Generate post-generation instructions
|
|
215
|
+
*/
|
|
216
|
+
export function getSchemaInstructions(entityName, options) {
|
|
217
|
+
const schemaImports = options.crud
|
|
218
|
+
? `import {
|
|
219
|
+
${entityName}Schema,
|
|
220
|
+
create${entityName}InputSchema,
|
|
221
|
+
update${entityName}InputSchema,
|
|
222
|
+
patch${entityName}InputSchema,
|
|
223
|
+
${entityName.charAt(0).toLowerCase() + entityName.slice(1)}IdParamSchema,
|
|
224
|
+
${entityName.charAt(0).toLowerCase() + entityName.slice(1)}ListQuerySchema,
|
|
225
|
+
} from './schemas/${entityName.toLowerCase()}.schema.js';`
|
|
226
|
+
: `import { ${entityName}Schema } from './schemas/${entityName.toLowerCase()}.schema.js';`;
|
|
227
|
+
return `
|
|
228
|
+
1. Customize the schema fields in the generated file:
|
|
229
|
+
|
|
230
|
+
Edit the ${entityName.toLowerCase()}Schema to match your data model.
|
|
231
|
+
|
|
232
|
+
2. Import and use in your procedures:
|
|
233
|
+
|
|
234
|
+
${schemaImports}
|
|
235
|
+
|
|
236
|
+
3. Example procedure usage:
|
|
237
|
+
|
|
238
|
+
export const get${entityName} = procedure
|
|
239
|
+
.input(${entityName.charAt(0).toLowerCase() + entityName.slice(1)}IdParamSchema)
|
|
240
|
+
.output(${entityName}Schema)
|
|
241
|
+
.query(async ({ input, ctx }) => {
|
|
242
|
+
return ctx.db.${entityName.charAt(0).toLowerCase() + entityName.slice(1)}.findUnique({
|
|
243
|
+
where: { id: input.id }
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/generators/templates/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;GAEG;AACH,SAAS,kBAAkB,CACzB,MAAyC,EACzC,OAAsB;IAEtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE3C,MAAM,eAAe,GAAG,UAAU;QAChC,CAAC,CAAC;;uBAEiB;QACnB,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,gBAAgB,GAAG,UAAU;QACjC,CAAC,CAAC;kCAC4B;QAC9B,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;KACJ,MAAM;;gCAEqB,MAAM;;;;;;;;;;;KAWjC,MAAM;;eAEI,KAAK;;;;;yDAKqC,eAAe,GAAG,gBAAgB;;;cAG7E,MAAM,qBAAqB,KAAK;CAC7C,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAC1B,MAAyC,EACzC,OAAsB;IAEtB,MAAM,EAAE,MAAM,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AAU;WACX,UAAU;MACf,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;MACxD,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;sBACxC,UAAU,CAAC,WAAW,EAAE,cAAc;QACxD,CAAC,CAAC,YAAY,UAAU,4BAA4B,UAAU,CAAC,WAAW,EAAE,cAAc,CAAC;IAE7F,OAAO;;;gBAGO,UAAU,CAAC,WAAW,EAAE;;;;OAIjC,aAAa;;;;uBAIG,UAAU;gBACjB,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;iBACvD,UAAU;;yBAEF,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;;;;CAIhF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Template
|
|
3
|
+
*
|
|
4
|
+
* Generates Vitest test files for VeloxTS applications.
|
|
5
|
+
*/
|
|
6
|
+
import type { GeneratedFile, TemplateContext, TemplateFunction } from '../types.js';
|
|
7
|
+
export interface TestOptions {
|
|
8
|
+
/** Type of test to generate */
|
|
9
|
+
type: 'unit' | 'integration' | 'e2e';
|
|
10
|
+
/** Target being tested (procedure, schema, model, service) */
|
|
11
|
+
target: 'procedure' | 'schema' | 'model' | 'service' | 'generic';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Test template function
|
|
15
|
+
*/
|
|
16
|
+
export declare const testTemplate: TemplateFunction<TestOptions>;
|
|
17
|
+
/**
|
|
18
|
+
* Get an output path for a test file
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTestPath(entity: {
|
|
21
|
+
kebab: string;
|
|
22
|
+
}, options: TestOptions): string;
|
|
23
|
+
/**
|
|
24
|
+
* Generate all files for a test
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateTestFiles(ctx: TemplateContext<TestOptions>): GeneratedFile[];
|
|
27
|
+
/**
|
|
28
|
+
* Generate post-generation instructions
|
|
29
|
+
*/
|
|
30
|
+
export declare function getTestInstructions(entityName: string, options: TestOptions): string;
|
|
31
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/generators/templates/test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpF,MAAM,WAAW,WAAW;IAC1B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC;IACrC,8DAA8D;IAC9D,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CAClE;AAmyBD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,gBAAgB,CAAC,WAAW,CA0BtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CA2BnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,aAAa,EAAE,CASpF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CA4BpF"}
|