@palbase/web 1.9.0 → 2.0.0
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 +3 -2
- package/dist/{analytics-facade-DsvKx5A5.d.ts → analytics-facade-DMtGDGfd.d.ts} +3 -19
- package/dist/{analytics-facade-DFd5LB3_.d.cts → analytics-facade-ovP0pF2P.d.cts} +3 -19
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-I3ZMB7XM.js → chunk-V6VTX65P.js} +23 -36
- package/dist/chunk-V6VTX65P.js.map +1 -0
- package/dist/gen/cli.cjs +1228 -0
- package/dist/gen/cli.cjs.map +1 -0
- package/dist/gen/cli.d.cts +1 -0
- package/dist/gen/cli.d.ts +1 -0
- package/dist/gen/cli.js +1206 -0
- package/dist/gen/cli.js.map +1 -0
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/internal.cjs +19 -30
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +2 -1
- package/dist/next/client.cjs +16 -29
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +2 -1
- package/dist/next/client.js.map +1 -1
- package/dist/next/index.cjs +19 -30
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +2 -1
- package/dist/next/index.js.map +1 -1
- package/dist/{pb-CDVMy1l1.d.ts → pb-CvpcQero.d.ts} +1 -1
- package/dist/{pb-D_fuhafL.d.cts → pb-DDM_mCQB.d.cts} +1 -1
- package/dist/react/index.cjs +12 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +7 -3
- package/dist/chunk-I3ZMB7XM.js.map +0 -1
package/dist/internal.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { P as PalbeConfig, d as PalbeRuntime } from './analytics-facade-ovP0pF2P.cjs';
|
|
2
|
+
export { e as buildRuntime } from './analytics-facade-ovP0pF2P.cjs';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.cjs';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-DDM_mCQB.cjs';
|
|
5
5
|
import 'livekit-client';
|
|
6
6
|
import './storage-BPaeSG8K.cjs';
|
|
7
7
|
import './pooled-flags-Bwq4usn0.js';
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { P as PalbeConfig, d as PalbeRuntime } from './analytics-facade-DMtGDGfd.js';
|
|
2
|
+
export { e as buildRuntime } from './analytics-facade-DMtGDGfd.js';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.js';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-CvpcQero.js';
|
|
5
5
|
import 'livekit-client';
|
|
6
6
|
import './storage-BPaeSG8K.js';
|
|
7
7
|
import './pooled-flags-Bwq4usn0.js';
|
package/dist/internal.js
CHANGED
package/dist/next/client.cjs
CHANGED
|
@@ -443,12 +443,6 @@ async function palbeRequest(rt, method, path, spec = {}) {
|
|
|
443
443
|
if (MUTATING.has(method) && !callerHasKey) {
|
|
444
444
|
headers["Idempotency-Key"] = crypto.randomUUID();
|
|
445
445
|
}
|
|
446
|
-
if (rt.appIdentifier !== "") {
|
|
447
|
-
const callerHasBundle = Object.keys(headers).some(
|
|
448
|
-
(k) => k.toLowerCase() === "x-palbase-bundle"
|
|
449
|
-
);
|
|
450
|
-
if (!callerHasBundle) headers["X-Palbase-Bundle"] = rt.appIdentifier;
|
|
451
|
-
}
|
|
452
446
|
const attempt = async () => {
|
|
453
447
|
try {
|
|
454
448
|
return await rt.http.request(method, path, {
|
|
@@ -1237,23 +1231,6 @@ var PalbeAnalytics = class {
|
|
|
1237
1231
|
}
|
|
1238
1232
|
};
|
|
1239
1233
|
|
|
1240
|
-
// src/app-config.ts
|
|
1241
|
-
function loadAppConfig(raw) {
|
|
1242
|
-
if (typeof raw !== "object" || raw === null) {
|
|
1243
|
-
throw new Error("app_config_invalid: expected a JSON object");
|
|
1244
|
-
}
|
|
1245
|
-
const r = raw;
|
|
1246
|
-
const str = (k) => typeof r[k] === "string" ? r[k] : "";
|
|
1247
|
-
return { appId: str("app_id"), identifier: str("identifier"), envPreset: str("env_preset") };
|
|
1248
|
-
}
|
|
1249
|
-
function assertOriginMatches(cfg, runtimeOrigin) {
|
|
1250
|
-
if (cfg.identifier === "") return;
|
|
1251
|
-
if (runtimeOrigin === "") return;
|
|
1252
|
-
if (runtimeOrigin !== cfg.identifier) {
|
|
1253
|
-
throw new Error(`app_config_mismatch: expected origin ${cfg.identifier}, got ${runtimeOrigin}`);
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
1234
|
// src/auth-wire.ts
|
|
1258
1235
|
function asWireAuthResult(raw) {
|
|
1259
1236
|
if (typeof raw !== "object" || raw === null) return null;
|
|
@@ -8063,6 +8040,14 @@ function observeWebVitals(record) {
|
|
|
8063
8040
|
};
|
|
8064
8041
|
}
|
|
8065
8042
|
|
|
8043
|
+
// src/runtime-metadata.ts
|
|
8044
|
+
var APP_METADATA_HEADER = "X-Palbase-Bundle";
|
|
8045
|
+
function applyBrowserOriginHeader(headers) {
|
|
8046
|
+
if (Object.keys(headers).some((key) => key.toLowerCase() === "x-palbase-bundle")) return;
|
|
8047
|
+
const origin = typeof window !== "undefined" && typeof window.location !== "undefined" ? window.location.origin : "";
|
|
8048
|
+
if (origin !== "") headers[APP_METADATA_HEADER] = origin;
|
|
8049
|
+
}
|
|
8050
|
+
|
|
8066
8051
|
// src/realtime/anon-token.ts
|
|
8067
8052
|
var REFRESH_SKEW_MS = 6e4;
|
|
8068
8053
|
var AnonTokenProvider = class {
|
|
@@ -8105,11 +8090,16 @@ var AnonTokenProvider = class {
|
|
|
8105
8090
|
*/
|
|
8106
8091
|
async mint() {
|
|
8107
8092
|
const base = this.rt.config.url.replace(/\/+$/, "");
|
|
8093
|
+
const headers = {
|
|
8094
|
+
apikey: this.rt.config.apiKey,
|
|
8095
|
+
...this.rt.config.headers
|
|
8096
|
+
};
|
|
8097
|
+
applyBrowserOriginHeader(headers);
|
|
8108
8098
|
let response;
|
|
8109
8099
|
try {
|
|
8110
8100
|
response = await fetch(`${base}/auth/anonymous`, {
|
|
8111
8101
|
method: "POST",
|
|
8112
|
-
headers
|
|
8102
|
+
headers
|
|
8113
8103
|
});
|
|
8114
8104
|
} catch (e) {
|
|
8115
8105
|
throw new BackendError("network", {
|
|
@@ -8750,17 +8740,15 @@ function defaultSessionStorage(key) {
|
|
|
8750
8740
|
}
|
|
8751
8741
|
|
|
8752
8742
|
// src/version.ts
|
|
8753
|
-
var VERSION = "
|
|
8743
|
+
var VERSION = "2.0.0";
|
|
8754
8744
|
|
|
8755
8745
|
// src/runtime.ts
|
|
8756
8746
|
function buildRuntime(config) {
|
|
8757
|
-
const appIdentifier = config.identifier ?? "";
|
|
8758
|
-
const runtimeOrigin = typeof window !== "undefined" && typeof window.location !== "undefined" ? window.location.origin : "";
|
|
8759
|
-
assertOriginMatches(loadAppConfig({ identifier: appIdentifier }), runtimeOrigin);
|
|
8760
8747
|
const http = new HttpClient(config.apiKey, {
|
|
8761
8748
|
url: config.url,
|
|
8762
8749
|
headers: { "X-Client-Info": `palbe-web/${VERSION}`, ...config.headers }
|
|
8763
8750
|
});
|
|
8751
|
+
http.addInterceptor(({ headers }) => applyBrowserOriginHeader(headers));
|
|
8764
8752
|
const tokenManager = new TokenManager();
|
|
8765
8753
|
http.tokenManager = tokenManager;
|
|
8766
8754
|
const authClient = new AuthClient(http, tokenManager);
|
|
@@ -8809,7 +8797,6 @@ function buildRuntime(config) {
|
|
|
8809
8797
|
let perf;
|
|
8810
8798
|
const rt = {
|
|
8811
8799
|
config,
|
|
8812
|
-
appIdentifier,
|
|
8813
8800
|
http,
|
|
8814
8801
|
tokenManager,
|
|
8815
8802
|
authClient,
|