@insforge/sdk 1.3.0-ssr.2 → 1.3.0-ssr.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/README.md +18 -0
- package/dist/{client-B8ykVESe.d.mts → client-CQfw9UsO.d.mts} +7 -1
- package/dist/{client-B8ykVESe.d.ts → client-CQfw9UsO.d.ts} +7 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +87 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -57
- package/dist/index.mjs.map +1 -1
- package/dist/ssr.d.mts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +76 -60
- package/dist/ssr.js.map +1 -1
- package/dist/ssr.mjs +66 -60
- package/dist/ssr.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ssr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient,
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-CQfw9UsO.mjs';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InsForgeConfig, I as InsForgeClient,
|
|
1
|
+
import { a as InsForgeConfig, I as InsForgeClient, m as AuthRefreshResponse, e as InsForgeError } from './client-CQfw9UsO.js';
|
|
2
2
|
import '@insforge/shared-schemas';
|
|
3
3
|
import '@supabase/postgrest-js';
|
|
4
4
|
|
package/dist/ssr.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/ssr.ts
|
|
@@ -2215,7 +2225,6 @@ var Functions = class _Functions {
|
|
|
2215
2225
|
};
|
|
2216
2226
|
|
|
2217
2227
|
// src/modules/realtime.ts
|
|
2218
|
-
var import_socket = require("socket.io-client");
|
|
2219
2228
|
var CONNECT_TIMEOUT = 1e4;
|
|
2220
2229
|
var Realtime = class {
|
|
2221
2230
|
constructor(baseUrl, tokenManager, anonKey) {
|
|
@@ -2250,61 +2259,69 @@ var Realtime = class {
|
|
|
2250
2259
|
if (this.connectPromise) {
|
|
2251
2260
|
return this.connectPromise;
|
|
2252
2261
|
}
|
|
2253
|
-
this.connectPromise =
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
this.socket.
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2262
|
+
this.connectPromise = (async () => {
|
|
2263
|
+
try {
|
|
2264
|
+
const { io } = await import("socket.io-client");
|
|
2265
|
+
await new Promise((resolve, reject) => {
|
|
2266
|
+
const token = this.tokenManager.getAccessToken() ?? this.anonKey;
|
|
2267
|
+
this.socket = io(this.baseUrl, {
|
|
2268
|
+
transports: ["websocket"],
|
|
2269
|
+
auth: token ? { token } : void 0
|
|
2270
|
+
});
|
|
2271
|
+
let initialConnection = true;
|
|
2272
|
+
let timeoutId = null;
|
|
2273
|
+
const cleanup = () => {
|
|
2274
|
+
if (timeoutId) {
|
|
2275
|
+
clearTimeout(timeoutId);
|
|
2276
|
+
timeoutId = null;
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
timeoutId = setTimeout(() => {
|
|
2280
|
+
if (initialConnection) {
|
|
2281
|
+
initialConnection = false;
|
|
2282
|
+
this.connectPromise = null;
|
|
2283
|
+
this.socket?.disconnect();
|
|
2284
|
+
this.socket = null;
|
|
2285
|
+
reject(new Error(`Connection timeout after ${CONNECT_TIMEOUT}ms`));
|
|
2286
|
+
}
|
|
2287
|
+
}, CONNECT_TIMEOUT);
|
|
2288
|
+
this.socket.on("connect", () => {
|
|
2289
|
+
cleanup();
|
|
2290
|
+
for (const channel of this.subscribedChannels) {
|
|
2291
|
+
this.socket.emit("realtime:subscribe", { channel });
|
|
2292
|
+
}
|
|
2293
|
+
this.notifyListeners("connect");
|
|
2294
|
+
if (initialConnection) {
|
|
2295
|
+
initialConnection = false;
|
|
2296
|
+
this.connectPromise = null;
|
|
2297
|
+
resolve();
|
|
2298
|
+
}
|
|
2299
|
+
});
|
|
2300
|
+
this.socket.on("connect_error", (error) => {
|
|
2301
|
+
cleanup();
|
|
2302
|
+
this.notifyListeners("connect_error", error);
|
|
2303
|
+
if (initialConnection) {
|
|
2304
|
+
initialConnection = false;
|
|
2305
|
+
this.connectPromise = null;
|
|
2306
|
+
reject(error);
|
|
2307
|
+
}
|
|
2308
|
+
});
|
|
2309
|
+
this.socket.on("disconnect", (reason) => {
|
|
2310
|
+
this.notifyListeners("disconnect", reason);
|
|
2311
|
+
});
|
|
2312
|
+
this.socket.on("realtime:error", (error) => {
|
|
2313
|
+
this.notifyListeners("error", error);
|
|
2314
|
+
});
|
|
2315
|
+
this.socket.onAny((event, message) => {
|
|
2316
|
+
if (event === "realtime:error") return;
|
|
2317
|
+
this.notifyListeners(event, message);
|
|
2318
|
+
});
|
|
2319
|
+
});
|
|
2320
|
+
} catch (error) {
|
|
2321
|
+
this.connectPromise = null;
|
|
2322
|
+
throw error;
|
|
2323
|
+
}
|
|
2324
|
+
})();
|
|
2308
2325
|
return this.connectPromise;
|
|
2309
2326
|
}
|
|
2310
2327
|
/**
|
|
@@ -2634,10 +2651,9 @@ function decodeBase64Url(input) {
|
|
|
2634
2651
|
normalized.length + (4 - normalized.length % 4) % 4,
|
|
2635
2652
|
"="
|
|
2636
2653
|
);
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
return Buffer.from(padded, "base64").toString("utf8");
|
|
2654
|
+
const binary = atob(padded);
|
|
2655
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
2656
|
+
return new TextDecoder().decode(bytes);
|
|
2641
2657
|
}
|
|
2642
2658
|
function getJwtExpiration(token) {
|
|
2643
2659
|
if (!token) return null;
|