@abyss-project/reflex 6.3.0 → 6.6.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 (123) hide show
  1. package/.prettierrc +5 -5
  2. package/dist/api/function-run.api.d.ts +3 -1
  3. package/dist/api/function-run.api.js +5 -1
  4. package/dist/api/function-run.api.js.map +1 -1
  5. package/dist/api/function-settings.api.d.ts +3 -1
  6. package/dist/api/function-settings.api.js +7 -1
  7. package/dist/api/function-settings.api.js.map +1 -1
  8. package/dist/api/index.d.ts +1 -0
  9. package/dist/api/index.js +1 -0
  10. package/dist/api/index.js.map +1 -1
  11. package/dist/api/storage-surplus.admin.api.d.ts +5 -0
  12. package/dist/api/storage-surplus.admin.api.js +17 -0
  13. package/dist/api/storage-surplus.admin.api.js.map +1 -0
  14. package/dist/discord/discord-command-tree.d.ts +5 -0
  15. package/dist/discord/discord-command-tree.js +38 -0
  16. package/dist/discord/discord-command-tree.js.map +1 -0
  17. package/dist/discord/discord-event-filter-cases.js +27 -11
  18. package/dist/discord/discord-event-filter-cases.js.map +1 -1
  19. package/dist/discord/discord-event-filters.js +7 -3
  20. package/dist/discord/discord-event-filters.js.map +1 -1
  21. package/dist/discord/discord-event-intents.d.ts +8 -2
  22. package/dist/discord/discord-event-intents.js +13 -2
  23. package/dist/discord/discord-event-intents.js.map +1 -1
  24. package/dist/discord/index.d.ts +1 -0
  25. package/dist/discord/index.js +1 -0
  26. package/dist/discord/index.js.map +1 -1
  27. package/dist/index.d.ts +17 -0
  28. package/dist/index.js +20 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/types/enum/discord-command-node-type.enum.d.ts +5 -0
  31. package/dist/types/enum/discord-command-node-type.enum.js +10 -0
  32. package/dist/types/enum/discord-command-node-type.enum.js.map +1 -0
  33. package/dist/types/enum/discord-command-type.enum.d.ts +5 -0
  34. package/dist/types/enum/discord-command-type.enum.js +10 -0
  35. package/dist/types/enum/discord-command-type.enum.js.map +1 -0
  36. package/dist/types/enum/discord-event-type.enum.d.ts +3 -1
  37. package/dist/types/enum/discord-event-type.enum.js +2 -0
  38. package/dist/types/enum/discord-event-type.enum.js.map +1 -1
  39. package/dist/types/enum/index.d.ts +2 -0
  40. package/dist/types/enum/index.js +2 -0
  41. package/dist/types/enum/index.js.map +1 -1
  42. package/dist/types/enum/reflex-error-code.enum.d.ts +14 -1
  43. package/dist/types/enum/reflex-error-code.enum.js +13 -0
  44. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  45. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
  46. package/dist/types/interface/api/requests/function-run.request.d.ts +16 -0
  47. package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
  48. package/dist/types/interface/api/requests/index.d.ts +1 -0
  49. package/dist/types/interface/api/requests/index.js +1 -0
  50. package/dist/types/interface/api/requests/index.js.map +1 -1
  51. package/dist/types/interface/api/requests/service-discord.request.d.ts +7 -3
  52. package/dist/types/interface/api/requests/service.request.d.ts +1 -0
  53. package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
  54. package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
  55. package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
  56. package/dist/types/interface/api/responses/function-run.response.d.ts +12 -0
  57. package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
  58. package/dist/types/interface/api/responses/index.d.ts +1 -0
  59. package/dist/types/interface/api/responses/index.js +1 -0
  60. package/dist/types/interface/api/responses/index.js.map +1 -1
  61. package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
  62. package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
  63. package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
  64. package/dist/types/interface/models/index.d.ts +2 -0
  65. package/dist/types/interface/models/index.js +2 -0
  66. package/dist/types/interface/models/index.js.map +1 -1
  67. package/dist/types/interface/models/reflex-discord.model.d.ts +18 -2
  68. package/dist/types/interface/models/reflex-discord.model.js +4 -0
  69. package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
  70. package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
  71. package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
  72. package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
  73. package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
  74. package/dist/types/interface/models/reflex-run.model.d.ts +9 -0
  75. package/dist/types/interface/models/reflex-run.model.js +4 -1
  76. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  77. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
  78. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  79. package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
  80. package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
  81. package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -0
  82. package/package.json +1 -1
  83. package/src/api/application-run-settings.api.test.ts +62 -51
  84. package/src/api/function-run.api.ts +34 -0
  85. package/src/api/function-settings.api.ts +96 -74
  86. package/src/api/function.api.test.ts +346 -291
  87. package/src/api/index.ts +27 -26
  88. package/src/api/service.api.test.ts +220 -215
  89. package/src/api/storage-surplus.admin.api.test.ts +66 -0
  90. package/src/api/storage-surplus.admin.api.ts +45 -0
  91. package/src/discord/discord-command-tree.test.ts +47 -0
  92. package/src/discord/discord-command-tree.ts +60 -0
  93. package/src/discord/discord-event-filter-cases.ts +54 -16
  94. package/src/discord/discord-event-filters.test.ts +33 -4
  95. package/src/discord/discord-event-filters.ts +13 -5
  96. package/src/discord/discord-event-intents.test.ts +27 -0
  97. package/src/discord/discord-event-intents.ts +31 -6
  98. package/src/discord/index.ts +1 -0
  99. package/src/index.ts +44 -0
  100. package/src/types/enum/discord-command-node-type.enum.ts +10 -0
  101. package/src/types/enum/discord-command-type.enum.ts +9 -0
  102. package/src/types/enum/discord-event-type.enum.ts +4 -0
  103. package/src/types/enum/index.ts +2 -0
  104. package/src/types/enum/reflex-error-code.enum.ts +112 -73
  105. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -11
  106. package/src/types/interface/api/requests/function-run.request.ts +53 -32
  107. package/src/types/interface/api/requests/function-settings.request.ts +50 -34
  108. package/src/types/interface/api/requests/index.ts +25 -24
  109. package/src/types/interface/api/requests/service-discord.request.ts +19 -6
  110. package/src/types/interface/api/requests/service.request.ts +48 -46
  111. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
  112. package/src/types/interface/api/responses/function-run.response.ts +35 -18
  113. package/src/types/interface/api/responses/function-settings.response.ts +57 -50
  114. package/src/types/interface/api/responses/index.ts +25 -24
  115. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
  116. package/src/types/interface/models/index.ts +29 -27
  117. package/src/types/interface/models/reflex-discord.model.ts +45 -4
  118. package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
  119. package/src/types/interface/models/reflex-run-settings.model.ts +39 -28
  120. package/src/types/interface/models/reflex-run.model.ts +317 -299
  121. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -46
  122. package/src/types/interface/models/reflex-service.model.ts +47 -45
  123. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
@@ -1,46 +1,48 @@
1
- import type {
2
- DiscordSyncStatus,
3
- ScheduleSyncStatus,
4
- ServiceDeploymentAction,
5
- ServiceDeploymentStatus,
6
- } from '../../enum';
7
- import type { IReflexAccessDeclaration } from './reflex-definition.model';
8
-
9
- /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
10
- export interface IReflexServiceDeploymentGrant {
11
- functionId: string;
12
- grants: IReflexAccessDeclaration[];
13
- }
14
-
15
- /**
16
- * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
17
- * is paused) there; the others are the history a rollback reads.
18
- */
19
- export interface IReflexServiceDeployment {
20
- id: string;
21
- serviceId: string;
22
- /** The environment of the application (abyss-main's id). */
23
- environmentId: string;
24
- /** The name of that environment, second segment of the address. */
25
- environmentSlug: string;
26
- serviceVersionId: string;
27
- serviceVersionNumber: number;
28
- action: ServiceDeploymentAction;
29
- status: ServiceDeploymentStatus;
30
- grants: IReflexServiceDeploymentGrant[];
31
- /** Push of the interactions address and the commands to Discord; null for a Service that is not a Discord bot. */
32
- discordSync: DiscordSyncStatus | null;
33
- /** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
34
- discordSyncError: string | null;
35
- discordSyncedAt: Date | null;
36
- /** Synchronization of the cron tasks of the version with Flow; null when the version has no cron task. */
37
- scheduleSync: ScheduleSyncStatus | null;
38
- /** Code and message of the failure when `scheduleSync` is FAILED (500 characters at most). */
39
- scheduleSyncError: string | null;
40
- scheduleSyncedAt: Date | null;
41
- /** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
42
- pausedForQuota: boolean;
43
- isCurrent: boolean;
44
- byUserId: string;
45
- at: Date;
46
- }
1
+ import type {
2
+ DiscordSyncStatus,
3
+ ScheduleSyncStatus,
4
+ ServiceDeploymentAction,
5
+ ServiceDeploymentStatus,
6
+ } from '../../enum';
7
+ import type { IReflexAccessDeclaration } from './reflex-definition.model';
8
+
9
+ /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
10
+ export interface IReflexServiceDeploymentGrant {
11
+ functionId: string;
12
+ grants: IReflexAccessDeclaration[];
13
+ }
14
+
15
+ /**
16
+ * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
17
+ * is paused) there; the others are the history a rollback reads.
18
+ */
19
+ export interface IReflexServiceDeployment {
20
+ id: string;
21
+ serviceId: string;
22
+ /** The environment of the application (abyss-main's id). */
23
+ environmentId: string;
24
+ /** The name of that environment, second segment of the address. */
25
+ environmentSlug: string;
26
+ /** The version this gesture put in service; null once the purge deleted it (the row stays in the history, no way back to it). */
27
+ serviceVersionId: string | null;
28
+ /** Number of that version; null with `serviceVersionId`. */
29
+ serviceVersionNumber: number | null;
30
+ action: ServiceDeploymentAction;
31
+ status: ServiceDeploymentStatus;
32
+ grants: IReflexServiceDeploymentGrant[];
33
+ /** Push of the interactions address and the commands to Discord; null for a Service that is not a Discord bot. */
34
+ discordSync: DiscordSyncStatus | null;
35
+ /** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
36
+ discordSyncError: string | null;
37
+ discordSyncedAt: Date | null;
38
+ /** Synchronization of the cron tasks of the version with Flow; null when the version has no cron task. */
39
+ scheduleSync: ScheduleSyncStatus | null;
40
+ /** Code and message of the failure when `scheduleSync` is FAILED (500 characters at most). */
41
+ scheduleSyncError: string | null;
42
+ scheduleSyncedAt: Date | null;
43
+ /** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
44
+ pausedForQuota: boolean;
45
+ isCurrent: boolean;
46
+ byUserId: string;
47
+ at: Date;
48
+ }
@@ -1,45 +1,47 @@
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
+ /** How many versions of the Service the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
42
+ versionsKept: number;
43
+ createdByUserId: string;
44
+ updatedByUserId: string;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Whose storage a day-90 operation is about (the storage surplus contract of abyss-main, #889): the owner of an
3
+ * application is an organization, so `organizationId` is the one Reflex acts on.
4
+ */
5
+ export interface IReflexStorageSurplusOwner {
6
+ organizationId?: string | null;
7
+ userId?: string | null;
8
+ }
9
+
10
+ /**
11
+ * One item of the day-90 contract: a day of the runs of one function. Online (archivable) its `id` names the day; in
12
+ * the archive it is the id of the archive object of that day.
13
+ */
14
+ export interface IReflexStorageSurplusItem {
15
+ id: string;
16
+ sizeBytes: number;
17
+ /** The day the item holds the runs of, UTC. */
18
+ createdAt: Date | string;
19
+ /** The day holds a favorite run. A favorite protects nothing against the quota. */
20
+ isFavorite: boolean;
21
+ /** What the customer recognises the day by: the function and the day. */
22
+ label: string;
23
+ }