@substrat-run/control-plane-api 0.82.0 → 0.84.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/api.d.ts +10 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +25 -0
- package/dist/api.js.map +1 -1
- package/dist/connection-grants.d.ts +65 -0
- package/dist/connection-grants.d.ts.map +1 -0
- package/dist/connection-grants.js +0 -0
- package/dist/connection-grants.js.map +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +1 -1
- package/dist/failure-attribution.d.ts +49 -0
- package/dist/failure-attribution.d.ts.map +1 -0
- package/dist/failure-attribution.js +95 -0
- package/dist/failure-attribution.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/platform-drain.d.ts +7 -1
- package/dist/platform-drain.d.ts.map +1 -1
- package/dist/platform-drain.js +31 -10
- package/dist/platform-drain.js.map +1 -1
- package/dist/vertical-client.d.ts +8 -1
- package/dist/vertical-client.d.ts.map +1 -1
- package/dist/vertical-client.js +1 -0
- package/dist/vertical-client.js.map +1 -1
- package/package.json +5 -5
package/dist/api.d.ts
CHANGED
|
@@ -55,6 +55,16 @@ export interface ControlPlaneApiOptions {
|
|
|
55
55
|
* the same Workers-for-Platforms swap later.
|
|
56
56
|
*/
|
|
57
57
|
verticals?: Record<string, VerticalClient>;
|
|
58
|
+
/**
|
|
59
|
+
* The standing grants each connector declares, by provider (#726 gap 2) — e.g.
|
|
60
|
+
* `{ scrive: SCRIVE_CONNECTION_GRANTS }`.
|
|
61
|
+
*
|
|
62
|
+
* Every reconcile heals a connection toward this floor before gathering, which is what
|
|
63
|
+
* makes a missing capability repairable by a PUSH rather than by re-typing a working
|
|
64
|
+
* credential. Absent ⇒ nothing is healed and the gather behaves exactly as before, so a
|
|
65
|
+
* host that configures no connectors is unaffected.
|
|
66
|
+
*/
|
|
67
|
+
connectorGrants?: Readonly<Record<string, readonly string[]>>;
|
|
58
68
|
/**
|
|
59
69
|
* Resolves a vertical dynamically — the dispatch swap for provisioning (orchestration.md
|
|
60
70
|
* §5.4), the mirror of the router's `verticalFor`. Given a slug, the host looks up the
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuC5B,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EAGf,eAAe,EAMhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuC5B,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EAGf,eAAe,EAMhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAkBrF,OAAO,KAAK,EAEV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAA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gB,CAAC,EAAE,oBAAoB,CAAC;IACxC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAKD,KAAK,IAAI,GAAG;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AA2P7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAAE,SAAS,EAAE,IAAI,CAAA;CAAE,CAAC,CAutHhG"}
|
package/dist/api.js
CHANGED
|
@@ -3,6 +3,7 @@ import { adminAction, ASSET_PART_PREFIX, assetHash, channelName, connectionActiv
|
|
|
3
3
|
import { migrationProgress, ulid } from '@substrat-run/kernel';
|
|
4
4
|
import { TENANT_HEADER } from './auth.js';
|
|
5
5
|
import { connectionGrantsForScope } from './vertical-client.js';
|
|
6
|
+
import { reconcileConnectionGrants } from './connection-grants.js';
|
|
6
7
|
import { ConnectionRelayError, relayConnectionUpsert } from './connection-relay.js';
|
|
7
8
|
import { ControlPlaneError } from './client.js';
|
|
8
9
|
import { provisionSiblingScope } from './platform-drain.js';
|
|
@@ -1240,6 +1241,21 @@ export function createControlPlaneApi(options) {
|
|
|
1240
1241
|
// #592: connection grants ride the same authoritative gather — the back-fill for a
|
|
1241
1242
|
// scope provisioned before `grantToConnection` ran, and how a revoked connection's
|
|
1242
1243
|
// grants stop being delivered (they are absent from the directory's live rows).
|
|
1244
|
+
// #726 gap 2: heal FIRST, gather second. The gather only ever delivered grants that
|
|
1245
|
+
// already existed as directory rows, so a capability the connector requires and the
|
|
1246
|
+
// connection never received was repairable only by re-submitting the credential. This
|
|
1247
|
+
// is the operator's existing lever (`substrat scope provision`, the idempotent
|
|
1248
|
+
// repair), so a missing grant is now fixed by the same command that fixes everything
|
|
1249
|
+
// else — and by a push, once a connector's declaration changes.
|
|
1250
|
+
//
|
|
1251
|
+
// Best-effort: healing reaches the directory and must never take the reconcile down
|
|
1252
|
+
// with it. A failure here leaves exactly the behaviour that shipped before it existed.
|
|
1253
|
+
try {
|
|
1254
|
+
await reconcileConnectionGrants({ admin, actor, declared: options.connectorGrants ?? {} }, tenantId, scope.vertical);
|
|
1255
|
+
}
|
|
1256
|
+
catch {
|
|
1257
|
+
// The next reconcile tries again; the read-back still shows what is missing.
|
|
1258
|
+
}
|
|
1243
1259
|
const connectionGrants = connectionGrantsForScope(await admin.listConnectionGrants(actor, tenantId), scope.vertical, scopeId);
|
|
1244
1260
|
// #687: connection sealing keys ride the same gather — the back-fill for a scope
|
|
1245
1261
|
// provisioned before its connection existed, and the channel a connection made AFTER
|
|
@@ -2224,6 +2240,15 @@ export function createControlPlaneApi(options) {
|
|
|
2224
2240
|
// install provisioned after `grantToConnection` holds the same `connection:<id>` tuple
|
|
2225
2241
|
// as one provisioned before it, and the connector return path works without a human
|
|
2226
2242
|
// replaying grants per install.
|
|
2243
|
+
// #726 gap 2: heal before gathering here too, so a NEW install of a vertical whose
|
|
2244
|
+
// connector has since declared another grant receives it — rather than inheriting the
|
|
2245
|
+
// gap the tenant's first install was created with.
|
|
2246
|
+
try {
|
|
2247
|
+
await reconcileConnectionGrants({ admin, actor: c.get('actor'), declared: options.connectorGrants ?? {} }, input.tenantId, slug);
|
|
2248
|
+
}
|
|
2249
|
+
catch {
|
|
2250
|
+
// Best-effort, exactly as on the reconcile route.
|
|
2251
|
+
}
|
|
2227
2252
|
const connectionGrants = connectionGrantsForScope(await admin.listConnectionGrants(c.get('actor'), input.tenantId), slug, input.scopeId);
|
|
2228
2253
|
// #687: and the public sealing keys of this tenant's live connections for the same
|
|
2229
2254
|
// vertical, so the new install can seal a value TO a connector from its first
|