@get-bb/plugin-sdk 0.6.65 → 0.6.73
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 +2 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +1192 -440
- 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 +34 -14
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +19 -2
- package/bundled-types/bb-plugin-sdk.d.ts +6463 -5633
- package/dist/app.js +98 -4
- package/dist/index.js +16 -0
- package/dist/internal/composer-handle.js +14 -15
- package/dist/internal/plugin-app-collector.js +243 -150
- package/dist/internal/rpc-query-host.js +1987 -193
- 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 +2577 -450
- package/dist/testing/index.js +69 -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);
|
|
@@ -3247,13 +3248,21 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3247
3248
|
};
|
|
3248
3249
|
const rpcHandlers = /* @__PURE__ */ new Map();
|
|
3249
3250
|
const rpcInvalidations = [];
|
|
3251
|
+
const invalidationListeners = /* @__PURE__ */ new Set();
|
|
3250
3252
|
const rpc = {
|
|
3253
|
+
experimental_whileWatched(method) {
|
|
3254
|
+
assertLive();
|
|
3255
|
+
if (!rpcHandlers.has(method))
|
|
3256
|
+
throw new Error(`Unknown RPC method: ${method}`);
|
|
3257
|
+
},
|
|
3251
3258
|
experimental_invalidate(tags) {
|
|
3252
3259
|
assertLive();
|
|
3260
|
+
for (const listener of invalidationListeners) listener();
|
|
3253
3261
|
rpcInvalidations.push(rpcInvalidationTags.parse(tags));
|
|
3254
3262
|
},
|
|
3255
3263
|
experimental_invalidateAll() {
|
|
3256
3264
|
assertLive();
|
|
3265
|
+
for (const listener of invalidationListeners) listener();
|
|
3257
3266
|
rpcInvalidations.push(null);
|
|
3258
3267
|
},
|
|
3259
3268
|
register(contract, handlers, registrationOptions) {
|
|
@@ -3447,8 +3456,34 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3447
3456
|
get experimental_dataDir() {
|
|
3448
3457
|
assertLive();
|
|
3449
3458
|
return dataDir;
|
|
3459
|
+
},
|
|
3460
|
+
async internal_DO_NOT_USE_openTunnelIngress(ingressOptions) {
|
|
3461
|
+
assertLive();
|
|
3462
|
+
const audience = ingressOptions?.audience;
|
|
3463
|
+
if (typeof audience !== "string" || audience.length === 0) {
|
|
3464
|
+
throw new Error(
|
|
3465
|
+
"bb.server.internal_DO_NOT_USE_openTunnelIngress needs a non-empty audience"
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3468
|
+
const shared = tunnelIngresses.find(
|
|
3469
|
+
(entry2) => entry2.audience === audience && !entry2.closed
|
|
3470
|
+
);
|
|
3471
|
+
const entry = {
|
|
3472
|
+
audience,
|
|
3473
|
+
baseUrl: shared?.baseUrl ?? `http://127.0.0.1:${FAKE_TUNNEL_INGRESS_FIRST_PORT + tunnelIngresses.length}`,
|
|
3474
|
+
closed: false
|
|
3475
|
+
};
|
|
3476
|
+
tunnelIngresses.push(entry);
|
|
3477
|
+
const close = async () => {
|
|
3478
|
+
entry.closed = true;
|
|
3479
|
+
const index = disposeHooks.indexOf(close);
|
|
3480
|
+
if (index !== -1) disposeHooks.splice(index, 1);
|
|
3481
|
+
};
|
|
3482
|
+
disposeHooks.push(close);
|
|
3483
|
+
return { baseUrl: entry.baseUrl, close };
|
|
3450
3484
|
}
|
|
3451
3485
|
};
|
|
3486
|
+
const tunnelIngresses = [];
|
|
3452
3487
|
const { sdk, harness: sdkHarness } = createFakeSdk({
|
|
3453
3488
|
pluginId,
|
|
3454
3489
|
overrides: options.sdk
|
|
@@ -3520,6 +3555,9 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3520
3555
|
});
|
|
3521
3556
|
}
|
|
3522
3557
|
const sharedPortDeclarations = [];
|
|
3558
|
+
let nextTunnelConfig = null;
|
|
3559
|
+
let nextTunnelStatuses = [];
|
|
3560
|
+
const nextTunnelListeners = /* @__PURE__ */ new Set();
|
|
3523
3561
|
const hostRpcCalls = [];
|
|
3524
3562
|
const hostWorkerExitSubscriptions = [];
|
|
3525
3563
|
const hostSignalSubscriptions = [];
|
|
@@ -3650,10 +3688,27 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3650
3688
|
} else {
|
|
3651
3689
|
sharedPortDeclarations[existingIndex] = replacement;
|
|
3652
3690
|
}
|
|
3691
|
+
},
|
|
3692
|
+
internal_DO_NOT_USE_setNextTunnels(config) {
|
|
3693
|
+
assertLive();
|
|
3694
|
+
nextTunnelConfig = config === null ? null : { domain: config.domain, server: { ...config.server } };
|
|
3695
|
+
},
|
|
3696
|
+
internal_DO_NOT_USE_nextTunnelStatuses() {
|
|
3697
|
+
assertLive();
|
|
3698
|
+
return structuredClone(nextTunnelStatuses);
|
|
3699
|
+
},
|
|
3700
|
+
internal_DO_NOT_USE_onNextTunnelStatusChange(listener) {
|
|
3701
|
+
assertLive();
|
|
3702
|
+
nextTunnelListeners.add(listener);
|
|
3703
|
+
return () => {
|
|
3704
|
+
nextTunnelListeners.delete(listener);
|
|
3705
|
+
};
|
|
3653
3706
|
}
|
|
3654
3707
|
};
|
|
3655
3708
|
disposeHooks.push(() => {
|
|
3656
3709
|
sharedPortDeclarations.length = 0;
|
|
3710
|
+
nextTunnelConfig = null;
|
|
3711
|
+
nextTunnelListeners.clear();
|
|
3657
3712
|
});
|
|
3658
3713
|
const events = {
|
|
3659
3714
|
on(event, handler) {
|
|
@@ -3860,13 +3915,27 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3860
3915
|
},
|
|
3861
3916
|
pluginId,
|
|
3862
3917
|
logEntries,
|
|
3918
|
+
experimental_onRpcInvalidation(listener) {
|
|
3919
|
+
invalidationListeners.add(listener);
|
|
3920
|
+
return () => {
|
|
3921
|
+
invalidationListeners.delete(listener);
|
|
3922
|
+
};
|
|
3923
|
+
},
|
|
3863
3924
|
experimental_rpcInvalidations: rpcInvalidations,
|
|
3864
3925
|
realtimeSignals,
|
|
3865
3926
|
needsConfigurationMessages,
|
|
3866
3927
|
get recheckCount() {
|
|
3867
3928
|
return requestedDrains;
|
|
3868
3929
|
},
|
|
3930
|
+
internal_DO_NOT_USE_tunnelIngresses: tunnelIngresses,
|
|
3869
3931
|
sharedPortDeclarations,
|
|
3932
|
+
get internal_DO_NOT_USE_nextTunnelConfig() {
|
|
3933
|
+
return nextTunnelConfig;
|
|
3934
|
+
},
|
|
3935
|
+
internal_DO_NOT_USE_setNextTunnelStatuses(statuses) {
|
|
3936
|
+
nextTunnelStatuses = structuredClone([...statuses]);
|
|
3937
|
+
for (const listener of [...nextTunnelListeners]) listener();
|
|
3938
|
+
},
|
|
3870
3939
|
experimental_hostRpcCalls: hostRpcCalls,
|
|
3871
3940
|
sdk: sdkHarness,
|
|
3872
3941
|
registrations: {
|