@decaf-ts/utils 1.0.10 → 1.2.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/README.md +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/cjs/assets/slogans.cjs +3 -2
- package/lib/cjs/assets/slogans.cjs.map +1 -0
- package/lib/cjs/bin/build-scripts.cjs +5 -4
- package/lib/cjs/bin/build-scripts.cjs.map +1 -0
- package/lib/cjs/bin/release-chain-dispatch.cjs +5 -4
- package/lib/cjs/bin/release-chain-dispatch.cjs.map +1 -0
- package/lib/cjs/bin/release-chain.cjs +5 -4
- package/lib/cjs/bin/release-chain.cjs.map +1 -0
- package/lib/cjs/bin/tag-release.cjs +5 -4
- package/lib/cjs/bin/tag-release.cjs.map +1 -0
- package/lib/cjs/cli/command.cjs +11 -10
- package/lib/cjs/cli/command.cjs.map +1 -0
- package/lib/cjs/cli/commands/build-scripts.cjs +163 -44
- package/lib/cjs/cli/commands/build-scripts.cjs.map +1 -0
- package/lib/cjs/cli/commands/index.cjs +1 -0
- package/lib/cjs/cli/commands/index.cjs.map +1 -0
- package/lib/cjs/cli/commands/release-chain.cjs +12 -11
- package/lib/cjs/cli/commands/release-chain.cjs.map +1 -0
- package/lib/cjs/cli/commands/tag-release.cjs +21 -20
- package/lib/cjs/cli/commands/tag-release.cjs.map +1 -0
- package/lib/cjs/cli/constants.cjs +1 -0
- package/lib/cjs/cli/constants.cjs.map +1 -0
- package/lib/cjs/cli/index.cjs +1 -0
- package/lib/cjs/cli/index.cjs.map +1 -0
- package/lib/cjs/cli/types.cjs +1 -0
- package/lib/cjs/cli/types.cjs.map +1 -0
- package/lib/cjs/index.cjs +2 -1
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/input/index.cjs +1 -0
- package/lib/cjs/input/index.cjs.map +1 -0
- package/lib/cjs/input/input.cjs +1 -0
- package/lib/cjs/input/input.cjs.map +1 -0
- package/lib/cjs/input/types.cjs +1 -0
- package/lib/cjs/input/types.cjs.map +1 -0
- package/lib/cjs/output/common.cjs +4 -3
- package/lib/cjs/output/common.cjs.map +1 -0
- package/lib/cjs/output/index.cjs +1 -0
- package/lib/cjs/output/index.cjs.map +1 -0
- package/lib/cjs/release-chain/index.cjs +1 -0
- package/lib/cjs/release-chain/index.cjs.map +1 -0
- package/lib/cjs/tests/Consumer.cjs +3 -2
- package/lib/cjs/tests/Consumer.cjs.map +1 -0
- package/lib/cjs/tests/ProducerChildProcess.cjs.map +1 -0
- package/lib/cjs/tests/TestReporter.cjs +5 -4
- package/lib/cjs/tests/TestReporter.cjs.map +1 -0
- package/lib/cjs/tests/index.cjs +1 -0
- package/lib/cjs/tests/index.cjs.map +1 -0
- package/lib/cjs/tests/jestPerformanceRunner.cjs +5 -4
- package/lib/cjs/tests/jestPerformanceRunner.cjs.map +1 -0
- package/lib/cjs/tests/utils.cjs +5 -4
- package/lib/cjs/tests/utils.cjs.map +1 -0
- package/lib/cjs/utils/constants.cjs +3 -16
- package/lib/cjs/utils/constants.cjs.map +1 -0
- package/lib/cjs/utils/fs.cjs +16 -15
- package/lib/cjs/utils/fs.cjs.map +1 -0
- package/lib/cjs/utils/http.cjs +1 -0
- package/lib/cjs/utils/http.cjs.map +1 -0
- package/lib/cjs/utils/index.cjs +1 -0
- package/lib/cjs/utils/index.cjs.map +1 -0
- package/lib/cjs/utils/md.cjs +1 -0
- package/lib/cjs/utils/md.cjs.map +1 -0
- package/lib/cjs/utils/performanceRunner.cjs +1 -0
- package/lib/cjs/utils/performanceRunner.cjs.map +1 -0
- package/lib/cjs/utils/timeout.cjs +1 -0
- package/lib/cjs/utils/timeout.cjs.map +1 -0
- package/lib/cjs/utils/types.cjs +1 -0
- package/lib/cjs/utils/types.cjs.map +1 -0
- package/lib/cjs/utils/utils.cjs +5 -4
- package/lib/cjs/utils/utils.cjs.map +1 -0
- package/lib/cjs/writers/OutputWriter.cjs +1 -0
- package/lib/cjs/writers/OutputWriter.cjs.map +1 -0
- package/lib/cjs/writers/RegexpOutputWriter.cjs +3 -2
- package/lib/cjs/writers/RegexpOutputWriter.cjs.map +1 -0
- package/lib/cjs/writers/StandardOutputWriter.cjs +3 -2
- package/lib/cjs/writers/StandardOutputWriter.cjs.map +1 -0
- package/lib/cjs/writers/index.cjs +1 -0
- package/lib/cjs/writers/index.cjs.map +1 -0
- package/lib/cjs/writers/types.cjs +1 -0
- package/lib/cjs/writers/types.cjs.map +1 -0
- package/lib/esm/cli/commands/build-scripts.js +142 -24
- package/lib/esm/cli/commands/build-scripts.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/types/assets/slogans.d.cts +19 -0
- package/lib/types/assets/slogans.d.mts +19 -0
- package/lib/types/bin/build-scripts.d.cts +1 -0
- package/lib/types/bin/build-scripts.d.mts +1 -0
- package/lib/types/bin/release-chain-dispatch.d.cts +1 -0
- package/lib/types/bin/release-chain-dispatch.d.mts +1 -0
- package/lib/types/bin/release-chain.d.cts +1 -0
- package/lib/types/bin/release-chain.d.mts +1 -0
- package/lib/types/bin/tag-release.d.cts +1 -0
- package/lib/types/bin/tag-release.d.mts +1 -0
- package/lib/types/cli/command.d.cts +104 -0
- package/lib/types/cli/command.d.mts +104 -0
- package/lib/types/cli/commands/build-scripts.d.cts +148 -0
- package/lib/types/cli/commands/build-scripts.d.mts +148 -0
- package/lib/types/cli/commands/build-scripts.d.ts +5 -0
- package/lib/types/cli/commands/index.d.cts +3 -0
- package/lib/types/cli/commands/index.d.mts +3 -0
- package/lib/types/cli/commands/release-chain.d.cts +62 -0
- package/lib/types/cli/commands/release-chain.d.mts +62 -0
- package/lib/types/cli/commands/tag-release.d.cts +105 -0
- package/lib/types/cli/commands/tag-release.d.mts +105 -0
- package/lib/types/cli/constants.d.cts +75 -0
- package/lib/types/cli/constants.d.mts +75 -0
- package/lib/types/cli/index.d.cts +4 -0
- package/lib/types/cli/index.d.mts +4 -0
- package/lib/types/cli/types.d.cts +30 -0
- package/lib/types/cli/types.d.mts +30 -0
- package/lib/types/index.d.cts +38 -0
- package/lib/types/index.d.mts +38 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/input/index.d.cts +2 -0
- package/lib/types/input/index.d.mts +2 -0
- package/lib/types/input/input.d.cts +517 -0
- package/lib/types/input/input.d.mts +517 -0
- package/lib/types/input/types.d.cts +159 -0
- package/lib/types/input/types.d.mts +159 -0
- package/lib/types/output/common.d.cts +53 -0
- package/lib/types/output/common.d.mts +53 -0
- package/lib/types/output/index.d.cts +1 -0
- package/lib/types/output/index.d.mts +1 -0
- package/lib/types/release-chain/index.d.cts +43 -0
- package/lib/types/release-chain/index.d.mts +43 -0
- package/lib/types/tests/Consumer.d.cts +151 -0
- package/lib/types/tests/Consumer.d.mts +151 -0
- package/lib/types/tests/ProducerChildProcess.d.cts +18 -0
- package/lib/types/tests/ProducerChildProcess.d.mts +18 -0
- package/lib/types/tests/TestReporter.d.cts +245 -0
- package/lib/types/tests/TestReporter.d.mts +245 -0
- package/lib/types/tests/index.d.cts +4 -0
- package/lib/types/tests/index.d.mts +4 -0
- package/lib/types/tests/jestPerformanceRunner.d.cts +37 -0
- package/lib/types/tests/jestPerformanceRunner.d.mts +37 -0
- package/lib/types/tests/utils.d.cts +5 -0
- package/lib/types/tests/utils.d.mts +5 -0
- package/lib/types/utils/constants.d.cts +65 -0
- package/lib/types/utils/constants.d.mts +65 -0
- package/lib/types/utils/fs.d.cts +259 -0
- package/lib/types/utils/fs.d.mts +259 -0
- package/lib/types/utils/http.d.cts +41 -0
- package/lib/types/utils/http.d.mts +41 -0
- package/lib/types/utils/index.d.cts +6 -0
- package/lib/types/utils/index.d.mts +6 -0
- package/lib/types/utils/md.d.cts +156 -0
- package/lib/types/utils/md.d.mts +156 -0
- package/lib/types/utils/performanceRunner.d.cts +129 -0
- package/lib/types/utils/performanceRunner.d.mts +129 -0
- package/lib/types/utils/timeout.d.cts +12 -0
- package/lib/types/utils/timeout.d.mts +12 -0
- package/lib/types/utils/types.d.cts +112 -0
- package/lib/types/utils/types.d.mts +112 -0
- package/lib/types/utils/utils.d.cts +133 -0
- package/lib/types/utils/utils.d.mts +133 -0
- package/lib/types/writers/OutputWriter.d.cts +49 -0
- package/lib/types/writers/OutputWriter.d.mts +49 -0
- package/lib/types/writers/RegexpOutputWriter.d.cts +110 -0
- package/lib/types/writers/RegexpOutputWriter.d.mts +110 -0
- package/lib/types/writers/StandardOutputWriter.d.cts +130 -0
- package/lib/types/writers/StandardOutputWriter.d.mts +130 -0
- package/lib/types/writers/index.d.cts +4 -0
- package/lib/types/writers/index.d.mts +4 -0
- package/lib/types/writers/types.d.cts +29 -0
- package/lib/types/writers/types.d.mts +29 -0
- package/package.json +14 -8
- package/lib/cjs/assets/slogans.js.map +0 -1
- package/lib/cjs/bin/build-scripts.js.map +0 -1
- package/lib/cjs/bin/release-chain-dispatch.js.map +0 -1
- package/lib/cjs/bin/release-chain.js.map +0 -1
- package/lib/cjs/bin/tag-release.js.map +0 -1
- package/lib/cjs/cli/command.js.map +0 -1
- package/lib/cjs/cli/commands/build-scripts.js.map +0 -1
- package/lib/cjs/cli/commands/index.js.map +0 -1
- package/lib/cjs/cli/commands/release-chain.js.map +0 -1
- package/lib/cjs/cli/commands/tag-release.js.map +0 -1
- package/lib/cjs/cli/constants.js.map +0 -1
- package/lib/cjs/cli/index.js.map +0 -1
- package/lib/cjs/cli/types.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/input/index.js.map +0 -1
- package/lib/cjs/input/input.js.map +0 -1
- package/lib/cjs/input/types.js.map +0 -1
- package/lib/cjs/output/common.js.map +0 -1
- package/lib/cjs/output/index.js.map +0 -1
- package/lib/cjs/release-chain/index.js.map +0 -1
- package/lib/cjs/tests/Consumer.js.map +0 -1
- package/lib/cjs/tests/ProducerChildProcess.js.map +0 -1
- package/lib/cjs/tests/TestReporter.js.map +0 -1
- package/lib/cjs/tests/index.js.map +0 -1
- package/lib/cjs/tests/jestPerformanceRunner.js.map +0 -1
- package/lib/cjs/tests/utils.js.map +0 -1
- package/lib/cjs/utils/constants.js.map +0 -1
- package/lib/cjs/utils/fs.js.map +0 -1
- package/lib/cjs/utils/http.js.map +0 -1
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/md.js.map +0 -1
- package/lib/cjs/utils/performanceRunner.js.map +0 -1
- package/lib/cjs/utils/timeout.js.map +0 -1
- package/lib/cjs/utils/types.js.map +0 -1
- package/lib/cjs/utils/utils.js.map +0 -1
- package/lib/cjs/writers/OutputWriter.js.map +0 -1
- package/lib/cjs/writers/RegexpOutputWriter.js.map +0 -1
- package/lib/cjs/writers/StandardOutputWriter.js.map +0 -1
- package/lib/cjs/writers/index.js.map +0 -1
- package/lib/cjs/writers/types.js.map +0 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Represents a color function in the Kleur library.
|
|
3
|
+
* @summary The Color interface defines a function that can be called with or without arguments
|
|
4
|
+
* to apply color styling to text or chain multiple color operations.
|
|
5
|
+
*
|
|
6
|
+
* @interface Color
|
|
7
|
+
* @memberOf module:utils
|
|
8
|
+
* */
|
|
9
|
+
export interface Color {
|
|
10
|
+
/**
|
|
11
|
+
* @description Applies the color to the given text.
|
|
12
|
+
* @param {string | number} x - The text or number to be colored.
|
|
13
|
+
* @return {string} The colored text.
|
|
14
|
+
*/
|
|
15
|
+
(x: string | number): string;
|
|
16
|
+
/**
|
|
17
|
+
* @description Allows chaining of multiple color operations.
|
|
18
|
+
* @return {Kleur} The Kleur instance for method chaining.
|
|
19
|
+
*/
|
|
20
|
+
(): Kleur;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description Represents the main Kleur interface with all available color and style methods.
|
|
24
|
+
* @summary The Kleur interface provides methods for applying various colors, background colors,
|
|
25
|
+
* and text styles to strings in terminal output.
|
|
26
|
+
*
|
|
27
|
+
* @interface Kleur
|
|
28
|
+
* @memberOf module:utils
|
|
29
|
+
*/
|
|
30
|
+
export interface Kleur {
|
|
31
|
+
/** @description Applies black color to the text. */
|
|
32
|
+
black: Color;
|
|
33
|
+
/** @description Applies red color to the text. */
|
|
34
|
+
red: Color;
|
|
35
|
+
/** @description Applies green color to the text. */
|
|
36
|
+
green: Color;
|
|
37
|
+
/** @description Applies yellow color to the text. */
|
|
38
|
+
yellow: Color;
|
|
39
|
+
/** @description Applies blue color to the text. */
|
|
40
|
+
blue: Color;
|
|
41
|
+
/** @description Applies magenta color to the text. */
|
|
42
|
+
magenta: Color;
|
|
43
|
+
/** @description Applies cyan color to the text. */
|
|
44
|
+
cyan: Color;
|
|
45
|
+
/** @description Applies white color to the text. */
|
|
46
|
+
white: Color;
|
|
47
|
+
/** @description Applies gray color to the text. */
|
|
48
|
+
gray: Color;
|
|
49
|
+
/** @description Alias for gray color. */
|
|
50
|
+
grey: Color;
|
|
51
|
+
/** @description Applies black background to the text. */
|
|
52
|
+
bgBlack: Color;
|
|
53
|
+
/** @description Applies red background to the text. */
|
|
54
|
+
bgRed: Color;
|
|
55
|
+
/** @description Applies green background to the text. */
|
|
56
|
+
bgGreen: Color;
|
|
57
|
+
/** @description Applies yellow background to the text. */
|
|
58
|
+
bgYellow: Color;
|
|
59
|
+
/** @description Applies blue background to the text. */
|
|
60
|
+
bgBlue: Color;
|
|
61
|
+
/** @description Applies magenta background to the text. */
|
|
62
|
+
bgMagenta: Color;
|
|
63
|
+
/** @description Applies cyan background to the text. */
|
|
64
|
+
bgCyan: Color;
|
|
65
|
+
/** @description Applies white background to the text. */
|
|
66
|
+
bgWhite: Color;
|
|
67
|
+
/** @description Resets all applied styles. */
|
|
68
|
+
reset: Color;
|
|
69
|
+
/** @description Applies bold style to the text. */
|
|
70
|
+
bold: Color;
|
|
71
|
+
/** @description Applies dim (decreased intensity) style to the text. */
|
|
72
|
+
dim: Color;
|
|
73
|
+
/** @description Applies italic style to the text. */
|
|
74
|
+
italic: Color;
|
|
75
|
+
/** @description Applies underline style to the text. */
|
|
76
|
+
underline: Color;
|
|
77
|
+
/** @description Inverts the foreground and background colors. */
|
|
78
|
+
inverse: Color;
|
|
79
|
+
/** @description Hides the text (same color as background). */
|
|
80
|
+
hidden: Color;
|
|
81
|
+
/** @description Applies strikethrough style to the text. */
|
|
82
|
+
strikethrough: Color;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @description Configuration for a single command-line argument option.
|
|
86
|
+
* @summary Defines the structure and behavior of a command-line option.
|
|
87
|
+
* @interface ParseArgsOptionConfig
|
|
88
|
+
* @property {("string" | "boolean")} type - The data type of the option.
|
|
89
|
+
* @property {boolean} [multiple] - Whether the option can be specified multiple times.
|
|
90
|
+
* @property {string} [short] - The short (single-character) alias for the option.
|
|
91
|
+
* @property {string | boolean | string[] | boolean[]} [default] - The default value(s) for the option.
|
|
92
|
+
* @memberOf module:utils
|
|
93
|
+
*/
|
|
94
|
+
export interface ParseArgsOptionConfig {
|
|
95
|
+
type: "string" | "boolean";
|
|
96
|
+
multiple?: boolean | undefined;
|
|
97
|
+
short?: string | undefined;
|
|
98
|
+
default?: string | boolean | string[] | boolean[] | undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @description Configuration for all command-line argument options.
|
|
102
|
+
* @summary A mapping of long option names to their configurations.
|
|
103
|
+
* @interface ParseArgsOptionsConfig
|
|
104
|
+
* @memberOf module:utils
|
|
105
|
+
*/
|
|
106
|
+
export interface ParseArgsOptionsConfig {
|
|
107
|
+
[longOption: string]: ParseArgsOptionConfig;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @description Represents a parsed command-line option token.
|
|
111
|
+
* @summary Can be either an option with a value or an option without a value.
|
|
112
|
+
* @typedef {Object} OptionToken
|
|
113
|
+
* @memberOf module:utils
|
|
114
|
+
*/
|
|
115
|
+
export type OptionToken = {
|
|
116
|
+
kind: "option";
|
|
117
|
+
index: number;
|
|
118
|
+
name: string;
|
|
119
|
+
rawName: string;
|
|
120
|
+
value: string;
|
|
121
|
+
inlineValue: boolean;
|
|
122
|
+
} | {
|
|
123
|
+
kind: "option";
|
|
124
|
+
index: number;
|
|
125
|
+
name: string;
|
|
126
|
+
rawName: string;
|
|
127
|
+
value: undefined;
|
|
128
|
+
inlineValue: undefined;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* @description Represents a parsed command-line token.
|
|
132
|
+
* @summary Can be an option, a positional argument, or an option terminator.
|
|
133
|
+
* @typedef {OptionToken | Object} Token
|
|
134
|
+
* @memberOf module:utils
|
|
135
|
+
*/
|
|
136
|
+
export type Token = OptionToken | {
|
|
137
|
+
kind: "positional";
|
|
138
|
+
index: number;
|
|
139
|
+
value: string;
|
|
140
|
+
} | {
|
|
141
|
+
kind: "option-terminator";
|
|
142
|
+
index: number;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* @description The result of parsing command-line arguments.
|
|
146
|
+
* @summary Contains parsed values, positional arguments, and optionally the parsed tokens.
|
|
147
|
+
* @typedef {Object} ParseArgsResult
|
|
148
|
+
* @property {string | boolean | string[] | boolean[] | undefined} values - Parsed option values.
|
|
149
|
+
* @property {string[]} positionals - Positional arguments.
|
|
150
|
+
* @property {Token[]} [tokens] - Parsed tokens (if requested).
|
|
151
|
+
* @memberOf module:utils
|
|
152
|
+
*/
|
|
153
|
+
export type ParseArgsResult = {
|
|
154
|
+
values: {
|
|
155
|
+
[p: string]: string | boolean | (string | boolean)[] | undefined;
|
|
156
|
+
};
|
|
157
|
+
positionals: string[];
|
|
158
|
+
tokens?: Token[];
|
|
159
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger } from "@decaf-ts/logging";
|
|
2
|
+
/**
|
|
3
|
+
* @description Prints a styled banner to the console.
|
|
4
|
+
* @summary Generates and prints a colorful ASCII art banner with a random slogan.
|
|
5
|
+
* @param {Logger} [logger] - Optional logger for verbose output.
|
|
6
|
+
* @memberOf module:utils
|
|
7
|
+
* @function printBanner
|
|
8
|
+
* @mermaid
|
|
9
|
+
* sequenceDiagram
|
|
10
|
+
* participant printBanner
|
|
11
|
+
* participant getSlogan
|
|
12
|
+
* participant padEnd
|
|
13
|
+
* participant console
|
|
14
|
+
* printBanner->>getSlogan: Call getSlogan()
|
|
15
|
+
* getSlogan-->>printBanner: Return random slogan
|
|
16
|
+
* printBanner->>printBanner: Create banner ASCII art
|
|
17
|
+
* printBanner->>printBanner: Split banner into lines
|
|
18
|
+
* printBanner->>printBanner: Calculate max line length
|
|
19
|
+
* printBanner->>padEnd: Call padEnd with slogan
|
|
20
|
+
* padEnd-->>printBanner: Return padded slogan line
|
|
21
|
+
* loop For each banner line
|
|
22
|
+
* printBanner->>style: Call style(line)
|
|
23
|
+
* style-->>printBanner: Return styled line
|
|
24
|
+
* printBanner->>console: Log styled line
|
|
25
|
+
* end
|
|
26
|
+
*/
|
|
27
|
+
export declare function printBanner(logger?: Logger): void;
|
|
28
|
+
/**
|
|
29
|
+
* @description Retrieves a slogan from the predefined list.
|
|
30
|
+
* @summary Fetches a random slogan or a specific one by index from the slogans list.
|
|
31
|
+
* @param {number} [i] - Optional index to retrieve a specific slogan.
|
|
32
|
+
* @return {string} The selected slogan.
|
|
33
|
+
* @function getSlogan
|
|
34
|
+
* @memberOf module:utils
|
|
35
|
+
* @mermaid
|
|
36
|
+
* sequenceDiagram
|
|
37
|
+
* participant getSlogan
|
|
38
|
+
* participant Math.random
|
|
39
|
+
* participant slogans
|
|
40
|
+
* alt i is undefined
|
|
41
|
+
* getSlogan->>Math.random: Generate random index
|
|
42
|
+
* Math.random-->>getSlogan: Return random index
|
|
43
|
+
* else i is defined
|
|
44
|
+
* Note over getSlogan: Use provided index
|
|
45
|
+
* end
|
|
46
|
+
* getSlogan->>slogans: Access slogan at index
|
|
47
|
+
* slogans-->>getSlogan: Return slogan
|
|
48
|
+
* alt Error occurs
|
|
49
|
+
* getSlogan->>getSlogan: Throw error
|
|
50
|
+
* end
|
|
51
|
+
* getSlogan-->>Caller: Return slogan
|
|
52
|
+
*/
|
|
53
|
+
export declare function getSlogan(i?: number): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Logger } from "@decaf-ts/logging";
|
|
2
|
+
/**
|
|
3
|
+
* @description Prints a styled banner to the console.
|
|
4
|
+
* @summary Generates and prints a colorful ASCII art banner with a random slogan.
|
|
5
|
+
* @param {Logger} [logger] - Optional logger for verbose output.
|
|
6
|
+
* @memberOf module:utils
|
|
7
|
+
* @function printBanner
|
|
8
|
+
* @mermaid
|
|
9
|
+
* sequenceDiagram
|
|
10
|
+
* participant printBanner
|
|
11
|
+
* participant getSlogan
|
|
12
|
+
* participant padEnd
|
|
13
|
+
* participant console
|
|
14
|
+
* printBanner->>getSlogan: Call getSlogan()
|
|
15
|
+
* getSlogan-->>printBanner: Return random slogan
|
|
16
|
+
* printBanner->>printBanner: Create banner ASCII art
|
|
17
|
+
* printBanner->>printBanner: Split banner into lines
|
|
18
|
+
* printBanner->>printBanner: Calculate max line length
|
|
19
|
+
* printBanner->>padEnd: Call padEnd with slogan
|
|
20
|
+
* padEnd-->>printBanner: Return padded slogan line
|
|
21
|
+
* loop For each banner line
|
|
22
|
+
* printBanner->>style: Call style(line)
|
|
23
|
+
* style-->>printBanner: Return styled line
|
|
24
|
+
* printBanner->>console: Log styled line
|
|
25
|
+
* end
|
|
26
|
+
*/
|
|
27
|
+
export declare function printBanner(logger?: Logger): void;
|
|
28
|
+
/**
|
|
29
|
+
* @description Retrieves a slogan from the predefined list.
|
|
30
|
+
* @summary Fetches a random slogan or a specific one by index from the slogans list.
|
|
31
|
+
* @param {number} [i] - Optional index to retrieve a specific slogan.
|
|
32
|
+
* @return {string} The selected slogan.
|
|
33
|
+
* @function getSlogan
|
|
34
|
+
* @memberOf module:utils
|
|
35
|
+
* @mermaid
|
|
36
|
+
* sequenceDiagram
|
|
37
|
+
* participant getSlogan
|
|
38
|
+
* participant Math.random
|
|
39
|
+
* participant slogans
|
|
40
|
+
* alt i is undefined
|
|
41
|
+
* getSlogan->>Math.random: Generate random index
|
|
42
|
+
* Math.random-->>getSlogan: Return random index
|
|
43
|
+
* else i is defined
|
|
44
|
+
* Note over getSlogan: Use provided index
|
|
45
|
+
* end
|
|
46
|
+
* getSlogan->>slogans: Access slogan at index
|
|
47
|
+
* slogans-->>getSlogan: Return slogan
|
|
48
|
+
* alt Error occurs
|
|
49
|
+
* getSlogan->>getSlogan: Throw error
|
|
50
|
+
* end
|
|
51
|
+
* getSlogan-->>Caller: Return slogan
|
|
52
|
+
*/
|
|
53
|
+
export declare function getSlogan(i?: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./common.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./common.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ReleaseChainOptions {
|
|
2
|
+
metaRepoUrl: string;
|
|
3
|
+
branch: string;
|
|
4
|
+
currentRepo?: string;
|
|
5
|
+
packageName: string;
|
|
6
|
+
workspace?: string;
|
|
7
|
+
token?: string;
|
|
8
|
+
submoduleFile?: string;
|
|
9
|
+
submodulePath?: string;
|
|
10
|
+
targetBaseBranch?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ReleaseChainDispatchOptions {
|
|
13
|
+
metaRepoUrl: string;
|
|
14
|
+
branch: string;
|
|
15
|
+
workflowFile?: string;
|
|
16
|
+
repoSlug?: string;
|
|
17
|
+
currentRepo?: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
ref?: string;
|
|
20
|
+
targetBaseBranch?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class ReleaseChainRunner {
|
|
23
|
+
private readonly options;
|
|
24
|
+
private readonly workspace;
|
|
25
|
+
private readonly clonesRoot;
|
|
26
|
+
private readonly token?;
|
|
27
|
+
private readonly metaRepoSlug;
|
|
28
|
+
private readonly currentRepo?;
|
|
29
|
+
constructor(options: ReleaseChainOptions);
|
|
30
|
+
run(): Promise<void>;
|
|
31
|
+
private evaluateModule;
|
|
32
|
+
private cloneRepository;
|
|
33
|
+
private checkoutTargetBranch;
|
|
34
|
+
private loadSubmodules;
|
|
35
|
+
private runCommand;
|
|
36
|
+
private githubRequest;
|
|
37
|
+
private findExistingPr;
|
|
38
|
+
private acceptPullRequest;
|
|
39
|
+
private createPullRequest;
|
|
40
|
+
private getDefaultBranch;
|
|
41
|
+
}
|
|
42
|
+
export declare function runReleaseChain(options: ReleaseChainOptions): Promise<void>;
|
|
43
|
+
export declare function dispatchReleaseChainWorkflow(options: ReleaseChainDispatchOptions): Promise<void>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ReleaseChainOptions {
|
|
2
|
+
metaRepoUrl: string;
|
|
3
|
+
branch: string;
|
|
4
|
+
currentRepo?: string;
|
|
5
|
+
packageName: string;
|
|
6
|
+
workspace?: string;
|
|
7
|
+
token?: string;
|
|
8
|
+
submoduleFile?: string;
|
|
9
|
+
submodulePath?: string;
|
|
10
|
+
targetBaseBranch?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ReleaseChainDispatchOptions {
|
|
13
|
+
metaRepoUrl: string;
|
|
14
|
+
branch: string;
|
|
15
|
+
workflowFile?: string;
|
|
16
|
+
repoSlug?: string;
|
|
17
|
+
currentRepo?: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
ref?: string;
|
|
20
|
+
targetBaseBranch?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class ReleaseChainRunner {
|
|
23
|
+
private readonly options;
|
|
24
|
+
private readonly workspace;
|
|
25
|
+
private readonly clonesRoot;
|
|
26
|
+
private readonly token?;
|
|
27
|
+
private readonly metaRepoSlug;
|
|
28
|
+
private readonly currentRepo?;
|
|
29
|
+
constructor(options: ReleaseChainOptions);
|
|
30
|
+
run(): Promise<void>;
|
|
31
|
+
private evaluateModule;
|
|
32
|
+
private cloneRepository;
|
|
33
|
+
private checkoutTargetBranch;
|
|
34
|
+
private loadSubmodules;
|
|
35
|
+
private runCommand;
|
|
36
|
+
private githubRequest;
|
|
37
|
+
private findExistingPr;
|
|
38
|
+
private acceptPullRequest;
|
|
39
|
+
private createPullRequest;
|
|
40
|
+
private getDefaultBranch;
|
|
41
|
+
}
|
|
42
|
+
export declare function runReleaseChain(options: ReleaseChainOptions): Promise<void>;
|
|
43
|
+
export declare function dispatchReleaseChainWorkflow(options: ReleaseChainDispatchOptions): Promise<void>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { LoggedClass } from "@decaf-ts/logging";
|
|
2
|
+
import { TestReporter } from "./TestReporter.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* @description Store for logs indexed by identifier.
|
|
5
|
+
* @summary A record where keys are identifiers and values are arrays of log strings.
|
|
6
|
+
* @typedef {Record<number, string[]>} LogStore
|
|
7
|
+
* @memberOf module:utils
|
|
8
|
+
*/
|
|
9
|
+
type LogStore = Record<number, string[]>;
|
|
10
|
+
/**
|
|
11
|
+
* @description Structure of a parsed log entry.
|
|
12
|
+
* @summary Contains timestamp, child identifier, and action.
|
|
13
|
+
* @interface ParsedLog
|
|
14
|
+
* @property {number} timestamp - The timestamp of the log.
|
|
15
|
+
* @property {string} child - The child identifier.
|
|
16
|
+
* @property {string} action - The action performed.
|
|
17
|
+
* @memberOf module:utils
|
|
18
|
+
*/
|
|
19
|
+
export interface ParsedLog {
|
|
20
|
+
timestamp: number;
|
|
21
|
+
child: string;
|
|
22
|
+
action: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @description Result of a comparison between consumer and producer logs.
|
|
26
|
+
* @summary Contains arrays of parsed logs for both consumer and producer.
|
|
27
|
+
* @interface ComparerResult
|
|
28
|
+
* @property {ParsedLog[]} consumer - The parsed consumer logs.
|
|
29
|
+
* @property {ParsedLog[]} producer - The parsed producer logs.
|
|
30
|
+
* @memberOf module:utils
|
|
31
|
+
*/
|
|
32
|
+
export interface ComparerResult {
|
|
33
|
+
consumer: ParsedLog[];
|
|
34
|
+
producer: ParsedLog[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Function type for comparing consumer and producer data.
|
|
38
|
+
* @summary Compares two LogStores and returns a Promise resolving to ComparerResult.
|
|
39
|
+
* @typedef {function(LogStore, LogStore): Promise<ComparerResult>} Comparer
|
|
40
|
+
* @memberOf module:utils
|
|
41
|
+
*/
|
|
42
|
+
type Comparer = (consumerData: LogStore, producerData: LogStore) => Promise<ComparerResult>;
|
|
43
|
+
/**
|
|
44
|
+
* @description Function type for handling consumer actions.
|
|
45
|
+
* @summary A function that takes an identifier and optional arguments, returning a result.
|
|
46
|
+
* @typedef {function(number, ...unknown[]): unknown | Promise<unknown>} ConsumerHandler
|
|
47
|
+
* @memberOf module:utils
|
|
48
|
+
*/
|
|
49
|
+
type ConsumerHandler = (identifier: number, ...args: unknown[]) => unknown | Promise<unknown>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Default comparer function for consumer and producer logs.
|
|
52
|
+
* @summary Sorts and compares consumer and producer logs to ensure they match.
|
|
53
|
+
* @param {LogStore} consumerData - The consumer logs.
|
|
54
|
+
* @param {LogStore} producerData - The producer logs.
|
|
55
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
56
|
+
* @function defaultComparer
|
|
57
|
+
* @memberOf module:utils
|
|
58
|
+
*/
|
|
59
|
+
export declare const defaultComparer: Comparer;
|
|
60
|
+
/**
|
|
61
|
+
* @description Options for the reporting comparer.
|
|
62
|
+
* @summary Configuration options for the reportingComparer function.
|
|
63
|
+
* @interface ReportingComparerOptions
|
|
64
|
+
* @property {TestReporter} [reporter] - The test reporter instance.
|
|
65
|
+
* @property {string} [testCase] - The test case name.
|
|
66
|
+
* @property {string} [referencePrefix] - The prefix for report references.
|
|
67
|
+
* @memberOf module:utils
|
|
68
|
+
*/
|
|
69
|
+
export interface ReportingComparerOptions {
|
|
70
|
+
reporter?: TestReporter;
|
|
71
|
+
testCase?: string;
|
|
72
|
+
referencePrefix?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @description Comparer function that reports results using TestReporter.
|
|
76
|
+
* @summary Compares logs and generates a report with tables and messages.
|
|
77
|
+
* @param {LogStore} consumerData - The consumer logs.
|
|
78
|
+
* @param {LogStore} producerData - The producer logs.
|
|
79
|
+
* @param {ReportingComparerOptions} [options] - Options for reporting.
|
|
80
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
81
|
+
* @function reportingComparer
|
|
82
|
+
* @memberOf module:utils
|
|
83
|
+
*/
|
|
84
|
+
export declare const reportingComparer: (consumerData: LogStore, producerData: LogStore, options?: ReportingComparerOptions) => Promise<ComparerResult>;
|
|
85
|
+
/**
|
|
86
|
+
* @class ConsumerRunner
|
|
87
|
+
* @description Runs a consumer process and manages producer child processes.
|
|
88
|
+
* @summary Orchestrates the execution of consumer and producer processes, collects logs, and compares results.
|
|
89
|
+
* @param {string} action - The action name.
|
|
90
|
+
* @param {ConsumerHandler} consumerHandler - The handler function for the consumer.
|
|
91
|
+
* @param {Comparer} [compareHandler] - Optional custom comparer function.
|
|
92
|
+
* @memberOf module:utils
|
|
93
|
+
*/
|
|
94
|
+
export declare class ConsumerRunner extends LoggedClass {
|
|
95
|
+
private readonly action;
|
|
96
|
+
private readonly handler;
|
|
97
|
+
private readonly comparerHandle;
|
|
98
|
+
private forkedCache;
|
|
99
|
+
private consumerResults;
|
|
100
|
+
private producerResults;
|
|
101
|
+
private childExitPromises;
|
|
102
|
+
private completionTriggered;
|
|
103
|
+
private producerCompletion;
|
|
104
|
+
private consumerCompletion;
|
|
105
|
+
private expectedIterations;
|
|
106
|
+
private activeHandlers;
|
|
107
|
+
constructor(action: string, consumerHandler: ConsumerHandler, compareHandler?: Comparer);
|
|
108
|
+
private reset;
|
|
109
|
+
private waitForChildExit;
|
|
110
|
+
private store;
|
|
111
|
+
private recordConsumer;
|
|
112
|
+
private isProducerComplete;
|
|
113
|
+
private isConsumerComplete;
|
|
114
|
+
private terminateChildren;
|
|
115
|
+
/**
|
|
116
|
+
* @description Runs the consumer and producer processes.
|
|
117
|
+
* @summary Starts the producer child processes and the consumer handler, then waits for completion and compares results.
|
|
118
|
+
* @param {number} count - The number of producers.
|
|
119
|
+
* @param {number} [timeout] - The timeout for producers.
|
|
120
|
+
* @param {number} times - The number of times to repeat.
|
|
121
|
+
* @param {boolean} [random] - Whether to use random timeouts.
|
|
122
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
123
|
+
* @mermaid
|
|
124
|
+
* sequenceDiagram
|
|
125
|
+
* participant Runner as ConsumerRunner
|
|
126
|
+
* participant Child as ProducerChild
|
|
127
|
+
* participant Handler as ConsumerHandler
|
|
128
|
+
* participant Comparer as Comparer
|
|
129
|
+
* Runner->>Runner: reset()
|
|
130
|
+
* loop For each count
|
|
131
|
+
* Runner->>Child: fork()
|
|
132
|
+
* Runner->>Runner: Store child process
|
|
133
|
+
* end
|
|
134
|
+
* Runner->>Child: send(start message)
|
|
135
|
+
* loop For each message from Child
|
|
136
|
+
* Child->>Runner: message(action)
|
|
137
|
+
* Runner->>Runner: store producer log
|
|
138
|
+
* Runner->>Handler: call handler
|
|
139
|
+
* Handler-->>Runner: return
|
|
140
|
+
* Runner->>Runner: record consumer log
|
|
141
|
+
* Runner->>Runner: finalizeIfComplete()
|
|
142
|
+
* end
|
|
143
|
+
* alt Complete
|
|
144
|
+
* Runner->>Comparer: compare logs
|
|
145
|
+
* Comparer-->>Runner: return result
|
|
146
|
+
* Runner-->>Caller: resolve(result)
|
|
147
|
+
* end
|
|
148
|
+
*/
|
|
149
|
+
run(count: number, timeout: number | undefined, times: number, random: boolean | undefined): Promise<ComparerResult>;
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { LoggedClass } from "@decaf-ts/logging";
|
|
2
|
+
import { TestReporter } from "./TestReporter.js";
|
|
3
|
+
/**
|
|
4
|
+
* @description Store for logs indexed by identifier.
|
|
5
|
+
* @summary A record where keys are identifiers and values are arrays of log strings.
|
|
6
|
+
* @typedef {Record<number, string[]>} LogStore
|
|
7
|
+
* @memberOf module:utils
|
|
8
|
+
*/
|
|
9
|
+
type LogStore = Record<number, string[]>;
|
|
10
|
+
/**
|
|
11
|
+
* @description Structure of a parsed log entry.
|
|
12
|
+
* @summary Contains timestamp, child identifier, and action.
|
|
13
|
+
* @interface ParsedLog
|
|
14
|
+
* @property {number} timestamp - The timestamp of the log.
|
|
15
|
+
* @property {string} child - The child identifier.
|
|
16
|
+
* @property {string} action - The action performed.
|
|
17
|
+
* @memberOf module:utils
|
|
18
|
+
*/
|
|
19
|
+
export interface ParsedLog {
|
|
20
|
+
timestamp: number;
|
|
21
|
+
child: string;
|
|
22
|
+
action: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @description Result of a comparison between consumer and producer logs.
|
|
26
|
+
* @summary Contains arrays of parsed logs for both consumer and producer.
|
|
27
|
+
* @interface ComparerResult
|
|
28
|
+
* @property {ParsedLog[]} consumer - The parsed consumer logs.
|
|
29
|
+
* @property {ParsedLog[]} producer - The parsed producer logs.
|
|
30
|
+
* @memberOf module:utils
|
|
31
|
+
*/
|
|
32
|
+
export interface ComparerResult {
|
|
33
|
+
consumer: ParsedLog[];
|
|
34
|
+
producer: ParsedLog[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @description Function type for comparing consumer and producer data.
|
|
38
|
+
* @summary Compares two LogStores and returns a Promise resolving to ComparerResult.
|
|
39
|
+
* @typedef {function(LogStore, LogStore): Promise<ComparerResult>} Comparer
|
|
40
|
+
* @memberOf module:utils
|
|
41
|
+
*/
|
|
42
|
+
type Comparer = (consumerData: LogStore, producerData: LogStore) => Promise<ComparerResult>;
|
|
43
|
+
/**
|
|
44
|
+
* @description Function type for handling consumer actions.
|
|
45
|
+
* @summary A function that takes an identifier and optional arguments, returning a result.
|
|
46
|
+
* @typedef {function(number, ...unknown[]): unknown | Promise<unknown>} ConsumerHandler
|
|
47
|
+
* @memberOf module:utils
|
|
48
|
+
*/
|
|
49
|
+
type ConsumerHandler = (identifier: number, ...args: unknown[]) => unknown | Promise<unknown>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Default comparer function for consumer and producer logs.
|
|
52
|
+
* @summary Sorts and compares consumer and producer logs to ensure they match.
|
|
53
|
+
* @param {LogStore} consumerData - The consumer logs.
|
|
54
|
+
* @param {LogStore} producerData - The producer logs.
|
|
55
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
56
|
+
* @function defaultComparer
|
|
57
|
+
* @memberOf module:utils
|
|
58
|
+
*/
|
|
59
|
+
export declare const defaultComparer: Comparer;
|
|
60
|
+
/**
|
|
61
|
+
* @description Options for the reporting comparer.
|
|
62
|
+
* @summary Configuration options for the reportingComparer function.
|
|
63
|
+
* @interface ReportingComparerOptions
|
|
64
|
+
* @property {TestReporter} [reporter] - The test reporter instance.
|
|
65
|
+
* @property {string} [testCase] - The test case name.
|
|
66
|
+
* @property {string} [referencePrefix] - The prefix for report references.
|
|
67
|
+
* @memberOf module:utils
|
|
68
|
+
*/
|
|
69
|
+
export interface ReportingComparerOptions {
|
|
70
|
+
reporter?: TestReporter;
|
|
71
|
+
testCase?: string;
|
|
72
|
+
referencePrefix?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @description Comparer function that reports results using TestReporter.
|
|
76
|
+
* @summary Compares logs and generates a report with tables and messages.
|
|
77
|
+
* @param {LogStore} consumerData - The consumer logs.
|
|
78
|
+
* @param {LogStore} producerData - The producer logs.
|
|
79
|
+
* @param {ReportingComparerOptions} [options] - Options for reporting.
|
|
80
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
81
|
+
* @function reportingComparer
|
|
82
|
+
* @memberOf module:utils
|
|
83
|
+
*/
|
|
84
|
+
export declare const reportingComparer: (consumerData: LogStore, producerData: LogStore, options?: ReportingComparerOptions) => Promise<ComparerResult>;
|
|
85
|
+
/**
|
|
86
|
+
* @class ConsumerRunner
|
|
87
|
+
* @description Runs a consumer process and manages producer child processes.
|
|
88
|
+
* @summary Orchestrates the execution of consumer and producer processes, collects logs, and compares results.
|
|
89
|
+
* @param {string} action - The action name.
|
|
90
|
+
* @param {ConsumerHandler} consumerHandler - The handler function for the consumer.
|
|
91
|
+
* @param {Comparer} [compareHandler] - Optional custom comparer function.
|
|
92
|
+
* @memberOf module:utils
|
|
93
|
+
*/
|
|
94
|
+
export declare class ConsumerRunner extends LoggedClass {
|
|
95
|
+
private readonly action;
|
|
96
|
+
private readonly handler;
|
|
97
|
+
private readonly comparerHandle;
|
|
98
|
+
private forkedCache;
|
|
99
|
+
private consumerResults;
|
|
100
|
+
private producerResults;
|
|
101
|
+
private childExitPromises;
|
|
102
|
+
private completionTriggered;
|
|
103
|
+
private producerCompletion;
|
|
104
|
+
private consumerCompletion;
|
|
105
|
+
private expectedIterations;
|
|
106
|
+
private activeHandlers;
|
|
107
|
+
constructor(action: string, consumerHandler: ConsumerHandler, compareHandler?: Comparer);
|
|
108
|
+
private reset;
|
|
109
|
+
private waitForChildExit;
|
|
110
|
+
private store;
|
|
111
|
+
private recordConsumer;
|
|
112
|
+
private isProducerComplete;
|
|
113
|
+
private isConsumerComplete;
|
|
114
|
+
private terminateChildren;
|
|
115
|
+
/**
|
|
116
|
+
* @description Runs the consumer and producer processes.
|
|
117
|
+
* @summary Starts the producer child processes and the consumer handler, then waits for completion and compares results.
|
|
118
|
+
* @param {number} count - The number of producers.
|
|
119
|
+
* @param {number} [timeout] - The timeout for producers.
|
|
120
|
+
* @param {number} times - The number of times to repeat.
|
|
121
|
+
* @param {boolean} [random] - Whether to use random timeouts.
|
|
122
|
+
* @return {Promise<ComparerResult>} The comparison result.
|
|
123
|
+
* @mermaid
|
|
124
|
+
* sequenceDiagram
|
|
125
|
+
* participant Runner as ConsumerRunner
|
|
126
|
+
* participant Child as ProducerChild
|
|
127
|
+
* participant Handler as ConsumerHandler
|
|
128
|
+
* participant Comparer as Comparer
|
|
129
|
+
* Runner->>Runner: reset()
|
|
130
|
+
* loop For each count
|
|
131
|
+
* Runner->>Child: fork()
|
|
132
|
+
* Runner->>Runner: Store child process
|
|
133
|
+
* end
|
|
134
|
+
* Runner->>Child: send(start message)
|
|
135
|
+
* loop For each message from Child
|
|
136
|
+
* Child->>Runner: message(action)
|
|
137
|
+
* Runner->>Runner: store producer log
|
|
138
|
+
* Runner->>Handler: call handler
|
|
139
|
+
* Handler-->>Runner: return
|
|
140
|
+
* Runner->>Runner: record consumer log
|
|
141
|
+
* Runner->>Runner: finalizeIfComplete()
|
|
142
|
+
* end
|
|
143
|
+
* alt Complete
|
|
144
|
+
* Runner->>Comparer: compare logs
|
|
145
|
+
* Comparer-->>Runner: return result
|
|
146
|
+
* Runner-->>Caller: resolve(result)
|
|
147
|
+
* end
|
|
148
|
+
*/
|
|
149
|
+
run(count: number, timeout: number | undefined, times: number, random: boolean | undefined): Promise<ComparerResult>;
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ParentMessage = {
|
|
2
|
+
identifier: number;
|
|
3
|
+
action: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
times: number;
|
|
6
|
+
random?: boolean;
|
|
7
|
+
terminate?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type ProducerResponse = {
|
|
10
|
+
identifier: number;
|
|
11
|
+
action: string;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
times: number;
|
|
14
|
+
random?: boolean;
|
|
15
|
+
result?: string[];
|
|
16
|
+
};
|
|
17
|
+
declare let shuttingDown: boolean;
|
|
18
|
+
declare const completeAndExit: (logMessage?: string) => void;
|