@tinycloud/sdk-core 3.2.0-beta.2 → 3.2.0-beta.5
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 +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -15295,9 +15295,10 @@ async function ignoreIndexFailure(task) {
|
|
|
15295
15295
|
var import_sdk_services9 = require("@tinycloud/sdk-services");
|
|
15296
15296
|
|
|
15297
15297
|
// src/space.ts
|
|
15298
|
-
async function fetchPeerId(host, spaceId) {
|
|
15298
|
+
async function fetchPeerId(host, spaceId, signal) {
|
|
15299
15299
|
const res = await fetch(
|
|
15300
|
-
`${host}/peer/generate/${encodeURIComponent(spaceId)}
|
|
15300
|
+
`${host}/peer/generate/${encodeURIComponent(spaceId)}`,
|
|
15301
|
+
{ signal }
|
|
15301
15302
|
);
|
|
15302
15303
|
if (!res.ok) {
|
|
15303
15304
|
const error = await res.text().catch(() => res.statusText);
|
|
@@ -15307,10 +15308,11 @@ async function fetchPeerId(host, spaceId) {
|
|
|
15307
15308
|
}
|
|
15308
15309
|
return res.text();
|
|
15309
15310
|
}
|
|
15310
|
-
async function submitHostDelegation(host, headers) {
|
|
15311
|
+
async function submitHostDelegation(host, headers, signal) {
|
|
15311
15312
|
const res = await fetch(`${host}/delegate`, {
|
|
15312
15313
|
method: "POST",
|
|
15313
|
-
headers
|
|
15314
|
+
headers,
|
|
15315
|
+
signal
|
|
15314
15316
|
});
|
|
15315
15317
|
if (!res.ok) {
|
|
15316
15318
|
return {
|
|
@@ -15339,7 +15341,8 @@ function activationFlightKey(host, delegationHeader) {
|
|
|
15339
15341
|
);
|
|
15340
15342
|
return JSON.stringify([host, entries]);
|
|
15341
15343
|
}
|
|
15342
|
-
async function activateSessionWithHost(host, delegationHeader) {
|
|
15344
|
+
async function activateSessionWithHost(host, delegationHeader, signal) {
|
|
15345
|
+
if (signal) return postSessionActivation(host, delegationHeader, signal);
|
|
15343
15346
|
const key = activationFlightKey(host, delegationHeader);
|
|
15344
15347
|
const existing = inFlightActivations.get(key);
|
|
15345
15348
|
if (!existing) return startActivationFlight(key, host, delegationHeader);
|
|
@@ -15361,10 +15364,11 @@ function startActivationFlight(key, host, delegationHeader) {
|
|
|
15361
15364
|
flight.then(evict, evict);
|
|
15362
15365
|
return flight;
|
|
15363
15366
|
}
|
|
15364
|
-
async function postSessionActivation(host, delegationHeader) {
|
|
15367
|
+
async function postSessionActivation(host, delegationHeader, signal) {
|
|
15365
15368
|
const res = await fetch(`${host}/delegate`, {
|
|
15366
15369
|
method: "POST",
|
|
15367
|
-
headers: delegationHeader
|
|
15370
|
+
headers: delegationHeader,
|
|
15371
|
+
signal
|
|
15368
15372
|
});
|
|
15369
15373
|
if (res.ok) {
|
|
15370
15374
|
try {
|