@iveri/contracts 0.2.0 → 0.4.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/README.md +58 -12
- package/dist/cjs/api/conduit/capture.type.d.ts +70 -0
- package/dist/cjs/api/conduit/capture.type.d.ts.map +1 -0
- package/dist/cjs/api/conduit/capture.type.js +3 -0
- package/dist/cjs/api/conduit/capture.type.js.map +1 -0
- package/dist/cjs/api/conduit/endpoint.type.d.ts +66 -0
- package/dist/cjs/api/conduit/endpoint.type.d.ts.map +1 -0
- package/dist/cjs/api/conduit/endpoint.type.js +3 -0
- package/dist/cjs/api/conduit/endpoint.type.js.map +1 -0
- package/dist/cjs/api/conduit/handshake-kind.enum.d.ts +22 -0
- package/dist/cjs/api/conduit/handshake-kind.enum.d.ts.map +1 -0
- package/dist/cjs/api/conduit/handshake-kind.enum.js +26 -0
- package/dist/cjs/api/conduit/handshake-kind.enum.js.map +1 -0
- package/dist/cjs/api/conduit/index.d.ts +11 -0
- package/dist/cjs/api/conduit/index.d.ts.map +1 -0
- package/dist/cjs/api/conduit/index.js +27 -0
- package/dist/cjs/api/conduit/index.js.map +1 -0
- package/dist/cjs/api/conduit/provider.type.d.ts +138 -0
- package/dist/cjs/api/conduit/provider.type.d.ts.map +1 -0
- package/dist/cjs/api/conduit/provider.type.js +8 -0
- package/dist/cjs/api/conduit/provider.type.js.map +1 -0
- package/dist/cjs/api/conduit/replay.type.d.ts +48 -0
- package/dist/cjs/api/conduit/replay.type.d.ts.map +1 -0
- package/dist/cjs/api/conduit/replay.type.js +3 -0
- package/dist/cjs/api/conduit/replay.type.js.map +1 -0
- package/dist/cjs/api/conduit/signature-algorithm.enum.d.ts +17 -0
- package/dist/cjs/api/conduit/signature-algorithm.enum.d.ts.map +1 -0
- package/dist/cjs/api/conduit/signature-algorithm.enum.js +21 -0
- package/dist/cjs/api/conduit/signature-algorithm.enum.js.map +1 -0
- package/dist/cjs/api/conduit/signature-encoding.enum.d.ts +13 -0
- package/dist/cjs/api/conduit/signature-encoding.enum.d.ts.map +1 -0
- package/dist/cjs/api/conduit/signature-encoding.enum.js +17 -0
- package/dist/cjs/api/conduit/signature-encoding.enum.js.map +1 -0
- package/dist/cjs/api/conduit/signature-header-scheme.enum.d.ts +19 -0
- package/dist/cjs/api/conduit/signature-header-scheme.enum.d.ts.map +1 -0
- package/dist/cjs/api/conduit/signature-header-scheme.enum.js +23 -0
- package/dist/cjs/api/conduit/signature-header-scheme.enum.js.map +1 -0
- package/dist/cjs/api/conduit/signature-verdict.enum.d.ts +50 -0
- package/dist/cjs/api/conduit/signature-verdict.enum.d.ts.map +1 -0
- package/dist/cjs/api/conduit/signature-verdict.enum.js +54 -0
- package/dist/cjs/api/conduit/signature-verdict.enum.js.map +1 -0
- package/dist/cjs/api/conduit/signature.type.d.ts +54 -0
- package/dist/cjs/api/conduit/signature.type.d.ts.map +1 -0
- package/dist/cjs/api/conduit/signature.type.js +3 -0
- package/dist/cjs/api/conduit/signature.type.js.map +1 -0
- package/dist/cjs/api/identity/auth.type.d.ts +92 -0
- package/dist/cjs/api/identity/auth.type.d.ts.map +1 -0
- package/dist/cjs/api/identity/auth.type.js +3 -0
- package/dist/cjs/api/identity/auth.type.js.map +1 -0
- package/dist/cjs/api/identity/index.d.ts +4 -0
- package/dist/cjs/api/identity/index.d.ts.map +1 -0
- package/dist/cjs/api/identity/index.js +20 -0
- package/dist/cjs/api/identity/index.js.map +1 -0
- package/dist/cjs/api/identity/membership-status.enum.d.ts +16 -0
- package/dist/cjs/api/identity/membership-status.enum.d.ts.map +1 -0
- package/dist/cjs/api/identity/membership-status.enum.js +20 -0
- package/dist/cjs/api/identity/membership-status.enum.js.map +1 -0
- package/dist/cjs/api/identity/tenant-status.enum.d.ts +28 -0
- package/dist/cjs/api/identity/tenant-status.enum.d.ts.map +1 -0
- package/dist/cjs/api/identity/tenant-status.enum.js +32 -0
- package/dist/cjs/api/identity/tenant-status.enum.js.map +1 -0
- package/dist/cjs/enum/user-permission.enum.d.ts +30 -1
- package/dist/cjs/enum/user-permission.enum.d.ts.map +1 -1
- package/dist/cjs/enum/user-permission.enum.js +32 -0
- package/dist/cjs/enum/user-permission.enum.js.map +1 -1
- package/dist/cjs/type/api-response.type.d.ts +24 -28
- package/dist/cjs/type/api-response.type.d.ts.map +1 -1
- package/dist/cjs/type/index.d.ts +1 -0
- package/dist/cjs/type/index.d.ts.map +1 -1
- package/dist/cjs/type/index.js +1 -0
- package/dist/cjs/type/index.js.map +1 -1
- package/dist/cjs/type/iso-date-time.type.d.ts +17 -0
- package/dist/cjs/type/iso-date-time.type.d.ts.map +1 -0
- package/dist/cjs/type/iso-date-time.type.js +3 -0
- package/dist/cjs/type/iso-date-time.type.js.map +1 -0
- package/dist/esm/api/conduit/capture.type.d.ts +70 -0
- package/dist/esm/api/conduit/capture.type.d.ts.map +1 -0
- package/dist/esm/api/conduit/capture.type.js +2 -0
- package/dist/esm/api/conduit/capture.type.js.map +1 -0
- package/dist/esm/api/conduit/endpoint.type.d.ts +66 -0
- package/dist/esm/api/conduit/endpoint.type.d.ts.map +1 -0
- package/dist/esm/api/conduit/endpoint.type.js +2 -0
- package/dist/esm/api/conduit/endpoint.type.js.map +1 -0
- package/dist/esm/api/conduit/handshake-kind.enum.d.ts +22 -0
- package/dist/esm/api/conduit/handshake-kind.enum.d.ts.map +1 -0
- package/dist/esm/api/conduit/handshake-kind.enum.js +23 -0
- package/dist/esm/api/conduit/handshake-kind.enum.js.map +1 -0
- package/dist/esm/api/conduit/index.d.ts +11 -0
- package/dist/esm/api/conduit/index.d.ts.map +1 -0
- package/dist/esm/api/conduit/index.js +11 -0
- package/dist/esm/api/conduit/index.js.map +1 -0
- package/dist/esm/api/conduit/provider.type.d.ts +138 -0
- package/dist/esm/api/conduit/provider.type.d.ts.map +1 -0
- package/dist/esm/api/conduit/provider.type.js +5 -0
- package/dist/esm/api/conduit/provider.type.js.map +1 -0
- package/dist/esm/api/conduit/replay.type.d.ts +48 -0
- package/dist/esm/api/conduit/replay.type.d.ts.map +1 -0
- package/dist/esm/api/conduit/replay.type.js +2 -0
- package/dist/esm/api/conduit/replay.type.js.map +1 -0
- package/dist/esm/api/conduit/signature-algorithm.enum.d.ts +17 -0
- package/dist/esm/api/conduit/signature-algorithm.enum.d.ts.map +1 -0
- package/dist/esm/api/conduit/signature-algorithm.enum.js +18 -0
- package/dist/esm/api/conduit/signature-algorithm.enum.js.map +1 -0
- package/dist/esm/api/conduit/signature-encoding.enum.d.ts +13 -0
- package/dist/esm/api/conduit/signature-encoding.enum.d.ts.map +1 -0
- package/dist/esm/api/conduit/signature-encoding.enum.js +14 -0
- package/dist/esm/api/conduit/signature-encoding.enum.js.map +1 -0
- package/dist/esm/api/conduit/signature-header-scheme.enum.d.ts +19 -0
- package/dist/esm/api/conduit/signature-header-scheme.enum.d.ts.map +1 -0
- package/dist/esm/api/conduit/signature-header-scheme.enum.js +20 -0
- package/dist/esm/api/conduit/signature-header-scheme.enum.js.map +1 -0
- package/dist/esm/api/conduit/signature-verdict.enum.d.ts +50 -0
- package/dist/esm/api/conduit/signature-verdict.enum.d.ts.map +1 -0
- package/dist/esm/api/conduit/signature-verdict.enum.js +51 -0
- package/dist/esm/api/conduit/signature-verdict.enum.js.map +1 -0
- package/dist/esm/api/conduit/signature.type.d.ts +54 -0
- package/dist/esm/api/conduit/signature.type.d.ts.map +1 -0
- package/dist/esm/api/conduit/signature.type.js +2 -0
- package/dist/esm/api/conduit/signature.type.js.map +1 -0
- package/dist/esm/api/identity/auth.type.d.ts +92 -0
- package/dist/esm/api/identity/auth.type.d.ts.map +1 -0
- package/dist/esm/api/identity/auth.type.js +2 -0
- package/dist/esm/api/identity/auth.type.js.map +1 -0
- package/dist/esm/api/identity/index.d.ts +4 -0
- package/dist/esm/api/identity/index.d.ts.map +1 -0
- package/dist/esm/api/identity/index.js +4 -0
- package/dist/esm/api/identity/index.js.map +1 -0
- package/dist/esm/api/identity/membership-status.enum.d.ts +16 -0
- package/dist/esm/api/identity/membership-status.enum.d.ts.map +1 -0
- package/dist/esm/api/identity/membership-status.enum.js +17 -0
- package/dist/esm/api/identity/membership-status.enum.js.map +1 -0
- package/dist/esm/api/identity/tenant-status.enum.d.ts +28 -0
- package/dist/esm/api/identity/tenant-status.enum.d.ts.map +1 -0
- package/dist/esm/api/identity/tenant-status.enum.js +29 -0
- package/dist/esm/api/identity/tenant-status.enum.js.map +1 -0
- package/dist/esm/enum/user-permission.enum.d.ts +30 -1
- package/dist/esm/enum/user-permission.enum.d.ts.map +1 -1
- package/dist/esm/enum/user-permission.enum.js +32 -0
- package/dist/esm/enum/user-permission.enum.js.map +1 -1
- package/dist/esm/type/api-response.type.d.ts +24 -28
- package/dist/esm/type/api-response.type.d.ts.map +1 -1
- package/dist/esm/type/index.d.ts +1 -0
- package/dist/esm/type/index.d.ts.map +1 -1
- package/dist/esm/type/index.js +1 -0
- package/dist/esm/type/index.js.map +1 -1
- package/dist/esm/type/iso-date-time.type.d.ts +17 -0
- package/dist/esm/type/iso-date-time.type.d.ts.map +1 -0
- package/dist/esm/type/iso-date-time.type.js +2 -0
- package/dist/esm/type/iso-date-time.type.js.map +1 -0
- package/package.json +22 -2
|
@@ -76,6 +76,38 @@ var UserPermission;
|
|
|
76
76
|
UserPermission["CONDUIT_PROVIDER_READ"] = "conduit:provider:read";
|
|
77
77
|
/** Define or amend a custom provider manifest — signature scheme, headers, handshake. */
|
|
78
78
|
UserPermission["CONDUIT_PROVIDER_MANAGE"] = "conduit:provider:manage";
|
|
79
|
+
// ── Destination (gateway mode) ──────────────────────────────────────────
|
|
80
|
+
/** Read destinations. Never exposes their stored header values. */
|
|
81
|
+
UserPermission["CONDUIT_DESTINATION_READ"] = "conduit:destination:read";
|
|
82
|
+
/**
|
|
83
|
+
* Create, amend or delete a destination — **a URL Conduit will then post to on its own**,
|
|
84
|
+
* repeatedly, from inside our network, carrying whatever a provider sent.
|
|
85
|
+
*
|
|
86
|
+
* Deliberately a single manage permission rather than create/update/delete: the dangerous
|
|
87
|
+
* act is naming the URL at all, and splitting it would imply the three carry different
|
|
88
|
+
* risk. They do not.
|
|
89
|
+
*/
|
|
90
|
+
UserPermission["CONDUIT_DESTINATION_MANAGE"] = "conduit:destination:manage";
|
|
91
|
+
// ── Route (gateway mode) ────────────────────────────────────────────────
|
|
92
|
+
UserPermission["CONDUIT_ROUTE_READ"] = "conduit:route:read";
|
|
93
|
+
/** Define which captures fan out to which destinations. */
|
|
94
|
+
UserPermission["CONDUIT_ROUTE_MANAGE"] = "conduit:route:manage";
|
|
95
|
+
// ── Delivery (gateway mode) ─────────────────────────────────────────────
|
|
96
|
+
/**
|
|
97
|
+
* Read the delivery log and the dead-letter queue, including each attempt's response.
|
|
98
|
+
*
|
|
99
|
+
* Grouped with reading rather than with operating the queue: a delivery record holds a
|
|
100
|
+
* target's response body, which can echo back the payload that was sent.
|
|
101
|
+
*/
|
|
102
|
+
UserPermission["CONDUIT_DELIVERY_READ"] = "conduit:delivery:read";
|
|
103
|
+
/**
|
|
104
|
+
* Redrive a dead-lettered delivery, or cancel one still pending.
|
|
105
|
+
*
|
|
106
|
+
* Separate from `CONDUIT_DELIVERY_READ` for the same reason replay is separate from capture
|
|
107
|
+
* read: it causes an outbound request rather than returning a row, and redriving a large
|
|
108
|
+
* dead-letter backlog is a way to flood a customer's own service.
|
|
109
|
+
*/
|
|
110
|
+
UserPermission["CONDUIT_DELIVERY_OPERATE"] = "conduit:delivery:operate";
|
|
79
111
|
})(UserPermission || (exports.UserPermission = UserPermission = {}));
|
|
80
112
|
/**
|
|
81
113
|
* Every member, for seeding the owner role and validating custom-role input.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-permission.enum.js","sourceRoot":"","sources":["../../../src/enum/user-permission.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"user-permission.enum.js","sourceRoot":"","sources":["../../../src/enum/user-permission.enum.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AACU,QAAA,oBAAoB,GAA8B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC"}
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import type { ErrorCode } from '../enum/error-code.enum.js';
|
|
2
2
|
import type { Maybe } from './nil.type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Envelope for a successful HTTP response.
|
|
5
|
-
*
|
|
6
|
-
* Every service wraps its payload in this shape, so a client can branch on
|
|
7
|
-
* `success` before touching anything else and never has to guess whether a
|
|
8
|
-
* 200 body is data or an error report.
|
|
9
|
-
*
|
|
10
|
-
* @typeParam T - the response payload type.
|
|
11
|
-
*/
|
|
12
|
-
export interface ApiSuccessResponse<T> {
|
|
13
|
-
success: true;
|
|
14
|
-
data: T;
|
|
15
|
-
}
|
|
16
3
|
/**
|
|
17
4
|
* The error half of {@link ApiErrorResponse}.
|
|
18
5
|
*
|
|
@@ -36,8 +23,30 @@ export interface ApiErrorBody {
|
|
|
36
23
|
correlationId?: Maybe<string>;
|
|
37
24
|
}
|
|
38
25
|
/**
|
|
39
|
-
* Envelope for a failed
|
|
40
|
-
*
|
|
26
|
+
* Envelope for a failed response, emitted by the SDK's `GlobalExceptionFilter` for every
|
|
27
|
+
* non-2xx status.
|
|
28
|
+
*
|
|
29
|
+
* **Only errors are enveloped.** A success is the bare payload — a tenant response *is* a
|
|
30
|
+
* tenant, not a `{ success, data }` wrapper around one. So `success: false` discriminates a
|
|
31
|
+
* shape the client receives *instead of* its payload, never alongside it:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* const body: unknown = await response.json();
|
|
35
|
+
*
|
|
36
|
+
* if (!response.ok) {
|
|
37
|
+
* throw new ApiError(body as ApiErrorResponse);
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* return body as Tenant;
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* This file also declared `ApiSuccessResponse<T>` and a union over the two until 0.3.0.
|
|
44
|
+
* Nothing ever sent it: both `iveri-identity-api` and `conduit-api` register the exception
|
|
45
|
+
* filter and no success interceptor. A type describing a response no service produces is worse
|
|
46
|
+
* than no type at all — reading it, the natural thing to write is `body.data`, which is
|
|
47
|
+
* `undefined` for every call in the application. It was removed rather than made true, because
|
|
48
|
+
* bare payloads were already shipped across two services and a frontend and the envelope added
|
|
49
|
+
* nothing to the HTTP status a client must check regardless.
|
|
41
50
|
*/
|
|
42
51
|
export interface ApiErrorResponse {
|
|
43
52
|
success: false;
|
|
@@ -47,17 +56,4 @@ export interface ApiErrorResponse {
|
|
|
47
56
|
/** Request path that produced the error, without the query string. */
|
|
48
57
|
path: string;
|
|
49
58
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Discriminated union of both envelopes. Narrow on `success`:
|
|
52
|
-
*
|
|
53
|
-
* ```ts
|
|
54
|
-
* if (!response.success) {
|
|
55
|
-
* return handle(response.error.code);
|
|
56
|
-
* }
|
|
57
|
-
* use(response.data);
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* @typeParam T - the payload type on the success branch.
|
|
61
|
-
*/
|
|
62
|
-
export type ApiResponse<T> = ApiSuccessResponse<T> | ApiErrorResponse;
|
|
63
59
|
//# sourceMappingURL=api-response.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-response.type.d.ts","sourceRoot":"","sources":["../../../src/type/api-response.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"api-response.type.d.ts","sourceRoot":"","sources":["../../../src/type/api-response.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,iFAAiF;IACjF,IAAI,EAAE,SAAS,CAAC;IAEhB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzC;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,YAAY,CAAC;IAEpB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAElB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/cjs/type/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
package/dist/cjs/type/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api-response.type.js"), exports);
|
|
18
18
|
__exportStar(require("./cursor-page.type.js"), exports);
|
|
19
|
+
__exportStar(require("./iso-date-time.type.js"), exports);
|
|
19
20
|
__exportStar(require("./nil.type.js"), exports);
|
|
20
21
|
__exportStar(require("./paginated.type.js"), exports);
|
|
21
22
|
__exportStar(require("./uuid.type.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,wDAAsC;AACtC,gDAA8B;AAC9B,sDAAoC;AACpC,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,wDAAsC;AACtC,0DAAwC;AACxC,gDAA8B;AAC9B,sDAAoC;AACpC,iDAA+B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An ISO-8601 timestamp as it appears on the wire: `2026-08-02T09:41:17.312Z`.
|
|
3
|
+
*
|
|
4
|
+
* **JSON has no date type**, so every timestamp a service sends is a string, whatever the
|
|
5
|
+
* entity behind it holds. Naming that is not pedantry — it is the single most reliable way to
|
|
6
|
+
* hand-retype a backend response wrongly. A frontend interface declaring `receivedAt: Date`
|
|
7
|
+
* compiles, and every `receivedAt.getTime()` throws at runtime against a value that is really
|
|
8
|
+
* a string. `conduit-admin-web` called this out in a comment and got it right by hand; the
|
|
9
|
+
* point of putting the shapes in this package is that nobody has to.
|
|
10
|
+
*
|
|
11
|
+
* It is an alias, not a branded type, deliberately. A brand would force a cast at every
|
|
12
|
+
* boundary where a string arrives from `JSON.parse` — which is all of them — and buy nothing,
|
|
13
|
+
* since the value genuinely is an unvalidated string until someone parses it. What this alias
|
|
14
|
+
* carries is the instruction: to get a `Date`, write `new Date(value)`.
|
|
15
|
+
*/
|
|
16
|
+
export type IsoDateTime = string;
|
|
17
|
+
//# sourceMappingURL=iso-date-time.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date-time.type.d.ts","sourceRoot":"","sources":["../../../src/type/iso-date-time.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date-time.type.js","sourceRoot":"","sources":["../../../src/type/iso-date-time.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { CursorPage } from '../../type/cursor-page.type.js';
|
|
2
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
3
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
4
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
5
|
+
import type { SignatureVerdict } from './signature-verdict.enum.js';
|
|
6
|
+
/** A capture without its body — one row of the list. */
|
|
7
|
+
export interface CaptureSummary {
|
|
8
|
+
id: UUID;
|
|
9
|
+
endpointId: UUID;
|
|
10
|
+
method: string;
|
|
11
|
+
/** Path after the ingress token. */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Raw query string, without the `?`. */
|
|
14
|
+
queryString: string;
|
|
15
|
+
contentType: Nullable<string>;
|
|
16
|
+
/** Body size in bytes, as received. */
|
|
17
|
+
bodySize: number;
|
|
18
|
+
/** Hex SHA-256 of the body. Compare this against what the provider says it sent. */
|
|
19
|
+
bodySha256: string;
|
|
20
|
+
/** From `x-forwarded-for`. Advisory — a client controls it. */
|
|
21
|
+
sourceIp: Nullable<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Verdict recorded **when the request arrived**. A snapshot: fixing the endpoint's secret
|
|
24
|
+
* does not rewrite it. Re-run the signature route to check against current configuration.
|
|
25
|
+
*/
|
|
26
|
+
signatureVerdict: Nullable<SignatureVerdict>;
|
|
27
|
+
/** A provider's URL-verification challenge rather than a real event. */
|
|
28
|
+
isHandshake: boolean;
|
|
29
|
+
receivedAt: IsoDateTime;
|
|
30
|
+
}
|
|
31
|
+
/** A capture with its headers and body. `GET /api/v1/capture/:id`. */
|
|
32
|
+
export interface CaptureDetail extends CaptureSummary {
|
|
33
|
+
/** Every request header, lowercase keys — including the signature headers. */
|
|
34
|
+
headers: Record<string, string | string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* The body as UTF-8 when it decodes cleanly, otherwise `null`.
|
|
37
|
+
*
|
|
38
|
+
* A convenience only. `toString('utf8')` never fails — it substitutes U+FFFD for every
|
|
39
|
+
* invalid sequence — so a gzip or protobuf body would come back as convincing-looking
|
|
40
|
+
* mojibake that no longer hashes to `bodySha256`. Conduit round-trips the decode and sends
|
|
41
|
+
* `null` when it does not survive, which is the honest answer.
|
|
42
|
+
*/
|
|
43
|
+
body: Nullable<string>;
|
|
44
|
+
/**
|
|
45
|
+
* The body as base64. **This is the authoritative field.** A webhook body is arbitrary
|
|
46
|
+
* bytes; base64 is the only representation that survives JSON without alteration, and the
|
|
47
|
+
* signed payload is those exact bytes.
|
|
48
|
+
*/
|
|
49
|
+
bodyBase64: string;
|
|
50
|
+
/** The body was too large to inline and was read back from a spill file. */
|
|
51
|
+
isSpilled: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** `GET /api/v1/capture`. */
|
|
54
|
+
export type CapturesPage = CursorPage<CaptureSummary>;
|
|
55
|
+
/**
|
|
56
|
+
* Query for `GET /api/v1/capture`.
|
|
57
|
+
*
|
|
58
|
+
* Cursor-paginated, unlike endpoints and providers: captures are appended to while they are
|
|
59
|
+
* being read — every inbound webhook lands at the top of the list, including while an operator
|
|
60
|
+
* pages through it — and offset paging drops or repeats rows under that.
|
|
61
|
+
*/
|
|
62
|
+
export interface GetCapturesQuery {
|
|
63
|
+
limit?: number;
|
|
64
|
+
/** Opaque cursor from the previous page's `nextCursor`. Never parse it. */
|
|
65
|
+
after?: Nullable<string>;
|
|
66
|
+
endpointId?: Nullable<UUID>;
|
|
67
|
+
method?: Nullable<string>;
|
|
68
|
+
signatureVerdict?: Nullable<SignatureVerdict>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=capture.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.type.d.ts","sourceRoot":"","sources":["../../../../src/api/conduit/capture.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,IAAI,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IAEb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE9B,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IAEjB,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;IAEnB,+DAA+D;IAC/D,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE3B;;;OAGG;IACH,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAE7C,wEAAwE;IACxE,WAAW,EAAE,OAAO,CAAC;IAErB,UAAU,EAAE,WAAW,CAAC;CAC3B;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAc,SAAQ,cAAc;IACjD,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEvB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,6BAA6B;AAC7B,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2EAA2E;IAC3E,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzB,UAAU,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.type.js","sourceRoot":"","sources":["../../../../src/api/conduit/capture.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { Paginated } from '../../type/paginated.type.js';
|
|
4
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
5
|
+
/**
|
|
6
|
+
* One endpoint on the wire.
|
|
7
|
+
*
|
|
8
|
+
* Carries `hasSigningSecret`, never the secret. Not a masked value, not a last-four hint — the
|
|
9
|
+
* field simply does not exist, so no future change can accidentally start populating it.
|
|
10
|
+
*/
|
|
11
|
+
export interface Endpoint {
|
|
12
|
+
id: UUID;
|
|
13
|
+
name: string;
|
|
14
|
+
description: Nullable<string>;
|
|
15
|
+
/** The path segment providers post to. */
|
|
16
|
+
ingressToken: string;
|
|
17
|
+
/**
|
|
18
|
+
* Path to register with the provider. Relative on purpose — the public origin is a tunnel or
|
|
19
|
+
* a load balancer this service cannot see, so the caller prepends its own.
|
|
20
|
+
*/
|
|
21
|
+
ingressPath: string;
|
|
22
|
+
providerKey: Nullable<string>;
|
|
23
|
+
/** Whether a signing secret is configured. The secret itself is never returned. */
|
|
24
|
+
hasSigningSecret: boolean;
|
|
25
|
+
/** Whether a handshake verify token is configured. */
|
|
26
|
+
hasVerifyToken: boolean;
|
|
27
|
+
/** Inactive endpoints answer 410 Gone. */
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
createdAt: IsoDateTime;
|
|
30
|
+
updatedAt: IsoDateTime;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `GET /api/v1/endpoint`. Offset-paginated, unlike captures: endpoints are a small, slow-moving
|
|
34
|
+
* collection a customer renders as numbered pages.
|
|
35
|
+
*/
|
|
36
|
+
export type EndpointsPage = Paginated<Endpoint>;
|
|
37
|
+
/** `POST /api/v1/endpoint`. */
|
|
38
|
+
export interface CreateEndpointBody {
|
|
39
|
+
name: string;
|
|
40
|
+
description?: Nullable<string>;
|
|
41
|
+
providerKey?: Nullable<string>;
|
|
42
|
+
signingSecret?: Nullable<string>;
|
|
43
|
+
verifyToken?: Nullable<string>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `PATCH /api/v1/endpoint/:id`.
|
|
47
|
+
*
|
|
48
|
+
* **Secret fields have three states, not two.** Omitting one leaves the stored secret untouched;
|
|
49
|
+
* sending `null` deletes it. A form must therefore never send `''` or `null` where the user
|
|
50
|
+
* meant "I did not change this" — that silently wipes a working signing secret, and the next
|
|
51
|
+
* webhook verifies as `MISSING_SECRET` with nothing to say why.
|
|
52
|
+
*/
|
|
53
|
+
export interface UpdateEndpointBody {
|
|
54
|
+
name?: string;
|
|
55
|
+
description?: Nullable<string>;
|
|
56
|
+
providerKey?: Nullable<string>;
|
|
57
|
+
signingSecret?: Nullable<string>;
|
|
58
|
+
verifyToken?: Nullable<string>;
|
|
59
|
+
isActive?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Query for `GET /api/v1/endpoint`. */
|
|
62
|
+
export interface GetEndpointsQuery {
|
|
63
|
+
limit?: number;
|
|
64
|
+
offset?: number;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=endpoint.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.type.d.ts","sourceRoot":"","sources":["../../../../src/api/conduit/endpoint.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE9B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE9B,mFAAmF;IACnF,gBAAgB,EAAE,OAAO,CAAC;IAE1B,sDAAsD;IACtD,cAAc,EAAE,OAAO,CAAC;IAExB,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAElB,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,EAAE,WAAW,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhD,+BAA+B;AAC/B,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.type.js","sourceRoot":"","sources":["../../../../src/api/conduit/endpoint.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a provider proves the endpoint is really ours before it will send anything.
|
|
3
|
+
*
|
|
4
|
+
* **Handshakes work in inspect mode, deliberately.** Meta will not save a callback URL that
|
|
5
|
+
* does not echo `hub.challenge`, and Slack will not save one that does not echo `challenge` —
|
|
6
|
+
* so without this, the local developer tool could never be registered with the provider at all,
|
|
7
|
+
* and there would be nothing to capture. It is the one piece of ingress behaviour that is not
|
|
8
|
+
* "store and acknowledge".
|
|
9
|
+
*/
|
|
10
|
+
export declare enum HandshakeKind {
|
|
11
|
+
/**
|
|
12
|
+
* Provider sends `GET ?mode=subscribe&verify_token=…&challenge=…` and expects the challenge
|
|
13
|
+
* echoed back as the plain-text body. Meta (WhatsApp, Messenger, Instagram).
|
|
14
|
+
*/
|
|
15
|
+
QUERY_ECHO = "query-echo",
|
|
16
|
+
/**
|
|
17
|
+
* Provider sends a JSON body carrying a trigger field and a challenge, and expects the
|
|
18
|
+
* challenge echoed in a JSON response. Slack (`type: url_verification`).
|
|
19
|
+
*/
|
|
20
|
+
JSON_ECHO = "json-echo"
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=handshake-kind.enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-kind.enum.d.ts","sourceRoot":"","sources":["../../../../src/api/conduit/handshake-kind.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,oBAAY,aAAa;IACrB;;;OAGG;IACH,UAAU,eAAe;IAEzB;;;OAGG;IACH,SAAS,cAAc;CAC1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a provider proves the endpoint is really ours before it will send anything.
|
|
3
|
+
*
|
|
4
|
+
* **Handshakes work in inspect mode, deliberately.** Meta will not save a callback URL that
|
|
5
|
+
* does not echo `hub.challenge`, and Slack will not save one that does not echo `challenge` —
|
|
6
|
+
* so without this, the local developer tool could never be registered with the provider at all,
|
|
7
|
+
* and there would be nothing to capture. It is the one piece of ingress behaviour that is not
|
|
8
|
+
* "store and acknowledge".
|
|
9
|
+
*/
|
|
10
|
+
export var HandshakeKind;
|
|
11
|
+
(function (HandshakeKind) {
|
|
12
|
+
/**
|
|
13
|
+
* Provider sends `GET ?mode=subscribe&verify_token=…&challenge=…` and expects the challenge
|
|
14
|
+
* echoed back as the plain-text body. Meta (WhatsApp, Messenger, Instagram).
|
|
15
|
+
*/
|
|
16
|
+
HandshakeKind["QUERY_ECHO"] = "query-echo";
|
|
17
|
+
/**
|
|
18
|
+
* Provider sends a JSON body carrying a trigger field and a challenge, and expects the
|
|
19
|
+
* challenge echoed in a JSON response. Slack (`type: url_verification`).
|
|
20
|
+
*/
|
|
21
|
+
HandshakeKind["JSON_ECHO"] = "json-echo";
|
|
22
|
+
})(HandshakeKind || (HandshakeKind = {}));
|
|
23
|
+
//# sourceMappingURL=handshake-kind.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-kind.enum.js","sourceRoot":"","sources":["../../../../src/api/conduit/handshake-kind.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACrB;;;OAGG;IACH,0CAAyB,CAAA;IAEzB;;;OAGG;IACH,wCAAuB,CAAA;AAC3B,CAAC,EAZW,aAAa,KAAb,aAAa,QAYxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './capture.type.js';
|
|
2
|
+
export * from './endpoint.type.js';
|
|
3
|
+
export * from './handshake-kind.enum.js';
|
|
4
|
+
export * from './provider.type.js';
|
|
5
|
+
export * from './replay.type.js';
|
|
6
|
+
export * from './signature-algorithm.enum.js';
|
|
7
|
+
export * from './signature-encoding.enum.js';
|
|
8
|
+
export * from './signature-header-scheme.enum.js';
|
|
9
|
+
export * from './signature-verdict.enum.js';
|
|
10
|
+
export * from './signature.type.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/conduit/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './capture.type.js';
|
|
2
|
+
export * from './endpoint.type.js';
|
|
3
|
+
export * from './handshake-kind.enum.js';
|
|
4
|
+
export * from './provider.type.js';
|
|
5
|
+
export * from './replay.type.js';
|
|
6
|
+
export * from './signature-algorithm.enum.js';
|
|
7
|
+
export * from './signature-encoding.enum.js';
|
|
8
|
+
export * from './signature-header-scheme.enum.js';
|
|
9
|
+
export * from './signature-verdict.enum.js';
|
|
10
|
+
export * from './signature.type.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/conduit/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
import type { HandshakeKind } from './handshake-kind.enum.js';
|
|
5
|
+
import type { SignatureAlgorithm } from './signature-algorithm.enum.js';
|
|
6
|
+
import type { SignatureEncoding } from './signature-encoding.enum.js';
|
|
7
|
+
import type { SignatureHeaderScheme } from './signature-header-scheme.enum.js';
|
|
8
|
+
/** Required in `signedPayloadTemplate`; substituted with the raw request bytes. */
|
|
9
|
+
export declare const SIGNED_PAYLOAD_BODY_TOKEN = "{body}";
|
|
10
|
+
/** Optional in `signedPayloadTemplate`; substituted with the timestamp exactly as received. */
|
|
11
|
+
export declare const SIGNED_PAYLOAD_TIMESTAMP_TOKEN = "{timestamp}";
|
|
12
|
+
/**
|
|
13
|
+
* How to verify one provider's HMAC.
|
|
14
|
+
*
|
|
15
|
+
* A manifest holds **no secret**. It describes where a signature lives and how it is computed,
|
|
16
|
+
* never the key it is computed with — which is why it is returned in full to anyone with
|
|
17
|
+
* `conduit:provider:read` while the signing secret it is used against is returned to nobody.
|
|
18
|
+
*
|
|
19
|
+
* This is the response shape: every key is present, absent ones are `null`. The request shape
|
|
20
|
+
* is {@link SignatureManifestInput}, where they may be omitted.
|
|
21
|
+
*/
|
|
22
|
+
export interface SignatureManifest {
|
|
23
|
+
algorithm: SignatureAlgorithm;
|
|
24
|
+
encoding: SignatureEncoding;
|
|
25
|
+
/** Lowercase header the signature arrives in, e.g. `x-hub-signature-256`. */
|
|
26
|
+
headerName: string;
|
|
27
|
+
headerScheme: SignatureHeaderScheme;
|
|
28
|
+
/** Literal prefix stripped before comparison, e.g. `sha256=`. `DIRECT` scheme only. */
|
|
29
|
+
headerPrefix: Nullable<string>;
|
|
30
|
+
/** Key naming the signature inside a `KEY_VALUE_LIST` header, e.g. `v1`. */
|
|
31
|
+
signatureKey: Nullable<string>;
|
|
32
|
+
/** Separate header carrying the signed timestamp, when it is not in the signature header. */
|
|
33
|
+
timestampHeaderName: Nullable<string>;
|
|
34
|
+
/** Key naming the timestamp inside a `KEY_VALUE_LIST` header, e.g. `t`. */
|
|
35
|
+
timestampKey: Nullable<string>;
|
|
36
|
+
/** Replay window. Null disables the age check entirely. */
|
|
37
|
+
timestampToleranceSeconds: Nullable<number>;
|
|
38
|
+
/**
|
|
39
|
+
* What gets hashed. {@link SIGNED_PAYLOAD_BODY_TOKEN} is required;
|
|
40
|
+
* {@link SIGNED_PAYLOAD_TIMESTAMP_TOKEN} is optional — Slack's is `v0:{timestamp}:{body}`,
|
|
41
|
+
* Meta's is just `{body}`.
|
|
42
|
+
*/
|
|
43
|
+
signedPayloadTemplate: string;
|
|
44
|
+
}
|
|
45
|
+
/** {@link SignatureManifest} as sent on create/update: nullable fields may simply be omitted. */
|
|
46
|
+
export interface SignatureManifestInput {
|
|
47
|
+
algorithm: SignatureAlgorithm;
|
|
48
|
+
encoding: SignatureEncoding;
|
|
49
|
+
headerName: string;
|
|
50
|
+
headerScheme: SignatureHeaderScheme;
|
|
51
|
+
headerPrefix?: Nullable<string>;
|
|
52
|
+
signatureKey?: Nullable<string>;
|
|
53
|
+
timestampHeaderName?: Nullable<string>;
|
|
54
|
+
timestampKey?: Nullable<string>;
|
|
55
|
+
timestampToleranceSeconds?: Nullable<number>;
|
|
56
|
+
signedPayloadTemplate: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* How to answer one provider's URL-verification challenge.
|
|
60
|
+
*
|
|
61
|
+
* The fields split by {@link HandshakeKind} — a `QUERY_ECHO` manifest populates the four query
|
|
62
|
+
* parameter names and nulls the rest, a `JSON_ECHO` manifest does the opposite.
|
|
63
|
+
*/
|
|
64
|
+
export interface HandshakeManifest {
|
|
65
|
+
kind: HandshakeKind;
|
|
66
|
+
/** Query parameter holding the value to echo back, e.g. `hub.challenge`. */
|
|
67
|
+
challengeParam: Nullable<string>;
|
|
68
|
+
/** Query parameter holding the token to compare against the endpoint's, e.g. `hub.verify_token`. */
|
|
69
|
+
verifyTokenParam: Nullable<string>;
|
|
70
|
+
/** Query parameter naming the operation, e.g. `hub.mode`. */
|
|
71
|
+
modeParam: Nullable<string>;
|
|
72
|
+
/** Value `modeParam` must hold for this to be a handshake, e.g. `subscribe`. */
|
|
73
|
+
expectedMode: Nullable<string>;
|
|
74
|
+
/** Top-level body field identifying a handshake, e.g. `type`. */
|
|
75
|
+
triggerField: Nullable<string>;
|
|
76
|
+
/** Value `triggerField` must hold, e.g. `url_verification`. */
|
|
77
|
+
triggerValue: Nullable<string>;
|
|
78
|
+
/** Body field holding the value to echo back, e.g. `challenge`. */
|
|
79
|
+
challengeField: Nullable<string>;
|
|
80
|
+
}
|
|
81
|
+
/** {@link HandshakeManifest} as sent on create/update: nullable fields may simply be omitted. */
|
|
82
|
+
export interface HandshakeManifestInput {
|
|
83
|
+
kind: HandshakeKind;
|
|
84
|
+
challengeParam?: Nullable<string>;
|
|
85
|
+
verifyTokenParam?: Nullable<string>;
|
|
86
|
+
modeParam?: Nullable<string>;
|
|
87
|
+
expectedMode?: Nullable<string>;
|
|
88
|
+
triggerField?: Nullable<string>;
|
|
89
|
+
triggerValue?: Nullable<string>;
|
|
90
|
+
challengeField?: Nullable<string>;
|
|
91
|
+
}
|
|
92
|
+
/** One provider on the wire. `GET /api/v1/provider`. */
|
|
93
|
+
export interface Provider {
|
|
94
|
+
/** Null for a built-in — it is not a row and cannot be edited or deleted. */
|
|
95
|
+
id: Nullable<UUID>;
|
|
96
|
+
key: string;
|
|
97
|
+
name: string;
|
|
98
|
+
description: Nullable<string>;
|
|
99
|
+
/** Null when this provider signs nothing. */
|
|
100
|
+
signature: Nullable<SignatureManifest>;
|
|
101
|
+
/** Null when this provider has no URL challenge. */
|
|
102
|
+
handshake: Nullable<HandshakeManifest>;
|
|
103
|
+
/**
|
|
104
|
+
* Ships with Conduit, in code rather than as a seeded row. Override it by creating your own
|
|
105
|
+
* under the same key — resolution checks a tenant's rows first.
|
|
106
|
+
*/
|
|
107
|
+
isBuiltIn: boolean;
|
|
108
|
+
/** Null for a built-in. */
|
|
109
|
+
createdAt: Nullable<IsoDateTime>;
|
|
110
|
+
/** Null for a built-in. */
|
|
111
|
+
updatedAt: Nullable<IsoDateTime>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Not paginated: the list is the built-ins plus whatever one customer has defined by hand.
|
|
115
|
+
* Wrapped in an object rather than returned as a bare array so a `total` or a cursor can be
|
|
116
|
+
* added later without breaking every client.
|
|
117
|
+
*/
|
|
118
|
+
export interface ProvidersList {
|
|
119
|
+
items: Provider[];
|
|
120
|
+
}
|
|
121
|
+
/** `POST /api/v1/provider`. */
|
|
122
|
+
export interface CreateProviderBody {
|
|
123
|
+
key: string;
|
|
124
|
+
name: string;
|
|
125
|
+
description?: Nullable<string>;
|
|
126
|
+
signature?: Nullable<SignatureManifestInput>;
|
|
127
|
+
handshake?: Nullable<HandshakeManifestInput>;
|
|
128
|
+
}
|
|
129
|
+
/** `PATCH /api/v1/provider/:id`. */
|
|
130
|
+
export interface UpdateProviderBody {
|
|
131
|
+
name?: string;
|
|
132
|
+
description?: Nullable<string>;
|
|
133
|
+
/** Send `null` to stop verifying this provider's signatures. */
|
|
134
|
+
signature?: Nullable<SignatureManifestInput>;
|
|
135
|
+
/** Send `null` to stop answering this provider's challenge. */
|
|
136
|
+
handshake?: Nullable<HandshakeManifestInput>;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=provider.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.type.d.ts","sourceRoot":"","sources":["../../../../src/api/conduit/provider.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,mFAAmF;AACnF,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAElD,+FAA+F;AAC/F,eAAO,MAAM,8BAA8B,gBAAgB,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IAEnB,YAAY,EAAE,qBAA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;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED,+BAA+B;AAC/B,MAAM,WAAW,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAChD;AAED,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE/B,gEAAgE;IAChE,SAAS,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IAE7C,+DAA+D;IAC/D,SAAS,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Required in `signedPayloadTemplate`; substituted with the raw request bytes. */
|
|
2
|
+
export const SIGNED_PAYLOAD_BODY_TOKEN = '{body}';
|
|
3
|
+
/** Optional in `signedPayloadTemplate`; substituted with the timestamp exactly as received. */
|
|
4
|
+
export const SIGNED_PAYLOAD_TIMESTAMP_TOKEN = '{timestamp}';
|
|
5
|
+
//# sourceMappingURL=provider.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.type.js","sourceRoot":"","sources":["../../../../src/api/conduit/provider.type.ts"],"names":[],"mappings":"AASA,mFAAmF;AACnF,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAElD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC"}
|