@runium/types-core 0.2.0 → 0.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.
- package/index.d.ts +80 -85
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -5,18 +5,18 @@ declare module '@runium/core' {
|
|
|
5
5
|
|
|
6
6
|
export function applyMacros(text: string, macros: MacrosCollection): string;
|
|
7
7
|
|
|
8
|
-
export class EventTrigger extends RuniumTrigger<
|
|
8
|
+
export class EventTrigger extends RuniumTrigger<EventTriggerParams> {
|
|
9
9
|
constructor(
|
|
10
|
-
|
|
10
|
+
params: EventTriggerParams,
|
|
11
11
|
project: RuniumTriggerProjectAccessible
|
|
12
12
|
);
|
|
13
13
|
enable(): void;
|
|
14
14
|
disable(): void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export type EventTriggerParams = RuniumTriggerParams<{
|
|
18
18
|
event: string;
|
|
19
|
-
}
|
|
19
|
+
}>;
|
|
20
20
|
|
|
21
21
|
export function extendProjectSchema(
|
|
22
22
|
schema: object,
|
|
@@ -28,22 +28,24 @@ declare module '@runium/core' {
|
|
|
28
28
|
WRITE_JSON = 'file-write-json',
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export function getProcessTreePids(pid: number): Promise<number[]>;
|
|
32
|
+
|
|
31
33
|
export function getProjectSchema(): object;
|
|
32
34
|
|
|
33
35
|
export const ID_REGEX: RegExp;
|
|
34
36
|
|
|
35
|
-
export class IntervalTrigger extends RuniumTrigger<
|
|
37
|
+
export class IntervalTrigger extends RuniumTrigger<IntervalTriggerParams> {
|
|
36
38
|
constructor(
|
|
37
|
-
|
|
39
|
+
params: IntervalTriggerParams,
|
|
38
40
|
project: RuniumTriggerProjectAccessible
|
|
39
41
|
);
|
|
40
42
|
enable(): void;
|
|
41
43
|
disable(): void;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
export
|
|
46
|
+
export type IntervalTriggerParams = RuniumTriggerParams<{
|
|
45
47
|
interval: number;
|
|
46
|
-
}
|
|
48
|
+
}>;
|
|
47
49
|
|
|
48
50
|
export function isCustomAction(
|
|
49
51
|
action: ProjectAction
|
|
@@ -69,6 +71,13 @@ declare module '@runium/core' {
|
|
|
69
71
|
|
|
70
72
|
export type JSONValue = string | number | boolean | JSONObject | JSONValue[];
|
|
71
73
|
|
|
74
|
+
export function killProcessTree(
|
|
75
|
+
pid: number,
|
|
76
|
+
signal?: NodeJS.Signals,
|
|
77
|
+
forceSignal?: NodeJS.Signals,
|
|
78
|
+
timeout?: number
|
|
79
|
+
): Promise<void>;
|
|
80
|
+
|
|
72
81
|
export type Macro = (...params: string[]) => string;
|
|
73
82
|
|
|
74
83
|
export type MacrosCollection = Record<string, Macro>;
|
|
@@ -113,26 +122,37 @@ declare module '@runium/core' {
|
|
|
113
122
|
| ProjectActionStopProject
|
|
114
123
|
| ProjectActionToggleTrigger;
|
|
115
124
|
|
|
116
|
-
export interface
|
|
125
|
+
export interface ProjectActionBase<Options = unknown> {
|
|
126
|
+
type: ProjectActionType;
|
|
127
|
+
options: Options;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ProjectActionEmitEvent
|
|
131
|
+
extends ProjectActionBase<{
|
|
132
|
+
event: string;
|
|
133
|
+
}> {
|
|
117
134
|
type: ProjectActionType.EMIT_EVENT;
|
|
118
|
-
event: string;
|
|
119
135
|
}
|
|
120
136
|
|
|
121
|
-
export interface ProjectActionProcessTask
|
|
137
|
+
export interface ProjectActionProcessTask
|
|
138
|
+
extends ProjectActionBase<{
|
|
139
|
+
taskId: string;
|
|
140
|
+
}> {
|
|
122
141
|
type:
|
|
123
142
|
| ProjectActionType.START_TASK
|
|
124
143
|
| ProjectActionType.RESTART_TASK
|
|
125
144
|
| ProjectActionType.STOP_TASK;
|
|
126
|
-
taskId: string;
|
|
127
145
|
}
|
|
128
146
|
|
|
129
|
-
export interface ProjectActionStopProject {
|
|
147
|
+
export interface ProjectActionStopProject extends ProjectActionBase<never> {
|
|
130
148
|
type: ProjectActionType.STOP_PROJECT;
|
|
131
149
|
}
|
|
132
150
|
|
|
133
|
-
export interface ProjectActionToggleTrigger
|
|
151
|
+
export interface ProjectActionToggleTrigger
|
|
152
|
+
extends ProjectActionBase<{
|
|
153
|
+
triggerId: string;
|
|
154
|
+
}> {
|
|
134
155
|
type: ProjectActionType.ENABLE_TRIGGER | ProjectActionType.DISABLE_TRIGGER;
|
|
135
|
-
triggerId: string;
|
|
136
156
|
}
|
|
137
157
|
|
|
138
158
|
export enum ProjectActionType {
|
|
@@ -159,15 +179,11 @@ declare module '@runium/core' {
|
|
|
159
179
|
TRIGGER_NOT_EXISTS = 'project-config-trigger-not-exists',
|
|
160
180
|
}
|
|
161
181
|
|
|
162
|
-
export
|
|
163
|
-
type: string;
|
|
164
|
-
payload?: unknown;
|
|
165
|
-
}
|
|
182
|
+
export type ProjectCustomAction = ProjectActionBase;
|
|
166
183
|
|
|
167
|
-
export
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
184
|
+
export type ProjectCustomTrigger = ProjectTriggerBase<{
|
|
185
|
+
options: unknown;
|
|
186
|
+
}>;
|
|
171
187
|
|
|
172
188
|
export interface ProjectDefaultTaskConfig
|
|
173
189
|
extends ProjectTaskConfig<TaskOptions> {
|
|
@@ -203,6 +219,19 @@ declare module '@runium/core' {
|
|
|
203
219
|
TRIGGER_TYPE_ALREADY_USED = 'project-schema-trigger-type-already-used',
|
|
204
220
|
}
|
|
205
221
|
|
|
222
|
+
export interface ProjectSchemaExtension {
|
|
223
|
+
project?: ProjectSchemaExtensionProject;
|
|
224
|
+
tasks?: Record<string, ProjectSchemaExtensionTask>;
|
|
225
|
+
definitions?: Record<string, unknown>;
|
|
226
|
+
actions?: Record<string, ProjectSchemaExtensionAction>;
|
|
227
|
+
triggers?: Record<string, ProjectSchemaExtensionTrigger>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface ProjectSchemaExtensionAction {
|
|
231
|
+
type: string;
|
|
232
|
+
options?: unknown;
|
|
233
|
+
}
|
|
234
|
+
|
|
206
235
|
export interface ProjectSchemaExtensionProject {
|
|
207
236
|
properties: unknown;
|
|
208
237
|
required?: string[];
|
|
@@ -213,43 +242,9 @@ declare module '@runium/core' {
|
|
|
213
242
|
options: unknown;
|
|
214
243
|
}
|
|
215
244
|
|
|
216
|
-
export interface ProjectSchemaExtensionAction {
|
|
217
|
-
type: string;
|
|
218
|
-
payload?: unknown;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
245
|
export interface ProjectSchemaExtensionTrigger {
|
|
222
246
|
type: string;
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export interface ProjectSchemaExtension {
|
|
227
|
-
project?: {
|
|
228
|
-
properties: unknown;
|
|
229
|
-
required?: string[];
|
|
230
|
-
};
|
|
231
|
-
tasks?: Record<
|
|
232
|
-
string,
|
|
233
|
-
{
|
|
234
|
-
type: string;
|
|
235
|
-
options: unknown;
|
|
236
|
-
}
|
|
237
|
-
>;
|
|
238
|
-
definitions?: Record<string, unknown>;
|
|
239
|
-
actions?: Record<
|
|
240
|
-
string,
|
|
241
|
-
{
|
|
242
|
-
type: string;
|
|
243
|
-
payload?: unknown;
|
|
244
|
-
}
|
|
245
|
-
>;
|
|
246
|
-
triggers?: Record<
|
|
247
|
-
string,
|
|
248
|
-
{
|
|
249
|
-
type: string;
|
|
250
|
-
payload?: unknown;
|
|
251
|
-
}
|
|
252
|
-
>;
|
|
247
|
+
options?: unknown;
|
|
253
248
|
}
|
|
254
249
|
|
|
255
250
|
export interface ProjectState {
|
|
@@ -329,26 +324,33 @@ declare module '@runium/core' {
|
|
|
329
324
|
| ProjectTriggerTimeout
|
|
330
325
|
| ProjectCustomTrigger;
|
|
331
326
|
|
|
332
|
-
interface ProjectTriggerBase {
|
|
327
|
+
interface ProjectTriggerBase<T = unknown> {
|
|
333
328
|
id: string;
|
|
334
329
|
type: ProjectTriggerType | string;
|
|
335
330
|
action: ProjectAction;
|
|
336
331
|
disabled?: boolean;
|
|
332
|
+
options: T;
|
|
337
333
|
}
|
|
338
334
|
|
|
339
|
-
export interface ProjectTriggerEvent
|
|
335
|
+
export interface ProjectTriggerEvent
|
|
336
|
+
extends ProjectTriggerBase<{
|
|
337
|
+
event: string;
|
|
338
|
+
}> {
|
|
340
339
|
type: ProjectTriggerType.EVENT;
|
|
341
|
-
event: string;
|
|
342
340
|
}
|
|
343
341
|
|
|
344
|
-
export interface ProjectTriggerInterval
|
|
342
|
+
export interface ProjectTriggerInterval
|
|
343
|
+
extends ProjectTriggerBase<{
|
|
344
|
+
interval: number;
|
|
345
|
+
}> {
|
|
345
346
|
type: ProjectTriggerType.INTERVAL;
|
|
346
|
-
interval: number;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
export interface ProjectTriggerTimeout
|
|
349
|
+
export interface ProjectTriggerTimeout
|
|
350
|
+
extends ProjectTriggerBase<{
|
|
351
|
+
timeout: number;
|
|
352
|
+
}> {
|
|
350
353
|
type: ProjectTriggerType.TIMEOUT;
|
|
351
|
-
timeout: number;
|
|
352
354
|
}
|
|
353
355
|
|
|
354
356
|
export enum ProjectTriggerType {
|
|
@@ -359,7 +361,7 @@ declare module '@runium/core' {
|
|
|
359
361
|
|
|
360
362
|
export function readJsonFile<T = JSONValue>(path: string): Promise<T>;
|
|
361
363
|
|
|
362
|
-
type RuniumActionProcessor = (
|
|
364
|
+
type RuniumActionProcessor = (options: unknown) => void;
|
|
363
365
|
|
|
364
366
|
export class RuniumError extends Error {
|
|
365
367
|
code: string;
|
|
@@ -394,27 +396,29 @@ declare module '@runium/core' {
|
|
|
394
396
|
reason?: string;
|
|
395
397
|
}
|
|
396
398
|
|
|
397
|
-
export abstract class RuniumTrigger<
|
|
399
|
+
export abstract class RuniumTrigger<Params extends RuniumTriggerParams> {
|
|
398
400
|
protected project: RuniumTriggerProjectAccessible;
|
|
399
401
|
protected id: string;
|
|
400
402
|
protected action: ProjectAction;
|
|
401
403
|
protected disabled: boolean;
|
|
402
|
-
constructor(
|
|
404
|
+
constructor(params: Params, project: RuniumTriggerProjectAccessible);
|
|
403
405
|
abstract enable(): void;
|
|
404
406
|
abstract disable(): void;
|
|
405
407
|
getId(): string;
|
|
406
408
|
isDisabled(): boolean;
|
|
409
|
+
processAction(): void;
|
|
407
410
|
}
|
|
408
411
|
|
|
409
|
-
export type RuniumTriggerConstructor<
|
|
412
|
+
export type RuniumTriggerConstructor<Params extends RuniumTriggerParams> =
|
|
410
413
|
new (
|
|
411
|
-
|
|
414
|
+
params: Params,
|
|
412
415
|
project: RuniumTriggerProjectAccessible
|
|
413
|
-
) => RuniumTrigger<
|
|
416
|
+
) => RuniumTrigger<Params>;
|
|
414
417
|
|
|
415
|
-
export interface
|
|
418
|
+
export interface RuniumTriggerParams<Options = unknown> {
|
|
416
419
|
id: string;
|
|
417
420
|
action: ProjectAction;
|
|
421
|
+
options: Options;
|
|
418
422
|
disabled?: boolean;
|
|
419
423
|
}
|
|
420
424
|
|
|
@@ -488,18 +492,18 @@ declare module '@runium/core' {
|
|
|
488
492
|
STOPPED = 'stopped',
|
|
489
493
|
}
|
|
490
494
|
|
|
491
|
-
export class TimeoutTrigger extends RuniumTrigger<
|
|
495
|
+
export class TimeoutTrigger extends RuniumTrigger<TimeoutTriggerParams> {
|
|
492
496
|
constructor(
|
|
493
|
-
|
|
497
|
+
params: TimeoutTriggerParams,
|
|
494
498
|
project: RuniumTriggerProjectAccessible
|
|
495
499
|
);
|
|
496
500
|
enable(): void;
|
|
497
501
|
disable(): void;
|
|
498
502
|
}
|
|
499
503
|
|
|
500
|
-
export
|
|
504
|
+
export type TimeoutTriggerParams = RuniumTriggerParams<{
|
|
501
505
|
timeout: number;
|
|
502
|
-
}
|
|
506
|
+
}>;
|
|
503
507
|
|
|
504
508
|
export function validateProject(project: ProjectConfig, schema: object): void;
|
|
505
509
|
|
|
@@ -507,13 +511,4 @@ declare module '@runium/core' {
|
|
|
507
511
|
path: string,
|
|
508
512
|
data: T
|
|
509
513
|
): Promise<void>;
|
|
510
|
-
|
|
511
|
-
export function getProcessTreePids(pid: number): Promise<number[]>;
|
|
512
|
-
|
|
513
|
-
export function killProcessTree(
|
|
514
|
-
pid: number,
|
|
515
|
-
signal?: NodeJS.Signals,
|
|
516
|
-
forceSignal?: NodeJS.Signals,
|
|
517
|
-
timeout?: number
|
|
518
|
-
): Promise<void>;
|
|
519
514
|
}
|