@substrat-run/vertical-host 0.219.0 → 0.221.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connect-link.d.ts +49 -2
- package/dist/connect-link.d.ts.map +1 -1
- package/dist/connect-link.js +29 -2
- package/dist/connect-link.js.map +1 -1
- package/dist/connect-url.d.ts +18 -1
- package/dist/connect-url.d.ts.map +1 -1
- package/dist/connect-url.js +15 -1
- package/dist/connect-url.js.map +1 -1
- package/dist/connections.d.ts +90 -7
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +53 -5
- package/dist/connections.js.map +1 -1
- package/dist/connectors.d.ts +87 -1
- package/dist/connectors.d.ts.map +1 -1
- package/dist/connectors.js +121 -3
- package/dist/connectors.js.map +1 -1
- package/dist/docs-renderer.generated.d.ts.map +1 -1
- package/dist/docs-renderer.generated.js +1 -1
- package/dist/docs-renderer.generated.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -21
- package/dist/index.js.map +1 -1
- package/dist/mail-in.d.ts +27 -5
- package/dist/mail-in.d.ts.map +1 -1
- package/dist/mail-in.js +16 -3
- package/dist/mail-in.js.map +1 -1
- package/dist/mcp-images.d.ts +32 -0
- package/dist/mcp-images.d.ts.map +1 -0
- package/dist/mcp-images.js +64 -0
- package/dist/mcp-images.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +24 -3
- package/dist/mcp.js.map +1 -1
- package/dist/worker-door.d.ts +190 -5
- package/dist/worker-door.d.ts.map +1 -1
- package/dist/worker-door.js +196 -16
- package/dist/worker-door.js.map +1 -1
- package/package.json +11 -11
package/dist/connect-link.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ import type { ConnectLinkListRelayResult, ConnectLinkRelayResult, ConnectLinkRev
|
|
|
59
59
|
* return there, carrying `link=<id>` and your `subjectRef`. List and revoke reach only this
|
|
60
60
|
* scope's links: a list omits another scope's id exactly as an unknown one, and a revoke
|
|
61
61
|
* answers both with a `404`.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Goes with `mintConnectLink`, `listConnectLinks` and `revokeConnectLink` in the next major of
|
|
64
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
62
65
|
*/
|
|
63
66
|
export interface ConnectLinkRelayAccess {
|
|
64
67
|
/** The control plane's origin, injected into the vertical as `CONTROL_PLANE_URL`. */
|
|
@@ -72,6 +75,10 @@ export interface ConnectLinkRelayAccess {
|
|
|
72
75
|
/** `fetch` seam for tests; defaults to the runtime's, bound (see `lint:bound-fetch`). */
|
|
73
76
|
fetchImpl?: typeof fetch;
|
|
74
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Goes with `mintConnectLink` in the next major of `@substrat-run/vertical-host`
|
|
80
|
+
* (#3374).
|
|
81
|
+
*/
|
|
75
82
|
export interface ConnectLinkRequest extends ConnectLinkRelayAccess {
|
|
76
83
|
/** Provider slug (`fortnox`). One with no platform consent round is refused, naming the paste door. */
|
|
77
84
|
provider: string;
|
|
@@ -84,17 +91,36 @@ export interface ConnectLinkRequest extends ConnectLinkRelayAccess {
|
|
|
84
91
|
/** Seconds the link stays openable. Default 7 days; more than 30 days is refused. */
|
|
85
92
|
ttlSeconds?: number;
|
|
86
93
|
}
|
|
87
|
-
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Goes with `listConnectLinks` in the next major of `@substrat-run/vertical-host`
|
|
96
|
+
* (#3374).
|
|
97
|
+
*/
|
|
98
|
+
export interface ConnectLinkListRequest extends Omit<ConnectLinkRelayAccess, 'platformSecret'> {
|
|
99
|
+
/**
|
|
100
|
+
* Leave it out on the worker's own request path: a list is a read, and the platform accepts the
|
|
101
|
+
* caller the dispatch proves instead (#3374, decision (d)(2)). Required from inside a Durable
|
|
102
|
+
* Object, where no caller is proven.
|
|
103
|
+
*/
|
|
104
|
+
platformSecret?: string;
|
|
88
105
|
/** The links to read — ids your mints returned, 1 to 100. One not in this scope is omitted. */
|
|
89
106
|
linkIds: readonly string[];
|
|
90
107
|
provider?: string;
|
|
91
108
|
/** Only the links that can still be opened. Omitted: every named link, newest first. */
|
|
92
109
|
outstanding?: boolean;
|
|
93
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated Goes with `revokeConnectLink` in the next major of `@substrat-run/vertical-host`
|
|
113
|
+
* (#3374).
|
|
114
|
+
*/
|
|
94
115
|
export interface ConnectLinkRevokeRequest extends ConnectLinkRelayAccess {
|
|
95
116
|
linkId: string;
|
|
96
117
|
}
|
|
97
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* The relay refused, or could not be reached. Carries the status so a caller can map it.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Goes with `mintConnectLink`, `listConnectLinks` and `revokeConnectLink` in the next major of
|
|
122
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
123
|
+
*/
|
|
98
124
|
export declare class ConnectLinkRequestError extends Error {
|
|
99
125
|
readonly status: number;
|
|
100
126
|
/**
|
|
@@ -115,7 +141,28 @@ export declare class ConnectLinkRequestError extends Error {
|
|
|
115
141
|
*/
|
|
116
142
|
problemCode?: ErrorCode | undefined);
|
|
117
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
146
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
147
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
148
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
149
|
+
* host`.
|
|
150
|
+
*/
|
|
118
151
|
export declare function mintConnectLink(request: ConnectLinkRequest): Promise<ConnectLinkRelayResult>;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
154
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
155
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
156
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
157
|
+
* host`.
|
|
158
|
+
*/
|
|
119
159
|
export declare function listConnectLinks(request: ConnectLinkListRequest): Promise<ConnectLinkListRelayResult>;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
162
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
163
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
164
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
165
|
+
* host`.
|
|
166
|
+
*/
|
|
120
167
|
export declare function revokeConnectLink(request: ConnectLinkRevokeRequest): Promise<ConnectLinkRevokeRelayResult>;
|
|
121
168
|
//# sourceMappingURL=connect-link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-link.d.ts","sourceRoot":"","sources":["../src/connect-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/G,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"connect-link.d.ts","sourceRoot":"","sources":["../src/connect-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/G,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,eAAe,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,cAA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ED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAYrG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAQ1G"}
|
package/dist/connect-link.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PLATFORM_SECRET_HEADER, problemCodeOf, problemDetail } from '@substrat-run/contracts';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The relay refused, or could not be reached. Carries the status so a caller can map it.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Goes with `mintConnectLink`, `listConnectLinks` and `revokeConnectLink` in the next major of
|
|
6
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
7
|
+
*/
|
|
3
8
|
export class ConnectLinkRequestError extends Error {
|
|
4
9
|
status;
|
|
5
10
|
problemCode;
|
|
@@ -23,9 +28,10 @@ async function relay(access, path, body, ok, what) {
|
|
|
23
28
|
const base = access.controlPlaneUrl.replace(/\/+$/, '');
|
|
24
29
|
const res = await fetchImpl(`${base}${path}`, {
|
|
25
30
|
method: 'POST',
|
|
31
|
+
// Only when given one: a list on the worker's own request path is made on the proof alone (#3374).
|
|
26
32
|
headers: {
|
|
27
33
|
'content-type': 'application/json',
|
|
28
|
-
[PLATFORM_SECRET_HEADER]: access.platformSecret,
|
|
34
|
+
...(access.platformSecret ? { [PLATFORM_SECRET_HEADER]: access.platformSecret } : {}),
|
|
29
35
|
},
|
|
30
36
|
body: JSON.stringify({ tenantId: access.tenantId, scopeId: access.scopeId, ...body }),
|
|
31
37
|
});
|
|
@@ -35,6 +41,13 @@ async function relay(access, path, body, ok, what) {
|
|
|
35
41
|
}
|
|
36
42
|
return answer;
|
|
37
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
46
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
47
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
48
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
49
|
+
* host`.
|
|
50
|
+
*/
|
|
38
51
|
export function mintConnectLink(request) {
|
|
39
52
|
return relay(request, '/internal/connections/connect-links', {
|
|
40
53
|
provider: request.provider,
|
|
@@ -44,6 +57,13 @@ export function mintConnectLink(request) {
|
|
|
44
57
|
...(request.ttlSeconds ? { ttlSeconds: request.ttlSeconds } : {}),
|
|
45
58
|
}, (b) => typeof b.url === 'string' && !!b.link, `mint a ${request.provider} connect link`);
|
|
46
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
62
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
63
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
64
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
65
|
+
* host`.
|
|
66
|
+
*/
|
|
47
67
|
export function listConnectLinks(request) {
|
|
48
68
|
return relay(request, '/internal/connections/connect-links/list', {
|
|
49
69
|
linkIds: request.linkIds,
|
|
@@ -51,6 +71,13 @@ export function listConnectLinks(request) {
|
|
|
51
71
|
...(request.outstanding ? { outstanding: true } : {}),
|
|
52
72
|
}, (b) => Array.isArray(b.links), 'list connect links');
|
|
53
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
76
|
+
* Replaced by a consent round the platform mints and owns (#3374, decision (b)): the vertical
|
|
77
|
+
* writes a request, the platform mints the link and owns the callback, and the person is sent to a
|
|
78
|
+
* page the platform owns. Not built yet. Removed in the next major of `@substrat-run/vertical-
|
|
79
|
+
* host`.
|
|
80
|
+
*/
|
|
54
81
|
export function revokeConnectLink(request) {
|
|
55
82
|
return relay(request, '/internal/connections/connect-links/revoke', { linkId: request.linkId }, (b) => !!b.link, `revoke connect link ${request.linkId}`);
|
|
56
83
|
}
|
package/dist/connect-link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-link.js","sourceRoot":"","sources":["../src/connect-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-link.js","sourceRoot":"","sources":["../src/connect-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AA8H/G;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAGrC,MAAM;IAQN,WAAW;IAVtB,YACE,OAAe,EACN,MAAc;IACvB;;;;;;OAMG;IACM,WAAuB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;sBAVN,MAAM;2BAQN,WAAW;QAGpB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED,KAAK,UAAU,KAAK,CAClB,MAAoF,EACpF,IAAY,EACZ,IAA6B,EAC7B,EAAiC,EACjC,IAAY;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,EAAE;QAC5C,MAAM,EAAE,MAAM;QACd,mGAAmG;QACnG,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,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,CAAC,EAAE,CAAC;KAClE,EACD,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5C,UAAU,OAAO,CAAC,QAAQ,eAAe,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA+B;IAC9D,OAAO,KAAK,CACV,OAAO,EACP,0CAA0C,EAC1C;QACE,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,EACD,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAC7B,oBAAoB,CACrB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,OAAO,KAAK,CACV,OAAO,EACP,4CAA4C,EAC5C,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAC1B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EACf,uBAAuB,OAAO,CAAC,MAAM,EAAE,CACxC,CAAC;AACJ,CAAC"}
|
package/dist/connect-url.d.ts
CHANGED
|
@@ -53,6 +53,9 @@ import type { ConnectUrlRelayResult, ErrorCode } from '@substrat-run/contracts';
|
|
|
53
53
|
* callback — naming someone else's scope does not borrow their vertical, it fails.
|
|
54
54
|
* `returnUrl` is likewise checked against the hostname map: it must be a surface this
|
|
55
55
|
* scope actually answers on, or the call is refused.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated Goes with `requestConnectUrl` in the next major of `@substrat-run/vertical-host`
|
|
58
|
+
* (#3374).
|
|
56
59
|
*/
|
|
57
60
|
export interface ConnectUrlRequest {
|
|
58
61
|
/** The control plane's origin, injected into the vertical as `CONTROL_PLANE_URL`. */
|
|
@@ -84,7 +87,12 @@ export interface ConnectUrlRequest {
|
|
|
84
87
|
/** `fetch` seam for tests; defaults to the runtime's, bound (see `lint:bound-fetch`). */
|
|
85
88
|
fetchImpl?: typeof fetch;
|
|
86
89
|
}
|
|
87
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* The relay refused, or could not be reached. Carries the status so a caller can map it.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated Goes with `requestConnectUrl` in the next major of `@substrat-run/vertical-host`
|
|
94
|
+
* (#3374).
|
|
95
|
+
*/
|
|
88
96
|
export declare class ConnectUrlRequestError extends Error {
|
|
89
97
|
readonly status: number;
|
|
90
98
|
/**
|
|
@@ -105,5 +113,14 @@ export declare class ConnectUrlRequestError extends Error {
|
|
|
105
113
|
*/
|
|
106
114
|
problemCode?: ErrorCode | undefined);
|
|
107
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated K-58 step 6 (#3374): this is an up-call with the shared platform credential, and it
|
|
118
|
+
* goes. Write the request from the operation instead, with `requestConnect(ctx, …)` from
|
|
119
|
+
* `@substrat-run/kernel`, and redirect the browser to `connectRequestUrl(env.CONTROL_PLANE_URL,
|
|
120
|
+
* { tenantId, scopeId, requestId })`: the platform's own page reads the request out of the scope,
|
|
121
|
+
* mints the round and owns the callback, and the principal on the connection is the kernel's stamp
|
|
122
|
+
* rather than a value the harness passes. The route this calls stays accepted until K-58 step 7, so
|
|
123
|
+
* a version built with it keeps working until then; it is removed in vertical-host's next major.
|
|
124
|
+
*/
|
|
108
125
|
export declare function requestConnectUrl(request: ConnectUrlRequest): Promise<ConnectUrlRelayResult>;
|
|
109
126
|
//# sourceMappingURL=connect-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-url.d.ts","sourceRoot":"","sources":["../src/connect-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"connect-url.d.ts","sourceRoot":"","sources":["../src/connect-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,eAAe,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,uGAAuG;IACvG,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,yFAAyF;IACzF,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAG7C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS;IAVlC,YACE,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM;IACvB;;;;;;OAMG;IACM,WAAW,CAAC,EAAE,SAAS,YAAA,EAIjC;CACF;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6BlG"}
|
package/dist/connect-url.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PLATFORM_SECRET_HEADER, problemCodeOf, problemDetail } from '@substrat-run/contracts';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The relay refused, or could not be reached. Carries the status so a caller can map it.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Goes with `requestConnectUrl` in the next major of `@substrat-run/vertical-host`
|
|
6
|
+
* (#3374).
|
|
7
|
+
*/
|
|
3
8
|
export class ConnectUrlRequestError extends Error {
|
|
4
9
|
status;
|
|
5
10
|
problemCode;
|
|
@@ -18,6 +23,15 @@ export class ConnectUrlRequestError extends Error {
|
|
|
18
23
|
this.name = 'ConnectUrlRequestError';
|
|
19
24
|
}
|
|
20
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated K-58 step 6 (#3374): this is an up-call with the shared platform credential, and it
|
|
28
|
+
* goes. Write the request from the operation instead, with `requestConnect(ctx, …)` from
|
|
29
|
+
* `@substrat-run/kernel`, and redirect the browser to `connectRequestUrl(env.CONTROL_PLANE_URL,
|
|
30
|
+
* { tenantId, scopeId, requestId })`: the platform's own page reads the request out of the scope,
|
|
31
|
+
* mints the round and owns the callback, and the principal on the connection is the kernel's stamp
|
|
32
|
+
* rather than a value the harness passes. The route this calls stays accepted until K-58 step 7, so
|
|
33
|
+
* a version built with it keeps working until then; it is removed in vertical-host's next major.
|
|
34
|
+
*/
|
|
21
35
|
export async function requestConnectUrl(request) {
|
|
22
36
|
const fetchImpl = request.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
23
37
|
const base = request.controlPlaneUrl.replace(/\/+$/, '');
|
package/dist/connect-url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-url.js","sourceRoot":"","sources":["../src/connect-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-url.js","sourceRoot":"","sources":["../src/connect-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4F/F;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAGpC,MAAM;IAQN,WAAW;IAVtB,YACE,OAAe,EACN,MAAc;IACvB;;;;;;OAMG;IACM,WAAuB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;sBAVN,MAAM;2BAQN,WAAW;QAGpB,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA0B;IAChE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,IAAI,mCAAmC,EAAE;QACtE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,cAAc;SACjD;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD,CAAC;KACH,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAmC,CAAC;IACpF,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,IAAI,sBAAsB,CAC9B,mCAAmC,OAAO,CAAC,QAAQ,mBAAmB,GAAG,CAAC,MAAM,MAAM,aAAa,CAAC,IAAI,CAAC,IAAI,eAAe,EAAE,EAC9H,GAAG,CAAC,MAAM,EACV,aAAa,CAAC,IAAI,CAAC,CACpB,CAAC;IACJ,CAAC;IACD,OAAO,IAA6B,CAAC;AACvC,CAAC"}
|
package/dist/connections.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ import type { ConnectionBindingsRequest, ConnectionBindingsResult, ConnectionBin
|
|
|
27
27
|
* and the connector validates the options. Bind and unbind, and an `owner: 'scope'` upsert, need a
|
|
28
28
|
* PROVEN caller: call them from the worker, on the request it is serving, never from inside a
|
|
29
29
|
* Durable Object.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Goes with `upsertConnection`, `bindConnection`, `unbindConnection`, `listBindings`, `syncConnections` and `requestCheckout` in the next major of
|
|
32
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
30
33
|
*/
|
|
31
34
|
export interface ConnectionRelayAccess {
|
|
32
35
|
/** The control plane's origin, injected into the vertical as `CONTROL_PLANE_URL`. */
|
|
@@ -36,13 +39,50 @@ export interface ConnectionRelayAccess {
|
|
|
36
39
|
/** `fetch` seam for tests; defaults to the runtime's, bound (see `lint:bound-fetch`). */
|
|
37
40
|
fetchImpl?: typeof fetch;
|
|
38
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* What a synchronous read takes (`listBindings`, `syncConnections`, `requestCheckout`): the same
|
|
44
|
+
* access, with `platformSecret` optional. Made on the worker's own request path, a read needs none,
|
|
45
|
+
* because the platform accepts the caller the dispatch proves instead (#3374, decision (d)(2)).
|
|
46
|
+
* Every one of them needs a proven caller anyway, so leave it out.
|
|
47
|
+
*/
|
|
48
|
+
type ConnectionReadAccess = Omit<ConnectionRelayAccess, 'platformSecret'> & {
|
|
49
|
+
platformSecret?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Goes with `upsertConnection` in the next major of `@substrat-run/vertical-host`
|
|
53
|
+
* (#3374).
|
|
54
|
+
*/
|
|
39
55
|
export type UpsertConnectionRequest = ConnectionRelayAccess & z.input<typeof connectionRelayRequest>;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Goes with `bindConnection` in the next major of `@substrat-run/vertical-host`
|
|
58
|
+
* (#3374).
|
|
59
|
+
*/
|
|
40
60
|
export type BindConnectionRequest = ConnectionRelayAccess & ConnectionBindRequest;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Goes with `unbindConnection` in the next major of `@substrat-run/vertical-host`
|
|
63
|
+
* (#3374).
|
|
64
|
+
*/
|
|
41
65
|
export type UnbindConnectionRequest = ConnectionRelayAccess & ConnectionUnbindRequest;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Goes with `listBindings` in the next major of `@substrat-run/vertical-host` (#3374).
|
|
68
|
+
*/
|
|
69
|
+
export type ListBindingsRequest = ConnectionReadAccess & ConnectionBindingsRequest;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Goes with `syncConnections` in the next major of `@substrat-run/vertical-host`
|
|
72
|
+
* (#3374).
|
|
73
|
+
*/
|
|
74
|
+
export type SyncConnectionsRequest = ConnectionReadAccess & ConnectionSyncRequest;
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Goes with `requestCheckout` in the next major of `@substrat-run/vertical-host`
|
|
77
|
+
* (#3374).
|
|
78
|
+
*/
|
|
79
|
+
export type CheckoutRequest = ConnectionReadAccess & z.input<typeof connectionCheckoutRequest>;
|
|
80
|
+
/**
|
|
81
|
+
* The relay refused, or answered something other than its result. Carries the status so a caller can map it.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated Goes with `upsertConnection`, `bindConnection`, `unbindConnection`, `listBindings`, `syncConnections` and `requestCheckout` in the next major of
|
|
84
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
85
|
+
*/
|
|
46
86
|
export declare class ConnectionRequestError extends Error {
|
|
47
87
|
readonly status: number;
|
|
48
88
|
/**
|
|
@@ -63,11 +103,29 @@ export declare class ConnectionRequestError extends Error {
|
|
|
63
103
|
*/
|
|
64
104
|
problemCode?: ErrorCode | undefined);
|
|
65
105
|
}
|
|
66
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Create the connection, or rotate the live one's secret in place. The answer never echoes the secret.
|
|
108
|
+
*
|
|
109
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
110
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
111
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
112
|
+
*/
|
|
67
113
|
export declare function upsertConnection(request: UpsertConnectionRequest): Promise<ConnectionRelayResult>;
|
|
68
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Bind the scope's own connection to that scope with these options; a rebind keeps options it does not name.
|
|
116
|
+
*
|
|
117
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
118
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
119
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
120
|
+
*/
|
|
69
121
|
export declare function bindConnection(request: BindConnectionRequest): Promise<ConnectionBindResult>;
|
|
70
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Drop the binding and take its landing key back on this scope; what the scope landed stays. Idempotent.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
126
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
127
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
128
|
+
*/
|
|
71
129
|
export declare function unbindConnection(request: UnbindConnectionRequest): Promise<ConnectionUnbindResult>;
|
|
72
130
|
/**
|
|
73
131
|
* The scope's own connections bound to it, each with its last successful sweep (`lastSyncedAt`) and
|
|
@@ -80,12 +138,28 @@ export declare function unbindConnection(request: UnbindConnectionRequest): Prom
|
|
|
80
138
|
* up — and for the tenant's connections bound to the scope as well, each marked `owner: 'tenant'`.
|
|
81
139
|
* A sweep that moved past a record it could not land still completes `ok`, so `health` is what
|
|
82
140
|
* tells a stalled binding from a caught-up one.
|
|
141
|
+
*
|
|
142
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
143
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
144
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
145
|
+
*
|
|
146
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
147
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
148
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
83
149
|
*/
|
|
84
150
|
export declare function listBindings(request: ListBindingsRequest): Promise<ConnectionBindingsResult>;
|
|
85
151
|
/**
|
|
86
152
|
* Poll the scope's bindings of `provider` now (#2672), the tenant's connections bound to it as well
|
|
87
153
|
* as its own, and answer what each poll did. A binding polled in the last minute refuses the call
|
|
88
154
|
* with 429; nothing is queued. A provider whose bindings cannot be polled on request answers 501.
|
|
155
|
+
*
|
|
156
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
157
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
158
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
159
|
+
*
|
|
160
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
161
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
162
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
89
163
|
*/
|
|
90
164
|
export declare function syncConnections(request: SyncConnectionsRequest): Promise<ConnectionSyncResult>;
|
|
91
165
|
/**
|
|
@@ -104,6 +178,15 @@ export declare function syncConnections(request: SyncConnectionsRequest): Promis
|
|
|
104
178
|
* `paymentChange`, keyed by `reference`. Asking again for a reference while its checkout is open
|
|
105
179
|
* answers the same page; a reference already paid is refused with 409, and so is a scope with no
|
|
106
180
|
* payment connection bound. A preview or fork is refused with 403: it never charges anyone.
|
|
181
|
+
*
|
|
182
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
183
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
184
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
185
|
+
*
|
|
186
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
187
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
188
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
107
189
|
*/
|
|
108
190
|
export declare function requestCheckout(request: CheckoutRequest): Promise<ConnectionCheckoutResult>;
|
|
191
|
+
export {};
|
|
109
192
|
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,SAAS,EACT,yBAAyB,EACzB,sBAAsB,EACtB,CAAC,EACF,MAAM,yBAAyB,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,SAAS,EACT,yBAAyB,EACzB,sBAAsB,EACtB,CAAC,EACF,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,qBAAqB;IACpC,qFAAqF;IACrF,eAAe,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED;;;;;GAKG;AACH,KAAK,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GAAG,C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AAO,CAAC,oBAAoB,CAAC,CAE9F;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAE3F"}
|
package/dist/connections.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PLATFORM_SECRET_HEADER, problemCodeOf, problemDetail, connectionBindResult, connectionBindingsResult, connectionCheckoutResult, connectionRelayResult, connectionSyncResult, connectionUnbindResult } from '@substrat-run/contracts';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The relay refused, or answered something other than its result. Carries the status so a caller can map it.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Goes with `upsertConnection`, `bindConnection`, `unbindConnection`, `listBindings`, `syncConnections` and `requestCheckout` in the next major of
|
|
6
|
+
* `@substrat-run/vertical-host` (#3374).
|
|
7
|
+
*/
|
|
3
8
|
export class ConnectionRequestError extends Error {
|
|
4
9
|
status;
|
|
5
10
|
problemCode;
|
|
@@ -21,7 +26,8 @@ export class ConnectionRequestError extends Error {
|
|
|
21
26
|
async function relay({ controlPlaneUrl, platformSecret, fetchImpl, ...body }, path, result, what) {
|
|
22
27
|
const res = await (fetchImpl ?? globalThis.fetch.bind(globalThis))(`${controlPlaneUrl.replace(/\/+$/, '')}${path}`, {
|
|
23
28
|
method: 'POST',
|
|
24
|
-
|
|
29
|
+
// Only when given one: a read on the worker's own request path is made on the proof alone (#3374).
|
|
30
|
+
headers: { 'content-type': 'application/json', ...(platformSecret ? { [PLATFORM_SECRET_HEADER]: platformSecret } : {}) },
|
|
25
31
|
body: JSON.stringify(body),
|
|
26
32
|
});
|
|
27
33
|
const answer = await res.json().catch(() => ({}));
|
|
@@ -31,15 +37,33 @@ async function relay({ controlPlaneUrl, platformSecret, fetchImpl, ...body }, pa
|
|
|
31
37
|
}
|
|
32
38
|
return parsed.data;
|
|
33
39
|
}
|
|
34
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Create the connection, or rotate the live one's secret in place. The answer never echoes the secret.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
44
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
45
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
46
|
+
*/
|
|
35
47
|
export function upsertConnection(request) {
|
|
36
48
|
return relay(request, '/internal/connections/upsert', connectionRelayResult, `store a ${request.provider} connection`);
|
|
37
49
|
}
|
|
38
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Bind the scope's own connection to that scope with these options; a rebind keeps options it does not name.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
54
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
55
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
56
|
+
*/
|
|
39
57
|
export function bindConnection(request) {
|
|
40
58
|
return relay(request, '/internal/connections/bind', connectionBindResult, `bind connection ${request.connectionId}`);
|
|
41
59
|
}
|
|
42
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Drop the binding and take its landing key back on this scope; what the scope landed stays. Idempotent.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
64
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
65
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
66
|
+
*/
|
|
43
67
|
export function unbindConnection(request) {
|
|
44
68
|
return relay(request, '/internal/connections/unbind', connectionUnbindResult, `unbind connection ${request.connectionId}`);
|
|
45
69
|
}
|
|
@@ -54,6 +78,14 @@ export function unbindConnection(request) {
|
|
|
54
78
|
* up — and for the tenant's connections bound to the scope as well, each marked `owner: 'tenant'`.
|
|
55
79
|
* A sweep that moved past a record it could not land still completes `ok`, so `health` is what
|
|
56
80
|
* tells a stalled binding from a caught-up one.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
83
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
84
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
85
|
+
*
|
|
86
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
87
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
88
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
57
89
|
*/
|
|
58
90
|
export function listBindings(request) {
|
|
59
91
|
return relay(request, '/internal/connections/bindings', connectionBindingsResult, 'list connection bindings');
|
|
@@ -62,6 +94,14 @@ export function listBindings(request) {
|
|
|
62
94
|
* Poll the scope's bindings of `provider` now (#2672), the tenant's connections bound to it as well
|
|
63
95
|
* as its own, and answer what each poll did. A binding polled in the last minute refuses the call
|
|
64
96
|
* with 429; nothing is queued. A provider whose bindings cannot be polled on request answers 501.
|
|
97
|
+
*
|
|
98
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
99
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
100
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
101
|
+
*
|
|
102
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
103
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
104
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
65
105
|
*/
|
|
66
106
|
export function syncConnections(request) {
|
|
67
107
|
return relay(request, '/internal/connections/sync', connectionSyncResult, `poll ${request.provider} bindings`);
|
|
@@ -82,6 +122,14 @@ export function syncConnections(request) {
|
|
|
82
122
|
* `paymentChange`, keyed by `reference`. Asking again for a reference while its checkout is open
|
|
83
123
|
* answers the same page; a reference already paid is refused with 409, and so is a scope with no
|
|
84
124
|
* payment connection bound. A preview or fork is refused with 403: it never charges anyone.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated An up-call with the platform credential, which K-58 retires (rollout step 6, #3374).
|
|
127
|
+
* Nothing in this repository calls it, so no transport replaces it (#3374, decision (d)(3)), and it
|
|
128
|
+
* is removed in the next major of `@substrat-run/vertical-host`.
|
|
129
|
+
*
|
|
130
|
+
* Leave `platformSecret` out: called on the worker's own request path, as it must be, the platform
|
|
131
|
+
* accepts the caller the dispatch proves instead (#3374, decision (d)(2)). From inside a Durable
|
|
132
|
+
* Object nothing proves the caller, and the platform refuses it whatever it presents.
|
|
85
133
|
*/
|
|
86
134
|
export function requestCheckout(request) {
|
|
87
135
|
return relay(request, '/internal/connections/checkout', connectionCheckoutResult, `open a ${request.provider} checkout`);
|
package/dist/connections.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAiG9O;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAGpC,MAAM;IAQN,WAAW;IAVtB,YACE,OAAe,EACN,MAAc;IACvB;;;;;;OAMG;IACM,WAAuB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;sBAV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