@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.
@@ -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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.65",
3
+ "version": "0.6.68",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"