@abyss-project/reflex 6.4.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 (133) hide show
  1. package/.eslintrc.js +32 -32
  2. package/.prettierrc +5 -5
  3. package/README.md +15 -15
  4. package/dist/api/function-run.api.d.ts +2 -1
  5. package/dist/api/function-run.api.js +3 -1
  6. package/dist/api/function-run.api.js.map +1 -1
  7. package/dist/discord/discord-command-tree.d.ts +5 -0
  8. package/dist/discord/discord-command-tree.js +38 -0
  9. package/dist/discord/discord-command-tree.js.map +1 -0
  10. package/dist/discord/discord-event-filter-cases.js +27 -11
  11. package/dist/discord/discord-event-filter-cases.js.map +1 -1
  12. package/dist/discord/discord-event-filters.js +7 -3
  13. package/dist/discord/discord-event-filters.js.map +1 -1
  14. package/dist/discord/discord-event-intents.d.ts +8 -2
  15. package/dist/discord/discord-event-intents.js +13 -2
  16. package/dist/discord/discord-event-intents.js.map +1 -1
  17. package/dist/discord/index.d.ts +1 -0
  18. package/dist/discord/index.js +1 -0
  19. package/dist/discord/index.js.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/types/enum/discord-command-node-type.enum.d.ts +5 -0
  24. package/dist/types/enum/discord-command-node-type.enum.js +10 -0
  25. package/dist/types/enum/discord-command-node-type.enum.js.map +1 -0
  26. package/dist/types/enum/discord-command-type.enum.d.ts +5 -0
  27. package/dist/types/enum/discord-command-type.enum.js +10 -0
  28. package/dist/types/enum/discord-command-type.enum.js.map +1 -0
  29. package/dist/types/enum/discord-event-type.enum.d.ts +3 -1
  30. package/dist/types/enum/discord-event-type.enum.js +2 -0
  31. package/dist/types/enum/discord-event-type.enum.js.map +1 -1
  32. package/dist/types/enum/index.d.ts +2 -0
  33. package/dist/types/enum/index.js +2 -0
  34. package/dist/types/enum/index.js.map +1 -1
  35. package/dist/types/enum/reflex-error-code.enum.d.ts +10 -0
  36. package/dist/types/enum/reflex-error-code.enum.js +10 -0
  37. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  38. package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
  39. package/dist/types/interface/api/requests/service-discord.request.d.ts +7 -3
  40. package/dist/types/interface/api/responses/function-run.response.d.ts +8 -0
  41. package/dist/types/interface/models/reflex-discord.model.d.ts +18 -2
  42. package/dist/types/interface/models/reflex-discord.model.js +4 -0
  43. package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
  44. package/dist/types/interface/models/reflex-run.model.d.ts +4 -0
  45. package/dist/types/interface/models/reflex-run.model.js +4 -1
  46. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  47. package/jest.config.ts +11 -11
  48. package/package.json +1 -1
  49. package/src/api/alert-rule.api.test.ts +72 -72
  50. package/src/api/alert-rule.api.ts +57 -57
  51. package/src/api/application-insights.api.test.ts +42 -42
  52. package/src/api/application-insights.api.ts +38 -38
  53. package/src/api/application-run-settings.api.test.ts +62 -62
  54. package/src/api/application-run-settings.api.ts +30 -30
  55. package/src/api/function-access.api.ts +87 -87
  56. package/src/api/function-insights.api.test.ts +27 -27
  57. package/src/api/function-insights.api.ts +18 -18
  58. package/src/api/function-run.api.ts +19 -0
  59. package/src/api/function-settings.api.ts +96 -96
  60. package/src/api/function-template.api.test.ts +72 -72
  61. package/src/api/function-template.api.ts +52 -52
  62. package/src/api/function-test.api.ts +34 -34
  63. package/src/api/function-version.api.ts +66 -66
  64. package/src/api/function.api.test.ts +346 -346
  65. package/src/api/function.api.ts +62 -62
  66. package/src/api/health.api.ts +10 -10
  67. package/src/api/route-stats.api.test.ts +45 -45
  68. package/src/api/route-stats.api.ts +36 -36
  69. package/src/api/service-completion-webhook.api.test.ts +97 -97
  70. package/src/api/service-completion-webhook.api.ts +39 -39
  71. package/src/api/service-configuration.api.ts +16 -16
  72. package/src/api/service-consumer.api.test.ts +104 -104
  73. package/src/api/service-consumer.api.ts +90 -90
  74. package/src/api/service-deployment.api.ts +79 -79
  75. package/src/api/service-discord-event.api.test.ts +106 -106
  76. package/src/api/service-discord-event.api.ts +78 -78
  77. package/src/api/service-discord.api.test.ts +178 -178
  78. package/src/api/service-discord.api.ts +222 -222
  79. package/src/api/service-insights.api.test.ts +36 -36
  80. package/src/api/service-insights.api.ts +42 -42
  81. package/src/api/service-limits.api.test.ts +100 -100
  82. package/src/api/service-limits.api.ts +37 -37
  83. package/src/api/service-openapi.api.test.ts +52 -52
  84. package/src/api/service-openapi.api.ts +21 -21
  85. package/src/api/service-route.api.ts +74 -74
  86. package/src/api/service-task.api.test.ts +140 -140
  87. package/src/api/service-task.api.ts +141 -141
  88. package/src/api/service-version.api.ts +54 -54
  89. package/src/api/service.api.test.ts +220 -220
  90. package/src/api/service.api.ts +55 -55
  91. package/src/api/storage-surplus.admin.api.test.ts +66 -66
  92. package/src/api/storage-surplus.admin.api.ts +45 -45
  93. package/src/discord/discord-command-tree.test.ts +47 -0
  94. package/src/discord/discord-command-tree.ts +60 -0
  95. package/src/discord/discord-event-filter-cases.ts +299 -261
  96. package/src/discord/discord-event-filters.test.ts +120 -91
  97. package/src/discord/discord-event-filters.ts +103 -95
  98. package/src/discord/discord-event-intents.test.ts +139 -112
  99. package/src/discord/discord-event-intents.ts +80 -55
  100. package/src/discord/index.ts +4 -3
  101. package/src/index.test.ts +104 -104
  102. package/src/index.ts +2 -0
  103. package/src/insights/index.ts +1 -1
  104. package/src/insights/percentiles.test.ts +75 -75
  105. package/src/insights/percentiles.ts +37 -37
  106. package/src/types/enum/discord-command-node-type.enum.ts +10 -0
  107. package/src/types/enum/discord-command-type.enum.ts +9 -0
  108. package/src/types/enum/discord-event-type.enum.ts +4 -0
  109. package/src/types/enum/discord-host-action.enum.ts +37 -37
  110. package/src/types/enum/index.ts +2 -0
  111. package/src/types/enum/reflex-error-code.enum.ts +112 -89
  112. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -13
  113. package/src/types/interface/api/requests/function-run.request.ts +53 -42
  114. package/src/types/interface/api/requests/function-settings.request.ts +50 -50
  115. package/src/types/interface/api/requests/index.ts +25 -25
  116. package/src/types/interface/api/requests/service-discord.request.ts +168 -155
  117. package/src/types/interface/api/requests/service.request.ts +48 -48
  118. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -12
  119. package/src/types/interface/api/responses/function-run.response.ts +35 -23
  120. package/src/types/interface/api/responses/function-settings.response.ts +57 -57
  121. package/src/types/interface/api/responses/index.ts +25 -25
  122. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -10
  123. package/src/types/interface/models/index.ts +29 -29
  124. package/src/types/interface/models/reflex-discord.model.ts +249 -208
  125. package/src/types/interface/models/reflex-price-list.model.ts +22 -22
  126. package/src/types/interface/models/reflex-run-retention.model.ts +24 -24
  127. package/src/types/interface/models/reflex-run-settings.model.ts +39 -39
  128. package/src/types/interface/models/reflex-run.model.ts +317 -309
  129. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -48
  130. package/src/types/interface/models/reflex-service.model.ts +47 -47
  131. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -23
  132. package/tsconfig.check.json +15 -15
  133. package/tsconfig.json +35 -35
@@ -1,48 +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
- /** 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
+ 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,47 +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
- /** 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
- }
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
+ }
@@ -1,23 +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
- }
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
+ }
@@ -1,15 +1,15 @@
1
- {
2
- // Perimetre de VERIFICATION, distinct de celui du build.
3
- //
4
- // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
- // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
- // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
- // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
- //
9
- // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
- "extends": "./tsconfig.json",
11
- "compilerOptions": {
12
- "noEmit": true
13
- },
14
- "exclude": ["./dist/**/*"]
15
- }
1
+ {
2
+ // Perimetre de VERIFICATION, distinct de celui du build.
3
+ //
4
+ // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
+ // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
+ // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
+ // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
+ //
9
+ // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
+ "extends": "./tsconfig.json",
11
+ "compilerOptions": {
12
+ "noEmit": true
13
+ },
14
+ "exclude": ["./dist/**/*"]
15
+ }
package/tsconfig.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "compilerOptions": {
3
- "incremental": false,
4
- "target": "es2021",
5
- "lib": [
6
- "dom",
7
- "es2021"
8
- ],
9
- "module": "commonjs",
10
- "rootDir": "src",
11
- "moduleResolution": "node",
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "sourceMap": true,
15
- "outDir": "./dist",
16
- "removeComments": true,
17
- "allowSyntheticDefaultImports": true,
18
- "esModuleInterop": true,
19
- "forceConsistentCasingInFileNames": true,
20
- "strict": true,
21
- "strictNullChecks": true,
22
- "strictFunctionTypes": true,
23
- "strictPropertyInitialization": false,
24
- "skipLibCheck": true
25
- },
26
- "include": [
27
- "./src"
28
- ],
29
- "exclude": [
30
- "./dist/**/*",
31
- "./src/**/*.spec.ts",
32
- "./src/**/*.test.ts",
33
- "./src/**/__tests__/**"
34
- ]
35
- }
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": false,
4
+ "target": "es2021",
5
+ "lib": [
6
+ "dom",
7
+ "es2021"
8
+ ],
9
+ "module": "commonjs",
10
+ "rootDir": "src",
11
+ "moduleResolution": "node",
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "sourceMap": true,
15
+ "outDir": "./dist",
16
+ "removeComments": true,
17
+ "allowSyntheticDefaultImports": true,
18
+ "esModuleInterop": true,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "strict": true,
21
+ "strictNullChecks": true,
22
+ "strictFunctionTypes": true,
23
+ "strictPropertyInitialization": false,
24
+ "skipLibCheck": true
25
+ },
26
+ "include": [
27
+ "./src"
28
+ ],
29
+ "exclude": [
30
+ "./dist/**/*",
31
+ "./src/**/*.spec.ts",
32
+ "./src/**/*.test.ts",
33
+ "./src/**/__tests__/**"
34
+ ]
35
+ }