@abyss-project/reflex 0.0.0-stage → 1.0.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/.eslintrc.js +32 -0
- package/.prettierrc +5 -0
- package/README.md +15 -3
- package/dist/api/function-access.api.d.ts +4 -0
- package/dist/api/function-access.api.js +12 -0
- package/dist/api/function-access.api.js.map +1 -0
- package/dist/api/function-promotion.api.d.ts +4 -0
- package/dist/api/function-promotion.api.js +12 -0
- package/dist/api/function-promotion.api.js.map +1 -0
- package/dist/api/function-run.api.d.ts +3 -0
- package/dist/api/function-run.api.js +12 -0
- package/dist/api/function-run.api.js.map +1 -0
- package/dist/api/function-test.api.d.ts +3 -0
- package/dist/api/function-test.api.js +12 -0
- package/dist/api/function-test.api.js.map +1 -0
- package/dist/api/function-trigger.api.d.ts +5 -0
- package/dist/api/function-trigger.api.js +14 -0
- package/dist/api/function-trigger.api.js.map +1 -0
- package/dist/api/function-version.api.d.ts +4 -0
- package/dist/api/function-version.api.js +12 -0
- package/dist/api/function-version.api.js.map +1 -0
- package/dist/api/function.api.d.ts +6 -0
- package/dist/api/function.api.js +16 -0
- package/dist/api/function.api.js.map +1 -0
- package/dist/api/health.api.d.ts +2 -0
- package/dist/api/health.api.js +7 -0
- package/dist/api/health.api.js.map +1 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.js +25 -0
- package/dist/api/index.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/types/enum/access-grant-status.enum.d.ts +5 -0
- package/dist/types/enum/access-grant-status.enum.js +10 -0
- package/dist/types/enum/access-grant-status.enum.js.map +1 -0
- package/dist/types/enum/access-kind.enum.d.ts +4 -0
- package/dist/types/enum/access-kind.enum.js +9 -0
- package/dist/types/enum/access-kind.enum.js.map +1 -0
- package/dist/types/enum/health-status.enum.d.ts +4 -0
- package/dist/types/enum/health-status.enum.js +9 -0
- package/dist/types/enum/health-status.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +9 -0
- package/dist/types/enum/index.js +26 -0
- package/dist/types/enum/index.js.map +1 -0
- package/dist/types/enum/reflex-error-code.enum.d.ts +10 -0
- package/dist/types/enum/reflex-error-code.enum.js +15 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -0
- package/dist/types/enum/run-mode.enum.d.ts +5 -0
- package/dist/types/enum/run-mode.enum.js +10 -0
- package/dist/types/enum/run-mode.enum.js.map +1 -0
- package/dist/types/enum/run-status.enum.d.ts +4 -0
- package/dist/types/enum/run-status.enum.js +9 -0
- package/dist/types/enum/run-status.enum.js.map +1 -0
- package/dist/types/enum/trace-effect-type.enum.d.ts +5 -0
- package/dist/types/enum/trace-effect-type.enum.js +10 -0
- package/dist/types/enum/trace-effect-type.enum.js.map +1 -0
- package/dist/types/enum/trigger-access-mode.enum.d.ts +5 -0
- package/dist/types/enum/trigger-access-mode.enum.js +10 -0
- package/dist/types/enum/trigger-access-mode.enum.js.map +1 -0
- package/dist/types/enum/trigger-type.enum.d.ts +3 -0
- package/dist/types/enum/trigger-type.enum.js +8 -0
- package/dist/types/enum/trigger-type.enum.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interface/api/index.d.ts +3 -0
- package/dist/types/interface/api/index.js +20 -0
- package/dist/types/interface/api/index.js.map +1 -0
- package/dist/types/interface/api/requests/function-access.request.d.ts +17 -0
- package/dist/types/interface/api/requests/function-access.request.js +3 -0
- package/dist/types/interface/api/requests/function-access.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-promotion.request.d.ts +20 -0
- package/dist/types/interface/api/requests/function-promotion.request.js +3 -0
- package/dist/types/interface/api/requests/function-promotion.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +15 -0
- package/dist/types/interface/api/requests/function-run.request.js +3 -0
- package/dist/types/interface/api/requests/function-run.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +14 -0
- package/dist/types/interface/api/requests/function-test.request.js +3 -0
- package/dist/types/interface/api/requests/function-test.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-trigger.request.d.ts +23 -0
- package/dist/types/interface/api/requests/function-trigger.request.js +3 -0
- package/dist/types/interface/api/requests/function-trigger.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-version.request.d.ts +13 -0
- package/dist/types/interface/api/requests/function-version.request.js +3 -0
- package/dist/types/interface/api/requests/function-version.request.js.map +1 -0
- package/dist/types/interface/api/requests/function.request.d.ts +27 -0
- package/dist/types/interface/api/requests/function.request.js +3 -0
- package/dist/types/interface/api/requests/function.request.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +7 -0
- package/dist/types/interface/api/requests/index.js +24 -0
- package/dist/types/interface/api/requests/index.js.map +1 -0
- package/dist/types/interface/api/response.d.ts +3 -0
- package/dist/types/interface/api/response.js +3 -0
- package/dist/types/interface/api/response.js.map +1 -0
- package/dist/types/interface/api/responses/function-access.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-access.response.js +3 -0
- package/dist/types/interface/api/responses/function-access.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-promotion.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-promotion.response.js +3 -0
- package/dist/types/interface/api/responses/function-promotion.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-run.response.d.ts +10 -0
- package/dist/types/interface/api/responses/function-run.response.js +3 -0
- package/dist/types/interface/api/responses/function-run.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-test.response.d.ts +10 -0
- package/dist/types/interface/api/responses/function-test.response.js +3 -0
- package/dist/types/interface/api/responses/function-test.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-trigger.response.d.ts +18 -0
- package/dist/types/interface/api/responses/function-trigger.response.js +3 -0
- package/dist/types/interface/api/responses/function-trigger.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-version.response.d.ts +14 -0
- package/dist/types/interface/api/responses/function-version.response.js +3 -0
- package/dist/types/interface/api/responses/function-version.response.js.map +1 -0
- package/dist/types/interface/api/responses/function.response.d.ts +20 -0
- package/dist/types/interface/api/responses/function.response.js +3 -0
- package/dist/types/interface/api/responses/function.response.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +7 -0
- package/dist/types/interface/api/responses/index.js +24 -0
- package/dist/types/interface/api/responses/index.js.map +1 -0
- package/dist/types/interface/health.response.d.ts +5 -0
- package/dist/types/interface/health.response.js +3 -0
- package/dist/types/interface/health.response.js.map +1 -0
- package/dist/types/interface/index.d.ts +3 -0
- package/dist/types/interface/index.js +20 -0
- package/dist/types/interface/index.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +7 -0
- package/dist/types/interface/models/index.js +24 -0
- package/dist/types/interface/models/index.js.map +1 -0
- package/dist/types/interface/models/reflex-access-grant.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-access-grant.model.js +3 -0
- package/dist/types/interface/models/reflex-access-grant.model.js.map +1 -0
- package/dist/types/interface/models/reflex-definition.model.d.ts +15 -0
- package/dist/types/interface/models/reflex-definition.model.js +3 -0
- package/dist/types/interface/models/reflex-definition.model.js.map +1 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.js +3 -0
- package/dist/types/interface/models/reflex-environment-pointer.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function-version.model.d.ts +10 -0
- package/dist/types/interface/models/reflex-function-version.model.js +3 -0
- package/dist/types/interface/models/reflex-function-version.model.js.map +1 -0
- package/dist/types/interface/models/reflex-function.model.d.ts +12 -0
- package/dist/types/interface/models/reflex-function.model.js +3 -0
- package/dist/types/interface/models/reflex-function.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +46 -0
- package/dist/types/interface/models/reflex-run.model.js +3 -0
- package/dist/types/interface/models/reflex-run.model.js.map +1 -0
- package/dist/types/interface/models/reflex-trigger.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-trigger.model.js +3 -0
- package/dist/types/interface/models/reflex-trigger.model.js.map +1 -0
- package/jest.config.ts +11 -0
- package/package.json +41 -3
- package/src/api/function-access.api.ts +36 -0
- package/src/api/function-promotion.api.ts +42 -0
- package/src/api/function-run.api.ts +26 -0
- package/src/api/function-test.api.ts +33 -0
- package/src/api/function-trigger.api.ts +52 -0
- package/src/api/function-version.api.ts +37 -0
- package/src/api/function.api.test.ts +212 -0
- package/src/api/function.api.ts +62 -0
- package/src/api/health.api.ts +10 -0
- package/src/api/index.ts +8 -0
- package/src/index.test.ts +50 -0
- package/src/index.ts +135 -0
- package/src/types/enum/access-grant-status.enum.ts +12 -0
- package/src/types/enum/access-kind.enum.ts +7 -0
- package/src/types/enum/health-status.enum.ts +4 -0
- package/src/types/enum/index.ts +9 -0
- package/src/types/enum/reflex-error-code.enum.ts +19 -0
- package/src/types/enum/run-mode.enum.ts +11 -0
- package/src/types/enum/run-status.enum.ts +4 -0
- package/src/types/enum/trace-effect-type.enum.ts +6 -0
- package/src/types/enum/trigger-access-mode.enum.ts +12 -0
- package/src/types/enum/trigger-type.enum.ts +4 -0
- package/src/types/index.ts +2 -0
- package/src/types/interface/api/index.ts +3 -0
- package/src/types/interface/api/requests/function-access.request.ts +25 -0
- package/src/types/interface/api/requests/function-promotion.request.ts +25 -0
- package/src/types/interface/api/requests/function-run.request.ts +19 -0
- package/src/types/interface/api/requests/function-test.request.ts +19 -0
- package/src/types/interface/api/requests/function-trigger.request.ts +28 -0
- package/src/types/interface/api/requests/function-version.request.ts +15 -0
- package/src/types/interface/api/requests/function.request.ts +34 -0
- package/src/types/interface/api/requests/index.ts +7 -0
- package/src/types/interface/api/response.ts +4 -0
- package/src/types/interface/api/responses/function-access.response.ts +17 -0
- package/src/types/interface/api/responses/function-promotion.response.ts +18 -0
- package/src/types/interface/api/responses/function-run.response.ts +13 -0
- package/src/types/interface/api/responses/function-test.response.ts +12 -0
- package/src/types/interface/api/responses/function-trigger.response.ts +24 -0
- package/src/types/interface/api/responses/function-version.response.ts +17 -0
- package/src/types/interface/api/responses/function.response.ts +25 -0
- package/src/types/interface/api/responses/index.ts +7 -0
- package/src/types/interface/health.response.ts +7 -0
- package/src/types/interface/index.ts +3 -0
- package/src/types/interface/models/index.ts +7 -0
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -0
- package/src/types/interface/models/reflex-definition.model.ts +23 -0
- package/src/types/interface/models/reflex-environment-pointer.model.ts +18 -0
- package/src/types/interface/models/reflex-function-version.model.ts +14 -0
- package/src/types/interface/models/reflex-function.model.ts +14 -0
- package/src/types/interface/models/reflex-run.model.ts +57 -0
- package/src/types/interface/models/reflex-trigger.model.ts +17 -0
- package/tsconfig.check.json +15 -0
- package/tsconfig.json +35 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './function.response';
|
|
2
|
+
export * from './function-access.response';
|
|
3
|
+
export * from './function-test.response';
|
|
4
|
+
export * from './function-version.response';
|
|
5
|
+
export * from './function-promotion.response';
|
|
6
|
+
export * from './function-trigger.response';
|
|
7
|
+
export * from './function-run.response';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./function.response"), exports);
|
|
18
|
+
__exportStar(require("./function-access.response"), exports);
|
|
19
|
+
__exportStar(require("./function-test.response"), exports);
|
|
20
|
+
__exportStar(require("./function-version.response"), exports);
|
|
21
|
+
__exportStar(require("./function-promotion.response"), exports);
|
|
22
|
+
__exportStar(require("./function-trigger.response"), exports);
|
|
23
|
+
__exportStar(require("./function-run.response"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,gEAA8C;AAC9C,8DAA4C;AAC5C,0DAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.response.js","sourceRoot":"","sources":["../../../src/types/interface/health.response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./health.response"), exports);
|
|
18
|
+
__exportStar(require("./models"), exports);
|
|
19
|
+
__exportStar(require("./api"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2CAAyB;AACzB,wCAAsB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './reflex-definition.model';
|
|
2
|
+
export * from './reflex-function.model';
|
|
3
|
+
export * from './reflex-function-version.model';
|
|
4
|
+
export * from './reflex-environment-pointer.model';
|
|
5
|
+
export * from './reflex-trigger.model';
|
|
6
|
+
export * from './reflex-access-grant.model';
|
|
7
|
+
export * from './reflex-run.model';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reflex-definition.model"), exports);
|
|
18
|
+
__exportStar(require("./reflex-function.model"), exports);
|
|
19
|
+
__exportStar(require("./reflex-function-version.model"), exports);
|
|
20
|
+
__exportStar(require("./reflex-environment-pointer.model"), exports);
|
|
21
|
+
__exportStar(require("./reflex-trigger.model"), exports);
|
|
22
|
+
__exportStar(require("./reflex-access-grant.model"), exports);
|
|
23
|
+
__exportStar(require("./reflex-run.model"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,0DAAwC;AACxC,kEAAgD;AAChD,qEAAmD;AACnD,yDAAuC;AACvC,8DAA4C;AAC5C,qDAAmC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AccessGrantStatus } from '../../enum';
|
|
2
|
+
import type { IReflexAccessDeclaration } from './reflex-definition.model';
|
|
3
|
+
export interface IReflexAccessGrant {
|
|
4
|
+
id: string;
|
|
5
|
+
functionId: string;
|
|
6
|
+
declaration: IReflexAccessDeclaration;
|
|
7
|
+
status: AccessGrantStatus;
|
|
8
|
+
grantedByUserId: string;
|
|
9
|
+
grantedAt: Date;
|
|
10
|
+
suspendedAt: Date | null;
|
|
11
|
+
revokedByUserId: string | null;
|
|
12
|
+
revokedAt: Date | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-access-grant.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-access-grant.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReflexAccessKind } from '../../enum';
|
|
2
|
+
export interface IReflexHttpAccess {
|
|
3
|
+
kind: ReflexAccessKind.HTTP;
|
|
4
|
+
hosts: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface IReflexHostActionAccess {
|
|
7
|
+
kind: ReflexAccessKind.HOST_ACTION;
|
|
8
|
+
action: string;
|
|
9
|
+
}
|
|
10
|
+
export type IReflexAccessDeclaration = IReflexHttpAccess | IReflexHostActionAccess;
|
|
11
|
+
export interface IReflexDefinition {
|
|
12
|
+
formatVersion: number;
|
|
13
|
+
accesses: IReflexAccessDeclaration[];
|
|
14
|
+
steps: Array<Record<string, unknown>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-definition.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-definition.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IReflexAccessDeclaration } from './reflex-definition.model';
|
|
2
|
+
export interface IReflexEnvironmentPointer {
|
|
3
|
+
id: string;
|
|
4
|
+
functionId: string;
|
|
5
|
+
environmentId: string;
|
|
6
|
+
environmentSlug: string;
|
|
7
|
+
versionId: string;
|
|
8
|
+
versionNumber: number;
|
|
9
|
+
grants: IReflexAccessDeclaration[];
|
|
10
|
+
isCurrent: boolean;
|
|
11
|
+
promotedByUserId: string;
|
|
12
|
+
promotedAt: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-environment-pointer.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-environment-pointer.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
+
export interface IReflexFunctionVersion {
|
|
3
|
+
id: string;
|
|
4
|
+
functionId: string;
|
|
5
|
+
number: number;
|
|
6
|
+
definition: IReflexDefinition;
|
|
7
|
+
hash: string;
|
|
8
|
+
publishedByUserId: string;
|
|
9
|
+
publishedAt: Date;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-function-version.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-function-version.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
+
export interface IReflexFunction {
|
|
3
|
+
id: string;
|
|
4
|
+
applicationId: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
draftDefinition: IReflexDefinition;
|
|
8
|
+
createdByUserId: string;
|
|
9
|
+
updatedByUserId: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-function.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-function.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RunMode, RunStatus, TraceEffectType } from '../../enum';
|
|
2
|
+
export interface IReflexTraceError {
|
|
3
|
+
code: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IReflexTraceEntry {
|
|
7
|
+
stepId: string;
|
|
8
|
+
type: TraceEffectType;
|
|
9
|
+
action?: string;
|
|
10
|
+
request?: unknown;
|
|
11
|
+
response?: unknown;
|
|
12
|
+
error?: IReflexTraceError;
|
|
13
|
+
recorded: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface IReflexTraceResponse {
|
|
16
|
+
status: number;
|
|
17
|
+
headers: Record<string, string>;
|
|
18
|
+
body: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface IReflexRunTrace {
|
|
21
|
+
entries: IReflexTraceEntry[];
|
|
22
|
+
outcome: {
|
|
23
|
+
status: RunStatus;
|
|
24
|
+
output?: unknown;
|
|
25
|
+
error?: IReflexTraceError & {
|
|
26
|
+
stepId?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
response?: IReflexTraceResponse;
|
|
30
|
+
truncated: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface IReflexRun {
|
|
33
|
+
id: string;
|
|
34
|
+
functionId: string;
|
|
35
|
+
versionId: string | null;
|
|
36
|
+
environmentId: string | null;
|
|
37
|
+
mode: RunMode;
|
|
38
|
+
status: RunStatus;
|
|
39
|
+
durationMs: number;
|
|
40
|
+
trace: IReflexRunTrace | null;
|
|
41
|
+
triggerId: string | null;
|
|
42
|
+
httpStatus: number | null;
|
|
43
|
+
errorCode: string | null;
|
|
44
|
+
createdByUserId: string | null;
|
|
45
|
+
createdAt: Date;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-run.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-run.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TriggerAccessMode, TriggerType } from '../../enum';
|
|
2
|
+
export interface IReflexTrigger {
|
|
3
|
+
id: string;
|
|
4
|
+
functionId: string;
|
|
5
|
+
applicationId: string;
|
|
6
|
+
applicationSlug: string;
|
|
7
|
+
type: TriggerType;
|
|
8
|
+
path: string;
|
|
9
|
+
accessMode: TriggerAccessMode;
|
|
10
|
+
createdByUserId: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflex-trigger.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-trigger.model.ts"],"names":[],"mappings":""}
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Config } from '@jest/types';
|
|
2
|
+
|
|
3
|
+
const config: Config.InitialOptions = {
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
transform: {
|
|
6
|
+
'^.+\\.tsx?$': ['ts-jest', { isolatedModules: true }],
|
|
7
|
+
},
|
|
8
|
+
modulePathIgnorePatterns: ['dist'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/reflex",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Core package to interact with AbyssReflex",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://gitlab.com/abyss-group/abyss-reflex.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "scylla",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=19.8"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"axios": "^1.6.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@jest/types": "^29.6.0",
|
|
22
|
+
"@types/jest": "^29.5.5",
|
|
23
|
+
"@types/node": "^20.11.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "8.71.0",
|
|
25
|
+
"@typescript-eslint/parser": "8.71.0",
|
|
26
|
+
"eslint": "^8.57.1",
|
|
27
|
+
"eslint-config-prettier": "^8.3.0",
|
|
28
|
+
"eslint-plugin-filenames-simple": "^0.7.0",
|
|
29
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"prettier": "2.3.1",
|
|
32
|
+
"ts-jest": "^29.1.0",
|
|
33
|
+
"ts-node": "^10.4.0",
|
|
34
|
+
"typescript": "5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
|
|
38
|
+
"lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
|
|
39
|
+
"tsc": "tsc",
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"dev": "tsc --watch"
|
|
43
|
+
}
|
|
6
44
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGrantFunctionAccessBody,
|
|
4
|
+
IGrantFunctionAccessParams,
|
|
5
|
+
IGrantFunctionAccessResponse,
|
|
6
|
+
IListFunctionAccessParams,
|
|
7
|
+
IListFunctionAccessResponse,
|
|
8
|
+
IRevokeFunctionAccessParams,
|
|
9
|
+
IRevokeFunctionAccessResponse,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
const accessUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
13
|
+
`api/function/${params.applicationId}/${params.functionId}/access`;
|
|
14
|
+
|
|
15
|
+
/** `GET .../access`: every access granted to the function, revoked ones included (the journal). Needs REFLEX_READ. */
|
|
16
|
+
export const listFunctionAccess = async (
|
|
17
|
+
params: IListFunctionAccessParams,
|
|
18
|
+
): Promise<IListFunctionAccessResponse> =>
|
|
19
|
+
(await AbyssReflexCore.axios.get<IListFunctionAccessResponse>(accessUrl(params))).data;
|
|
20
|
+
|
|
21
|
+
/** `POST .../access`: grants an access the draft declares. The caller must hold the right it needs (`403` otherwise). */
|
|
22
|
+
export const grantFunctionAccess = async (
|
|
23
|
+
params: IGrantFunctionAccessParams,
|
|
24
|
+
body: IGrantFunctionAccessBody,
|
|
25
|
+
): Promise<IGrantFunctionAccessResponse> =>
|
|
26
|
+
(await AbyssReflexCore.axios.post<IGrantFunctionAccessResponse>(accessUrl(params), body)).data;
|
|
27
|
+
|
|
28
|
+
/** `DELETE .../access/:grantId`: withdraws the access, at once, from what is already promoted. Needs REFLEX_FUNCTION_UPDATE. */
|
|
29
|
+
export const revokeFunctionAccess = async (
|
|
30
|
+
params: IRevokeFunctionAccessParams,
|
|
31
|
+
): Promise<IRevokeFunctionAccessResponse> =>
|
|
32
|
+
(
|
|
33
|
+
await AbyssReflexCore.axios.delete<IRevokeFunctionAccessResponse>(
|
|
34
|
+
`${accessUrl(params)}/${params.grantId}`,
|
|
35
|
+
)
|
|
36
|
+
).data;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IListFunctionPromotionParams,
|
|
4
|
+
IListFunctionPromotionResponse,
|
|
5
|
+
IPromoteFunctionBody,
|
|
6
|
+
IPromoteFunctionParams,
|
|
7
|
+
IPromoteFunctionResponse,
|
|
8
|
+
IRollbackFunctionBody,
|
|
9
|
+
IRollbackFunctionParams,
|
|
10
|
+
IRollbackFunctionResponse,
|
|
11
|
+
} from '../types';
|
|
12
|
+
|
|
13
|
+
const promotionUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
14
|
+
`api/function/${params.applicationId}/${params.functionId}/promotion`;
|
|
15
|
+
|
|
16
|
+
/** `GET .../promotion`: where each version runs, and the history a rollback reads. Needs REFLEX_READ. */
|
|
17
|
+
export const listFunctionPromotion = async (
|
|
18
|
+
params: IListFunctionPromotionParams,
|
|
19
|
+
): Promise<IListFunctionPromotionResponse> =>
|
|
20
|
+
(await AbyssReflexCore.axios.get<IListFunctionPromotionResponse>(promotionUrl(params))).data;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `POST .../promotion`: runs a version in a Monitor environment (copies it, its accesses and its secrets to
|
|
24
|
+
* the execution plane). Needs REFLEX_PUBLISH, and REFLEX_PUBLISH_PRODUCTION for a PRODUCTION environment.
|
|
25
|
+
*/
|
|
26
|
+
export const promoteFunction = async (
|
|
27
|
+
params: IPromoteFunctionParams,
|
|
28
|
+
body: IPromoteFunctionBody,
|
|
29
|
+
): Promise<IPromoteFunctionResponse> =>
|
|
30
|
+
(await AbyssReflexCore.axios.post<IPromoteFunctionResponse>(promotionUrl(params), body)).data;
|
|
31
|
+
|
|
32
|
+
/** `POST .../promotion/rollback`: moves the environment back to a version it ran before. Same rights as a promotion. */
|
|
33
|
+
export const rollbackFunction = async (
|
|
34
|
+
params: IRollbackFunctionParams,
|
|
35
|
+
body: IRollbackFunctionBody,
|
|
36
|
+
): Promise<IRollbackFunctionResponse> =>
|
|
37
|
+
(
|
|
38
|
+
await AbyssReflexCore.axios.post<IRollbackFunctionResponse>(
|
|
39
|
+
`${promotionUrl(params)}/rollback`,
|
|
40
|
+
body,
|
|
41
|
+
)
|
|
42
|
+
).data;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetFunctionRunParams,
|
|
4
|
+
IGetFunctionRunResponse,
|
|
5
|
+
IListFunctionRunParams,
|
|
6
|
+
IListFunctionRunQuery,
|
|
7
|
+
IListFunctionRunResponse,
|
|
8
|
+
} from '../types';
|
|
9
|
+
|
|
10
|
+
const runUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
11
|
+
`api/function/${params.applicationId}/${params.functionId}/run`;
|
|
12
|
+
|
|
13
|
+
/** `GET .../run`: the test runs (kept: the last 10, then 7 days) and the live executions of the edge (7 days), merged, newest first, paged by `limit`/`offset`. Needs REFLEX_LOG_READ. */
|
|
14
|
+
export const listFunctionRun = async (
|
|
15
|
+
params: IListFunctionRunParams,
|
|
16
|
+
query: IListFunctionRunQuery = {},
|
|
17
|
+
): Promise<IListFunctionRunResponse> =>
|
|
18
|
+
(await AbyssReflexCore.axios.get<IListFunctionRunResponse>(runUrl(params), { params: query }))
|
|
19
|
+
.data;
|
|
20
|
+
|
|
21
|
+
/** `GET .../run/:runId`. Needs REFLEX_LOG_READ. */
|
|
22
|
+
export const getFunctionRun = async (
|
|
23
|
+
params: IGetFunctionRunParams,
|
|
24
|
+
): Promise<IGetFunctionRunResponse> =>
|
|
25
|
+
(await AbyssReflexCore.axios.get<IGetFunctionRunResponse>(`${runUrl(params)}/${params.runId}`))
|
|
26
|
+
.data;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IDryRunFunctionBody,
|
|
4
|
+
IDryRunFunctionResponse,
|
|
5
|
+
IFunctionTestParams,
|
|
6
|
+
ISimulateFunctionBody,
|
|
7
|
+
ISimulateFunctionResponse,
|
|
8
|
+
} from '../types';
|
|
9
|
+
|
|
10
|
+
const testUrl = (params: IFunctionTestParams): string =>
|
|
11
|
+
`api/function/${params.applicationId}/${params.functionId}/test`;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `POST .../test/simulate`: runs the draft on a made-up event. Nothing is executed: HTTP steps get the
|
|
15
|
+
* stub they are given, the Store is a scratch copy thrown away. Needs REFLEX_TEST_RUN.
|
|
16
|
+
*/
|
|
17
|
+
export const simulateFunction = async (
|
|
18
|
+
params: IFunctionTestParams,
|
|
19
|
+
body: ISimulateFunctionBody = {},
|
|
20
|
+
): Promise<ISimulateFunctionResponse> =>
|
|
21
|
+
(await AbyssReflexCore.axios.post<ISimulateFunctionResponse>(`${testUrl(params)}/simulate`, body))
|
|
22
|
+
.data;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `POST .../test/dry-run`: like a simulation, but the Store is read for real; writes are recorded and not
|
|
26
|
+
* done. Needs REFLEX_TEST_RUN.
|
|
27
|
+
*/
|
|
28
|
+
export const dryRunFunction = async (
|
|
29
|
+
params: IFunctionTestParams,
|
|
30
|
+
body: IDryRunFunctionBody = {},
|
|
31
|
+
): Promise<IDryRunFunctionResponse> =>
|
|
32
|
+
(await AbyssReflexCore.axios.post<IDryRunFunctionResponse>(`${testUrl(params)}/dry-run`, body))
|
|
33
|
+
.data;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
ICreateFunctionTriggerBody,
|
|
4
|
+
ICreateFunctionTriggerParams,
|
|
5
|
+
ICreateFunctionTriggerResponse,
|
|
6
|
+
IDeleteFunctionTriggerParams,
|
|
7
|
+
IDeleteFunctionTriggerResponse,
|
|
8
|
+
IListFunctionTriggerParams,
|
|
9
|
+
IListFunctionTriggerResponse,
|
|
10
|
+
IRotateFunctionTriggerParams,
|
|
11
|
+
IRotateFunctionTriggerResponse,
|
|
12
|
+
} from '../types';
|
|
13
|
+
|
|
14
|
+
const triggerUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
15
|
+
`api/function/${params.applicationId}/${params.functionId}/trigger`;
|
|
16
|
+
|
|
17
|
+
/** `GET .../trigger`: the HTTP triggers of the function. Needs REFLEX_READ. */
|
|
18
|
+
export const listFunctionTrigger = async (
|
|
19
|
+
params: IListFunctionTriggerParams,
|
|
20
|
+
): Promise<IListFunctionTriggerResponse> =>
|
|
21
|
+
(await AbyssReflexCore.axios.get<IListFunctionTriggerResponse>(triggerUrl(params))).data;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `POST .../trigger`: adds an HTTP trigger. The key or the signing secret comes back ONCE in `secret`.
|
|
25
|
+
* Needs REFLEX_FUNCTION_UPDATE.
|
|
26
|
+
*/
|
|
27
|
+
export const createFunctionTrigger = async (
|
|
28
|
+
params: ICreateFunctionTriggerParams,
|
|
29
|
+
body: ICreateFunctionTriggerBody,
|
|
30
|
+
): Promise<ICreateFunctionTriggerResponse> =>
|
|
31
|
+
(await AbyssReflexCore.axios.post<ICreateFunctionTriggerResponse>(triggerUrl(params), body)).data;
|
|
32
|
+
|
|
33
|
+
/** `POST .../trigger/:triggerId/rotate`: a new key or signing secret, shown ONCE; the old one stops at once. */
|
|
34
|
+
export const rotateFunctionTrigger = async (
|
|
35
|
+
params: IRotateFunctionTriggerParams,
|
|
36
|
+
): Promise<IRotateFunctionTriggerResponse> =>
|
|
37
|
+
(
|
|
38
|
+
await AbyssReflexCore.axios.post<IRotateFunctionTriggerResponse>(
|
|
39
|
+
`${triggerUrl(params)}/${params.triggerId}/rotate`,
|
|
40
|
+
{},
|
|
41
|
+
)
|
|
42
|
+
).data;
|
|
43
|
+
|
|
44
|
+
/** `DELETE .../trigger/:triggerId`: the address answers `404` from then on. Needs REFLEX_FUNCTION_UPDATE. */
|
|
45
|
+
export const deleteFunctionTrigger = async (
|
|
46
|
+
params: IDeleteFunctionTriggerParams,
|
|
47
|
+
): Promise<IDeleteFunctionTriggerResponse> =>
|
|
48
|
+
(
|
|
49
|
+
await AbyssReflexCore.axios.delete<IDeleteFunctionTriggerResponse>(
|
|
50
|
+
`${triggerUrl(params)}/${params.triggerId}`,
|
|
51
|
+
)
|
|
52
|
+
).data;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AbyssReflexCore } from '..';
|
|
2
|
+
import type {
|
|
3
|
+
IGetFunctionVersionParams,
|
|
4
|
+
IGetFunctionVersionResponse,
|
|
5
|
+
IListFunctionVersionParams,
|
|
6
|
+
IListFunctionVersionResponse,
|
|
7
|
+
IPublishFunctionVersionParams,
|
|
8
|
+
IPublishFunctionVersionResponse,
|
|
9
|
+
} from '../types';
|
|
10
|
+
|
|
11
|
+
const versionUrl = (params: { applicationId: string; functionId: string }): string =>
|
|
12
|
+
`api/function/${params.applicationId}/${params.functionId}/version`;
|
|
13
|
+
|
|
14
|
+
/** `GET .../version`: the frozen versions, newest first. Needs REFLEX_READ. */
|
|
15
|
+
export const listFunctionVersion = async (
|
|
16
|
+
params: IListFunctionVersionParams,
|
|
17
|
+
): Promise<IListFunctionVersionResponse> =>
|
|
18
|
+
(await AbyssReflexCore.axios.get<IListFunctionVersionResponse>(versionUrl(params))).data;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `POST .../version`: freezes the draft as the next version (SHA-256 of the definition). Refused with
|
|
22
|
+
* `409 GRANT_SUSPENDED` when an access was granted by a member who lost the right since. Needs REFLEX_PUBLISH.
|
|
23
|
+
*/
|
|
24
|
+
export const publishFunctionVersion = async (
|
|
25
|
+
params: IPublishFunctionVersionParams,
|
|
26
|
+
): Promise<IPublishFunctionVersionResponse> =>
|
|
27
|
+
(await AbyssReflexCore.axios.post<IPublishFunctionVersionResponse>(versionUrl(params), {})).data;
|
|
28
|
+
|
|
29
|
+
/** `GET .../version/:versionId`. Needs REFLEX_READ. */
|
|
30
|
+
export const getFunctionVersion = async (
|
|
31
|
+
params: IGetFunctionVersionParams,
|
|
32
|
+
): Promise<IGetFunctionVersionResponse> =>
|
|
33
|
+
(
|
|
34
|
+
await AbyssReflexCore.axios.get<IGetFunctionVersionResponse>(
|
|
35
|
+
`${versionUrl(params)}/${params.versionId}`,
|
|
36
|
+
)
|
|
37
|
+
).data;
|