@qodalis/cli-core 0.0.15 → 2.0.0-beta.1

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 (51) hide show
  1. package/README.md +399 -31
  2. package/package.json +16 -23
  3. package/public-api.d.mts +2322 -0
  4. package/public-api.d.ts +2322 -8
  5. package/public-api.js +3597 -0
  6. package/public-api.js.map +1 -0
  7. package/public-api.mjs +3545 -0
  8. package/public-api.mjs.map +1 -0
  9. package/esm2022/lib/constants/index.mjs +0 -8
  10. package/esm2022/lib/interfaces/command-hooks.mjs +0 -2
  11. package/esm2022/lib/interfaces/command-processor.mjs +0 -2
  12. package/esm2022/lib/interfaces/execution-context.mjs +0 -2
  13. package/esm2022/lib/interfaces/index.mjs +0 -6
  14. package/esm2022/lib/interfaces/progress-bars.mjs +0 -2
  15. package/esm2022/lib/interfaces/users.mjs +0 -2
  16. package/esm2022/lib/models/index.mjs +0 -175
  17. package/esm2022/lib/models/services.mjs +0 -2
  18. package/esm2022/lib/models/users.mjs +0 -2
  19. package/esm2022/lib/modules/index.mjs +0 -30
  20. package/esm2022/lib/themes/index.mjs +0 -221
  21. package/esm2022/lib/types/CancellablePromise.mjs +0 -28
  22. package/esm2022/lib/types/index.mjs +0 -2
  23. package/esm2022/lib/utils/delay.mjs +0 -4
  24. package/esm2022/lib/utils/index.mjs +0 -80
  25. package/esm2022/lib/utils/object-describer.mjs +0 -134
  26. package/esm2022/lib/utils/terminal-utils.mjs +0 -16
  27. package/esm2022/lib/version.mjs +0 -3
  28. package/esm2022/public-api.mjs +0 -12
  29. package/esm2022/qodalis-cli-core.mjs +0 -5
  30. package/fesm2022/qodalis-cli-core.mjs +0 -697
  31. package/fesm2022/qodalis-cli-core.mjs.map +0 -1
  32. package/index.d.ts +0 -5
  33. package/lib/constants/index.d.ts +0 -5
  34. package/lib/interfaces/command-hooks.d.ts +0 -5
  35. package/lib/interfaces/command-processor.d.ts +0 -151
  36. package/lib/interfaces/execution-context.d.ts +0 -109
  37. package/lib/interfaces/index.d.ts +0 -349
  38. package/lib/interfaces/progress-bars.d.ts +0 -72
  39. package/lib/interfaces/users.d.ts +0 -42
  40. package/lib/models/index.d.ts +0 -293
  41. package/lib/models/services.d.ts +0 -20
  42. package/lib/models/users.d.ts +0 -30
  43. package/lib/modules/index.d.ts +0 -6
  44. package/lib/themes/index.d.ts +0 -16
  45. package/lib/types/CancellablePromise.d.ts +0 -8
  46. package/lib/types/index.d.ts +0 -1
  47. package/lib/utils/delay.d.ts +0 -1
  48. package/lib/utils/index.d.ts +0 -24
  49. package/lib/utils/object-describer.d.ts +0 -12
  50. package/lib/utils/terminal-utils.d.ts +0 -7
  51. package/lib/version.d.ts +0 -1
@@ -1,293 +0,0 @@
1
- import { ITerminalInitOnlyOptions, ITerminalOptions } from '@xterm/xterm';
2
- export type CliProcessCommand = {
3
- /**
4
- * The command that was entered
5
- */
6
- command: string;
7
- /**
8
- * The data that was entered
9
- */
10
- data?: any;
11
- /**
12
- * The chain of commands that were entered
13
- */
14
- chainCommands: string[];
15
- /**
16
- * The raw command that was entered
17
- */
18
- rawCommand: string;
19
- /**
20
- * The value of the command
21
- */
22
- value?: string;
23
- /**
24
- * The arguments that were entered
25
- */
26
- args: Record<string, any>;
27
- };
28
- export declare enum CliForegroundColor {
29
- Black = "\u001B[30m",
30
- Red = "\u001B[31m",
31
- Green = "\u001B[32m",
32
- Yellow = "\u001B[33m",
33
- Blue = "\u001B[34m",
34
- Magenta = "\u001B[35m",
35
- Cyan = "\u001B[36m",
36
- White = "\u001B[37m",
37
- Reset = "\u001B[0m"
38
- }
39
- export declare enum CliBackgroundColor {
40
- Black = "\u001B[40m",
41
- Red = "\u001B[41m",
42
- Green = "\u001B[42m",
43
- Yellow = "\u001B[43m",
44
- Blue = "\u001B[44m",
45
- Magenta = "\u001B[45m",
46
- Cyan = "\u001B[46m",
47
- White = "\u001B[47m"
48
- }
49
- export declare enum CliIcon {
50
- CheckIcon = "\u2714",
51
- CrossIcon = "\u2718",
52
- InfoIcon = "\u2139",
53
- WarningIcon = "\u26A0",
54
- QuestionMark = "?",
55
- Exclamation = "\u2757",
56
- Ellipsis = "\u2026",
57
- Dot = "\u2022",
58
- Bullet = "\u2023",
59
- ArrowRight = "\u2192",
60
- ArrowLeft = "\u2190",
61
- ArrowUp = "\u2191",
62
- ArrowDown = "\u2193",
63
- ArrowRightFilled = "\u25B6",
64
- ArrowLeftFilled = "\u25C0",
65
- ArrowUpFilled = "\u25B2",
66
- ArrowDownFilled = "\u25BC",
67
- DoubleArrowRight = "\u00BB",
68
- DoubleArrowLeft = "\u00AB",
69
- Star = "\u2605",
70
- StarEmpty = "\u2606",
71
- Plus = "+",
72
- Minus = "-",
73
- Progress = "\u23F3",
74
- Success = "\u2705",
75
- Failure = "\u274C",
76
- Clock = "\u23F0",
77
- Timer = "\u23F1",
78
- Alarm = "\uD83D\uDD14",
79
- Calendar = "\uD83D\uDCC5",
80
- Folder = "\uD83D\uDCC1",
81
- FolderOpen = "\uD83D\uDCC2",
82
- File = "\uD83D\uDCC4",
83
- Archive = "\uD83D\uDDC3",
84
- Link = "\uD83D\uDD17",
85
- Chain = "\u26D3",
86
- Bookmark = "\uD83D\uDD16",
87
- Edit = "\u270F",
88
- Trash = "\uD83D\uDDD1",
89
- Add = "\u2795",
90
- Remove = "\u2796",
91
- Reload = "\uD83D\uDD04",
92
- Save = "\uD83D\uDCBE",
93
- Undo = "\u21A9",
94
- Redo = "\u21AA",
95
- Play = "\u25B6",
96
- Pause = "\u23F8",
97
- Stop = "\u23F9",
98
- Cancel = "\u274E",
99
- User = "\uD83D\uDC64",
100
- Group = "\uD83D\uDC65",
101
- Lock = "\uD83D\uDD12",
102
- Unlock = "\uD83D\uDD13",
103
- Help = "\u2753",
104
- Key = "\uD83D\uDD11",
105
- Shield = "\uD83D\uDEE1",
106
- Gear = "\u2699",
107
- Settings = "\u2699\uFE0F",
108
- Theme = "\uD83C\uDFA8",
109
- Light = "\uD83D\uDCA1",
110
- Bug = "\uD83D\uDC1E",
111
- Wrench = "\uD83D\uDD27",
112
- Hammer = "\uD83D\uDD28",
113
- Terminal = "\uD83D\uDCBB",
114
- Database = "\uD83D\uDDC4",
115
- Server = "\uD83D\uDDA5",
116
- Cloud = "\u2601",
117
- Network = "\uD83C\uDF10",
118
- Monitor = "\uD83D\uDDA5",
119
- Printer = "\uD83D\uDDA8",
120
- USB = "\uD83D\uDD0C",
121
- Speaker = "\uD83D\uDD0A",
122
- Microphone = "\uD83C\uDF99",
123
- Camera = "\uD83D\uDCF7",
124
- Video = "\uD83C\uDFA5",
125
- Music = "\uD83C\uDFB5",
126
- Phone = "\uD83D\uDCDE",
127
- Package = "\uD83D\uDCE6",
128
- Plugin = "\uD83D\uDD0C",
129
- Extension = "\uD83E\uDDE9",
130
- Module = "\uD83D\uDCE6",
131
- Evaluate = "\uD83D\uDD0D",
132
- Variable = "\uD83D\uDD27",
133
- Script = "\uD83D\uDCDC",
134
- Code = "\uD83D\uDCBE",
135
- Logs = "\uD83D\uDCDC",
136
- Power = "\u23FB",
137
- Heart = "\u2764",
138
- Flame = "\uD83D\uDD25",
139
- Growth = "\uD83D\uDCC8",
140
- Decline = "\uD83D\uDCC9",
141
- WarningFilled = "\u26A0\uFE0F",
142
- Sun = "\u2600",
143
- Moon = "\uD83C\uDF19",
144
- Rain = "\uD83C\uDF27",
145
- Snow = "\u2744",
146
- Lightning = "\u26A1",
147
- Tree = "\uD83C\uDF32",
148
- Smile = "\uD83D\uDE0A",
149
- Sad = "\uD83D\uDE22",
150
- Angry = "\uD83D\uDE21",
151
- Clap = "\uD83D\uDC4F",
152
- ThumbsUp = "\uD83D\uDC4D",
153
- ThumbsDown = "\uD83D\uDC4E",
154
- Rocket = "\uD83D\uDE80",
155
- Globe = "\uD83C\uDF0D",
156
- Medal = "\uD83C\uDFC5",
157
- Trophy = "\uD83C\uDFC6",
158
- Flag = "\uD83D\uDEA9",
159
- StarFilled = "\u2B50",
160
- StarOutline = "\u2729",
161
- Fireworks = "\uD83C\uDF86",
162
- Balloon = "\uD83C\uDF88",
163
- Gift = "\uD83C\uDF81"
164
- }
165
- /**
166
- * Options for the CLI
167
- */
168
- export type CliOptions = Record<string, any> & {
169
- /**
170
- * The welcome message options
171
- */
172
- welcomeMessage?: {
173
- /**
174
- * The message to display
175
- */
176
- message?: string;
177
- /**
178
- * When to show the welcome message
179
- * @default 'always'
180
- */
181
- show?: 'always' | 'once' | 'daily' | 'never';
182
- };
183
- /**
184
- * If true, the welcome message is hidden
185
- * @default false
186
- */
187
- hideWelcomeMessage?: boolean;
188
- /**
189
- * Users module options
190
- */
191
- usersModule?: {
192
- /**
193
- * If true, the users module is enabled
194
- */
195
- enabled: boolean;
196
- /**
197
- * Hide the prompt to display when the CLI is ready to accept input
198
- */
199
- hideUserName?: boolean;
200
- /**
201
- * Reload the page when the user changes
202
- */
203
- reloadPageOnUserChange?: boolean;
204
- };
205
- /**
206
- * Custom terminal options
207
- */
208
- terminalOptions?: ITerminalOptions & ITerminalInitOnlyOptions;
209
- /**
210
- * The minimum log level to display
211
- */
212
- logLevel?: CliLogLevel;
213
- };
214
- /**
215
- * Represents a package that can be installed
216
- */
217
- export interface Package {
218
- /**
219
- * The name of the package
220
- */
221
- name: string;
222
- /**
223
- * The global name used to access the package
224
- */
225
- globalName?: string;
226
- /**
227
- * The version of the package
228
- */
229
- version: string;
230
- /**
231
- * The unpkg url to the package
232
- */
233
- url: string;
234
- /**
235
- * The dependencies for the module
236
- */
237
- dependencies?: Package[];
238
- }
239
- /**
240
- * Represents command processor metadata
241
- */
242
- export type CliProcessorMetadata = Record<string, any> & {
243
- /**
244
- * If true, the processor is sealed and cannot be extended
245
- */
246
- sealed?: boolean;
247
- /**
248
- * If true, the processor requires the server to be running
249
- */
250
- requireServer?: boolean;
251
- /**
252
- * The module the processor belongs to
253
- */
254
- module?: string;
255
- /**
256
- * An icon to display for the processor
257
- */
258
- icon?: CliIcon | string;
259
- };
260
- /**
261
- * Represents a state configuration for the CLI processor
262
- */
263
- export type CliStateConfiguration = {
264
- /**
265
- * The initial state for the processor
266
- */
267
- initialState: Record<string, any>;
268
- /**
269
- * The store identifier for the processor, if any
270
- * @remarks If the store identifier is not set, the processor command name is used
271
- */
272
- storeName?: string;
273
- };
274
- /**
275
- * Represents a log level for the CLI
276
- */
277
- export declare enum CliLogLevel {
278
- None = 0,
279
- DEBUG = 1,
280
- LOG = 2,
281
- INFO = 3,
282
- WARN = 4,
283
- ERROR = 5
284
- }
285
- export type CliState = Record<string, any>;
286
- export declare const enums: {
287
- CliForegroundColor: typeof CliForegroundColor;
288
- CliBackgroundColor: typeof CliBackgroundColor;
289
- CliIcon: typeof CliIcon;
290
- CliLogLevel: typeof CliLogLevel;
291
- };
292
- export * from './services';
293
- export * from './users';
@@ -1,20 +0,0 @@
1
- type MultiServices = {
2
- /**
3
- * When true, injector returns an array of instances. This is useful to allow multiple
4
- * providers spread across many files to provide configuration information to a common token.
5
- */
6
- multi?: boolean;
7
- };
8
- export type CliValueProvider = MultiServices & {
9
- useValue: any;
10
- };
11
- export type CliTypeProvider = MultiServices & {
12
- useClass: any;
13
- };
14
- export type CliFactoryProvider = MultiServices & {
15
- useFactory: Function;
16
- };
17
- export type CliProvider = {
18
- provide: any;
19
- } & (CliValueProvider | CliTypeProvider | CliFactoryProvider) & Record<string, any>;
20
- export {};
@@ -1,30 +0,0 @@
1
- export type ICliUser = {
2
- /**
3
- * The id of the user
4
- */
5
- id: string;
6
- /**
7
- * The name of the user
8
- */
9
- name: string;
10
- /**
11
- * The email of the user
12
- */
13
- email: string;
14
- /**
15
- * The groups the user belongs to
16
- * @default []
17
- */
18
- groups?: string[];
19
- };
20
- export interface ICliUserSession {
21
- /**
22
- * The user associated with the session
23
- */
24
- user: ICliUser;
25
- /**
26
- * The data associated with the user session
27
- */
28
- data?: Record<string, any>;
29
- }
30
- export type CliAddUser = Omit<ICliUser, 'id'>;
@@ -1,6 +0,0 @@
1
- import { ICliExecutionContext, ICliUmdModule } from '../interfaces';
2
- export declare const initializeBrowserEnvironment: ({ context, handlers, }: {
3
- context: ICliExecutionContext;
4
- handlers: ((module: ICliUmdModule) => Promise<void>)[];
5
- }) => void;
6
- export declare const bootUmdModule: (module: ICliUmdModule) => Promise<void>;
@@ -1,16 +0,0 @@
1
- import { ITheme } from '@xterm/xterm';
2
- export type CliTheme = ITheme;
3
- export declare const DefaultThemes: {
4
- default: CliTheme;
5
- dracula: CliTheme;
6
- monokai: CliTheme;
7
- solarizedDark: CliTheme;
8
- solarizedLight: CliTheme;
9
- gruvboxDark: CliTheme;
10
- gruvboxLight: CliTheme;
11
- nord: CliTheme;
12
- oneDark: CliTheme;
13
- material: CliTheme;
14
- yellow: CliTheme;
15
- [key: string]: CliTheme;
16
- };
@@ -1,8 +0,0 @@
1
- export declare class CancellablePromise<T> {
2
- private executor;
3
- private hasCancelled;
4
- private abortController;
5
- constructor(executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void);
6
- execute(): Promise<T>;
7
- cancel(): void;
8
- }
@@ -1 +0,0 @@
1
- export * from './CancellablePromise';
@@ -1 +0,0 @@
1
- export declare const delay: (ms: number) => Promise<void>;
@@ -1,24 +0,0 @@
1
- import { ICliCommandParameterDescriptor } from '../interfaces';
2
- import { CliBackgroundColor } from '../models';
3
- import { ObjectDescriber } from './object-describer';
4
- export declare const getParameterValue: (p: ICliCommandParameterDescriptor, args: Record<string, any>) => any | undefined;
5
- export declare const formatJson: (json: any) => string;
6
- export declare const colorizeJson: (jsonString: any) => string;
7
- export declare const toQueryString: (params: Record<string, any>) => string;
8
- export declare const highlightTextWithBg: (text: string, pattern: RegExp, bgColor?: CliBackgroundColor) => string;
9
- export declare const getRightOfWord: (command: string, word: string) => string | undefined;
10
- export declare const colorFirstWord: (text: string, colorFunction: (word: string) => string) => string;
11
- export * from './object-describer';
12
- export * from './delay';
13
- export * from './terminal-utils';
14
- export declare const utils: {
15
- getParameterValue: (p: ICliCommandParameterDescriptor, args: Record<string, any>) => any | undefined;
16
- formatJson: (json: any) => string;
17
- colorizeJson: (jsonString: any) => string;
18
- toQueryString: (params: Record<string, any>) => string;
19
- highlightTextWithBg: (text: string, pattern: RegExp, bgColor?: CliBackgroundColor) => string;
20
- getRightOfWord: (command: string, word: string) => string | undefined;
21
- colorFirstWord: (text: string, colorFunction: (word: string) => string) => string;
22
- ObjectDescriber: typeof ObjectDescriber;
23
- delay: (ms: number) => Promise<void>;
24
- };
@@ -1,12 +0,0 @@
1
- import { ICliCommandProcessor } from '../interfaces';
2
- export declare class ObjectDescriber {
3
- static describe(obj: any, options?: {
4
- filter?: (o: {
5
- funcName: string;
6
- func: any;
7
- args: string[];
8
- }) => boolean;
9
- }): ICliCommandProcessor[];
10
- static supportsDynamicArgs(func: any): boolean;
11
- static getFunctionArguments(func: any): string[];
12
- }
@@ -1,7 +0,0 @@
1
- import { Terminal } from '@xterm/xterm';
2
- /**
3
- * Clears the current line in the terminal, accounting for text that wraps across multiple lines.
4
- * @param terminal The xterm terminal instance
5
- * @param contentLength The total visible character count on the line (prompt + text)
6
- */
7
- export declare const clearTerminalLine: (terminal: Terminal, contentLength: number) => void;
package/lib/version.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const LIBRARY_VERSION = "0.0.15";