@gesslar/toolkit 0.5.0 → 0.7.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/package.json +8 -8
- package/src/lib/Collection.js +132 -17
- package/src/lib/Contract.js +1 -1
- package/src/lib/Data.js +27 -18
- package/src/lib/DirectoryObject.js +1 -1
- package/src/lib/FS.js +10 -0
- package/src/lib/Glog.js +27 -10
- package/src/lib/Logger.js +3 -0
- package/src/lib/Sass.js +6 -1
- package/src/lib/Tantrum.js +43 -0
- package/src/lib/TypeSpec.js +11 -7
- package/src/lib/Util.js +82 -0
- package/src/lib/Valid.js +24 -6
- package/src/types/Collection.d.ts +6 -1
- package/src/types/Contract.d.ts +27 -27
- package/src/types/Data.d.ts +23 -23
- package/src/types/FS.d.ts +3 -3
- package/src/types/Glog.d.ts +302 -49
- package/src/types/Sass.d.ts +1 -1
- package/src/types/Schemer.d.ts +29 -29
- package/src/types/Tantrum.d.ts +10 -10
- package/src/types/Term.d.ts +1 -1
- package/src/types/Terms.d.ts +21 -21
- package/src/types/Type.d.ts +1 -1
- package/src/types/Util.d.ts +20 -2
- package/src/types/index.d.ts +17 -23
- package/src/types/index.d.ts.map +1 -0
- package/src/types/lib/Cache.d.ts +28 -0
- package/src/types/lib/Cache.d.ts.map +1 -0
- package/src/types/lib/Collection.d.ts +246 -0
- package/src/types/lib/Collection.d.ts.map +1 -0
- package/src/types/lib/Contract.d.ts +72 -0
- package/src/types/lib/Contract.d.ts.map +1 -0
- package/src/types/lib/Data.d.ts +189 -0
- package/src/types/lib/Data.d.ts.map +1 -0
- package/src/types/lib/DirectoryObject.d.ts +148 -0
- package/src/types/lib/DirectoryObject.d.ts.map +1 -0
- package/src/types/lib/FS.d.ts +70 -0
- package/src/types/lib/FS.d.ts.map +1 -0
- package/src/types/lib/FileObject.d.ts +189 -0
- package/src/types/lib/FileObject.d.ts.map +1 -0
- package/src/types/lib/Glog.d.ts +113 -0
- package/src/types/lib/Glog.d.ts.map +1 -0
- package/src/types/lib/Logger.d.ts +46 -0
- package/src/types/lib/Logger.d.ts.map +1 -0
- package/src/types/lib/Sass.d.ts +62 -0
- package/src/types/lib/Sass.d.ts.map +1 -0
- package/src/types/lib/Schemer.d.ts +23 -0
- package/src/types/lib/Schemer.d.ts.map +1 -0
- package/src/types/lib/Tantrum.d.ts +50 -0
- package/src/types/lib/Tantrum.d.ts.map +1 -0
- package/src/types/lib/Term.d.ts +103 -0
- package/src/types/lib/Term.d.ts.map +1 -0
- package/src/types/lib/Terms.d.ts +24 -0
- package/src/types/lib/Terms.d.ts.map +1 -0
- package/src/types/lib/TypeSpec.d.ts +92 -0
- package/src/types/lib/TypeSpec.d.ts.map +1 -0
- package/src/types/lib/Util.d.ts +197 -0
- package/src/types/lib/Util.d.ts.map +1 -0
- package/src/types/lib/Valid.d.ts +33 -0
- package/src/types/lib/Valid.d.ts.map +1 -0
- package/src/lib/Action.js +0 -283
- package/src/lib/ActionBuilder.js +0 -144
- package/src/lib/ActionRunner.js +0 -79
- package/src/lib/Hooks.js +0 -194
- package/src/lib/Piper.js +0 -155
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export namespace loggerColours {
|
|
2
|
+
let debug: string[];
|
|
3
|
+
let info: string;
|
|
4
|
+
let warn: string;
|
|
5
|
+
let error: string;
|
|
6
|
+
let reset: string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: typeof Glog;
|
|
9
|
+
export default _default;
|
|
10
|
+
declare class Glog {
|
|
11
|
+
static logLevel: number;
|
|
12
|
+
static logPrefix: string;
|
|
13
|
+
static colors: any;
|
|
14
|
+
static stackTrace: boolean;
|
|
15
|
+
static name: string;
|
|
16
|
+
static setLogPrefix(prefix: any): typeof Glog;
|
|
17
|
+
static setLogLevel(level: any): typeof Glog;
|
|
18
|
+
static withName(name: any): typeof Glog;
|
|
19
|
+
static withColors(colors?: {
|
|
20
|
+
debug: string[];
|
|
21
|
+
info: string;
|
|
22
|
+
warn: string;
|
|
23
|
+
error: string;
|
|
24
|
+
reset: string;
|
|
25
|
+
}): typeof Glog;
|
|
26
|
+
static withStackTrace(enabled?: boolean): typeof Glog;
|
|
27
|
+
static create(options?: {}): Glog;
|
|
28
|
+
static execute(...args: any[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Static version of colorize for global usage
|
|
31
|
+
*
|
|
32
|
+
* @param {Array<string>} strings - Template strings
|
|
33
|
+
* @param {...unknown} values - Template values
|
|
34
|
+
*/
|
|
35
|
+
static colorize(strings: Array<string>, ...values: unknown[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Static success method
|
|
38
|
+
*
|
|
39
|
+
* @param {string} message - Success message to log
|
|
40
|
+
* @param {...unknown} args - Additional arguments to log
|
|
41
|
+
*/
|
|
42
|
+
static success(message: string, ...args: unknown[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Set a color alias for convenient usage
|
|
45
|
+
*
|
|
46
|
+
* @param {string} alias - Alias name
|
|
47
|
+
* @param {string} colorCode - Color code (e.g., "{F196}" or "{<B}")
|
|
48
|
+
* @returns {Glog} The Glog class for chaining.
|
|
49
|
+
*/
|
|
50
|
+
static setAlias(alias: string, colorCode: string): Glog;
|
|
51
|
+
constructor(options?: {});
|
|
52
|
+
setOptions(options: any): this;
|
|
53
|
+
withName(name: any): this;
|
|
54
|
+
withLogLevel(level: any): this;
|
|
55
|
+
withPrefix(prefix: any): this;
|
|
56
|
+
withColors(colors?: {
|
|
57
|
+
debug: string[];
|
|
58
|
+
info: string;
|
|
59
|
+
warn: string;
|
|
60
|
+
error: string;
|
|
61
|
+
reset: string;
|
|
62
|
+
}): this;
|
|
63
|
+
withStackTrace(enabled?: boolean): this;
|
|
64
|
+
get name(): string;
|
|
65
|
+
get debugLevel(): number;
|
|
66
|
+
get options(): {
|
|
67
|
+
name: string;
|
|
68
|
+
debugLevel: number;
|
|
69
|
+
prefix: string;
|
|
70
|
+
colors: any;
|
|
71
|
+
stackTrace: boolean;
|
|
72
|
+
};
|
|
73
|
+
extractFileFunction(): string;
|
|
74
|
+
newDebug(tag: any): any;
|
|
75
|
+
/**
|
|
76
|
+
* Log a debug message with specified verbosity level.
|
|
77
|
+
* Level 0 means debug OFF - use levels 1-4 for actual debug output.
|
|
78
|
+
* Debug messages only show when logLevel > 0.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} message - Debug message to log
|
|
81
|
+
* @param {number} level - Debug verbosity level (1-4, default: 1)
|
|
82
|
+
* @param {...unknown} arg - Additional arguments to log
|
|
83
|
+
* @throws {Error} If level < 1 (level 0 = debug OFF)
|
|
84
|
+
*/
|
|
85
|
+
debug(message: string, level?: number, ...arg: unknown[]): void;
|
|
86
|
+
info(message: any, ...arg: any[]): void;
|
|
87
|
+
warn(message: any, ...arg: any[]): void;
|
|
88
|
+
error(message: any, ...arg: any[]): void;
|
|
89
|
+
execute(...args: any[]): void;
|
|
90
|
+
/**
|
|
91
|
+
* Log a colorized message using template literals
|
|
92
|
+
*
|
|
93
|
+
* @param {Array<string>} strings - Template strings
|
|
94
|
+
* @param {...unknown} values - Template values
|
|
95
|
+
* @example logger.colorize`{success}Operation completed{/} in {bold}${time}ms{/}`
|
|
96
|
+
*/
|
|
97
|
+
colorize(strings: Array<string>, ...values: unknown[]): void;
|
|
98
|
+
/**
|
|
99
|
+
* Log a success message with green color
|
|
100
|
+
*
|
|
101
|
+
* @param {string} message - Success message
|
|
102
|
+
* @param {...unknown} args - Additional arguments
|
|
103
|
+
*/
|
|
104
|
+
success(message: string, ...args: unknown[]): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get access to the colours template function for instance usage
|
|
107
|
+
*
|
|
108
|
+
* @returns {import('@gesslar/colours')} The colours template function from \@gesslar/colours
|
|
109
|
+
*/
|
|
110
|
+
get colours(): typeof import("@gesslar/colours");
|
|
111
|
+
#private;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=Glog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../lib/Glog.js"],"names":[],"mappings":";;;;;;;;;AA6CA;IAEE,wBAAmB;IACnB,yBAAqB;IACrB,mBAAoB;IACpB,2BAAyB;IACzB,oBAAgB;IA2ChB,8CAIC;IAED,4CAIC;IAED,wCAIC;IAED;;;;;;oBAIC;IAED,sDAIC;IAID,kCAEC;IAwJD,qCAoBC;IAuBD;;;;;OAKG;IACH,yBAHW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAOpB;IAYD;;;;;OAKG;IACH,wBAHW,MAAM,WACH,OAAO,EAAA,QAIpB;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,aACN,MAAM,GACJ,IAAI,CAMhB;IAhTD,0BAeC;IAID,+BAQC;IAwCD,0BAIC;IAED,+BAIC;IAED,8BAIC;IAED;;;;;;aAIC;IAED,wCAIC;IAID,mBAEC;IAED,yBAEC;IAED;;;;;;MAQC;IAqBD,8BAGC;IAED,wBAQC;IA8BD;;;;;;;;;OASG;IACH,eALW,MAAM,UACN,MAAM,UACH,OAAO,EAAA,QAapB;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;IA0BD,8BAEC;IAID;;;;;;OAMG;IACH,kBAJW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAQpB;IAeD;;;;;OAKG;IACH,iBAHW,MAAM,WACH,OAAO,EAAA,QAIpB;IAyBD;;;;OAIG;IACH,iDAEC;;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export namespace loggerColours {
|
|
2
|
+
let debug: string[];
|
|
3
|
+
let info: string;
|
|
4
|
+
let warn: string;
|
|
5
|
+
let error: string;
|
|
6
|
+
let reset: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Logger class
|
|
10
|
+
*
|
|
11
|
+
* Log levels:
|
|
12
|
+
* - debug: Debugging information
|
|
13
|
+
* - Debug levels
|
|
14
|
+
* - 0: No/critical debug information, not error level, but, should be
|
|
15
|
+
* logged
|
|
16
|
+
* - 1: Basic debug information, startup, shutdown, etc
|
|
17
|
+
* - 2: Intermediate debug information, discovery, starting to get more
|
|
18
|
+
* detailed
|
|
19
|
+
* - 3: Detailed debug information, parsing, processing, etc
|
|
20
|
+
* - 4: Very detailed debug information, nerd mode!
|
|
21
|
+
* - warn: Warning information
|
|
22
|
+
* - info: Informational information
|
|
23
|
+
* - error: Error information
|
|
24
|
+
*/
|
|
25
|
+
export default class Logger {
|
|
26
|
+
constructor(options: any);
|
|
27
|
+
vscodeError: any;
|
|
28
|
+
vscodeWarn: any;
|
|
29
|
+
vscodeInfo: any;
|
|
30
|
+
get name(): any;
|
|
31
|
+
get debugLevel(): number;
|
|
32
|
+
get options(): {
|
|
33
|
+
name: any;
|
|
34
|
+
debugLevel: number;
|
|
35
|
+
};
|
|
36
|
+
setOptions(options: any): void;
|
|
37
|
+
lastStackLine(error?: Error, stepsRemoved?: number): any;
|
|
38
|
+
extractFileFunction(level?: number): any;
|
|
39
|
+
newDebug(tag: any): any;
|
|
40
|
+
debug(message: any, level?: number, ...arg: any[]): void;
|
|
41
|
+
warn(message: any, ...arg: any[]): void;
|
|
42
|
+
info(message: any, ...arg: any[]): void;
|
|
43
|
+
error(message: any, ...arg: any[]): void;
|
|
44
|
+
#private;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../lib/Logger.js"],"names":[],"mappings":";;;;;;;AA4CA;;;;;;;;;;;;;;;;GAgBG;AAEH;IAIE,0BAYC;IALK,iBAAiD;IACjD,gBAAkD;IAClD,gBAAsD;IAK5D,gBAEC;IAED,yBAEC;IAED;;;MAKC;IAED,+BAGC;IAWD,yDAIC;IAED,yCAsCC;IAED,wBAKC;IAED,yDAGC;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error class for toolkit errors.
|
|
3
|
+
* Provides error chaining, trace management, and formatted error reporting.
|
|
4
|
+
*/
|
|
5
|
+
export default class Sass extends Error {
|
|
6
|
+
/**
|
|
7
|
+
* Creates an Sass from an existing Error object with additional
|
|
8
|
+
* trace message.
|
|
9
|
+
*
|
|
10
|
+
* @param {Error} error - The original error object
|
|
11
|
+
* @param {string} message - Additional trace message to add
|
|
12
|
+
* @returns {Sass} New Sass instance with trace from the original error
|
|
13
|
+
* @throws {Sass} If the first parameter is not an Error instance
|
|
14
|
+
*/
|
|
15
|
+
static from(error: Error, message: string): Sass;
|
|
16
|
+
/**
|
|
17
|
+
* Factory method to create or enhance Sass instances.
|
|
18
|
+
* If error parameter is provided, enhances existing Sass or wraps
|
|
19
|
+
* other errors. Otherwise creates a new Sass instance.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} message - The error message
|
|
22
|
+
* @param {Error|Sass|Tantrum} [error] - Optional existing error to wrap or enhance
|
|
23
|
+
* @returns {Sass} New or enhanced Sass instance
|
|
24
|
+
*/
|
|
25
|
+
static "new"(message: string, error?: Error | Sass | Tantrum): Sass;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new Sass instance.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} message - The error message
|
|
30
|
+
* @param {...unknown} [arg] - Additional arguments passed to parent Error constructor
|
|
31
|
+
*/
|
|
32
|
+
constructor(message: string, ...arg?: unknown[]);
|
|
33
|
+
/**
|
|
34
|
+
* Adds a message to the beginning of the trace array.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} message - The trace message to add
|
|
37
|
+
*/
|
|
38
|
+
set trace(message: string);
|
|
39
|
+
/**
|
|
40
|
+
* Gets the error trace array.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Array<string>} Array of trace messages
|
|
43
|
+
*/
|
|
44
|
+
get trace(): Array<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Adds a trace message and returns this instance for chaining.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} message - The trace message to add
|
|
49
|
+
* @returns {this} This Sass instance for method chaining
|
|
50
|
+
*/
|
|
51
|
+
addTrace(message: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Reports the error to the terminal with formatted output.
|
|
54
|
+
* Optionally includes detailed stack trace information.
|
|
55
|
+
*
|
|
56
|
+
* @param {boolean} [nerdMode] - Whether to include detailed stack trace
|
|
57
|
+
*/
|
|
58
|
+
report(nerdMode?: boolean): void;
|
|
59
|
+
#private;
|
|
60
|
+
}
|
|
61
|
+
import Tantrum from "./Tantrum.js";
|
|
62
|
+
//# sourceMappingURL=Sass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sass.d.ts","sourceRoot":"","sources":["../../lib/Sass.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH;IA2GE;;;;;;;;OAQG;IACH,mBALW,KAAK,WACL,MAAM,GACJ,IAAI,CAWhB;IAED;;;;;;;;OAQG;IACH,sBAJW,MAAM,UACN,KAAK,GAAC,IAAI,GAAC,OAAO,GAChB,IAAI,CAchB;IAhJD;;;;;OAKG;IACH,qBAHW,MAAM,WACH,OAAO,EAAA,EAMpB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;;OAKG;IACH,kBAFW,OAAO,QAqBjB;;CA2EF;oBA1JmB,cAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schemer provides utilities for compiling and validating JSON schemas using AJV.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* - Use Schemer.fromFile(file, options) to create a validator from a file.
|
|
6
|
+
* - Use Schemer.from(schemaData, options) to create a validator from a schema object.
|
|
7
|
+
* - Use Schemer.getValidator(schema, options) to get a raw AJV validator function.
|
|
8
|
+
* - Use Schemer.reportValidationErrors(errors) to format AJV validation errors.
|
|
9
|
+
*/
|
|
10
|
+
export default class Schemer {
|
|
11
|
+
static fromFile(file: any, options?: {}): Promise<(data: unknown) => boolean>;
|
|
12
|
+
static from(schemaData?: {}, options?: {}): Promise<(data: unknown) => boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a validator function from a schema object
|
|
15
|
+
*
|
|
16
|
+
* @param {object} schema - The schema to compile
|
|
17
|
+
* @param {object} [options] - AJV options
|
|
18
|
+
* @returns {(data: unknown) => boolean} The AJV validator function, which may have additional properties (e.g., `.errors`)
|
|
19
|
+
*/
|
|
20
|
+
static getValidator(schema: object, options?: object): (data: unknown) => boolean;
|
|
21
|
+
static reportValidationErrors(errors: any): any;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Schemer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schemer.d.ts","sourceRoot":"","sources":["../../lib/Schemer.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH;IACE,yDAqBoB,OAAO,KAAK,OAAO,EAdtC;IAED,2DAYoB,OAAO,KAAK,OAAO,EAPtC;IAED;;;;;;OAMG;IACH,4BAJW,MAAM,YACN,MAAM,GACJ,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAMtC;IAED,gDA0CC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom aggregate error class that extends AggregateError.
|
|
3
|
+
* Automatically wraps plain errors in Sass instances for consistent reporting.
|
|
4
|
+
*/
|
|
5
|
+
export default class Tantrum extends AggregateError {
|
|
6
|
+
/**
|
|
7
|
+
* Factory method to create a Tantrum instance.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} message - The aggregate error message
|
|
10
|
+
* @param {Array<Error|Sass>} errors - Array of errors to aggregate
|
|
11
|
+
* @returns {Tantrum} New Tantrum instance
|
|
12
|
+
*/
|
|
13
|
+
static "new"(message: string, errors?: Array<Error | Sass>): Tantrum;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new Tantrum instance.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} message - The aggregate error message
|
|
18
|
+
* @param {Array<Error|Sass>} errors - Array of errors to aggregate
|
|
19
|
+
*/
|
|
20
|
+
constructor(message: string, errors?: Array<Error | Sass>);
|
|
21
|
+
/**
|
|
22
|
+
* Adds a trace message and returns this instance for chaining.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} message - The trace message to add
|
|
25
|
+
* @param {Error|Sass} [_error] - Optional error (currently unused, reserved for future use)
|
|
26
|
+
* @returns {this} This Tantrum instance for method chaining
|
|
27
|
+
*/
|
|
28
|
+
addTrace(message: string, _error?: Error | Sass): this;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a message to the beginning of the trace array.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} message - The trace message to add
|
|
33
|
+
*/
|
|
34
|
+
set trace(message: string);
|
|
35
|
+
/**
|
|
36
|
+
* Gets the error trace array.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Array<string>} Array of trace messages
|
|
39
|
+
*/
|
|
40
|
+
get trace(): Array<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Reports all aggregated errors to the terminal with formatted output.
|
|
43
|
+
*
|
|
44
|
+
* @param {boolean} [nerdMode] - Whether to include detailed stack traces
|
|
45
|
+
*/
|
|
46
|
+
report(nerdMode?: boolean): void;
|
|
47
|
+
#private;
|
|
48
|
+
}
|
|
49
|
+
import Sass from "./Sass.js";
|
|
50
|
+
//# sourceMappingURL=Tantrum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tantrum.d.ts","sourceRoot":"","sources":["../../lib/Tantrum.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IAgFE;;;;;;OAMG;IACH,sBAJW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,GACf,OAAO,CAOnB;IAzFD;;;;;OAKG;IACH,qBAHW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,EAgB3B;IAED;;;;;;OAMG;IACH,kBAJW,MAAM,WACN,KAAK,GAAC,IAAI,GACR,IAAI,CAShB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;OAIG;IACH,kBAFW,OAAO,QAgBjB;;CAeF;iBApGgB,WAAW"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export default class Term {
|
|
2
|
+
/**
|
|
3
|
+
* Log an informational message.
|
|
4
|
+
*
|
|
5
|
+
* @param {...unknown} [arg] - Values to log.
|
|
6
|
+
*/
|
|
7
|
+
static log(...arg?: unknown[]): void;
|
|
8
|
+
/**
|
|
9
|
+
* Log an informational message.
|
|
10
|
+
*
|
|
11
|
+
* @param {...unknown} [arg] - Values to log.
|
|
12
|
+
*/
|
|
13
|
+
static info(...arg?: unknown[]): void;
|
|
14
|
+
/**
|
|
15
|
+
* Log a warning message.
|
|
16
|
+
*
|
|
17
|
+
* @param {...unknown} [arg] - Warning text / object.
|
|
18
|
+
*/
|
|
19
|
+
static warn(...arg?: unknown[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* Log an error message (plus optional details).
|
|
22
|
+
*
|
|
23
|
+
* @param {...unknown} [arg] - Values to log.
|
|
24
|
+
*/
|
|
25
|
+
static error(...arg?: unknown[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Log a debug message (no-op unless console.debug provided/visible by env).
|
|
28
|
+
*
|
|
29
|
+
* @param {...unknown} [arg] - Values to log.
|
|
30
|
+
*/
|
|
31
|
+
static debug(...arg?: unknown[]): void;
|
|
32
|
+
/**
|
|
33
|
+
* Emit a status line to the terminal.
|
|
34
|
+
*
|
|
35
|
+
* Accepts either a plain string or an array of message segments (see
|
|
36
|
+
* `terminalMessage()` for formatting options). If `silent` is true, output
|
|
37
|
+
* is suppressed.
|
|
38
|
+
*
|
|
39
|
+
* This is a convenient shortcut for logging status updates, with optional
|
|
40
|
+
* formatting and easy suppression.
|
|
41
|
+
*
|
|
42
|
+
* @param {string | Array<string | [string, string]>} args - Message or segments.
|
|
43
|
+
* @param {object} [options] - Behaviour flags.
|
|
44
|
+
* @param {boolean} options.silent - When true, suppress output.
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
static status(args: string | Array<string | [string, string]>, { silent }?: {
|
|
48
|
+
silent: boolean;
|
|
49
|
+
}): void;
|
|
50
|
+
/**
|
|
51
|
+
* Constructs a formatted status line.
|
|
52
|
+
*
|
|
53
|
+
* Input forms:
|
|
54
|
+
* - string: printed as-is
|
|
55
|
+
* - array: each element is either:
|
|
56
|
+
* - a plain string (emitted unchanged), or
|
|
57
|
+
* - a tuple: [level, text] where `level` maps to an ansiColors alias
|
|
58
|
+
* (e.g. success, info, warn, error, modified).
|
|
59
|
+
* - a tuple: [level, text, [openBracket,closeBracket]] where `level` maps to an ansiColors alias
|
|
60
|
+
* (e.g. success, info, warn, error, modified). These are rendered as
|
|
61
|
+
* colourised bracketed segments: [TEXT].
|
|
62
|
+
*
|
|
63
|
+
* The function performs a shallow validation: tuple elements must both be
|
|
64
|
+
* strings; otherwise a TypeError is thrown. Nested arrays beyond depth 1 are
|
|
65
|
+
* not supported.
|
|
66
|
+
*
|
|
67
|
+
* Recursion: array input is normalised into a single string then re-dispatched
|
|
68
|
+
* through `status` to leverage the string branch (keeps logic DRY).
|
|
69
|
+
*
|
|
70
|
+
* @param {string | Array<string | [string, string] | [string, string, string]>} argList - Message spec.
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
static terminalMessage(argList: string | Array<string | [string, string] | [string, string, string]>): void;
|
|
74
|
+
/**
|
|
75
|
+
* Construct a single coloured bracketed segment from a tuple specifying
|
|
76
|
+
* the style level and the text. The first element ("level") maps to an
|
|
77
|
+
* `ansiColors` alias (e.g. success, info, warn, error, modified) and is
|
|
78
|
+
* used both for the inner text colour and to locate its matching
|
|
79
|
+
* "-bracket" alias for the surrounding square brackets. The second
|
|
80
|
+
* element is the raw text to display.
|
|
81
|
+
*
|
|
82
|
+
* Input validation: every element of `parts` must be a string; otherwise
|
|
83
|
+
* an `Sass` error is thrown. (Additional elements beyond the first two are
|
|
84
|
+
* ignored – the method destructures only the first pair.)
|
|
85
|
+
*
|
|
86
|
+
* Example:
|
|
87
|
+
* terminalBracket(["success", "COMPILED"]) → "[COMPILED]" with coloured
|
|
88
|
+
* brackets + inner text (assuming colour support is available in the
|
|
89
|
+
* terminal).
|
|
90
|
+
*
|
|
91
|
+
* This method does not append trailing spaces; callers are responsible for
|
|
92
|
+
* joining multiple segments with appropriate separators.
|
|
93
|
+
*
|
|
94
|
+
* @param {Array<string>} parts - Tuple: [level, text]. Additional entries ignored.
|
|
95
|
+
* @returns {string} Colourised bracketed segment (e.g. "[TEXT]").
|
|
96
|
+
* @throws {Sass} If any element of `parts` is not a string.
|
|
97
|
+
*/
|
|
98
|
+
static terminalBracket([level, text, brackets]: Array<string>): string;
|
|
99
|
+
static resetTerminal(): Promise<void>;
|
|
100
|
+
static clearLines(num: any): Promise<void>;
|
|
101
|
+
static directWrite(output: any): Promise<any>;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=Term.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Term.d.ts","sourceRoot":"","sources":["../../lib/Term.js"],"names":[],"mappings":"AAKA;IACE;;;;OAIG;IACH,oBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;;;;;;;;;;;OAcG;IACH,oBALW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,eAEjD;QAAyB,MAAM,EAAvB,OAAO;KACf,GAAU,IAAI,CAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,gCAHW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GAClE,IAAI,CA4BhB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gDAJW,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CASlB;IAED,sCAGC;IAED,2CAEC;IAED,8CAIC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terms represents an interface definition - what an action promises to provide or accept.
|
|
3
|
+
* It's just the specification, not the negotiation. Contract handles the negotiation.
|
|
4
|
+
*/
|
|
5
|
+
export default class Terms {
|
|
6
|
+
/**
|
|
7
|
+
* Parses terms data, handling file references
|
|
8
|
+
*
|
|
9
|
+
* @param {string|object} termsData - Terms data or reference
|
|
10
|
+
* @param {DirectoryObject?} directoryObject - Directory context for file resolution
|
|
11
|
+
* @returns {object} Parsed terms data
|
|
12
|
+
*/
|
|
13
|
+
static parse(termsData: string | object, directoryObject: DirectoryObject | null): object;
|
|
14
|
+
constructor(definition: any);
|
|
15
|
+
/**
|
|
16
|
+
* Get the terms definition
|
|
17
|
+
*
|
|
18
|
+
* @returns {object} The terms definition
|
|
19
|
+
*/
|
|
20
|
+
get definition(): object;
|
|
21
|
+
#private;
|
|
22
|
+
}
|
|
23
|
+
import DirectoryObject from "./DirectoryObject.js";
|
|
24
|
+
//# sourceMappingURL=Terms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Terms.d.ts","sourceRoot":"","sources":["../../lib/Terms.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAOE;;;;;;OAMG;IACH,wBAJW,MAAM,GAAC,MAAM,mBACb,eAAe,OAAC,GACd,MAAM,CAmClB;IA5CD,6BAEC;IA4CD;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;;CAEF;4BArE2B,sBAAsB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type specification class for parsing and validating complex type definitions.
|
|
3
|
+
* Supports union types, array types, and validation options.
|
|
4
|
+
*/
|
|
5
|
+
export default class TypeSpec {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new TypeSpec instance.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} string - The type specification string (e.g., "string|number", "object[]")
|
|
10
|
+
* @param {object} options - Additional parsing options
|
|
11
|
+
*/
|
|
12
|
+
constructor(string: string, options: object);
|
|
13
|
+
specs: any[];
|
|
14
|
+
length: number;
|
|
15
|
+
stringRepresentation: string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a string representation of the type specification.
|
|
18
|
+
*
|
|
19
|
+
* @returns {string} The type specification as a string (e.g., "string|number[]")
|
|
20
|
+
*/
|
|
21
|
+
toString(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a JSON representation of the TypeSpec.
|
|
24
|
+
*
|
|
25
|
+
* @returns {object} Object containing specs, length, and string representation
|
|
26
|
+
*/
|
|
27
|
+
toJSON(): object;
|
|
28
|
+
/**
|
|
29
|
+
* Executes a provided function once for each type specification.
|
|
30
|
+
*
|
|
31
|
+
* @param {function(unknown): void} callback - Function to execute for each spec
|
|
32
|
+
*/
|
|
33
|
+
forEach(callback: (arg0: unknown) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* Tests whether all type specifications pass the provided test function.
|
|
36
|
+
*
|
|
37
|
+
* @param {function(unknown): boolean} callback - Function to test each spec
|
|
38
|
+
* @returns {boolean} True if all specs pass the test
|
|
39
|
+
*/
|
|
40
|
+
every(callback: (arg0: unknown) => boolean): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Tests whether at least one type specification passes the provided test function.
|
|
43
|
+
*
|
|
44
|
+
* @param {function(unknown): boolean} callback - Function to test each spec
|
|
45
|
+
* @returns {boolean} True if at least one spec passes the test
|
|
46
|
+
*/
|
|
47
|
+
some(callback: (arg0: unknown) => boolean): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new array with all type specifications that pass the provided test function.
|
|
50
|
+
*
|
|
51
|
+
* @param {function(unknown): boolean} callback - Function to test each spec
|
|
52
|
+
* @returns {Array<unknown>} New array with filtered specs
|
|
53
|
+
*/
|
|
54
|
+
filter(callback: (arg0: unknown) => boolean): Array<unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new array populated with the results of calling the provided function on every spec.
|
|
57
|
+
*
|
|
58
|
+
* @param {function(unknown): unknown} callback - Function to call on each spec
|
|
59
|
+
* @returns {Array<unknown>} New array with mapped values
|
|
60
|
+
*/
|
|
61
|
+
map(callback: (arg0: unknown) => unknown): Array<unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Executes a reducer function on each spec, resulting in a single output value.
|
|
64
|
+
*
|
|
65
|
+
* @param {function(unknown, unknown): unknown} callback - Function to execute on each spec
|
|
66
|
+
* @param {unknown} initialValue - Initial value for the accumulator
|
|
67
|
+
* @returns {unknown} The final accumulated value
|
|
68
|
+
*/
|
|
69
|
+
reduce(callback: (arg0: unknown, arg1: unknown) => unknown, initialValue: unknown): unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the first type specification that satisfies the provided testing function.
|
|
72
|
+
*
|
|
73
|
+
* @param {function(unknown): boolean} callback - Function to test each spec
|
|
74
|
+
* @returns {object|undefined} The first spec that matches, or undefined
|
|
75
|
+
*/
|
|
76
|
+
find(callback: (arg0: unknown) => boolean): object | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Tests whether a value matches any of the type specifications.
|
|
79
|
+
* Handles array types, union types, and empty value validation.
|
|
80
|
+
*
|
|
81
|
+
* @param {unknown} value - The value to test against the type specifications
|
|
82
|
+
* @param {object} options - Validation options
|
|
83
|
+
* @param {boolean} options.allowEmpty - Whether empty values are allowed
|
|
84
|
+
* @returns {boolean} True if the value matches any type specification
|
|
85
|
+
*/
|
|
86
|
+
matches(value: unknown, options: {
|
|
87
|
+
allowEmpty: boolean;
|
|
88
|
+
}): boolean;
|
|
89
|
+
match(value: any, options: any): false | unknown[];
|
|
90
|
+
#private;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=TypeSpec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeSpec.d.ts","sourceRoot":"","sources":["../../lib/TypeSpec.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,oBAHW,MAAM,WACN,MAAM,EAUhB;IAJC,aAAwB;IACxB,eAAgC;IAChC,6BAA2C;IAI7C;;;;OAIG;IACH,YAFa,MAAM,CAQlB;IAED;;;;OAIG;IACH,UAFa,MAAM,CASlB;IAED;;;;OAIG;IACH,kBAFW,CAAS,IAAO,EAAP,OAAO,KAAG,IAAI,QAIjC;IAED;;;;;OAKG;IACH,gBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,iBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;OAKG;IACH,cAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;;OAMG;IACH,iBAJW,CAAS,IAAO,EAAP,OAAO,EAAE,IAAO,EAAP,OAAO,KAAG,OAAO,gBACnC,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,MAAM,GAAC,SAAS,CAI5B;IAED;;;;;;;;OAQG;IACH,eALW,OAAO,WAEf;QAAyB,UAAU,EAA3B,OAAO;KACf,GAAU,OAAO,CAInB;IAED,mDAkDC;;CAiCF"}
|