@abyss-project/reflex 3.0.0 → 4.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.
Files changed (107) hide show
  1. package/dist/api/index.d.ts +1 -1
  2. package/dist/api/index.js +1 -1
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/api/service-configuration.api.d.ts +2 -0
  5. package/dist/api/service-configuration.api.js +7 -0
  6. package/dist/api/service-configuration.api.js.map +1 -0
  7. package/dist/index.d.ts +3 -6
  8. package/dist/index.js +3 -6
  9. package/dist/index.js.map +1 -1
  10. package/dist/types/enum/configuration-read-as.enum.d.ts +4 -0
  11. package/dist/types/enum/configuration-read-as.enum.js +9 -0
  12. package/dist/types/enum/configuration-read-as.enum.js.map +1 -0
  13. package/dist/types/enum/index.d.ts +3 -1
  14. package/dist/types/enum/index.js +3 -1
  15. package/dist/types/enum/index.js.map +1 -1
  16. package/dist/types/enum/vault-value-source.enum.d.ts +6 -0
  17. package/dist/types/enum/vault-value-source.enum.js +11 -0
  18. package/dist/types/enum/vault-value-source.enum.js.map +1 -0
  19. package/dist/types/enum/vault-visibility.enum.d.ts +4 -0
  20. package/dist/types/enum/vault-visibility.enum.js +9 -0
  21. package/dist/types/enum/vault-visibility.enum.js.map +1 -0
  22. package/dist/types/interface/api/requests/index.d.ts +1 -1
  23. package/dist/types/interface/api/requests/index.js +1 -1
  24. package/dist/types/interface/api/requests/index.js.map +1 -1
  25. package/dist/types/interface/api/requests/service-configuration.request.d.ts +4 -0
  26. package/dist/types/interface/api/requests/{service-variable.request.js → service-configuration.request.js} +1 -1
  27. package/dist/types/interface/api/requests/service-configuration.request.js.map +1 -0
  28. package/dist/types/interface/api/responses/index.d.ts +1 -1
  29. package/dist/types/interface/api/responses/index.js +1 -1
  30. package/dist/types/interface/api/responses/index.js.map +1 -1
  31. package/dist/types/interface/api/responses/service-configuration.response.d.ts +6 -0
  32. package/dist/types/interface/api/responses/{service-variable.response.js → service-configuration.response.js} +1 -1
  33. package/dist/types/interface/api/responses/service-configuration.response.js.map +1 -0
  34. package/dist/types/interface/models/index.d.ts +1 -1
  35. package/dist/types/interface/models/index.js +1 -1
  36. package/dist/types/interface/models/index.js.map +1 -1
  37. package/dist/types/interface/models/reflex-service-configuration.model.d.ts +9 -0
  38. package/dist/types/interface/models/{reflex-service-variable.model.js → reflex-service-configuration.model.js} +1 -1
  39. package/dist/types/interface/models/reflex-service-configuration.model.js.map +1 -0
  40. package/dist/types/interface/models/reflex-service.model.d.ts +0 -2
  41. package/dist/types/interface/models/reflex-service.model.js +0 -2
  42. package/dist/types/interface/models/reflex-service.model.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/api/function-run.api.ts +38 -38
  45. package/src/api/function-version.api.ts +48 -48
  46. package/src/api/function.api.test.ts +249 -249
  47. package/src/api/index.ts +1 -1
  48. package/src/api/service-configuration.api.ts +16 -0
  49. package/src/api/service-deployment.api.ts +79 -79
  50. package/src/api/service-route.api.ts +72 -72
  51. package/src/api/service-version.api.ts +39 -39
  52. package/src/api/service.api.test.ts +209 -234
  53. package/src/api/service.api.ts +55 -55
  54. package/src/index.ts +190 -196
  55. package/src/types/enum/configuration-read-as.enum.ts +5 -0
  56. package/src/types/enum/execution-mode.enum.ts +9 -9
  57. package/src/types/enum/index.ts +3 -1
  58. package/src/types/enum/reflex-error-code.enum.ts +25 -25
  59. package/src/types/enum/route-method.enum.ts +9 -9
  60. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  61. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  62. package/src/types/enum/service-type.enum.ts +7 -7
  63. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  64. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  65. package/src/types/enum/vault-value-source.enum.ts +12 -0
  66. package/src/types/enum/vault-visibility.enum.ts +5 -0
  67. package/src/types/interface/api/requests/function-run.request.ts +26 -26
  68. package/src/types/interface/api/requests/function-version.request.ts +20 -20
  69. package/src/types/interface/api/requests/function.request.ts +36 -36
  70. package/src/types/interface/api/requests/index.ts +1 -1
  71. package/src/types/interface/api/requests/service-configuration.request.ts +4 -0
  72. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  73. package/src/types/interface/api/requests/service-route.request.ts +44 -44
  74. package/src/types/interface/api/requests/service-version.request.ts +19 -19
  75. package/src/types/interface/api/requests/service.request.ts +39 -39
  76. package/src/types/interface/api/responses/function-version.response.ts +31 -31
  77. package/src/types/interface/api/responses/index.ts +1 -1
  78. package/src/types/interface/api/responses/service-configuration.response.ts +8 -0
  79. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  80. package/src/types/interface/api/responses/service-route.response.ts +31 -31
  81. package/src/types/interface/api/responses/service-version.response.ts +33 -33
  82. package/src/types/interface/api/responses/service.response.ts +31 -31
  83. package/src/types/interface/models/index.ts +1 -1
  84. package/src/types/interface/models/reflex-function.model.ts +16 -16
  85. package/src/types/interface/models/reflex-route.model.ts +19 -19
  86. package/src/types/interface/models/reflex-run.model.ts +164 -164
  87. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -0
  88. package/src/types/interface/models/reflex-service-deployment.model.ts +29 -29
  89. package/src/types/interface/models/reflex-service-version.model.ts +43 -43
  90. package/src/types/interface/models/reflex-service.model.ts +43 -46
  91. package/dist/api/service-variable.api.d.ts +0 -5
  92. package/dist/api/service-variable.api.js +0 -16
  93. package/dist/api/service-variable.api.js.map +0 -1
  94. package/dist/types/enum/secret-source.enum.d.ts +0 -5
  95. package/dist/types/enum/secret-source.enum.js +0 -10
  96. package/dist/types/enum/secret-source.enum.js.map +0 -1
  97. package/dist/types/interface/api/requests/service-variable.request.d.ts +0 -23
  98. package/dist/types/interface/api/requests/service-variable.request.js.map +0 -1
  99. package/dist/types/interface/api/responses/service-variable.response.d.ts +0 -22
  100. package/dist/types/interface/api/responses/service-variable.response.js.map +0 -1
  101. package/dist/types/interface/models/reflex-service-variable.model.d.ts +0 -10
  102. package/dist/types/interface/models/reflex-service-variable.model.js.map +0 -1
  103. package/src/api/service-variable.api.ts +0 -58
  104. package/src/types/enum/secret-source.enum.ts +0 -9
  105. package/src/types/interface/api/requests/service-variable.request.ts +0 -29
  106. package/src/types/interface/api/responses/service-variable.response.ts +0 -31
  107. package/src/types/interface/models/reflex-service-variable.model.ts +0 -16
@@ -1,29 +1,29 @@
1
- import type { ServiceDeploymentAction, ServiceDeploymentStatus } from '../../enum';
2
- import type { IReflexAccessDeclaration } from './reflex-definition.model';
3
-
4
- /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
5
- export interface IReflexServiceDeploymentGrant {
6
- functionId: string;
7
- grants: IReflexAccessDeclaration[];
8
- }
9
-
10
- /**
11
- * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
12
- * is paused) there; the others are the history a rollback reads.
13
- */
14
- export interface IReflexServiceDeployment {
15
- id: string;
16
- serviceId: string;
17
- /** The environment of the application (abyss-main's id). */
18
- environmentId: string;
19
- /** The name of that environment, second segment of the address. */
20
- environmentSlug: string;
21
- serviceVersionId: string;
22
- serviceVersionNumber: number;
23
- action: ServiceDeploymentAction;
24
- status: ServiceDeploymentStatus;
25
- grants: IReflexServiceDeploymentGrant[];
26
- isCurrent: boolean;
27
- byUserId: string;
28
- at: Date;
29
- }
1
+ import type { ServiceDeploymentAction, ServiceDeploymentStatus } from '../../enum';
2
+ import type { IReflexAccessDeclaration } from './reflex-definition.model';
3
+
4
+ /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
5
+ export interface IReflexServiceDeploymentGrant {
6
+ functionId: string;
7
+ grants: IReflexAccessDeclaration[];
8
+ }
9
+
10
+ /**
11
+ * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
12
+ * is paused) there; the others are the history a rollback reads.
13
+ */
14
+ export interface IReflexServiceDeployment {
15
+ id: string;
16
+ serviceId: string;
17
+ /** The environment of the application (abyss-main's id). */
18
+ environmentId: string;
19
+ /** The name of that environment, second segment of the address. */
20
+ environmentSlug: string;
21
+ serviceVersionId: string;
22
+ serviceVersionNumber: number;
23
+ action: ServiceDeploymentAction;
24
+ status: ServiceDeploymentStatus;
25
+ grants: IReflexServiceDeploymentGrant[];
26
+ isCurrent: boolean;
27
+ byUserId: string;
28
+ at: Date;
29
+ }
@@ -1,43 +1,43 @@
1
- import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
- import type { IReflexServiceCors } from './reflex-service.model';
3
-
4
- /** A route as a version of the Service froze it. */
5
- export interface IReflexServiceVersionRoute {
6
- routeId: string;
7
- method: RouteMethod;
8
- path: string;
9
- functionId: string;
10
- accessMode: TriggerAccessMode;
11
- }
12
-
13
- /** The version of a member function a version of the Service runs. */
14
- export interface IReflexServiceVersionFunction {
15
- functionId: string;
16
- functionVersionId: string;
17
- functionVersionNumber: number;
18
- }
19
-
20
- /**
21
- * What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
22
- * Service always gives the same snapshot, and the same `hash`.
23
- */
24
- export interface IReflexServiceVersionSnapshot {
25
- routes: IReflexServiceVersionRoute[];
26
- functions: IReflexServiceVersionFunction[];
27
- cors: IReflexServiceCors;
28
- rateLimitPerIpPerMinute: number;
29
- }
30
-
31
- export interface IReflexServiceVersion {
32
- id: string;
33
- serviceId: string;
34
- /** 1, 2, 3...: counted per Service. */
35
- number: number;
36
- /** 500 characters at most. */
37
- message: string | null;
38
- snapshot: IReflexServiceVersionSnapshot;
39
- /** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
40
- hash: string;
41
- publishedByUserId: string;
42
- publishedAt: Date;
43
- }
1
+ import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
+ import type { IReflexServiceCors } from './reflex-service.model';
3
+
4
+ /** A route as a version of the Service froze it. */
5
+ export interface IReflexServiceVersionRoute {
6
+ routeId: string;
7
+ method: RouteMethod;
8
+ path: string;
9
+ functionId: string;
10
+ accessMode: TriggerAccessMode;
11
+ }
12
+
13
+ /** The version of a member function a version of the Service runs. */
14
+ export interface IReflexServiceVersionFunction {
15
+ functionId: string;
16
+ functionVersionId: string;
17
+ functionVersionNumber: number;
18
+ }
19
+
20
+ /**
21
+ * What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
22
+ * Service always gives the same snapshot, and the same `hash`.
23
+ */
24
+ export interface IReflexServiceVersionSnapshot {
25
+ routes: IReflexServiceVersionRoute[];
26
+ functions: IReflexServiceVersionFunction[];
27
+ cors: IReflexServiceCors;
28
+ rateLimitPerIpPerMinute: number;
29
+ }
30
+
31
+ export interface IReflexServiceVersion {
32
+ id: string;
33
+ serviceId: string;
34
+ /** 1, 2, 3...: counted per Service. */
35
+ number: number;
36
+ /** 500 characters at most. */
37
+ message: string | null;
38
+ snapshot: IReflexServiceVersionSnapshot;
39
+ /** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
40
+ hash: string;
41
+ publishedByUserId: string;
42
+ publishedAt: Date;
43
+ }
@@ -1,46 +1,43 @@
1
- import type { ServiceType } from '../../enum';
2
-
3
- /** Bounds of a Service, its routes, versions and variables; the API and its database apply the same ones. */
4
- export const REFLEX_SERVICE_LIMITS = {
5
- /** `^[a-z0-9][a-z0-9-]{0,39}$`: the third segment of the address, immutable. */
6
- slugPattern: /^[a-z0-9][a-z0-9-]{0,39}$/,
7
- nameMaxLength: 100,
8
- corsAllowedOriginsMax: 20,
9
- rateLimitPerIpPerMinute: { min: 1, max: 6000, default: 60 },
10
- /** Segments of `[a-z0-9._~-]` or `:param`, joined by `/`, without leading or trailing slash. */
11
- routePathMaxSegments: 20,
12
- routePathMaxLength: 255,
13
- versionMessageMaxLength: 500,
14
- /** `^[A-Z][A-Z0-9_]{0,63}$`: read as `{{ config.NAME }}` in a field and `config.NAME` in code. */
15
- variableNamePattern: /^[A-Z][A-Z0-9_]{0,63}$/,
16
- variableValueMaxLength: 4096,
17
- } as const;
18
-
19
- /**
20
- * Origins a browser may call the Service from. Each is `https://host` or `https://*.domain`; `*` (any
21
- * origin) is refused when a route of the Service is not PUBLIC.
22
- */
23
- export interface IReflexServiceCors {
24
- allowedOrigins: string[];
25
- }
26
-
27
- /** A group of functions versioned, put in service and paused as one, in an application. */
28
- export interface IReflexService {
29
- id: string;
30
- applicationId: string;
31
- /** First segment of the address, `app-<8 hex>`, fixed for the application. */
32
- applicationSlug: string;
33
- /** Unique within the application. */
34
- name: string;
35
- /** Unique within the application, immutable: `/<application>/<environment>/<slug>/<route path>`. */
36
- slug: string;
37
- type: ServiceType;
38
- /** Draft: frozen by the next version. */
39
- cors: IReflexServiceCors;
40
- /** Draft: frozen by the next version. Calls per minute and per client IP, in each environment. */
41
- rateLimitPerIpPerMinute: number;
42
- createdByUserId: string;
43
- updatedByUserId: string;
44
- createdAt: Date;
45
- updatedAt: Date;
46
- }
1
+ import type { ServiceType } from '../../enum';
2
+
3
+ /** Bounds of a Service, its routes and versions; the API and its database apply the same ones. */
4
+ export const REFLEX_SERVICE_LIMITS = {
5
+ /** `^[a-z0-9][a-z0-9-]{0,39}$`: the third segment of the address, immutable. */
6
+ slugPattern: /^[a-z0-9][a-z0-9-]{0,39}$/,
7
+ nameMaxLength: 100,
8
+ corsAllowedOriginsMax: 20,
9
+ rateLimitPerIpPerMinute: { min: 1, max: 6000, default: 60 },
10
+ /** Segments of `[a-z0-9._~-]` or `:param`, joined by `/`, without leading or trailing slash. */
11
+ routePathMaxSegments: 20,
12
+ routePathMaxLength: 255,
13
+ versionMessageMaxLength: 500,
14
+ } as const;
15
+
16
+ /**
17
+ * Origins a browser may call the Service from. Each is `https://host` or `https://*.domain`; `*` (any
18
+ * origin) is refused when a route of the Service is not PUBLIC.
19
+ */
20
+ export interface IReflexServiceCors {
21
+ allowedOrigins: string[];
22
+ }
23
+
24
+ /** A group of functions versioned, put in service and paused as one, in an application. */
25
+ export interface IReflexService {
26
+ id: string;
27
+ applicationId: string;
28
+ /** First segment of the address, `app-<8 hex>`, fixed for the application. */
29
+ applicationSlug: string;
30
+ /** Unique within the application. */
31
+ name: string;
32
+ /** Unique within the application, immutable: `/<application>/<environment>/<slug>/<route path>`. */
33
+ slug: string;
34
+ type: ServiceType;
35
+ /** Draft: frozen by the next version. */
36
+ cors: IReflexServiceCors;
37
+ /** Draft: frozen by the next version. Calls per minute and per client IP, in each environment. */
38
+ rateLimitPerIpPerMinute: number;
39
+ createdByUserId: string;
40
+ updatedByUserId: string;
41
+ createdAt: Date;
42
+ updatedAt: Date;
43
+ }
@@ -1,5 +0,0 @@
1
- import type { IDeleteServiceVariableParams, IDeleteServiceVariableResponse, IGetServiceSecretStatusParams, IGetServiceSecretStatusResponse, IListServiceVariableParams, IListServiceVariableResponse, ISetServiceVariableBody, ISetServiceVariableParams, ISetServiceVariableResponse } from '../types';
2
- export declare const listServiceVariable: (params: IListServiceVariableParams) => Promise<IListServiceVariableResponse>;
3
- export declare const setServiceVariable: (params: ISetServiceVariableParams, body: ISetServiceVariableBody) => Promise<ISetServiceVariableResponse>;
4
- export declare const deleteServiceVariable: (params: IDeleteServiceVariableParams) => Promise<IDeleteServiceVariableResponse>;
5
- export declare const getServiceSecretStatus: (params: IGetServiceSecretStatusParams) => Promise<IGetServiceSecretStatusResponse>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServiceSecretStatus = exports.deleteServiceVariable = exports.setServiceVariable = exports.listServiceVariable = void 0;
4
- const __1 = require("..");
5
- const serviceUrl = (params) => `api/service/${params.applicationId}/${params.serviceId}`;
6
- const variableUrl = (params) => `${serviceUrl(params)}/variable/${params.environmentId}/${params.name}`;
7
- const listServiceVariable = async (params) => (await __1.AbyssReflexCore.axios.get(`${serviceUrl(params)}/variable`))
8
- .data;
9
- exports.listServiceVariable = listServiceVariable;
10
- const setServiceVariable = async (params, body) => (await __1.AbyssReflexCore.axios.put(variableUrl(params), body)).data;
11
- exports.setServiceVariable = setServiceVariable;
12
- const deleteServiceVariable = async (params) => (await __1.AbyssReflexCore.axios.delete(variableUrl(params))).data;
13
- exports.deleteServiceVariable = deleteServiceVariable;
14
- const getServiceSecretStatus = async (params) => (await __1.AbyssReflexCore.axios.get(`${serviceUrl(params)}/secret-status`)).data;
15
- exports.getServiceSecretStatus = getServiceSecretStatus;
16
- //# sourceMappingURL=service-variable.api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-variable.api.js","sourceRoot":"","sources":["../../src/api/service-variable.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;AAarC,MAAM,UAAU,GAAG,CAAC,MAAoD,EAAU,EAAE,CAClF,eAAe,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;AAE5D,MAAM,WAAW,GAAG,CAAC,MAKpB,EAAU,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;AAG/E,MAAM,mBAAmB,GAAG,KAAK,EACtC,MAAkC,EACK,EAAE,CACzC,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAA+B,GAAG,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;KAC9F,IAAI,CAAC;AAJG,QAAA,mBAAmB,uBAItB;AAMH,MAAM,kBAAkB,GAAG,KAAK,EACrC,MAAiC,EACjC,IAA6B,EACS,EAAE,CACxC,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAA8B,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAJpF,QAAA,kBAAkB,sBAIkE;AAG1F,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAoC,EACK,EAAE,CAC3C,CAAC,MAAM,mBAAe,CAAC,KAAK,CAAC,MAAM,CAAiC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAHpF,QAAA,qBAAqB,yBAG+D;AAM1F,MAAM,sBAAsB,GAAG,KAAK,EACzC,MAAqC,EACK,EAAE,CAC5C,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAC7B,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,CACtC,CACF,CAAC,IAAI,CAAC;AAPI,QAAA,sBAAsB,0BAO1B"}
@@ -1,5 +0,0 @@
1
- export declare enum SecretSource {
2
- PROJECT = "PROJECT",
3
- OVERRIDE = "OVERRIDE",
4
- MISSING = "MISSING"
5
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SecretSource = void 0;
4
- var SecretSource;
5
- (function (SecretSource) {
6
- SecretSource["PROJECT"] = "PROJECT";
7
- SecretSource["OVERRIDE"] = "OVERRIDE";
8
- SecretSource["MISSING"] = "MISSING";
9
- })(SecretSource || (exports.SecretSource = SecretSource = {}));
10
- //# sourceMappingURL=secret-source.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"secret-source.enum.js","sourceRoot":"","sources":["../../../src/types/enum/secret-source.enum.ts"],"names":[],"mappings":";;;AACA,IAAY,YAOX;AAPD,WAAY,YAAY;IAEtB,mCAAmB,CAAA;IAEnB,qCAAqB,CAAA;IAErB,mCAAmB,CAAA;AACrB,CAAC,EAPW,YAAY,4BAAZ,YAAY,QAOvB"}
@@ -1,23 +0,0 @@
1
- export interface IListServiceVariableParams {
2
- applicationId: string;
3
- serviceId: string;
4
- }
5
- export interface ISetServiceVariableParams {
6
- applicationId: string;
7
- serviceId: string;
8
- environmentId: string;
9
- name: string;
10
- }
11
- export interface ISetServiceVariableBody {
12
- value: string;
13
- }
14
- export interface IDeleteServiceVariableParams {
15
- applicationId: string;
16
- serviceId: string;
17
- environmentId: string;
18
- name: string;
19
- }
20
- export interface IGetServiceSecretStatusParams {
21
- applicationId: string;
22
- serviceId: string;
23
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-variable.request.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/service-variable.request.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import type { SecretSource } from '../../../enum';
2
- import type { IReflexServiceVariable } from '../../models';
3
- import type { IResponse } from '../response';
4
- export interface IListServiceVariableData {
5
- variables: IReflexServiceVariable[];
6
- }
7
- export type IListServiceVariableResponse = IResponse<IListServiceVariableData>;
8
- export interface ISetServiceVariableData {
9
- variable: IReflexServiceVariable;
10
- }
11
- export type ISetServiceVariableResponse = IResponse<ISetServiceVariableData>;
12
- export type IDeleteServiceVariableData = Record<string, never>;
13
- export type IDeleteServiceVariableResponse = IResponse<IDeleteServiceVariableData>;
14
- export interface IReflexServiceSecretStatus {
15
- name: string;
16
- secretId: string | null;
17
- sources: Record<string, SecretSource>;
18
- }
19
- export interface IGetServiceSecretStatusData {
20
- secrets: IReflexServiceSecretStatus[];
21
- }
22
- export type IGetServiceSecretStatusResponse = IResponse<IGetServiceSecretStatusData>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-variable.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/service-variable.response.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- export interface IReflexServiceVariable {
2
- id: string;
3
- serviceId: string;
4
- environmentId: string;
5
- name: string;
6
- value: string;
7
- updatedByUserId: string;
8
- createdAt: Date;
9
- updatedAt: Date;
10
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"reflex-service-variable.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-service-variable.model.ts"],"names":[],"mappings":""}
@@ -1,58 +0,0 @@
1
- import { AbyssReflexCore } from '..';
2
- import type {
3
- IDeleteServiceVariableParams,
4
- IDeleteServiceVariableResponse,
5
- IGetServiceSecretStatusParams,
6
- IGetServiceSecretStatusResponse,
7
- IListServiceVariableParams,
8
- IListServiceVariableResponse,
9
- ISetServiceVariableBody,
10
- ISetServiceVariableParams,
11
- ISetServiceVariableResponse,
12
- } from '../types';
13
-
14
- const serviceUrl = (params: { applicationId: string; serviceId: string }): string =>
15
- `api/service/${params.applicationId}/${params.serviceId}`;
16
-
17
- const variableUrl = (params: {
18
- applicationId: string;
19
- serviceId: string;
20
- environmentId: string;
21
- name: string;
22
- }): string => `${serviceUrl(params)}/variable/${params.environmentId}/${params.name}`;
23
-
24
- /** `GET .../variable`: every variable of the Service, in every environment. Needs REFLEX_READ. */
25
- export const listServiceVariable = async (
26
- params: IListServiceVariableParams,
27
- ): Promise<IListServiceVariableResponse> =>
28
- (await AbyssReflexCore.axios.get<IListServiceVariableResponse>(`${serviceUrl(params)}/variable`))
29
- .data;
30
-
31
- /**
32
- * `PUT .../variable/:environmentId/:name`: sets a variable, read by the next call. Needs
33
- * REFLEX_FUNCTION_UPDATE, and REFLEX_PUBLISH_PRODUCTION in a production environment.
34
- */
35
- export const setServiceVariable = async (
36
- params: ISetServiceVariableParams,
37
- body: ISetServiceVariableBody,
38
- ): Promise<ISetServiceVariableResponse> =>
39
- (await AbyssReflexCore.axios.put<ISetServiceVariableResponse>(variableUrl(params), body)).data;
40
-
41
- /** `DELETE .../variable/:environmentId/:name`. Rights as set. */
42
- export const deleteServiceVariable = async (
43
- params: IDeleteServiceVariableParams,
44
- ): Promise<IDeleteServiceVariableResponse> =>
45
- (await AbyssReflexCore.axios.delete<IDeleteServiceVariableResponse>(variableUrl(params))).data;
46
-
47
- /**
48
- * `GET .../secret-status`: per secret the functions read and per environment, where its value comes
49
- * from (`PROJECT`, `OVERRIDE`, `MISSING`) and the vault entry; never a value. Needs REFLEX_READ.
50
- */
51
- export const getServiceSecretStatus = async (
52
- params: IGetServiceSecretStatusParams,
53
- ): Promise<IGetServiceSecretStatusResponse> =>
54
- (
55
- await AbyssReflexCore.axios.get<IGetServiceSecretStatusResponse>(
56
- `${serviceUrl(params)}/secret-status`,
57
- )
58
- ).data;
@@ -1,9 +0,0 @@
1
- /** Where the value of a secret a Service uses comes from, in one environment. */
2
- export enum SecretSource {
3
- /** The project value of the Console vault entry. */
4
- PROJECT = 'PROJECT',
5
- /** The override the vault entry holds for this environment. */
6
- OVERRIDE = 'OVERRIDE',
7
- /** No vault entry of that name in the project. */
8
- MISSING = 'MISSING',
9
- }
@@ -1,29 +0,0 @@
1
- export interface IListServiceVariableParams {
2
- applicationId: string;
3
- serviceId: string;
4
- }
5
-
6
- export interface ISetServiceVariableParams {
7
- applicationId: string;
8
- serviceId: string;
9
- environmentId: string;
10
- /** `^[A-Z][A-Z0-9_]{0,63}$`. */
11
- name: string;
12
- }
13
- /** A production environment needs REFLEX_PUBLISH_PRODUCTION, any other REFLEX_FUNCTION_UPDATE. */
14
- export interface ISetServiceVariableBody {
15
- /** 4096 characters at most. */
16
- value: string;
17
- }
18
-
19
- export interface IDeleteServiceVariableParams {
20
- applicationId: string;
21
- serviceId: string;
22
- environmentId: string;
23
- name: string;
24
- }
25
-
26
- export interface IGetServiceSecretStatusParams {
27
- applicationId: string;
28
- serviceId: string;
29
- }
@@ -1,31 +0,0 @@
1
- import type { SecretSource } from '../../../enum';
2
- import type { IReflexServiceVariable } from '../../models';
3
- import type { IResponse } from '../response';
4
-
5
- export interface IListServiceVariableData {
6
- /** Every variable of the Service, in every environment. */
7
- variables: IReflexServiceVariable[];
8
- }
9
- export type IListServiceVariableResponse = IResponse<IListServiceVariableData>;
10
-
11
- export interface ISetServiceVariableData {
12
- variable: IReflexServiceVariable;
13
- }
14
- export type ISetServiceVariableResponse = IResponse<ISetServiceVariableData>;
15
-
16
- export type IDeleteServiceVariableData = Record<string, never>;
17
- export type IDeleteServiceVariableResponse = IResponse<IDeleteServiceVariableData>;
18
-
19
- /** A secret the functions of the Service use, and where its value comes from in each environment. Never the value. */
20
- export interface IReflexServiceSecretStatus {
21
- name: string;
22
- /** The Console vault entry of that name in the project; null when there is none. */
23
- secretId: string | null;
24
- /** By environment id of the application. */
25
- sources: Record<string, SecretSource>;
26
- }
27
-
28
- export interface IGetServiceSecretStatusData {
29
- secrets: IReflexServiceSecretStatus[];
30
- }
31
- export type IGetServiceSecretStatusResponse = IResponse<IGetServiceSecretStatusData>;
@@ -1,16 +0,0 @@
1
- /**
2
- * A non-secret value of a Service in one environment, read as `{{ config.NAME }}` in a field and
3
- * `config.NAME` in code. Not versioned: a change applies to the next executions.
4
- */
5
- export interface IReflexServiceVariable {
6
- id: string;
7
- serviceId: string;
8
- environmentId: string;
9
- /** `^[A-Z][A-Z0-9_]{0,63}$`, unique per Service and environment. */
10
- name: string;
11
- /** 4096 characters at most. */
12
- value: string;
13
- updatedByUserId: string;
14
- createdAt: Date;
15
- updatedAt: Date;
16
- }