@abyss-project/reflex 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/service-task.api.d.ts +9 -0
- package/dist/api/service-task.api.js +24 -0
- package/dist/api/service-task.api.js.map +1 -0
- package/dist/api/service-version.api.d.ts +2 -1
- package/dist/api/service-version.api.js +3 -1
- package/dist/api/service-version.api.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/reflex-error-code.enum.d.ts +2 -1
- package/dist/types/enum/reflex-error-code.enum.js +1 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/schedule-sync-status.enum.d.ts +5 -0
- package/dist/types/enum/schedule-sync-status.enum.js +10 -0
- package/dist/types/enum/schedule-sync-status.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-origin.enum.d.ts +4 -0
- package/dist/types/enum/scheduled-run-origin.enum.js +9 -0
- package/dist/types/enum/scheduled-run-origin.enum.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +2 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +4 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +1 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-task.request.d.ts +54 -0
- package/dist/types/interface/api/requests/service-task.request.js +3 -0
- package/dist/types/interface/api/requests/service-task.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-version.request.d.ts +4 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +1 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/service-task.response.d.ts +31 -0
- package/dist/types/interface/api/responses/service-task.response.js +3 -0
- package/dist/types/interface/api/responses/service-task.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-version.response.d.ts +13 -1
- package/dist/types/interface/models/index.d.ts +1 -0
- package/dist/types/interface/models/index.js +1 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-run.model.d.ts +3 -1
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +4 -1
- package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-task.model.d.ts +35 -0
- package/dist/types/interface/models/reflex-task.model.js +15 -0
- package/dist/types/interface/models/reflex-task.model.js.map +1 -0
- package/package.json +10 -15
- package/src/api/index.ts +1 -0
- package/src/api/service-task.api.test.ts +124 -0
- package/src/api/service-task.api.ts +122 -0
- package/src/api/service-version.api.ts +15 -0
- package/src/api/service.api.test.ts +6 -0
- package/src/index.ts +29 -0
- package/src/types/enum/access-grant-status.enum.ts +12 -12
- package/src/types/enum/access-kind.enum.ts +7 -7
- package/src/types/enum/configuration-read-as.enum.ts +5 -5
- package/src/types/enum/discord-activity-type.enum.ts +9 -9
- package/src/types/enum/discord-component-kind.enum.ts +7 -7
- package/src/types/enum/discord-gateway-failure-code.enum.ts +9 -9
- package/src/types/enum/discord-gateway-state.enum.ts +11 -11
- package/src/types/enum/discord-option-type.enum.ts +12 -12
- package/src/types/enum/discord-presence-status.enum.ts +8 -8
- package/src/types/enum/discord-sync-status.enum.ts +6 -6
- package/src/types/enum/discord-token-state.enum.ts +11 -11
- package/src/types/enum/execution-mode.enum.ts +9 -9
- package/src/types/enum/execution-profile.enum.ts +20 -20
- package/src/types/enum/execution-settings-source.enum.ts +9 -9
- package/src/types/enum/health-status.enum.ts +4 -4
- package/src/types/enum/index.ts +31 -29
- package/src/types/enum/reflex-error-code.enum.ts +39 -37
- package/src/types/enum/route-method.enum.ts +9 -9
- package/src/types/enum/run-log-level.enum.ts +6 -6
- package/src/types/enum/run-mode.enum.ts +11 -11
- package/src/types/enum/run-status.enum.ts +11 -11
- package/src/types/enum/run-step-status.enum.ts +7 -7
- package/src/types/enum/schedule-sync-status.enum.ts +6 -0
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -0
- package/src/types/enum/service-deployment-action.enum.ts +11 -11
- package/src/types/enum/service-deployment-status.enum.ts +5 -5
- package/src/types/enum/service-type.enum.ts +9 -9
- package/src/types/enum/service-version-change-kind.enum.ts +6 -6
- package/src/types/enum/trace-effect-type.enum.ts +12 -12
- package/src/types/enum/trigger-access-mode.enum.ts +12 -12
- package/src/types/enum/vault-value-source.enum.ts +12 -12
- package/src/types/enum/vault-visibility.enum.ts +5 -5
- package/src/types/index.ts +2 -2
- package/src/types/interface/api/index.ts +3 -3
- package/src/types/interface/api/requests/function-access.request.ts +25 -25
- package/src/types/interface/api/requests/function-run.request.ts +30 -26
- package/src/types/interface/api/requests/function-settings.request.ts +27 -27
- package/src/types/interface/api/requests/function-test.request.ts +39 -24
- package/src/types/interface/api/requests/function-version.request.ts +20 -20
- package/src/types/interface/api/requests/function.request.ts +36 -36
- package/src/types/interface/api/requests/index.ts +13 -12
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
- package/src/types/interface/api/requests/service-discord.request.ts +128 -128
- package/src/types/interface/api/requests/service-route.request.ts +44 -44
- package/src/types/interface/api/requests/service-task.request.ts +66 -0
- package/src/types/interface/api/requests/service-version.request.ts +24 -19
- package/src/types/interface/api/requests/service.request.ts +46 -46
- package/src/types/interface/api/response.ts +4 -4
- package/src/types/interface/api/responses/function-access.response.ts +17 -17
- package/src/types/interface/api/responses/function-run.response.ts +18 -18
- package/src/types/interface/api/responses/function-settings.response.ts +36 -36
- package/src/types/interface/api/responses/function-test.response.ts +12 -12
- package/src/types/interface/api/responses/function-version.response.ts +31 -31
- package/src/types/interface/api/responses/function.response.ts +25 -25
- package/src/types/interface/api/responses/index.ts +13 -12
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
- package/src/types/interface/api/responses/service-discord.response.ts +72 -72
- package/src/types/interface/api/responses/service-route.response.ts +31 -31
- package/src/types/interface/api/responses/service-task.response.ts +48 -0
- package/src/types/interface/api/responses/service-version.response.ts +91 -62
- package/src/types/interface/api/responses/service.response.ts +31 -31
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +15 -14
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
- package/src/types/interface/models/reflex-definition.model.ts +31 -31
- package/src/types/interface/models/reflex-discord.model.ts +146 -146
- package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
- package/src/types/interface/models/reflex-function-version.model.ts +14 -14
- package/src/types/interface/models/reflex-function.model.ts +16 -16
- package/src/types/interface/models/reflex-price-list.model.ts +20 -20
- package/src/types/interface/models/reflex-route.model.ts +19 -19
- package/src/types/interface/models/reflex-run.model.ts +179 -173
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +46 -40
- package/src/types/interface/models/reflex-service-version.model.ts +58 -55
- package/src/types/interface/models/reflex-service.model.ts +45 -45
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
- package/src/types/interface/models/reflex-task.model.ts +61 -0
|
@@ -1,45 +1,45 @@
|
|
|
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
|
-
/** Vault entry (secret) holding the Discord bot token, one value per environment; null for other types and until chosen. */
|
|
36
|
-
discordTokenSecretId: string | null;
|
|
37
|
-
/** Draft: frozen by the next version. */
|
|
38
|
-
cors: IReflexServiceCors;
|
|
39
|
-
/** Draft: frozen by the next version. Calls per minute and per client IP, in each environment. */
|
|
40
|
-
rateLimitPerIpPerMinute: number;
|
|
41
|
-
createdByUserId: string;
|
|
42
|
-
updatedByUserId: string;
|
|
43
|
-
createdAt: Date;
|
|
44
|
-
updatedAt: Date;
|
|
45
|
-
}
|
|
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
|
+
/** Vault entry (secret) holding the Discord bot token, one value per environment; null for other types and until chosen. */
|
|
36
|
+
discordTokenSecretId: string | null;
|
|
37
|
+
/** Draft: frozen by the next version. */
|
|
38
|
+
cors: IReflexServiceCors;
|
|
39
|
+
/** Draft: frozen by the next version. Calls per minute and per client IP, in each environment. */
|
|
40
|
+
rateLimitPerIpPerMinute: number;
|
|
41
|
+
createdByUserId: string;
|
|
42
|
+
updatedByUserId: string;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
/** Median and 95th percentile of a measure, over the executions of the window. */
|
|
2
|
-
export interface IReflexPercentiles {
|
|
3
|
-
median: number;
|
|
4
|
-
p95: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The measured consumption of one step of a version, over the retention window. Interrupted and running
|
|
9
|
-
* executions are left out.
|
|
10
|
-
*/
|
|
11
|
-
export interface IReflexStepStats {
|
|
12
|
-
stepId: string;
|
|
13
|
-
/** Executions in which the step ran. */
|
|
14
|
-
executions: number;
|
|
15
|
-
durationMs: IReflexPercentiles;
|
|
16
|
-
cpuMs: IReflexPercentiles;
|
|
17
|
-
heapPeakBytes: IReflexPercentiles;
|
|
18
|
-
costMillicredits: IReflexPercentiles;
|
|
19
|
-
/** 99th percentile of the heap peak: what a smaller profile is compared to. */
|
|
20
|
-
heapPeakP99Bytes: number;
|
|
21
|
-
/** Share of the cost of the executions that this step makes, from 0 to 1; null when they cost nothing. */
|
|
22
|
-
costShare: number | null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** The p99 heap peak of one step of the version running in an environment. */
|
|
26
|
-
export interface IReflexStepHeapPeak {
|
|
27
|
-
stepId: string;
|
|
28
|
-
heapPeakP99Bytes: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** What the settings screen compares a smaller profile to: the version running in the environment. */
|
|
32
|
-
export interface IReflexRunningVersionHeapPeaks {
|
|
33
|
-
versionId: string;
|
|
34
|
-
steps: IReflexStepHeapPeak[];
|
|
35
|
-
}
|
|
1
|
+
/** Median and 95th percentile of a measure, over the executions of the window. */
|
|
2
|
+
export interface IReflexPercentiles {
|
|
3
|
+
median: number;
|
|
4
|
+
p95: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The measured consumption of one step of a version, over the retention window. Interrupted and running
|
|
9
|
+
* executions are left out.
|
|
10
|
+
*/
|
|
11
|
+
export interface IReflexStepStats {
|
|
12
|
+
stepId: string;
|
|
13
|
+
/** Executions in which the step ran. */
|
|
14
|
+
executions: number;
|
|
15
|
+
durationMs: IReflexPercentiles;
|
|
16
|
+
cpuMs: IReflexPercentiles;
|
|
17
|
+
heapPeakBytes: IReflexPercentiles;
|
|
18
|
+
costMillicredits: IReflexPercentiles;
|
|
19
|
+
/** 99th percentile of the heap peak: what a smaller profile is compared to. */
|
|
20
|
+
heapPeakP99Bytes: number;
|
|
21
|
+
/** Share of the cost of the executions that this step makes, from 0 to 1; null when they cost nothing. */
|
|
22
|
+
costShare: number | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The p99 heap peak of one step of the version running in an environment. */
|
|
26
|
+
export interface IReflexStepHeapPeak {
|
|
27
|
+
stepId: string;
|
|
28
|
+
heapPeakP99Bytes: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** What the settings screen compares a smaller profile to: the version running in the environment. */
|
|
32
|
+
export interface IReflexRunningVersionHeapPeaks {
|
|
33
|
+
versionId: string;
|
|
34
|
+
steps: IReflexStepHeapPeak[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Bounds of the tasks of a Service and of their delayed runs; the API, the edge and their databases apply the same ones. */
|
|
2
|
+
export const REFLEX_TASK_LIMITS = {
|
|
3
|
+
/** `^[-_a-z0-9]{1,32}$`: the name `abyss.schedule.*` targets. */
|
|
4
|
+
namePattern: /^[-_a-z0-9]{1,32}$/,
|
|
5
|
+
maxTasksPerService: 20,
|
|
6
|
+
nameMaxLength: 32,
|
|
7
|
+
/** Characters of the payload of a delayed run, serialized to JSON. */
|
|
8
|
+
payloadMaxLength: 4096,
|
|
9
|
+
/** Shortest delay of a delayed run. */
|
|
10
|
+
delayMinSeconds: 1,
|
|
11
|
+
/** Furthest due date of a delayed run. */
|
|
12
|
+
delayMaxDays: 30,
|
|
13
|
+
/** Lateness past which a tick of a cron is EXPIRED instead of run (after a pause or an outage). */
|
|
14
|
+
recurringToleranceMinutes: 5,
|
|
15
|
+
/** Lateness past which a delayed run is EXPIRED instead of run. */
|
|
16
|
+
delayedToleranceMinutes: 60,
|
|
17
|
+
/** Attempts of a scheduled run interrupted before its end (at least once). */
|
|
18
|
+
maxAttempts: 3,
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
/** A task of the draft of a Service: a named target of a cron and of `abyss.schedule.*`. */
|
|
22
|
+
export interface IReflexTask {
|
|
23
|
+
id: string;
|
|
24
|
+
serviceId: string;
|
|
25
|
+
/** A function of the same Service. */
|
|
26
|
+
functionId: string;
|
|
27
|
+
/** Unique within the Service. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** A cron of 5 fields, read in `timezone`, at most one tick a minute; null for a task only delayed runs start. */
|
|
30
|
+
schedule: string | null;
|
|
31
|
+
/** IANA time zone of the cron; `Etc/UTC` by default. */
|
|
32
|
+
timezone: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A task as a version of the Service froze it. */
|
|
38
|
+
export type IReflexTaskSnapshot = Pick<
|
|
39
|
+
IReflexTask,
|
|
40
|
+
'id' | 'functionId' | 'name' | 'schedule' | 'timezone'
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
/** A delayed run waiting for its due date in one environment. */
|
|
44
|
+
export interface IReflexDelayedRun {
|
|
45
|
+
id: string;
|
|
46
|
+
serviceId: string;
|
|
47
|
+
environmentId: string;
|
|
48
|
+
taskId: string;
|
|
49
|
+
/** The name of the task in the version in service; null when that version no longer has it. */
|
|
50
|
+
taskName: string | null;
|
|
51
|
+
dueAt: Date;
|
|
52
|
+
/** The deduplication key it was scheduled with; null without one. */
|
|
53
|
+
key: string | null;
|
|
54
|
+
/** The payload handed to the run; null without one. */
|
|
55
|
+
payload: unknown;
|
|
56
|
+
/** Attempts already made (interrupted runs taken again). */
|
|
57
|
+
attempts: number;
|
|
58
|
+
/** The live run that scheduled it. */
|
|
59
|
+
scheduledByRunId: string | null;
|
|
60
|
+
createdAt: Date;
|
|
61
|
+
}
|