@abyss-project/reflex 5.3.0 → 5.4.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/dist/api/service-task.api.d.ts +2 -1
- package/dist/api/service-task.api.js +3 -1
- package/dist/api/service-task.api.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/scheduled-run-failure-code.enum.d.ts +4 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js +9 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-status.enum.d.ts +9 -0
- package/dist/types/enum/scheduled-run-status.enum.js +14 -0
- package/dist/types/enum/scheduled-run-status.enum.js.map +1 -0
- package/dist/types/interface/api/requests/service-task.request.d.ts +10 -0
- package/dist/types/interface/api/responses/service-task.response.d.ts +6 -1
- package/dist/types/interface/models/reflex-task.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-task.model.js +1 -0
- package/dist/types/interface/models/reflex-task.model.js.map +1 -1
- package/package.json +1 -1
- package/src/api/service-task.api.test.ts +16 -0
- package/src/api/service-task.api.ts +19 -0
- package/src/index.ts +271 -264
- package/src/types/enum/index.ts +33 -31
- package/src/types/enum/scheduled-run-failure-code.enum.ts +10 -0
- package/src/types/enum/scheduled-run-status.enum.ts +17 -0
- package/src/types/interface/api/requests/service-task.request.ts +14 -0
- package/src/types/interface/api/responses/service-task.response.ts +9 -0
- package/src/types/interface/models/reflex-task.model.ts +37 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ICancelServiceDelayedRunParams, ICancelServiceDelayedRunResponse, ICreateServiceTaskBody, ICreateServiceTaskParams, ICreateServiceTaskResponse, IDeleteServiceTaskParams, IDeleteServiceTaskResponse, IListServiceDelayedRunParams, IListServiceDelayedRunResponse, IListServiceTaskParams, IListServiceTaskResponse, IRetryServiceScheduleSyncParams, IRetryServiceScheduleSyncResponse, ITestRunServiceTaskBody, ITestRunServiceTaskParams, ITestRunServiceTaskResponse, IUpdateServiceTaskBody, IUpdateServiceTaskParams, IUpdateServiceTaskResponse } from '../types';
|
|
1
|
+
import type { ICancelServiceDelayedRunParams, ICancelServiceDelayedRunResponse, ICreateServiceTaskBody, ICreateServiceTaskParams, ICreateServiceTaskResponse, IDeleteServiceTaskParams, IDeleteServiceTaskResponse, IListServiceDelayedRunParams, IListServiceDelayedRunResponse, IListServiceTaskParams, IListServiceTaskResponse, IListServiceTaskScheduledRunParams, IListServiceTaskScheduledRunQuery, IListServiceTaskScheduledRunResponse, IRetryServiceScheduleSyncParams, IRetryServiceScheduleSyncResponse, ITestRunServiceTaskBody, ITestRunServiceTaskParams, ITestRunServiceTaskResponse, IUpdateServiceTaskBody, IUpdateServiceTaskParams, IUpdateServiceTaskResponse } from '../types';
|
|
2
2
|
export declare const listServiceTask: (params: IListServiceTaskParams) => Promise<IListServiceTaskResponse>;
|
|
3
3
|
export declare const createServiceTask: (params: ICreateServiceTaskParams, body: ICreateServiceTaskBody) => Promise<ICreateServiceTaskResponse>;
|
|
4
4
|
export declare const updateServiceTask: (params: IUpdateServiceTaskParams, body: IUpdateServiceTaskBody) => Promise<IUpdateServiceTaskResponse>;
|
|
5
5
|
export declare const deleteServiceTask: (params: IDeleteServiceTaskParams) => Promise<IDeleteServiceTaskResponse>;
|
|
6
6
|
export declare const testRunServiceTask: (params: ITestRunServiceTaskParams, body: ITestRunServiceTaskBody) => Promise<ITestRunServiceTaskResponse>;
|
|
7
|
+
export declare const listServiceTaskScheduledRun: (params: IListServiceTaskScheduledRunParams, query?: IListServiceTaskScheduledRunQuery) => Promise<IListServiceTaskScheduledRunResponse>;
|
|
7
8
|
export declare const listServiceDelayedRun: (params: IListServiceDelayedRunParams) => Promise<IListServiceDelayedRunResponse>;
|
|
8
9
|
export declare const cancelServiceDelayedRun: (params: ICancelServiceDelayedRunParams) => Promise<ICancelServiceDelayedRunResponse>;
|
|
9
10
|
export declare const retryServiceScheduleSync: (params: IRetryServiceScheduleSyncParams) => Promise<IRetryServiceScheduleSyncResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.retryServiceScheduleSync = exports.cancelServiceDelayedRun = exports.listServiceDelayedRun = exports.testRunServiceTask = exports.deleteServiceTask = exports.updateServiceTask = exports.createServiceTask = exports.listServiceTask = void 0;
|
|
3
|
+
exports.retryServiceScheduleSync = exports.cancelServiceDelayedRun = exports.listServiceDelayedRun = exports.listServiceTaskScheduledRun = exports.testRunServiceTask = exports.deleteServiceTask = exports.updateServiceTask = exports.createServiceTask = exports.listServiceTask = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
const serviceUrl = (params) => `api/service/${params.applicationId}/${params.serviceId}`;
|
|
6
6
|
const taskUrl = (params) => `${serviceUrl(params)}/task`;
|
|
@@ -15,6 +15,8 @@ const deleteServiceTask = async (params) => (await __1.AbyssReflexCore.axios.del
|
|
|
15
15
|
exports.deleteServiceTask = deleteServiceTask;
|
|
16
16
|
const testRunServiceTask = async (params, body) => (await __1.AbyssReflexCore.axios.post(`${taskUrl(params)}/${params.taskId}/test-run`, body)).data;
|
|
17
17
|
exports.testRunServiceTask = testRunServiceTask;
|
|
18
|
+
const listServiceTaskScheduledRun = async (params, query = {}) => (await __1.AbyssReflexCore.axios.get(`${taskUrl(params)}/${params.taskId}/environment/${params.environmentId}/scheduled-run`, { params: query })).data;
|
|
19
|
+
exports.listServiceTaskScheduledRun = listServiceTaskScheduledRun;
|
|
18
20
|
const listServiceDelayedRun = async (params) => (await __1.AbyssReflexCore.axios.get(delayedRunUrl(params))).data;
|
|
19
21
|
exports.listServiceDelayedRun = listServiceDelayedRun;
|
|
20
22
|
const cancelServiceDelayedRun = async (params) => (await __1.AbyssReflexCore.axios.delete(`${delayedRunUrl(params)}/${params.delayedRunId}`)).data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-task.api.js","sourceRoot":"","sources":["../../src/api/service-task.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;
|
|
1
|
+
{"version":3,"file":"service-task.api.js","sourceRoot":"","sources":["../../src/api/service-task.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;AA0BrC,MAAM,UAAU,GAAG,CAAC,MAAoD,EAAU,EAAE,CAClF,eAAe,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;AAE5D,MAAM,OAAO,GAAG,CAAC,MAAoD,EAAU,EAAE,CAC/E,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC;AAE/B,MAAM,aAAa,GAAG,CAAC,MAItB,EAAU,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,MAAM,CAAC,aAAa,cAAc,CAAC;AAG/E,MAAM,eAAe,GAAG,KAAK,EAClC,MAA8B,EACK,EAAE,CACrC,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAA2B,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAHvE,QAAA,eAAe,mBAGwD;AAO7E,MAAM,iBAAiB,GAAG,KAAK,EACpC,MAAgC,EAChC,IAA4B,EACS,EAAE,CACvC,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAA6B,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAJhF,QAAA,iBAAiB,qBAI+D;AAGtF,MAAM,iBAAiB,GAAG,KAAK,EACpC,MAAgC,EAChC,IAA4B,EACS,EAAE,CACvC,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,KAAK,CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,EACrC,I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D,CACF,CAAC,IAAI,CAAC;AAPI,QAAA,uBAAuB,2BAO3B;AAOF,MAAM,wBAAwB,GAAG,KAAK,EAC3C,MAAuC,EACK,EAAE,CAC9C,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAC9B,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,MAAM,CAAC,aAAa,gBAAgB,EACxE,EAAE,CACH,CACF,CAAC,IAAI,CAAC;AARI,QAAA,wBAAwB,4BAQ5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,9 @@ type AbyssReflexCoreSDK = {
|
|
|
108
108
|
update: typeof serviceTaskApi.updateServiceTask;
|
|
109
109
|
delete: typeof serviceTaskApi.deleteServiceTask;
|
|
110
110
|
testRun: typeof serviceTaskApi.testRunServiceTask;
|
|
111
|
+
scheduledRun: {
|
|
112
|
+
list: typeof serviceTaskApi.listServiceTaskScheduledRun;
|
|
113
|
+
};
|
|
111
114
|
delayedRun: {
|
|
112
115
|
list: typeof serviceTaskApi.listServiceDelayedRun;
|
|
113
116
|
cancel: typeof serviceTaskApi.cancelServiceDelayedRun;
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,9 @@ class AbyssReflexCore {
|
|
|
151
151
|
update: serviceTaskApi.updateServiceTask,
|
|
152
152
|
delete: serviceTaskApi.deleteServiceTask,
|
|
153
153
|
testRun: serviceTaskApi.testRunServiceTask,
|
|
154
|
+
scheduledRun: {
|
|
155
|
+
list: serviceTaskApi.listServiceTaskScheduledRun,
|
|
156
|
+
},
|
|
154
157
|
delayedRun: {
|
|
155
158
|
list: serviceTaskApi.listServiceDelayedRun,
|
|
156
159
|
cancel: serviceTaskApi.cancelServiceDelayedRun,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1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BACV,IAAI,EAAE,cAAc,CAAC,qBAAqB;4BAC1C,MAAM,EAAE,cAAc,CAAC,uBAAuB;yBAC/C;wBACD,IAAI,EAAE,cAAc,CAAC,wBAAwB;qBAC9C;iBACF;aACF,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,MAAkB;QACxC,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC;QAE5B,eAAe,CAAC,MAAM,GAAG,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAElE,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC1D,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,UAAU,MAAM,CAAC,KAAK,EAAE,CAAC;QACzF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,SAAS;QACrB,OAAO,eAAe,CAAC,MAAM,CAAC;IAChC,CAAC;;AArIH,0CAsIC;AArIgB,sBAAM,GAAe;IAClC,OAAO,EAAE,gBAAgB;CAC1B,CAAC;AACK,qBAAK,GAAG,eAAK,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC;AAEY,oBAAI,GAA8B,IAAI,CAAC"}
|
|
@@ -29,3 +29,5 @@ export * from './discord-gateway-state.enum';
|
|
|
29
29
|
export * from './discord-gateway-failure-code.enum';
|
|
30
30
|
export * from './schedule-sync-status.enum';
|
|
31
31
|
export * from './scheduled-run-origin.enum';
|
|
32
|
+
export * from './scheduled-run-status.enum';
|
|
33
|
+
export * from './scheduled-run-failure-code.enum';
|
package/dist/types/enum/index.js
CHANGED
|
@@ -45,4 +45,6 @@ __exportStar(require("./discord-gateway-state.enum"), exports);
|
|
|
45
45
|
__exportStar(require("./discord-gateway-failure-code.enum"), exports);
|
|
46
46
|
__exportStar(require("./schedule-sync-status.enum"), exports);
|
|
47
47
|
__exportStar(require("./scheduled-run-origin.enum"), exports);
|
|
48
|
+
__exportStar(require("./scheduled-run-status.enum"), exports);
|
|
49
|
+
__exportStar(require("./scheduled-run-failure-code.enum"), exports);
|
|
48
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6DAA2C;AAC3C,6DAA2C;AAC3C,kDAAgC;AAChC,oDAAkC;AAClC,2DAAyC;AACzC,2DAAyC;AACzC,qDAAmC;AACnC,2DAAyC;AACzC,wDAAsC;AACtC,mEAAiD;AACjD,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,sDAAoC;AACpC,mEAAiD;AACjD,mEAAiD;AACjD,4DAA0C;AAC1C,0DAAwC;AACxC,+DAA6C;AAC7C,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,6DAA2C;AAC3C,6DAA2C;AAC3C,iEAA+C;AAC/C,+DAA6C;AAC7C,+DAA6C;AAC7C,sEAAoD;AACpD,8DAA4C;AAC5C,8DAA4C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6DAA2C;AAC3C,6DAA2C;AAC3C,kDAAgC;AAChC,oDAAkC;AAClC,2DAAyC;AACzC,2DAAyC;AACzC,qDAAmC;AACnC,2DAAyC;AACzC,wDAAsC;AACtC,mEAAiD;AACjD,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,sDAAoC;AACpC,mEAAiD;AACjD,mEAAiD;AACjD,4DAA0C;AAC1C,0DAAwC;AACxC,+DAA6C;AAC7C,qEAAmD;AACnD,6DAA2C;AAC3C,gEAA8C;AAC9C,6DAA2C;AAC3C,6DAA2C;AAC3C,iEAA+C;AAC/C,+DAA6C;AAC7C,+DAA6C;AAC7C,sEAAoD;AACpD,8DAA4C;AAC5C,8DAA4C;AAC5C,8DAA4C;AAC5C,oEAAkD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScheduledRunFailureCode = void 0;
|
|
4
|
+
var ScheduledRunFailureCode;
|
|
5
|
+
(function (ScheduledRunFailureCode) {
|
|
6
|
+
ScheduledRunFailureCode["TASK_REMOVED"] = "TASK_REMOVED";
|
|
7
|
+
ScheduledRunFailureCode["ATTEMPTS_EXHAUSTED"] = "ATTEMPTS_EXHAUSTED";
|
|
8
|
+
})(ScheduledRunFailureCode || (exports.ScheduledRunFailureCode = ScheduledRunFailureCode = {}));
|
|
9
|
+
//# sourceMappingURL=scheduled-run-failure-code.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduled-run-failure-code.enum.js","sourceRoot":"","sources":["../../../src/types/enum/scheduled-run-failure-code.enum.ts"],"names":[],"mappings":";;;AAIA,IAAY,uBAKX;AALD,WAAY,uBAAuB;IAEjC,wDAA6B,CAAA;IAE7B,oEAAyC,CAAA;AAC3C,CAAC,EALW,uBAAuB,uCAAvB,uBAAuB,QAKlC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScheduledRunStatus = void 0;
|
|
4
|
+
var ScheduledRunStatus;
|
|
5
|
+
(function (ScheduledRunStatus) {
|
|
6
|
+
ScheduledRunStatus["PENDING"] = "PENDING";
|
|
7
|
+
ScheduledRunStatus["CLAIMED"] = "CLAIMED";
|
|
8
|
+
ScheduledRunStatus["DONE"] = "DONE";
|
|
9
|
+
ScheduledRunStatus["FAILED"] = "FAILED";
|
|
10
|
+
ScheduledRunStatus["CANCELLED"] = "CANCELLED";
|
|
11
|
+
ScheduledRunStatus["EXPIRED"] = "EXPIRED";
|
|
12
|
+
ScheduledRunStatus["SKIPPED"] = "SKIPPED";
|
|
13
|
+
})(ScheduledRunStatus || (exports.ScheduledRunStatus = ScheduledRunStatus = {}));
|
|
14
|
+
//# sourceMappingURL=scheduled-run-status.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduled-run-status.enum.js","sourceRoot":"","sources":["../../../src/types/enum/scheduled-run-status.enum.ts"],"names":[],"mappings":";;;AACA,IAAY,kBAeX;AAfD,WAAY,kBAAkB;IAE5B,yCAAmB,CAAA;IAEnB,yCAAmB,CAAA;IAEnB,mCAAa,CAAA;IAEb,uCAAiB,CAAA;IAEjB,6CAAuB,CAAA;IAEvB,yCAAmB,CAAA;IAEnB,yCAAmB,CAAA;AACrB,CAAC,EAfW,kBAAkB,kCAAlB,kBAAkB,QAe7B"}
|
|
@@ -52,3 +52,13 @@ export interface IRetryServiceScheduleSyncParams {
|
|
|
52
52
|
serviceId: string;
|
|
53
53
|
environmentId: string;
|
|
54
54
|
}
|
|
55
|
+
export interface IListServiceTaskScheduledRunParams {
|
|
56
|
+
applicationId: string;
|
|
57
|
+
serviceId: string;
|
|
58
|
+
taskId: string;
|
|
59
|
+
environmentId: string;
|
|
60
|
+
}
|
|
61
|
+
export interface IListServiceTaskScheduledRunQuery {
|
|
62
|
+
limit?: number;
|
|
63
|
+
offset?: number;
|
|
64
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IReflexDelayedRun, IReflexRun, IReflexServiceDeployment, IReflexTask } from '../../models';
|
|
1
|
+
import type { IReflexDelayedRun, IReflexRun, IReflexScheduledRun, IReflexServiceDeployment, IReflexTask } from '../../models';
|
|
2
2
|
import type { IResponse } from '../response';
|
|
3
3
|
export interface IListServiceTaskData {
|
|
4
4
|
tasks: IReflexTask[];
|
|
@@ -29,3 +29,8 @@ export interface IRetryServiceScheduleSyncData {
|
|
|
29
29
|
deployment: IReflexServiceDeployment;
|
|
30
30
|
}
|
|
31
31
|
export type IRetryServiceScheduleSyncResponse = IResponse<IRetryServiceScheduleSyncData>;
|
|
32
|
+
export interface IListServiceTaskScheduledRunData {
|
|
33
|
+
scheduledRuns: IReflexScheduledRun[];
|
|
34
|
+
total: number;
|
|
35
|
+
}
|
|
36
|
+
export type IListServiceTaskScheduledRunResponse = IResponse<IListServiceTaskScheduledRunData>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScheduledRunOrigin, ScheduledRunStatus } from '../../enum';
|
|
1
2
|
export declare const REFLEX_TASK_LIMITS: {
|
|
2
3
|
readonly namePattern: RegExp;
|
|
3
4
|
readonly maxTasksPerService: 20;
|
|
@@ -8,6 +9,7 @@ export declare const REFLEX_TASK_LIMITS: {
|
|
|
8
9
|
readonly recurringToleranceMinutes: 5;
|
|
9
10
|
readonly delayedToleranceMinutes: 60;
|
|
10
11
|
readonly maxAttempts: 3;
|
|
12
|
+
readonly scheduledRunPageMax: 50;
|
|
11
13
|
};
|
|
12
14
|
export interface IReflexTask {
|
|
13
15
|
id: string;
|
|
@@ -33,3 +35,14 @@ export interface IReflexDelayedRun {
|
|
|
33
35
|
scheduledByRunId: string | null;
|
|
34
36
|
createdAt: Date;
|
|
35
37
|
}
|
|
38
|
+
export interface IReflexScheduledRun {
|
|
39
|
+
id: string;
|
|
40
|
+
kind: ScheduledRunOrigin;
|
|
41
|
+
status: ScheduledRunStatus;
|
|
42
|
+
failureCode: string | null;
|
|
43
|
+
scheduledFor: Date;
|
|
44
|
+
startedAt: Date | null;
|
|
45
|
+
finishedAt: Date | null;
|
|
46
|
+
attempts: number;
|
|
47
|
+
liveRunId: string | null;
|
|
48
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-task.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-task.model.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reflex-task.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-task.model.ts"],"names":[],"mappings":";;;AAGa,QAAA,kBAAkB,GAAG;IAEhC,WAAW,EAAE,oBAAoB;IACjC,kBAAkB,EAAE,EAAE;IACtB,aAAa,EAAE,EAAE;IAEjB,gBAAgB,EAAE,IAAI;IAEtB,eAAe,EAAE,CAAC;IAElB,YAAY,EAAE,EAAE;IAEhB,yBAAyB,EAAE,CAAC;IAE5B,uBAAuB,EAAE,EAAE;IAE3B,WAAW,EAAE,CAAC;IAEd,mBAAmB,EAAE,EAAE;CACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ interface Call {
|
|
|
11
11
|
method: string;
|
|
12
12
|
url: string;
|
|
13
13
|
body?: unknown;
|
|
14
|
+
params?: unknown;
|
|
14
15
|
run: () => Promise<unknown>;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -57,6 +58,17 @@ const calls: Call[] = [
|
|
|
57
58
|
body: { environmentId: 'e-1' },
|
|
58
59
|
run: () => task().testRun({ ...SERVICE, taskId: 't-1' }, { environmentId: 'e-1' }),
|
|
59
60
|
},
|
|
61
|
+
{
|
|
62
|
+
label: 'scheduledRun.list',
|
|
63
|
+
method: 'get',
|
|
64
|
+
url: `${BASE}/task/t-1/environment/e-1/scheduled-run`,
|
|
65
|
+
params: { limit: 20, offset: 40 },
|
|
66
|
+
run: () =>
|
|
67
|
+
task().scheduledRun.list(
|
|
68
|
+
{ ...SERVICE, taskId: 't-1', environmentId: 'e-1' },
|
|
69
|
+
{ limit: 20, offset: 40 },
|
|
70
|
+
),
|
|
71
|
+
},
|
|
60
72
|
{
|
|
61
73
|
label: 'delayedRun.list',
|
|
62
74
|
method: 'get',
|
|
@@ -100,6 +112,9 @@ describe('AbyssReflexCore task routes', () => {
|
|
|
100
112
|
if (call.body !== undefined) {
|
|
101
113
|
expect(JSON.parse(config.data)).toEqual(call.body);
|
|
102
114
|
}
|
|
115
|
+
if (call.params !== undefined) {
|
|
116
|
+
expect(config.params).toEqual(call.params);
|
|
117
|
+
}
|
|
103
118
|
});
|
|
104
119
|
|
|
105
120
|
it('exposes no route twice', () => {
|
|
@@ -116,6 +131,7 @@ describe('AbyssReflexCore task routes', () => {
|
|
|
116
131
|
recurringToleranceMinutes: 5,
|
|
117
132
|
delayedToleranceMinutes: 60,
|
|
118
133
|
maxAttempts: 3,
|
|
134
|
+
scheduledRunPageMax: 50,
|
|
119
135
|
});
|
|
120
136
|
expect(REFLEX_TASK_LIMITS.namePattern.test('daily-report_2')).toBe(true);
|
|
121
137
|
expect(REFLEX_TASK_LIMITS.namePattern.test('Daily')).toBe(false);
|
|
@@ -11,6 +11,9 @@ import type {
|
|
|
11
11
|
IListServiceDelayedRunResponse,
|
|
12
12
|
IListServiceTaskParams,
|
|
13
13
|
IListServiceTaskResponse,
|
|
14
|
+
IListServiceTaskScheduledRunParams,
|
|
15
|
+
IListServiceTaskScheduledRunQuery,
|
|
16
|
+
IListServiceTaskScheduledRunResponse,
|
|
14
17
|
IRetryServiceScheduleSyncParams,
|
|
15
18
|
IRetryServiceScheduleSyncResponse,
|
|
16
19
|
ITestRunServiceTaskBody,
|
|
@@ -87,6 +90,22 @@ export const testRunServiceTask = async (
|
|
|
87
90
|
)
|
|
88
91
|
).data;
|
|
89
92
|
|
|
93
|
+
/**
|
|
94
|
+
* `GET .../task/:taskId/environment/:environmentId/scheduled-run`: the runs of the task in the environment, every
|
|
95
|
+
* status (EXPIRED, SKIPPED, CANCELLED and FAILED with their `failureCode` included), newest due first, paged by
|
|
96
|
+
* `limit` (50 at most) and `offset`. Needs REFLEX_READ.
|
|
97
|
+
*/
|
|
98
|
+
export const listServiceTaskScheduledRun = async (
|
|
99
|
+
params: IListServiceTaskScheduledRunParams,
|
|
100
|
+
query: IListServiceTaskScheduledRunQuery = {},
|
|
101
|
+
): Promise<IListServiceTaskScheduledRunResponse> =>
|
|
102
|
+
(
|
|
103
|
+
await AbyssReflexCore.axios.get<IListServiceTaskScheduledRunResponse>(
|
|
104
|
+
`${taskUrl(params)}/${params.taskId}/environment/${params.environmentId}/scheduled-run`,
|
|
105
|
+
{ params: query },
|
|
106
|
+
)
|
|
107
|
+
).data;
|
|
108
|
+
|
|
90
109
|
/** `GET .../environment/:environmentId/delayed-run`: the first 100 pending delayed runs of the environment. Needs REFLEX_READ. */
|
|
91
110
|
export const listServiceDelayedRun = async (
|
|
92
111
|
params: IListServiceDelayedRunParams,
|
package/src/index.ts
CHANGED
|
@@ -1,264 +1,271 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import * as healthApi from './api/health.api';
|
|
3
|
-
import * as functionApi from './api/function.api';
|
|
4
|
-
import * as functionAccessApi from './api/function-access.api';
|
|
5
|
-
import * as functionTestApi from './api/function-test.api';
|
|
6
|
-
import * as functionVersionApi from './api/function-version.api';
|
|
7
|
-
import * as functionRunApi from './api/function-run.api';
|
|
8
|
-
import * as functionSettingsApi from './api/function-settings.api';
|
|
9
|
-
import * as serviceApi from './api/service.api';
|
|
10
|
-
import * as serviceRouteApi from './api/service-route.api';
|
|
11
|
-
import * as serviceVersionApi from './api/service-version.api';
|
|
12
|
-
import * as serviceDeploymentApi from './api/service-deployment.api';
|
|
13
|
-
import * as serviceConfigurationApi from './api/service-configuration.api';
|
|
14
|
-
import * as serviceDiscordApi from './api/service-discord.api';
|
|
15
|
-
import * as serviceTaskApi from './api/service-task.api';
|
|
16
|
-
|
|
17
|
-
export * from './api';
|
|
18
|
-
export * from './types';
|
|
19
|
-
|
|
20
|
-
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
21
|
-
|
|
22
|
-
type CoreConfig = {
|
|
23
|
-
baseURL?: string;
|
|
24
|
-
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
25
|
-
token?: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type AbyssReflexCoreSDK = {
|
|
29
|
-
/** `GET /health` — status of the database and Redis behind the API. */
|
|
30
|
-
health: typeof healthApi.health;
|
|
31
|
-
function: {
|
|
32
|
-
list: typeof functionApi.listFunction;
|
|
33
|
-
create: typeof functionApi.createFunction;
|
|
34
|
-
get: typeof functionApi.getFunction;
|
|
35
|
-
update: typeof functionApi.updateFunction;
|
|
36
|
-
delete: typeof functionApi.deleteFunction;
|
|
37
|
-
access: {
|
|
38
|
-
list: typeof functionAccessApi.listFunctionAccess;
|
|
39
|
-
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
40
|
-
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
41
|
-
};
|
|
42
|
-
test: {
|
|
43
|
-
simulate: typeof functionTestApi.simulateFunction;
|
|
44
|
-
dryRun: typeof functionTestApi.dryRunFunction;
|
|
45
|
-
};
|
|
46
|
-
version: {
|
|
47
|
-
list: typeof functionVersionApi.listFunctionVersion;
|
|
48
|
-
get: typeof functionVersionApi.getFunctionVersion;
|
|
49
|
-
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
50
|
-
};
|
|
51
|
-
run: {
|
|
52
|
-
list: typeof functionRunApi.listFunctionRun;
|
|
53
|
-
get: typeof functionRunApi.getFunctionRun;
|
|
54
|
-
state: typeof functionRunApi.getFunctionRunState;
|
|
55
|
-
};
|
|
56
|
-
settings: {
|
|
57
|
-
get: typeof functionSettingsApi.getFunctionSettings;
|
|
58
|
-
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
59
|
-
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
60
|
-
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
/** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
|
|
64
|
-
service: {
|
|
65
|
-
list: typeof serviceApi.listService;
|
|
66
|
-
create: typeof serviceApi.createService;
|
|
67
|
-
get: typeof serviceApi.getService;
|
|
68
|
-
update: typeof serviceApi.updateService;
|
|
69
|
-
delete: typeof serviceApi.deleteService;
|
|
70
|
-
route: {
|
|
71
|
-
list: typeof serviceRouteApi.listServiceRoute;
|
|
72
|
-
create: typeof serviceRouteApi.createServiceRoute;
|
|
73
|
-
update: typeof serviceRouteApi.updateServiceRoute;
|
|
74
|
-
delete: typeof serviceRouteApi.deleteServiceRoute;
|
|
75
|
-
rotate: typeof serviceRouteApi.rotateServiceRoute;
|
|
76
|
-
};
|
|
77
|
-
version: {
|
|
78
|
-
list: typeof serviceVersionApi.listServiceVersion;
|
|
79
|
-
create: typeof serviceVersionApi.createServiceVersion;
|
|
80
|
-
get: typeof serviceVersionApi.getServiceVersion;
|
|
81
|
-
draftStatus: typeof serviceVersionApi.getServiceVersionDraftStatus;
|
|
82
|
-
};
|
|
83
|
-
deployment: {
|
|
84
|
-
list: typeof serviceDeploymentApi.listServiceDeployment;
|
|
85
|
-
goLive: typeof serviceDeploymentApi.goLiveService;
|
|
86
|
-
rollback: typeof serviceDeploymentApi.rollbackService;
|
|
87
|
-
pause: typeof serviceDeploymentApi.pauseService;
|
|
88
|
-
resume: typeof serviceDeploymentApi.resumeService;
|
|
89
|
-
};
|
|
90
|
-
configuration: {
|
|
91
|
-
list: typeof serviceConfigurationApi.listServiceConfiguration;
|
|
92
|
-
};
|
|
93
|
-
/** A Discord bot Service: its commands and components, its connection, the push to Discord. */
|
|
94
|
-
discord: {
|
|
95
|
-
command: {
|
|
96
|
-
list: typeof serviceDiscordApi.listServiceDiscordCommand;
|
|
97
|
-
create: typeof serviceDiscordApi.createServiceDiscordCommand;
|
|
98
|
-
update: typeof serviceDiscordApi.updateServiceDiscordCommand;
|
|
99
|
-
delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
|
|
100
|
-
};
|
|
101
|
-
component: {
|
|
102
|
-
list: typeof serviceDiscordApi.listServiceDiscordComponent;
|
|
103
|
-
create: typeof serviceDiscordApi.createServiceDiscordComponent;
|
|
104
|
-
update: typeof serviceDiscordApi.updateServiceDiscordComponent;
|
|
105
|
-
delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
|
|
106
|
-
};
|
|
107
|
-
connection: {
|
|
108
|
-
get: typeof serviceDiscordApi.getServiceDiscordConnection;
|
|
109
|
-
setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
|
|
110
|
-
setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
|
|
111
|
-
check: typeof serviceDiscordApi.checkServiceDiscordConnection;
|
|
112
|
-
};
|
|
113
|
-
/** Pushes the interactions address and the commands to Discord again. */
|
|
114
|
-
sync: typeof serviceDiscordApi.retryServiceDiscordSync;
|
|
115
|
-
};
|
|
116
|
-
/** The tasks of the Service (cron and delayed runs), their delayed runs, the synchronization with Flow. */
|
|
117
|
-
task: {
|
|
118
|
-
list: typeof serviceTaskApi.listServiceTask;
|
|
119
|
-
create: typeof serviceTaskApi.createServiceTask;
|
|
120
|
-
update: typeof serviceTaskApi.updateServiceTask;
|
|
121
|
-
delete: typeof serviceTaskApi.deleteServiceTask;
|
|
122
|
-
testRun: typeof serviceTaskApi.testRunServiceTask;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
get:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import * as healthApi from './api/health.api';
|
|
3
|
+
import * as functionApi from './api/function.api';
|
|
4
|
+
import * as functionAccessApi from './api/function-access.api';
|
|
5
|
+
import * as functionTestApi from './api/function-test.api';
|
|
6
|
+
import * as functionVersionApi from './api/function-version.api';
|
|
7
|
+
import * as functionRunApi from './api/function-run.api';
|
|
8
|
+
import * as functionSettingsApi from './api/function-settings.api';
|
|
9
|
+
import * as serviceApi from './api/service.api';
|
|
10
|
+
import * as serviceRouteApi from './api/service-route.api';
|
|
11
|
+
import * as serviceVersionApi from './api/service-version.api';
|
|
12
|
+
import * as serviceDeploymentApi from './api/service-deployment.api';
|
|
13
|
+
import * as serviceConfigurationApi from './api/service-configuration.api';
|
|
14
|
+
import * as serviceDiscordApi from './api/service-discord.api';
|
|
15
|
+
import * as serviceTaskApi from './api/service-task.api';
|
|
16
|
+
|
|
17
|
+
export * from './api';
|
|
18
|
+
export * from './types';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
21
|
+
|
|
22
|
+
type CoreConfig = {
|
|
23
|
+
baseURL?: string;
|
|
24
|
+
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
25
|
+
token?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AbyssReflexCoreSDK = {
|
|
29
|
+
/** `GET /health` — status of the database and Redis behind the API. */
|
|
30
|
+
health: typeof healthApi.health;
|
|
31
|
+
function: {
|
|
32
|
+
list: typeof functionApi.listFunction;
|
|
33
|
+
create: typeof functionApi.createFunction;
|
|
34
|
+
get: typeof functionApi.getFunction;
|
|
35
|
+
update: typeof functionApi.updateFunction;
|
|
36
|
+
delete: typeof functionApi.deleteFunction;
|
|
37
|
+
access: {
|
|
38
|
+
list: typeof functionAccessApi.listFunctionAccess;
|
|
39
|
+
grant: typeof functionAccessApi.grantFunctionAccess;
|
|
40
|
+
revoke: typeof functionAccessApi.revokeFunctionAccess;
|
|
41
|
+
};
|
|
42
|
+
test: {
|
|
43
|
+
simulate: typeof functionTestApi.simulateFunction;
|
|
44
|
+
dryRun: typeof functionTestApi.dryRunFunction;
|
|
45
|
+
};
|
|
46
|
+
version: {
|
|
47
|
+
list: typeof functionVersionApi.listFunctionVersion;
|
|
48
|
+
get: typeof functionVersionApi.getFunctionVersion;
|
|
49
|
+
stepStats: typeof functionVersionApi.getFunctionVersionStepStats;
|
|
50
|
+
};
|
|
51
|
+
run: {
|
|
52
|
+
list: typeof functionRunApi.listFunctionRun;
|
|
53
|
+
get: typeof functionRunApi.getFunctionRun;
|
|
54
|
+
state: typeof functionRunApi.getFunctionRunState;
|
|
55
|
+
};
|
|
56
|
+
settings: {
|
|
57
|
+
get: typeof functionSettingsApi.getFunctionSettings;
|
|
58
|
+
setDefault: typeof functionSettingsApi.setFunctionDefaultSettings;
|
|
59
|
+
setEnvironment: typeof functionSettingsApi.setFunctionEnvironmentSettings;
|
|
60
|
+
removeEnvironment: typeof functionSettingsApi.removeFunctionEnvironmentSettings;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/** Services: the unit versioned, put in service and paused as one (`/api/service/:applicationId/...`). */
|
|
64
|
+
service: {
|
|
65
|
+
list: typeof serviceApi.listService;
|
|
66
|
+
create: typeof serviceApi.createService;
|
|
67
|
+
get: typeof serviceApi.getService;
|
|
68
|
+
update: typeof serviceApi.updateService;
|
|
69
|
+
delete: typeof serviceApi.deleteService;
|
|
70
|
+
route: {
|
|
71
|
+
list: typeof serviceRouteApi.listServiceRoute;
|
|
72
|
+
create: typeof serviceRouteApi.createServiceRoute;
|
|
73
|
+
update: typeof serviceRouteApi.updateServiceRoute;
|
|
74
|
+
delete: typeof serviceRouteApi.deleteServiceRoute;
|
|
75
|
+
rotate: typeof serviceRouteApi.rotateServiceRoute;
|
|
76
|
+
};
|
|
77
|
+
version: {
|
|
78
|
+
list: typeof serviceVersionApi.listServiceVersion;
|
|
79
|
+
create: typeof serviceVersionApi.createServiceVersion;
|
|
80
|
+
get: typeof serviceVersionApi.getServiceVersion;
|
|
81
|
+
draftStatus: typeof serviceVersionApi.getServiceVersionDraftStatus;
|
|
82
|
+
};
|
|
83
|
+
deployment: {
|
|
84
|
+
list: typeof serviceDeploymentApi.listServiceDeployment;
|
|
85
|
+
goLive: typeof serviceDeploymentApi.goLiveService;
|
|
86
|
+
rollback: typeof serviceDeploymentApi.rollbackService;
|
|
87
|
+
pause: typeof serviceDeploymentApi.pauseService;
|
|
88
|
+
resume: typeof serviceDeploymentApi.resumeService;
|
|
89
|
+
};
|
|
90
|
+
configuration: {
|
|
91
|
+
list: typeof serviceConfigurationApi.listServiceConfiguration;
|
|
92
|
+
};
|
|
93
|
+
/** A Discord bot Service: its commands and components, its connection, the push to Discord. */
|
|
94
|
+
discord: {
|
|
95
|
+
command: {
|
|
96
|
+
list: typeof serviceDiscordApi.listServiceDiscordCommand;
|
|
97
|
+
create: typeof serviceDiscordApi.createServiceDiscordCommand;
|
|
98
|
+
update: typeof serviceDiscordApi.updateServiceDiscordCommand;
|
|
99
|
+
delete: typeof serviceDiscordApi.deleteServiceDiscordCommand;
|
|
100
|
+
};
|
|
101
|
+
component: {
|
|
102
|
+
list: typeof serviceDiscordApi.listServiceDiscordComponent;
|
|
103
|
+
create: typeof serviceDiscordApi.createServiceDiscordComponent;
|
|
104
|
+
update: typeof serviceDiscordApi.updateServiceDiscordComponent;
|
|
105
|
+
delete: typeof serviceDiscordApi.deleteServiceDiscordComponent;
|
|
106
|
+
};
|
|
107
|
+
connection: {
|
|
108
|
+
get: typeof serviceDiscordApi.getServiceDiscordConnection;
|
|
109
|
+
setTokenSecret: typeof serviceDiscordApi.setServiceDiscordTokenSecret;
|
|
110
|
+
setEnvironment: typeof serviceDiscordApi.setServiceDiscordEnvironment;
|
|
111
|
+
check: typeof serviceDiscordApi.checkServiceDiscordConnection;
|
|
112
|
+
};
|
|
113
|
+
/** Pushes the interactions address and the commands to Discord again. */
|
|
114
|
+
sync: typeof serviceDiscordApi.retryServiceDiscordSync;
|
|
115
|
+
};
|
|
116
|
+
/** The tasks of the Service (cron and delayed runs), their delayed runs, the synchronization with Flow. */
|
|
117
|
+
task: {
|
|
118
|
+
list: typeof serviceTaskApi.listServiceTask;
|
|
119
|
+
create: typeof serviceTaskApi.createServiceTask;
|
|
120
|
+
update: typeof serviceTaskApi.updateServiceTask;
|
|
121
|
+
delete: typeof serviceTaskApi.deleteServiceTask;
|
|
122
|
+
testRun: typeof serviceTaskApi.testRunServiceTask;
|
|
123
|
+
/** The history of a task in an environment: its runs of every status, those that ran nothing included. */
|
|
124
|
+
scheduledRun: {
|
|
125
|
+
list: typeof serviceTaskApi.listServiceTaskScheduledRun;
|
|
126
|
+
};
|
|
127
|
+
delayedRun: {
|
|
128
|
+
list: typeof serviceTaskApi.listServiceDelayedRun;
|
|
129
|
+
cancel: typeof serviceTaskApi.cancelServiceDelayedRun;
|
|
130
|
+
};
|
|
131
|
+
/** Synchronizes the cron tasks of the version in service with Flow again. */
|
|
132
|
+
sync: typeof serviceTaskApi.retryServiceScheduleSync;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export class AbyssReflexCore {
|
|
138
|
+
private static config: CoreConfig = {
|
|
139
|
+
baseURL: DEFAULT_BASE_URL,
|
|
140
|
+
};
|
|
141
|
+
static axios = axios.create({
|
|
142
|
+
baseURL: DEFAULT_BASE_URL,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
private static _sdk: AbyssReflexCoreSDK | null = null;
|
|
146
|
+
|
|
147
|
+
public static get sdk(): AbyssReflexCoreSDK {
|
|
148
|
+
if (!AbyssReflexCore._sdk) {
|
|
149
|
+
AbyssReflexCore._sdk = {
|
|
150
|
+
health: healthApi.health,
|
|
151
|
+
function: {
|
|
152
|
+
list: functionApi.listFunction,
|
|
153
|
+
create: functionApi.createFunction,
|
|
154
|
+
get: functionApi.getFunction,
|
|
155
|
+
update: functionApi.updateFunction,
|
|
156
|
+
delete: functionApi.deleteFunction,
|
|
157
|
+
access: {
|
|
158
|
+
list: functionAccessApi.listFunctionAccess,
|
|
159
|
+
grant: functionAccessApi.grantFunctionAccess,
|
|
160
|
+
revoke: functionAccessApi.revokeFunctionAccess,
|
|
161
|
+
},
|
|
162
|
+
test: {
|
|
163
|
+
simulate: functionTestApi.simulateFunction,
|
|
164
|
+
dryRun: functionTestApi.dryRunFunction,
|
|
165
|
+
},
|
|
166
|
+
version: {
|
|
167
|
+
list: functionVersionApi.listFunctionVersion,
|
|
168
|
+
get: functionVersionApi.getFunctionVersion,
|
|
169
|
+
stepStats: functionVersionApi.getFunctionVersionStepStats,
|
|
170
|
+
},
|
|
171
|
+
run: {
|
|
172
|
+
list: functionRunApi.listFunctionRun,
|
|
173
|
+
get: functionRunApi.getFunctionRun,
|
|
174
|
+
state: functionRunApi.getFunctionRunState,
|
|
175
|
+
},
|
|
176
|
+
settings: {
|
|
177
|
+
get: functionSettingsApi.getFunctionSettings,
|
|
178
|
+
setDefault: functionSettingsApi.setFunctionDefaultSettings,
|
|
179
|
+
setEnvironment: functionSettingsApi.setFunctionEnvironmentSettings,
|
|
180
|
+
removeEnvironment: functionSettingsApi.removeFunctionEnvironmentSettings,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
service: {
|
|
184
|
+
list: serviceApi.listService,
|
|
185
|
+
create: serviceApi.createService,
|
|
186
|
+
get: serviceApi.getService,
|
|
187
|
+
update: serviceApi.updateService,
|
|
188
|
+
delete: serviceApi.deleteService,
|
|
189
|
+
route: {
|
|
190
|
+
list: serviceRouteApi.listServiceRoute,
|
|
191
|
+
create: serviceRouteApi.createServiceRoute,
|
|
192
|
+
update: serviceRouteApi.updateServiceRoute,
|
|
193
|
+
delete: serviceRouteApi.deleteServiceRoute,
|
|
194
|
+
rotate: serviceRouteApi.rotateServiceRoute,
|
|
195
|
+
},
|
|
196
|
+
version: {
|
|
197
|
+
list: serviceVersionApi.listServiceVersion,
|
|
198
|
+
create: serviceVersionApi.createServiceVersion,
|
|
199
|
+
get: serviceVersionApi.getServiceVersion,
|
|
200
|
+
draftStatus: serviceVersionApi.getServiceVersionDraftStatus,
|
|
201
|
+
},
|
|
202
|
+
deployment: {
|
|
203
|
+
list: serviceDeploymentApi.listServiceDeployment,
|
|
204
|
+
goLive: serviceDeploymentApi.goLiveService,
|
|
205
|
+
rollback: serviceDeploymentApi.rollbackService,
|
|
206
|
+
pause: serviceDeploymentApi.pauseService,
|
|
207
|
+
resume: serviceDeploymentApi.resumeService,
|
|
208
|
+
},
|
|
209
|
+
configuration: {
|
|
210
|
+
list: serviceConfigurationApi.listServiceConfiguration,
|
|
211
|
+
},
|
|
212
|
+
discord: {
|
|
213
|
+
command: {
|
|
214
|
+
list: serviceDiscordApi.listServiceDiscordCommand,
|
|
215
|
+
create: serviceDiscordApi.createServiceDiscordCommand,
|
|
216
|
+
update: serviceDiscordApi.updateServiceDiscordCommand,
|
|
217
|
+
delete: serviceDiscordApi.deleteServiceDiscordCommand,
|
|
218
|
+
},
|
|
219
|
+
component: {
|
|
220
|
+
list: serviceDiscordApi.listServiceDiscordComponent,
|
|
221
|
+
create: serviceDiscordApi.createServiceDiscordComponent,
|
|
222
|
+
update: serviceDiscordApi.updateServiceDiscordComponent,
|
|
223
|
+
delete: serviceDiscordApi.deleteServiceDiscordComponent,
|
|
224
|
+
},
|
|
225
|
+
connection: {
|
|
226
|
+
get: serviceDiscordApi.getServiceDiscordConnection,
|
|
227
|
+
setTokenSecret: serviceDiscordApi.setServiceDiscordTokenSecret,
|
|
228
|
+
setEnvironment: serviceDiscordApi.setServiceDiscordEnvironment,
|
|
229
|
+
check: serviceDiscordApi.checkServiceDiscordConnection,
|
|
230
|
+
},
|
|
231
|
+
sync: serviceDiscordApi.retryServiceDiscordSync,
|
|
232
|
+
},
|
|
233
|
+
task: {
|
|
234
|
+
list: serviceTaskApi.listServiceTask,
|
|
235
|
+
create: serviceTaskApi.createServiceTask,
|
|
236
|
+
update: serviceTaskApi.updateServiceTask,
|
|
237
|
+
delete: serviceTaskApi.deleteServiceTask,
|
|
238
|
+
testRun: serviceTaskApi.testRunServiceTask,
|
|
239
|
+
scheduledRun: {
|
|
240
|
+
list: serviceTaskApi.listServiceTaskScheduledRun,
|
|
241
|
+
},
|
|
242
|
+
delayedRun: {
|
|
243
|
+
list: serviceTaskApi.listServiceDelayedRun,
|
|
244
|
+
cancel: serviceTaskApi.cancelServiceDelayedRun,
|
|
245
|
+
},
|
|
246
|
+
sync: serviceTaskApi.retryServiceScheduleSync,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return AbyssReflexCore._sdk;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public static setConfig(config: CoreConfig): void {
|
|
255
|
+
AbyssReflexCore._sdk = null;
|
|
256
|
+
|
|
257
|
+
AbyssReflexCore.config = { ...AbyssReflexCore.config, ...config };
|
|
258
|
+
|
|
259
|
+
if (config.baseURL) {
|
|
260
|
+
AbyssReflexCore.axios.defaults.baseURL = config.baseURL;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (config.token) {
|
|
264
|
+
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
public static getConfig(): CoreConfig {
|
|
269
|
+
return AbyssReflexCore.config;
|
|
270
|
+
}
|
|
271
|
+
}
|
package/src/types/enum/index.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
export * from './health-status.enum';
|
|
2
|
-
export * from './trigger-access-mode.enum';
|
|
3
|
-
export * from './access-grant-status.enum';
|
|
4
|
-
export * from './run-mode.enum';
|
|
5
|
-
export * from './run-status.enum';
|
|
6
|
-
export * from './trace-effect-type.enum';
|
|
7
|
-
export * from './reflex-error-code.enum';
|
|
8
|
-
export * from './access-kind.enum';
|
|
9
|
-
export * from './execution-profile.enum';
|
|
10
|
-
export * from './execution-mode.enum';
|
|
11
|
-
export * from './execution-settings-source.enum';
|
|
12
|
-
export * from './run-step-status.enum';
|
|
13
|
-
export * from './run-log-level.enum';
|
|
14
|
-
export * from './service-type.enum';
|
|
15
|
-
export * from './route-method.enum';
|
|
16
|
-
export * from './service-deployment-action.enum';
|
|
17
|
-
export * from './service-deployment-status.enum';
|
|
18
|
-
export * from './vault-value-source.enum';
|
|
19
|
-
export * from './vault-visibility.enum';
|
|
20
|
-
export * from './configuration-read-as.enum';
|
|
21
|
-
export * from './service-version-change-kind.enum';
|
|
22
|
-
export * from './discord-option-type.enum';
|
|
23
|
-
export * from './discord-component-kind.enum';
|
|
24
|
-
export * from './discord-sync-status.enum';
|
|
25
|
-
export * from './discord-token-state.enum';
|
|
26
|
-
export * from './discord-presence-status.enum';
|
|
27
|
-
export * from './discord-activity-type.enum';
|
|
28
|
-
export * from './discord-gateway-state.enum';
|
|
29
|
-
export * from './discord-gateway-failure-code.enum';
|
|
30
|
-
export * from './schedule-sync-status.enum';
|
|
31
|
-
export * from './scheduled-run-origin.enum';
|
|
1
|
+
export * from './health-status.enum';
|
|
2
|
+
export * from './trigger-access-mode.enum';
|
|
3
|
+
export * from './access-grant-status.enum';
|
|
4
|
+
export * from './run-mode.enum';
|
|
5
|
+
export * from './run-status.enum';
|
|
6
|
+
export * from './trace-effect-type.enum';
|
|
7
|
+
export * from './reflex-error-code.enum';
|
|
8
|
+
export * from './access-kind.enum';
|
|
9
|
+
export * from './execution-profile.enum';
|
|
10
|
+
export * from './execution-mode.enum';
|
|
11
|
+
export * from './execution-settings-source.enum';
|
|
12
|
+
export * from './run-step-status.enum';
|
|
13
|
+
export * from './run-log-level.enum';
|
|
14
|
+
export * from './service-type.enum';
|
|
15
|
+
export * from './route-method.enum';
|
|
16
|
+
export * from './service-deployment-action.enum';
|
|
17
|
+
export * from './service-deployment-status.enum';
|
|
18
|
+
export * from './vault-value-source.enum';
|
|
19
|
+
export * from './vault-visibility.enum';
|
|
20
|
+
export * from './configuration-read-as.enum';
|
|
21
|
+
export * from './service-version-change-kind.enum';
|
|
22
|
+
export * from './discord-option-type.enum';
|
|
23
|
+
export * from './discord-component-kind.enum';
|
|
24
|
+
export * from './discord-sync-status.enum';
|
|
25
|
+
export * from './discord-token-state.enum';
|
|
26
|
+
export * from './discord-presence-status.enum';
|
|
27
|
+
export * from './discord-activity-type.enum';
|
|
28
|
+
export * from './discord-gateway-state.enum';
|
|
29
|
+
export * from './discord-gateway-failure-code.enum';
|
|
30
|
+
export * from './schedule-sync-status.enum';
|
|
31
|
+
export * from './scheduled-run-origin.enum';
|
|
32
|
+
export * from './scheduled-run-status.enum';
|
|
33
|
+
export * from './scheduled-run-failure-code.enum';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `failureCode` of a FAILED scheduled run the execution plane writes itself. Any other `failureCode` is the
|
|
3
|
+
* error code of the live run that failed (`FUNCTION_FAILED`, `FUNCTION_TIMEOUT`, `INTERNAL_ERROR`...).
|
|
4
|
+
*/
|
|
5
|
+
export enum ScheduledRunFailureCode {
|
|
6
|
+
/** The task left the version in service before the run was due: nothing ran, nothing is billed. */
|
|
7
|
+
TASK_REMOVED = 'TASK_REMOVED',
|
|
8
|
+
/** Every attempt was interrupted by the end of its edge. */
|
|
9
|
+
ATTEMPTS_EXHAUSTED = 'ATTEMPTS_EXHAUSTED',
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Where a scheduled run of a task stands (`scheduled_runs.status` of the execution plane). */
|
|
2
|
+
export enum ScheduledRunStatus {
|
|
3
|
+
/** Waiting for its due date, or due and not yet taken by an edge. */
|
|
4
|
+
PENDING = 'PENDING',
|
|
5
|
+
/** An edge runs it. */
|
|
6
|
+
CLAIMED = 'CLAIMED',
|
|
7
|
+
/** Ran to its end. */
|
|
8
|
+
DONE = 'DONE',
|
|
9
|
+
/** Did not run to its end: `failureCode` says why. */
|
|
10
|
+
FAILED = 'FAILED',
|
|
11
|
+
/** Cancelled before it ran (`abyss.schedule.cancel` or the screen). */
|
|
12
|
+
CANCELLED = 'CANCELLED',
|
|
13
|
+
/** Taken too late, past the tolerance (after a pause or an outage): ran nothing, cost nothing. */
|
|
14
|
+
EXPIRED = 'EXPIRED',
|
|
15
|
+
/** A tick of a cron that came while the previous one still ran: ran nothing, cost nothing. */
|
|
16
|
+
SKIPPED = 'SKIPPED',
|
|
17
|
+
}
|
|
@@ -64,3 +64,17 @@ export interface IRetryServiceScheduleSyncParams {
|
|
|
64
64
|
serviceId: string;
|
|
65
65
|
environmentId: string;
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
export interface IListServiceTaskScheduledRunParams {
|
|
69
|
+
applicationId: string;
|
|
70
|
+
serviceId: string;
|
|
71
|
+
taskId: string;
|
|
72
|
+
/** The environment of the application whose runs are read (abyss-main's id). */
|
|
73
|
+
environmentId: string;
|
|
74
|
+
}
|
|
75
|
+
export interface IListServiceTaskScheduledRunQuery {
|
|
76
|
+
/** 1 to `REFLEX_TASK_LIMITS.scheduledRunPageMax` (50), 50 by default. */
|
|
77
|
+
limit?: number;
|
|
78
|
+
/** Runs skipped, newest first; 0 by default. */
|
|
79
|
+
offset?: number;
|
|
80
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IReflexDelayedRun,
|
|
3
3
|
IReflexRun,
|
|
4
|
+
IReflexScheduledRun,
|
|
4
5
|
IReflexServiceDeployment,
|
|
5
6
|
IReflexTask,
|
|
6
7
|
} from '../../models';
|
|
@@ -46,3 +47,11 @@ export interface IRetryServiceScheduleSyncData {
|
|
|
46
47
|
deployment: IReflexServiceDeployment;
|
|
47
48
|
}
|
|
48
49
|
export type IRetryServiceScheduleSyncResponse = IResponse<IRetryServiceScheduleSyncData>;
|
|
50
|
+
|
|
51
|
+
export interface IListServiceTaskScheduledRunData {
|
|
52
|
+
/** The runs of the task in the environment, every status, newest due first, paged by `limit`/`offset`. */
|
|
53
|
+
scheduledRuns: IReflexScheduledRun[];
|
|
54
|
+
/** Runs of the task in the environment, all of them (kept 7 days after their end). */
|
|
55
|
+
total: number;
|
|
56
|
+
}
|
|
57
|
+
export type IListServiceTaskScheduledRunResponse = IResponse<IListServiceTaskScheduledRunData>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ScheduledRunOrigin, ScheduledRunStatus } from '../../enum';
|
|
2
|
+
|
|
1
3
|
/** Bounds of the tasks of a Service and of their delayed runs; the API, the edge and their databases apply the same ones. */
|
|
2
4
|
export const REFLEX_TASK_LIMITS = {
|
|
3
5
|
/** `^[-_a-z0-9]{1,32}$`: the name `abyss.schedule.*` targets. */
|
|
@@ -16,6 +18,8 @@ export const REFLEX_TASK_LIMITS = {
|
|
|
16
18
|
delayedToleranceMinutes: 60,
|
|
17
19
|
/** Attempts of a scheduled run interrupted before its end (at least once). */
|
|
18
20
|
maxAttempts: 3,
|
|
21
|
+
/** Runs of a task one page of its history holds at most (and by default). */
|
|
22
|
+
scheduledRunPageMax: 50,
|
|
19
23
|
} as const;
|
|
20
24
|
|
|
21
25
|
/** A task of the draft of a Service: a named target of a cron and of `abyss.schedule.*`. */
|
|
@@ -49,7 +53,12 @@ export interface IReflexDelayedRun {
|
|
|
49
53
|
/** The name of the task in the version in service; null when that version no longer has it. */
|
|
50
54
|
taskName: string | null;
|
|
51
55
|
dueAt: Date;
|
|
52
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The deduplication key it was scheduled with; null without one. A key deduplicates per task: a task holds one
|
|
58
|
+
* pending run of a key at a time, and another task of the Service may hold a run of the same key.
|
|
59
|
+
* `abyss.schedule.cancel(key)` cancels the pending runs of that key in every task of the Service in the
|
|
60
|
+
* environment.
|
|
61
|
+
*/
|
|
53
62
|
key: string | null;
|
|
54
63
|
/** The payload handed to the run; null without one. */
|
|
55
64
|
payload: unknown;
|
|
@@ -59,3 +68,30 @@ export interface IReflexDelayedRun {
|
|
|
59
68
|
scheduledByRunId: string | null;
|
|
60
69
|
createdAt: Date;
|
|
61
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A run of a task in one environment, as the execution plane holds it, whatever its status: a tick of its cron or a
|
|
74
|
+
* delayed run, due, running or ended (kept 7 days after its end). The runs that ran nothing (EXPIRED, SKIPPED,
|
|
75
|
+
* CANCELLED, FAILED with TASK_REMOVED) are only seen here: the run journal holds what was executed.
|
|
76
|
+
*/
|
|
77
|
+
export interface IReflexScheduledRun {
|
|
78
|
+
id: string;
|
|
79
|
+
/** A tick of the cron, or a delayed run the code scheduled. */
|
|
80
|
+
kind: ScheduledRunOrigin;
|
|
81
|
+
status: ScheduledRunStatus;
|
|
82
|
+
/**
|
|
83
|
+
* Why FAILED, null otherwise: a `ScheduledRunFailureCode` the plane wrote itself, or the error code of the live
|
|
84
|
+
* run that failed.
|
|
85
|
+
*/
|
|
86
|
+
failureCode: string | null;
|
|
87
|
+
/** When the run was due. */
|
|
88
|
+
scheduledFor: Date;
|
|
89
|
+
/** When its last attempt began, from the live run; null when nothing ran (or the live run is purged). */
|
|
90
|
+
startedAt: Date | null;
|
|
91
|
+
/** When it ended; null while PENDING or CLAIMED. */
|
|
92
|
+
finishedAt: Date | null;
|
|
93
|
+
/** Attempts begun, 3 at most. */
|
|
94
|
+
attempts: number;
|
|
95
|
+
/** The live run of its last attempt, to open in the run journal; null when nothing ran (or it is purged). */
|
|
96
|
+
liveRunId: string | null;
|
|
97
|
+
}
|