@abyss-project/reflex 6.0.2 → 6.0.4
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/types/interface/models/reflex-completion-webhook.model.d.ts +9 -0
- package/dist/types/interface/models/reflex-completion-webhook.model.js +10 -1
- package/dist/types/interface/models/reflex-completion-webhook.model.js.map +1 -1
- package/dist/types/interface/models/reflex-service-limits.model.d.ts +2 -0
- package/package.json +1 -1
- package/src/api/service-completion-webhook.api.test.ts +10 -0
- package/src/types/interface/models/reflex-completion-webhook.model.ts +26 -0
- package/src/types/interface/models/reflex-service-limits.model.ts +10 -0
|
@@ -7,6 +7,15 @@ export declare const REFLEX_COMPLETION_WEBHOOK_LIMITS: {
|
|
|
7
7
|
readonly sendTimeoutMs: 10000;
|
|
8
8
|
readonly outputMaxBytes: 65536;
|
|
9
9
|
};
|
|
10
|
+
export declare const REFLEX_COMPLETION_DELIVERY_ERRORS: {
|
|
11
|
+
readonly refusedAddress: "The URL is not https, or reaches an address the edge may not reach";
|
|
12
|
+
readonly noSigningSecret: "No signing secret for the Service in the environment";
|
|
13
|
+
readonly invalidUrl: "The URL is not valid";
|
|
14
|
+
readonly receiverTimeoutPrefix: "The receiver did not answer within";
|
|
15
|
+
readonly requestFailedPrefix: "The request failed";
|
|
16
|
+
readonly httpPrefix: "HTTP";
|
|
17
|
+
readonly redirectsNotFollowed: "redirects are not followed";
|
|
18
|
+
};
|
|
10
19
|
export interface IReflexCompletionWebhookPayload {
|
|
11
20
|
executionId: string;
|
|
12
21
|
functionId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REFLEX_COMPLETION_WEBHOOK_LIMITS = exports.RESERVED_EXECUTIONS_SEGMENT = exports.COMPLETION_DELIVERY_ID_HEADER = void 0;
|
|
3
|
+
exports.REFLEX_COMPLETION_DELIVERY_ERRORS = exports.REFLEX_COMPLETION_WEBHOOK_LIMITS = exports.RESERVED_EXECUTIONS_SEGMENT = exports.COMPLETION_DELIVERY_ID_HEADER = void 0;
|
|
4
4
|
exports.COMPLETION_DELIVERY_ID_HEADER = 'x-abyss-delivery-id';
|
|
5
5
|
exports.RESERVED_EXECUTIONS_SEGMENT = '_executions';
|
|
6
6
|
exports.REFLEX_COMPLETION_WEBHOOK_LIMITS = {
|
|
@@ -9,4 +9,13 @@ exports.REFLEX_COMPLETION_WEBHOOK_LIMITS = {
|
|
|
9
9
|
sendTimeoutMs: 10_000,
|
|
10
10
|
outputMaxBytes: 65_536,
|
|
11
11
|
};
|
|
12
|
+
exports.REFLEX_COMPLETION_DELIVERY_ERRORS = {
|
|
13
|
+
refusedAddress: 'The URL is not https, or reaches an address the edge may not reach',
|
|
14
|
+
noSigningSecret: 'No signing secret for the Service in the environment',
|
|
15
|
+
invalidUrl: 'The URL is not valid',
|
|
16
|
+
receiverTimeoutPrefix: 'The receiver did not answer within',
|
|
17
|
+
requestFailedPrefix: 'The request failed',
|
|
18
|
+
httpPrefix: 'HTTP',
|
|
19
|
+
redirectsNotFollowed: 'redirects are not followed',
|
|
20
|
+
};
|
|
12
21
|
//# sourceMappingURL=reflex-completion-webhook.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-completion-webhook.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-completion-webhook.model.ts"],"names":[],"mappings":";;;AAGa,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AAMtD,QAAA,2BAA2B,GAAG,aAAa,CAAC;AAG5C,QAAA,gCAAgC,GAAG;IAE9C,YAAY,EAAE,IAAI;IAElB,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAEtC,aAAa,EAAE,MAAM;IAErB,cAAc,EAAE,MAAM;CACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"reflex-completion-webhook.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-completion-webhook.model.ts"],"names":[],"mappings":";;;AAGa,QAAA,6BAA6B,GAAG,qBAAqB,CAAC;AAMtD,QAAA,2BAA2B,GAAG,aAAa,CAAC;AAG5C,QAAA,gCAAgC,GAAG;IAE9C,YAAY,EAAE,IAAI;IAElB,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAEtC,aAAa,EAAE,MAAM;IAErB,cAAc,EAAE,MAAM;CACd,CAAC;AAWE,QAAA,iCAAiC,GAAG;IAE/C,cAAc,EAAE,oEAAoE;IAEpF,eAAe,EAAE,sDAAsD;IAEvE,UAAU,EAAE,sBAAsB;IAElC,qBAAqB,EAAE,oCAAoC;IAE3D,mBAAmB,EAAE,oBAAoB;IAEzC,UAAU,EAAE,MAAM;IAElB,oBAAoB,EAAE,4BAA4B;CAC1C,CAAC"}
|
|
@@ -16,6 +16,8 @@ export interface IReflexServiceMonthlySpendCap {
|
|
|
16
16
|
export interface IReflexServiceCredits {
|
|
17
17
|
month: string;
|
|
18
18
|
consumedMillicredits: number;
|
|
19
|
+
organizationConsumedMillicredits: number;
|
|
20
|
+
includedMillicredits: number | null;
|
|
19
21
|
overageEnabled: boolean;
|
|
20
22
|
overageAllowedByOrganization: boolean;
|
|
21
23
|
}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
COMPLETION_DELIVERY_ID_HEADER,
|
|
5
5
|
CompletionDeliveryStatus,
|
|
6
6
|
DEFAULT_REFLEX_EXECUTION_SETTINGS,
|
|
7
|
+
REFLEX_COMPLETION_DELIVERY_ERRORS,
|
|
7
8
|
REFLEX_COMPLETION_WEBHOOK_LIMITS,
|
|
8
9
|
RESERVED_EXECUTIONS_SEGMENT,
|
|
9
10
|
RunStatus,
|
|
@@ -76,6 +77,15 @@ describe('AbyssReflexCore completion webhook routes', () => {
|
|
|
76
77
|
outputMaxBytes: 65_536,
|
|
77
78
|
});
|
|
78
79
|
expect(COMPLETION_DELIVERY_ID_HEADER).toBe('x-abyss-delivery-id');
|
|
80
|
+
expect(REFLEX_COMPLETION_DELIVERY_ERRORS).toEqual({
|
|
81
|
+
refusedAddress: 'The URL is not https, or reaches an address the edge may not reach',
|
|
82
|
+
noSigningSecret: 'No signing secret for the Service in the environment',
|
|
83
|
+
invalidUrl: 'The URL is not valid',
|
|
84
|
+
receiverTimeoutPrefix: 'The receiver did not answer within',
|
|
85
|
+
requestFailedPrefix: 'The request failed',
|
|
86
|
+
httpPrefix: 'HTTP',
|
|
87
|
+
redirectsNotFollowed: 'redirects are not followed',
|
|
88
|
+
});
|
|
79
89
|
expect(RESERVED_EXECUTIONS_SEGMENT).toBe('_executions');
|
|
80
90
|
expect(Object.values(CompletionDeliveryStatus)).toEqual(['PENDING', 'DELIVERED', 'FAILED']);
|
|
81
91
|
expect(RunStatus.REFUSED).toBe('REFUSED');
|
|
@@ -21,6 +21,32 @@ export const REFLEX_COMPLETION_WEBHOOK_LIMITS = {
|
|
|
21
21
|
outputMaxBytes: 65_536,
|
|
22
22
|
} as const;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The sentences the edge writes into the `error` of a delivery attempt (`IReflexCompletionDeliveryAttempt.error`)
|
|
26
|
+
* when it is not a bare receiver answer, for a reader that has to recognise them. They are English and fixed; the
|
|
27
|
+
* edge builds the rest of an `error` around the prefixes:
|
|
28
|
+
* - `HTTP <status>` or `HTTP <status>: redirects are not followed` (`httpPrefix`, `redirectsNotFollowed`);
|
|
29
|
+
* - `The receiver did not answer within <sendTimeoutMs> ms` (`receiverTimeoutPrefix`);
|
|
30
|
+
* - `The request failed (<code>)` where `<code>` is the undici or Node error code (`requestFailedPrefix`).
|
|
31
|
+
* The edge keeps a local copy (it does not depend on this SDK); `edge-contract-parity.spec.ts` fails when they differ.
|
|
32
|
+
*/
|
|
33
|
+
export const REFLEX_COMPLETION_DELIVERY_ERRORS = {
|
|
34
|
+
/** The URL is not https, or it (or the address it resolves to) is one the edge may not reach: the SSRF guard refused it. */
|
|
35
|
+
refusedAddress: 'The URL is not https, or reaches an address the edge may not reach',
|
|
36
|
+
/** The Service has no signing secret in the environment (or it does not unseal): nothing was posted. */
|
|
37
|
+
noSigningSecret: 'No signing secret for the Service in the environment',
|
|
38
|
+
/** The URL does not parse: nothing was posted. */
|
|
39
|
+
invalidUrl: 'The URL is not valid',
|
|
40
|
+
/** Start of the sentence written when the receiver did not answer in time; followed by ` <ms> ms`. */
|
|
41
|
+
receiverTimeoutPrefix: 'The receiver did not answer within',
|
|
42
|
+
/** Start of the sentence written for a network failure; followed by ` (<error code>)`. */
|
|
43
|
+
requestFailedPrefix: 'The request failed',
|
|
44
|
+
/** Start of the sentence written for an HTTP status that ended the attempt; followed by ` <status>`. */
|
|
45
|
+
httpPrefix: 'HTTP',
|
|
46
|
+
/** The reason that follows `HTTP <status>: ` for a 3xx answer. */
|
|
47
|
+
redirectsNotFollowed: 'redirects are not followed',
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
24
50
|
/**
|
|
25
51
|
* The JSON body the edge `POST`s to the completion webhook URL once an async execution finished, signed
|
|
26
52
|
* `x-abyss-signature: t=<seconds>,v1=<hmac>` (ADR-0257) with the secret of the Service and the environment, and
|
|
@@ -30,6 +30,16 @@ export interface IReflexServiceCredits {
|
|
|
30
30
|
/** `YYYY-MM`. */
|
|
31
31
|
month: string;
|
|
32
32
|
consumedMillicredits: number;
|
|
33
|
+
/**
|
|
34
|
+
* What all the Services of the organization consumed this month, in millicredits: what abyss-main holds plus what
|
|
35
|
+
* the Reflex report has not declared yet. The stop compares this total to `includedMillicredits`.
|
|
36
|
+
*/
|
|
37
|
+
organizationConsumedMillicredits: number;
|
|
38
|
+
/**
|
|
39
|
+
* The credits the plan of the organization includes this month (effective limit, packs included), in millicredits:
|
|
40
|
+
* the same threshold that stops the Services. `null` for an unlimited plan.
|
|
41
|
+
*/
|
|
42
|
+
includedMillicredits: number | null;
|
|
33
43
|
/** True when the Service bills overage past the credits of the organization. */
|
|
34
44
|
overageEnabled: boolean;
|
|
35
45
|
/** True when the organization allows overage of the credits metric at all. */
|