@voxgig/apidef 2.4.1 → 3.1.0
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 +7 -2
- package/dist/apidef.js +190 -114
- 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 +39 -12
- 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 +87 -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 +1122 -234
- package/dist/guide/heuristic01.js.map +1 -1
- package/dist/model.d.ts +90 -0
- package/dist/model.js +4 -0
- package/dist/model.js.map +1 -0
- package/dist/parse.d.ts +4 -3
- package/dist/parse.js +40 -46
- package/dist/parse.js.map +1 -1
- package/dist/resolver.js +2 -1
- package/dist/resolver.js.map +1 -1
- package/dist/transform/args.d.ts +3 -0
- package/dist/transform/args.js +54 -0
- package/dist/transform/args.js.map +1 -0
- package/dist/transform/clean.d.ts +2 -2
- package/dist/transform/clean.js +28 -3
- package/dist/transform/clean.js.map +1 -1
- package/dist/transform/entity.d.ts +9 -1
- package/dist/transform/entity.js +57 -41
- package/dist/transform/entity.js.map +1 -1
- package/dist/transform/field.d.ts +1 -1
- package/dist/transform/field.js +89 -65
- package/dist/transform/field.js.map +1 -1
- package/dist/transform/flow.d.ts +3 -0
- package/dist/transform/flow.js +26 -0
- package/dist/transform/flow.js.map +1 -0
- package/dist/transform/flowstep.d.ts +3 -0
- package/dist/transform/flowstep.js +145 -0
- package/dist/transform/flowstep.js.map +1 -0
- package/dist/transform/operation.d.ts +3 -3
- package/dist/transform/operation.js +101 -296
- package/dist/transform/operation.js.map +1 -1
- package/dist/transform/select.d.ts +3 -0
- package/dist/transform/select.js +65 -0
- package/dist/transform/select.js.map +1 -0
- package/dist/transform/top.js +24 -2
- package/dist/transform/top.js.map +1 -1
- package/dist/transform.d.ts +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 +115 -14
- package/dist/types.js +4 -2
- package/dist/types.js.map +1 -1
- package/dist/utility.d.ts +34 -2
- package/dist/utility.js +444 -6
- package/dist/utility.js.map +1 -1
- package/model/apidef.jsonic +76 -1
- package/model/guide.jsonic +14 -44
- package/package.json +19 -16
- package/src/apidef.ts +258 -122
- 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 +54 -13
- package/src/def.ts +91 -0
- package/src/desc.ts +154 -0
- package/src/guide/guide.ts +208 -134
- package/src/guide/heuristic01.ts +1653 -272
- package/src/model.ts +143 -0
- package/src/parse.ts +50 -59
- package/src/resolver.ts +3 -1
- package/src/schematron.ts.off +317 -0
- package/src/transform/args.ts +98 -0
- package/src/transform/clean.ts +45 -11
- package/src/transform/entity.ts +96 -50
- package/src/transform/field.ts +136 -75
- package/src/transform/flow.ts +59 -0
- package/src/transform/flowstep.ts +242 -0
- package/src/transform/operation.ts +119 -419
- package/src/transform/select.ts +119 -0
- package/src/transform/top.ts +46 -4
- package/src/transform.ts +8 -4
- package/src/types.ts +181 -5
- package/src/utility.ts +567 -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
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: {};
|
|
@@ -983,22 +988,118 @@ declare const OpenBuildShape: {
|
|
|
983
988
|
type Build = ReturnType<typeof BuildShape>;
|
|
984
989
|
type ApiModel = {
|
|
985
990
|
main: {
|
|
986
|
-
|
|
991
|
+
kit: {
|
|
992
|
+
info: Record<string, any>;
|
|
987
993
|
entity: Record<string, any>;
|
|
994
|
+
flow: Record<string, any>;
|
|
988
995
|
};
|
|
989
|
-
def: Record<string, any>;
|
|
990
996
|
};
|
|
991
997
|
};
|
|
998
|
+
type KitModel = {
|
|
999
|
+
info: Record<string, any>;
|
|
1000
|
+
entity: Record<string, any>;
|
|
1001
|
+
flow: Record<string, any>;
|
|
1002
|
+
};
|
|
992
1003
|
type ApiDefResult = {
|
|
993
1004
|
ok: boolean;
|
|
994
1005
|
start: number;
|
|
995
1006
|
end: number;
|
|
996
1007
|
steps: string[];
|
|
997
|
-
|
|
1008
|
+
err?: any;
|
|
1009
|
+
ctrl?: Control;
|
|
998
1010
|
guide?: any;
|
|
999
1011
|
apimodel?: any;
|
|
1000
1012
|
ctx?: any;
|
|
1001
1013
|
jres?: any;
|
|
1002
1014
|
};
|
|
1003
|
-
|
|
1004
|
-
|
|
1015
|
+
type Metrics = {
|
|
1016
|
+
count: {
|
|
1017
|
+
path: number;
|
|
1018
|
+
method: number;
|
|
1019
|
+
origcmprefs: Record<string, number>;
|
|
1020
|
+
cmp: number;
|
|
1021
|
+
tag: number;
|
|
1022
|
+
entity: number;
|
|
1023
|
+
};
|
|
1024
|
+
found: {
|
|
1025
|
+
cmp: Record<string, any>;
|
|
1026
|
+
tag: Record<string, any>;
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
type ApiDefContext = {
|
|
1030
|
+
fs: any;
|
|
1031
|
+
log: any;
|
|
1032
|
+
spec: any;
|
|
1033
|
+
opts: any;
|
|
1034
|
+
util: any;
|
|
1035
|
+
defpath: string;
|
|
1036
|
+
model: any;
|
|
1037
|
+
apimodel: any;
|
|
1038
|
+
guide: any;
|
|
1039
|
+
def: any;
|
|
1040
|
+
note: any;
|
|
1041
|
+
warn: any;
|
|
1042
|
+
metrics: Metrics;
|
|
1043
|
+
work: Record<string, any>;
|
|
1044
|
+
};
|
|
1045
|
+
type Warner = {
|
|
1046
|
+
history: ({
|
|
1047
|
+
point: string;
|
|
1048
|
+
when: number;
|
|
1049
|
+
} & Record<string, any>)[];
|
|
1050
|
+
point: string;
|
|
1051
|
+
} & ((details: Record<string, any>) => void);
|
|
1052
|
+
type MethodName = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | '';
|
|
1053
|
+
type Guide = {
|
|
1054
|
+
metrics: GuideMetrics;
|
|
1055
|
+
entity: Record<string, GuideEntity>;
|
|
1056
|
+
control: GuideControl;
|
|
1057
|
+
};
|
|
1058
|
+
type GuideControl = {};
|
|
1059
|
+
type GuideMetrics = {
|
|
1060
|
+
count: {
|
|
1061
|
+
path: number;
|
|
1062
|
+
method: number;
|
|
1063
|
+
entity: number;
|
|
1064
|
+
tag: number;
|
|
1065
|
+
cmp: number;
|
|
1066
|
+
origcmprefs: Record<string, number>;
|
|
1067
|
+
};
|
|
1068
|
+
found: {
|
|
1069
|
+
tag: Record<string, string>;
|
|
1070
|
+
cmp: Record<string, string>;
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
type GuideEntity = {
|
|
1074
|
+
name: string;
|
|
1075
|
+
orig: string;
|
|
1076
|
+
path: Record<string, GuidePath>;
|
|
1077
|
+
};
|
|
1078
|
+
type GuidePath = {
|
|
1079
|
+
why_path: string[];
|
|
1080
|
+
action: Record<string, GuidePathAction>;
|
|
1081
|
+
rename: {
|
|
1082
|
+
param: Record<string, GuideRenameParam>;
|
|
1083
|
+
};
|
|
1084
|
+
op: Record<string, GuidePathOp>;
|
|
1085
|
+
};
|
|
1086
|
+
type GuidePathAction = {
|
|
1087
|
+
kind: string;
|
|
1088
|
+
why_action: string[];
|
|
1089
|
+
};
|
|
1090
|
+
type GuideRenameParam = {
|
|
1091
|
+
target: string;
|
|
1092
|
+
why_rename: string[];
|
|
1093
|
+
};
|
|
1094
|
+
type GuidePathOp = {
|
|
1095
|
+
method: string;
|
|
1096
|
+
why_op: string[];
|
|
1097
|
+
transform: {
|
|
1098
|
+
req: any;
|
|
1099
|
+
res: any;
|
|
1100
|
+
};
|
|
1101
|
+
};
|
|
1102
|
+
export { KIT, OpenControlShape, OpenModelShape, OpenBuildShape, };
|
|
1103
|
+
export type { Guide, GuideMetrics, GuideEntity, GuidePath, GuidePathAction, GuideRenameParam, GuidePathOp, KitModel, MethodName, TypeName, Log, FsUtil, ApiDefOptions, ApiDefResult, Control, Model, Build, ApiModel, ApiDefContext, Warner, Metrics, };
|
|
1104
|
+
export type { CmpDesc, BasicMethodDesc, MethodDesc, MethodEntityDesc, EntityDesc, EntityPathDesc, PathDesc, OpDesc, } from './desc';
|
|
1105
|
+
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;AAyOf,kBAAG;AAzML,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;AAkMpE,4CAAgB;AA5LlB,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;AAiL9D,wCAAc;AA5KhB,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;AA0J3C,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,31 @@ 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
|
+
declare function relativizePath(path: string): string;
|
|
40
|
+
declare function getModelPath(model: any, path: string, flags?: {
|
|
41
|
+
required?: boolean;
|
|
42
|
+
}): any;
|
|
43
|
+
export type { PathMatch };
|
|
44
|
+
export { nom, getdlog, loadFile, formatJsonSrc, depluralize, find, capture, pathMatch, makeWarner, formatJSONIC, validator, canonize, debugpath, findPathsWithPrefix, writeFileSyncWarn, warnOnError, relativizePath, getModelPath, };
|