@acmekit/acmekit 2.13.40 → 2.13.43
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/api/admin/views/[entity]/configurations/validators.d.ts +8 -8
- package/dist/commands/develop.d.ts.map +1 -1
- package/dist/commands/develop.js +1 -0
- package/dist/commands/develop.js.map +1 -1
- package/dist/commands/generate/crud.d.ts +8 -0
- package/dist/commands/generate/crud.d.ts.map +1 -0
- package/dist/commands/generate/crud.js +223 -0
- package/dist/commands/generate/crud.js.map +1 -0
- package/dist/commands/generate/docs.d.ts +7 -0
- package/dist/commands/generate/docs.d.ts.map +1 -0
- package/dist/commands/generate/docs.js +236 -0
- package/dist/commands/generate/docs.js.map +1 -0
- package/dist/commands/generate/index.d.ts +2 -0
- package/dist/commands/generate/index.d.ts.map +1 -0
- package/dist/commands/generate/index.js +10 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/generate/job.d.ts +7 -0
- package/dist/commands/generate/job.d.ts.map +1 -0
- package/dist/commands/generate/job.js +38 -0
- package/dist/commands/generate/job.js.map +1 -0
- package/dist/commands/generate/link.d.ts +7 -0
- package/dist/commands/generate/link.d.ts.map +1 -0
- package/dist/commands/generate/link.js +63 -0
- package/dist/commands/generate/link.js.map +1 -0
- package/dist/commands/generate/module.d.ts +8 -0
- package/dist/commands/generate/module.d.ts.map +1 -0
- package/dist/commands/generate/module.js +78 -0
- package/dist/commands/generate/module.js.map +1 -0
- package/dist/commands/generate/route.d.ts +7 -0
- package/dist/commands/generate/route.d.ts.map +1 -0
- package/dist/commands/generate/route.js +54 -0
- package/dist/commands/generate/route.js.map +1 -0
- package/dist/commands/generate/subscriber.d.ts +7 -0
- package/dist/commands/generate/subscriber.d.ts.map +1 -0
- package/dist/commands/generate/subscriber.js +41 -0
- package/dist/commands/generate/subscriber.js.map +1 -0
- package/dist/commands/generate/types.d.ts +7 -0
- package/dist/commands/generate/types.d.ts.map +1 -0
- package/dist/commands/generate/types.js +243 -0
- package/dist/commands/generate/types.js.map +1 -0
- package/dist/commands/generate/utils/config-updater.d.ts +12 -0
- package/dist/commands/generate/utils/config-updater.d.ts.map +1 -0
- package/dist/commands/generate/utils/config-updater.js +38 -0
- package/dist/commands/generate/utils/config-updater.js.map +1 -0
- package/dist/commands/generate/utils/file-writer.d.ts +17 -0
- package/dist/commands/generate/utils/file-writer.d.ts.map +1 -0
- package/dist/commands/generate/utils/file-writer.js +31 -0
- package/dist/commands/generate/utils/file-writer.js.map +1 -0
- package/dist/commands/generate/utils/log.d.ts +13 -0
- package/dist/commands/generate/utils/log.d.ts.map +1 -0
- package/dist/commands/generate/utils/log.js +37 -0
- package/dist/commands/generate/utils/log.js.map +1 -0
- package/dist/commands/generate/utils/model-introspector.d.ts +22 -0
- package/dist/commands/generate/utils/model-introspector.d.ts.map +1 -0
- package/dist/commands/generate/utils/model-introspector.js +93 -0
- package/dist/commands/generate/utils/model-introspector.js.map +1 -0
- package/dist/commands/generate/utils/naming.d.ts +21 -0
- package/dist/commands/generate/utils/naming.d.ts.map +1 -0
- package/dist/commands/generate/utils/naming.js +74 -0
- package/dist/commands/generate/utils/naming.js.map +1 -0
- package/dist/commands/generate/workflow.d.ts +7 -0
- package/dist/commands/generate/workflow.d.ts.map +1 -0
- package/dist/commands/generate/workflow.js +66 -0
- package/dist/commands/generate/workflow.js.map +1 -0
- package/dist/loaders/docs.d.ts +10 -0
- package/dist/loaders/docs.d.ts.map +1 -0
- package/dist/loaders/docs.js +129 -0
- package/dist/loaders/docs.js.map +1 -0
- package/dist/loaders/index.d.ts.map +1 -1
- package/dist/loaders/index.js +2 -0
- package/dist/loaders/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -37
|
@@ -359,36 +359,36 @@ export declare const AdminCreateViewConfiguration: z.ZodObject<{
|
|
|
359
359
|
}, "strip", z.ZodTypeAny, {
|
|
360
360
|
visible_columns: string[];
|
|
361
361
|
column_order: string[];
|
|
362
|
+
search?: string | undefined;
|
|
362
363
|
column_widths?: Record<string, number> | undefined;
|
|
363
364
|
filters?: Record<string, any> | undefined;
|
|
364
365
|
sorting?: {
|
|
365
366
|
id: string;
|
|
366
367
|
desc: boolean;
|
|
367
368
|
} | null | undefined;
|
|
368
|
-
search?: string | undefined;
|
|
369
369
|
}, {
|
|
370
370
|
visible_columns: string[];
|
|
371
371
|
column_order: string[];
|
|
372
|
+
search?: string | undefined;
|
|
372
373
|
column_widths?: Record<string, number> | undefined;
|
|
373
374
|
filters?: Record<string, any> | undefined;
|
|
374
375
|
sorting?: {
|
|
375
376
|
id: string;
|
|
376
377
|
desc: boolean;
|
|
377
378
|
} | null | undefined;
|
|
378
|
-
search?: string | undefined;
|
|
379
379
|
}>;
|
|
380
380
|
}, "strip", z.ZodTypeAny, {
|
|
381
381
|
is_system_default: boolean;
|
|
382
382
|
configuration: {
|
|
383
383
|
visible_columns: string[];
|
|
384
384
|
column_order: string[];
|
|
385
|
+
search?: string | undefined;
|
|
385
386
|
column_widths?: Record<string, number> | undefined;
|
|
386
387
|
filters?: Record<string, any> | undefined;
|
|
387
388
|
sorting?: {
|
|
388
389
|
id: string;
|
|
389
390
|
desc: boolean;
|
|
390
391
|
} | null | undefined;
|
|
391
|
-
search?: string | undefined;
|
|
392
392
|
};
|
|
393
393
|
set_active: boolean;
|
|
394
394
|
name?: string | undefined;
|
|
@@ -396,13 +396,13 @@ export declare const AdminCreateViewConfiguration: z.ZodObject<{
|
|
|
396
396
|
configuration: {
|
|
397
397
|
visible_columns: string[];
|
|
398
398
|
column_order: string[];
|
|
399
|
+
search?: string | undefined;
|
|
399
400
|
column_widths?: Record<string, number> | undefined;
|
|
400
401
|
filters?: Record<string, any> | undefined;
|
|
401
402
|
sorting?: {
|
|
402
403
|
id: string;
|
|
403
404
|
desc: boolean;
|
|
404
405
|
} | null | undefined;
|
|
405
|
-
search?: string | undefined;
|
|
406
406
|
};
|
|
407
407
|
name?: string | undefined;
|
|
408
408
|
is_system_default?: boolean | undefined;
|
|
@@ -430,6 +430,7 @@ export declare const AdminUpdateViewConfiguration: z.ZodObject<{
|
|
|
430
430
|
}>>>;
|
|
431
431
|
search: z.ZodOptional<z.ZodString>;
|
|
432
432
|
}, "strip", z.ZodTypeAny, {
|
|
433
|
+
search?: string | undefined;
|
|
433
434
|
visible_columns?: string[] | undefined;
|
|
434
435
|
column_order?: string[] | undefined;
|
|
435
436
|
column_widths?: Record<string, number> | undefined;
|
|
@@ -438,8 +439,8 @@ export declare const AdminUpdateViewConfiguration: z.ZodObject<{
|
|
|
438
439
|
id: string;
|
|
439
440
|
desc: boolean;
|
|
440
441
|
} | null | undefined;
|
|
441
|
-
search?: string | undefined;
|
|
442
442
|
}, {
|
|
443
|
+
search?: string | undefined;
|
|
443
444
|
visible_columns?: string[] | undefined;
|
|
444
445
|
column_order?: string[] | undefined;
|
|
445
446
|
column_widths?: Record<string, number> | undefined;
|
|
@@ -448,13 +449,13 @@ export declare const AdminUpdateViewConfiguration: z.ZodObject<{
|
|
|
448
449
|
id: string;
|
|
449
450
|
desc: boolean;
|
|
450
451
|
} | null | undefined;
|
|
451
|
-
search?: string | undefined;
|
|
452
452
|
}>>;
|
|
453
453
|
}, "strip", z.ZodTypeAny, {
|
|
454
454
|
set_active: boolean;
|
|
455
455
|
name?: string | undefined;
|
|
456
456
|
is_system_default?: boolean | undefined;
|
|
457
457
|
configuration?: {
|
|
458
|
+
search?: string | undefined;
|
|
458
459
|
visible_columns?: string[] | undefined;
|
|
459
460
|
column_order?: string[] | undefined;
|
|
460
461
|
column_widths?: Record<string, number> | undefined;
|
|
@@ -463,12 +464,12 @@ export declare const AdminUpdateViewConfiguration: z.ZodObject<{
|
|
|
463
464
|
id: string;
|
|
464
465
|
desc: boolean;
|
|
465
466
|
} | null | undefined;
|
|
466
|
-
search?: string | undefined;
|
|
467
467
|
} | undefined;
|
|
468
468
|
}, {
|
|
469
469
|
name?: string | undefined;
|
|
470
470
|
is_system_default?: boolean | undefined;
|
|
471
471
|
configuration?: {
|
|
472
|
+
search?: string | undefined;
|
|
472
473
|
visible_columns?: string[] | undefined;
|
|
473
474
|
column_order?: string[] | undefined;
|
|
474
475
|
column_widths?: Record<string, number> | undefined;
|
|
@@ -477,7 +478,6 @@ export declare const AdminUpdateViewConfiguration: z.ZodObject<{
|
|
|
477
478
|
id: string;
|
|
478
479
|
desc: boolean;
|
|
479
480
|
} | null | undefined;
|
|
480
|
-
search?: string | undefined;
|
|
481
481
|
} | undefined;
|
|
482
482
|
set_active?: boolean | undefined;
|
|
483
483
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAoBA,yBAA+B,EAAE,KAAK,EAAE,SAAS,EAAE;;;CAAA,
|
|
1
|
+
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAoBA,yBAA+B,EAAE,KAAK,EAAE,SAAS,EAAE;;;CAAA,iBA2OlD"}
|
package/dist/commands/develop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"develop.js","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":";;;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"develop.js","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":";;;;;AAoBA,4BA2OC;AA/PD,kDAAoD;AACpD,oDAGiC;AACjC,kDAA0C;AAC1C,kDAAyB;AACzB,iDAA4D;AAC5D,wDAA8C;AAC9C,2BAAwB;AACxB,gDAAuB;AACvB,+EAAgE;AAChE,wCAAgD;AAEhD,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,QAAQ;CACL,CAAA;AAEH,KAAK,oBAAW,EAAE,KAAK,EAAE,SAAS,EAAE;IACjD,MAAM,SAAS,GAAG,MAAM,IAAA,6BAAm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A;IACvB,SAAS,CAAC,KAAK,EAAE,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../../src/commands/generate/crud.ts"],"names":[],"mappings":"AAcA,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAA8B,YAAY,CAAC,EACzC,MAAM,EACN,MAAM,EACN,SAAS,GACV,EAAE,OAAO,iBA6NT"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = generateCrud;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const file_writer_1 = require("./utils/file-writer");
|
|
10
|
+
const naming_1 = require("./utils/naming");
|
|
11
|
+
const log_1 = require("./utils/log");
|
|
12
|
+
const types_1 = __importDefault(require("./types"));
|
|
13
|
+
async function generateCrud({ entity, module, directory, }) {
|
|
14
|
+
const moduleName = (0, naming_1.toKebabCase)(module);
|
|
15
|
+
const moduleDir = (0, path_1.join)(directory, "src", "modules", moduleName);
|
|
16
|
+
if (!(0, fs_1.existsSync)(moduleDir)) {
|
|
17
|
+
console.error(`Module "${moduleName}" not found at src/modules/${moduleName}/`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const entityName = (0, naming_1.toPascalCase)(entity);
|
|
21
|
+
const entityCamel = (0, naming_1.toCamelCase)(entity);
|
|
22
|
+
const entitySnake = (0, naming_1.toSnakeCase)(entity);
|
|
23
|
+
const entityPlural = (0, naming_1.pluralize)(entityName);
|
|
24
|
+
const entityPluralCamel = (0, naming_1.toCamelCase)(entityPlural);
|
|
25
|
+
const resourcePath = (0, naming_1.toResourcePath)(entity);
|
|
26
|
+
// Run types generator first to ensure generated types exist
|
|
27
|
+
await (0, types_1.default)({ module: moduleName, directory });
|
|
28
|
+
const routeDir = (0, path_1.join)(directory, "src", "api", "admin", resourcePath);
|
|
29
|
+
const typesImportPath = `../../types/generated/${moduleName}`;
|
|
30
|
+
const typesImportPathFromId = `../../../types/generated/${moduleName}`;
|
|
31
|
+
// Collection route (GET list + POST create)
|
|
32
|
+
const collectionRouteContent = `import {
|
|
33
|
+
defineRouteConfig,
|
|
34
|
+
type AuthenticatedAcmeKitTypedRequest,
|
|
35
|
+
type AcmeKitTypedResponse,
|
|
36
|
+
} from "@acmekit/framework/http"
|
|
37
|
+
import {
|
|
38
|
+
ContainerRegistrationKeys,
|
|
39
|
+
remoteQueryObjectFromString,
|
|
40
|
+
} from "@acmekit/framework/utils"
|
|
41
|
+
import {
|
|
42
|
+
Create${entityName}Schema,
|
|
43
|
+
List${entityPlural}Params,
|
|
44
|
+
} from "${typesImportPath}"
|
|
45
|
+
import * as QueryConfig from "./query-config"
|
|
46
|
+
|
|
47
|
+
export const config = defineRouteConfig({
|
|
48
|
+
GET: {
|
|
49
|
+
query: List${entityPlural}Params,
|
|
50
|
+
queryConfig: QueryConfig.listTransformQueryConfig,
|
|
51
|
+
},
|
|
52
|
+
POST: {
|
|
53
|
+
body: Create${entityName}Schema,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const GET = async (
|
|
58
|
+
req: AuthenticatedAcmeKitTypedRequest<typeof config, "GET">,
|
|
59
|
+
res: AcmeKitTypedResponse<typeof config, "GET">
|
|
60
|
+
) => {
|
|
61
|
+
const remoteQuery = req.scope.resolve(
|
|
62
|
+
ContainerRegistrationKeys.REMOTE_QUERY
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const query = remoteQueryObjectFromString({
|
|
66
|
+
entryPoint: "${entitySnake}",
|
|
67
|
+
variables: {
|
|
68
|
+
filters: req.filterableFields,
|
|
69
|
+
...req.queryConfig.pagination,
|
|
70
|
+
},
|
|
71
|
+
fields: req.queryConfig.fields,
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const { rows: ${entityPluralCamel}, metadata } = await remoteQuery(query)
|
|
75
|
+
|
|
76
|
+
res.json({
|
|
77
|
+
${entityPluralCamel},
|
|
78
|
+
count: metadata.count,
|
|
79
|
+
offset: metadata.skip,
|
|
80
|
+
limit: metadata.take,
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const POST = async (
|
|
85
|
+
req: AuthenticatedAcmeKitTypedRequest<typeof config, "POST">,
|
|
86
|
+
res: AcmeKitTypedResponse<typeof config, "POST">
|
|
87
|
+
) => {
|
|
88
|
+
// TODO: use a workflow or module service to create
|
|
89
|
+
// const result = await create${entityName}Workflow(req.scope).run({
|
|
90
|
+
// input: req.validatedBody,
|
|
91
|
+
// })
|
|
92
|
+
|
|
93
|
+
res.status(201).json({ ${entityCamel}: {} })
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
// Single item route (GET retrieve + POST update + DELETE)
|
|
97
|
+
const itemRouteContent = `import {
|
|
98
|
+
defineRouteConfig,
|
|
99
|
+
type AuthenticatedAcmeKitTypedRequest,
|
|
100
|
+
type AcmeKitTypedResponse,
|
|
101
|
+
} from "@acmekit/framework/http"
|
|
102
|
+
import {
|
|
103
|
+
Update${entityName}Schema,
|
|
104
|
+
Get${entityName}Params,
|
|
105
|
+
} from "${typesImportPathFromId}"
|
|
106
|
+
import * as QueryConfig from "../query-config"
|
|
107
|
+
import { refetch${entityName} } from "../helpers"
|
|
108
|
+
|
|
109
|
+
export const config = defineRouteConfig({
|
|
110
|
+
GET: {
|
|
111
|
+
query: Get${entityName}Params,
|
|
112
|
+
queryConfig: QueryConfig.retrieveTransformQueryConfig,
|
|
113
|
+
},
|
|
114
|
+
POST: {
|
|
115
|
+
body: Update${entityName}Schema,
|
|
116
|
+
query: Get${entityName}Params,
|
|
117
|
+
queryConfig: QueryConfig.retrieveTransformQueryConfig,
|
|
118
|
+
},
|
|
119
|
+
DELETE: {},
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
export const GET = async (
|
|
123
|
+
req: AuthenticatedAcmeKitTypedRequest<typeof config, "GET">,
|
|
124
|
+
res: AcmeKitTypedResponse<typeof config, "GET">
|
|
125
|
+
) => {
|
|
126
|
+
const ${entityCamel} = await refetch${entityName}(
|
|
127
|
+
req.params.id,
|
|
128
|
+
req.scope,
|
|
129
|
+
req.queryConfig.fields
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
res.json({ ${entityCamel} })
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const POST = async (
|
|
136
|
+
req: AuthenticatedAcmeKitTypedRequest<typeof config, "POST">,
|
|
137
|
+
res: AcmeKitTypedResponse<typeof config, "POST">
|
|
138
|
+
) => {
|
|
139
|
+
// TODO: use a workflow or module service to update
|
|
140
|
+
|
|
141
|
+
const ${entityCamel} = await refetch${entityName}(
|
|
142
|
+
req.params.id,
|
|
143
|
+
req.scope,
|
|
144
|
+
req.queryConfig.fields
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
res.json({ ${entityCamel} })
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const DELETE = async (
|
|
151
|
+
req: AuthenticatedAcmeKitTypedRequest<typeof config, "DELETE">,
|
|
152
|
+
res: AcmeKitTypedResponse<typeof config, "DELETE">
|
|
153
|
+
) => {
|
|
154
|
+
const { id } = req.params
|
|
155
|
+
|
|
156
|
+
// TODO: use a workflow or module service to delete
|
|
157
|
+
|
|
158
|
+
res.status(200).json({ id, object: "${entitySnake}", deleted: true })
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
// Query config
|
|
162
|
+
const queryConfigContent = `import { default${entityName}Fields } from "${typesImportPath}"
|
|
163
|
+
|
|
164
|
+
export const retrieveTransformQueryConfig = {
|
|
165
|
+
defaults: default${entityName}Fields,
|
|
166
|
+
isList: false,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const listTransformQueryConfig = {
|
|
170
|
+
...retrieveTransformQueryConfig,
|
|
171
|
+
isList: true,
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
// Helpers
|
|
175
|
+
const helpersContent = `import {
|
|
176
|
+
ContainerRegistrationKeys,
|
|
177
|
+
remoteQueryObjectFromString,
|
|
178
|
+
} from "@acmekit/framework/utils"
|
|
179
|
+
|
|
180
|
+
export const refetch${entityName} = async (
|
|
181
|
+
id: string,
|
|
182
|
+
scope: any,
|
|
183
|
+
fields: string[]
|
|
184
|
+
) => {
|
|
185
|
+
const remoteQuery = scope.resolve(
|
|
186
|
+
ContainerRegistrationKeys.REMOTE_QUERY
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
const query = remoteQueryObjectFromString({
|
|
190
|
+
entryPoint: "${entitySnake}",
|
|
191
|
+
variables: { filters: { id } },
|
|
192
|
+
fields,
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
const { rows } = await remoteQuery(query)
|
|
196
|
+
return rows[0]
|
|
197
|
+
}
|
|
198
|
+
`;
|
|
199
|
+
const result = (0, file_writer_1.writeFiles)([
|
|
200
|
+
{ path: (0, path_1.join)(routeDir, "route.ts"), content: collectionRouteContent },
|
|
201
|
+
{
|
|
202
|
+
path: (0, path_1.join)(routeDir, "[id]", "route.ts"),
|
|
203
|
+
content: itemRouteContent,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
path: (0, path_1.join)(routeDir, "query-config.ts"),
|
|
207
|
+
content: queryConfigContent,
|
|
208
|
+
},
|
|
209
|
+
{ path: (0, path_1.join)(routeDir, "helpers.ts"), content: helpersContent },
|
|
210
|
+
]);
|
|
211
|
+
(0, log_1.printSummary)({
|
|
212
|
+
type: "crud",
|
|
213
|
+
name: entityName,
|
|
214
|
+
...result,
|
|
215
|
+
nextSteps: [
|
|
216
|
+
`Implement create/update/delete workflows for ${entityName}`,
|
|
217
|
+
`Routes available at /admin/${resourcePath} and /admin/${resourcePath}/:id`,
|
|
218
|
+
`Re-run \`npx acmekit generate types ${moduleName}\` after model changes`,
|
|
219
|
+
],
|
|
220
|
+
directory,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=crud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../../src/commands/generate/crud.ts"],"names":[],"mappings":";;;;;AAoBA,+BAiOC;AArPD,2BAA+B;AAC/B,+BAA2B;AAC3B,qDAAgD;AAChD,2CAOuB;AACvB,qCAA0C;AAC1C,oDAAmC;AAQpB,KAAK,UAAU,YAAY,CAAC,EACzC,MAAM,EACN,MAAM,EACN,SAAS,GACD;IACR,MAAM,UAAU,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAA;IACtC,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IAE/D,IAAI,CAAC,IAAA,eAAU,EAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CACX,WAAW,UAAU,8BAA8B,UAAU,GAAG,CACjE,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAA;IACvC,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAA;IACvC,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAA;IACvC,MAAM,YAAY,GAAG,IAAA,kBAAS,EAAC,UAAU,CAAC,CAAA;IAC1C,MAAM,iBAAiB,GAAG,IAAA,oBAAW,EAAC,YAAY,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,IAAA,uBAAc,EAAC,M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AE;QACrE;YACE,IAAI,EAAE,IAAA,WAAI,EAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC;YACxC,OAAO,EAAE,gBAAgB;SAC1B;QACD;YACE,IAAI,EAAE,IAAA,WAAI,EAAC,QAAQ,EAAE,iBAAiB,CAAC;YACvC,OAAO,EAAE,kBAAkB;SAC5B;QACD,EAAE,IAAI,EAAE,IAAA,WAAI,EAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE;KAChE,CAAC,CAAA;IAEF,IAAA,kBAAY,EAAC;QACX,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,UAAU;QAChB,GAAG,MAAM;QACT,SAAS,EAAE;YACT,gDAAgD,UAAU,EAAE;YAC5D,8BAA8B,YAAY,eAAe,YAAY,MAAM;YAC3E,uCAAuC,UAAU,wBAAwB;SAC1E;QACD,SAAS;KACV,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/commands/generate/docs.ts"],"names":[],"mappings":"AAiBA,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAA8B,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,iBAqExE"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = generateDocs;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const file_writer_1 = require("./utils/file-writer");
|
|
7
|
+
const model_introspector_1 = require("./utils/model-introspector");
|
|
8
|
+
const naming_1 = require("./utils/naming");
|
|
9
|
+
const log_1 = require("./utils/log");
|
|
10
|
+
async function generateDocs({ module, directory }) {
|
|
11
|
+
const moduleName = (0, naming_1.toKebabCase)(module);
|
|
12
|
+
const moduleDir = (0, path_1.join)(directory, "src", "modules", moduleName);
|
|
13
|
+
if (!(0, fs_1.existsSync)(moduleDir)) {
|
|
14
|
+
console.error(`Module "${moduleName}" not found at src/modules/${moduleName}/`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const modelsDir = (0, path_1.join)(moduleDir, "models");
|
|
18
|
+
if (!(0, fs_1.existsSync)(modelsDir)) {
|
|
19
|
+
console.error(`No models directory found at src/modules/${moduleName}/models/`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const entities = (0, model_introspector_1.introspectModule)(directory, moduleName);
|
|
23
|
+
if (entities.length === 0) {
|
|
24
|
+
console.error(`No DML models found in src/modules/${moduleName}/models/`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const docsDir = (0, path_1.join)(directory, "src", "docs", "reference", moduleName);
|
|
28
|
+
const files = [];
|
|
29
|
+
const entitiesWithApi = [];
|
|
30
|
+
let position = 2;
|
|
31
|
+
for (const entity of entities) {
|
|
32
|
+
const entityKebab = (0, naming_1.toKebabCase)(entity.name);
|
|
33
|
+
const resourcePath = (0, naming_1.toResourcePath)(entity.name);
|
|
34
|
+
files.push({
|
|
35
|
+
path: (0, path_1.join)(docsDir, `${entityKebab}.mdx`),
|
|
36
|
+
content: generateModelDoc(entity, position++),
|
|
37
|
+
});
|
|
38
|
+
const routeDir = (0, path_1.join)(directory, "src", "api", "admin", resourcePath);
|
|
39
|
+
if ((0, fs_1.existsSync)(routeDir)) {
|
|
40
|
+
entitiesWithApi.push(entity);
|
|
41
|
+
files.push({
|
|
42
|
+
path: (0, path_1.join)(docsDir, `${entityKebab}-api.mdx`),
|
|
43
|
+
content: generateApiDoc(entity, position++),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
files.push({
|
|
48
|
+
path: (0, path_1.join)(docsDir, "index.mdx"),
|
|
49
|
+
content: generateIndexDoc(moduleName, entities, entitiesWithApi),
|
|
50
|
+
});
|
|
51
|
+
const result = (0, file_writer_1.writeFiles)(files, { overwrite: true });
|
|
52
|
+
(0, log_1.printSummary)({
|
|
53
|
+
type: "docs",
|
|
54
|
+
name: moduleName,
|
|
55
|
+
...result,
|
|
56
|
+
nextSteps: [
|
|
57
|
+
`View docs at /docs/reference/${moduleName}`,
|
|
58
|
+
`Re-run \`npx acmekit generate docs --module ${moduleName}\` after model changes`,
|
|
59
|
+
],
|
|
60
|
+
directory,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function generateModelDoc(entity, position) {
|
|
64
|
+
const name = entity.name;
|
|
65
|
+
const typeListEntries = entity.fields.map((field) => {
|
|
66
|
+
const tsType = (0, model_introspector_1.fieldToTsType)(field);
|
|
67
|
+
const description = fieldDescription(field);
|
|
68
|
+
const defaultValue = fieldDefaultValue(field);
|
|
69
|
+
const entry = [];
|
|
70
|
+
entry.push(` {`);
|
|
71
|
+
entry.push(` name: "${field.name}",`);
|
|
72
|
+
entry.push(` type: "${tsType}",`);
|
|
73
|
+
entry.push(` description: "${description}",`);
|
|
74
|
+
entry.push(` optional: ${field.nullable},`);
|
|
75
|
+
if (defaultValue) {
|
|
76
|
+
entry.push(` defaultValue: "${defaultValue}",`);
|
|
77
|
+
}
|
|
78
|
+
entry.push(` }`);
|
|
79
|
+
return entry.join("\n");
|
|
80
|
+
});
|
|
81
|
+
return `---
|
|
82
|
+
title: "${name} Data Model"
|
|
83
|
+
sidebar_label: "${name} Data Model"
|
|
84
|
+
sidebar_position: ${position}
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
import { TypeList } from "@acmekit/docs-ui"
|
|
88
|
+
|
|
89
|
+
# ${name} Data Model
|
|
90
|
+
|
|
91
|
+
<TypeList
|
|
92
|
+
types={[
|
|
93
|
+
${typeListEntries.join(",\n")},
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
function generateApiDoc(entity, position) {
|
|
99
|
+
const name = entity.name;
|
|
100
|
+
const pluralName = (0, naming_1.pluralize)(name);
|
|
101
|
+
const resourcePath = (0, naming_1.toResourcePath)(entity.name);
|
|
102
|
+
const createFields = entity.fields.filter((f) => !isExcludedFromCreate(f));
|
|
103
|
+
const updateFields = entity.fields.filter((f) => !isExcludedFromUpdate(f));
|
|
104
|
+
const createTable = createFields
|
|
105
|
+
.map((f) => {
|
|
106
|
+
const tsType = (0, model_introspector_1.fieldToTsType)(f);
|
|
107
|
+
const required = f.nullable ? "No" : "Yes";
|
|
108
|
+
return `| ${f.name} | ${tsType} | ${required} |`;
|
|
109
|
+
})
|
|
110
|
+
.join("\n");
|
|
111
|
+
const updateTable = updateFields
|
|
112
|
+
.map((f) => {
|
|
113
|
+
const tsType = (0, model_introspector_1.fieldToTsType)(f);
|
|
114
|
+
return `| ${f.name} | ${tsType} | No |`;
|
|
115
|
+
})
|
|
116
|
+
.join("\n");
|
|
117
|
+
return `---
|
|
118
|
+
title: "${name} API"
|
|
119
|
+
sidebar_label: "${name} API"
|
|
120
|
+
sidebar_position: ${position}
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
# ${name} API Endpoints
|
|
124
|
+
|
|
125
|
+
## List ${pluralName}
|
|
126
|
+
|
|
127
|
+
\`GET /admin/${resourcePath}\`
|
|
128
|
+
|
|
129
|
+
Returns a paginated list of ${pluralName.toLowerCase()}.
|
|
130
|
+
|
|
131
|
+
## Create ${name}
|
|
132
|
+
|
|
133
|
+
\`POST /admin/${resourcePath}\`
|
|
134
|
+
|
|
135
|
+
### Request Body
|
|
136
|
+
|
|
137
|
+
| Field | Type | Required |
|
|
138
|
+
|-------|------|----------|
|
|
139
|
+
${createTable}
|
|
140
|
+
|
|
141
|
+
## Get ${name}
|
|
142
|
+
|
|
143
|
+
\`GET /admin/${resourcePath}/:id\`
|
|
144
|
+
|
|
145
|
+
## Update ${name}
|
|
146
|
+
|
|
147
|
+
\`POST /admin/${resourcePath}/:id\`
|
|
148
|
+
|
|
149
|
+
### Request Body
|
|
150
|
+
|
|
151
|
+
| Field | Type | Required |
|
|
152
|
+
|-------|------|----------|
|
|
153
|
+
${updateTable}
|
|
154
|
+
|
|
155
|
+
## Delete ${name}
|
|
156
|
+
|
|
157
|
+
\`DELETE /admin/${resourcePath}/:id\`
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
function generateIndexDoc(moduleName, entities, entitiesWithApi) {
|
|
161
|
+
const moduleTitle = (0, naming_1.toPascalCase)(moduleName);
|
|
162
|
+
const modelLinks = entities
|
|
163
|
+
.map((e) => `- [${e.name}](./${(0, naming_1.toKebabCase)(e.name)})`)
|
|
164
|
+
.join("\n");
|
|
165
|
+
let apiSection = "";
|
|
166
|
+
if (entitiesWithApi.length > 0) {
|
|
167
|
+
const apiLinks = entitiesWithApi
|
|
168
|
+
.map((e) => `- [${e.name} API](./${(0, naming_1.toKebabCase)(e.name)}-api)`)
|
|
169
|
+
.join("\n");
|
|
170
|
+
apiSection = `
|
|
171
|
+
|
|
172
|
+
## API Reference
|
|
173
|
+
|
|
174
|
+
${apiLinks}`;
|
|
175
|
+
}
|
|
176
|
+
return `---
|
|
177
|
+
title: "${moduleTitle} Module"
|
|
178
|
+
sidebar_label: "${moduleTitle}"
|
|
179
|
+
sidebar_position: 1
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
# ${moduleTitle} Module
|
|
183
|
+
|
|
184
|
+
## Data Models
|
|
185
|
+
|
|
186
|
+
${modelLinks}${apiSection}
|
|
187
|
+
`;
|
|
188
|
+
}
|
|
189
|
+
function fieldDescription(field) {
|
|
190
|
+
if (field.dataType === "enum" && field.enumChoices) {
|
|
191
|
+
return `Enum: ${field.enumChoices.join(", ")}`;
|
|
192
|
+
}
|
|
193
|
+
if (field.primaryKey) {
|
|
194
|
+
return "Unique identifier";
|
|
195
|
+
}
|
|
196
|
+
const descriptions = {
|
|
197
|
+
text: "Text field",
|
|
198
|
+
boolean: "Boolean flag",
|
|
199
|
+
number: "Numeric value",
|
|
200
|
+
float: "Floating-point number",
|
|
201
|
+
bigNumber: "Large numeric value",
|
|
202
|
+
serial: "Auto-incrementing number",
|
|
203
|
+
dateTime: "Date and time",
|
|
204
|
+
json: "JSON data",
|
|
205
|
+
array: "Array of values",
|
|
206
|
+
id: "Unique identifier",
|
|
207
|
+
};
|
|
208
|
+
return descriptions[field.dataType] || "Field value";
|
|
209
|
+
}
|
|
210
|
+
function fieldDefaultValue(field) {
|
|
211
|
+
if (field.hasDefault &&
|
|
212
|
+
(field.primaryKey || field.dataType === "id" || field.dataType === "serial")) {
|
|
213
|
+
return "Auto-generated";
|
|
214
|
+
}
|
|
215
|
+
if (field.hasDefault && field.dataType === "enum" && field.enumChoices) {
|
|
216
|
+
return field.enumChoices[0];
|
|
217
|
+
}
|
|
218
|
+
if (field.hasDefault) {
|
|
219
|
+
return "Auto-generated";
|
|
220
|
+
}
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
function isExcludedFromCreate(field) {
|
|
224
|
+
return (field.primaryKey ||
|
|
225
|
+
field.dataType === "id" ||
|
|
226
|
+
field.dataType === "serial" ||
|
|
227
|
+
field.dataType === "dateTime" ||
|
|
228
|
+
field.hasDefault);
|
|
229
|
+
}
|
|
230
|
+
function isExcludedFromUpdate(field) {
|
|
231
|
+
return (field.primaryKey ||
|
|
232
|
+
field.dataType === "id" ||
|
|
233
|
+
field.dataType === "serial" ||
|
|
234
|
+
field.dataType === "dateTime");
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/commands/generate/docs.ts"],"names":[],"mappings":";;AAsBA,+BAqEC;AA3FD,2BAA+B;AAC/B,+BAA2B;AAC3B,qDAAgD;AAChD,mEAKmC;AACnC,2CAKuB;AACvB,qCAA0C;AAO3B,KAAK,UAAU,YAAY,CAAC,EAAE,MA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AAC,MAAM,EAAE,OAAO,CAAC,iBAE5D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
// This file exists so that resolveCwd("@acmekit/acmekit/commands/generate") resolves.
|
|
5
|
+
// Individual generators are at generate/module, generate/workflow, etc.
|
|
6
|
+
// The yargs subcommand routing handles dispatch.
|
|
7
|
+
async function default_1(_args) {
|
|
8
|
+
// yargs .demandCommand(1) prevents reaching here
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|