@voxgig/apidef 2.4.1 → 3.0.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/apidef.d.ts +5 -1
- package/dist/apidef.js +197 -112
- package/dist/apidef.js.map +1 -1
- package/dist/builder/entity/entity.d.ts +3 -0
- package/dist/builder/entity/{apiEntity.js → entity.js} +12 -9
- package/dist/builder/entity/entity.js.map +1 -0
- package/dist/builder/entity/info.d.ts +3 -0
- package/dist/builder/entity/info.js +22 -0
- package/dist/builder/entity/info.js.map +1 -0
- package/dist/builder/entity.js +7 -21
- package/dist/builder/entity.js.map +1 -1
- package/dist/builder/flow/flowHeuristic01.js +21 -11
- package/dist/builder/flow/flowHeuristic01.js.map +1 -1
- package/dist/builder/flow.d.ts +2 -1
- package/dist/builder/flow.js +29 -4
- package/dist/builder/flow.js.map +1 -1
- package/dist/def.d.ts +62 -0
- package/dist/def.js +4 -0
- package/dist/def.js.map +1 -0
- package/dist/desc.d.ts +89 -0
- package/dist/desc.js +4 -0
- package/dist/desc.js.map +1 -0
- package/dist/guide/guide.d.ts +2 -1
- package/dist/guide/guide.js +161 -30
- package/dist/guide/guide.js.map +1 -1
- package/dist/guide/heuristic01.d.ts +2 -1
- package/dist/guide/heuristic01.js +1120 -234
- package/dist/guide/heuristic01.js.map +1 -1
- package/dist/model.d.ts +55 -0
- package/dist/model.js +4 -0
- package/dist/model.js.map +1 -0
- package/dist/parse.d.ts +1 -2
- package/dist/parse.js +8 -47
- package/dist/parse.js.map +1 -1
- package/dist/transform/args.d.ts +3 -0
- package/dist/transform/args.js +58 -0
- package/dist/transform/args.js.map +1 -0
- package/dist/transform/clean.js +27 -3
- package/dist/transform/clean.js.map +1 -1
- package/dist/transform/entity.d.ts +11 -3
- package/dist/transform/entity.js +57 -41
- package/dist/transform/entity.js.map +1 -1
- package/dist/transform/field.d.ts +3 -3
- package/dist/transform/field.js +90 -65
- package/dist/transform/field.js.map +1 -1
- package/dist/transform/operation.d.ts +1 -1
- package/dist/transform/operation.js +94 -296
- package/dist/transform/operation.js.map +1 -1
- package/dist/transform/select.d.ts +3 -0
- package/dist/transform/select.js +44 -0
- package/dist/transform/select.js.map +1 -0
- package/dist/transform/top.d.ts +9 -0
- package/dist/transform/top.js +11 -2
- package/dist/transform/top.js.map +1 -1
- package/dist/transform.js +4 -0
- package/dist/transform.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +112 -19
- package/dist/types.js +4 -2
- package/dist/types.js.map +1 -1
- package/dist/utility.d.ts +30 -2
- package/dist/utility.js +381 -6
- package/dist/utility.js.map +1 -1
- package/model/apidef.jsonic +75 -1
- package/model/guide.jsonic +14 -44
- package/package.json +17 -14
- package/src/apidef.ts +264 -121
- package/src/builder/entity/{apiEntity.ts → entity.ts} +18 -11
- package/src/builder/entity/info.ts +53 -0
- package/src/builder/entity.ts +9 -35
- package/src/builder/flow/flowHeuristic01.ts +46 -12
- package/src/builder/flow.ts +39 -5
- package/src/def.ts +91 -0
- package/src/desc.ts +143 -0
- package/src/guide/guide.ts +207 -134
- package/src/guide/heuristic01.ts +1651 -272
- package/src/model.ts +98 -0
- package/src/parse.ts +5 -61
- package/src/schematron.ts.off +317 -0
- package/src/transform/args.ts +102 -0
- package/src/transform/clean.ts +43 -8
- package/src/transform/entity.ts +100 -51
- package/src/transform/field.ts +150 -71
- package/src/transform/operation.ts +118 -414
- package/src/transform/select.ts +90 -0
- package/src/transform/top.ts +76 -3
- package/src/transform.ts +4 -0
- package/src/types.ts +185 -5
- package/src/utility.ts +481 -9
- package/dist/builder/entity/apiEntity.d.ts +0 -3
- package/dist/builder/entity/apiEntity.js.map +0 -1
- package/dist/builder/entity/def.d.ts +0 -3
- package/dist/builder/entity/def.js +0 -19
- package/dist/builder/entity/def.js.map +0 -1
- package/src/builder/entity/def.ts +0 -44
- package/src/guide.ts.off +0 -136
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectTransform = void 0;
|
|
4
|
+
const jostraca_1 = require("jostraca");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const selectTransform = async function (ctx) {
|
|
7
|
+
const { apimodel, def, guide } = ctx;
|
|
8
|
+
const kit = apimodel.main[types_1.KIT];
|
|
9
|
+
let msg = 'select ';
|
|
10
|
+
(0, jostraca_1.each)(kit.entity, (ment, entname) => {
|
|
11
|
+
(0, jostraca_1.each)(ment.op, (mop, opname) => {
|
|
12
|
+
(0, jostraca_1.each)(mop.alts, (malt) => {
|
|
13
|
+
const pdef = def.paths[malt.orig];
|
|
14
|
+
resolveSelect(guide, ment, mop, malt, pdef);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
msg += ment.name + ' ';
|
|
18
|
+
});
|
|
19
|
+
return { ok: true, msg };
|
|
20
|
+
};
|
|
21
|
+
exports.selectTransform = selectTransform;
|
|
22
|
+
function resolveSelect(guide, ment, mop, malt, pdef) {
|
|
23
|
+
const select = malt.select;
|
|
24
|
+
const margs = malt.args;
|
|
25
|
+
const argkinds = ['param', 'query', 'header', 'cookie'];
|
|
26
|
+
argkinds.map((kind) => {
|
|
27
|
+
(0, jostraca_1.each)(margs[kind], (marg) => {
|
|
28
|
+
select[kind] = (select[kind] ?? {});
|
|
29
|
+
if (marg.req) {
|
|
30
|
+
select[kind][marg.name] = true;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const gent = guide.entity[ment.name];
|
|
35
|
+
const gpath = gent.path[malt.orig];
|
|
36
|
+
// console.log('GPATH', gpath)
|
|
37
|
+
if (gpath.action) {
|
|
38
|
+
const actname = Object.keys(gpath.action)[0];
|
|
39
|
+
if (null != actname) {
|
|
40
|
+
select.$action = actname;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/transform/select.ts"],"names":[],"mappings":";;;AAEA,uCAAwC;AAOxC,oCAA8B;AAuB9B,MAAM,eAAe,GAAG,KAAK,WAC3B,GAAQ;IAER,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,CAAA;IACpC,MAAM,GAAG,GAAa,QAAQ,CAAC,IAAI,CAAC,WAAG,CAAC,CAAA;IAExC,IAAI,GAAG,GAAG,SAAS,CAAA;IAEnB,IAAA,eAAI,EAAC,GAAG,CAAC,MAAM,EAAE,CAAC,IAAiB,EAAE,OAAe,EAAE,EAAE;QACtD,IAAA,eAAI,EAAC,IAAI,CAAC,EAAE,EAAE,CAAC,GAAY,EAAE,MAAc,EAAE,EAAE;YAC7C,IAAA,eAAI,EAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAc,EAAE,EAAE;gBAChC,MAAM,IAAI,GAAY,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBAC1C,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAC1B,CAAC,CAAA;AAoCC,0CAAe;AAjCjB,SAAS,aAAa,CAAC,KAAY,EAAE,IAAiB,EAAE,GAAY,EAAE,IAAc,EAAE,IAAa;IACjG,MAAM,MAAM,GAAQ,IAAI,CAAC,MAAM,CAAA;IAC/B,MAAM,KAAK,GAAQ,IAAI,CAAC,IAAI,CAAA;IAE5B,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEvD,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;QAC5B,IAAA,eAAI,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAc,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;YAEnC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;YAChC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAElC,8BAA8B;IAE9B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAE5C,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;QAC1B,CAAC;IACH,CAAC;AAEH,CAAC"}
|
package/dist/transform/top.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { TransformResult } from '../transform';
|
|
2
|
+
import type { GuidePath, PathDesc, OpDesc } from '../desc';
|
|
3
|
+
import type { OpName } from '../model';
|
|
4
|
+
type GuideEntity = {
|
|
5
|
+
name: string;
|
|
6
|
+
path: Record<string, GuidePath>;
|
|
7
|
+
paths$: PathDesc[];
|
|
8
|
+
opm$: Record<OpName, OpDesc>;
|
|
9
|
+
};
|
|
2
10
|
declare const topTransform: (ctx: any) => Promise<TransformResult>;
|
|
3
11
|
export { topTransform };
|
|
12
|
+
export type { GuideEntity, };
|
package/dist/transform/top.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.topTransform = void 0;
|
|
4
|
+
const struct_1 = require("@voxgig/struct");
|
|
5
|
+
const types_1 = require("../types");
|
|
4
6
|
const topTransform = async function (ctx) {
|
|
5
7
|
const { apimodel, def } = ctx;
|
|
6
|
-
apimodel.main.
|
|
7
|
-
|
|
8
|
+
const kit = apimodel.main[types_1.KIT];
|
|
9
|
+
kit.info = def.info;
|
|
10
|
+
kit.info.servers = def.servers ?? [];
|
|
11
|
+
// Swagger 2.0
|
|
12
|
+
if (def.host) {
|
|
13
|
+
kit.info.servers.push({
|
|
14
|
+
url: (def.schemes?.[0] ?? 'https') + '://' + (0, struct_1.joinurl)([def.host, def.basePath])
|
|
15
|
+
});
|
|
16
|
+
}
|
|
8
17
|
return { ok: true, msg: 'top' };
|
|
9
18
|
};
|
|
10
19
|
exports.topTransform = topTransform;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"top.js","sourceRoot":"","sources":["../../src/transform/top.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"top.js","sourceRoot":"","sources":["../../src/transform/top.ts"],"names":[],"mappings":";;;AAGA,2CAAwC;AAExC,oCAA8B;AAgE9B,MAAM,YAAY,GAAG,KAAK,WACxB,GAAQ;IAER,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;IAC7B,MAAM,GAAG,GAAa,QAAQ,CAAC,IAAI,CAAC,WAAG,CAAC,CAAA;IAExC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACnB,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAA;IAEpC,cAAc;IACd,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACpB,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAA,gBAAO,EAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;SAC/E,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AACjC,CAAC,CAAA;AAIC,oCAAY"}
|
package/dist/transform.js
CHANGED
|
@@ -8,11 +8,15 @@ const gubu_1 = require("gubu");
|
|
|
8
8
|
const top_1 = require("./transform/top");
|
|
9
9
|
const entity_1 = require("./transform/entity");
|
|
10
10
|
const operation_1 = require("./transform/operation");
|
|
11
|
+
const args_1 = require("./transform/args");
|
|
12
|
+
const select_1 = require("./transform/select");
|
|
11
13
|
const field_1 = require("./transform/field");
|
|
12
14
|
const TRANSFORM = {
|
|
13
15
|
top: top_1.topTransform,
|
|
14
16
|
entity: entity_1.entityTransform,
|
|
15
17
|
operation: operation_1.operationTransform,
|
|
18
|
+
args: args_1.argsTransform,
|
|
19
|
+
select: select_1.selectTransform,
|
|
16
20
|
field: field_1.fieldTransform,
|
|
17
21
|
// manual: manualTransform,
|
|
18
22
|
};
|
package/dist/transform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AA+G1C,0BAAO;AA1GT,uCAA+C;AAE/C,+BAAyC;AAEzC,yCAA8C;AAC9C,+CAAoD;AACpD,qDAA0D;AAC1D,2CAAgD;AAChD,+CAAoD;AACpD,6CAAkD;AAwClD,MAAM,SAAS,GAA8B;IAC3C,GAAG,EAAE,kBAAY;IACjB,MAAM,EAAE,wBAAe;IACvB,SAAS,EAAE,8BAAkB;IAC7B,IAAI,EAAE,oBAAa;IACnB,MAAM,EAAE,wBAAe;IACvB,KAAK,EAAE,sBAAc;IACrB,2BAA2B;CAC5B,CAAA;AAID,MAAM,MAAM,GAAQ;IAClB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;CACd,CAAA;AAwCC,wBAAM;AArCR,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC;IACtB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IACb,MAAM,EAAE,EAAE;CACX,CAAC,CAAA;AAiCA,gCAAU;AA3BZ,SAAS,OAAO,CAAC,IAAS,EAAE,IAAY,EAAE,IAAI,GAAG,MAAM;IACrD,IAAI,IAAI,IAAI,IAAI,IAAI,QAAQ,KAAK,OAAO,IAAI,IAAI,QAAQ,KAAK,OAAO,IAAI,EAAE,CAAC;QACzE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QAC7C,IAAI,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAA;QACrC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IAC/C,CAAC;SACI,CAAC;QACJ,2BAA2B;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/apidef.ts","../src/parse.ts","../src/resolver.ts","../src/transform.ts","../src/types.ts","../src/utility.ts","../src/builder/entity.ts","../src/builder/flow.ts","../src/builder/entity/
|
|
1
|
+
{"root":["../src/apidef.ts","../src/def.ts","../src/desc.ts","../src/model.ts","../src/parse.ts","../src/resolver.ts","../src/transform.ts","../src/types.ts","../src/utility.ts","../src/builder/entity.ts","../src/builder/flow.ts","../src/builder/entity/entity.ts","../src/builder/entity/info.ts","../src/builder/flow/flowheuristic01.ts","../src/guide/guide.ts","../src/guide/heuristic01.ts","../src/transform/args.ts","../src/transform/clean.ts","../src/transform/entity.ts","../src/transform/field.ts","../src/transform/operation.ts","../src/transform/select.ts","../src/transform/top.ts"],"version":"5.9.3"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as Fs from 'node:fs';
|
|
2
2
|
import { Pino, prettyPino } from '@voxgig/util';
|
|
3
|
+
declare const KIT = "kit";
|
|
3
4
|
type FsUtil = typeof Fs;
|
|
4
5
|
type Log = ReturnType<typeof prettyPino>;
|
|
6
|
+
type TypeName = 'String' | 'Number' | 'Integer' | 'Boolean' | 'Null' | 'Array' | 'Object' | 'Any';
|
|
5
7
|
type ApiDefOptions = {
|
|
6
8
|
def?: string;
|
|
7
9
|
fs?: any;
|
|
@@ -11,6 +13,9 @@ type ApiDefOptions = {
|
|
|
11
13
|
meta?: Record<string, any>;
|
|
12
14
|
outprefix?: string;
|
|
13
15
|
strategy?: string;
|
|
16
|
+
why?: {
|
|
17
|
+
show?: boolean;
|
|
18
|
+
};
|
|
14
19
|
};
|
|
15
20
|
declare const ControlShape: {
|
|
16
21
|
<V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
|
|
@@ -301,7 +306,7 @@ declare const ModelShape: {
|
|
|
301
306
|
name: string;
|
|
302
307
|
def: string;
|
|
303
308
|
main: {
|
|
304
|
-
|
|
309
|
+
kit: {};
|
|
305
310
|
def: {};
|
|
306
311
|
api: {
|
|
307
312
|
guide: {};
|
|
@@ -313,7 +318,7 @@ declare const ModelShape: {
|
|
|
313
318
|
name: StringConstructor;
|
|
314
319
|
def: StringConstructor;
|
|
315
320
|
main: {
|
|
316
|
-
|
|
321
|
+
kit: {};
|
|
317
322
|
def: {};
|
|
318
323
|
api: {
|
|
319
324
|
guide: {};
|
|
@@ -363,7 +368,7 @@ declare const ModelShape: {
|
|
|
363
368
|
name: StringConstructor;
|
|
364
369
|
def: StringConstructor;
|
|
365
370
|
main: {
|
|
366
|
-
|
|
371
|
+
kit: {};
|
|
367
372
|
def: {};
|
|
368
373
|
api: {
|
|
369
374
|
guide: {};
|
|
@@ -399,7 +404,7 @@ declare const OpenModelShape: {
|
|
|
399
404
|
name: string;
|
|
400
405
|
def: string;
|
|
401
406
|
main: {
|
|
402
|
-
|
|
407
|
+
kit: {};
|
|
403
408
|
def: {};
|
|
404
409
|
api: {
|
|
405
410
|
guide: {};
|
|
@@ -411,7 +416,7 @@ declare const OpenModelShape: {
|
|
|
411
416
|
name: StringConstructor;
|
|
412
417
|
def: StringConstructor;
|
|
413
418
|
main: {
|
|
414
|
-
|
|
419
|
+
kit: {};
|
|
415
420
|
def: {};
|
|
416
421
|
api: {
|
|
417
422
|
guide: {};
|
|
@@ -461,7 +466,7 @@ declare const OpenModelShape: {
|
|
|
461
466
|
name: StringConstructor;
|
|
462
467
|
def: StringConstructor;
|
|
463
468
|
main: {
|
|
464
|
-
|
|
469
|
+
kit: {};
|
|
465
470
|
def: {};
|
|
466
471
|
api: {
|
|
467
472
|
guide: {};
|
|
@@ -520,7 +525,7 @@ declare const OpenModelShape: {
|
|
|
520
525
|
name: string;
|
|
521
526
|
def: string;
|
|
522
527
|
main: {
|
|
523
|
-
|
|
528
|
+
kit: {};
|
|
524
529
|
def: {};
|
|
525
530
|
api: {
|
|
526
531
|
guide: {};
|
|
@@ -532,7 +537,7 @@ declare const OpenModelShape: {
|
|
|
532
537
|
name: StringConstructor;
|
|
533
538
|
def: StringConstructor;
|
|
534
539
|
main: {
|
|
535
|
-
|
|
540
|
+
kit: {};
|
|
536
541
|
def: {};
|
|
537
542
|
api: {
|
|
538
543
|
guide: {};
|
|
@@ -582,7 +587,7 @@ declare const OpenModelShape: {
|
|
|
582
587
|
name: StringConstructor;
|
|
583
588
|
def: StringConstructor;
|
|
584
589
|
main: {
|
|
585
|
-
|
|
590
|
+
kit: {};
|
|
586
591
|
def: {};
|
|
587
592
|
api: {
|
|
588
593
|
guide: {};
|
|
@@ -981,24 +986,112 @@ declare const OpenBuildShape: {
|
|
|
981
986
|
};
|
|
982
987
|
};
|
|
983
988
|
type Build = ReturnType<typeof BuildShape>;
|
|
984
|
-
type ApiModel = {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
def: Record<string, any>;
|
|
990
|
-
};
|
|
989
|
+
type ApiModel = {};
|
|
990
|
+
type KitModel = {
|
|
991
|
+
info: Record<string, any>;
|
|
992
|
+
entity: Record<string, any>;
|
|
993
|
+
flow: Record<string, any>;
|
|
991
994
|
};
|
|
992
995
|
type ApiDefResult = {
|
|
993
996
|
ok: boolean;
|
|
994
997
|
start: number;
|
|
995
998
|
end: number;
|
|
996
999
|
steps: string[];
|
|
997
|
-
|
|
1000
|
+
err?: any;
|
|
1001
|
+
ctrl?: Control;
|
|
998
1002
|
guide?: any;
|
|
999
1003
|
apimodel?: any;
|
|
1000
1004
|
ctx?: any;
|
|
1001
1005
|
jres?: any;
|
|
1002
1006
|
};
|
|
1003
|
-
|
|
1004
|
-
|
|
1007
|
+
type Metrics = {
|
|
1008
|
+
count: {
|
|
1009
|
+
path: number;
|
|
1010
|
+
method: number;
|
|
1011
|
+
origcmprefs: Record<string, number>;
|
|
1012
|
+
cmp: number;
|
|
1013
|
+
tag: number;
|
|
1014
|
+
entity: number;
|
|
1015
|
+
};
|
|
1016
|
+
found: {
|
|
1017
|
+
cmp: Record<string, any>;
|
|
1018
|
+
tag: Record<string, any>;
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
type ApiDefContext = {
|
|
1022
|
+
fs: any;
|
|
1023
|
+
log: any;
|
|
1024
|
+
spec: any;
|
|
1025
|
+
opts: any;
|
|
1026
|
+
util: any;
|
|
1027
|
+
defpath: string;
|
|
1028
|
+
model: any;
|
|
1029
|
+
apimodel: any;
|
|
1030
|
+
guide: any;
|
|
1031
|
+
def: any;
|
|
1032
|
+
note: any;
|
|
1033
|
+
warn: any;
|
|
1034
|
+
metrics: Metrics;
|
|
1035
|
+
work: Record<string, any>;
|
|
1036
|
+
};
|
|
1037
|
+
type Warner = {
|
|
1038
|
+
history: ({
|
|
1039
|
+
point: string;
|
|
1040
|
+
when: number;
|
|
1041
|
+
} & Record<string, any>)[];
|
|
1042
|
+
point: string;
|
|
1043
|
+
} & ((details: Record<string, any>) => void);
|
|
1044
|
+
type MethodName = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | '';
|
|
1045
|
+
type Guide = {
|
|
1046
|
+
metrics: GuideMetrics;
|
|
1047
|
+
entity: Record<string, GuideEntity>;
|
|
1048
|
+
control: GuideControl;
|
|
1049
|
+
};
|
|
1050
|
+
type GuideControl = {};
|
|
1051
|
+
type GuideMetrics = {
|
|
1052
|
+
count: {
|
|
1053
|
+
path: number;
|
|
1054
|
+
method: number;
|
|
1055
|
+
entity: number;
|
|
1056
|
+
tag: number;
|
|
1057
|
+
cmp: number;
|
|
1058
|
+
origcmprefs: Record<string, number>;
|
|
1059
|
+
};
|
|
1060
|
+
found: {
|
|
1061
|
+
tag: Record<string, string>;
|
|
1062
|
+
cmp: Record<string, string>;
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
type GuideEntity = {
|
|
1066
|
+
name: string;
|
|
1067
|
+
orig: string;
|
|
1068
|
+
path: Record<string, GuidePath>;
|
|
1069
|
+
};
|
|
1070
|
+
type GuidePath = {
|
|
1071
|
+
why_path: string[];
|
|
1072
|
+
action: Record<string, GuidePathAction>;
|
|
1073
|
+
rename: {
|
|
1074
|
+
param: Record<string, GuideRenameParam>;
|
|
1075
|
+
};
|
|
1076
|
+
op: Record<string, GuidePathOp>;
|
|
1077
|
+
};
|
|
1078
|
+
type GuidePathAction = {
|
|
1079
|
+
kind: string;
|
|
1080
|
+
why_action: string[];
|
|
1081
|
+
};
|
|
1082
|
+
type GuideRenameParam = {
|
|
1083
|
+
target: string;
|
|
1084
|
+
why_rename: string[];
|
|
1085
|
+
};
|
|
1086
|
+
type GuidePathOp = {
|
|
1087
|
+
method: string;
|
|
1088
|
+
why_op: string[];
|
|
1089
|
+
transform: {
|
|
1090
|
+
req: any;
|
|
1091
|
+
res: any;
|
|
1092
|
+
};
|
|
1093
|
+
};
|
|
1094
|
+
export { KIT, OpenControlShape, OpenModelShape, OpenBuildShape, };
|
|
1095
|
+
export type { Guide, GuideMetrics, GuideEntity, GuidePath, GuidePathAction, GuideRenameParam, GuidePathOp, KitModel, MethodName, TypeName, Log, FsUtil, ApiDefOptions, ApiDefResult, Control, Model, Build, ApiModel, ApiDefContext, Warner, Metrics, };
|
|
1096
|
+
export type { CmpDesc, BasicMethodDesc, MethodDesc, MethodEntityDesc, EntityDesc, EntityPathDesc, PathDesc, OpDesc, } from './desc';
|
|
1097
|
+
export type { OpName, ModelEntityRelations, ModelOpMap, ModelFieldOp, ModelField, ModelArg, ModelAlt, ModelOp, ModelEntity, } from './model';
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Copyright (c) 2025 Voxgig, MIT License */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OpenBuildShape = exports.OpenModelShape = exports.OpenControlShape = void 0;
|
|
4
|
+
exports.OpenBuildShape = exports.OpenModelShape = exports.OpenControlShape = exports.KIT = void 0;
|
|
5
5
|
const gubu_1 = require("gubu");
|
|
6
|
+
const KIT = 'kit';
|
|
7
|
+
exports.KIT = KIT;
|
|
6
8
|
const ControlShape = (0, gubu_1.Gubu)({
|
|
7
9
|
step: {
|
|
8
10
|
parse: true,
|
|
@@ -18,7 +20,7 @@ const ModelShape = (0, gubu_1.Gubu)({
|
|
|
18
20
|
name: String,
|
|
19
21
|
def: String,
|
|
20
22
|
main: {
|
|
21
|
-
|
|
23
|
+
[KIT]: {},
|
|
22
24
|
def: {},
|
|
23
25
|
api: {
|
|
24
26
|
guide: {},
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAK5C,+BAAsC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAK5C,+BAAsC;AAGtC,MAAM,GAAG,GAAG,KAAK,CAAA;AA6Of,kBAAG;AA7ML,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC;IACxB,IAAI,EAAE;QACJ,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAC,CAAA;AACF,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,IAAA,WAAI,EAAC,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAsMpE,4CAAgB;AAhMlB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC;IACtB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,IAAI,EAAE;QACJ,CAAC,GAAG,CAAC,EAAE,EAAE;QACT,GAAG,EAAE,EAAE;QACP,GAAG,EAAE;YACH,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC,CAAA;AACF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,IAAA,WAAI,EAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAqL9D,wCAAc;AAhLhB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,EAAE;QACP,EAAE,EAAE,IAAA,UAAG,GAAE;QACT,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,EAAE;QACb,KAAK,EAAE;YACL,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,IAAI;SACV;KACF;CACF,CAAC,CAAA;AACF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,IAAA,WAAI,EAAC,UAAU,CAAC,CAAC,CAAA;AA8J3C,wCAAc"}
|
package/dist/utility.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { FsUtil, Log } from './types';
|
|
1
|
+
import type { FsUtil, Log, Warner } from './types';
|
|
2
|
+
declare function makeWarner(spec: {
|
|
3
|
+
point: string;
|
|
4
|
+
log: Log;
|
|
5
|
+
}): Warner;
|
|
6
|
+
declare function writeFileSyncWarn(warn: Warner, fs: any, path: string, text: string): void;
|
|
2
7
|
declare function getdlog(tagin?: string, filepath?: string): ((...args: any[]) => void) & {
|
|
3
8
|
tag: string;
|
|
4
9
|
file: string;
|
|
@@ -9,4 +14,27 @@ declare function formatJsonSrc(jsonsrc: string): string;
|
|
|
9
14
|
declare function depluralize(word: string): string;
|
|
10
15
|
declare function find(obj: any, qkey: string): any[];
|
|
11
16
|
declare function capture(data: any, shape: any): Record<string, any>;
|
|
12
|
-
|
|
17
|
+
type PathMatch = (string[] & {
|
|
18
|
+
index: number;
|
|
19
|
+
expr: string;
|
|
20
|
+
path: string;
|
|
21
|
+
});
|
|
22
|
+
declare function pathMatch(path: string | string[], expr: string): null | PathMatch;
|
|
23
|
+
declare function formatJSONIC(val?: any, opts?: {
|
|
24
|
+
hsepd?: number;
|
|
25
|
+
$?: boolean;
|
|
26
|
+
color?: boolean;
|
|
27
|
+
maxlines?: number;
|
|
28
|
+
exclude?: string[];
|
|
29
|
+
}): string;
|
|
30
|
+
declare function validator(torig: undefined | string | string[]): any;
|
|
31
|
+
declare function canonize(s: string): string;
|
|
32
|
+
declare function warnOnError(where: string, warn: Warner, fn: Function, result?: any): any;
|
|
33
|
+
declare function debugpath(pathStr: string, methodName: string | null | undefined, ...args: any[]): void;
|
|
34
|
+
declare function findPathsWithPrefix(ctx: any, pathStr: string, opts?: {
|
|
35
|
+
strict?: boolean;
|
|
36
|
+
param?: boolean;
|
|
37
|
+
}): number;
|
|
38
|
+
declare function nom(v: any, format: string): string;
|
|
39
|
+
export type { PathMatch };
|
|
40
|
+
export { nom, getdlog, loadFile, formatJsonSrc, depluralize, find, capture, pathMatch, makeWarner, formatJSONIC, validator, canonize, debugpath, findPathsWithPrefix, writeFileSyncWarn, warnOnError, };
|