@palbase/web 2.0.0 → 2.0.1
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/{analytics-facade-ovP0pF2P.d.cts → analytics-facade-ChlBRcLZ.d.cts} +13 -4
- package/dist/{analytics-facade-DMtGDGfd.d.ts → analytics-facade-G0il4NrT.d.ts} +13 -4
- package/dist/{chunk-V6VTX65P.js → chunk-AIPUO4QX.js} +52 -24
- package/dist/chunk-AIPUO4QX.js.map +1 -0
- package/dist/gen/cli.cjs +4 -5
- package/dist/gen/cli.cjs.map +1 -1
- package/dist/gen/cli.js +4 -5
- package/dist/gen/cli.js.map +1 -1
- package/dist/index.cjs +51 -23
- 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 +1 -1
- package/dist/internal.cjs +51 -23
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +51 -23
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +51 -23
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +3 -3
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +1 -1
- package/dist/{pb-DDM_mCQB.d.cts → pb-B_6o5p79.d.cts} +1 -1
- package/dist/{pb-CvpcQero.d.ts → pb-nPBhqhJr.d.ts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-V6VTX65P.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Room, ExternalE2EEKeyProvider } from 'livekit-client';
|
|
2
2
|
import { S as SessionStorageAdapter } from './storage-BPaeSG8K.cjs';
|
|
3
|
-
import { F } from './pooled-flags-
|
|
3
|
+
import { F } from './pooled-flags-4GtDtsiu.js';
|
|
4
4
|
|
|
5
5
|
declare class PalbaseError$1 extends Error {
|
|
6
6
|
readonly code: string;
|
|
@@ -622,8 +622,17 @@ interface PalbeConfig {
|
|
|
622
622
|
apiKey: string;
|
|
623
623
|
/** Registered app identity persisted by `palbase web link`. */
|
|
624
624
|
appId: string;
|
|
625
|
-
/**
|
|
626
|
-
|
|
625
|
+
/**
|
|
626
|
+
* The ENVIRONMENT this config targets — informational only.
|
|
627
|
+
*
|
|
628
|
+
* `url` and `apiKey` ALREADY identify the environment (the ref is the host
|
|
629
|
+
* label and is embedded in the key), so nothing at runtime reads this: it is
|
|
630
|
+
* here so a developer looking at the generated file can see WHICH runtime it
|
|
631
|
+
* points at. It replaces the old `branch` field — the Palbase branch is gone
|
|
632
|
+
* as a resource, and a second, drift-prone name for the same runtime is
|
|
633
|
+
* exactly how a build ends up talking to production from a staging checkout.
|
|
634
|
+
*/
|
|
635
|
+
environmentRef?: string;
|
|
627
636
|
oauth?: PalbeOAuthConfig;
|
|
628
637
|
/** Refresh-token persistence. Default: endpoint-scoped localStorage in browsers, memory elsewhere. */
|
|
629
638
|
storage?: SessionStorageAdapter;
|
|
@@ -679,7 +688,7 @@ declare class PalbeFlags {
|
|
|
679
688
|
*
|
|
680
689
|
* DEVIATION from iOS sync-cache parity: the platform does not propagate
|
|
681
690
|
* variant metadata into the user-flags snapshot/delta cache, so this is an
|
|
682
|
-
* ASYNC transport read (`GET /v1/flags
|
|
691
|
+
* ASYNC transport read (derived from `GET /v1/user-flags`), not a cache lookup.
|
|
683
692
|
*/
|
|
684
693
|
getVariant(key: string): Promise<string | null>;
|
|
685
694
|
/** Subscribe to any change in the cached flag set. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Room, ExternalE2EEKeyProvider } from 'livekit-client';
|
|
2
2
|
import { S as SessionStorageAdapter } from './storage-BPaeSG8K.js';
|
|
3
|
-
import { F } from './pooled-flags-
|
|
3
|
+
import { F } from './pooled-flags-4GtDtsiu.js';
|
|
4
4
|
|
|
5
5
|
declare class PalbaseError$1 extends Error {
|
|
6
6
|
readonly code: string;
|
|
@@ -622,8 +622,17 @@ interface PalbeConfig {
|
|
|
622
622
|
apiKey: string;
|
|
623
623
|
/** Registered app identity persisted by `palbase web link`. */
|
|
624
624
|
appId: string;
|
|
625
|
-
/**
|
|
626
|
-
|
|
625
|
+
/**
|
|
626
|
+
* The ENVIRONMENT this config targets — informational only.
|
|
627
|
+
*
|
|
628
|
+
* `url` and `apiKey` ALREADY identify the environment (the ref is the host
|
|
629
|
+
* label and is embedded in the key), so nothing at runtime reads this: it is
|
|
630
|
+
* here so a developer looking at the generated file can see WHICH runtime it
|
|
631
|
+
* points at. It replaces the old `branch` field — the Palbase branch is gone
|
|
632
|
+
* as a resource, and a second, drift-prone name for the same runtime is
|
|
633
|
+
* exactly how a build ends up talking to production from a staging checkout.
|
|
634
|
+
*/
|
|
635
|
+
environmentRef?: string;
|
|
627
636
|
oauth?: PalbeOAuthConfig;
|
|
628
637
|
/** Refresh-token persistence. Default: endpoint-scoped localStorage in browsers, memory elsewhere. */
|
|
629
638
|
storage?: SessionStorageAdapter;
|
|
@@ -679,7 +688,7 @@ declare class PalbeFlags {
|
|
|
679
688
|
*
|
|
680
689
|
* DEVIATION from iOS sync-cache parity: the platform does not propagate
|
|
681
690
|
* variant metadata into the user-flags snapshot/delta cache, so this is an
|
|
682
|
-
* ASYNC transport read (`GET /v1/flags
|
|
691
|
+
* ASYNC transport read (derived from `GET /v1/user-flags`), not a cache lookup.
|
|
683
692
|
*/
|
|
684
693
|
getVariant(key: string): Promise<string | null>;
|
|
685
694
|
/** Subscribe to any change in the cached flag set. */
|
|
@@ -1969,6 +1969,19 @@ var PalbeCalls = class {
|
|
|
1969
1969
|
|
|
1970
1970
|
// ../modules/flags/dist/index.js
|
|
1971
1971
|
var FLAG_NAME_RE = /^[a-zA-Z0-9_-]+$/;
|
|
1972
|
+
function flagEnabled(value) {
|
|
1973
|
+
if (typeof value === "boolean") return value;
|
|
1974
|
+
return value != null && value !== 0 && value !== "";
|
|
1975
|
+
}
|
|
1976
|
+
function flagVariant(value) {
|
|
1977
|
+
return typeof value === "string" ? { name: value } : null;
|
|
1978
|
+
}
|
|
1979
|
+
function mapResponse(res, fn) {
|
|
1980
|
+
if (res.error || res.data == null) {
|
|
1981
|
+
return { ...res, data: null };
|
|
1982
|
+
}
|
|
1983
|
+
return { ...res, data: fn(res.data) };
|
|
1984
|
+
}
|
|
1972
1985
|
var FlagsClient = class {
|
|
1973
1986
|
httpClient;
|
|
1974
1987
|
getCurrentUserId;
|
|
@@ -1988,10 +2001,11 @@ var FlagsClient = class {
|
|
|
1988
2001
|
`Invalid flag name: "${flagName}". Flag names must match ${FLAG_NAME_RE.source}`
|
|
1989
2002
|
);
|
|
1990
2003
|
}
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2004
|
+
const res = await this.httpClient.request(
|
|
2005
|
+
"GET",
|
|
2006
|
+
this.mergedPath(context)
|
|
2007
|
+
);
|
|
2008
|
+
return mapResponse(res, (snap) => flagEnabled(snap.values?.[flagName]));
|
|
1995
2009
|
}
|
|
1996
2010
|
async getVariant(flagName, context) {
|
|
1997
2011
|
if (!FLAG_NAME_RE.test(flagName)) {
|
|
@@ -1999,16 +2013,29 @@ var FlagsClient = class {
|
|
|
1999
2013
|
`Invalid flag name: "${flagName}". Flag names must match ${FLAG_NAME_RE.source}`
|
|
2000
2014
|
);
|
|
2001
2015
|
}
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2016
|
+
const res = await this.httpClient.request(
|
|
2017
|
+
"GET",
|
|
2018
|
+
this.mergedPath(context)
|
|
2019
|
+
);
|
|
2020
|
+
if (res.error || res.data == null) {
|
|
2021
|
+
return { ...res, data: null };
|
|
2022
|
+
}
|
|
2023
|
+
return { ...res, data: flagVariant(res.data.values?.[flagName]) };
|
|
2006
2024
|
}
|
|
2007
2025
|
async getAll(context) {
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2026
|
+
const res = await this.httpClient.request(
|
|
2027
|
+
"GET",
|
|
2028
|
+
this.mergedPath(context)
|
|
2029
|
+
);
|
|
2030
|
+
return mapResponse(res, (snap) => {
|
|
2031
|
+
const values = snap.values ?? {};
|
|
2032
|
+
return Object.keys(values).map((name) => {
|
|
2033
|
+
const value = values[name];
|
|
2034
|
+
const flag = { name, enabled: flagEnabled(value) };
|
|
2035
|
+
if (typeof value === "string") flag.variant = { name: value };
|
|
2036
|
+
return flag;
|
|
2037
|
+
});
|
|
2038
|
+
});
|
|
2012
2039
|
}
|
|
2013
2040
|
/**
|
|
2014
2041
|
* Cold-start read: the full merged flag set for the current auth identity.
|
|
@@ -2107,15 +2134,16 @@ var FlagsClient = class {
|
|
|
2107
2134
|
}
|
|
2108
2135
|
};
|
|
2109
2136
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2137
|
+
/**
|
|
2138
|
+
* Resolve the merged-read path for a context. With `context.userId` present the
|
|
2139
|
+
* read targets that specific user's merged view (`/v1/user-flags/users/{id}`, a
|
|
2140
|
+
* privileged cross-user read); otherwise the current auth user's view
|
|
2141
|
+
* (`/v1/user-flags`). `context.properties` has no server-side targeting support
|
|
2142
|
+
* in the user-flags module and is ignored.
|
|
2143
|
+
*/
|
|
2144
|
+
mergedPath(context) {
|
|
2145
|
+
const uid = context?.userId;
|
|
2146
|
+
return uid ? `/v1/user-flags/users/${encodeURIComponent(uid)}` : "/v1/user-flags";
|
|
2119
2147
|
}
|
|
2120
2148
|
};
|
|
2121
2149
|
var DEFAULT_POLL_MS = 3e4;
|
|
@@ -2577,7 +2605,7 @@ var PalbeFlags = class {
|
|
|
2577
2605
|
*
|
|
2578
2606
|
* DEVIATION from iOS sync-cache parity: the platform does not propagate
|
|
2579
2607
|
* variant metadata into the user-flags snapshot/delta cache, so this is an
|
|
2580
|
-
* ASYNC transport read (`GET /v1/flags
|
|
2608
|
+
* ASYNC transport read (derived from `GET /v1/user-flags`), not a cache lookup.
|
|
2581
2609
|
*/
|
|
2582
2610
|
async getVariant(key) {
|
|
2583
2611
|
let res;
|
|
@@ -8916,7 +8944,7 @@ function defaultSessionStorage(key) {
|
|
|
8916
8944
|
}
|
|
8917
8945
|
|
|
8918
8946
|
// src/version.ts
|
|
8919
|
-
var VERSION = "2.0.
|
|
8947
|
+
var VERSION = "2.0.1";
|
|
8920
8948
|
|
|
8921
8949
|
// src/runtime.ts
|
|
8922
8950
|
function buildRuntime(config) {
|
|
@@ -9329,4 +9357,4 @@ export {
|
|
|
9329
9357
|
pb,
|
|
9330
9358
|
createBoundClient
|
|
9331
9359
|
};
|
|
9332
|
-
//# sourceMappingURL=chunk-
|
|
9360
|
+
//# sourceMappingURL=chunk-AIPUO4QX.js.map
|