zubbl-sdk 1.1.18 → 1.1.19
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/types/client.d.ts +27 -4
- package/dist/types/core/config.d.ts +9 -3
- package/dist/types/core/config.original.d.ts +14 -0
- package/dist/types/core/http.d.ts +5 -4
- package/dist/types/core/http.original.d.ts +4 -0
- package/dist/types/core/telemetry.d.ts +2 -2
- package/dist/types/features/getTiles.d.ts +3 -2
- package/dist/types/features/identifyUser.d.ts +2 -1
- package/dist/types/index.d.ts +20 -2
- package/dist/zubbl-sdk.cjs.js +362 -428
- package/dist/zubbl-sdk.cjs.js.map +1 -1
- package/dist/zubbl-sdk.esm.js +362 -428
- package/dist/zubbl-sdk.esm.js.map +1 -1
- package/dist/zubbl-sdk.umd.js +363 -429
- package/dist/zubbl-sdk.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/types/client.d.ts
CHANGED
|
@@ -6,17 +6,40 @@ export type ZubblConfig = {
|
|
|
6
6
|
injectWorkerHeaders?: boolean;
|
|
7
7
|
workerSecret?: string | null;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Creates a self-contained, instance-based Zubbl client.
|
|
11
|
+
* Each instance owns its own config store and initialization state.
|
|
12
|
+
*/
|
|
9
13
|
export declare function createZubblClient(cfg: ZubblConfig): {
|
|
10
14
|
init: () => Promise<void>;
|
|
11
15
|
identifyUser: ({ email, name }: {
|
|
12
16
|
email: string;
|
|
13
17
|
name?: string;
|
|
14
|
-
}) => Promise<
|
|
15
|
-
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
external_user_id: any;
|
|
20
|
+
cached: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
getTiles: ({ external_user_id, app_id, ttlSeconds, }: {
|
|
16
23
|
external_user_id: string;
|
|
17
24
|
app_id?: string | null;
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
ttlSeconds?: number;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
data: any;
|
|
28
|
+
fromCache: boolean;
|
|
29
|
+
status?: undefined;
|
|
30
|
+
error?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
data: any;
|
|
33
|
+
fromCache: boolean;
|
|
34
|
+
status: number;
|
|
35
|
+
error?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
data: any;
|
|
38
|
+
fromCache: boolean;
|
|
39
|
+
error: string;
|
|
40
|
+
status?: undefined;
|
|
41
|
+
}>;
|
|
42
|
+
enforce: ({ external_user_id, app_id, }: {
|
|
20
43
|
external_user_id: string;
|
|
21
44
|
app_id?: string | null;
|
|
22
45
|
}) => Promise<{
|
|
@@ -9,6 +9,12 @@ export interface ZubblConfig {
|
|
|
9
9
|
injectWorkerHeaders?: boolean;
|
|
10
10
|
workerSecret?: string | null;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Creates an isolated configuration store.
|
|
14
|
+
* Each ZubblClient instance owns its own store.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createConfigStore(initial?: Partial<ZubblConfig>): {
|
|
17
|
+
init: (partial: Partial<ZubblConfig>) => void;
|
|
18
|
+
get: () => Readonly<ZubblConfig>;
|
|
19
|
+
buildHeaders: (extra?: Record<string, string>) => Record<string, string>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const isBrowser: boolean;
|
|
2
|
+
export declare const isNode: boolean;
|
|
3
|
+
export declare const isWorker: boolean;
|
|
4
|
+
export interface ZubblConfig {
|
|
5
|
+
apiKey: string | null;
|
|
6
|
+
tenantId: string | null;
|
|
7
|
+
appId: string | null;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
injectWorkerHeaders?: boolean;
|
|
10
|
+
workerSecret?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function init(partial: Partial<ZubblConfig>): void;
|
|
13
|
+
export declare function getConfig(): Readonly<ZubblConfig>;
|
|
14
|
+
export declare function buildHeaders(extra?: Record<string, string>): Record<string, string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Performs a safe HTTP request with adaptive + signing headers.
|
|
3
|
+
* NOTE: no global getConfig() dependency — caller must provide fully resolved URL + headers.
|
|
4
|
+
*/
|
|
5
|
+
export declare function httpRequest(url: string, options?: RequestInit): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function setSamplingRatio(ratio: number): void;
|
|
2
|
-
export declare function emitEndpoint(payload: Record<string, any>): void;
|
|
3
|
-
export declare function recordRequestTelemetry(url: string, method: string, status: number, latency: number, extra?: Record<string, any>): Promise<void>;
|
|
2
|
+
export declare function emitEndpoint(store: any, payload: Record<string, any>): void;
|
|
3
|
+
export declare function recordRequestTelemetry(store: any, url: string, method: string, status: number, latency: number, extra?: Record<string, any>): Promise<void>;
|
|
4
4
|
export declare function logRuntimeDiscovery(url: string): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Fetch effective tiles with caching, ETag and background refresh.
|
|
2
|
+
* Fetch effective tiles with caching, ETag, and background refresh.
|
|
3
|
+
* Instance-safe: requires store (from createConfigStore()) passed in.
|
|
3
4
|
*/
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function getTilesFeature(store: any, { external_user_id, app_id, ttlSeconds, }: {
|
|
5
6
|
external_user_id: string;
|
|
6
7
|
app_id?: string | null;
|
|
7
8
|
ttlSeconds?: number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identify or auto-create a user by email/name.
|
|
3
|
+
* Instance-safe: requires store (from createConfigStore()) passed in.
|
|
3
4
|
* Idempotent: returns cached UUID if available.
|
|
4
5
|
*/
|
|
5
|
-
export declare function
|
|
6
|
+
export declare function identifyUserFeature(store: any, { email, name }: {
|
|
6
7
|
email: string;
|
|
7
8
|
name?: string;
|
|
8
9
|
}): Promise<{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { createZubblClient, ZubblConfig } from "./client.js";
|
|
2
2
|
export declare function init(config: ZubblConfig): Promise<void>;
|
|
3
|
-
export declare function identifyUser(...args: Parameters<ReturnType<typeof createZubblClient>["identifyUser"]>): Promise<
|
|
4
|
-
|
|
3
|
+
export declare function identifyUser(...args: Parameters<ReturnType<typeof createZubblClient>["identifyUser"]>): Promise<{
|
|
4
|
+
external_user_id: any;
|
|
5
|
+
cached: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function getTiles(...args: Parameters<ReturnType<typeof createZubblClient>["getTiles"]>): Promise<{
|
|
8
|
+
data: any;
|
|
9
|
+
fromCache: boolean;
|
|
10
|
+
status?: undefined;
|
|
11
|
+
error?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
data: any;
|
|
14
|
+
fromCache: boolean;
|
|
15
|
+
status: number;
|
|
16
|
+
error?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
data: any;
|
|
19
|
+
fromCache: boolean;
|
|
20
|
+
error: string;
|
|
21
|
+
status?: undefined;
|
|
22
|
+
}>;
|
|
5
23
|
export declare function enforce(...args: Parameters<ReturnType<typeof createZubblClient>["enforce"]>): Promise<{
|
|
6
24
|
decision: string;
|
|
7
25
|
status: number;
|