@pylonts/dsl 1.1.5 → 1.1.6
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/controller.d.ts +27 -0
- package/dist/controller.js +11 -0
- package/dist/convert.d.ts +18 -6
- package/dist/convert.js +12 -2
- package/dist/curd.d.ts +0 -2
- package/dist/curd.js +7 -0
- package/dist/dao.d.ts +111 -2
- package/dist/dao.js +28 -2
- package/dist/db.js +3 -0
- package/dist/dsl.d.ts +16 -1
- package/dist/dsl.js +6 -0
- package/dist/dto.d.ts +6 -2
- package/dist/dto.js +20 -9
- package/dist/endpoint.d.ts +15 -0
- package/dist/endpoint.js +3 -0
- package/dist/exception.d.ts +14 -0
- package/dist/exception.js +9 -0
- package/dist/field-rule.d.ts +20 -0
- package/dist/field-rule.js +19 -0
- package/dist/flow.d.ts +24 -2
- package/dist/flow.js +16 -4
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -0
- package/dist/mermaid-driver.js +32 -3
- package/dist/method.d.ts +11 -0
- package/dist/method.js +3 -0
- package/dist/mysql-driver.js +4 -0
- package/dist/provider.d.ts +6 -11
- package/dist/provider.js +2 -2
- package/dist/service.d.ts +16 -6
- package/dist/service.js +13 -2
- package/dist/third-service.d.ts +75 -0
- package/dist/third-service.js +96 -0
- package/dist/typebox-driver.d.ts +6 -0
- package/dist/typebox-driver.js +73 -12
- package/dist/utils.d.ts +25 -10
- package/dist/utils.js +28 -11
- package/docs/dto.md +73 -66
- package/docs/third-service.md +122 -0
- package/package.json +4 -1
- package/src/controller.ts +40 -0
- package/src/convert.ts +42 -15
- package/src/curd.ts +98 -93
- package/src/dao.ts +172 -13
- package/src/db.ts +186 -181
- package/src/dsl.ts +26 -1
- package/src/dto.ts +263 -247
- package/src/endpoint.ts +18 -0
- package/src/exception.ts +28 -0
- package/src/field-rule.ts +47 -0
- package/src/flow.ts +143 -103
- package/src/index.ts +43 -33
- package/src/mermaid-driver.ts +112 -84
- package/src/method.ts +20 -0
- package/src/mysql-driver.ts +4 -0
- package/src/provider.ts +67 -72
- package/src/service.ts +42 -20
- package/src/third-service.ts +186 -0
- package/src/typebox-driver.ts +82 -11
- package/src/utils.ts +63 -26
- package/dist/check-inheritance.d.ts +0 -9
- package/dist/check-inheritance.js +0 -58
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** snake_case → camelCase: order_no → orderNo; names without underscores are unchanged */
|
|
2
|
-
function toCamelCase(name) {
|
|
3
|
-
return name.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
4
|
-
}
|
|
5
|
-
function isDtoMessage(v) {
|
|
6
|
-
if (typeof v !== 'object' || v === null)
|
|
7
|
-
return false;
|
|
8
|
-
const o = v;
|
|
9
|
-
return o.type === 'dto' && typeof o.name === 'string' && typeof o.fields === 'object' && o.fields !== null;
|
|
10
|
-
}
|
|
11
|
-
function collectFields(mod) {
|
|
12
|
-
const out = [];
|
|
13
|
-
for (const [name, v] of Object.entries(mod)) {
|
|
14
|
-
if (isDtoMessage(v)) {
|
|
15
|
-
const container = v;
|
|
16
|
-
for (const [fname, f] of Object.entries(container.fields)) {
|
|
17
|
-
out.push({ name: fname, field: f.field, container: name });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return out;
|
|
22
|
-
}
|
|
23
|
-
/** Check one loaded DSL module (its exports) for inheritance gaps. */
|
|
24
|
-
export function checkInheritance(mod, file) {
|
|
25
|
-
const fields = collectFields(mod);
|
|
26
|
-
if (fields.length === 0)
|
|
27
|
-
return [];
|
|
28
|
-
// Infer the tables this file is about from the referenced fields' schema identity.
|
|
29
|
-
const tables = new Map(); // table -> camelCol -> origCol
|
|
30
|
-
for (const f of fields) {
|
|
31
|
-
const schema = f.field.schema;
|
|
32
|
-
if (schema?.type !== 'table')
|
|
33
|
-
continue;
|
|
34
|
-
const table = schema;
|
|
35
|
-
if (!tables.has(table.name))
|
|
36
|
-
tables.set(table.name, new Map());
|
|
37
|
-
tables.get(table.name).set(toCamelCase(f.name), f.name);
|
|
38
|
-
}
|
|
39
|
-
if (tables.size === 0)
|
|
40
|
-
return [];
|
|
41
|
-
const issues = [];
|
|
42
|
-
for (const f of fields) {
|
|
43
|
-
if (f.field.schema?.type === 'table')
|
|
44
|
-
continue;
|
|
45
|
-
if (f.field.semantic !== undefined || f.field.type === 'enum')
|
|
46
|
-
continue;
|
|
47
|
-
const candidates = [];
|
|
48
|
-
for (const [t, cols] of tables) {
|
|
49
|
-
const orig = cols.get(f.name);
|
|
50
|
-
if (orig !== undefined)
|
|
51
|
-
candidates.push(`${t}.${orig}`);
|
|
52
|
-
}
|
|
53
|
-
if (candidates.length > 0) {
|
|
54
|
-
issues.push({ file, container: f.container, field: f.name, candidates });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return issues;
|
|
58
|
-
}
|