epicenter-libs 3.34.1 → 3.35.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 +50 -0
- package/README.md +61 -86
- package/dist/browser/epicenter.js +1586 -230
- package/dist/browser/epicenter.js.map +1 -1
- package/dist/cjs/epicenter.js +1508 -145
- package/dist/cjs/epicenter.js.map +1 -1
- package/dist/cjs/package.json +1 -0
- package/dist/epicenter.js +1592 -229
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/epicenter.js +1502 -146
- package/dist/module/epicenter.js.map +1 -1
- package/dist/types/adapters/docket.d.ts +80 -0
- package/dist/types/adapters/encyclopedia.d.ts +86 -0
- package/dist/types/adapters/file.d.ts +201 -0
- package/dist/types/adapters/git.d.ts +171 -0
- package/dist/types/adapters/index.d.ts +8 -1
- package/dist/types/adapters/pipeline.d.ts +88 -0
- package/dist/types/adapters/powerpoint.d.ts +130 -0
- package/dist/types/adapters/registration.d.ts +270 -0
- package/dist/types/adapters/task.d.ts +99 -37
- package/dist/types/epicenter.d.ts +2 -2
- package/dist/types/types.d.ts +6 -1
- package/dist/types/utils/router.d.ts +1 -0
- package/package.json +12 -7
- package/src/adapters/docket.ts +109 -0
- package/src/adapters/encyclopedia.ts +128 -0
- package/src/adapters/file.ts +332 -0
- package/src/adapters/git.ts +278 -0
- package/src/adapters/index.ts +14 -0
- package/src/adapters/pipeline.ts +145 -0
- package/src/adapters/powerpoint.ts +238 -0
- package/src/adapters/registration.ts +413 -0
- package/src/adapters/task.ts +170 -47
- package/src/epicenter.ts +10 -3
- package/src/globals.d.ts +6 -0
- package/src/types.ts +61 -0
- package/src/utils/config.ts +5 -4
- package/src/utils/router.ts +1 -0
package/src/adapters/task.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Address, GenericScope, GenericSearchOptions } from '../utils/constants';
|
|
2
|
+
import type { Page, RoutingOptions } from '../utils/router';
|
|
3
3
|
|
|
4
|
+
import { parseFilterInput } from '../utils/filter-parser';
|
|
4
5
|
import Router from '../utils/router';
|
|
5
6
|
|
|
6
7
|
export enum RETRY_POLICY {
|
|
7
8
|
DO_NOTHING = 'DO_NOTHING', // If the task fails, do nothing (this is the default)
|
|
8
|
-
|
|
9
|
-
FIRE_ON_FAIL_SAFE = 'FIRE_ON_FAIL_SAFE', // Will re-execute the task after it fails; how long until this occurs is equal to ttlSeconds
|
|
9
|
+
FIRE_ON_FAIL_SAFE = 'FIRE_ON_FAIL_SAFE', // Retry within the task's fail-safe execution window
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// Generic type aliases for task adapter
|
|
13
13
|
export type TaskPayloadBody = Record<string, unknown>;
|
|
14
14
|
export type TaskPayloadHeaders = Record<string, string>;
|
|
15
|
+
export type TaskHttpMethod =
|
|
16
|
+
| 'GET'
|
|
17
|
+
| 'POST'
|
|
18
|
+
| 'PUT'
|
|
19
|
+
| 'DELETE';
|
|
20
|
+
export type TaskRetryPolicyReadOutView = 'do_nothing' | 'fire_on_fail_safe';
|
|
21
|
+
export type TaskStatusReadOutView =
|
|
22
|
+
| 'initialized'
|
|
23
|
+
| 'triggered'
|
|
24
|
+
| 'succeeded'
|
|
25
|
+
| 'failed'
|
|
26
|
+
| 'cancelled'
|
|
27
|
+
| 'terminated';
|
|
28
|
+
export type TaskAddressReadOutView = Partial<Address>;
|
|
29
|
+
|
|
30
|
+
export interface TaskScopeReadOutView extends GenericScope {
|
|
31
|
+
userKey?: string;
|
|
32
|
+
}
|
|
15
33
|
|
|
16
34
|
// Status type for group status tasks
|
|
17
35
|
export interface StatusReadOutView {
|
|
@@ -53,10 +71,12 @@ export interface HttpTaskPayloadCreateInView<
|
|
|
53
71
|
H extends object = TaskPayloadHeaders,
|
|
54
72
|
> {
|
|
55
73
|
objectType: 'http';
|
|
56
|
-
method:
|
|
74
|
+
method: TaskHttpMethod;
|
|
57
75
|
url: string;
|
|
76
|
+
target?: 'APPLICATION' | 'PROXY';
|
|
58
77
|
body: B;
|
|
59
78
|
headers?: H;
|
|
79
|
+
timeoutSeconds?: number;
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
export interface GroupStatusTaskPayloadCreateInView {
|
|
@@ -72,16 +92,30 @@ export type TaskPayloadCreateInView<
|
|
|
72
92
|
| HttpTaskPayloadCreateInView<B, H>
|
|
73
93
|
| GroupStatusTaskPayloadCreateInView;
|
|
74
94
|
|
|
95
|
+
export type HttpTaskPayloadCreateInput<
|
|
96
|
+
B extends object = TaskPayloadBody,
|
|
97
|
+
H extends object = TaskPayloadHeaders,
|
|
98
|
+
> = Omit<HttpTaskPayloadCreateInView<B, H>, 'objectType'> & {
|
|
99
|
+
objectType?: 'http';
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type TaskPayloadCreateInput<
|
|
103
|
+
B extends object = TaskPayloadBody,
|
|
104
|
+
H extends object = TaskPayloadHeaders,
|
|
105
|
+
> = HttpTaskPayloadCreateInput<B, H> | GroupStatusTaskPayloadCreateInView;
|
|
106
|
+
|
|
75
107
|
// Payload type definitions for reading tasks
|
|
76
108
|
export interface HttpTaskPayloadReadOutView<
|
|
77
109
|
B extends object = TaskPayloadBody,
|
|
78
110
|
H extends object = TaskPayloadHeaders,
|
|
79
111
|
> {
|
|
80
112
|
objectType: 'http';
|
|
81
|
-
method?:
|
|
113
|
+
method?: TaskHttpMethod;
|
|
82
114
|
url?: string;
|
|
115
|
+
target?: 'application' | 'proxy';
|
|
83
116
|
body?: B;
|
|
84
117
|
headers?: H;
|
|
118
|
+
timeoutSeconds?: number;
|
|
85
119
|
}
|
|
86
120
|
|
|
87
121
|
export interface GroupStatusTaskPayloadReadOutView {
|
|
@@ -104,22 +138,38 @@ export interface TaskReadOutView<
|
|
|
104
138
|
> {
|
|
105
139
|
taskKey?: string;
|
|
106
140
|
name?: string;
|
|
107
|
-
status?:
|
|
141
|
+
status?: TaskStatusReadOutView;
|
|
108
142
|
cron?: string;
|
|
109
143
|
mutationKey?: string;
|
|
110
144
|
failures?: number;
|
|
111
145
|
successes?: number;
|
|
112
|
-
address?:
|
|
146
|
+
address?: TaskAddressReadOutView;
|
|
113
147
|
payload?: TaskPayloadReadOutView<B, H>;
|
|
114
|
-
scope?:
|
|
115
|
-
retryPolicy?:
|
|
148
|
+
scope?: TaskScopeReadOutView;
|
|
149
|
+
retryPolicy?: TaskRetryPolicyReadOutView;
|
|
116
150
|
failSafeTermination?: string;
|
|
117
151
|
ttlSeconds?: number;
|
|
118
152
|
}
|
|
119
153
|
|
|
154
|
+
export interface TaskHistoryReadOutView {
|
|
155
|
+
result?: string;
|
|
156
|
+
execution?: number;
|
|
157
|
+
response?: number;
|
|
158
|
+
success?: boolean;
|
|
159
|
+
taskId?: number;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface TaskPageOptions {
|
|
163
|
+
first?: number;
|
|
164
|
+
max?: number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface TaskScopePageOptions extends TaskPageOptions {
|
|
168
|
+
sort?: string[];
|
|
169
|
+
}
|
|
120
170
|
|
|
121
171
|
/**
|
|
122
|
-
* Creates a task; requires
|
|
172
|
+
* Creates a task; requires facilitator (or higher) privileges
|
|
123
173
|
* Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task`
|
|
124
174
|
*
|
|
125
175
|
* @example
|
|
@@ -131,7 +181,9 @@ export interface TaskReadOutView<
|
|
|
131
181
|
* const name = 'task-1-send-emails';
|
|
132
182
|
* const payload = {
|
|
133
183
|
* method: 'POST',
|
|
134
|
-
* url: '
|
|
184
|
+
* url: '/send-out-emails',
|
|
185
|
+
* target: 'PROXY', // fire at the project's proxy server; omit to fire at the app
|
|
186
|
+
* body: {},
|
|
135
187
|
* };
|
|
136
188
|
* const trigger = {
|
|
137
189
|
* value: '0 7 15 * * ?', // triggers on day 15 7am of each month
|
|
@@ -144,11 +196,13 @@ export interface TaskReadOutView<
|
|
|
144
196
|
* @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
|
|
145
197
|
* @param [scope.userKey] Key associated with the user
|
|
146
198
|
* @param name Name of the task
|
|
147
|
-
* @param payload An HTTP
|
|
148
|
-
* @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST'
|
|
149
|
-
* @param payload.url
|
|
150
|
-
* @param [payload.
|
|
151
|
-
* @param
|
|
199
|
+
* @param payload An HTTP request or group-status change to execute when the task is triggered
|
|
200
|
+
* @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST')
|
|
201
|
+
* @param payload.url Relative URL the HTTP request will be sent to; the task runner builds the full URL as `{host}{targetPath}/{account}/{project}{url}`
|
|
202
|
+
* @param [payload.target] Where the task fires: 'APPLICATION' (the project app, `/app`, the default) or 'PROXY' (the project's proxy server, `/proxy`)
|
|
203
|
+
* @param payload.body The JSON body of the HTTP request
|
|
204
|
+
* @param [payload.headers] Headers to send along with the HTTP request; must be non-empty when provided — omit rather than pass an empty object
|
|
205
|
+
* @param [payload.timeoutSeconds] Request timeout in seconds (1–30)
|
|
152
206
|
* @param trigger Object that determines when to run the task (cron, offset, or date)
|
|
153
207
|
* @param [trigger.value] For cron: cron expression (e.g., '0 7 * * * ?'). For date: ISO-8601 date-time string
|
|
154
208
|
* @param [trigger.objectType] Type of trigger: 'cron', 'offset', or 'date'
|
|
@@ -159,8 +213,8 @@ export interface TaskReadOutView<
|
|
|
159
213
|
* @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
|
|
160
214
|
* @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
|
|
161
215
|
* @param [optionals.retryPolicy] Specifies what to do should the task fail; see RETRY_POLICY
|
|
162
|
-
* @param [optionals.failSafeTermination]
|
|
163
|
-
* @param [optionals.ttlSeconds]
|
|
216
|
+
* @param [optionals.failSafeTermination] ISO-8601 deadline after which the task terminates; the server defaults and caps this at one year from creation
|
|
217
|
+
* @param [optionals.ttlSeconds] Execution fail-safe window in seconds; the server applies its configured minimum
|
|
164
218
|
* @returns promise that resolves to the task object including the taskKey
|
|
165
219
|
*/
|
|
166
220
|
export async function create<
|
|
@@ -169,16 +223,11 @@ export async function create<
|
|
|
169
223
|
>(
|
|
170
224
|
scope: { userKey?: string } & GenericScope,
|
|
171
225
|
name: string,
|
|
172
|
-
payload:
|
|
173
|
-
method: string;
|
|
174
|
-
url: string;
|
|
175
|
-
body?: B;
|
|
176
|
-
headers?: H;
|
|
177
|
-
},
|
|
226
|
+
payload: TaskPayloadCreateInput<B, H>,
|
|
178
227
|
trigger: TaskTriggerCreateInView,
|
|
179
228
|
optionals: {
|
|
180
229
|
retryPolicy?: keyof typeof RETRY_POLICY;
|
|
181
|
-
failSafeTermination?:
|
|
230
|
+
failSafeTermination?: string;
|
|
182
231
|
ttlSeconds?: number;
|
|
183
232
|
} & RoutingOptions = {},
|
|
184
233
|
): Promise<TaskReadOutView<B, H>> {
|
|
@@ -188,12 +237,16 @@ export async function create<
|
|
|
188
237
|
ttlSeconds,
|
|
189
238
|
...routingOptions
|
|
190
239
|
} = optionals;
|
|
240
|
+
const normalizedPayload: TaskPayloadCreateInView<B, H> =
|
|
241
|
+
payload.objectType === 'groupStatus' ?
|
|
242
|
+
payload :
|
|
243
|
+
{ ...payload, objectType: 'http' };
|
|
191
244
|
return await new Router()
|
|
192
245
|
.post(
|
|
193
246
|
'/task',
|
|
194
247
|
{
|
|
195
248
|
body: {
|
|
196
|
-
payload:
|
|
249
|
+
payload: normalizedPayload,
|
|
197
250
|
trigger,
|
|
198
251
|
retryPolicy,
|
|
199
252
|
failSafeTermination,
|
|
@@ -209,7 +262,7 @@ export async function create<
|
|
|
209
262
|
|
|
210
263
|
|
|
211
264
|
/**
|
|
212
|
-
* Deletes a task (changes status to cancelled); requires
|
|
265
|
+
* Deletes a task (changes status to cancelled); requires facilitator (or higher) privileges
|
|
213
266
|
* Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
|
|
214
267
|
*
|
|
215
268
|
* @example
|
|
@@ -218,7 +271,7 @@ export async function create<
|
|
|
218
271
|
* await taskAdapter.destroy(taskKey);
|
|
219
272
|
*
|
|
220
273
|
* @param taskKey Unique key associated with a task
|
|
221
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
274
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
222
275
|
* @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
|
|
223
276
|
* @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
|
|
224
277
|
* @returns promise that resolves to undefined when successful
|
|
@@ -234,7 +287,7 @@ export async function destroy(
|
|
|
234
287
|
|
|
235
288
|
|
|
236
289
|
/**
|
|
237
|
-
* Gets a task by taskKey; requires
|
|
290
|
+
* Gets a task by taskKey; requires facilitator (or higher) privileges
|
|
238
291
|
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
|
|
239
292
|
*
|
|
240
293
|
* @example
|
|
@@ -243,7 +296,7 @@ export async function destroy(
|
|
|
243
296
|
* const task = await taskAdapter.get(taskKey);
|
|
244
297
|
*
|
|
245
298
|
* @param taskKey Unique key associated with a task
|
|
246
|
-
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
299
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
247
300
|
* @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
|
|
248
301
|
* @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
|
|
249
302
|
* @returns promise that resolves to the task object
|
|
@@ -259,7 +312,7 @@ export async function get<
|
|
|
259
312
|
|
|
260
313
|
|
|
261
314
|
/**
|
|
262
|
-
* Gets the history (100 most recent times it has triggered) of a task by taskKey; requires
|
|
315
|
+
* Gets the history (100 most recent times it has triggered) of a task by taskKey; requires facilitator (or higher) privileges
|
|
263
316
|
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/history/{TASK_KEY}`
|
|
264
317
|
*
|
|
265
318
|
* @example
|
|
@@ -268,26 +321,30 @@ export async function get<
|
|
|
268
321
|
* const history = await taskAdapter.getHistory(taskKey);
|
|
269
322
|
*
|
|
270
323
|
* @param taskKey Unique key associated with a task
|
|
271
|
-
* @param [optionals]
|
|
324
|
+
* @param [optionals] Pagination and network options
|
|
325
|
+
* @param [optionals.first] Zero-based index of the first history record; defaults to 0
|
|
326
|
+
* @param [optionals.max] Maximum history records to return; defaults to 100 and cannot exceed 100
|
|
272
327
|
* @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
|
|
273
328
|
* @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
|
|
274
|
-
* @returns promise that resolves to
|
|
329
|
+
* @returns promise that resolves to a page of task history objects
|
|
275
330
|
*/
|
|
276
|
-
export async function getHistory
|
|
277
|
-
B extends object = TaskPayloadBody,
|
|
278
|
-
H extends object = TaskPayloadHeaders,
|
|
279
|
-
>(
|
|
331
|
+
export async function getHistory(
|
|
280
332
|
taskKey: string,
|
|
281
|
-
optionals: RoutingOptions = {},
|
|
282
|
-
): Promise<
|
|
333
|
+
optionals: TaskPageOptions & RoutingOptions = {},
|
|
334
|
+
): Promise<Page<TaskHistoryReadOutView>> {
|
|
335
|
+
const { first, max, ...routingOptions } = optionals;
|
|
283
336
|
return await new Router()
|
|
284
|
-
.
|
|
337
|
+
.withSearchParams({ first, max })
|
|
338
|
+
.get(`/task/history/${taskKey}`, {
|
|
339
|
+
paginated: true,
|
|
340
|
+
...routingOptions,
|
|
341
|
+
})
|
|
285
342
|
.then(({ body }) => body);
|
|
286
343
|
}
|
|
287
344
|
|
|
288
345
|
|
|
289
346
|
/**
|
|
290
|
-
* Gets most recent 100 tasks related to the selected scope; requires
|
|
347
|
+
* Gets most recent 100 tasks related to the selected scope; requires facilitator (or higher) privileges
|
|
291
348
|
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}`
|
|
292
349
|
*
|
|
293
350
|
* Note: Will retrieve all tasks that were CREATED in the specified scope. If something was created with episode scope, it will not be retrievable through group scoping.
|
|
@@ -304,25 +361,91 @@ export async function getHistory<
|
|
|
304
361
|
* @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
|
|
305
362
|
* @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
|
|
306
363
|
* @param [scope.userKey] Key associated with the user; will retrieve tasks in the scope that were made by the specified user
|
|
307
|
-
* @param [optionals]
|
|
364
|
+
* @param [optionals] Pagination, sorting, and network options
|
|
365
|
+
* @param [optionals.sort] Task fields to sort by
|
|
366
|
+
* @param [optionals.first] Zero-based index of the first task; defaults to 0
|
|
367
|
+
* @param [optionals.max] Maximum tasks to return; defaults to 100 and cannot exceed 100
|
|
308
368
|
* @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
|
|
309
369
|
* @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
|
|
310
|
-
* @returns promise that resolves to
|
|
370
|
+
* @returns promise that resolves to a page of task objects
|
|
311
371
|
*/
|
|
312
372
|
export async function getTaskIn<
|
|
313
373
|
B extends object = TaskPayloadBody,
|
|
314
374
|
H extends object = TaskPayloadHeaders,
|
|
315
375
|
>(
|
|
316
376
|
scope: { userKey?: string } & GenericScope,
|
|
317
|
-
optionals: RoutingOptions = {},
|
|
318
|
-
): Promise<TaskReadOutView<B, H
|
|
377
|
+
optionals: TaskScopePageOptions & RoutingOptions = {},
|
|
378
|
+
): Promise<Page<TaskReadOutView<B, H>>> {
|
|
319
379
|
const { scopeBoundary, scopeKey, userKey } = scope;
|
|
380
|
+
const { sort = [], first, max, ...routingOptions } = optionals;
|
|
320
381
|
return await new Router()
|
|
382
|
+
.withSearchParams({
|
|
383
|
+
sort: sort.join(';') || undefined,
|
|
384
|
+
first,
|
|
385
|
+
max,
|
|
386
|
+
})
|
|
321
387
|
.get(
|
|
322
388
|
`/task/in/${scopeBoundary}/${scopeKey}${
|
|
323
389
|
userKey ? `/${userKey}` : ''
|
|
324
390
|
}`,
|
|
325
|
-
|
|
391
|
+
{
|
|
392
|
+
paginated: true,
|
|
393
|
+
...routingOptions,
|
|
394
|
+
},
|
|
326
395
|
)
|
|
327
396
|
.then(({ body }) => body);
|
|
328
397
|
}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Queries for tasks
|
|
402
|
+
* Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/search`
|
|
403
|
+
*
|
|
404
|
+
* No authentication is required; results use facilitator-level row visibility.
|
|
405
|
+
* Filterable/sortable fields include
|
|
406
|
+
* `task.taskKey`, `task.name`, `task.status`, `task.scopeBoundary`, `task.scopeKey`,
|
|
407
|
+
* `task.userKey`, `task.groupName`, `task.episodeName`, `task.nextExecution`,
|
|
408
|
+
* `task.failSafeExecution`, and `task.created`.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* import { taskAdapter } from 'epicenter-libs';
|
|
412
|
+
* const page = await taskAdapter.query({
|
|
413
|
+
* filter: [
|
|
414
|
+
* 'task.scopeKey=0000017dd3bf540e5ada5b1e058f08f20461', // tasks scoped to this group
|
|
415
|
+
* 'task.status=INITIALIZED', // that have not yet fired
|
|
416
|
+
* ],
|
|
417
|
+
* sort: ['-task.created'], // newest first
|
|
418
|
+
* max: 10, // page should only include the first 10 items
|
|
419
|
+
* });
|
|
420
|
+
*
|
|
421
|
+
* @param searchOptions Search options for the query
|
|
422
|
+
* @param [searchOptions.filter] Filters for searching
|
|
423
|
+
* @param [searchOptions.sort] Sorting criteria
|
|
424
|
+
* @param [searchOptions.first] The starting index of the page returned
|
|
425
|
+
* @param [searchOptions.max] The number of entries per page
|
|
426
|
+
* @param [optionals] Optional arguments; pass network call options overrides here.
|
|
427
|
+
* @returns promise that resolves to a page of tasks
|
|
428
|
+
*/
|
|
429
|
+
export async function query<
|
|
430
|
+
B extends object = TaskPayloadBody,
|
|
431
|
+
H extends object = TaskPayloadHeaders,
|
|
432
|
+
>(
|
|
433
|
+
searchOptions: GenericSearchOptions,
|
|
434
|
+
optionals: RoutingOptions = {},
|
|
435
|
+
): Promise<Page<TaskReadOutView<B, H>>> {
|
|
436
|
+
const { filter, sort = [], first, max } = searchOptions;
|
|
437
|
+
|
|
438
|
+
const searchParams = {
|
|
439
|
+
filter: parseFilterInput(filter),
|
|
440
|
+
sort: sort.join(';') || undefined,
|
|
441
|
+
first, max,
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
return await new Router()
|
|
445
|
+
.withSearchParams(searchParams)
|
|
446
|
+
.get('/task/search', {
|
|
447
|
+
paginated: true,
|
|
448
|
+
...optionals,
|
|
449
|
+
})
|
|
450
|
+
.then(({ body }) => body);
|
|
451
|
+
}
|
package/src/epicenter.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'regenerator-runtime/runtime';
|
|
2
2
|
|
|
3
|
-
/*
|
|
4
|
-
*
|
|
5
|
-
const version = `Epicenter (v${
|
|
3
|
+
/* __VERSION__, __BUILD__ and __DATE__ are injected at build time — by
|
|
4
|
+
* @rollup/plugin-replace for the shipped bundles and by Vite's `define` for tests */
|
|
5
|
+
const version = `Epicenter (v${__VERSION__}) for ${__BUILD__} | Build Date: ${__DATE__}`;
|
|
6
6
|
|
|
7
7
|
import type { RetryFunction } from './utils/router';
|
|
8
8
|
import { authAdapter, cometdAdapter } from './adapters';
|
|
@@ -123,8 +123,15 @@ export {
|
|
|
123
123
|
dailyAdapter,
|
|
124
124
|
matchmakerAdapter,
|
|
125
125
|
walletAdapter,
|
|
126
|
+
pipelineAdapter,
|
|
127
|
+
encyclopediaAdapter,
|
|
128
|
+
fileAdapter,
|
|
129
|
+
registrationAdapter,
|
|
130
|
+
docketAdapter,
|
|
126
131
|
Channel,
|
|
127
132
|
cometdAdapter,
|
|
133
|
+
gitAdapter,
|
|
134
|
+
powerpointAdapter,
|
|
128
135
|
} from './adapters';
|
|
129
136
|
|
|
130
137
|
/* APIs */
|
package/src/globals.d.ts
CHANGED
|
@@ -14,3 +14,9 @@ interface JSONObject {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
type JSONArray = Array<JSONValue>;
|
|
17
|
+
|
|
18
|
+
/* Build-time constants injected by @rollup/plugin-replace (shipped bundles)
|
|
19
|
+
* and Vite's `define` (tests). See src/epicenter.ts. */
|
|
20
|
+
declare const __VERSION__: string;
|
|
21
|
+
declare const __BUILD__: string;
|
|
22
|
+
declare const __DATE__: string;
|
package/src/types.ts
CHANGED
|
@@ -234,6 +234,11 @@ export type {
|
|
|
234
234
|
RETRY_POLICY,
|
|
235
235
|
TaskPayloadBody,
|
|
236
236
|
TaskPayloadHeaders,
|
|
237
|
+
TaskHttpMethod,
|
|
238
|
+
TaskRetryPolicyReadOutView,
|
|
239
|
+
TaskStatusReadOutView,
|
|
240
|
+
TaskAddressReadOutView,
|
|
241
|
+
TaskScopeReadOutView,
|
|
237
242
|
StatusReadOutView,
|
|
238
243
|
StatusCreateInView,
|
|
239
244
|
CronTaskTriggerCreateInView,
|
|
@@ -243,10 +248,15 @@ export type {
|
|
|
243
248
|
HttpTaskPayloadCreateInView,
|
|
244
249
|
GroupStatusTaskPayloadCreateInView,
|
|
245
250
|
TaskPayloadCreateInView,
|
|
251
|
+
HttpTaskPayloadCreateInput,
|
|
252
|
+
TaskPayloadCreateInput,
|
|
246
253
|
HttpTaskPayloadReadOutView,
|
|
247
254
|
GroupStatusTaskPayloadReadOutView,
|
|
248
255
|
TaskPayloadReadOutView,
|
|
249
256
|
TaskReadOutView,
|
|
257
|
+
TaskHistoryReadOutView,
|
|
258
|
+
TaskPageOptions,
|
|
259
|
+
TaskScopePageOptions,
|
|
250
260
|
} from './adapters/task';
|
|
251
261
|
|
|
252
262
|
// User Adapter
|
|
@@ -306,6 +316,57 @@ export type {
|
|
|
306
316
|
OrbitType,
|
|
307
317
|
} from './adapters/world';
|
|
308
318
|
|
|
319
|
+
// File Adapter
|
|
320
|
+
export type {
|
|
321
|
+
FileEntry,
|
|
322
|
+
DirectoryEntry,
|
|
323
|
+
FileSystemEntry,
|
|
324
|
+
} from './adapters/file';
|
|
325
|
+
|
|
326
|
+
// Registration Adapter
|
|
327
|
+
export type {
|
|
328
|
+
RegistrationInfo,
|
|
329
|
+
TeamRegistrationInfo,
|
|
330
|
+
RegistrationResult,
|
|
331
|
+
WhoAmI,
|
|
332
|
+
WhoAmIObjectType,
|
|
333
|
+
TeamRole,
|
|
334
|
+
SsoProtocol,
|
|
335
|
+
} from './adapters/registration';
|
|
336
|
+
|
|
337
|
+
// Docket Adapter
|
|
338
|
+
export type {
|
|
339
|
+
OperatingSystem,
|
|
340
|
+
WorkerShape,
|
|
341
|
+
ScaleFlavor,
|
|
342
|
+
ScaleCreateInView,
|
|
343
|
+
ScaleReadOutView,
|
|
344
|
+
ScaleDocketPayloadCreateInView,
|
|
345
|
+
ScaleDocketPayloadReadOutView,
|
|
346
|
+
DocketPayloadCreateInView,
|
|
347
|
+
DocketPayloadReadOutView,
|
|
348
|
+
DocketReadOutView,
|
|
349
|
+
} from './adapters/docket';
|
|
350
|
+
|
|
351
|
+
// Encyclopedia Adapter
|
|
352
|
+
export type {
|
|
353
|
+
EncyclopediaTranslator,
|
|
354
|
+
DocumentedEndpointMethod,
|
|
355
|
+
DocumentedEndpointAuthorization,
|
|
356
|
+
DocumentedEndpointNotation,
|
|
357
|
+
DocumentedParameterSource,
|
|
358
|
+
DocumentedParameter,
|
|
359
|
+
DocumentedEndpoint,
|
|
360
|
+
DocumentedResource,
|
|
361
|
+
KnownServiceReadOutView,
|
|
362
|
+
} from './adapters/encyclopedia';
|
|
363
|
+
|
|
364
|
+
// Pipeline Adapter
|
|
365
|
+
export type {
|
|
366
|
+
PipelineExecutionStatus,
|
|
367
|
+
PipelineAuditReadOutView,
|
|
368
|
+
} from './adapters/pipeline';
|
|
369
|
+
|
|
309
370
|
// Somebody Adapter
|
|
310
371
|
export type {
|
|
311
372
|
Somebody,
|
package/src/utils/config.ts
CHANGED
|
@@ -37,11 +37,12 @@ class Config {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
set apiProtocol(apiProtocol) {
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
40
|
+
let proto = apiProtocol.toLowerCase();
|
|
41
|
+
if (!proto.startsWith('http')) return;
|
|
42
|
+
if (proto.endsWith(':')) {
|
|
43
|
+
proto = proto.slice(0, -1);
|
|
43
44
|
}
|
|
44
|
-
this._apiProtocol =
|
|
45
|
+
this._apiProtocol = proto;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/**
|