@tinycloud/sdk-core 3.2.0-beta.2 → 3.2.0-beta.3

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/index.cjs CHANGED
@@ -351,6 +351,7 @@ __export(index_exports, {
351
351
  generateRandomReceiverKey: () => import_sdk_services9.generateRandomReceiverKey,
352
352
  getPolicyRootStatusV3: () => getPolicyRootStatusV3,
353
353
  getTinyCloudDebugLogs: () => import_sdk_services9.getTinyCloudDebugLogs,
354
+ grantPathsForSelector: () => grantPathsForSelector,
354
355
  hasTinyCloudManageKeyScope: () => hasTinyCloudManageKeyScope,
355
356
  hexDecode: () => import_sdk_services9.hexDecode,
356
357
  hexEncode: () => import_sdk_services9.hexEncode,
@@ -15295,9 +15296,10 @@ async function ignoreIndexFailure(task) {
15295
15296
  var import_sdk_services9 = require("@tinycloud/sdk-services");
15296
15297
 
15297
15298
  // src/space.ts
15298
- async function fetchPeerId(host, spaceId) {
15299
+ async function fetchPeerId(host, spaceId, signal) {
15299
15300
  const res = await fetch(
15300
- `${host}/peer/generate/${encodeURIComponent(spaceId)}`
15301
+ `${host}/peer/generate/${encodeURIComponent(spaceId)}`,
15302
+ { signal }
15301
15303
  );
15302
15304
  if (!res.ok) {
15303
15305
  const error = await res.text().catch(() => res.statusText);
@@ -15307,10 +15309,11 @@ async function fetchPeerId(host, spaceId) {
15307
15309
  }
15308
15310
  return res.text();
15309
15311
  }
15310
- async function submitHostDelegation(host, headers) {
15312
+ async function submitHostDelegation(host, headers, signal) {
15311
15313
  const res = await fetch(`${host}/delegate`, {
15312
15314
  method: "POST",
15313
- headers
15315
+ headers,
15316
+ signal
15314
15317
  });
15315
15318
  if (!res.ok) {
15316
15319
  return {
@@ -15339,7 +15342,8 @@ function activationFlightKey(host, delegationHeader) {
15339
15342
  );
15340
15343
  return JSON.stringify([host, entries]);
15341
15344
  }
15342
- async function activateSessionWithHost(host, delegationHeader) {
15345
+ async function activateSessionWithHost(host, delegationHeader, signal) {
15346
+ if (signal) return postSessionActivation(host, delegationHeader, signal);
15343
15347
  const key = activationFlightKey(host, delegationHeader);
15344
15348
  const existing = inFlightActivations.get(key);
15345
15349
  if (!existing) return startActivationFlight(key, host, delegationHeader);
@@ -15361,10 +15365,11 @@ function startActivationFlight(key, host, delegationHeader) {
15361
15365
  flight.then(evict, evict);
15362
15366
  return flight;
15363
15367
  }
15364
- async function postSessionActivation(host, delegationHeader) {
15368
+ async function postSessionActivation(host, delegationHeader, signal) {
15365
15369
  const res = await fetch(`${host}/delegate`, {
15366
15370
  method: "POST",
15367
- headers: delegationHeader
15371
+ headers: delegationHeader,
15372
+ signal
15368
15373
  });
15369
15374
  if (res.ok) {
15370
15375
  try {
@@ -18945,4 +18950,9 @@ function decodeBase64Url4(value) {
18945
18950
  }
18946
18951
  return Uint8Array.from(bytes2);
18947
18952
  }
18953
+
18954
+ // src/replication/selector.ts
18955
+ function grantPathsForSelector(selector) {
18956
+ return selector === "" || selector.endsWith("/") ? [selector] : [selector, `${selector}/`];
18957
+ }
18948
18958
  //# sourceMappingURL=index.cjs.map