@gesslar/bedoc 1.1.0 → 1.3.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.
Files changed (49) hide show
  1. package/dist/types/cli.d.ts +3 -0
  2. package/dist/types/cli.d.ts.map +10 -0
  3. package/dist/types/core/ActionManager.d.ts +27 -0
  4. package/dist/types/core/ActionManager.d.ts.map +10 -0
  5. package/dist/types/core/Configuration.d.ts +27 -0
  6. package/dist/types/core/Configuration.d.ts.map +10 -0
  7. package/dist/types/core/ConfigurationParameters.d.ts +38 -0
  8. package/dist/types/core/ConfigurationParameters.d.ts.map +10 -0
  9. package/dist/types/core/Conveyor.d.ts +47 -0
  10. package/dist/types/core/Conveyor.d.ts.map +10 -0
  11. package/dist/types/core/Core.d.ts +53 -0
  12. package/dist/types/core/Core.d.ts.map +10 -0
  13. package/dist/types/core/Discovery.d.ts +73 -0
  14. package/dist/types/core/Discovery.d.ts.map +10 -0
  15. package/dist/types/core/HookManager.d.ts +60 -0
  16. package/dist/types/core/HookManager.d.ts.map +10 -0
  17. package/dist/types/core/Logger.d.ts +55 -0
  18. package/dist/types/core/Logger.d.ts.map +10 -0
  19. package/dist/types/core/action/ParseManager.d.ts +8 -0
  20. package/dist/types/core/action/ParseManager.d.ts.map +10 -0
  21. package/dist/types/core/action/PrintManager.d.ts +8 -0
  22. package/dist/types/core/action/PrintManager.d.ts.map +10 -0
  23. package/dist/types/core/util/ActionUtil.d.ts +35 -0
  24. package/dist/types/core/util/ActionUtil.d.ts.map +10 -0
  25. package/dist/types/core/util/DataUtil.d.ts +52 -0
  26. package/dist/types/core/util/DataUtil.d.ts.map +10 -0
  27. package/dist/types/core/util/FDUtil.d.ts +146 -0
  28. package/dist/types/core/util/FDUtil.d.ts.map +10 -0
  29. package/dist/types/core/util/ModuleUtil.d.ts +27 -0
  30. package/dist/types/core/util/ModuleUtil.d.ts.map +10 -0
  31. package/dist/types/core/util/StringUtil.d.ts +5 -0
  32. package/dist/types/core/util/StringUtil.d.ts.map +10 -0
  33. package/dist/types/core/util/TypeSpec.d.ts +42 -0
  34. package/dist/types/core/util/TypeSpec.d.ts.map +10 -0
  35. package/dist/types/core/util/ValidUtil.d.ts +29 -0
  36. package/dist/types/core/util/ValidUtil.d.ts.map +10 -0
  37. package/package.json +10 -3
  38. package/src/cli.js +12 -11
  39. package/src/core/ActionManager.js +85 -22
  40. package/src/core/Conveyor.js +36 -16
  41. package/src/core/Core.js +68 -78
  42. package/src/core/Discovery.js +219 -65
  43. package/src/core/{HooksManager.js → HookManager.js} +14 -13
  44. package/src/core/Logger.js +3 -11
  45. package/src/core/action/ParseManager.js +0 -19
  46. package/src/core/action/PrintManager.js +0 -19
  47. package/src/core/util/DataUtil.js +3 -1
  48. package/src/core/util/FDUtil.js +1 -1
  49. package/tsconfig.json +20 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "cli.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../src/cli.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": ""
10
+ }
@@ -0,0 +1,27 @@
1
+ import Logger from './Logger';
2
+ import HookManager from './HookManager';
3
+
4
+ export interface ActionDefinition {
5
+ action: string;
6
+ contract: Record<string, unknown>;
7
+ meta: Record<string, unknown>;
8
+ }
9
+
10
+ export default class ActionManager {
11
+ constructor(actionDefinition: ActionDefinition, logger: Logger);
12
+ get action(): ActionDefinition;
13
+ set hookManager(hookManager: HookManager);
14
+ get hookManager(): HookManager;
15
+ get contract(): Record<string, unknown>;
16
+ get meta(): Record<string, unknown>;
17
+ get log(): Logger;
18
+ setupAction(): Promise<void>;
19
+ runAction({ file, content }: {
20
+ file: string;
21
+ content: string;
22
+ }): Promise<string>;
23
+ cleanupAction(): Promise<void>;
24
+ toString(): string;
25
+ #private;
26
+ }
27
+ //# sourceMappingURL=ActionManager.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "ActionManager.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/ActionManager.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAEA;IAQE,gDAKC;IAsBD,kBAEC;IAMD,kCAQC;IAZD,uBAEC;IAYD,oBAEC;IAED,gBAEC;IAED,eAEC;IA0CD,6BAKC;IAED;;;qBAWC;IAED,+BAMC;IAED,mBAEC;;CACF"
10
+ }
@@ -0,0 +1,27 @@
1
+ import { Environment } from './Core';
2
+
3
+ interface ConfigurationOption {
4
+ value: unknown;
5
+ source: string;
6
+ }
7
+
8
+ interface ConfigurationOptions {
9
+ [key: string]: ConfigurationOption;
10
+ }
11
+
12
+ interface ValidateParams {
13
+ options: ConfigurationOptions;
14
+ source: typeof Environment;
15
+ }
16
+
17
+ interface ValidationResult {
18
+ status: 'success';
19
+ validated: boolean;
20
+ [key: string]: unknown;
21
+ }
22
+
23
+ export default class Configuration {
24
+ validate({ options, source }: ValidateParams): Promise<ValidationResult>;
25
+ #private;
26
+ }
27
+ //# sourceMappingURL=Configuration.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Configuration.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/Configuration.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAiBA;IACE;;;;;;OAqHC;;CAwMF"
10
+ }
@@ -0,0 +1,38 @@
1
+ import TypeSpec from './util/TypeSpec';
2
+
3
+ interface PathConfig {
4
+ type: 'file' | 'directory';
5
+ mustExist: boolean;
6
+ }
7
+
8
+ interface ConfigurationParameter {
9
+ short: string;
10
+ param?: string;
11
+ description: string;
12
+ type: TypeSpec;
13
+ required: boolean;
14
+ default?: boolean | number | string;
15
+ path?: PathConfig;
16
+ exclusiveOf?: string;
17
+ }
18
+
19
+ interface ConfigurationParametersType {
20
+ input: ConfigurationParameter;
21
+ exclude: ConfigurationParameter;
22
+ language: ConfigurationParameter;
23
+ format: ConfigurationParameter;
24
+ maxConcurrent: ConfigurationParameter;
25
+ hooks: ConfigurationParameter;
26
+ output: ConfigurationParameter;
27
+ parser: ConfigurationParameter;
28
+ printer: ConfigurationParameter;
29
+ hookTimeout: ConfigurationParameter;
30
+ mock: ConfigurationParameter;
31
+ config: ConfigurationParameter;
32
+ debug: ConfigurationParameter;
33
+ debugLevel: ConfigurationParameter;
34
+ }
35
+
36
+ export const ConfigurationParameters: Readonly<ConfigurationParametersType>;
37
+ export const ConfigurationPriorityKeys: readonly ['exclude', 'input'];
38
+ //# sourceMappingURL=ConfigurationParameters.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "ConfigurationParameters.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/ConfigurationParameters.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqIE;AAEF,0DAAqE"
10
+ }
@@ -0,0 +1,47 @@
1
+ import ActionManager from './ActionManager';
2
+ import Logger from './Logger';
3
+ import { FileMap } from './util/FDUtil';
4
+
5
+ interface ProcessResult {
6
+ status: 'success' | 'error' | 'warning';
7
+ file?: FileMap;
8
+ error?: Error;
9
+ warning?: string;
10
+ result?: string;
11
+ destFile?: string;
12
+ content?: string;
13
+ }
14
+
15
+ interface ConveyResult {
16
+ succeeded: Array<{ input: FileMap; output: FileMap }>;
17
+ errored: Array<{ input: FileMap; error: Error }>;
18
+ }
19
+
20
+ export default class Conveyor {
21
+ constructor(
22
+ parse: ActionManager,
23
+ print: ActionManager,
24
+ logger: Logger,
25
+ output: FileMap
26
+ );
27
+
28
+ readonly parse: ActionManager;
29
+ readonly print: ActionManager;
30
+ readonly logger: Logger;
31
+ readonly output: FileMap;
32
+
33
+ /**
34
+ * Processes files with a concurrency limit.
35
+ *
36
+ * @param files - List of files to process.
37
+ * @param maxConcurrent - Maximum number of concurrent tasks.
38
+ * @returns Resolves when all files are processed.
39
+ */
40
+ convey(files: FileMap[], maxConcurrent?: number): Promise<ConveyResult>;
41
+
42
+ #succeeded: Array<{ input: FileMap; output: FileMap }>;
43
+ #errored: Array<{ input: FileMap; error: Error }>;
44
+ #processFile(file: FileMap): Promise<ProcessResult>;
45
+ #writeOutput(destFile: string, content: string): Promise<ProcessResult>;
46
+ }
47
+ //# sourceMappingURL=Conveyor.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Conveyor.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/Conveyor.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAMA;IAIE,8DAKC;IAJC,WAAkB;IAClB,WAAkB;IAClB,YAAoB;IACpB,YAAoB;IAGtB;;;;;;OAMG;IACH,qCAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CA8B3B;;CAgFF"
10
+ }
@@ -0,0 +1,53 @@
1
+ import Logger from './Logger';
2
+ import ActionManager from './ActionManager';
3
+ import { FileMap } from './util/FDUtil';
4
+
5
+ export const Environment: Readonly<{
6
+ EXTENSION: 'extension';
7
+ NPM: 'npm';
8
+ ACTION: 'action';
9
+ CLI: 'cli';
10
+ }>;
11
+
12
+ export type EnvironmentType = typeof Environment[keyof typeof Environment];
13
+
14
+ interface CoreOptions {
15
+ debug?: boolean;
16
+ debugLevel?: number;
17
+ name?: string;
18
+ [key: string]: unknown;
19
+ }
20
+
21
+ interface CoreConstructorOptions extends CoreOptions {
22
+ hooks?: string;
23
+ hooksTimeout?: number;
24
+ output?: string;
25
+ maxConcurrent?: number;
26
+ }
27
+
28
+ interface NewParams {
29
+ options: CoreOptions;
30
+ source: EnvironmentType;
31
+ }
32
+
33
+ interface ProcessResult {
34
+ succeeded: Array<{ input: FileMap; output: FileMap }>;
35
+ errored: Array<{ input: FileMap; error: Error }>;
36
+ }
37
+
38
+ export default class Core {
39
+ static new({ options, source }: NewParams): Promise<Core>;
40
+
41
+ constructor(options: CoreConstructorOptions);
42
+
43
+ readonly options: CoreConstructorOptions;
44
+ readonly logger: Logger;
45
+ readonly packageJson: Record<string, unknown>;
46
+ readonly debugOptions: {
47
+ name: string | null;
48
+ debugLevel: number;
49
+ };
50
+ readonly actions: Record<string, ActionManager>;
51
+
52
+ processFiles(glob: string | string[], startTime?: [number, number]): Promise<ProcessResult>;
53
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Core.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/Core.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAkBA;;;;;GAKE;AAEF;IASE;;;sBAoFC;IA5FD,0BAMC;IALC,aAAsB;IAEtB,eAAgE;IAChE,iBAAiD;IACjD;;;MAAuC;IAyFzC;;;OAsDC;CACF;mBA3KkB,aAAa"
10
+ }
@@ -0,0 +1,73 @@
1
+ import Core from './Core';
2
+ import { FileMap } from './util/FDUtil';
3
+ import ActionManager from './ActionManager';
4
+
5
+ interface DiscoveryOptions {
6
+ print?: FileMap;
7
+ parse?: FileMap;
8
+ }
9
+
10
+ interface ActionDefinition {
11
+ file: FileMap;
12
+ action: {
13
+ meta: {
14
+ action: string;
15
+ [key: string]: unknown;
16
+ };
17
+ };
18
+ contract: Record<string, unknown>;
19
+ }
20
+
21
+ interface ActionMap {
22
+ print: ActionDefinition[];
23
+ parse: ActionDefinition[];
24
+ [key: string]: ActionDefinition[];
25
+ }
26
+
27
+ interface ValidCriteria {
28
+ parse: ActionDefinition[];
29
+ print: ActionDefinition[];
30
+ }
31
+
32
+ export default class Discovery {
33
+ constructor(core: Core);
34
+ readonly core: Core;
35
+
36
+ /**
37
+ * Discover actions from local or global node_modules
38
+ *
39
+ * @param specific Configuration options for action discovery
40
+ * @returns A map of discovered modules
41
+ */
42
+ discoverActions(specific?: DiscoveryOptions): Promise<ActionMap>;
43
+
44
+ /**
45
+ * Check which actions satisfy the configuration criteria
46
+ */
47
+ satisfyCriteria(actions: ActionMap, validatedConfig: Record<string, unknown>): ValidCriteria;
48
+
49
+ #loadModule(module: FileMap): Promise<{
50
+ file: FileMap;
51
+ actions: ActionManager[];
52
+ contracts: string[];
53
+ }>;
54
+
55
+ #getModuleExports(dirMap: FileMap): FileMap[];
56
+
57
+ #loadActionsAndContracts(
58
+ moduleFiles: FileMap[],
59
+ specific: {
60
+ print?: FileMap;
61
+ parse?: FileMap;
62
+ }
63
+ ): Promise<ActionMap>;
64
+
65
+ #validMeta(
66
+ actionType: string,
67
+ toValidate: {
68
+ action: ActionDefinition['action'];
69
+ contract: ActionDefinition['contract'];
70
+ }
71
+ ): boolean;
72
+ }
73
+ //# sourceMappingURL=Discovery.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Discovery.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/Discovery.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAYA;IAIE,uBAIC;IAHC,UAAgB;IAKlB;;;;;;;OAOG;IACH,0BAJG;QAAyB,KAAK,GAAtB,MAAM;QACW,KAAK,GAAtB,MAAM;KACd,GAAU,OAAO,CAAC,MAAM,CAAC,CAsE3B;IA6JD;;;MAiDC;;CA4DF"
10
+ }
@@ -0,0 +1,60 @@
1
+ import Logger from './Logger';
2
+ import { FileMap } from './util/FDUtil';
3
+
4
+ type HookEvent = 'start' | 'section_load' | 'enter' | 'exit' | 'end';
5
+
6
+ interface HookResult {
7
+ status?: 'success' | 'error';
8
+ error?: Error;
9
+ [key: string]: unknown;
10
+ }
11
+
12
+ interface HooksDefinition {
13
+ setup?: () => Promise<void>;
14
+ cleanup?: () => Promise<void>;
15
+ start?: (...args: unknown[]) => Promise<HookResult>;
16
+ section_load?: (...args: unknown[]) => Promise<HookResult>;
17
+ enter?: (...args: unknown[]) => Promise<HookResult>;
18
+ exit?: (...args: unknown[]) => Promise<HookResult>;
19
+ end?: (...args: unknown[]) => Promise<HookResult>;
20
+ log?: Logger;
21
+ }
22
+
23
+ interface HookManagerConstructorParams {
24
+ action: string;
25
+ hooksFile: FileMap;
26
+ logger: Logger;
27
+ timeOut: number;
28
+ }
29
+
30
+ export const hookPoints: Readonly<Record<Uppercase<HookEvent>, HookEvent>>;
31
+
32
+ export default class HookManager {
33
+ static new(arg: HookManagerConstructorParams): Promise<HookManager | null>;
34
+
35
+ constructor({ action, hooksFile, logger, timeOut: timeout }: HookManagerConstructorParams);
36
+
37
+ get action(): string;
38
+ get hooksFile(): FileMap;
39
+ get hooks(): HooksDefinition | null;
40
+ get log(): Logger;
41
+ get timeout(): number;
42
+ get setup(): (() => Promise<void>) | null;
43
+ get cleanup(): (() => Promise<void>) | null;
44
+
45
+ /**
46
+ * Trigger a hook
47
+ *
48
+ * @param event - The type of hook to trigger
49
+ * @param args - The hook arguments
50
+ * @returns The result of the hook
51
+ */
52
+ on(event: HookEvent, ...args: unknown[]): Promise<HookResult | undefined>;
53
+
54
+ #hooksFile: FileMap | null;
55
+ #log: Logger | null;
56
+ #hooks: HooksDefinition | null;
57
+ #action: string | null;
58
+ #timeout: number;
59
+ }
60
+ //# sourceMappingURL=HookManager.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "HookManager.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/HookManager.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAUA,sCAKC;AAED;IA0CE,6CAsCC;IAzED;;;;;OAKC;IAED,kBAEC;IAED,qBAEC;IAED,iBAEC;IAED,eAEC;IAED,sBAEC;IAED,iBAEC;IAED,mBAEC;IA0CD;;;;;;OAMG;IACH,UAJW,MAAM,WACH,GAAG,EAAA,GACJ,OAAO,CAAC,GAAG,CAAC,CAsCxB;;CACF"
10
+ }
@@ -0,0 +1,55 @@
1
+ import ErrorStackParser from 'error-stack-parser';
2
+ import * as vscode from 'vscode';
3
+
4
+ interface LoggerOptions {
5
+ name?: string;
6
+ debugLevel?: number;
7
+ env?: string;
8
+ }
9
+
10
+ type LogLevel = 'debug' | 'warn' | 'info' | 'error';
11
+ type DebugLevel = 0 | 1 | 2 | 3 | 4;
12
+
13
+ /**
14
+ * Logger class
15
+ *
16
+ * Log levels:
17
+ * - debug: Debugging information
18
+ * - Debug levels
19
+ * - 0: No/critical debug information, not error level, but should be logged
20
+ * - 1: Basic debug information, startup, shutdown, etc
21
+ * - 2: Intermediate debug information, discovery
22
+ * - 3: Detailed debug information, parsing, processing, etc
23
+ * - 4: Very detailed debug information, nerd mode!
24
+ * - warn: Warning information
25
+ * - info: Informational information
26
+ * - error: Error information
27
+ */
28
+ export default class Logger {
29
+ constructor(options?: LoggerOptions);
30
+
31
+ readonly vscodeError?: typeof vscode.window.showErrorMessage;
32
+ readonly vscodeWarn?: typeof vscode.window.showWarningMessage;
33
+ readonly vscodeInfo?: typeof vscode.window.showInformationMessage;
34
+
35
+ get name(): string;
36
+ get debugLevel(): number;
37
+ get options(): Required<Pick<LoggerOptions, 'name' | 'debugLevel'>>;
38
+
39
+ setOptions(options: LoggerOptions): void;
40
+
41
+ lastStackLine(error?: Error, stepsRemoved?: number): ErrorStackParser.StackFrame;
42
+ extractFileFunction(level?: DebugLevel): string;
43
+
44
+ newDebug(tag?: string): (message: string, level?: DebugLevel, ...args: unknown[]) => void;
45
+
46
+ debug(message: string, level?: DebugLevel, ...args: unknown[]): void;
47
+ warn(message: string, ...args: unknown[]): void;
48
+ info(message: string, ...args: unknown[]): void;
49
+ error(message: string, ...args: unknown[]): void;
50
+
51
+ #name: string | null;
52
+ #debugLevel: number;
53
+ #compose(level: LogLevel, message: string, debugLevel?: DebugLevel): string;
54
+ }
55
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Logger.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../src/core/Logger.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAkDA;;;;;;;;;;;;;;;;GAgBG;AAEH;IAIE,0BAWC;IALK,iBAAiD;IACjD,gBAAkD;IAClD,gBAAsD;IAK5D,gBAEC;IAED,yBAEC;IAED;;;MAKC;IAED,+BAGC;IAWD,iFAGC;IAED,4CAoCC;IAED,wBAKC;IAED,yDAGC;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;;CACF;6BA7J4B,oBAAoB"
10
+ }
@@ -0,0 +1,8 @@
1
+ import ActionManager from '../ActionManager';
2
+ import Logger from '../Logger';
3
+ import { ActionDefinition } from "../ActionManager";
4
+
5
+ export default class ParseManager extends ActionManager {
6
+ constructor(actionDefinition: ActionDefinition, logger: Logger);
7
+ }
8
+ //# sourceMappingURL=ParseManager.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "ParseManager.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../../src/core/action/ParseManager.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAEA;IACE,gDAEC;CACF;0BANyB,qBAAqB"
10
+ }
@@ -0,0 +1,8 @@
1
+ import ActionManager from '../ActionManager';
2
+ import Logger from '../Logger';
3
+ import { ActionDefinition } from "../ActionManager";
4
+
5
+ export default class PrintManager extends ActionManager {
6
+ constructor(actionDefinition: ActionDefinition, logger: Logger);
7
+ }
8
+ //# sourceMappingURL=PrintManager.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "PrintManager.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../../src/core/action/PrintManager.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAEA;IACE,gDAEC;CACF;0BANyB,qBAAqB"
10
+ }
@@ -0,0 +1,35 @@
1
+ import { FileMap } from './FDUtil';
2
+
3
+ type ActionType = 'parse' | 'print';
4
+
5
+ interface ActionMeta {
6
+ action: ActionType;
7
+ language?: string;
8
+ format?: string;
9
+ }
10
+
11
+ interface ActionRequirement {
12
+ action: ActionType;
13
+ }
14
+
15
+ type ActionMetaRequirement = ActionRequirement | keyof ActionMeta;
16
+
17
+ export const actionMetaRequirements: Readonly<Record<ActionType, ActionMetaRequirement[]>>;
18
+ export const actionTypes: readonly ActionType[];
19
+
20
+ /**
21
+ * Loads a JSON file asynchronously
22
+ *
23
+ * @param jsonFileObject - The JSON file to load
24
+ * @returns The parsed JSON content
25
+ */
26
+ export function loadJson(jsonFileObject: FileMap): Record<string, unknown>;
27
+
28
+ /**
29
+ * Loads the package.json file asynchronously
30
+ *
31
+ * @param basePath - The base path to use
32
+ * @returns The parsed package.json content
33
+ */
34
+ export function loadPackageJson(basePath?: string | FileMap | null): Record<string, unknown>;
35
+ //# sourceMappingURL=ActionUtil.d.ts.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "ActionUtil.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../../src/core/util/ActionUtil.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAQA;;;;;;;GAGE;AALF,4CAA8C;AAO9C;;;;;GAKG;AACH,yCAHW,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;GAKG;AACH,2CAHW,MAAM,GAAC,MAAM,GACX,MAAM,CAOlB"
10
+ }
@@ -0,0 +1,52 @@
1
+ import Logger from '../Logger';
2
+ import TypeSpec from './TypeSpec';
3
+
4
+ type PrimitiveType = 'undefined' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'object' | 'function';
5
+ type ConstructorType = 'object' | 'array' | 'function' | 'date' | 'regexp' | 'error' | 'map' | 'set' | 'weakmap' | 'weakset' | 'promise' | 'int8array' | 'uint8array' | 'float32array' | 'float64array';
6
+ type DataType = PrimitiveType | ConstructorType;
7
+
8
+ export const dataTypes: readonly DataType[];
9
+ export const emptyableTypes: readonly ['string', 'array', 'object'];
10
+
11
+ interface TypeSpecOptions {
12
+ allowEmpty?: boolean;
13
+ }
14
+
15
+ interface SchemaCompareResult {
16
+ status: 'success' | 'error';
17
+ errors: Error[];
18
+ }
19
+
20
+ export function allocateObject<T>(source: string[], spec: T[] | ((source: string[]) => Promise<T[]>)): Promise<Record<string, T>>;
21
+ export function appendString(str: string, append: string): string;
22
+ export function prependString(str: string, prepend: string): string;
23
+ export function arrayIntersection<T>(arr1: T[], arr2: T[]): T[];
24
+ export function arrayPad<T>(arr: T[], length: number, value: T, position?: 0 | -1): T[];
25
+ export function isArrayUniform(arr: unknown[], type?: string): boolean;
26
+ export function isArrayUnique<T>(arr: T[]): T[];
27
+
28
+ export function cloneObject<T extends Record<string, unknown>>(obj: T, freeze?: boolean): T;
29
+ export function deepFreezeObject<T extends Record<string, unknown>>(obj: T): Readonly<T>;
30
+ export function isObjectEmpty(obj: Record<string, unknown>): boolean;
31
+
32
+ export function mapObject<T extends Record<string, unknown>>(
33
+ original: T,
34
+ transformer: (key: string, value: unknown) => Promise<unknown>,
35
+ mutate?: boolean
36
+ ): Promise<T>;
37
+
38
+ export function isNothing(value: unknown): value is null | undefined;
39
+ export function isEmpty(value: unknown, checkForNothing?: boolean): boolean;
40
+ export function isType(value: unknown, type: string | TypeSpec, options: TypeSpecOptions): boolean;
41
+ export function isBaseType(value: unknown, type: DataType): boolean;
42
+ export function isValidType(type: string): type is DataType;
43
+ export function typeOf(value: unknown): DataType;
44
+
45
+ export function newTypeSpec(str: string, options?: TypeSpecOptions): TypeSpec;
46
+
47
+ export function schemaCompare(
48
+ schema: Record<string, unknown>,
49
+ definition: Record<string, unknown>,
50
+ stack?: string[],
51
+ logger?: Logger
52
+ ): SchemaCompareResult;
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "DataUtil.d.ts",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "../../../../src/core/util/DataUtil.js"
7
+ ],
8
+ "names": [],
9
+ "mappings": "AAwCA,iCAA8E;AAE9E,sCAAoD;AAwGpD;;;;;;GAMG;AACH,uCAJW,GAAG,QACH,GAAG,WAAS,GACV,OAAO,CAAC,MAAM,CAAC,CA2C3B;AAtJD;;;;;;GAMG;AACH,qCAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAIlB;AAqCD;;;;;;GAMG;AACH,mEAEC;AAED;;;;;;;;;GASG;AACH,6CALW,MAAM,SACN,GAAG,aACH,MAAM,SAgBhB;AAED;;;;;;GAMG;AACH,iCAJW,MAAM,WACN,OAAO,GACL,MAAM,CAalB;AAqND;;;;;GAKG;AACH,sCAHW,MAAM,GACJ,MAAM,CAmBlB;AA1TD;;;;;;;GAOG;AACH,iDAJW,MAAM,GAEJ,OAAO,CAMnB;AAED;;;;;GAKG;AACH,iDAEC;AAkLD;;;;;;;;GAQG;AACH,kCAJW,GAAG,QACH,MAAM,GACJ,OAAO,CAgCnB;AAsBD;;;;;;;;GAQG;AACH,+BALW,GAAG,oBACH,OAAO,GAEL,OAAO,CAqBnB;AAtCD;;;;;GAKG;AACH,iCAHW,GAAG,GACD,OAAO,CAInB;AA1GD;;;;;GAKG;AACH,mCAHW,MAAM,GACJ,OAAO,CAInB;AAcD;;;;;;;GAOG;AACH,8BALW,GAAG,QACH,MAAM,GAAC,QAAQ,WACf,MAAM,GACJ,OAAO,CAOnB;AAED;;;;;GAKG;AACH,kCAHW,MAAM,GACJ,OAAO,CAInB;AApED;;;;;;;GAOG;AACH,oCALW,MAAM,kCAEN,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CAe3B;AAYD;;;;;;;GAOG;AACH,oCAJW,MAAM,WACN,MAAM,GACJ,MAAM,EAAE,CAIpB;AAxLD;;;;;;GAMG;AACH,sCAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAIlB;AA8TD;;;;;;;;GAQG;AACH,sCANW,MAAM,cACN,MAAM,0BAEN,MAAM,GACJ,OAAO,CA+DnB;AAjJD;;;;;GAKG;AACH,8BAHW,GAAG,GACD,MAAM,CAIlB;qBA1ToB,eAAe"
10
+ }