@get-bb/plugin-sdk 0.6.65 → 0.6.68
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/bundled-types/bb-plugin-sdk-app.d.ts +136 -86
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +60 -35
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +5 -11
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +18 -2
- package/bundled-types/bb-plugin-sdk.d.ts +231 -87
- package/dist/internal/composer-handle.js +13 -14
- package/dist/internal/plugin-app-collector.js +90 -87
- package/dist/internal/rpc-query-host.js +833 -181
- package/dist/provider-bridge-acp-next.js +2599 -2627
- package/dist/provider-bridge-acp.js +2599 -2627
- package/dist/provider-bridge-testing.js +1210 -1238
- package/dist/provider-bridge.js +1258 -1286
- package/dist/testing/app.js +919 -284
- package/dist/testing/index.js +55 -0
- package/package.json +1 -1
package/dist/testing/index.js
CHANGED
|
@@ -3072,6 +3072,7 @@ function jsonRoundTrip(value, what) {
|
|
|
3072
3072
|
function throwRpcError(error) {
|
|
3073
3073
|
throw new experimental_PluginRpcCallError(error);
|
|
3074
3074
|
}
|
|
3075
|
+
var FAKE_TUNNEL_INGRESS_FIRST_PORT = 41e3;
|
|
3075
3076
|
var fakeHostDisposers = /* @__PURE__ */ new WeakMap();
|
|
3076
3077
|
function createFakePluginHost(options = {}) {
|
|
3077
3078
|
return createFakePluginHostInternal(options);
|
|
@@ -3447,8 +3448,34 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3447
3448
|
get experimental_dataDir() {
|
|
3448
3449
|
assertLive();
|
|
3449
3450
|
return dataDir;
|
|
3451
|
+
},
|
|
3452
|
+
async internal_DO_NOT_USE_openTunnelIngress(ingressOptions) {
|
|
3453
|
+
assertLive();
|
|
3454
|
+
const audience = ingressOptions?.audience;
|
|
3455
|
+
if (typeof audience !== "string" || audience.length === 0) {
|
|
3456
|
+
throw new Error(
|
|
3457
|
+
"bb.server.internal_DO_NOT_USE_openTunnelIngress needs a non-empty audience"
|
|
3458
|
+
);
|
|
3459
|
+
}
|
|
3460
|
+
const shared = tunnelIngresses.find(
|
|
3461
|
+
(entry2) => entry2.audience === audience && !entry2.closed
|
|
3462
|
+
);
|
|
3463
|
+
const entry = {
|
|
3464
|
+
audience,
|
|
3465
|
+
baseUrl: shared?.baseUrl ?? `http://127.0.0.1:${FAKE_TUNNEL_INGRESS_FIRST_PORT + tunnelIngresses.length}`,
|
|
3466
|
+
closed: false
|
|
3467
|
+
};
|
|
3468
|
+
tunnelIngresses.push(entry);
|
|
3469
|
+
const close = async () => {
|
|
3470
|
+
entry.closed = true;
|
|
3471
|
+
const index = disposeHooks.indexOf(close);
|
|
3472
|
+
if (index !== -1) disposeHooks.splice(index, 1);
|
|
3473
|
+
};
|
|
3474
|
+
disposeHooks.push(close);
|
|
3475
|
+
return { baseUrl: entry.baseUrl, close };
|
|
3450
3476
|
}
|
|
3451
3477
|
};
|
|
3478
|
+
const tunnelIngresses = [];
|
|
3452
3479
|
const { sdk, harness: sdkHarness } = createFakeSdk({
|
|
3453
3480
|
pluginId,
|
|
3454
3481
|
overrides: options.sdk
|
|
@@ -3520,6 +3547,9 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3520
3547
|
});
|
|
3521
3548
|
}
|
|
3522
3549
|
const sharedPortDeclarations = [];
|
|
3550
|
+
let nextTunnelConfig = null;
|
|
3551
|
+
let nextTunnelStatuses = [];
|
|
3552
|
+
const nextTunnelListeners = /* @__PURE__ */ new Set();
|
|
3523
3553
|
const hostRpcCalls = [];
|
|
3524
3554
|
const hostWorkerExitSubscriptions = [];
|
|
3525
3555
|
const hostSignalSubscriptions = [];
|
|
@@ -3650,10 +3680,27 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3650
3680
|
} else {
|
|
3651
3681
|
sharedPortDeclarations[existingIndex] = replacement;
|
|
3652
3682
|
}
|
|
3683
|
+
},
|
|
3684
|
+
internal_DO_NOT_USE_setNextTunnels(config) {
|
|
3685
|
+
assertLive();
|
|
3686
|
+
nextTunnelConfig = config === null ? null : { domain: config.domain, server: { ...config.server } };
|
|
3687
|
+
},
|
|
3688
|
+
internal_DO_NOT_USE_nextTunnelStatuses() {
|
|
3689
|
+
assertLive();
|
|
3690
|
+
return structuredClone(nextTunnelStatuses);
|
|
3691
|
+
},
|
|
3692
|
+
internal_DO_NOT_USE_onNextTunnelStatusChange(listener) {
|
|
3693
|
+
assertLive();
|
|
3694
|
+
nextTunnelListeners.add(listener);
|
|
3695
|
+
return () => {
|
|
3696
|
+
nextTunnelListeners.delete(listener);
|
|
3697
|
+
};
|
|
3653
3698
|
}
|
|
3654
3699
|
};
|
|
3655
3700
|
disposeHooks.push(() => {
|
|
3656
3701
|
sharedPortDeclarations.length = 0;
|
|
3702
|
+
nextTunnelConfig = null;
|
|
3703
|
+
nextTunnelListeners.clear();
|
|
3657
3704
|
});
|
|
3658
3705
|
const events = {
|
|
3659
3706
|
on(event, handler) {
|
|
@@ -3866,7 +3913,15 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3866
3913
|
get recheckCount() {
|
|
3867
3914
|
return requestedDrains;
|
|
3868
3915
|
},
|
|
3916
|
+
internal_DO_NOT_USE_tunnelIngresses: tunnelIngresses,
|
|
3869
3917
|
sharedPortDeclarations,
|
|
3918
|
+
get internal_DO_NOT_USE_nextTunnelConfig() {
|
|
3919
|
+
return nextTunnelConfig;
|
|
3920
|
+
},
|
|
3921
|
+
internal_DO_NOT_USE_setNextTunnelStatuses(statuses) {
|
|
3922
|
+
nextTunnelStatuses = structuredClone([...statuses]);
|
|
3923
|
+
for (const listener of [...nextTunnelListeners]) listener();
|
|
3924
|
+
},
|
|
3870
3925
|
experimental_hostRpcCalls: hostRpcCalls,
|
|
3871
3926
|
sdk: sdkHarness,
|
|
3872
3927
|
registrations: {
|