zubbl-sdk 1.1.15 → 1.1.18
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 +28 -0
- package/dist/types/core/config.d.ts +14 -0
- package/dist/types/core/context.d.ts +4 -0
- package/dist/types/core/geo.d.ts +13 -0
- package/dist/types/core/http.d.ts +4 -0
- package/dist/types/core/signing.d.ts +3 -0
- package/dist/types/core/storage.d.ts +6 -0
- package/dist/types/core/telemetry.d.ts +4 -0
- package/dist/types/features/getTiles.d.ts +23 -0
- package/dist/types/features/identifyUser.d.ts +11 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/zubbl-sdk.cjs.js +699 -223
- package/dist/zubbl-sdk.cjs.js.map +1 -0
- package/dist/zubbl-sdk.esm.js +699 -221
- package/dist/zubbl-sdk.esm.js.map +1 -0
- package/dist/zubbl-sdk.umd.js +707 -231
- package/dist/zubbl-sdk.umd.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ZubblConfig = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
tenantId: string;
|
|
4
|
+
appId: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
injectWorkerHeaders?: boolean;
|
|
7
|
+
workerSecret?: string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare function createZubblClient(cfg: ZubblConfig): {
|
|
10
|
+
init: () => Promise<void>;
|
|
11
|
+
identifyUser: ({ email, name }: {
|
|
12
|
+
email: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
}) => Promise<any>;
|
|
15
|
+
getTiles: ({ external_user_id, app_id }: {
|
|
16
|
+
external_user_id: string;
|
|
17
|
+
app_id?: string | null;
|
|
18
|
+
}) => Promise<any>;
|
|
19
|
+
enforce: ({ external_user_id, app_id }: {
|
|
20
|
+
external_user_id: string;
|
|
21
|
+
app_id?: string | null;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
decision: string;
|
|
24
|
+
status: number;
|
|
25
|
+
data: any;
|
|
26
|
+
}>;
|
|
27
|
+
storage: import("./core/storage.js").IStorage;
|
|
28
|
+
};
|
|
@@ -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>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function detectGeo(): string;
|
|
2
|
+
export declare function updateGeo(geoHint?: string): void;
|
|
3
|
+
export declare function recordContextSample(path: string, method: string, status: number, latency: number): void;
|
|
4
|
+
export declare function getAdaptiveHeaders(): Record<string, string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface GeoPrivacy {
|
|
2
|
+
vpn: boolean;
|
|
3
|
+
hosting: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface GeoInfo {
|
|
6
|
+
ip: string | null;
|
|
7
|
+
country: string;
|
|
8
|
+
asn: string | null;
|
|
9
|
+
privacy: GeoPrivacy;
|
|
10
|
+
}
|
|
11
|
+
export declare function getGeoInfo(): Promise<GeoInfo>;
|
|
12
|
+
export declare function clearGeoCache(): void;
|
|
13
|
+
export declare function getGeoHeaders(): Promise<Record<string, string>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function generateNonce(): string;
|
|
2
|
+
export declare function signPayload(payload: string, secret: string): Promise<string>;
|
|
3
|
+
export declare function attachSigningHeaders(method: string, url: string, body: string | null, secretKey?: string | null): Promise<Record<string, string>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
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>;
|
|
4
|
+
export declare function logRuntimeDiscovery(url: string): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch effective tiles with caching, ETag and background refresh.
|
|
3
|
+
*/
|
|
4
|
+
export declare function getTiles({ external_user_id, app_id, ttlSeconds, }: {
|
|
5
|
+
external_user_id: string;
|
|
6
|
+
app_id?: string | null;
|
|
7
|
+
ttlSeconds?: number;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
data: any;
|
|
10
|
+
fromCache: boolean;
|
|
11
|
+
status?: undefined;
|
|
12
|
+
error?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
data: any;
|
|
15
|
+
fromCache: boolean;
|
|
16
|
+
status: number;
|
|
17
|
+
error?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
data: any;
|
|
20
|
+
fromCache: boolean;
|
|
21
|
+
error: string;
|
|
22
|
+
status?: undefined;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identify or auto-create a user by email/name.
|
|
3
|
+
* Idempotent: returns cached UUID if available.
|
|
4
|
+
*/
|
|
5
|
+
export declare function identifyUser({ email, name }: {
|
|
6
|
+
email: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
external_user_id: any;
|
|
10
|
+
cached: boolean;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createZubblClient, ZubblConfig } from "./client.js";
|
|
2
|
+
export declare function init(config: ZubblConfig): Promise<void>;
|
|
3
|
+
export declare function identifyUser(...args: Parameters<ReturnType<typeof createZubblClient>["identifyUser"]>): Promise<any>;
|
|
4
|
+
export declare function getTiles(...args: Parameters<ReturnType<typeof createZubblClient>["getTiles"]>): Promise<any>;
|
|
5
|
+
export declare function enforce(...args: Parameters<ReturnType<typeof createZubblClient>["enforce"]>): Promise<{
|
|
6
|
+
decision: string;
|
|
7
|
+
status: number;
|
|
8
|
+
data: any;
|
|
9
|
+
}>;
|
|
10
|
+
export { createZubblClient };
|