@uniformdev/context 20.49.3 → 20.49.4-alpha.102
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/api/api.d.mts +2 -1
- package/dist/api/api.d.ts +2 -1
- package/dist/api/api.js +19 -3
- package/dist/api/api.mjs +17 -2
- package/dist/index.esm.js +16 -1
- package/dist/index.js +16 -1
- package/dist/index.mjs +16 -1
- package/package.json +2 -2
package/dist/api/api.d.mts
CHANGED
|
@@ -55,6 +55,7 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
|
55
55
|
private static getRequestId;
|
|
56
56
|
}
|
|
57
57
|
declare function handleRateLimits(callApi: () => Promise<Response>): Promise<Response>;
|
|
58
|
+
declare function rewriteFiltersForApi(filters?: Record<string, unknown>): Record<string, string>;
|
|
58
59
|
|
|
59
60
|
interface components$7 {
|
|
60
61
|
schemas: {
|
|
@@ -1976,4 +1977,4 @@ declare class CachedContextClient extends ContextClient {
|
|
|
1976
1977
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
|
1977
1978
|
}
|
|
1978
1979
|
|
|
1979
|
-
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
|
1980
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy, rewriteFiltersForApi };
|
package/dist/api/api.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
|
55
55
|
private static getRequestId;
|
|
56
56
|
}
|
|
57
57
|
declare function handleRateLimits(callApi: () => Promise<Response>): Promise<Response>;
|
|
58
|
+
declare function rewriteFiltersForApi(filters?: Record<string, unknown>): Record<string, string>;
|
|
58
59
|
|
|
59
60
|
interface components$7 {
|
|
60
61
|
schemas: {
|
|
@@ -1976,4 +1977,4 @@ declare class CachedContextClient extends ContextClient {
|
|
|
1976
1977
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
|
1977
1978
|
}
|
|
1978
1979
|
|
|
1979
|
-
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy };
|
|
1980
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, CachedTestClient, type ClientOptions, ContextClient, type ContextDefinitions, type CookieCriteria, type CurrentPageCriteria, DimensionClient, type DimensionDefinition, type DimensionDisplayData, type DimensionGetParameters, type DimensionGetResponse, type EnrichmentCategory, type EnrichmentCategoryWithValues, EnrichmentClient, type EnrichmentDeleteParameters, type EnrichmentGetParameters, type EnrichmentGetResponse, type EnrichmentPutParameters, type EnrichmentValue, type EnrichmentValueDeleteParameters, type EnrichmentValuePutParameters, type EventCriteria, type ExceptProject, type LimitPolicy, ManifestClient, type ManifestGetParameters, type ManifestGetResponse, type PageViewCountCriteria, type QueryStringCriteria, type Quirk, QuirkClient, type QuirkCriteria, type QuirkDeleteParameters, type QuirkGetParameters, type QuirkGetResponse, type QuirkPutParameters, type RootSignalCriteriaGroup, SignalClient, type SignalDeleteParameters, type SignalGetParameters, type SignalGetResponse, type SignalPutParameters, type SignalWithId, type Test, TestClient, type TestDeleteParameters, type TestGetParameters, type TestGetResponse, type TestPutParameters, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy, rewriteFiltersForApi };
|
package/dist/api/api.js
CHANGED
|
@@ -69,7 +69,8 @@ __export(api_exports, {
|
|
|
69
69
|
computeDimensionDisplayName: () => computeDimensionDisplayName,
|
|
70
70
|
defaultLimitPolicy: () => defaultLimitPolicy,
|
|
71
71
|
handleRateLimits: () => handleRateLimits,
|
|
72
|
-
nullLimitPolicy: () => nullLimitPolicy
|
|
72
|
+
nullLimitPolicy: () => nullLimitPolicy,
|
|
73
|
+
rewriteFiltersForApi: () => rewriteFiltersForApi
|
|
73
74
|
});
|
|
74
75
|
module.exports = __toCommonJS(api_exports);
|
|
75
76
|
|
|
@@ -239,11 +240,25 @@ async function handleRateLimits(callApi) {
|
|
|
239
240
|
}
|
|
240
241
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
241
242
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
242
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
243
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
243
244
|
backoffRetriesLeft -= 1;
|
|
244
245
|
}
|
|
245
246
|
return response;
|
|
246
247
|
}
|
|
248
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
249
|
+
function rewriteFiltersForApi(filters) {
|
|
250
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
251
|
+
(acc, [key, value]) => {
|
|
252
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
253
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
254
|
+
return {
|
|
255
|
+
...acc,
|
|
256
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
257
|
+
};
|
|
258
|
+
},
|
|
259
|
+
{}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
247
262
|
|
|
248
263
|
// src/api/AggregateClient.ts
|
|
249
264
|
var _url;
|
|
@@ -650,5 +665,6 @@ var CachedContextClient = class extends ContextClient {
|
|
|
650
665
|
computeDimensionDisplayName,
|
|
651
666
|
defaultLimitPolicy,
|
|
652
667
|
handleRateLimits,
|
|
653
|
-
nullLimitPolicy
|
|
668
|
+
nullLimitPolicy,
|
|
669
|
+
rewriteFiltersForApi
|
|
654
670
|
});
|
package/dist/api/api.mjs
CHANGED
|
@@ -174,11 +174,25 @@ async function handleRateLimits(callApi) {
|
|
|
174
174
|
}
|
|
175
175
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
176
176
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
177
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
177
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
178
178
|
backoffRetriesLeft -= 1;
|
|
179
179
|
}
|
|
180
180
|
return response;
|
|
181
181
|
}
|
|
182
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
183
|
+
function rewriteFiltersForApi(filters) {
|
|
184
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
185
|
+
(acc, [key, value]) => {
|
|
186
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
187
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
188
|
+
return {
|
|
189
|
+
...acc,
|
|
190
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
{}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
182
196
|
|
|
183
197
|
// src/api/AggregateClient.ts
|
|
184
198
|
var _url;
|
|
@@ -584,5 +598,6 @@ export {
|
|
|
584
598
|
computeDimensionDisplayName,
|
|
585
599
|
defaultLimitPolicy,
|
|
586
600
|
handleRateLimits,
|
|
587
|
-
nullLimitPolicy
|
|
601
|
+
nullLimitPolicy,
|
|
602
|
+
rewriteFiltersForApi
|
|
588
603
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -2183,10 +2183,20 @@ calculateScores_fn = function(newData) {
|
|
|
2183
2183
|
|
|
2184
2184
|
// src/devTools/enableContextDevTools.ts
|
|
2185
2185
|
var isBrowser = typeof top !== "undefined";
|
|
2186
|
+
function isInCrossOriginIframe() {
|
|
2187
|
+
if (!isBrowser) {
|
|
2188
|
+
return false;
|
|
2189
|
+
}
|
|
2190
|
+
try {
|
|
2191
|
+
return top !== window && !(top == null ? void 0 : top.location.href);
|
|
2192
|
+
} catch (e) {
|
|
2193
|
+
return true;
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2186
2196
|
function enableContextDevTools(options) {
|
|
2187
2197
|
return {
|
|
2188
2198
|
logDrain: (message) => {
|
|
2189
|
-
if (!isBrowser) {
|
|
2199
|
+
if (!isBrowser || isInCrossOriginIframe()) {
|
|
2190
2200
|
return;
|
|
2191
2201
|
}
|
|
2192
2202
|
top == null ? void 0 : top.postMessage(
|
|
@@ -2198,6 +2208,11 @@ function enableContextDevTools(options) {
|
|
|
2198
2208
|
);
|
|
2199
2209
|
},
|
|
2200
2210
|
init: (context) => {
|
|
2211
|
+
if (isInCrossOriginIframe()) {
|
|
2212
|
+
console.info("Uniform Context DevTools disabled in cross-origin iframe");
|
|
2213
|
+
return () => {
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2201
2216
|
const personalizations = [];
|
|
2202
2217
|
const tests = [];
|
|
2203
2218
|
const onContextDataUpdated = () => {
|
package/dist/index.js
CHANGED
|
@@ -2276,10 +2276,20 @@ calculateScores_fn = function(newData) {
|
|
|
2276
2276
|
|
|
2277
2277
|
// src/devTools/enableContextDevTools.ts
|
|
2278
2278
|
var isBrowser = typeof top !== "undefined";
|
|
2279
|
+
function isInCrossOriginIframe() {
|
|
2280
|
+
if (!isBrowser) {
|
|
2281
|
+
return false;
|
|
2282
|
+
}
|
|
2283
|
+
try {
|
|
2284
|
+
return top !== window && !(top == null ? void 0 : top.location.href);
|
|
2285
|
+
} catch (e) {
|
|
2286
|
+
return true;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2279
2289
|
function enableContextDevTools(options) {
|
|
2280
2290
|
return {
|
|
2281
2291
|
logDrain: (message) => {
|
|
2282
|
-
if (!isBrowser) {
|
|
2292
|
+
if (!isBrowser || isInCrossOriginIframe()) {
|
|
2283
2293
|
return;
|
|
2284
2294
|
}
|
|
2285
2295
|
top == null ? void 0 : top.postMessage(
|
|
@@ -2291,6 +2301,11 @@ function enableContextDevTools(options) {
|
|
|
2291
2301
|
);
|
|
2292
2302
|
},
|
|
2293
2303
|
init: (context) => {
|
|
2304
|
+
if (isInCrossOriginIframe()) {
|
|
2305
|
+
console.info("Uniform Context DevTools disabled in cross-origin iframe");
|
|
2306
|
+
return () => {
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2294
2309
|
const personalizations = [];
|
|
2295
2310
|
const tests = [];
|
|
2296
2311
|
const onContextDataUpdated = () => {
|
package/dist/index.mjs
CHANGED
|
@@ -2183,10 +2183,20 @@ calculateScores_fn = function(newData) {
|
|
|
2183
2183
|
|
|
2184
2184
|
// src/devTools/enableContextDevTools.ts
|
|
2185
2185
|
var isBrowser = typeof top !== "undefined";
|
|
2186
|
+
function isInCrossOriginIframe() {
|
|
2187
|
+
if (!isBrowser) {
|
|
2188
|
+
return false;
|
|
2189
|
+
}
|
|
2190
|
+
try {
|
|
2191
|
+
return top !== window && !(top == null ? void 0 : top.location.href);
|
|
2192
|
+
} catch (e) {
|
|
2193
|
+
return true;
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2186
2196
|
function enableContextDevTools(options) {
|
|
2187
2197
|
return {
|
|
2188
2198
|
logDrain: (message) => {
|
|
2189
|
-
if (!isBrowser) {
|
|
2199
|
+
if (!isBrowser || isInCrossOriginIframe()) {
|
|
2190
2200
|
return;
|
|
2191
2201
|
}
|
|
2192
2202
|
top == null ? void 0 : top.postMessage(
|
|
@@ -2198,6 +2208,11 @@ function enableContextDevTools(options) {
|
|
|
2198
2208
|
);
|
|
2199
2209
|
},
|
|
2200
2210
|
init: (context) => {
|
|
2211
|
+
if (isInCrossOriginIframe()) {
|
|
2212
|
+
console.info("Uniform Context DevTools disabled in cross-origin iframe");
|
|
2213
|
+
return () => {
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2201
2216
|
const personalizations = [];
|
|
2202
2217
|
const tests = [];
|
|
2203
2218
|
const onContextDataUpdated = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context",
|
|
3
|
-
"version": "20.49.
|
|
3
|
+
"version": "20.49.4-alpha.102+140d1a56b4",
|
|
4
4
|
"description": "Uniform Context core package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "140d1a56b4b45021216a166bcaf7ebe629681b0b"
|
|
74
74
|
}
|