@voxgig/apidef 1.9.0 → 2.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.
Files changed (73) hide show
  1. package/dist/apidef.d.ts +3 -29
  2. package/dist/apidef.js +65 -186
  3. package/dist/apidef.js.map +1 -1
  4. package/dist/builder/entity/apiEntity.d.ts +3 -0
  5. package/dist/builder/entity/apiEntity.js +51 -0
  6. package/dist/builder/entity/apiEntity.js.map +1 -0
  7. package/dist/builder/entity/def.d.ts +3 -0
  8. package/dist/builder/entity/def.js +19 -0
  9. package/dist/builder/entity/def.js.map +1 -0
  10. package/dist/builder/entity.d.ts +2 -0
  11. package/dist/builder/entity.js +30 -0
  12. package/dist/builder/entity.js.map +1 -0
  13. package/dist/builder/flow/flowHeuristic01.d.ts +2 -0
  14. package/dist/builder/flow/flowHeuristic01.js +153 -0
  15. package/dist/builder/flow/flowHeuristic01.js.map +1 -0
  16. package/dist/builder/flow.d.ts +2 -0
  17. package/dist/builder/flow.js +41 -0
  18. package/dist/builder/flow.js.map +1 -0
  19. package/dist/guide/heuristic01.d.ts +2 -0
  20. package/dist/guide/heuristic01.js +119 -0
  21. package/dist/guide/heuristic01.js.map +1 -0
  22. package/dist/guide.d.ts +2 -0
  23. package/dist/guide.js +60 -0
  24. package/dist/guide.js.map +1 -0
  25. package/dist/parse.d.ts +1 -1
  26. package/dist/parse.js +5 -4
  27. package/dist/parse.js.map +1 -1
  28. package/dist/resolver.d.ts +2 -0
  29. package/dist/resolver.js +62 -0
  30. package/dist/resolver.js.map +1 -0
  31. package/dist/transform/entity.js +25 -4
  32. package/dist/transform/entity.js.map +1 -1
  33. package/dist/transform/field.js +4 -84
  34. package/dist/transform/field.js.map +1 -1
  35. package/dist/transform/operation.d.ts +2 -2
  36. package/dist/transform/operation.js +60 -30
  37. package/dist/transform/operation.js.map +1 -1
  38. package/dist/transform/top.d.ts +2 -2
  39. package/dist/transform/top.js +5 -4
  40. package/dist/transform/top.js.map +1 -1
  41. package/dist/transform.d.ts +1 -1
  42. package/dist/transform.js +20 -10
  43. package/dist/transform.js.map +1 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/dist/types.d.ts +691 -0
  46. package/dist/types.js +39 -0
  47. package/dist/types.js.map +1 -0
  48. package/dist/utility.d.ts +5 -0
  49. package/dist/utility.js +84 -0
  50. package/dist/utility.js.map +1 -0
  51. package/model/apidef.jsonic +28 -24
  52. package/package.json +9 -7
  53. package/src/apidef.ts +94 -271
  54. package/src/builder/entity/apiEntity.ts +88 -0
  55. package/src/builder/entity/def.ts +44 -0
  56. package/src/builder/entity.ts +54 -0
  57. package/src/builder/flow/flowHeuristic01.ts +200 -0
  58. package/src/builder/flow.ts +61 -0
  59. package/src/guide/heuristic01.ts +178 -0
  60. package/src/guide.ts +87 -0
  61. package/src/parse.ts +6 -4
  62. package/src/resolver.ts +91 -0
  63. package/src/transform/entity.ts +36 -10
  64. package/src/transform/field.ts +9 -92
  65. package/src/transform/operation.ts +112 -46
  66. package/src/transform/top.ts +11 -9
  67. package/src/transform.ts +22 -11
  68. package/src/types.ts +89 -0
  69. package/src/utility.ts +161 -0
  70. package/dist/transform/manual.d.ts +0 -3
  71. package/dist/transform/manual.js +0 -12
  72. package/dist/transform/manual.js.map +0 -1
  73. package/src/transform/manual.ts +0 -29
@@ -0,0 +1,691 @@
1
+ import * as Fs from 'node:fs';
2
+ import { Pino, prettyPino } from '@voxgig/util';
3
+ type FsUtil = typeof Fs;
4
+ type Log = ReturnType<typeof prettyPino>;
5
+ type ApiDefOptions = {
6
+ def?: string;
7
+ fs?: any;
8
+ pino?: ReturnType<typeof Pino>;
9
+ debug?: boolean | string;
10
+ folder?: string;
11
+ meta?: Record<string, any>;
12
+ outprefix?: string;
13
+ strategy?: string;
14
+ };
15
+ declare const ModelShape: {
16
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
17
+ name: string;
18
+ def: string;
19
+ main: {
20
+ sdk: {};
21
+ def: {};
22
+ api: {
23
+ guide: {};
24
+ entity: {};
25
+ };
26
+ };
27
+ };
28
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
29
+ name: StringConstructor;
30
+ def: StringConstructor;
31
+ main: {
32
+ sdk: {};
33
+ def: {};
34
+ api: {
35
+ guide: {};
36
+ entity: {};
37
+ };
38
+ };
39
+ };
40
+ match(root?: any, ctx?: import("gubu").Context): boolean;
41
+ error(root?: any, ctx?: import("gubu").Context): {
42
+ gubu: boolean;
43
+ code: string;
44
+ gname: string;
45
+ props: ({
46
+ path: string;
47
+ type: string;
48
+ value: any;
49
+ }[]);
50
+ desc: () => ({
51
+ name: string;
52
+ code: string;
53
+ err: {
54
+ key: string;
55
+ type: string;
56
+ node: import("gubu").Node<any>;
57
+ value: any;
58
+ path: string;
59
+ why: string;
60
+ check: string;
61
+ args: Record<string, any>;
62
+ mark: number;
63
+ text: string;
64
+ use: any;
65
+ }[];
66
+ ctx: any;
67
+ });
68
+ toJSON(): /*elided*/ any & {
69
+ err: any;
70
+ name: string;
71
+ message: string;
72
+ };
73
+ name: string;
74
+ message: string;
75
+ stack?: string;
76
+ }[];
77
+ spec(): any;
78
+ node(): import("gubu").Node<{
79
+ name: StringConstructor;
80
+ def: StringConstructor;
81
+ main: {
82
+ sdk: {};
83
+ def: {};
84
+ api: {
85
+ guide: {};
86
+ entity: {};
87
+ };
88
+ };
89
+ }>;
90
+ stringify(...rest: any[]): string;
91
+ jsonify(): any;
92
+ toString(this: any): string;
93
+ gubu: {
94
+ gubu$: symbol;
95
+ v$: string;
96
+ };
97
+ };
98
+ declare const OpenModelShape: {
99
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
100
+ valid: {};
101
+ match: {};
102
+ error: {};
103
+ spec: {};
104
+ node: {};
105
+ stringify: {};
106
+ jsonify: {};
107
+ toString: {};
108
+ gubu: {
109
+ gubu$: symbol;
110
+ v$: string;
111
+ };
112
+ };
113
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
114
+ <V_1>(root?: V_1 | undefined, ctx?: import("gubu").Context): V_1 & {
115
+ name: string;
116
+ def: string;
117
+ main: {
118
+ sdk: {};
119
+ def: {};
120
+ api: {
121
+ guide: {};
122
+ entity: {};
123
+ };
124
+ };
125
+ };
126
+ valid: <V_1>(root?: V_1 | undefined, ctx?: import("gubu").Context) => root is V_1 & {
127
+ name: StringConstructor;
128
+ def: StringConstructor;
129
+ main: {
130
+ sdk: {};
131
+ def: {};
132
+ api: {
133
+ guide: {};
134
+ entity: {};
135
+ };
136
+ };
137
+ };
138
+ match(root?: any, ctx?: import("gubu").Context): boolean;
139
+ error(root?: any, ctx?: import("gubu").Context): {
140
+ gubu: boolean;
141
+ code: string;
142
+ gname: string;
143
+ props: ({
144
+ path: string;
145
+ type: string;
146
+ value: any;
147
+ }[]);
148
+ desc: () => ({
149
+ name: string;
150
+ code: string;
151
+ err: {
152
+ key: string;
153
+ type: string;
154
+ node: import("gubu").Node<any>;
155
+ value: any;
156
+ path: string;
157
+ why: string;
158
+ check: string;
159
+ args: Record<string, any>;
160
+ mark: number;
161
+ text: string;
162
+ use: any;
163
+ }[];
164
+ ctx: any;
165
+ });
166
+ toJSON(): /*elided*/ any & {
167
+ err: any;
168
+ name: string;
169
+ message: string;
170
+ };
171
+ name: string;
172
+ message: string;
173
+ stack?: string;
174
+ }[];
175
+ spec(): any;
176
+ node(): import("gubu").Node<{
177
+ name: StringConstructor;
178
+ def: StringConstructor;
179
+ main: {
180
+ sdk: {};
181
+ def: {};
182
+ api: {
183
+ guide: {};
184
+ entity: {};
185
+ };
186
+ };
187
+ }>;
188
+ stringify(...rest: any[]): string;
189
+ jsonify(): any;
190
+ toString(this: any): string;
191
+ gubu: {
192
+ gubu$: symbol;
193
+ v$: string;
194
+ };
195
+ };
196
+ match(root?: any, ctx?: import("gubu").Context): boolean;
197
+ error(root?: any, ctx?: import("gubu").Context): {
198
+ gubu: boolean;
199
+ code: string;
200
+ gname: string;
201
+ props: ({
202
+ path: string;
203
+ type: string;
204
+ value: any;
205
+ }[]);
206
+ desc: () => ({
207
+ name: string;
208
+ code: string;
209
+ err: {
210
+ key: string;
211
+ type: string;
212
+ node: import("gubu").Node<any>;
213
+ value: any;
214
+ path: string;
215
+ why: string;
216
+ check: string;
217
+ args: Record<string, any>;
218
+ mark: number;
219
+ text: string;
220
+ use: any;
221
+ }[];
222
+ ctx: any;
223
+ });
224
+ toJSON(): /*elided*/ any & {
225
+ err: any;
226
+ name: string;
227
+ message: string;
228
+ };
229
+ name: string;
230
+ message: string;
231
+ stack?: string;
232
+ }[];
233
+ spec(): any;
234
+ node(): import("gubu").Node<{
235
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
236
+ name: string;
237
+ def: string;
238
+ main: {
239
+ sdk: {};
240
+ def: {};
241
+ api: {
242
+ guide: {};
243
+ entity: {};
244
+ };
245
+ };
246
+ };
247
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
248
+ name: StringConstructor;
249
+ def: StringConstructor;
250
+ main: {
251
+ sdk: {};
252
+ def: {};
253
+ api: {
254
+ guide: {};
255
+ entity: {};
256
+ };
257
+ };
258
+ };
259
+ match(root?: any, ctx?: import("gubu").Context): boolean;
260
+ error(root?: any, ctx?: import("gubu").Context): {
261
+ gubu: boolean;
262
+ code: string;
263
+ gname: string;
264
+ props: ({
265
+ path: string;
266
+ type: string;
267
+ value: any;
268
+ }[]);
269
+ desc: () => ({
270
+ name: string;
271
+ code: string;
272
+ err: {
273
+ key: string;
274
+ type: string;
275
+ node: import("gubu").Node<any>;
276
+ value: any;
277
+ path: string;
278
+ why: string;
279
+ check: string;
280
+ args: Record<string, any>;
281
+ mark: number;
282
+ text: string;
283
+ use: any;
284
+ }[];
285
+ ctx: any;
286
+ });
287
+ toJSON(): /*elided*/ any & {
288
+ err: any;
289
+ name: string;
290
+ message: string;
291
+ };
292
+ name: string;
293
+ message: string;
294
+ stack?: string;
295
+ }[];
296
+ spec(): any;
297
+ node(): import("gubu").Node<{
298
+ name: StringConstructor;
299
+ def: StringConstructor;
300
+ main: {
301
+ sdk: {};
302
+ def: {};
303
+ api: {
304
+ guide: {};
305
+ entity: {};
306
+ };
307
+ };
308
+ }>;
309
+ stringify(...rest: any[]): string;
310
+ jsonify(): any;
311
+ toString(this: any): string;
312
+ gubu: {
313
+ gubu$: symbol;
314
+ v$: string;
315
+ };
316
+ }>;
317
+ stringify(...rest: any[]): string;
318
+ jsonify(): any;
319
+ toString(this: any): string;
320
+ gubu: {
321
+ gubu$: symbol;
322
+ v$: string;
323
+ };
324
+ };
325
+ type Model = ReturnType<typeof ModelShape>;
326
+ declare const BuildShape: {
327
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
328
+ spec: {
329
+ base: string;
330
+ path: string;
331
+ debug: string;
332
+ use: {};
333
+ res: never[];
334
+ require: string;
335
+ log: {};
336
+ fs: any;
337
+ watch: {
338
+ mod: boolean;
339
+ add: boolean;
340
+ rem: boolean;
341
+ };
342
+ };
343
+ };
344
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
345
+ spec: {
346
+ base: string;
347
+ path: string;
348
+ debug: string;
349
+ use: {};
350
+ res: never[];
351
+ require: string;
352
+ log: {};
353
+ fs: import("gubu").Node<unknown>;
354
+ watch: {
355
+ mod: boolean;
356
+ add: boolean;
357
+ rem: boolean;
358
+ };
359
+ };
360
+ };
361
+ match(root?: any, ctx?: import("gubu").Context): boolean;
362
+ error(root?: any, ctx?: import("gubu").Context): {
363
+ gubu: boolean;
364
+ code: string;
365
+ gname: string;
366
+ props: ({
367
+ path: string;
368
+ type: string;
369
+ value: any;
370
+ }[]);
371
+ desc: () => ({
372
+ name: string;
373
+ code: string;
374
+ err: {
375
+ key: string;
376
+ type: string;
377
+ node: import("gubu").Node<any>;
378
+ value: any;
379
+ path: string;
380
+ why: string;
381
+ check: string;
382
+ args: Record<string, any>;
383
+ mark: number;
384
+ text: string;
385
+ use: any;
386
+ }[];
387
+ ctx: any;
388
+ });
389
+ toJSON(): /*elided*/ any & {
390
+ err: any;
391
+ name: string;
392
+ message: string;
393
+ };
394
+ name: string;
395
+ message: string;
396
+ stack?: string;
397
+ }[];
398
+ spec(): any;
399
+ node(): import("gubu").Node<{
400
+ spec: {
401
+ base: string;
402
+ path: string;
403
+ debug: string;
404
+ use: {};
405
+ res: never[];
406
+ require: string;
407
+ log: {};
408
+ fs: import("gubu").Node<unknown>;
409
+ watch: {
410
+ mod: boolean;
411
+ add: boolean;
412
+ rem: boolean;
413
+ };
414
+ };
415
+ }>;
416
+ stringify(...rest: any[]): string;
417
+ jsonify(): any;
418
+ toString(this: any): string;
419
+ gubu: {
420
+ gubu$: symbol;
421
+ v$: string;
422
+ };
423
+ };
424
+ declare const OpenBuildShape: {
425
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
426
+ valid: {};
427
+ match: {};
428
+ error: {};
429
+ spec: {};
430
+ node: {};
431
+ stringify: {};
432
+ jsonify: {};
433
+ toString: {};
434
+ gubu: {
435
+ gubu$: symbol;
436
+ v$: string;
437
+ };
438
+ };
439
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
440
+ <V_1>(root?: V_1 | undefined, ctx?: import("gubu").Context): V_1 & {
441
+ spec: {
442
+ base: string;
443
+ path: string;
444
+ debug: string;
445
+ use: {};
446
+ res: never[];
447
+ require: string;
448
+ log: {};
449
+ fs: any;
450
+ watch: {
451
+ mod: boolean;
452
+ add: boolean;
453
+ rem: boolean;
454
+ };
455
+ };
456
+ };
457
+ valid: <V_1>(root?: V_1 | undefined, ctx?: import("gubu").Context) => root is V_1 & {
458
+ spec: {
459
+ base: string;
460
+ path: string;
461
+ debug: string;
462
+ use: {};
463
+ res: never[];
464
+ require: string;
465
+ log: {};
466
+ fs: import("gubu").Node<unknown>;
467
+ watch: {
468
+ mod: boolean;
469
+ add: boolean;
470
+ rem: boolean;
471
+ };
472
+ };
473
+ };
474
+ match(root?: any, ctx?: import("gubu").Context): boolean;
475
+ error(root?: any, ctx?: import("gubu").Context): {
476
+ gubu: boolean;
477
+ code: string;
478
+ gname: string;
479
+ props: ({
480
+ path: string;
481
+ type: string;
482
+ value: any;
483
+ }[]);
484
+ desc: () => ({
485
+ name: string;
486
+ code: string;
487
+ err: {
488
+ key: string;
489
+ type: string;
490
+ node: import("gubu").Node<any>;
491
+ value: any;
492
+ path: string;
493
+ why: string;
494
+ check: string;
495
+ args: Record<string, any>;
496
+ mark: number;
497
+ text: string;
498
+ use: any;
499
+ }[];
500
+ ctx: any;
501
+ });
502
+ toJSON(): /*elided*/ any & {
503
+ err: any;
504
+ name: string;
505
+ message: string;
506
+ };
507
+ name: string;
508
+ message: string;
509
+ stack?: string;
510
+ }[];
511
+ spec(): any;
512
+ node(): import("gubu").Node<{
513
+ spec: {
514
+ base: string;
515
+ path: string;
516
+ debug: string;
517
+ use: {};
518
+ res: never[];
519
+ require: string;
520
+ log: {};
521
+ fs: import("gubu").Node<unknown>;
522
+ watch: {
523
+ mod: boolean;
524
+ add: boolean;
525
+ rem: boolean;
526
+ };
527
+ };
528
+ }>;
529
+ stringify(...rest: any[]): string;
530
+ jsonify(): any;
531
+ toString(this: any): string;
532
+ gubu: {
533
+ gubu$: symbol;
534
+ v$: string;
535
+ };
536
+ };
537
+ match(root?: any, ctx?: import("gubu").Context): boolean;
538
+ error(root?: any, ctx?: import("gubu").Context): {
539
+ gubu: boolean;
540
+ code: string;
541
+ gname: string;
542
+ props: ({
543
+ path: string;
544
+ type: string;
545
+ value: any;
546
+ }[]);
547
+ desc: () => ({
548
+ name: string;
549
+ code: string;
550
+ err: {
551
+ key: string;
552
+ type: string;
553
+ node: import("gubu").Node<any>;
554
+ value: any;
555
+ path: string;
556
+ why: string;
557
+ check: string;
558
+ args: Record<string, any>;
559
+ mark: number;
560
+ text: string;
561
+ use: any;
562
+ }[];
563
+ ctx: any;
564
+ });
565
+ toJSON(): /*elided*/ any & {
566
+ err: any;
567
+ name: string;
568
+ message: string;
569
+ };
570
+ name: string;
571
+ message: string;
572
+ stack?: string;
573
+ }[];
574
+ spec(): any;
575
+ node(): import("gubu").Node<{
576
+ <V>(root?: V | undefined, ctx?: import("gubu").Context): V & {
577
+ spec: {
578
+ base: string;
579
+ path: string;
580
+ debug: string;
581
+ use: {};
582
+ res: never[];
583
+ require: string;
584
+ log: {};
585
+ fs: any;
586
+ watch: {
587
+ mod: boolean;
588
+ add: boolean;
589
+ rem: boolean;
590
+ };
591
+ };
592
+ };
593
+ valid: <V>(root?: V | undefined, ctx?: import("gubu").Context) => root is V & {
594
+ spec: {
595
+ base: string;
596
+ path: string;
597
+ debug: string;
598
+ use: {};
599
+ res: never[];
600
+ require: string;
601
+ log: {};
602
+ fs: import("gubu").Node<unknown>;
603
+ watch: {
604
+ mod: boolean;
605
+ add: boolean;
606
+ rem: boolean;
607
+ };
608
+ };
609
+ };
610
+ match(root?: any, ctx?: import("gubu").Context): boolean;
611
+ error(root?: any, ctx?: import("gubu").Context): {
612
+ gubu: boolean;
613
+ code: string;
614
+ gname: string;
615
+ props: ({
616
+ path: string;
617
+ type: string;
618
+ value: any;
619
+ }[]);
620
+ desc: () => ({
621
+ name: string;
622
+ code: string;
623
+ err: {
624
+ key: string;
625
+ type: string;
626
+ node: import("gubu").Node<any>;
627
+ value: any;
628
+ path: string;
629
+ why: string;
630
+ check: string;
631
+ args: Record<string, any>;
632
+ mark: number;
633
+ text: string;
634
+ use: any;
635
+ }[];
636
+ ctx: any;
637
+ });
638
+ toJSON(): /*elided*/ any & {
639
+ err: any;
640
+ name: string;
641
+ message: string;
642
+ };
643
+ name: string;
644
+ message: string;
645
+ stack?: string;
646
+ }[];
647
+ spec(): any;
648
+ node(): import("gubu").Node<{
649
+ spec: {
650
+ base: string;
651
+ path: string;
652
+ debug: string;
653
+ use: {};
654
+ res: never[];
655
+ require: string;
656
+ log: {};
657
+ fs: import("gubu").Node<unknown>;
658
+ watch: {
659
+ mod: boolean;
660
+ add: boolean;
661
+ rem: boolean;
662
+ };
663
+ };
664
+ }>;
665
+ stringify(...rest: any[]): string;
666
+ jsonify(): any;
667
+ toString(this: any): string;
668
+ gubu: {
669
+ gubu$: symbol;
670
+ v$: string;
671
+ };
672
+ }>;
673
+ stringify(...rest: any[]): string;
674
+ jsonify(): any;
675
+ toString(this: any): string;
676
+ gubu: {
677
+ gubu$: symbol;
678
+ v$: string;
679
+ };
680
+ };
681
+ type Build = ReturnType<typeof BuildShape>;
682
+ type ApiModel = {
683
+ main: {
684
+ api: {
685
+ entity: Record<string, any>;
686
+ };
687
+ def: Record<string, any>;
688
+ };
689
+ };
690
+ export { OpenModelShape, OpenBuildShape, };
691
+ export type { Log, FsUtil, ApiDefOptions, Model, Build, ApiModel, };
package/dist/types.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /* Copyright (c) 2025 Voxgig, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OpenBuildShape = exports.OpenModelShape = void 0;
5
+ const gubu_1 = require("gubu");
6
+ const ModelShape = (0, gubu_1.Gubu)({
7
+ name: String,
8
+ def: String,
9
+ main: {
10
+ sdk: {},
11
+ def: {},
12
+ api: {
13
+ guide: {},
14
+ entity: {},
15
+ },
16
+ }
17
+ });
18
+ const OpenModelShape = (0, gubu_1.Gubu)((0, gubu_1.Open)(ModelShape), { name: 'Model' });
19
+ exports.OpenModelShape = OpenModelShape;
20
+ const BuildShape = (0, gubu_1.Gubu)({
21
+ spec: {
22
+ base: '',
23
+ path: '',
24
+ debug: '',
25
+ use: {},
26
+ res: [],
27
+ require: '',
28
+ log: {},
29
+ fs: (0, gubu_1.Any)(),
30
+ watch: {
31
+ mod: true,
32
+ add: true,
33
+ rem: true,
34
+ }
35
+ }
36
+ });
37
+ const OpenBuildShape = (0, gubu_1.Gubu)((0, gubu_1.Open)(BuildShape));
38
+ exports.OpenBuildShape = OpenBuildShape;
39
+ //# sourceMappingURL=types.js.map