@abyss-project/reflex 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/storage-surplus.admin.api.d.ts +5 -0
- package/dist/api/storage-surplus.admin.api.js +17 -0
- package/dist/api/storage-surplus.admin.api.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/types/enum/reflex-error-code.enum.d.ts +3 -1
- package/dist/types/enum/reflex-error-code.enum.js +2 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +1 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +1 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
- package/package.json +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/storage-surplus.admin.api.test.ts +66 -0
- package/src/api/storage-surplus.admin.api.ts +45 -0
- package/src/index.ts +30 -0
- package/src/types/enum/reflex-error-code.enum.ts +11 -0
- package/src/types/interface/api/requests/index.ts +1 -0
- package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
- package/src/types/interface/api/responses/index.ts +1 -0
- package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -40,4 +40,5 @@ __exportStar(require("./service-consumer.api"), exports);
|
|
|
40
40
|
__exportStar(require("./service-openapi.api"), exports);
|
|
41
41
|
__exportStar(require("./service-limits.api"), exports);
|
|
42
42
|
__exportStar(require("./service-completion-webhook.api"), exports);
|
|
43
|
+
__exportStar(require("./storage-surplus.admin.api"), exports);
|
|
43
44
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,iDAA+B;AAC/B,wDAAsC;AACtC,sDAAoC;AACpC,yDAAuC;AACvC,qDAAmC;AACnC,0DAAwC;AACxC,gDAA8B;AAC9B,sDAAoC;AACpC,wDAAsC;AACtC,2DAAyC;AACzC,8DAA4C;AAC5C,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,0DAAwC;AACxC,qDAAmC;AACnC,iEAA+C;AAC/C,6DAA2C;AAC3C,mDAAiC;AACjC,oDAAkC;AAClC,0DAAwC;AACxC,yDAAuC;AACvC,wDAAsC;AACtC,uDAAqC;AACrC,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,iDAA+B;AAC/B,wDAAsC;AACtC,sDAAoC;AACpC,yDAAuC;AACvC,qDAAmC;AACnC,0DAAwC;AACxC,gDAA8B;AAC9B,sDAAoC;AACpC,wDAAsC;AACtC,2DAAyC;AACzC,8DAA4C;AAC5C,wDAAsC;AACtC,8DAA4C;AAC5C,yDAAuC;AACvC,0DAAwC;AACxC,qDAAmC;AACnC,iEAA+C;AAC/C,6DAA2C;AAC3C,mDAAiC;AACjC,oDAAkC;AAClC,0DAAwC;AACxC,yDAAuC;AACvC,wDAAsC;AACtC,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IApplyStorageSurplusAdminBody, IApplyStorageSurplusAdminResponse, IListStorageSurplusAdminBody, IListStorageSurplusAdminResponse } from '../types';
|
|
2
|
+
export declare const listArchivableStorageSurplusAdmin: (body: IListStorageSurplusAdminBody) => Promise<IListStorageSurplusAdminResponse>;
|
|
3
|
+
export declare const archiveStorageSurplusAdmin: (body: IApplyStorageSurplusAdminBody) => Promise<IApplyStorageSurplusAdminResponse>;
|
|
4
|
+
export declare const listArchivesStorageSurplusAdmin: (body: IListStorageSurplusAdminBody) => Promise<IListStorageSurplusAdminResponse>;
|
|
5
|
+
export declare const deleteArchivesStorageSurplusAdmin: (body: IApplyStorageSurplusAdminBody) => Promise<IApplyStorageSurplusAdminResponse>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteArchivesStorageSurplusAdmin = exports.listArchivesStorageSurplusAdmin = exports.archiveStorageSurplusAdmin = exports.listArchivableStorageSurplusAdmin = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const BASE = 'storage-surplus/admin';
|
|
6
|
+
const listArchivableStorageSurplusAdmin = async (body) => (await __1.AbyssReflexCore.axios.post(`${BASE}/archivable`, body))
|
|
7
|
+
.data;
|
|
8
|
+
exports.listArchivableStorageSurplusAdmin = listArchivableStorageSurplusAdmin;
|
|
9
|
+
const archiveStorageSurplusAdmin = async (body) => (await __1.AbyssReflexCore.axios.post(`${BASE}/archive`, body))
|
|
10
|
+
.data;
|
|
11
|
+
exports.archiveStorageSurplusAdmin = archiveStorageSurplusAdmin;
|
|
12
|
+
const listArchivesStorageSurplusAdmin = async (body) => (await __1.AbyssReflexCore.axios.post(`${BASE}/archives`, body))
|
|
13
|
+
.data;
|
|
14
|
+
exports.listArchivesStorageSurplusAdmin = listArchivesStorageSurplusAdmin;
|
|
15
|
+
const deleteArchivesStorageSurplusAdmin = async (body) => (await __1.AbyssReflexCore.axios.post(`${BASE}/delete-archives`, body)).data;
|
|
16
|
+
exports.deleteArchivesStorageSurplusAdmin = deleteArchivesStorageSurplusAdmin;
|
|
17
|
+
//# sourceMappingURL=storage-surplus.admin.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-surplus.admin.api.js","sourceRoot":"","sources":["../../src/api/storage-surplus.admin.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;AAQrC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAO9B,MAAM,iCAAiC,GAAG,KAAK,EACpD,IAAkC,EACS,EAAE,CAC7C,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAAmC,GAAG,IAAI,aAAa,EAAE,IAAI,CAAC,CAAC;KAC7F,IAAI,CAAC;AAJG,QAAA,iCAAiC,qCAIpC;AAGH,MAAM,0BAA0B,GAAG,KAAK,EAC7C,IAAmC,EACS,EAAE,CAC9C,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAAoC,GAAG,IAAI,UAAU,EAAE,IAAI,CAAC,CAAC;KAC3F,IAAI,CAAC;AAJG,QAAA,0BAA0B,8BAI7B;AAGH,MAAM,+BAA+B,GAAG,KAAK,EAClD,IAAkC,EACS,EAAE,CAC7C,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAAmC,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC;KAC3F,IAAI,CAAC;AAJG,QAAA,+BAA+B,mCAIlC;AAGH,MAAM,iCAAiC,GAAG,KAAK,EACpD,IAAmC,EACS,EAAE,CAC9C,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,IAAI,CAC9B,GAAG,IAAI,kBAAkB,EACzB,IAAI,CACL,CACF,CAAC,IAAI,CAAC;AARI,QAAA,iCAAiC,qCAQrC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,13 +24,16 @@ import * as serviceConsumerApi from './api/service-consumer.api';
|
|
|
24
24
|
import * as serviceOpenApiApi from './api/service-openapi.api';
|
|
25
25
|
import * as serviceLimitsApi from './api/service-limits.api';
|
|
26
26
|
import * as serviceCompletionWebhookApi from './api/service-completion-webhook.api';
|
|
27
|
+
import * as storageSurplusAdminApi from './api/storage-surplus.admin.api';
|
|
27
28
|
export * from './api';
|
|
28
29
|
export * from './types';
|
|
29
30
|
export * from './discord';
|
|
30
31
|
export * from './insights';
|
|
32
|
+
export declare const ADMIN_TOKEN_HEADER = "abyss-admin-token";
|
|
31
33
|
type CoreConfig = {
|
|
32
34
|
baseURL?: string;
|
|
33
35
|
token?: string;
|
|
36
|
+
adminToken?: string;
|
|
34
37
|
};
|
|
35
38
|
type AbyssReflexCoreSDK = {
|
|
36
39
|
health: typeof healthApi.health;
|
|
@@ -207,6 +210,14 @@ type AbyssReflexCoreSDK = {
|
|
|
207
210
|
rotateSecret: typeof serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret;
|
|
208
211
|
};
|
|
209
212
|
};
|
|
213
|
+
storageSurplus: {
|
|
214
|
+
admin: {
|
|
215
|
+
listArchivable: typeof storageSurplusAdminApi.listArchivableStorageSurplusAdmin;
|
|
216
|
+
archive: typeof storageSurplusAdminApi.archiveStorageSurplusAdmin;
|
|
217
|
+
listArchives: typeof storageSurplusAdminApi.listArchivesStorageSurplusAdmin;
|
|
218
|
+
deleteArchives: typeof storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
210
221
|
};
|
|
211
222
|
export declare class AbyssReflexCore {
|
|
212
223
|
private static config;
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.AbyssReflexCore = void 0;
|
|
42
|
+
exports.AbyssReflexCore = exports.ADMIN_TOKEN_HEADER = void 0;
|
|
43
43
|
const axios_1 = __importDefault(require("axios"));
|
|
44
44
|
const healthApi = __importStar(require("./api/health.api"));
|
|
45
45
|
const functionApi = __importStar(require("./api/function.api"));
|
|
@@ -67,11 +67,13 @@ const serviceConsumerApi = __importStar(require("./api/service-consumer.api"));
|
|
|
67
67
|
const serviceOpenApiApi = __importStar(require("./api/service-openapi.api"));
|
|
68
68
|
const serviceLimitsApi = __importStar(require("./api/service-limits.api"));
|
|
69
69
|
const serviceCompletionWebhookApi = __importStar(require("./api/service-completion-webhook.api"));
|
|
70
|
+
const storageSurplusAdminApi = __importStar(require("./api/storage-surplus.admin.api"));
|
|
70
71
|
__exportStar(require("./api"), exports);
|
|
71
72
|
__exportStar(require("./types"), exports);
|
|
72
73
|
__exportStar(require("./discord"), exports);
|
|
73
74
|
__exportStar(require("./insights"), exports);
|
|
74
75
|
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
76
|
+
exports.ADMIN_TOKEN_HEADER = 'abyss-admin-token';
|
|
75
77
|
class AbyssReflexCore {
|
|
76
78
|
static get sdk() {
|
|
77
79
|
if (!AbyssReflexCore._sdk) {
|
|
@@ -250,6 +252,14 @@ class AbyssReflexCore {
|
|
|
250
252
|
rotateSecret: serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret,
|
|
251
253
|
},
|
|
252
254
|
},
|
|
255
|
+
storageSurplus: {
|
|
256
|
+
admin: {
|
|
257
|
+
listArchivable: storageSurplusAdminApi.listArchivableStorageSurplusAdmin,
|
|
258
|
+
archive: storageSurplusAdminApi.archiveStorageSurplusAdmin,
|
|
259
|
+
listArchives: storageSurplusAdminApi.listArchivesStorageSurplusAdmin,
|
|
260
|
+
deleteArchives: storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
253
263
|
};
|
|
254
264
|
}
|
|
255
265
|
return AbyssReflexCore._sdk;
|
|
@@ -263,6 +273,9 @@ class AbyssReflexCore {
|
|
|
263
273
|
if (config.token) {
|
|
264
274
|
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
265
275
|
}
|
|
276
|
+
if (config.adminToken) {
|
|
277
|
+
AbyssReflexCore.axios.defaults.headers.common[exports.ADMIN_TOKEN_HEADER] = config.adminToken;
|
|
278
|
+
}
|
|
266
279
|
}
|
|
267
280
|
static getConfig() {
|
|
268
281
|
return AbyssReflexCore.config;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAA8C;AAC9C,gEAAkD;AAClD,6EAA+D;AAC/D,iFAAmE;AACnE,yEAA2D;AAC3D,+EAAiE;AACjE,uEAAyD;AACzD,iFAAmE;AACnE,8DAAgD;AAChD,yEAA2D;AAC3D,6EAA+D;AAC/D,mFAAqE;AACrE,yFAA2E;AAC3E,6EAA+D;AAC/D,wFAA0E;AAC1E,+EAAiE;AACjE,iFAAmE;AACnE,uEAAyD;AACzD,8FAAgF;AAChF,uFAAyE;AACzE,mEAAqD;AACrD,qEAAuD;AACvD,+EAAiE;AACjE,6EAA+D;AAC/D,2EAA6D;AAC7D,kGAAoF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAA8C;AAC9C,gEAAkD;AAClD,6EAA+D;AAC/D,iFAAmE;AACnE,yEAA2D;AAC3D,+EAAiE;AACjE,uEAAyD;AACzD,iFAAmE;AACnE,8DAAgD;AAChD,yEAA2D;AAC3D,6EAA+D;AAC/D,mFAAqE;AACrE,y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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;QAED,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,0BAAkB,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;QACxF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,SAAS;QACrB,OAAO,eAAe,CAAC,MAAM,CAAC;IAChC,CAAC;;AA5NH,0CA6NC;AA5NgB,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"}
|
|
@@ -26,5 +26,7 @@ export declare enum ReflexErrorCode {
|
|
|
26
26
|
CONSUMER_LIMIT_REACHED = "CONSUMER_LIMIT_REACHED",
|
|
27
27
|
CONSUMER_KEY_LIMIT_REACHED = "CONSUMER_KEY_LIMIT_REACHED",
|
|
28
28
|
COMPLETION_WEBHOOK_URL_REFUSED = "COMPLETION_WEBHOOK_URL_REFUSED",
|
|
29
|
-
ARCHIVE_UNAVAILABLE = "ARCHIVE_UNAVAILABLE"
|
|
29
|
+
ARCHIVE_UNAVAILABLE = "ARCHIVE_UNAVAILABLE",
|
|
30
|
+
ARCHIVE_DELETED = "ARCHIVE_DELETED",
|
|
31
|
+
STORAGE_PUBLISH_REFUSED = "STORAGE_PUBLISH_REFUSED"
|
|
30
32
|
}
|
|
@@ -31,5 +31,7 @@ var ReflexErrorCode;
|
|
|
31
31
|
ReflexErrorCode["CONSUMER_KEY_LIMIT_REACHED"] = "CONSUMER_KEY_LIMIT_REACHED";
|
|
32
32
|
ReflexErrorCode["COMPLETION_WEBHOOK_URL_REFUSED"] = "COMPLETION_WEBHOOK_URL_REFUSED";
|
|
33
33
|
ReflexErrorCode["ARCHIVE_UNAVAILABLE"] = "ARCHIVE_UNAVAILABLE";
|
|
34
|
+
ReflexErrorCode["ARCHIVE_DELETED"] = "ARCHIVE_DELETED";
|
|
35
|
+
ReflexErrorCode["STORAGE_PUBLISH_REFUSED"] = "STORAGE_PUBLISH_REFUSED";
|
|
34
36
|
})(ReflexErrorCode || (exports.ReflexErrorCode = ReflexErrorCode = {}));
|
|
35
37
|
//# sourceMappingURL=reflex-error-code.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-error-code.enum.js","sourceRoot":"","sources":["../../../src/types/enum/reflex-error-code.enum.ts"],"names":[],"mappings":";;;AACA,IAAY,
|
|
1
|
+
{"version":3,"file":"reflex-error-code.enum.js","sourceRoot":"","sources":["../../../src/types/enum/reflex-error-code.enum.ts"],"names":[],"mappings":";;;AACA,IAAY,eAuFX;AAvFD,WAAY,eAAe;IAEzB,4DAAyC,CAAA;IAEzC,sDAAmC,CAAA;IAEnC,4CAAyB,CAAA;IAEzB,8DAA2C,CAAA;IAE3C,kEAA+C,CAAA;IAE/C,oDAAiC,CAAA;IAEjC,8EAA2D,CAAA;IAE3D,oDAAiC,CAAA;IAEjC,8DAA2C,CAAA;IAE3C,oDAAiC,CAAA;IAEjC,0DAAuC,CAAA;IAEvC,kEAA+C,CAAA;IAE/C,oEAAiD,CAAA;IAEjD,8EAA2D,CAAA;IAE3D,wEAAqD,CAAA;IAErD,0FAAuE,CAAA;IAEvE,4EAAyD,CAAA;IAKzD,oEAAiD,CAAA;IAEjD,4EAAyD,CAAA;IAEzD,4EAAyD,CAAA;IAKzD,sDAAmC,CAAA;IAKnC,0DAAuC,CAAA;IAMvC,oDAAiC,CAAA;IAEjC,wDAAqC,CAAA;IAErC,oEAAiD,CAAA;IAEjD,4EAAyD,CAAA;IAKzD,oFAAiE,CAAA;IAKjE,8DAA2C,CAAA;IAK3C,sDAAmC,CAAA;IAMnC,sEAAmD,CAAA;AACrD,CAAC,EAvFW,eAAe,+BAAf,eAAe,QAuF1B"}
|
|
@@ -38,4 +38,5 @@ __exportStar(require("./service-consumer.request"), exports);
|
|
|
38
38
|
__exportStar(require("./service-openapi.request"), exports);
|
|
39
39
|
__exportStar(require("./service-limits.request"), exports);
|
|
40
40
|
__exportStar(require("./service-completion-webhook.request"), exports);
|
|
41
|
+
__exportStar(require("./storage-surplus.admin.request"), exports);
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,4DAA0C;AAC1C,0DAAwC;AACxC,6DAA2C;AAC3C,yDAAuC;AACvC,8DAA4C;AAC5C,oDAAkC;AAClC,0DAAwC;AACxC,4DAA0C;AAC1C,+DAA6C;AAC7C,kEAAgD;AAChD,4DAA0C;AAC1C,yDAAuC;AACvC,kEAAgD;AAChD,6DAA2C;AAC3C,qEAAmD;AACnD,iEAA+C;AAC/C,uDAAqC;AACrC,wDAAsC;AACtC,8DAA4C;AAC5C,6DAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,uEAAqD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,4DAA0C;AAC1C,0DAAwC;AACxC,6DAA2C;AAC3C,yDAAuC;AACvC,8DAA4C;AAC5C,oDAAkC;AAClC,0DAAwC;AACxC,4DAA0C;AAC1C,+DAA6C;AAC7C,kEAAgD;AAChD,4DAA0C;AAC1C,yDAAuC;AACvC,kEAAgD;AAChD,6DAA2C;AAC3C,qEAAmD;AACnD,iEAA+C;AAC/C,uDAAqC;AACrC,wDAAsC;AACtC,8DAA4C;AAC5C,6DAA2C;AAC3C,4DAA0C;AAC1C,2DAAyC;AACzC,uEAAqD;AACrD,kEAAgD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IReflexStorageSurplusOwner } from '../../models';
|
|
2
|
+
export interface IListStorageSurplusAdminBody {
|
|
3
|
+
owner: IReflexStorageSurplusOwner;
|
|
4
|
+
}
|
|
5
|
+
export interface IApplyStorageSurplusAdminBody {
|
|
6
|
+
owner: IReflexStorageSurplusOwner;
|
|
7
|
+
itemIds: string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-surplus.admin.request.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/storage-surplus.admin.request.ts"],"names":[],"mappings":""}
|
|
@@ -38,4 +38,5 @@ __exportStar(require("./service-consumer.response"), exports);
|
|
|
38
38
|
__exportStar(require("./service-openapi.response"), exports);
|
|
39
39
|
__exportStar(require("./service-limits.response"), exports);
|
|
40
40
|
__exportStar(require("./service-completion-webhook.response"), exports);
|
|
41
|
+
__exportStar(require("./storage-surplus.admin.response"), exports);
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,6DAA2C;AAC3C,2DAAyC;AACzC,8DAA4C;AAC5C,0DAAwC;AACxC,+DAA6C;AAC7C,qDAAmC;AACnC,2DAAyC;AACzC,6DAA2C;AAC3C,gEAA8C;AAC9C,mEAAiD;AACjD,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,8DAA4C;AAC5C,sEAAoD;AACpD,kEAAgD;AAChD,wDAAsC;AACtC,yDAAuC;AACvC,+DAA6C;AAC7C,8DAA4C;AAC5C,6DAA2C;AAC3C,4DAA0C;AAC1C,wEAAsD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,6DAA2C;AAC3C,2DAAyC;AACzC,8DAA4C;AAC5C,0DAAwC;AACxC,+DAA6C;AAC7C,qDAAmC;AACnC,2DAAyC;AACzC,6DAA2C;AAC3C,gEAA8C;AAC9C,mEAAiD;AACjD,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,8DAA4C;AAC5C,sEAAoD;AACpD,kEAAgD;AAChD,wDAAsC;AACtC,yDAAuC;AACvC,+DAA6C;AAC7C,8DAA4C;AAC5C,6DAA2C;AAC3C,4DAA0C;AAC1C,wEAAsD;AACtD,mEAAiD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IReflexStorageSurplusItem } from '../../models';
|
|
2
|
+
import type { IResponse } from '../response';
|
|
3
|
+
export interface IListStorageSurplusAdminData {
|
|
4
|
+
items: IReflexStorageSurplusItem[];
|
|
5
|
+
}
|
|
6
|
+
export type IListStorageSurplusAdminResponse = IResponse<IListStorageSurplusAdminData>;
|
|
7
|
+
export type IApplyStorageSurplusAdminData = Record<string, never>;
|
|
8
|
+
export type IApplyStorageSurplusAdminResponse = IResponse<IApplyStorageSurplusAdminData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-surplus.admin.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/storage-surplus.admin.response.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AxiosAdapter, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { ADMIN_TOKEN_HEADER, AbyssReflexCore, ReflexErrorCode } from '..';
|
|
3
|
+
|
|
4
|
+
const OWNER = { organizationId: 'org-1' };
|
|
5
|
+
const BODY = { owner: OWNER, itemIds: ['day-1'] };
|
|
6
|
+
const BASE = 'storage-surplus/admin';
|
|
7
|
+
|
|
8
|
+
const surplus = () => AbyssReflexCore.sdk.storageSurplus.admin;
|
|
9
|
+
|
|
10
|
+
describe('AbyssReflexCore storage surplus routes (day 90 of abyss-main)', () => {
|
|
11
|
+
const adapter = jest.fn<ReturnType<AxiosAdapter>, [InternalAxiosRequestConfig]>(
|
|
12
|
+
async (config) => ({
|
|
13
|
+
data: { data: { items: [] } },
|
|
14
|
+
status: 200,
|
|
15
|
+
statusText: '',
|
|
16
|
+
headers: {},
|
|
17
|
+
config,
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
beforeAll(() => {
|
|
22
|
+
AbyssReflexCore.setConfig({ baseURL: 'http://reflex.test/', adminToken: 'mesh-admin-token' });
|
|
23
|
+
AbyssReflexCore.axios.defaults.adapter = adapter;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
beforeEach(() => adapter.mockClear());
|
|
27
|
+
|
|
28
|
+
it.each([
|
|
29
|
+
[
|
|
30
|
+
'listArchivable',
|
|
31
|
+
`${BASE}/archivable`,
|
|
32
|
+
{ owner: OWNER },
|
|
33
|
+
() => surplus().listArchivable({ owner: OWNER }),
|
|
34
|
+
],
|
|
35
|
+
['archive', `${BASE}/archive`, BODY, () => surplus().archive(BODY)],
|
|
36
|
+
[
|
|
37
|
+
'listArchives',
|
|
38
|
+
`${BASE}/archives`,
|
|
39
|
+
{ owner: OWNER },
|
|
40
|
+
() => surplus().listArchives({ owner: OWNER }),
|
|
41
|
+
],
|
|
42
|
+
['deleteArchives', `${BASE}/delete-archives`, BODY, () => surplus().deleteArchives(BODY)],
|
|
43
|
+
])('%s posts to %s with the body and the admin token', async (_label, url, body, run) => {
|
|
44
|
+
const answer = await run();
|
|
45
|
+
|
|
46
|
+
const config = adapter.mock.calls[0][0];
|
|
47
|
+
expect(config.method).toBe('post');
|
|
48
|
+
expect(config.url).toBe(url);
|
|
49
|
+
expect(config.baseURL).toBe('http://reflex.test/');
|
|
50
|
+
expect(JSON.parse(config.data)).toEqual(body);
|
|
51
|
+
expect(config.headers.get(ADMIN_TOKEN_HEADER)).toBe('mesh-admin-token');
|
|
52
|
+
expect(answer).toEqual({ data: { items: [] } });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('names the header of the mesh admin token', () => {
|
|
56
|
+
expect(ADMIN_TOKEN_HEADER).toBe('abyss-admin-token');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('names the refusal of a publication past the storage quota', () => {
|
|
60
|
+
expect(ReflexErrorCode.STORAGE_PUBLISH_REFUSED).toBe('STORAGE_PUBLISH_REFUSED');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('names the 404 of a run whose archive was deleted', () => {
|
|
64
|
+
expect(ReflexErrorCode.ARCHIVE_DELETED).toBe('ARCHIVE_DELETED');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IApplyStorageSurplusAdminBody,
|
|
4
|
+
IApplyStorageSurplusAdminResponse,
|
|
5
|
+
IListStorageSurplusAdminBody,
|
|
6
|
+
IListStorageSurplusAdminResponse,
|
|
7
|
+
} from '../types';
|
|
8
|
+
|
|
9
|
+
const BASE = 'storage-surplus/admin';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `POST /storage-surplus/admin/archivable`: the days of runs of an organization that can move to the archive now. For
|
|
13
|
+
* abyss-main only: behind the admin token (`setConfig({ adminToken })`). AbyssReflex lists nothing for the surplus of
|
|
14
|
+
* the ONLINE quota (its runs are not in it): the answer is always empty.
|
|
15
|
+
*/
|
|
16
|
+
export const listArchivableStorageSurplusAdmin = async (
|
|
17
|
+
body: IListStorageSurplusAdminBody,
|
|
18
|
+
): Promise<IListStorageSurplusAdminResponse> =>
|
|
19
|
+
(await AbyssReflexCore.axios.post<IListStorageSurplusAdminResponse>(`${BASE}/archivable`, body))
|
|
20
|
+
.data;
|
|
21
|
+
|
|
22
|
+
/** `POST /storage-surplus/admin/archive`: moves the given days to the archive; idempotent. Admin token. */
|
|
23
|
+
export const archiveStorageSurplusAdmin = async (
|
|
24
|
+
body: IApplyStorageSurplusAdminBody,
|
|
25
|
+
): Promise<IApplyStorageSurplusAdminResponse> =>
|
|
26
|
+
(await AbyssReflexCore.axios.post<IApplyStorageSurplusAdminResponse>(`${BASE}/archive`, body))
|
|
27
|
+
.data;
|
|
28
|
+
|
|
29
|
+
/** `POST /storage-surplus/admin/archives`: the archived days of the organization, the oldest first. Admin token. */
|
|
30
|
+
export const listArchivesStorageSurplusAdmin = async (
|
|
31
|
+
body: IListStorageSurplusAdminBody,
|
|
32
|
+
): Promise<IListStorageSurplusAdminResponse> =>
|
|
33
|
+
(await AbyssReflexCore.axios.post<IListStorageSurplusAdminResponse>(`${BASE}/archives`, body))
|
|
34
|
+
.data;
|
|
35
|
+
|
|
36
|
+
/** `POST /storage-surplus/admin/delete-archives`: deletes the given archived days for good; idempotent. Admin token. */
|
|
37
|
+
export const deleteArchivesStorageSurplusAdmin = async (
|
|
38
|
+
body: IApplyStorageSurplusAdminBody,
|
|
39
|
+
): Promise<IApplyStorageSurplusAdminResponse> =>
|
|
40
|
+
(
|
|
41
|
+
await AbyssReflexCore.axios.post<IApplyStorageSurplusAdminResponse>(
|
|
42
|
+
`${BASE}/delete-archives`,
|
|
43
|
+
body,
|
|
44
|
+
)
|
|
45
|
+
).data;
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import * as serviceConsumerApi from './api/service-consumer.api';
|
|
|
25
25
|
import * as serviceOpenApiApi from './api/service-openapi.api';
|
|
26
26
|
import * as serviceLimitsApi from './api/service-limits.api';
|
|
27
27
|
import * as serviceCompletionWebhookApi from './api/service-completion-webhook.api';
|
|
28
|
+
import * as storageSurplusAdminApi from './api/storage-surplus.admin.api';
|
|
28
29
|
|
|
29
30
|
export * from './api';
|
|
30
31
|
export * from './types';
|
|
@@ -33,10 +34,15 @@ export * from './insights';
|
|
|
33
34
|
|
|
34
35
|
const DEFAULT_BASE_URL = 'https://reflex-api.abyss-project.fr/';
|
|
35
36
|
|
|
37
|
+
/** The header of the service-to-service routes (`/storage-surplus/admin/*`): the admin token of the mesh. */
|
|
38
|
+
export const ADMIN_TOKEN_HEADER = 'abyss-admin-token';
|
|
39
|
+
|
|
36
40
|
type CoreConfig = {
|
|
37
41
|
baseURL?: string;
|
|
38
42
|
/** The session token of the member (`Authorization: Bearer`). Every route but `health` needs it. */
|
|
39
43
|
token?: string;
|
|
44
|
+
/** The admin token of the mesh (`abyss-admin-token`), for the routes abyss-main calls (`storageSurplus.admin`). */
|
|
45
|
+
adminToken?: string;
|
|
40
46
|
};
|
|
41
47
|
|
|
42
48
|
type AbyssReflexCoreSDK = {
|
|
@@ -236,6 +242,18 @@ type AbyssReflexCoreSDK = {
|
|
|
236
242
|
rotateSecret: typeof serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret;
|
|
237
243
|
};
|
|
238
244
|
};
|
|
245
|
+
/**
|
|
246
|
+
* The day-90 contract of abyss-main's storage surplus, service-to-service (admin token). AbyssReflex has nothing to
|
|
247
|
+
* archive for the ONLINE surplus: `listArchivable` is always empty; the archives of the runs are listed and deleted.
|
|
248
|
+
*/
|
|
249
|
+
storageSurplus: {
|
|
250
|
+
admin: {
|
|
251
|
+
listArchivable: typeof storageSurplusAdminApi.listArchivableStorageSurplusAdmin;
|
|
252
|
+
archive: typeof storageSurplusAdminApi.archiveStorageSurplusAdmin;
|
|
253
|
+
listArchives: typeof storageSurplusAdminApi.listArchivesStorageSurplusAdmin;
|
|
254
|
+
deleteArchives: typeof storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
239
257
|
};
|
|
240
258
|
|
|
241
259
|
export class AbyssReflexCore {
|
|
@@ -425,6 +443,14 @@ export class AbyssReflexCore {
|
|
|
425
443
|
rotateSecret: serviceCompletionWebhookApi.rotateServiceCompletionWebhookSecret,
|
|
426
444
|
},
|
|
427
445
|
},
|
|
446
|
+
storageSurplus: {
|
|
447
|
+
admin: {
|
|
448
|
+
listArchivable: storageSurplusAdminApi.listArchivableStorageSurplusAdmin,
|
|
449
|
+
archive: storageSurplusAdminApi.archiveStorageSurplusAdmin,
|
|
450
|
+
listArchives: storageSurplusAdminApi.listArchivesStorageSurplusAdmin,
|
|
451
|
+
deleteArchives: storageSurplusAdminApi.deleteArchivesStorageSurplusAdmin,
|
|
452
|
+
},
|
|
453
|
+
},
|
|
428
454
|
};
|
|
429
455
|
}
|
|
430
456
|
return AbyssReflexCore._sdk;
|
|
@@ -442,6 +468,10 @@ export class AbyssReflexCore {
|
|
|
442
468
|
if (config.token) {
|
|
443
469
|
AbyssReflexCore.axios.defaults.headers.common.Authorization = `Bearer ${config.token}`;
|
|
444
470
|
}
|
|
471
|
+
|
|
472
|
+
if (config.adminToken) {
|
|
473
|
+
AbyssReflexCore.axios.defaults.headers.common[ADMIN_TOKEN_HEADER] = config.adminToken;
|
|
474
|
+
}
|
|
445
475
|
}
|
|
446
476
|
|
|
447
477
|
public static getConfig(): CoreConfig {
|
|
@@ -75,4 +75,15 @@ export enum ReflexErrorCode {
|
|
|
75
75
|
* unavailable, object failing its check). The run itself is untouched; asking again later may succeed.
|
|
76
76
|
*/
|
|
77
77
|
ARCHIVE_UNAVAILABLE = 'ARCHIVE_UNAVAILABLE',
|
|
78
|
+
/**
|
|
79
|
+
* 404: the detail of the run was in the customer's archive and the archive was deleted (day 90 of the storage
|
|
80
|
+
* surplus). The run's row stays; its detail, steps and log lines are gone for good.
|
|
81
|
+
*/
|
|
82
|
+
ARCHIVE_DELETED = 'ARCHIVE_DELETED',
|
|
83
|
+
/**
|
|
84
|
+
* 409: the version cannot be published because the AbyssReflex storage of the organization is full: its online quota
|
|
85
|
+
* is reached, or the personal threshold of AbyssReflex is, with "Block deposits" on. Nothing was published; the
|
|
86
|
+
* versions that exist and the executions go on. Delete versions, or raise the quota or the threshold.
|
|
87
|
+
*/
|
|
88
|
+
STORAGE_PUBLISH_REFUSED = 'STORAGE_PUBLISH_REFUSED',
|
|
78
89
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IReflexStorageSurplusOwner } from '../../models';
|
|
2
|
+
|
|
3
|
+
/** Body of `archivable` and `archives`: whose storage the call is about. */
|
|
4
|
+
export interface IListStorageSurplusAdminBody {
|
|
5
|
+
owner: IReflexStorageSurplusOwner;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Body of `archive` and `delete-archives`: the items to act on, as `archivable` and `archives` gave them. */
|
|
9
|
+
export interface IApplyStorageSurplusAdminBody {
|
|
10
|
+
owner: IReflexStorageSurplusOwner;
|
|
11
|
+
itemIds: string[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IReflexStorageSurplusItem } from '../../models';
|
|
2
|
+
import type { IResponse } from '../response';
|
|
3
|
+
|
|
4
|
+
export interface IListStorageSurplusAdminData {
|
|
5
|
+
items: IReflexStorageSurplusItem[];
|
|
6
|
+
}
|
|
7
|
+
export type IListStorageSurplusAdminResponse = IResponse<IListStorageSurplusAdminData>;
|
|
8
|
+
|
|
9
|
+
export type IApplyStorageSurplusAdminData = Record<string, never>;
|
|
10
|
+
export type IApplyStorageSurplusAdminResponse = IResponse<IApplyStorageSurplusAdminData>;
|