@webda/async 4.0.0-beta.1 → 4.0.0-beta.3
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 +89 -4
- package/lib/{models.d.ts → asyncaction.model.d.ts} +76 -42
- package/lib/asyncaction.model.d.ts.map +1 -0
- package/lib/asyncaction.model.js +269 -0
- package/lib/asyncaction.model.js.map +1 -0
- package/lib/index.d.ts +7 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/services/asyncevents.service.d.ts +154 -0
- package/lib/services/asyncevents.service.d.ts.map +1 -0
- package/lib/services/asyncevents.service.js +219 -0
- package/lib/services/asyncevents.service.js.map +1 -0
- package/lib/services/{asyncjobservice.d.ts → asyncjobservice.service.d.ts} +79 -74
- package/lib/services/asyncjobservice.service.d.ts.map +1 -0
- package/lib/services/asyncjobservice.service.js +584 -0
- package/lib/services/asyncjobservice.service.js.map +1 -0
- package/lib/services/{localrunner.d.ts → localrunner.service.d.ts} +24 -9
- package/lib/services/localrunner.service.d.ts.map +1 -0
- package/lib/services/localrunner.service.js +87 -0
- package/lib/services/localrunner.service.js.map +1 -0
- package/lib/services/{runner.d.ts → runner.service.d.ts} +17 -11
- package/lib/services/runner.service.d.ts.map +1 -0
- package/lib/services/{runner.js → runner.service.js} +16 -13
- package/lib/services/runner.service.js.map +1 -0
- package/lib/services/servicerunner.service.d.ts +105 -0
- package/lib/services/servicerunner.service.d.ts.map +1 -0
- package/lib/services/servicerunner.service.js +131 -0
- package/lib/services/servicerunner.service.js.map +1 -0
- package/package.json +33 -37
- package/webda.module.json +1895 -857
- package/lib/models.js +0 -177
- package/lib/models.js.map +0 -1
- package/lib/services/asyncjobservice.js +0 -505
- package/lib/services/asyncjobservice.js.map +0 -1
- package/lib/services/localrunner.js +0 -70
- package/lib/services/localrunner.js.map +0 -1
- package/lib/services/runner.js.map +0 -1
- package/lib/services/servicerunner.d.ts +0 -67
- package/lib/services/servicerunner.js +0 -97
- package/lib/services/servicerunner.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Queue, Service, ServiceParameters } from "@webda/core";
|
|
2
|
+
import type { ModelClass } from "@webda/core";
|
|
3
|
+
/**
|
|
4
|
+
* AsyncEvent representation
|
|
5
|
+
*/
|
|
6
|
+
export declare class AsyncEvent {
|
|
7
|
+
/**
|
|
8
|
+
* Service emitted the event
|
|
9
|
+
*/
|
|
10
|
+
service: string;
|
|
11
|
+
/**
|
|
12
|
+
* Type of event
|
|
13
|
+
*/
|
|
14
|
+
type: string;
|
|
15
|
+
/**
|
|
16
|
+
* Payload of the event
|
|
17
|
+
*/
|
|
18
|
+
payload: any;
|
|
19
|
+
/**
|
|
20
|
+
* Time
|
|
21
|
+
*/
|
|
22
|
+
time: Date;
|
|
23
|
+
/**
|
|
24
|
+
* Used when serializing a service
|
|
25
|
+
*/
|
|
26
|
+
static ServiceTag: string;
|
|
27
|
+
/**
|
|
28
|
+
* @param service - the emitter: a service, a model class or its serialized name
|
|
29
|
+
* @param type - the event type
|
|
30
|
+
* @param payload - the event payload
|
|
31
|
+
*/
|
|
32
|
+
constructor(service: string | Service | ModelClass, type: string, payload?: any);
|
|
33
|
+
/**
|
|
34
|
+
* Allow payload to contain Service but do not serialize them
|
|
35
|
+
* replacing them by a #Webda:Service:${service.getName()} so it
|
|
36
|
+
* can be revived
|
|
37
|
+
*
|
|
38
|
+
* @returns the serializable event
|
|
39
|
+
*/
|
|
40
|
+
toJSON(): this & {
|
|
41
|
+
payload: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Deserialize from the queue, reviving any detected service
|
|
45
|
+
*
|
|
46
|
+
* @param data - the serialized event
|
|
47
|
+
* @returns the event
|
|
48
|
+
*/
|
|
49
|
+
static fromQueue(data: any): AsyncEvent;
|
|
50
|
+
/**
|
|
51
|
+
* Mapper name
|
|
52
|
+
* @returns the mapper key
|
|
53
|
+
*/
|
|
54
|
+
getMapper(): string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Queues by name
|
|
58
|
+
*/
|
|
59
|
+
interface QueueMap {
|
|
60
|
+
[key: string]: Queue;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @inheritdoc
|
|
64
|
+
*/
|
|
65
|
+
export declare class EventServiceParameters extends ServiceParameters {
|
|
66
|
+
/**
|
|
67
|
+
* Queues to post async events to
|
|
68
|
+
*/
|
|
69
|
+
queues?: {
|
|
70
|
+
[key: string]: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Make the event sending asynchronous
|
|
74
|
+
*/
|
|
75
|
+
sync?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @override
|
|
78
|
+
* @param params - the input parameters
|
|
79
|
+
* @returns this
|
|
80
|
+
*/
|
|
81
|
+
load(params?: any): this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @category CoreServices
|
|
85
|
+
* @WebdaModda AsyncEvents
|
|
86
|
+
*/
|
|
87
|
+
declare class EventService<T extends EventServiceParameters = EventServiceParameters> extends Service<T> {
|
|
88
|
+
_callbacks: any;
|
|
89
|
+
_queues: QueueMap;
|
|
90
|
+
_defaultQueue: string;
|
|
91
|
+
_async: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the queues
|
|
94
|
+
* @returns this
|
|
95
|
+
*/
|
|
96
|
+
resolve(): this;
|
|
97
|
+
/**
|
|
98
|
+
* Bind a asynchronous event
|
|
99
|
+
*
|
|
100
|
+
* ```mermaid
|
|
101
|
+
* sequenceDiagram
|
|
102
|
+
* participant S as Service
|
|
103
|
+
* participant As as AsyncEventService
|
|
104
|
+
* participant Q as Queue
|
|
105
|
+
* participant Aw as AsyncEventService Worker
|
|
106
|
+
*
|
|
107
|
+
* As->>S: Bind event to a sendQueue listener
|
|
108
|
+
* activate As
|
|
109
|
+
* S->>As: Emit event
|
|
110
|
+
* As->>Q: Push the event to the queue
|
|
111
|
+
* deactivate As
|
|
112
|
+
* Aw->>Q: Consume queue
|
|
113
|
+
* Aw->>Aw: Call the original listener
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param service - the service or model class emitting the event
|
|
117
|
+
* @param event - the event name
|
|
118
|
+
* @param callback - the listener
|
|
119
|
+
* @param queue - the queue to use, default queue if not specified
|
|
120
|
+
*/
|
|
121
|
+
bindAsyncListener(service: Service | ModelClass, event: string, callback: any, queue?: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Synchronous Listener to proxy to async
|
|
124
|
+
*
|
|
125
|
+
* @param service - the emitter
|
|
126
|
+
* @param type - the event type
|
|
127
|
+
* @param queue - the queue to use
|
|
128
|
+
* @param payload - the event payload
|
|
129
|
+
* @returns the send or handle promise
|
|
130
|
+
*/
|
|
131
|
+
pushEvent(service: Service | ModelClass, type: string, queue: string, payload: any): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Process one event
|
|
134
|
+
*
|
|
135
|
+
* @param event - the event
|
|
136
|
+
* @returns a promise resolved once all listeners are done
|
|
137
|
+
*/
|
|
138
|
+
protected handleEvent(event: AsyncEvent): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Process a serialized event
|
|
141
|
+
* @param event serialized event
|
|
142
|
+
* @returns the handle promise
|
|
143
|
+
*/
|
|
144
|
+
protected handleRawEvent(event: AsyncEvent): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Process asynchronous event on queue
|
|
147
|
+
* @param queue - the queue to consume
|
|
148
|
+
* @returns the consumer promise
|
|
149
|
+
*/
|
|
150
|
+
worker(queue?: string): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
export { EventService };
|
|
153
|
+
export type { QueueMap };
|
|
154
|
+
//# sourceMappingURL=asyncevents.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncevents.service.d.ts","sourceRoot":"","sources":["../../src/services/asyncevents.service.ts"],"names":[],"mappings":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OAGG;IACH,OAAO,IAAI,IAAI,CAiBd;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,KAAA,EAAE,KAAK,CAAC,EAAE,MAAM,QAiBvF;IAED;;;;;;;;OAQG;IACG,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAOvF;IAED;;;;;OAKG;IACH,UAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5D;IAED;;;;OAIG;IACH,UAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,iBAE/C;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,GAAE,MAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAIxD;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Service, ServiceParameters, useDynamicService, useRepository } from "@webda/core";
|
|
2
|
+
/**
|
|
3
|
+
* AsyncEvent representation
|
|
4
|
+
*/
|
|
5
|
+
export class AsyncEvent {
|
|
6
|
+
/**
|
|
7
|
+
* @param service - the emitter: a service, a model class or its serialized name
|
|
8
|
+
* @param type - the event type
|
|
9
|
+
* @param payload - the event payload
|
|
10
|
+
*/
|
|
11
|
+
constructor(service, type, payload = {}) {
|
|
12
|
+
if (service instanceof Service) {
|
|
13
|
+
this.service = `service:${service.getName()}`;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof service === "string") {
|
|
16
|
+
this.service = service;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.service = `model:${service.name}`;
|
|
20
|
+
}
|
|
21
|
+
this.type = type;
|
|
22
|
+
this.payload = payload;
|
|
23
|
+
this.time = new Date();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Allow payload to contain Service but do not serialize them
|
|
27
|
+
* replacing them by a #Webda:Service:${service.getName()} so it
|
|
28
|
+
* can be revived
|
|
29
|
+
*
|
|
30
|
+
* @returns the serializable event
|
|
31
|
+
*/
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
...this,
|
|
35
|
+
payload: JSON.stringify(this.payload, function serviceReplacer(key, value) {
|
|
36
|
+
// Service.toJSON is applied before the replacer, check the raw value
|
|
37
|
+
const raw = key === "" ? value : this[key];
|
|
38
|
+
if (raw instanceof Service) {
|
|
39
|
+
return `${AsyncEvent.ServiceTag}${raw.getName()}`;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Deserialize from the queue, reviving any detected service
|
|
47
|
+
*
|
|
48
|
+
* @param data - the serialized event
|
|
49
|
+
* @returns the event
|
|
50
|
+
*/
|
|
51
|
+
static fromQueue(data) {
|
|
52
|
+
const evt = new AsyncEvent(data.service, data.type, JSON.parse(data.payload, (_key, value) => {
|
|
53
|
+
if (typeof value === "string" && value.startsWith(AsyncEvent.ServiceTag)) {
|
|
54
|
+
return useDynamicService(value.substring(AsyncEvent.ServiceTag.length));
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}));
|
|
58
|
+
evt.time = data.time;
|
|
59
|
+
return evt;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Mapper name
|
|
63
|
+
* @returns the mapper key
|
|
64
|
+
*/
|
|
65
|
+
getMapper() {
|
|
66
|
+
return this.service + "_" + this.type;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Used when serializing a service
|
|
71
|
+
*/
|
|
72
|
+
AsyncEvent.ServiceTag = "#Webda:Service:";
|
|
73
|
+
/**
|
|
74
|
+
* @inheritdoc
|
|
75
|
+
*/
|
|
76
|
+
export class EventServiceParameters extends ServiceParameters {
|
|
77
|
+
/**
|
|
78
|
+
* @override
|
|
79
|
+
* @param params - the input parameters
|
|
80
|
+
* @returns this
|
|
81
|
+
*/
|
|
82
|
+
load(params = {}) {
|
|
83
|
+
super.load(params);
|
|
84
|
+
this.queues ?? (this.queues = {});
|
|
85
|
+
this.sync ?? (this.sync = false);
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @category CoreServices
|
|
91
|
+
* @WebdaModda AsyncEvents
|
|
92
|
+
*/
|
|
93
|
+
class EventService extends Service {
|
|
94
|
+
constructor() {
|
|
95
|
+
super(...arguments);
|
|
96
|
+
this._callbacks = {};
|
|
97
|
+
this._queues = {};
|
|
98
|
+
this._defaultQueue = "";
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolve the queues
|
|
102
|
+
* @returns this
|
|
103
|
+
*/
|
|
104
|
+
resolve() {
|
|
105
|
+
super.resolve();
|
|
106
|
+
Object.keys(this.parameters.queues).forEach(key => {
|
|
107
|
+
// Define default as first queue
|
|
108
|
+
if (!this._defaultQueue) {
|
|
109
|
+
this._defaultQueue = key;
|
|
110
|
+
}
|
|
111
|
+
this._queues[key] = useDynamicService(this.parameters.queues[key]);
|
|
112
|
+
});
|
|
113
|
+
this._async = !this.parameters.sync;
|
|
114
|
+
// Check we have at least one queue to handle asynchronous
|
|
115
|
+
if (this._async && Object.keys(this._queues).length < 1) {
|
|
116
|
+
this.log("ERROR", "Need at least one queue for async to be ready", this.parameters);
|
|
117
|
+
throw Error("Need at least one queue for async to be ready");
|
|
118
|
+
}
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Bind a asynchronous event
|
|
123
|
+
*
|
|
124
|
+
* ```mermaid
|
|
125
|
+
* sequenceDiagram
|
|
126
|
+
* participant S as Service
|
|
127
|
+
* participant As as AsyncEventService
|
|
128
|
+
* participant Q as Queue
|
|
129
|
+
* participant Aw as AsyncEventService Worker
|
|
130
|
+
*
|
|
131
|
+
* As->>S: Bind event to a sendQueue listener
|
|
132
|
+
* activate As
|
|
133
|
+
* S->>As: Emit event
|
|
134
|
+
* As->>Q: Push the event to the queue
|
|
135
|
+
* deactivate As
|
|
136
|
+
* Aw->>Q: Consume queue
|
|
137
|
+
* Aw->>Aw: Call the original listener
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @param service - the service or model class emitting the event
|
|
141
|
+
* @param event - the event name
|
|
142
|
+
* @param callback - the listener
|
|
143
|
+
* @param queue - the queue to use, default queue if not specified
|
|
144
|
+
*/
|
|
145
|
+
bindAsyncListener(service, event, callback, queue) {
|
|
146
|
+
if (!this._async) {
|
|
147
|
+
throw Error("EventService is not configured for asynchronous");
|
|
148
|
+
}
|
|
149
|
+
if (!queue) {
|
|
150
|
+
queue = this._defaultQueue;
|
|
151
|
+
}
|
|
152
|
+
const mapper = new AsyncEvent(service, event).getMapper();
|
|
153
|
+
if (!this._callbacks[mapper]) {
|
|
154
|
+
if (service instanceof Service) {
|
|
155
|
+
service.on(event, data => this.pushEvent(service, event, queue, data));
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
useRepository(service).on(event, data => this.pushEvent(service, event, queue, data));
|
|
159
|
+
}
|
|
160
|
+
this._callbacks[mapper] = [];
|
|
161
|
+
}
|
|
162
|
+
this._callbacks[mapper].push(callback);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Synchronous Listener to proxy to async
|
|
166
|
+
*
|
|
167
|
+
* @param service - the emitter
|
|
168
|
+
* @param type - the event type
|
|
169
|
+
* @param queue - the queue to use
|
|
170
|
+
* @param payload - the event payload
|
|
171
|
+
* @returns the send or handle promise
|
|
172
|
+
*/
|
|
173
|
+
async pushEvent(service, type, queue, payload) {
|
|
174
|
+
const event = new AsyncEvent(service, type, payload);
|
|
175
|
+
if (this._async) {
|
|
176
|
+
return this._queues[queue].sendMessage(event);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
return this.handleEvent(event);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Process one event
|
|
184
|
+
*
|
|
185
|
+
* @param event - the event
|
|
186
|
+
* @returns a promise resolved once all listeners are done
|
|
187
|
+
*/
|
|
188
|
+
async handleEvent(event) {
|
|
189
|
+
if (!this._callbacks[event.getMapper()]) {
|
|
190
|
+
return Promise.reject("Callbacks should not be empty, possible application version mismatch between emitter and worker");
|
|
191
|
+
}
|
|
192
|
+
const promises = [];
|
|
193
|
+
this._callbacks[event.getMapper()].map(executor => {
|
|
194
|
+
promises.push(executor(event.payload, event));
|
|
195
|
+
});
|
|
196
|
+
// Need to handle the failure
|
|
197
|
+
await Promise.all(promises);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Process a serialized event
|
|
201
|
+
* @param event serialized event
|
|
202
|
+
* @returns the handle promise
|
|
203
|
+
*/
|
|
204
|
+
async handleRawEvent(event) {
|
|
205
|
+
return this.handleEvent(AsyncEvent.fromQueue(event));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Process asynchronous event on queue
|
|
209
|
+
* @param queue - the queue to consume
|
|
210
|
+
* @returns the consumer promise
|
|
211
|
+
*/
|
|
212
|
+
worker(queue = this._defaultQueue) {
|
|
213
|
+
// Avoid loops
|
|
214
|
+
this._async = false;
|
|
215
|
+
return this._queues[queue].consume(this.handleRawEvent.bind(this));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export { EventService };
|
|
219
|
+
//# sourceMappingURL=asyncevents.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncevents.service.js","sourceRoot":"","sources":["../../src/services/asyncevents.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,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AC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QACH,6BAA6B;QAC7B,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAC,KAAiB;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,GAAW,IAAI,CAAC,aAAa;QACvC,cAAc;QACd,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CronDefinition, OperationContext, Queue, RequestFilter, Service, ServiceParameters, WebContext } from "@webda/core";
|
|
2
|
+
import type { ModelClass } from "@webda/core";
|
|
2
3
|
import * as WebdaQL from "@webda/ql";
|
|
4
|
+
import { CancelableLoopPromise, CancelablePromise } from "@webda/utils";
|
|
3
5
|
import { WorkerLogLevel } from "@webda/workout";
|
|
4
6
|
import { JSONSchema7 } from "json-schema";
|
|
5
|
-
import { AsyncAction, AsyncActionQueueItem, AsyncOperationAction, AsyncWebdaAction } from "../
|
|
6
|
-
import { Runner } from "./runner.js";
|
|
7
|
+
import { AsyncAction, AsyncActionQueueItem, AsyncOperationAction, AsyncWebdaAction } from "../asyncaction.model.js";
|
|
8
|
+
import { Runner } from "./runner.service.js";
|
|
7
9
|
/**
|
|
8
10
|
* Represent a Job information as you will find in env
|
|
9
11
|
*/
|
|
@@ -17,14 +19,6 @@ export interface JobInfo {
|
|
|
17
19
|
* @inheritdoc
|
|
18
20
|
*/
|
|
19
21
|
export declare class AsyncJobServiceParameters extends ServiceParameters {
|
|
20
|
-
/**
|
|
21
|
-
* If we want to expose a way to upload/download binary for the job
|
|
22
|
-
*
|
|
23
|
-
* It will expose a /download and /upload additional url
|
|
24
|
-
*
|
|
25
|
-
* @deprecated will be removed in 4.0 to only use object AsyncAction
|
|
26
|
-
*/
|
|
27
|
-
binaryStore?: string;
|
|
28
22
|
/**
|
|
29
23
|
* If set runner will be called without queue
|
|
30
24
|
*
|
|
@@ -39,8 +33,7 @@ export declare class AsyncJobServiceParameters extends ServiceParameters {
|
|
|
39
33
|
/**
|
|
40
34
|
* URL to expose job status report hook
|
|
41
35
|
*
|
|
42
|
-
* @default /async
|
|
43
|
-
* @deprecated will be removed in 4.0 to only use object AsyncAction
|
|
36
|
+
* @default /async
|
|
44
37
|
*/
|
|
45
38
|
url: string;
|
|
46
39
|
/**
|
|
@@ -107,22 +100,23 @@ export declare class AsyncJobServiceParameters extends ServiceParameters {
|
|
|
107
100
|
* Generated with `webda operations operations.json`
|
|
108
101
|
*/
|
|
109
102
|
asyncOperationDefinition?: string;
|
|
110
|
-
|
|
103
|
+
/**
|
|
104
|
+
* @override
|
|
105
|
+
* @param params - the input parameters
|
|
106
|
+
* @returns this
|
|
107
|
+
*/
|
|
108
|
+
load(params?: any): this;
|
|
111
109
|
}
|
|
112
110
|
/**
|
|
113
111
|
* AsyncService allows you to launch jobs and report status
|
|
114
112
|
*
|
|
115
113
|
* @WebdaModda
|
|
116
114
|
*/
|
|
117
|
-
export default class AsyncJobService<T extends AsyncJobServiceParameters = AsyncJobServiceParameters> extends Service<T> implements RequestFilter {
|
|
115
|
+
export default class AsyncJobService<T extends AsyncJobServiceParameters = AsyncJobServiceParameters> extends Service<T> implements RequestFilter<WebContext> {
|
|
118
116
|
/**
|
|
119
117
|
* Queue for execution
|
|
120
118
|
*/
|
|
121
119
|
protected queue: Queue<AsyncActionQueueItem>;
|
|
122
|
-
/**
|
|
123
|
-
* Store for async actions
|
|
124
|
-
*/
|
|
125
|
-
protected store: Store<AsyncAction>;
|
|
126
120
|
/**
|
|
127
121
|
* Runner to use
|
|
128
122
|
*/
|
|
@@ -131,18 +125,14 @@ export default class AsyncJobService<T extends AsyncJobServiceParameters = Async
|
|
|
131
125
|
* HMAC Algorithm used for simple auth
|
|
132
126
|
*/
|
|
133
127
|
static HMAC_ALGO: string;
|
|
134
|
-
/**
|
|
135
|
-
* If we want job to be able to upload/download
|
|
136
|
-
*/
|
|
137
|
-
protected binaryStore: CloudBinary;
|
|
138
128
|
/**
|
|
139
129
|
* Model to use when launching action
|
|
140
130
|
*/
|
|
141
|
-
model:
|
|
131
|
+
model: (new (serviceName?: string, method?: string, ...args: any[]) => AsyncWebdaAction) & ModelClass<AsyncWebdaAction>;
|
|
142
132
|
/**
|
|
143
|
-
* Model to use when launching
|
|
133
|
+
* Model to use when launching operation
|
|
144
134
|
*/
|
|
145
|
-
operationModel:
|
|
135
|
+
operationModel: new (operationId: string, context: OperationContext, logLevel?: WorkerLogLevel) => AsyncOperationAction;
|
|
146
136
|
/**
|
|
147
137
|
* Operations definition
|
|
148
138
|
*/
|
|
@@ -171,133 +161,148 @@ export default class AsyncJobService<T extends AsyncJobServiceParameters = Async
|
|
|
171
161
|
};
|
|
172
162
|
/**
|
|
173
163
|
* @inheritdoc
|
|
174
|
-
|
|
175
|
-
loadParameters(params: any): ServiceParameters;
|
|
176
|
-
/**
|
|
177
|
-
* @inheritdoc
|
|
164
|
+
* @returns this
|
|
178
165
|
*/
|
|
179
166
|
resolve(): this;
|
|
180
167
|
/**
|
|
181
168
|
* Register new operations
|
|
182
|
-
* @param operations
|
|
169
|
+
* @param operations - the operations definition
|
|
183
170
|
*/
|
|
184
171
|
registerOperations(operations: typeof this.operations): void;
|
|
185
172
|
/**
|
|
186
173
|
* Allow job status report url
|
|
174
|
+
* @param context - the web context
|
|
175
|
+
* @returns true if the request is a job status report
|
|
187
176
|
*/
|
|
188
177
|
checkRequest(context: WebContext): Promise<boolean>;
|
|
189
178
|
/**
|
|
190
179
|
* Status hook for job report
|
|
191
180
|
*
|
|
192
181
|
* Only updates specific fields: status, errorMessage, statusDetails, results, logs (appending)
|
|
182
|
+
* @param context - the web context
|
|
193
183
|
*/
|
|
194
184
|
protected statusHook(context: WebContext): Promise<void>;
|
|
195
185
|
/**
|
|
196
186
|
* Worker
|
|
197
187
|
*
|
|
198
188
|
* This will launch actions based on defined runners
|
|
189
|
+
* @returns a cancelable promise
|
|
199
190
|
*/
|
|
200
191
|
worker(): CancelablePromise<void>;
|
|
201
192
|
/**
|
|
202
193
|
* Handle one event from the queue and launch the job
|
|
203
|
-
* @param event
|
|
194
|
+
* @param event - the queue item
|
|
195
|
+
* @returns the job promise if any
|
|
204
196
|
*/
|
|
205
197
|
protected handleEvent(event: AsyncActionQueueItem): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Absolute url of the status hook remote runners POST their reports to
|
|
200
|
+
*
|
|
201
|
+
* It is this service status route: its request filter lets the job headers through
|
|
202
|
+
* and the HMAC is then verified by the action
|
|
203
|
+
* @returns the hook url
|
|
204
|
+
*/
|
|
205
|
+
getHookUrl(): string;
|
|
206
206
|
/**
|
|
207
207
|
* Get the job info
|
|
208
|
-
* @param action
|
|
209
|
-
* @returns
|
|
208
|
+
* @param action - the action
|
|
209
|
+
* @returns the job information
|
|
210
210
|
*/
|
|
211
211
|
getJobInfo(action: AsyncAction): JobInfo;
|
|
212
212
|
/**
|
|
213
213
|
* List available operations through this service
|
|
214
|
-
* @param context
|
|
214
|
+
* @param context - the web context
|
|
215
215
|
*/
|
|
216
216
|
listOperations(context: WebContext<void, {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
version: string;
|
|
220
|
-
};
|
|
221
|
-
operations: {
|
|
222
|
-
[key: string]: {
|
|
223
|
-
id: string;
|
|
224
|
-
input?: string;
|
|
225
|
-
output?: string;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
schemas: {
|
|
229
|
-
[key: string]: JSONSchema7;
|
|
230
|
-
};
|
|
231
|
-
} | string[]>): Promise<void>;
|
|
217
|
+
full?: boolean;
|
|
218
|
+
}>): Promise<void>;
|
|
232
219
|
/**
|
|
233
220
|
* Call an operation for an external system
|
|
234
|
-
* @param context
|
|
235
|
-
* @returns
|
|
221
|
+
* @param context - the operation context
|
|
222
|
+
* @returns the launched action
|
|
236
223
|
*/
|
|
237
|
-
callOperation(context: OperationContext): Promise<
|
|
224
|
+
callOperation(context: OperationContext): Promise<AsyncOperationAction>;
|
|
225
|
+
/**
|
|
226
|
+
* Check the operation exists, is allowed and its input is valid
|
|
227
|
+
* @param context - the operation context
|
|
228
|
+
* @param operationId - the operation id
|
|
229
|
+
*/
|
|
230
|
+
checkOperation(context: OperationContext, operationId: string): Promise<void>;
|
|
238
231
|
/**
|
|
239
232
|
* Launch an operation through this service
|
|
233
|
+
* @param context - the web context
|
|
240
234
|
*/
|
|
241
235
|
launchOperation(context: WebContext): Promise<void>;
|
|
242
236
|
/**
|
|
243
237
|
* Launch the action asynchronously
|
|
244
|
-
* @param action
|
|
245
|
-
* @returns
|
|
238
|
+
* @param action - the action
|
|
239
|
+
* @returns the action
|
|
246
240
|
*/
|
|
247
|
-
launchAction(action:
|
|
241
|
+
launchAction<A extends AsyncAction>(action: A): Promise<A>;
|
|
248
242
|
/**
|
|
249
243
|
* Schedule action for later execution
|
|
250
244
|
*
|
|
251
|
-
* @param action
|
|
252
|
-
* @param timestamp
|
|
245
|
+
* @param action - the action
|
|
246
|
+
* @param timestamp - when to launch it
|
|
247
|
+
* @returns the action
|
|
253
248
|
*/
|
|
254
|
-
scheduleAction(action:
|
|
249
|
+
scheduleAction<A extends AsyncAction>(action: A, timestamp: number): Promise<A>;
|
|
255
250
|
/**
|
|
256
251
|
* Return headers to request status hook
|
|
257
252
|
*
|
|
258
|
-
* @param jobInfo
|
|
259
|
-
* @returns
|
|
253
|
+
* @param jobInfo - the job information
|
|
254
|
+
* @returns the headers
|
|
260
255
|
*/
|
|
261
256
|
getHeaders(jobInfo: JobInfo): {
|
|
262
257
|
[key: string]: string;
|
|
263
258
|
};
|
|
264
259
|
/**
|
|
265
260
|
* Post hook to a remote url or use local store to update status
|
|
266
|
-
* @param jobInfo
|
|
267
|
-
* @param message
|
|
268
|
-
* @returns
|
|
261
|
+
* @param jobInfo - the job information
|
|
262
|
+
* @param message - the status report
|
|
263
|
+
* @returns the updated action
|
|
269
264
|
*/
|
|
270
265
|
postHook(jobInfo: JobInfo, message: any): Promise<AsyncWebdaAction>;
|
|
271
266
|
/**
|
|
272
267
|
* Launch a service.method as an AsyncAction
|
|
273
|
-
* @param serviceName
|
|
274
|
-
* @param method
|
|
275
|
-
* @param args
|
|
268
|
+
* @param serviceName - the service
|
|
269
|
+
* @param method - the method
|
|
270
|
+
* @param args - the arguments
|
|
271
|
+
* @returns the action
|
|
276
272
|
*/
|
|
277
|
-
launchAsAsyncAction(serviceName: string, method: string, ...args: any[]): Promise<
|
|
273
|
+
launchAsAsyncAction(serviceName: string, method: string, ...args: any[]): Promise<AsyncWebdaAction>;
|
|
278
274
|
/**
|
|
279
275
|
* Execute a service.method as an AsyncAction
|
|
280
276
|
*
|
|
281
277
|
* Useful for crontab execution
|
|
282
|
-
* @param serviceName
|
|
283
|
-
* @param method
|
|
284
|
-
* @param args
|
|
278
|
+
* @param serviceName - the service
|
|
279
|
+
* @param method - the method
|
|
280
|
+
* @param args - the arguments
|
|
281
|
+
* @returns the execution promise
|
|
285
282
|
*/
|
|
286
283
|
executeAsAsyncAction(serviceName: string, method: string, ...args: any[]): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* Run the AsyncAction described by the JOB_* environment variables
|
|
286
|
+
* @returns the execution promise
|
|
287
|
+
*/
|
|
288
|
+
runAction(): Promise<void>;
|
|
287
289
|
/**
|
|
288
290
|
* Wrap async job and call the job status hook
|
|
291
|
+
* @param jobInfo - the job information, from environment if not provided
|
|
292
|
+
* @returns a promise resolved once the job is reported
|
|
289
293
|
*/
|
|
290
294
|
runAsyncOperationAction(jobInfo?: JobInfo): Promise<void>;
|
|
291
295
|
/**
|
|
292
296
|
* Get the cron callback function
|
|
293
|
-
* @param cron
|
|
294
|
-
* @returns
|
|
297
|
+
* @param cron - the cron definition
|
|
298
|
+
* @returns the cron callback
|
|
295
299
|
*/
|
|
296
300
|
getCronExecutor(cron: CronDefinition): () => Promise<void>;
|
|
297
301
|
/**
|
|
298
302
|
* Manage scheduled actions and crontab actions
|
|
299
|
-
* @returns
|
|
303
|
+
* @returns a cancelable loop promise
|
|
300
304
|
*/
|
|
301
305
|
scheduler(): CancelableLoopPromise;
|
|
302
306
|
}
|
|
303
307
|
export { AsyncJobService };
|
|
308
|
+
//# sourceMappingURL=asyncjobservice.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncjobservice.service.d.ts","sourceRoot":"","sources":["../../src/services/asyncjobservice.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAGd,gBAAgB,EAChB,KAAK,EAGL,aAAa,EACb,OAAO,EACP,iBAAiB,EASjB,UAAU,EAEX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAwC,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACpH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAA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