@rango-dev/queue-manager-core 0.1.15-next.5 → 0.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/CHANGELOG.md +4 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +7 -0
- package/dist/manager.d.ts +212 -212
- package/dist/manager.d.ts.map +1 -1
- package/dist/persistor.d.ts +19 -19
- package/dist/persistor.d.ts.map +1 -1
- package/dist/queue.d.ts +181 -181
- package/dist/queue.d.ts.map +1 -1
- package/dist/types.d.ts +22 -22
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -6
- package/dist/queue-manager-core.cjs.development.js +0 -1500
- package/dist/queue-manager-core.cjs.development.js.map +0 -1
- package/dist/queue-manager-core.cjs.production.min.js +0 -2
- package/dist/queue-manager-core.cjs.production.min.js.map +0 -1
- package/dist/queue-manager-core.esm.js +0 -1494
- package/dist/queue-manager-core.esm.js.map +0 -1
package/dist/persistor.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { DBSchema, IDBPDatabase } from 'idb';
|
|
2
|
-
import { QueueID } from './manager';
|
|
3
|
-
import { PersistedQueue } from './types';
|
|
4
|
-
export declare const DB_NAME = "queues-manager";
|
|
5
|
-
|
|
6
|
-
interface Database extends DBSchema {
|
|
7
|
-
queues: {
|
|
8
|
-
value: PersistedQueue;
|
|
9
|
-
key: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
declare class Persistor {
|
|
13
|
-
db: Promise<IDBPDatabase<Database>>;
|
|
14
|
-
constructor();
|
|
15
|
-
insertQueue(queue: PersistedQueue): Promise<void>;
|
|
16
|
-
updateQueue(id: QueueID, queue: UpdatePersistedQueue): Promise<void>;
|
|
17
|
-
getAll(): Promise<PersistedQueue[]>;
|
|
18
|
-
}
|
|
19
|
-
export default Persistor;
|
|
1
|
+
import { DBSchema, IDBPDatabase } from 'idb';
|
|
2
|
+
import { QueueID } from './manager';
|
|
3
|
+
import { PersistedQueue } from './types';
|
|
4
|
+
export declare const DB_NAME = "queues-manager";
|
|
5
|
+
type UpdatePersistedQueue = Partial<Pick<PersistedQueue, 'status' | 'state' | 'tasks' | 'storage'>>;
|
|
6
|
+
interface Database extends DBSchema {
|
|
7
|
+
queues: {
|
|
8
|
+
value: PersistedQueue;
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare class Persistor {
|
|
13
|
+
db: Promise<IDBPDatabase<Database>>;
|
|
14
|
+
constructor();
|
|
15
|
+
insertQueue(queue: PersistedQueue): Promise<void>;
|
|
16
|
+
updateQueue(id: QueueID, queue: UpdatePersistedQueue): Promise<void>;
|
|
17
|
+
getAll(): Promise<PersistedQueue[]>;
|
|
18
|
+
}
|
|
19
|
+
export default Persistor;
|
|
20
20
|
//# sourceMappingURL=persistor.d.ts.map
|
package/dist/persistor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistor.d.ts","sourceRoot":"","sources":["src/persistor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,OAAO,mBAAmB,CAAC;AAIxC,
|
|
1
|
+
{"version":3,"file":"persistor.d.ts","sourceRoot":"","sources":["../src/persistor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,OAAO,mBAAmB,CAAC;AAIxC,KAAK,oBAAoB,GAAG,OAAO,CACjC,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,CAC/D,CAAC;AAEF,UAAU,QAAS,SAAQ,QAAQ;IACjC,MAAM,EAAE;QACN,KAAK,EAAE,cAAc,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,cAAM,SAAS;IACb,EAAE,EAAE,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;;IAU9B,WAAW,CAAC,KAAK,EAAE,cAAc;IASjC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB;IAYpD,MAAM;CAMb;AAED,eAAe,SAAS,CAAC"}
|
package/dist/queue.d.ts
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
import { ManagerContext, QueueDef, QueueID } from './manager';
|
|
2
|
-
import { QueueStorage, Status } from './types';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
status: Status;
|
|
6
|
-
blockedFor: any;
|
|
7
|
-
};
|
|
8
|
-
export interface QueueContext {
|
|
9
|
-
_queue?: {
|
|
10
|
-
id: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export
|
|
14
|
-
context: ManagerContext;
|
|
15
|
-
};
|
|
16
|
-
export interface QueueState {
|
|
17
|
-
status: Status;
|
|
18
|
-
activeTaskIndex: number;
|
|
19
|
-
tasks: {
|
|
20
|
-
[key in TaskId]: TaskState;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface Task {
|
|
24
|
-
id: TaskId;
|
|
25
|
-
action: string;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
28
|
-
tasks: Task[];
|
|
29
|
-
state: QueueState;
|
|
30
|
-
storage: QueueStorage;
|
|
31
|
-
};
|
|
32
|
-
export interface TaskEvent {
|
|
33
|
-
id: TaskId;
|
|
34
|
-
task: TaskState;
|
|
35
|
-
action: string;
|
|
36
|
-
}
|
|
37
|
-
export interface QueueEventHandlers {
|
|
38
|
-
onUpdateListStatus: (status: Status) => void;
|
|
39
|
-
onCreate: (event: TaskEvent) => void;
|
|
40
|
-
onUpdate: (event: TaskEvent) => void;
|
|
41
|
-
onStorageUpdate: (data: QueueStorage) => void;
|
|
42
|
-
onBlock: (data: Omit<TaskEvent, 'task'> & {
|
|
43
|
-
reason: Record<string, unknown>;
|
|
44
|
-
}) => void;
|
|
45
|
-
onUnblock: (data: {
|
|
46
|
-
id: string;
|
|
47
|
-
}) => void;
|
|
48
|
-
}
|
|
49
|
-
interface QueueOptions {
|
|
50
|
-
id: QueueID;
|
|
51
|
-
events: QueueEventHandlers;
|
|
52
|
-
actions: QueueDef['actions'];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* Notes on statuses:
|
|
57
|
-
* - Success: last task has success status
|
|
58
|
-
* - Failed: any of task has been failed
|
|
59
|
-
* - Running: first task is not on pending
|
|
60
|
-
* - Pending: default state. not started
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
declare class Queue {
|
|
64
|
-
id: string;
|
|
65
|
-
state: QueueState;
|
|
66
|
-
tasks: Task[];
|
|
67
|
-
private events;
|
|
68
|
-
private actions;
|
|
69
|
-
private storage;
|
|
70
|
-
constructor(options: QueueOptions);
|
|
71
|
-
/**
|
|
72
|
-
* Update queue status and trigger an event
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
private updateQueueStatus;
|
|
76
|
-
private updateActiveTaskIndex;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* Update task state (`status`, `blockedFor`) and trigger an event.
|
|
80
|
-
* @param id
|
|
81
|
-
* @param nextState
|
|
82
|
-
*/
|
|
83
|
-
private updateTaskState;
|
|
84
|
-
/**
|
|
85
|
-
* Create a task by providing an `action` name.
|
|
86
|
-
*
|
|
87
|
-
* this method creating the task, push it to the queue's tasks and trigger an event.
|
|
88
|
-
* @param action
|
|
89
|
-
*/
|
|
90
|
-
createTask(action: string): void;
|
|
91
|
-
/**
|
|
92
|
-
* Initilize a queue with some tasks, instead of an empty queue.
|
|
93
|
-
*
|
|
94
|
-
* Using it for recover the queue state from persistor.
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
initTasks(info: InitTasks): void;
|
|
98
|
-
checkBlock(): void;
|
|
99
|
-
/**
|
|
100
|
-
* Getting task state by ID
|
|
101
|
-
*/
|
|
102
|
-
get(id: string): TaskState | null;
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* Checking if status of the last is `SUCCESS` or not
|
|
106
|
-
*
|
|
107
|
-
*/
|
|
108
|
-
private lastTaskIsSuccessful;
|
|
109
|
-
/**
|
|
110
|
-
* If the first task started (it's not PENDING),
|
|
111
|
-
* it means the queue has been ran.
|
|
112
|
-
*
|
|
113
|
-
* @returns
|
|
114
|
-
*/
|
|
115
|
-
private firstTaskIsStarted;
|
|
116
|
-
/**
|
|
117
|
-
* Getting active task index from state and
|
|
118
|
-
* returns the task and its state.
|
|
119
|
-
*
|
|
120
|
-
*/
|
|
121
|
-
private getActiveTask;
|
|
122
|
-
/**
|
|
123
|
-
* Update and find the queue status by checking state of each tasks in the queue.
|
|
124
|
-
*/
|
|
125
|
-
check(): void;
|
|
126
|
-
/**
|
|
127
|
-
* Execute active task.
|
|
128
|
-
* Based on the state of active task, the behaviour is different. If status is:
|
|
129
|
-
* - Success -> we need to go to next task by updating the active index and try `next` on more time.
|
|
130
|
-
* - Failed, Running, or no active task -> doesn't do anything.
|
|
131
|
-
* - Pending or Blocked -> update the task and queue status to running, and execute the provided `action` for the task.
|
|
132
|
-
*
|
|
133
|
-
* The queue is a linked list somehow, active task means the pointer to where we are in the queue right now.
|
|
134
|
-
*
|
|
135
|
-
*/
|
|
136
|
-
next(params: NextParams): void;
|
|
137
|
-
/**
|
|
138
|
-
* Change the `status` of active task and queue to BLOCKED, then trigger an event.
|
|
139
|
-
*/
|
|
140
|
-
block({ reason, silent, }: {
|
|
141
|
-
reason: Record<string, unknown>;
|
|
142
|
-
silent?: boolean;
|
|
143
|
-
}): void;
|
|
144
|
-
/**
|
|
145
|
-
* If the active task is `BLOCKED`, update the task status to `PENDING`, queue status to `RUNNING`
|
|
146
|
-
* then trigger an event.
|
|
147
|
-
*/
|
|
148
|
-
unblock(): void;
|
|
149
|
-
/**
|
|
150
|
-
* If the active task is `BLOCKED` then execute the `action` for the task.
|
|
151
|
-
*
|
|
152
|
-
* It is useful for when we need to run a blocked task without changing the status of task at the first place.
|
|
153
|
-
* For scenarios like we have some conditions in `action` and needs to run the `action` again
|
|
154
|
-
* to check the conditions are met or not, if yes, so we can proceed the `action`.
|
|
155
|
-
*
|
|
156
|
-
*/
|
|
157
|
-
forceRun(params: NextParams): void;
|
|
158
|
-
private markCurrentTaskAsFinished;
|
|
159
|
-
/**
|
|
160
|
-
* If the active task is `RUNNING`, change it to `PENING` the try to run the task by calling `next`.
|
|
161
|
-
* If it's other than `RUNNING` we reset the queue state and run the queue from the beggining.
|
|
162
|
-
*
|
|
163
|
-
* @param params
|
|
164
|
-
* @returns
|
|
165
|
-
*/
|
|
166
|
-
resume(params: NextParams): void;
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* Cancel the queue by changing active task and queue status to `CANCELED`.
|
|
170
|
-
*
|
|
171
|
-
*/
|
|
172
|
-
cancel(): void;
|
|
173
|
-
/**
|
|
174
|
-
* Update queue status, and all the tasks inside queue to `PENDING`.
|
|
175
|
-
*/
|
|
176
|
-
private resetState;
|
|
177
|
-
getStorage():
|
|
178
|
-
setStorage(data: QueueStorage):
|
|
179
|
-
private getContext;
|
|
180
|
-
}
|
|
181
|
-
export default Queue;
|
|
1
|
+
import { ManagerContext, QueueDef, QueueID } from './manager';
|
|
2
|
+
import { QueueStorage, Status } from './types';
|
|
3
|
+
type TaskId = string;
|
|
4
|
+
export type TaskState = {
|
|
5
|
+
status: Status;
|
|
6
|
+
blockedFor: any;
|
|
7
|
+
};
|
|
8
|
+
export interface QueueContext {
|
|
9
|
+
_queue?: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export type NextParams = {
|
|
14
|
+
context: ManagerContext;
|
|
15
|
+
};
|
|
16
|
+
export interface QueueState {
|
|
17
|
+
status: Status;
|
|
18
|
+
activeTaskIndex: number;
|
|
19
|
+
tasks: {
|
|
20
|
+
[key in TaskId]: TaskState;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface Task {
|
|
24
|
+
id: TaskId;
|
|
25
|
+
action: string;
|
|
26
|
+
}
|
|
27
|
+
export type InitTasks = {
|
|
28
|
+
tasks: Task[];
|
|
29
|
+
state: QueueState;
|
|
30
|
+
storage: QueueStorage;
|
|
31
|
+
};
|
|
32
|
+
export interface TaskEvent {
|
|
33
|
+
id: TaskId;
|
|
34
|
+
task: TaskState;
|
|
35
|
+
action: string;
|
|
36
|
+
}
|
|
37
|
+
export interface QueueEventHandlers {
|
|
38
|
+
onUpdateListStatus: (status: Status) => void;
|
|
39
|
+
onCreate: (event: TaskEvent) => void;
|
|
40
|
+
onUpdate: (event: TaskEvent) => void;
|
|
41
|
+
onStorageUpdate: (data: QueueStorage) => void;
|
|
42
|
+
onBlock: (data: Omit<TaskEvent, 'task'> & {
|
|
43
|
+
reason: Record<string, unknown>;
|
|
44
|
+
}) => void;
|
|
45
|
+
onUnblock: (data: {
|
|
46
|
+
id: string;
|
|
47
|
+
}) => void;
|
|
48
|
+
}
|
|
49
|
+
interface QueueOptions {
|
|
50
|
+
id: QueueID;
|
|
51
|
+
events: QueueEventHandlers;
|
|
52
|
+
actions: QueueDef['actions'];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* Notes on statuses:
|
|
57
|
+
* - Success: last task has success status
|
|
58
|
+
* - Failed: any of task has been failed
|
|
59
|
+
* - Running: first task is not on pending
|
|
60
|
+
* - Pending: default state. not started
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
declare class Queue {
|
|
64
|
+
id: string;
|
|
65
|
+
state: QueueState;
|
|
66
|
+
tasks: Task[];
|
|
67
|
+
private events;
|
|
68
|
+
private actions;
|
|
69
|
+
private storage;
|
|
70
|
+
constructor(options: QueueOptions);
|
|
71
|
+
/**
|
|
72
|
+
* Update queue status and trigger an event
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
private updateQueueStatus;
|
|
76
|
+
private updateActiveTaskIndex;
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* Update task state (`status`, `blockedFor`) and trigger an event.
|
|
80
|
+
* @param id
|
|
81
|
+
* @param nextState
|
|
82
|
+
*/
|
|
83
|
+
private updateTaskState;
|
|
84
|
+
/**
|
|
85
|
+
* Create a task by providing an `action` name.
|
|
86
|
+
*
|
|
87
|
+
* this method creating the task, push it to the queue's tasks and trigger an event.
|
|
88
|
+
* @param action
|
|
89
|
+
*/
|
|
90
|
+
createTask(action: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Initilize a queue with some tasks, instead of an empty queue.
|
|
93
|
+
*
|
|
94
|
+
* Using it for recover the queue state from persistor.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
initTasks(info: InitTasks): void;
|
|
98
|
+
checkBlock(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Getting task state by ID
|
|
101
|
+
*/
|
|
102
|
+
get(id: string): TaskState | null;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* Checking if status of the last is `SUCCESS` or not
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
private lastTaskIsSuccessful;
|
|
109
|
+
/**
|
|
110
|
+
* If the first task started (it's not PENDING),
|
|
111
|
+
* it means the queue has been ran.
|
|
112
|
+
*
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
private firstTaskIsStarted;
|
|
116
|
+
/**
|
|
117
|
+
* Getting active task index from state and
|
|
118
|
+
* returns the task and its state.
|
|
119
|
+
*
|
|
120
|
+
*/
|
|
121
|
+
private getActiveTask;
|
|
122
|
+
/**
|
|
123
|
+
* Update and find the queue status by checking state of each tasks in the queue.
|
|
124
|
+
*/
|
|
125
|
+
check(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Execute active task.
|
|
128
|
+
* Based on the state of active task, the behaviour is different. If status is:
|
|
129
|
+
* - Success -> we need to go to next task by updating the active index and try `next` on more time.
|
|
130
|
+
* - Failed, Running, or no active task -> doesn't do anything.
|
|
131
|
+
* - Pending or Blocked -> update the task and queue status to running, and execute the provided `action` for the task.
|
|
132
|
+
*
|
|
133
|
+
* The queue is a linked list somehow, active task means the pointer to where we are in the queue right now.
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
next(params: NextParams): void;
|
|
137
|
+
/**
|
|
138
|
+
* Change the `status` of active task and queue to BLOCKED, then trigger an event.
|
|
139
|
+
*/
|
|
140
|
+
block({ reason, silent, }: {
|
|
141
|
+
reason: Record<string, unknown>;
|
|
142
|
+
silent?: boolean;
|
|
143
|
+
}): void;
|
|
144
|
+
/**
|
|
145
|
+
* If the active task is `BLOCKED`, update the task status to `PENDING`, queue status to `RUNNING`
|
|
146
|
+
* then trigger an event.
|
|
147
|
+
*/
|
|
148
|
+
unblock(): void;
|
|
149
|
+
/**
|
|
150
|
+
* If the active task is `BLOCKED` then execute the `action` for the task.
|
|
151
|
+
*
|
|
152
|
+
* It is useful for when we need to run a blocked task without changing the status of task at the first place.
|
|
153
|
+
* For scenarios like we have some conditions in `action` and needs to run the `action` again
|
|
154
|
+
* to check the conditions are met or not, if yes, so we can proceed the `action`.
|
|
155
|
+
*
|
|
156
|
+
*/
|
|
157
|
+
forceRun(params: NextParams): void;
|
|
158
|
+
private markCurrentTaskAsFinished;
|
|
159
|
+
/**
|
|
160
|
+
* If the active task is `RUNNING`, change it to `PENING` the try to run the task by calling `next`.
|
|
161
|
+
* If it's other than `RUNNING` we reset the queue state and run the queue from the beggining.
|
|
162
|
+
*
|
|
163
|
+
* @param params
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
resume(params: NextParams): void;
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* Cancel the queue by changing active task and queue status to `CANCELED`.
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
cancel(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Update queue status, and all the tasks inside queue to `PENDING`.
|
|
175
|
+
*/
|
|
176
|
+
private resetState;
|
|
177
|
+
getStorage(): QueueStorage;
|
|
178
|
+
setStorage(data: QueueStorage): QueueStorage;
|
|
179
|
+
private getContext;
|
|
180
|
+
}
|
|
181
|
+
export default Queue;
|
|
182
182
|
//# sourceMappingURL=queue.d.ts.map
|
package/dist/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["src/queue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE/C,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,UAAU;IAC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1
|
-
import { QueueID, QueueName } from './manager';
|
|
2
|
-
import Queue, { QueueState, Task } from './queue';
|
|
3
|
-
export declare enum Status {
|
|
4
|
-
PENDING = "PENDING",
|
|
5
|
-
RUNNING = "RUNNING",
|
|
6
|
-
FAILED = "FAILED",
|
|
7
|
-
SUCCESS = "SUCCESS",
|
|
8
|
-
CANCELED = "CANCELED",
|
|
9
|
-
BLOCKED = "BLOCKED"
|
|
10
|
-
}
|
|
11
|
-
export declare const SYNC_POLLING_INTERVAL = 5000;
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export interface PersistedQueue {
|
|
15
|
-
id: QueueID;
|
|
16
|
-
createdAt: number;
|
|
17
|
-
name: QueueName;
|
|
18
|
-
status: Status;
|
|
19
|
-
state: QueueState;
|
|
20
|
-
tasks: Task[];
|
|
21
|
-
storage: QueueStorage;
|
|
22
|
-
}
|
|
1
|
+
import { QueueID, QueueName } from './manager';
|
|
2
|
+
import Queue, { QueueState, Task } from './queue';
|
|
3
|
+
export declare enum Status {
|
|
4
|
+
PENDING = "PENDING",
|
|
5
|
+
RUNNING = "RUNNING",
|
|
6
|
+
FAILED = "FAILED",
|
|
7
|
+
SUCCESS = "SUCCESS",
|
|
8
|
+
CANCELED = "CANCELED",
|
|
9
|
+
BLOCKED = "BLOCKED"
|
|
10
|
+
}
|
|
11
|
+
export declare const SYNC_POLLING_INTERVAL = 5000;
|
|
12
|
+
export type QueueStorage = Record<string, unknown>;
|
|
13
|
+
export type QueueType = Queue;
|
|
14
|
+
export interface PersistedQueue {
|
|
15
|
+
id: QueueID;
|
|
16
|
+
createdAt: number;
|
|
17
|
+
name: QueueName;
|
|
18
|
+
status: Status;
|
|
19
|
+
state: QueueState;
|
|
20
|
+
tasks: Task[];
|
|
21
|
+
storage: QueueStorage;
|
|
22
|
+
}
|
|
23
23
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAElD,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,qBAAqB,OAAQ,CAAA;AAE1C,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAElD,oBAAY,MAAM;IAChB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,qBAAqB,OAAQ,CAAA;AAE1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC;AAE9B,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/queue-manager-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"module": "dist/queue-manager-core.esm.js",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"typings": "dist/index.d.ts",
|
|
8
5
|
"type": "module",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist",
|
|
11
10
|
"src"
|
|
12
11
|
],
|
|
13
12
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"build": "tsdx build --tsconfig ./tsconfig.json",
|
|
13
|
+
"build": "node ../../scripts/build/command.mjs --path queue-manager/core",
|
|
16
14
|
"analyze": "size-limit --why",
|
|
17
15
|
"clean": "rimraf dist",
|
|
18
16
|
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|