@abyss-project/reflex 6.5.0 → 6.9.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 -2
- package/dist/api/index.js +1 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/reflex-admin.admin.api.d.ts +5 -0
- package/dist/api/reflex-admin.admin.api.js +18 -0
- package/dist/api/reflex-admin.admin.api.js.map +1 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -4
- package/dist/types/enum/index.js +2 -4
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/reflex-abuse-rule.enum.d.ts +5 -0
- package/dist/types/enum/reflex-abuse-rule.enum.js +10 -0
- package/dist/types/enum/reflex-abuse-rule.enum.js.map +1 -0
- package/dist/types/enum/reflex-admin-hold-kind.enum.d.ts +4 -0
- package/dist/types/enum/reflex-admin-hold-kind.enum.js +9 -0
- package/dist/types/enum/reflex-admin-hold-kind.enum.js.map +1 -0
- package/dist/types/enum/reflex-error-code.enum.d.ts +3 -2
- package/dist/types/enum/reflex-error-code.enum.js +2 -1
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/trigger-access-mode.enum.d.ts +1 -2
- package/dist/types/enum/trigger-access-mode.enum.js +0 -1
- package/dist/types/enum/trigger-access-mode.enum.js.map +1 -1
- package/dist/types/interface/api/requests/index.d.ts +1 -2
- package/dist/types/interface/api/requests/index.js +1 -2
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/reflex-admin.admin.request.d.ts +21 -0
- package/dist/types/interface/api/requests/{code-environment.request.js → reflex-admin.admin.request.js} +1 -1
- package/dist/types/interface/api/requests/reflex-admin.admin.request.js.map +1 -0
- package/dist/types/interface/api/requests/service.request.d.ts +1 -2
- package/dist/types/interface/api/responses/index.d.ts +1 -2
- package/dist/types/interface/api/responses/index.js +1 -2
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/reflex-admin.admin.response.d.ts +19 -0
- package/dist/types/interface/api/{requests/service-template.request.js → responses/reflex-admin.admin.response.js} +1 -1
- package/dist/types/interface/api/responses/reflex-admin.admin.response.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +1 -3
- package/dist/types/interface/models/index.js +1 -3
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-admin-hold.model.d.ts +44 -0
- package/dist/types/interface/models/reflex-admin-hold.model.js +11 -0
- package/dist/types/interface/models/reflex-admin-hold.model.js.map +1 -0
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -1
- package/dist/types/interface/models/reflex-service.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-service.model.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +1 -2
- package/src/api/reflex-admin.admin.api.test.ts +52 -0
- package/src/api/reflex-admin.admin.api.ts +53 -0
- package/src/api/service-route.api.ts +74 -74
- package/src/index.ts +506 -497
- package/src/types/enum/index.ts +2 -4
- package/src/types/enum/reflex-abuse-rule.enum.ts +9 -0
- package/src/types/enum/reflex-admin-hold-kind.enum.ts +7 -0
- package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
- package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
- package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
- package/src/types/enum/reflex-error-code.enum.ts +7 -5
- package/src/types/enum/trigger-access-mode.enum.ts +12 -16
- package/src/types/interface/api/requests/index.ts +1 -2
- package/src/types/interface/api/requests/reflex-admin.admin.request.ts +26 -0
- package/src/types/interface/api/requests/service.request.ts +1 -7
- package/src/types/interface/api/responses/index.ts +1 -2
- package/src/types/interface/api/responses/reflex-admin.admin.response.ts +25 -0
- package/src/types/interface/api/responses/service-route.response.ts +31 -31
- package/src/types/interface/models/index.ts +1 -3
- package/src/types/interface/models/reflex-admin-hold.model.ts +55 -0
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +51 -48
- package/src/types/interface/models/reflex-service-limits.model.ts +92 -92
- package/src/types/interface/models/reflex-service-version.model.ts +64 -64
- package/src/types/interface/models/reflex-service.model.ts +50 -47
- package/dist/api/code-environment.api.d.ts +0 -2
- package/dist/api/code-environment.api.js +0 -7
- package/dist/api/code-environment.api.js.map +0 -1
- package/dist/api/service-template.api.d.ts +0 -2
- package/dist/api/service-template.api.js +0 -7
- package/dist/api/service-template.api.js.map +0 -1
- package/dist/code/index.d.ts +0 -1
- package/dist/code/index.js +0 -18
- package/dist/code/index.js.map +0 -1
- package/dist/code/reflex-code-declarations.d.ts +0 -1
- package/dist/code/reflex-code-declarations.js +0 -644
- package/dist/code/reflex-code-declarations.js.map +0 -1
- package/dist/types/enum/reflex-code-diagnostic-category.enum.d.ts +0 -6
- package/dist/types/enum/reflex-code-diagnostic-category.enum.js +0 -11
- package/dist/types/enum/reflex-code-diagnostic-category.enum.js.map +0 -1
- package/dist/types/enum/service-template-follow-up-kind.enum.d.ts +0 -10
- package/dist/types/enum/service-template-follow-up-kind.enum.js +0 -15
- package/dist/types/enum/service-template-follow-up-kind.enum.js.map +0 -1
- package/dist/types/enum/service-template-id.enum.d.ts +0 -10
- package/dist/types/enum/service-template-id.enum.js +0 -15
- package/dist/types/enum/service-template-id.enum.js.map +0 -1
- package/dist/types/enum/service-template-parameter-kind.enum.d.ts +0 -4
- package/dist/types/enum/service-template-parameter-kind.enum.js +0 -9
- package/dist/types/enum/service-template-parameter-kind.enum.js.map +0 -1
- package/dist/types/interface/api/requests/code-environment.request.d.ts +0 -3
- package/dist/types/interface/api/requests/code-environment.request.js.map +0 -1
- package/dist/types/interface/api/requests/service-template.request.d.ts +0 -3
- package/dist/types/interface/api/requests/service-template.request.js.map +0 -1
- package/dist/types/interface/api/responses/code-environment.response.d.ts +0 -6
- package/dist/types/interface/api/responses/code-environment.response.js +0 -3
- package/dist/types/interface/api/responses/code-environment.response.js.map +0 -1
- package/dist/types/interface/api/responses/service-template.response.d.ts +0 -6
- package/dist/types/interface/api/responses/service-template.response.js +0 -3
- package/dist/types/interface/api/responses/service-template.response.js.map +0 -1
- package/dist/types/interface/models/reflex-code-diagnostic.model.d.ts +0 -10
- package/dist/types/interface/models/reflex-code-diagnostic.model.js +0 -5
- package/dist/types/interface/models/reflex-code-diagnostic.model.js.map +0 -1
- package/dist/types/interface/models/reflex-code-environment.model.d.ts +0 -9
- package/dist/types/interface/models/reflex-code-environment.model.js +0 -3
- package/dist/types/interface/models/reflex-code-environment.model.js.map +0 -1
- package/dist/types/interface/models/reflex-service-template.model.d.ts +0 -33
- package/dist/types/interface/models/reflex-service-template.model.js +0 -3
- package/dist/types/interface/models/reflex-service-template.model.js.map +0 -1
- package/src/api/code-environment.api.ts +0 -15
- package/src/api/service-template.api.test.ts +0 -41
- package/src/api/service-template.api.ts +0 -12
- package/src/code/index.ts +0 -1
- package/src/code/reflex-code-declarations.ts +0 -646
- package/src/types/enum/reflex-code-diagnostic-category.enum.ts +0 -11
- package/src/types/enum/service-template-follow-up-kind.enum.ts +0 -19
- package/src/types/enum/service-template-id.enum.ts +0 -19
- package/src/types/enum/service-template-parameter-kind.enum.ts +0 -7
- package/src/types/interface/api/requests/code-environment.request.ts +0 -3
- package/src/types/interface/api/requests/service-template.request.ts +0 -3
- package/src/types/interface/api/responses/code-environment.response.ts +0 -7
- package/src/types/interface/api/responses/service-template.response.ts +0 -8
- package/src/types/interface/models/reflex-code-diagnostic.model.ts +0 -15
- package/src/types/interface/models/reflex-code-environment.model.ts +0 -17
- package/src/types/interface/models/reflex-service-template.model.ts +0 -55
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import type { ServiceBlockReason } from '../../enum';
|
|
2
|
-
|
|
3
|
-
/** Bounds of the monthly spend cap of a Service and of its alerts, whatever its type. */
|
|
4
|
-
export const REFLEX_SERVICE_SPEND_LIMITS = {
|
|
5
|
-
/** Monthly spend cap, in cents: 10 EUR by default, from 1 to 500 EUR. */
|
|
6
|
-
monthlySpendCapDefaultCents: 1000,
|
|
7
|
-
monthlySpendCapMinCents: 100,
|
|
8
|
-
monthlySpendCapMaxCents: 50000,
|
|
9
|
-
/** Alert thresholds: at most 5 values, each from 1 to 100 (percent). */
|
|
10
|
-
alertThresholdsMax: 5,
|
|
11
|
-
alertThresholdMin: 1,
|
|
12
|
-
alertThresholdMax: 100,
|
|
13
|
-
/** Thresholds a Service starts with, for the monthly spend cap. */
|
|
14
|
-
spendCapDefaultThresholds: [80, 100],
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The monthly spend cap of a Service: all its consumption of the month, included credits too, at the price of
|
|
19
|
-
* the lot.
|
|
20
|
-
*/
|
|
21
|
-
export interface IReflexServiceMonthlySpendCap {
|
|
22
|
-
capCents: number;
|
|
23
|
-
spentCents: number;
|
|
24
|
-
/** `spentCents / capCents`, in percent; may go past 100. */
|
|
25
|
-
usedPercent: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** The credits of the month of a whole organization: billing data, only for a member who may read the billing. */
|
|
29
|
-
export interface IReflexOrganizationCredits {
|
|
30
|
-
/**
|
|
31
|
-
* The credits the plan of the organization includes this month (effective limit, packs included), in
|
|
32
|
-
* millicredits: the same threshold that stops the Services. `null` for an unlimited plan.
|
|
33
|
-
*/
|
|
34
|
-
includedMillicredits: number | null;
|
|
35
|
-
/**
|
|
36
|
-
* What all the Services of the organization consumed this month, in millicredits: what abyss-main holds plus what
|
|
37
|
-
* the Reflex report has not declared yet. The stop compares this total to `includedMillicredits`.
|
|
38
|
-
*/
|
|
39
|
-
consumedMillicredits: number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Credits of the month a Service consumed, and its overage setting. */
|
|
43
|
-
export interface IReflexServiceCredits {
|
|
44
|
-
/** `YYYY-MM`. */
|
|
45
|
-
month: string;
|
|
46
|
-
consumedMillicredits: number;
|
|
47
|
-
/**
|
|
48
|
-
* The credits of the whole organization. `null` when the reader may not see the billing of the organization
|
|
49
|
-
* (no `ORG_BILLING_READ`), or when abyss-main cannot say whether they may.
|
|
50
|
-
*/
|
|
51
|
-
organizationCredits: IReflexOrganizationCredits | null;
|
|
52
|
-
/** True when the Service bills overage past the credits of the organization. */
|
|
53
|
-
overageEnabled: boolean;
|
|
54
|
-
/** True when the organization allows overage of the credits metric at all. */
|
|
55
|
-
overageAllowedByOrganization: boolean;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Alert settings of one limit of a Service. */
|
|
59
|
-
export interface IReflexServiceAlertSettings {
|
|
60
|
-
/** Percent values, at most 5, each from 1 to 100. */
|
|
61
|
-
thresholds: number[];
|
|
62
|
-
email: boolean;
|
|
63
|
-
inApp: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Alert settings of a Service in one environment. */
|
|
67
|
-
export interface IReflexServiceAlerts {
|
|
68
|
-
monthlySpendCap: IReflexServiceAlertSettings;
|
|
69
|
-
/** The event rate of a bot; absent for any other type of Service. */
|
|
70
|
-
rate?: IReflexServiceAlertSettings;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** What stops a Service in one environment, by its limits. */
|
|
74
|
-
export interface IReflexServiceBlock {
|
|
75
|
-
/**
|
|
76
|
-
* `CREDITS_EXHAUSTED` stops a bot entirely, and every route and task of an HTTP Service. `BUDGET_REACHED` stops
|
|
77
|
-
* every route and task of an HTTP Service; for a bot, only its events stop.
|
|
78
|
-
*/
|
|
79
|
-
reason: ServiceBlockReason;
|
|
80
|
-
since: Date;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** The credits, the monthly spend cap, the alerts and the stop of a Service in one environment. */
|
|
84
|
-
export interface IReflexServiceEnvironmentLimits {
|
|
85
|
-
environmentId: string;
|
|
86
|
-
/** Credits of the month and the overage setting; null while abyss-main, which holds the credits, does not answer. */
|
|
87
|
-
credits: IReflexServiceCredits | null;
|
|
88
|
-
monthlySpendCap: IReflexServiceMonthlySpendCap;
|
|
89
|
-
alerts: IReflexServiceAlerts;
|
|
90
|
-
/** Null when nothing stops the Service there. */
|
|
91
|
-
block: IReflexServiceBlock | null;
|
|
92
|
-
}
|
|
1
|
+
import type { ServiceBlockReason } from '../../enum';
|
|
2
|
+
|
|
3
|
+
/** Bounds of the monthly spend cap of a Service and of its alerts, whatever its type. */
|
|
4
|
+
export const REFLEX_SERVICE_SPEND_LIMITS = {
|
|
5
|
+
/** Monthly spend cap, in cents: 10 EUR by default, from 1 to 500 EUR. */
|
|
6
|
+
monthlySpendCapDefaultCents: 1000,
|
|
7
|
+
monthlySpendCapMinCents: 100,
|
|
8
|
+
monthlySpendCapMaxCents: 50000,
|
|
9
|
+
/** Alert thresholds: at most 5 values, each from 1 to 100 (percent). */
|
|
10
|
+
alertThresholdsMax: 5,
|
|
11
|
+
alertThresholdMin: 1,
|
|
12
|
+
alertThresholdMax: 100,
|
|
13
|
+
/** Thresholds a Service starts with, for the monthly spend cap. */
|
|
14
|
+
spendCapDefaultThresholds: [80, 100],
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The monthly spend cap of a Service: all its consumption of the month, included credits too, at the price of
|
|
19
|
+
* the lot.
|
|
20
|
+
*/
|
|
21
|
+
export interface IReflexServiceMonthlySpendCap {
|
|
22
|
+
capCents: number;
|
|
23
|
+
spentCents: number;
|
|
24
|
+
/** `spentCents / capCents`, in percent; may go past 100. */
|
|
25
|
+
usedPercent: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The credits of the month of a whole organization: billing data, only for a member who may read the billing. */
|
|
29
|
+
export interface IReflexOrganizationCredits {
|
|
30
|
+
/**
|
|
31
|
+
* The credits the plan of the organization includes this month (effective limit, packs included), in
|
|
32
|
+
* millicredits: the same threshold that stops the Services. `null` for an unlimited plan.
|
|
33
|
+
*/
|
|
34
|
+
includedMillicredits: number | null;
|
|
35
|
+
/**
|
|
36
|
+
* What all the Services of the organization consumed this month, in millicredits: what abyss-main holds plus what
|
|
37
|
+
* the Reflex report has not declared yet. The stop compares this total to `includedMillicredits`.
|
|
38
|
+
*/
|
|
39
|
+
consumedMillicredits: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Credits of the month a Service consumed, and its overage setting. */
|
|
43
|
+
export interface IReflexServiceCredits {
|
|
44
|
+
/** `YYYY-MM`. */
|
|
45
|
+
month: string;
|
|
46
|
+
consumedMillicredits: number;
|
|
47
|
+
/**
|
|
48
|
+
* The credits of the whole organization. `null` when the reader may not see the billing of the organization
|
|
49
|
+
* (no `ORG_BILLING_READ`), or when abyss-main cannot say whether they may.
|
|
50
|
+
*/
|
|
51
|
+
organizationCredits: IReflexOrganizationCredits | null;
|
|
52
|
+
/** True when the Service bills overage past the credits of the organization. */
|
|
53
|
+
overageEnabled: boolean;
|
|
54
|
+
/** True when the organization allows overage of the credits metric at all. */
|
|
55
|
+
overageAllowedByOrganization: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Alert settings of one limit of a Service. */
|
|
59
|
+
export interface IReflexServiceAlertSettings {
|
|
60
|
+
/** Percent values, at most 5, each from 1 to 100. */
|
|
61
|
+
thresholds: number[];
|
|
62
|
+
email: boolean;
|
|
63
|
+
inApp: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Alert settings of a Service in one environment. */
|
|
67
|
+
export interface IReflexServiceAlerts {
|
|
68
|
+
monthlySpendCap: IReflexServiceAlertSettings;
|
|
69
|
+
/** The event rate of a bot; absent for any other type of Service. */
|
|
70
|
+
rate?: IReflexServiceAlertSettings;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** What stops a Service in one environment, by its limits. */
|
|
74
|
+
export interface IReflexServiceBlock {
|
|
75
|
+
/**
|
|
76
|
+
* `CREDITS_EXHAUSTED` stops a bot entirely, and every route and task of an HTTP Service. `BUDGET_REACHED` stops
|
|
77
|
+
* every route and task of an HTTP Service; for a bot, only its events stop.
|
|
78
|
+
*/
|
|
79
|
+
reason: ServiceBlockReason;
|
|
80
|
+
since: Date;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The credits, the monthly spend cap, the alerts and the stop of a Service in one environment. */
|
|
84
|
+
export interface IReflexServiceEnvironmentLimits {
|
|
85
|
+
environmentId: string;
|
|
86
|
+
/** Credits of the month and the overage setting; null while abyss-main, which holds the credits, does not answer. */
|
|
87
|
+
credits: IReflexServiceCredits | null;
|
|
88
|
+
monthlySpendCap: IReflexServiceMonthlySpendCap;
|
|
89
|
+
alerts: IReflexServiceAlerts;
|
|
90
|
+
/** Null when nothing stops the Service there. */
|
|
91
|
+
block: IReflexServiceBlock | null;
|
|
92
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import type { RouteMethod, TriggerAccessMode } from '../../enum';
|
|
2
|
-
import type {
|
|
3
|
-
IReflexDiscordCommandSnapshot,
|
|
4
|
-
IReflexDiscordComponentSnapshot,
|
|
5
|
-
} from './reflex-discord.model';
|
|
6
|
-
import type { IReflexDiscordEventSnapshot } from './reflex-discord-event.model';
|
|
7
|
-
import type { IReflexRouteContract } from './reflex-route-contract.model';
|
|
8
|
-
import type { IReflexServiceCors } from './reflex-service.model';
|
|
9
|
-
import type { IReflexTaskSnapshot } from './reflex-task.model';
|
|
10
|
-
|
|
11
|
-
/** A route as a version of the Service froze it. */
|
|
12
|
-
export interface IReflexServiceVersionRoute {
|
|
13
|
-
routeId: string;
|
|
14
|
-
method: RouteMethod;
|
|
15
|
-
path: string;
|
|
16
|
-
functionId: string;
|
|
17
|
-
accessMode: TriggerAccessMode;
|
|
18
|
-
/** The contract of the route; absent for a route without contract, so the hash of other versions is unchanged. */
|
|
19
|
-
contract?: IReflexRouteContract;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** The version of a member function a version of the Service runs. */
|
|
23
|
-
export interface IReflexServiceVersionFunction {
|
|
24
|
-
functionId: string;
|
|
25
|
-
functionVersionId: string;
|
|
26
|
-
functionVersionNumber: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** What a version of a Discord bot freezes: its commands and components, identifiers included. */
|
|
30
|
-
export interface IReflexServiceVersionDiscord {
|
|
31
|
-
commands: IReflexDiscordCommandSnapshot[];
|
|
32
|
-
components: IReflexDiscordComponentSnapshot[];
|
|
33
|
-
/** The event triggers; absent when the bot has none, so the hash of other versions is unchanged. */
|
|
34
|
-
events?: IReflexDiscordEventSnapshot[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
|
|
39
|
-
* Service always gives the same snapshot, and the same `hash`.
|
|
40
|
-
*/
|
|
41
|
-
export interface IReflexServiceVersionSnapshot {
|
|
42
|
-
routes: IReflexServiceVersionRoute[];
|
|
43
|
-
functions: IReflexServiceVersionFunction[];
|
|
44
|
-
cors: IReflexServiceCors;
|
|
45
|
-
rateLimitPerIpPerMinute: number;
|
|
46
|
-
/** Only a `DISCORD_BOT` Service has it (its `routes` are then empty); absent otherwise, so the hash of other versions is unchanged. */
|
|
47
|
-
discord?: IReflexServiceVersionDiscord;
|
|
48
|
-
/** The tasks of the Service, by name; absent when it has none, so the hash of other versions is unchanged. */
|
|
49
|
-
tasks?: IReflexTaskSnapshot[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface IReflexServiceVersion {
|
|
53
|
-
id: string;
|
|
54
|
-
serviceId: string;
|
|
55
|
-
/** 1, 2, 3...: counted per Service. */
|
|
56
|
-
number: number;
|
|
57
|
-
/** 500 characters at most. */
|
|
58
|
-
message: string | null;
|
|
59
|
-
snapshot: IReflexServiceVersionSnapshot;
|
|
60
|
-
/** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
|
|
61
|
-
hash: string;
|
|
62
|
-
publishedByUserId: string;
|
|
63
|
-
publishedAt: Date;
|
|
64
|
-
}
|
|
1
|
+
import type { RouteMethod, TriggerAccessMode } from '../../enum';
|
|
2
|
+
import type {
|
|
3
|
+
IReflexDiscordCommandSnapshot,
|
|
4
|
+
IReflexDiscordComponentSnapshot,
|
|
5
|
+
} from './reflex-discord.model';
|
|
6
|
+
import type { IReflexDiscordEventSnapshot } from './reflex-discord-event.model';
|
|
7
|
+
import type { IReflexRouteContract } from './reflex-route-contract.model';
|
|
8
|
+
import type { IReflexServiceCors } from './reflex-service.model';
|
|
9
|
+
import type { IReflexTaskSnapshot } from './reflex-task.model';
|
|
10
|
+
|
|
11
|
+
/** A route as a version of the Service froze it. */
|
|
12
|
+
export interface IReflexServiceVersionRoute {
|
|
13
|
+
routeId: string;
|
|
14
|
+
method: RouteMethod;
|
|
15
|
+
path: string;
|
|
16
|
+
functionId: string;
|
|
17
|
+
accessMode: TriggerAccessMode;
|
|
18
|
+
/** The contract of the route; absent for a route without contract, so the hash of other versions is unchanged. */
|
|
19
|
+
contract?: IReflexRouteContract;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The version of a member function a version of the Service runs. */
|
|
23
|
+
export interface IReflexServiceVersionFunction {
|
|
24
|
+
functionId: string;
|
|
25
|
+
functionVersionId: string;
|
|
26
|
+
functionVersionNumber: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** What a version of a Discord bot freezes: its commands and components, identifiers included. */
|
|
30
|
+
export interface IReflexServiceVersionDiscord {
|
|
31
|
+
commands: IReflexDiscordCommandSnapshot[];
|
|
32
|
+
components: IReflexDiscordComponentSnapshot[];
|
|
33
|
+
/** The event triggers; absent when the bot has none, so the hash of other versions is unchanged. */
|
|
34
|
+
events?: IReflexDiscordEventSnapshot[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
|
|
39
|
+
* Service always gives the same snapshot, and the same `hash`.
|
|
40
|
+
*/
|
|
41
|
+
export interface IReflexServiceVersionSnapshot {
|
|
42
|
+
routes: IReflexServiceVersionRoute[];
|
|
43
|
+
functions: IReflexServiceVersionFunction[];
|
|
44
|
+
cors: IReflexServiceCors;
|
|
45
|
+
rateLimitPerIpPerMinute: number;
|
|
46
|
+
/** Only a `DISCORD_BOT` Service has it (its `routes` are then empty); absent otherwise, so the hash of other versions is unchanged. */
|
|
47
|
+
discord?: IReflexServiceVersionDiscord;
|
|
48
|
+
/** The tasks of the Service, by name; absent when it has none, so the hash of other versions is unchanged. */
|
|
49
|
+
tasks?: IReflexTaskSnapshot[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface IReflexServiceVersion {
|
|
53
|
+
id: string;
|
|
54
|
+
serviceId: string;
|
|
55
|
+
/** 1, 2, 3...: counted per Service. */
|
|
56
|
+
number: number;
|
|
57
|
+
/** 500 characters at most. */
|
|
58
|
+
message: string | null;
|
|
59
|
+
snapshot: IReflexServiceVersionSnapshot;
|
|
60
|
+
/** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
|
|
61
|
+
hash: string;
|
|
62
|
+
publishedByUserId: string;
|
|
63
|
+
publishedAt: Date;
|
|
64
|
+
}
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import type { ServiceType } from '../../enum';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import type { ServiceType } from '../../enum';
|
|
2
|
+
import type { IReflexAdminHold } from './reflex-admin-hold.model';
|
|
3
|
+
|
|
4
|
+
/** Bounds of a Service, its routes and versions; the API and its database apply the same ones. */
|
|
5
|
+
export const REFLEX_SERVICE_LIMITS = {
|
|
6
|
+
/** `^[a-z0-9][a-z0-9-]{0,39}$`: the third segment of the address, immutable. */
|
|
7
|
+
slugPattern: /^[a-z0-9][a-z0-9-]{0,39}$/,
|
|
8
|
+
nameMaxLength: 100,
|
|
9
|
+
corsAllowedOriginsMax: 20,
|
|
10
|
+
rateLimitPerIpPerMinute: { min: 1, max: 6000, default: 60 },
|
|
11
|
+
/** Segments of `[a-z0-9._~-]` or `:param`, joined by `/`, without leading or trailing slash. */
|
|
12
|
+
routePathMaxSegments: 20,
|
|
13
|
+
routePathMaxLength: 255,
|
|
14
|
+
versionMessageMaxLength: 500,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Origins a browser may call the Service from. Each is `https://host` or `https://*.domain`; `*` (any
|
|
19
|
+
* origin) is refused when a route of the Service is not PUBLIC.
|
|
20
|
+
*/
|
|
21
|
+
export interface IReflexServiceCors {
|
|
22
|
+
allowedOrigins: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A group of functions versioned, put in service and paused as one, in an application. */
|
|
26
|
+
export interface IReflexService {
|
|
27
|
+
id: string;
|
|
28
|
+
applicationId: string;
|
|
29
|
+
/** First segment of the address, `app-<8 hex>`, fixed for the application. */
|
|
30
|
+
applicationSlug: string;
|
|
31
|
+
/** Unique within the application. */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Unique within the application, immutable: `/<application>/<environment>/<slug>/<route path>`. */
|
|
34
|
+
slug: string;
|
|
35
|
+
type: ServiceType;
|
|
36
|
+
/** Vault entry (secret) holding the Discord bot token, one value per environment; null for other types and until chosen. */
|
|
37
|
+
discordTokenSecretId: string | null;
|
|
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
|
+
/** How many versions of the Service the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
|
|
43
|
+
versionsKept: number;
|
|
44
|
+
/** The holds Abyss put on the Service, one per environment at most; empty when none. */
|
|
45
|
+
adminHolds: IReflexAdminHold[];
|
|
46
|
+
createdByUserId: string;
|
|
47
|
+
updatedByUserId: string;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCodeEnvironment = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
const getCodeEnvironment = async (params) => (await __1.AbyssReflexCore.axios.get(`api/code-environment/${params.applicationId}`)).data;
|
|
6
|
-
exports.getCodeEnvironment = getCodeEnvironment;
|
|
7
|
-
//# sourceMappingURL=code-environment.api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-environment.api.js","sourceRoot":"","sources":["../../src/api/code-environment.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;AAO9B,MAAM,kBAAkB,GAAG,KAAK,EACrC,MAAiC,EACK,EAAE,CACxC,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAC7B,wBAAwB,MAAM,CAAC,aAAa,EAAE,CAC/C,CACF,CAAC,IAAI,CAAC;AAPI,QAAA,kBAAkB,sBAOtB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listServiceTemplate = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
const listServiceTemplate = async (params) => (await __1.AbyssReflexCore.axios.get(`api/service-template/${params.applicationId}`)).data;
|
|
6
|
-
exports.listServiceTemplate = listServiceTemplate;
|
|
7
|
-
//# sourceMappingURL=service-template.api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-template.api.js","sourceRoot":"","sources":["../../src/api/service-template.api.ts"],"names":[],"mappings":";;;AAAA,0BAAqC;AAI9B,MAAM,mBAAmB,GAAG,KAAK,EACtC,MAAkC,EACK,EAAE,CACzC,CACE,MAAM,mBAAe,CAAC,KAAK,CAAC,GAAG,CAC7B,wBAAwB,MAAM,CAAC,aAAa,EAAE,CAC/C,CACF,CAAC,IAAI,CAAC;AAPI,QAAA,mBAAmB,uBAOvB"}
|
package/dist/code/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './reflex-code-declarations';
|
package/dist/code/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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-code-declarations"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/code/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/code/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const REFLEX_CODE_DECLARATIONS: string;
|