@uniformdev/context 20.49.1 → 20.49.3-alpha.47
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 +33 -31
- package/dist/api/api.d.ts +33 -31
- package/dist/api/api.js +48 -11
- package/dist/api/api.mjs +44 -10
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.esm.js +17 -3
- package/dist/index.js +20 -6
- package/dist/index.mjs +17 -3
- package/dist/{types-HcKr1VVF.d.mts → types-C0Mthca3.d.mts} +453 -457
- package/dist/{types-HcKr1VVF.d.ts → types-C0Mthca3.d.ts} +453 -457
- package/package.json +9 -9
- package/dist/types-CKTfVAJs.d.mts +0 -1399
- package/dist/types-CKTfVAJs.d.ts +0 -1399
package/dist/api/api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as paths$7, M as ManifestV2 } from '../types-C0Mthca3.mjs';
|
|
2
2
|
import 'mitt';
|
|
3
3
|
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
|
@@ -26,6 +26,11 @@ type ClientOptions = {
|
|
|
26
26
|
signal?: AbortSignal;
|
|
27
27
|
};
|
|
28
28
|
type ExceptProject<T> = Omit<T, 'projectId'>;
|
|
29
|
+
/**
|
|
30
|
+
* Uniform API 401 message for an invalid or expired bearer token.
|
|
31
|
+
* Prefer catching {@link BearerTokenNotValidOrExpiredError} when using ApiClient-based SDKs.
|
|
32
|
+
*/
|
|
33
|
+
declare const UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE: "Bearer token not valid or expired";
|
|
29
34
|
declare class ApiClientError extends Error {
|
|
30
35
|
errorMessage: string;
|
|
31
36
|
fetchMethod: string;
|
|
@@ -35,6 +40,13 @@ declare class ApiClientError extends Error {
|
|
|
35
40
|
requestId?: string | undefined;
|
|
36
41
|
constructor(errorMessage: string, fetchMethod: string, fetchUri: string, statusCode?: number | undefined, statusText?: string | undefined, requestId?: string | undefined);
|
|
37
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when the Uniform API responds with 401 and
|
|
45
|
+
* {@link UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE}.
|
|
46
|
+
*/
|
|
47
|
+
declare class BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
48
|
+
constructor(errorMessage: string, fetchMethod: string, fetchUri: string, statusCode?: number, statusText?: string, requestId?: string);
|
|
49
|
+
}
|
|
38
50
|
|
|
39
51
|
declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
40
52
|
protected options: TOptions;
|
|
@@ -55,6 +67,7 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
|
55
67
|
private static getRequestId;
|
|
56
68
|
}
|
|
57
69
|
declare function handleRateLimits(callApi: () => Promise<Response>): Promise<Response>;
|
|
70
|
+
declare function rewriteFiltersForApi(filters?: Record<string, unknown>): Record<string, string>;
|
|
58
71
|
|
|
59
72
|
interface components$7 {
|
|
60
73
|
schemas: {
|
|
@@ -78,7 +91,6 @@ interface components$7 {
|
|
|
78
91
|
* 's' = current session (expires after a period of inactivity)
|
|
79
92
|
* 'p' = permanent (expires as far in the future as possible, may be limited by browser security settings)
|
|
80
93
|
* 't' = transient (score tracks the current state of the criteria every time scores are updated)
|
|
81
|
-
*
|
|
82
94
|
* @enum {string}
|
|
83
95
|
*/
|
|
84
96
|
dur: "s" | "p" | "t";
|
|
@@ -97,7 +109,6 @@ interface components$7 {
|
|
|
97
109
|
* | = OR
|
|
98
110
|
*
|
|
99
111
|
* Default is `&` if unspecified
|
|
100
|
-
*
|
|
101
112
|
* @default &
|
|
102
113
|
* @enum {string}
|
|
103
114
|
*/
|
|
@@ -124,7 +135,6 @@ interface components$7 {
|
|
|
124
135
|
* | = OR
|
|
125
136
|
*
|
|
126
137
|
* Default is `&` if unspecified
|
|
127
|
-
*
|
|
128
138
|
* @enum {string}
|
|
129
139
|
*/
|
|
130
140
|
op?: "&" | "|";
|
|
@@ -166,9 +176,10 @@ interface components$7 {
|
|
|
166
176
|
/** @description How to match the event name */
|
|
167
177
|
event: components$7["schemas"]["StringMatch"];
|
|
168
178
|
};
|
|
169
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* @description Matches the current page's absolute path (i.e. /path/to/page.html)
|
|
170
181
|
* Does not include the query string or protocol and hostname (i.e. NOT https://foo.com/path/to/page.html?query=something)
|
|
171
|
-
|
|
182
|
+
*/
|
|
172
183
|
CurrentPageCriteria: {
|
|
173
184
|
/** @enum {string} */
|
|
174
185
|
type: "PV";
|
|
@@ -192,7 +203,6 @@ interface components$7 {
|
|
|
192
203
|
* '//' = regular expression match
|
|
193
204
|
*
|
|
194
205
|
* Any of the above can be prefixed with '!' to invert the match (i.e. != for 'not an exact match')
|
|
195
|
-
*
|
|
196
206
|
* @enum {string}
|
|
197
207
|
*/
|
|
198
208
|
op: "=" | "~" | "//" | "!=" | "!~" | "!//";
|
|
@@ -203,7 +213,6 @@ interface components$7 {
|
|
|
203
213
|
* @description The type of match to perform
|
|
204
214
|
* '*' = exists with any value
|
|
205
215
|
* '!*' = does not exist
|
|
206
|
-
*
|
|
207
216
|
* @enum {string}
|
|
208
217
|
*/
|
|
209
218
|
op: "*" | "!*";
|
|
@@ -218,7 +227,6 @@ interface components$7 {
|
|
|
218
227
|
* '!=' = not an exact match
|
|
219
228
|
* '<' = less than match expression
|
|
220
229
|
* '>' = greater than match expression
|
|
221
|
-
*
|
|
222
230
|
* @enum {string}
|
|
223
231
|
*/
|
|
224
232
|
op: "=" | "<" | ">" | "!=";
|
|
@@ -230,14 +238,15 @@ interface components$7 {
|
|
|
230
238
|
};
|
|
231
239
|
/** @description Defines an input dimension to an aggregate dimension */
|
|
232
240
|
AggregateDimensionInput: {
|
|
233
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* @description Dimension name to reference as an input.
|
|
234
243
|
* For enrichment inputs, use CATEGORY_KEY as the dimension.
|
|
235
244
|
* Enrichments, signals, and other aggregate dimensions may be referenced.
|
|
236
245
|
*
|
|
237
246
|
* Note that creating a cycle of aggregate dimensions is allowed, however
|
|
238
247
|
* the final score will _ignore_ the cycled aggregate dimension in the result.
|
|
239
248
|
* This can be used to create mutually exclusive aggregates
|
|
240
|
-
|
|
249
|
+
*/
|
|
241
250
|
dim: string;
|
|
242
251
|
/**
|
|
243
252
|
* @description The sign of the input dimension controls how it affects the aggregate dimension's final score.
|
|
@@ -247,7 +256,6 @@ interface components$7 {
|
|
|
247
256
|
* 'c' = clear the final score (if the input dimension has any score at all, this aggregate will have no score regardless of other inputs)
|
|
248
257
|
*
|
|
249
258
|
* Default if unspecified: '+'
|
|
250
|
-
*
|
|
251
259
|
* @default +
|
|
252
260
|
* @enum {string}
|
|
253
261
|
*/
|
|
@@ -653,10 +661,11 @@ interface paths$4 {
|
|
|
653
661
|
projectId: string;
|
|
654
662
|
/** @description Limit the results to a specific aggregate ID */
|
|
655
663
|
aggregateId?: string;
|
|
656
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* @description Limit the results to a specific aggregate type
|
|
657
666
|
* 0: Audience
|
|
658
667
|
* 1: Intent
|
|
659
|
-
|
|
668
|
+
*/
|
|
660
669
|
type?: 0 | 1;
|
|
661
670
|
};
|
|
662
671
|
header?: never;
|
|
@@ -700,7 +709,6 @@ interface paths$4 {
|
|
|
700
709
|
* @description Skips updating aggregate inputs and upserts only the aggregate definition.
|
|
701
710
|
* Inputs data is still required, but is ignored and not saved or validated.
|
|
702
711
|
* Useful when creating aggregates that reference each other: Create the definitions, then the inputs.
|
|
703
|
-
*
|
|
704
712
|
* @default false
|
|
705
713
|
*/
|
|
706
714
|
skipInputs?: boolean;
|
|
@@ -788,7 +796,6 @@ interface components$4 {
|
|
|
788
796
|
* @description The type of aggregate
|
|
789
797
|
* 0: Audience
|
|
790
798
|
* 1: Intent
|
|
791
|
-
*
|
|
792
799
|
* @enum {number}
|
|
793
800
|
*/
|
|
794
801
|
type: 0 | 1;
|
|
@@ -796,14 +803,15 @@ interface components$4 {
|
|
|
796
803
|
};
|
|
797
804
|
/** @description Defines an input dimension to an aggregate dimension */
|
|
798
805
|
AggregateDimensionInput: {
|
|
799
|
-
/**
|
|
806
|
+
/**
|
|
807
|
+
* @description Dimension name to reference as an input.
|
|
800
808
|
* For enrichment inputs, use CATEGORY_KEY as the dimension.
|
|
801
809
|
* Enrichments, signals, and other aggregate dimensions may be referenced.
|
|
802
810
|
*
|
|
803
811
|
* Note that creating a cycle of aggregate dimensions is allowed, however
|
|
804
812
|
* the final score will _ignore_ the cycled aggregate dimension in the result.
|
|
805
813
|
* This can be used to create mutually exclusive aggregates
|
|
806
|
-
|
|
814
|
+
*/
|
|
807
815
|
dim: string;
|
|
808
816
|
/**
|
|
809
817
|
* @description The sign of the input dimension controls how it affects the aggregate dimension's final score.
|
|
@@ -813,7 +821,6 @@ interface components$4 {
|
|
|
813
821
|
* 'c' = clear the final score (if the input dimension has any score at all, this aggregate will have no score regardless of other inputs)
|
|
814
822
|
*
|
|
815
823
|
* Default if unspecified: '+'
|
|
816
|
-
*
|
|
817
824
|
* @default +
|
|
818
825
|
* @enum {string}
|
|
819
826
|
*/
|
|
@@ -948,16 +955,16 @@ interface components$3 {
|
|
|
948
955
|
* AGG: Aggregation (intent or audience)
|
|
949
956
|
* ENR: Enrichment
|
|
950
957
|
* SIG: Signal
|
|
951
|
-
*
|
|
952
958
|
* @enum {string}
|
|
953
959
|
*/
|
|
954
960
|
category: "AGG" | "ENR" | "SIG";
|
|
955
|
-
/**
|
|
961
|
+
/**
|
|
962
|
+
* @description Subtype of the dimension
|
|
956
963
|
* AGG:0: Audience
|
|
957
964
|
* AGG:1: Intent
|
|
958
965
|
* ENR: Enrichment Category name
|
|
959
966
|
* SIG: null
|
|
960
|
-
|
|
967
|
+
*/
|
|
961
968
|
subcategory?: string;
|
|
962
969
|
/** @description The dimension's name (without category) */
|
|
963
970
|
name: string;
|
|
@@ -1368,7 +1375,6 @@ interface components$1 {
|
|
|
1368
1375
|
* | = OR
|
|
1369
1376
|
*
|
|
1370
1377
|
* Default is `&` if unspecified
|
|
1371
|
-
*
|
|
1372
1378
|
* @enum {string}
|
|
1373
1379
|
*/
|
|
1374
1380
|
op?: "&" | "|";
|
|
@@ -1386,7 +1392,6 @@ interface components$1 {
|
|
|
1386
1392
|
* '//' = regular expression match
|
|
1387
1393
|
*
|
|
1388
1394
|
* Any of the above can be prefixed with '!' to invert the match (i.e. != for 'not an exact match')
|
|
1389
|
-
*
|
|
1390
1395
|
* @enum {string}
|
|
1391
1396
|
*/
|
|
1392
1397
|
op: "=" | "~" | "//" | "!=" | "!~" | "!//";
|
|
@@ -1397,7 +1402,6 @@ interface components$1 {
|
|
|
1397
1402
|
* @description The type of match to perform
|
|
1398
1403
|
* '*' = exists with any value
|
|
1399
1404
|
* '!*' = does not exist
|
|
1400
|
-
*
|
|
1401
1405
|
* @enum {string}
|
|
1402
1406
|
*/
|
|
1403
1407
|
op: "*" | "!*";
|
|
@@ -1436,9 +1440,10 @@ interface components$1 {
|
|
|
1436
1440
|
/** @description How to match the event name */
|
|
1437
1441
|
event: components$1["schemas"]["StringMatch"];
|
|
1438
1442
|
};
|
|
1439
|
-
/**
|
|
1443
|
+
/**
|
|
1444
|
+
* @description Matches the current page's absolute path (i.e. /path/to/page.html)
|
|
1440
1445
|
* Does not include the query string or protocol and hostname (i.e. NOT https://foo.com/path/to/page.html?query=something)
|
|
1441
|
-
|
|
1446
|
+
*/
|
|
1442
1447
|
CurrentPageCriteria: {
|
|
1443
1448
|
/** @enum {string} */
|
|
1444
1449
|
type: "PV";
|
|
@@ -1455,7 +1460,6 @@ interface components$1 {
|
|
|
1455
1460
|
* '!=' = not an exact match
|
|
1456
1461
|
* '<' = less than match expression
|
|
1457
1462
|
* '>' = greater than match expression
|
|
1458
|
-
*
|
|
1459
1463
|
* @enum {string}
|
|
1460
1464
|
*/
|
|
1461
1465
|
op: "=" | "<" | ">" | "!=";
|
|
@@ -1479,7 +1483,6 @@ interface components$1 {
|
|
|
1479
1483
|
* | = OR
|
|
1480
1484
|
*
|
|
1481
1485
|
* Default is `&` if unspecified
|
|
1482
|
-
*
|
|
1483
1486
|
* @default &
|
|
1484
1487
|
* @enum {string}
|
|
1485
1488
|
*/
|
|
@@ -1504,7 +1507,6 @@ interface components$1 {
|
|
|
1504
1507
|
* 's' = current session (expires after a period of inactivity)
|
|
1505
1508
|
* 'p' = permanent (expires as far in the future as possible, may be limited by browser security settings)
|
|
1506
1509
|
* 't' = transient (score tracks the current state of the criteria every time scores are updated)
|
|
1507
|
-
*
|
|
1508
1510
|
* @enum {string}
|
|
1509
1511
|
*/
|
|
1510
1512
|
dur: "s" | "p" | "t";
|
|
@@ -1976,4 +1978,4 @@ declare class CachedContextClient extends ContextClient {
|
|
|
1976
1978
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
|
1977
1979
|
}
|
|
1978
1980
|
|
|
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 };
|
|
1981
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, BearerTokenNotValidOrExpiredError, 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, UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy, rewriteFiltersForApi };
|
package/dist/api/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as paths$7, M as ManifestV2 } from '../types-C0Mthca3.js';
|
|
2
2
|
import 'mitt';
|
|
3
3
|
|
|
4
4
|
type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
|
|
@@ -26,6 +26,11 @@ type ClientOptions = {
|
|
|
26
26
|
signal?: AbortSignal;
|
|
27
27
|
};
|
|
28
28
|
type ExceptProject<T> = Omit<T, 'projectId'>;
|
|
29
|
+
/**
|
|
30
|
+
* Uniform API 401 message for an invalid or expired bearer token.
|
|
31
|
+
* Prefer catching {@link BearerTokenNotValidOrExpiredError} when using ApiClient-based SDKs.
|
|
32
|
+
*/
|
|
33
|
+
declare const UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE: "Bearer token not valid or expired";
|
|
29
34
|
declare class ApiClientError extends Error {
|
|
30
35
|
errorMessage: string;
|
|
31
36
|
fetchMethod: string;
|
|
@@ -35,6 +40,13 @@ declare class ApiClientError extends Error {
|
|
|
35
40
|
requestId?: string | undefined;
|
|
36
41
|
constructor(errorMessage: string, fetchMethod: string, fetchUri: string, statusCode?: number | undefined, statusText?: string | undefined, requestId?: string | undefined);
|
|
37
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when the Uniform API responds with 401 and
|
|
45
|
+
* {@link UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE}.
|
|
46
|
+
*/
|
|
47
|
+
declare class BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
48
|
+
constructor(errorMessage: string, fetchMethod: string, fetchUri: string, statusCode?: number, statusText?: string, requestId?: string);
|
|
49
|
+
}
|
|
38
50
|
|
|
39
51
|
declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
40
52
|
protected options: TOptions;
|
|
@@ -55,6 +67,7 @@ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
|
|
|
55
67
|
private static getRequestId;
|
|
56
68
|
}
|
|
57
69
|
declare function handleRateLimits(callApi: () => Promise<Response>): Promise<Response>;
|
|
70
|
+
declare function rewriteFiltersForApi(filters?: Record<string, unknown>): Record<string, string>;
|
|
58
71
|
|
|
59
72
|
interface components$7 {
|
|
60
73
|
schemas: {
|
|
@@ -78,7 +91,6 @@ interface components$7 {
|
|
|
78
91
|
* 's' = current session (expires after a period of inactivity)
|
|
79
92
|
* 'p' = permanent (expires as far in the future as possible, may be limited by browser security settings)
|
|
80
93
|
* 't' = transient (score tracks the current state of the criteria every time scores are updated)
|
|
81
|
-
*
|
|
82
94
|
* @enum {string}
|
|
83
95
|
*/
|
|
84
96
|
dur: "s" | "p" | "t";
|
|
@@ -97,7 +109,6 @@ interface components$7 {
|
|
|
97
109
|
* | = OR
|
|
98
110
|
*
|
|
99
111
|
* Default is `&` if unspecified
|
|
100
|
-
*
|
|
101
112
|
* @default &
|
|
102
113
|
* @enum {string}
|
|
103
114
|
*/
|
|
@@ -124,7 +135,6 @@ interface components$7 {
|
|
|
124
135
|
* | = OR
|
|
125
136
|
*
|
|
126
137
|
* Default is `&` if unspecified
|
|
127
|
-
*
|
|
128
138
|
* @enum {string}
|
|
129
139
|
*/
|
|
130
140
|
op?: "&" | "|";
|
|
@@ -166,9 +176,10 @@ interface components$7 {
|
|
|
166
176
|
/** @description How to match the event name */
|
|
167
177
|
event: components$7["schemas"]["StringMatch"];
|
|
168
178
|
};
|
|
169
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* @description Matches the current page's absolute path (i.e. /path/to/page.html)
|
|
170
181
|
* Does not include the query string or protocol and hostname (i.e. NOT https://foo.com/path/to/page.html?query=something)
|
|
171
|
-
|
|
182
|
+
*/
|
|
172
183
|
CurrentPageCriteria: {
|
|
173
184
|
/** @enum {string} */
|
|
174
185
|
type: "PV";
|
|
@@ -192,7 +203,6 @@ interface components$7 {
|
|
|
192
203
|
* '//' = regular expression match
|
|
193
204
|
*
|
|
194
205
|
* Any of the above can be prefixed with '!' to invert the match (i.e. != for 'not an exact match')
|
|
195
|
-
*
|
|
196
206
|
* @enum {string}
|
|
197
207
|
*/
|
|
198
208
|
op: "=" | "~" | "//" | "!=" | "!~" | "!//";
|
|
@@ -203,7 +213,6 @@ interface components$7 {
|
|
|
203
213
|
* @description The type of match to perform
|
|
204
214
|
* '*' = exists with any value
|
|
205
215
|
* '!*' = does not exist
|
|
206
|
-
*
|
|
207
216
|
* @enum {string}
|
|
208
217
|
*/
|
|
209
218
|
op: "*" | "!*";
|
|
@@ -218,7 +227,6 @@ interface components$7 {
|
|
|
218
227
|
* '!=' = not an exact match
|
|
219
228
|
* '<' = less than match expression
|
|
220
229
|
* '>' = greater than match expression
|
|
221
|
-
*
|
|
222
230
|
* @enum {string}
|
|
223
231
|
*/
|
|
224
232
|
op: "=" | "<" | ">" | "!=";
|
|
@@ -230,14 +238,15 @@ interface components$7 {
|
|
|
230
238
|
};
|
|
231
239
|
/** @description Defines an input dimension to an aggregate dimension */
|
|
232
240
|
AggregateDimensionInput: {
|
|
233
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* @description Dimension name to reference as an input.
|
|
234
243
|
* For enrichment inputs, use CATEGORY_KEY as the dimension.
|
|
235
244
|
* Enrichments, signals, and other aggregate dimensions may be referenced.
|
|
236
245
|
*
|
|
237
246
|
* Note that creating a cycle of aggregate dimensions is allowed, however
|
|
238
247
|
* the final score will _ignore_ the cycled aggregate dimension in the result.
|
|
239
248
|
* This can be used to create mutually exclusive aggregates
|
|
240
|
-
|
|
249
|
+
*/
|
|
241
250
|
dim: string;
|
|
242
251
|
/**
|
|
243
252
|
* @description The sign of the input dimension controls how it affects the aggregate dimension's final score.
|
|
@@ -247,7 +256,6 @@ interface components$7 {
|
|
|
247
256
|
* 'c' = clear the final score (if the input dimension has any score at all, this aggregate will have no score regardless of other inputs)
|
|
248
257
|
*
|
|
249
258
|
* Default if unspecified: '+'
|
|
250
|
-
*
|
|
251
259
|
* @default +
|
|
252
260
|
* @enum {string}
|
|
253
261
|
*/
|
|
@@ -653,10 +661,11 @@ interface paths$4 {
|
|
|
653
661
|
projectId: string;
|
|
654
662
|
/** @description Limit the results to a specific aggregate ID */
|
|
655
663
|
aggregateId?: string;
|
|
656
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* @description Limit the results to a specific aggregate type
|
|
657
666
|
* 0: Audience
|
|
658
667
|
* 1: Intent
|
|
659
|
-
|
|
668
|
+
*/
|
|
660
669
|
type?: 0 | 1;
|
|
661
670
|
};
|
|
662
671
|
header?: never;
|
|
@@ -700,7 +709,6 @@ interface paths$4 {
|
|
|
700
709
|
* @description Skips updating aggregate inputs and upserts only the aggregate definition.
|
|
701
710
|
* Inputs data is still required, but is ignored and not saved or validated.
|
|
702
711
|
* Useful when creating aggregates that reference each other: Create the definitions, then the inputs.
|
|
703
|
-
*
|
|
704
712
|
* @default false
|
|
705
713
|
*/
|
|
706
714
|
skipInputs?: boolean;
|
|
@@ -788,7 +796,6 @@ interface components$4 {
|
|
|
788
796
|
* @description The type of aggregate
|
|
789
797
|
* 0: Audience
|
|
790
798
|
* 1: Intent
|
|
791
|
-
*
|
|
792
799
|
* @enum {number}
|
|
793
800
|
*/
|
|
794
801
|
type: 0 | 1;
|
|
@@ -796,14 +803,15 @@ interface components$4 {
|
|
|
796
803
|
};
|
|
797
804
|
/** @description Defines an input dimension to an aggregate dimension */
|
|
798
805
|
AggregateDimensionInput: {
|
|
799
|
-
/**
|
|
806
|
+
/**
|
|
807
|
+
* @description Dimension name to reference as an input.
|
|
800
808
|
* For enrichment inputs, use CATEGORY_KEY as the dimension.
|
|
801
809
|
* Enrichments, signals, and other aggregate dimensions may be referenced.
|
|
802
810
|
*
|
|
803
811
|
* Note that creating a cycle of aggregate dimensions is allowed, however
|
|
804
812
|
* the final score will _ignore_ the cycled aggregate dimension in the result.
|
|
805
813
|
* This can be used to create mutually exclusive aggregates
|
|
806
|
-
|
|
814
|
+
*/
|
|
807
815
|
dim: string;
|
|
808
816
|
/**
|
|
809
817
|
* @description The sign of the input dimension controls how it affects the aggregate dimension's final score.
|
|
@@ -813,7 +821,6 @@ interface components$4 {
|
|
|
813
821
|
* 'c' = clear the final score (if the input dimension has any score at all, this aggregate will have no score regardless of other inputs)
|
|
814
822
|
*
|
|
815
823
|
* Default if unspecified: '+'
|
|
816
|
-
*
|
|
817
824
|
* @default +
|
|
818
825
|
* @enum {string}
|
|
819
826
|
*/
|
|
@@ -948,16 +955,16 @@ interface components$3 {
|
|
|
948
955
|
* AGG: Aggregation (intent or audience)
|
|
949
956
|
* ENR: Enrichment
|
|
950
957
|
* SIG: Signal
|
|
951
|
-
*
|
|
952
958
|
* @enum {string}
|
|
953
959
|
*/
|
|
954
960
|
category: "AGG" | "ENR" | "SIG";
|
|
955
|
-
/**
|
|
961
|
+
/**
|
|
962
|
+
* @description Subtype of the dimension
|
|
956
963
|
* AGG:0: Audience
|
|
957
964
|
* AGG:1: Intent
|
|
958
965
|
* ENR: Enrichment Category name
|
|
959
966
|
* SIG: null
|
|
960
|
-
|
|
967
|
+
*/
|
|
961
968
|
subcategory?: string;
|
|
962
969
|
/** @description The dimension's name (without category) */
|
|
963
970
|
name: string;
|
|
@@ -1368,7 +1375,6 @@ interface components$1 {
|
|
|
1368
1375
|
* | = OR
|
|
1369
1376
|
*
|
|
1370
1377
|
* Default is `&` if unspecified
|
|
1371
|
-
*
|
|
1372
1378
|
* @enum {string}
|
|
1373
1379
|
*/
|
|
1374
1380
|
op?: "&" | "|";
|
|
@@ -1386,7 +1392,6 @@ interface components$1 {
|
|
|
1386
1392
|
* '//' = regular expression match
|
|
1387
1393
|
*
|
|
1388
1394
|
* Any of the above can be prefixed with '!' to invert the match (i.e. != for 'not an exact match')
|
|
1389
|
-
*
|
|
1390
1395
|
* @enum {string}
|
|
1391
1396
|
*/
|
|
1392
1397
|
op: "=" | "~" | "//" | "!=" | "!~" | "!//";
|
|
@@ -1397,7 +1402,6 @@ interface components$1 {
|
|
|
1397
1402
|
* @description The type of match to perform
|
|
1398
1403
|
* '*' = exists with any value
|
|
1399
1404
|
* '!*' = does not exist
|
|
1400
|
-
*
|
|
1401
1405
|
* @enum {string}
|
|
1402
1406
|
*/
|
|
1403
1407
|
op: "*" | "!*";
|
|
@@ -1436,9 +1440,10 @@ interface components$1 {
|
|
|
1436
1440
|
/** @description How to match the event name */
|
|
1437
1441
|
event: components$1["schemas"]["StringMatch"];
|
|
1438
1442
|
};
|
|
1439
|
-
/**
|
|
1443
|
+
/**
|
|
1444
|
+
* @description Matches the current page's absolute path (i.e. /path/to/page.html)
|
|
1440
1445
|
* Does not include the query string or protocol and hostname (i.e. NOT https://foo.com/path/to/page.html?query=something)
|
|
1441
|
-
|
|
1446
|
+
*/
|
|
1442
1447
|
CurrentPageCriteria: {
|
|
1443
1448
|
/** @enum {string} */
|
|
1444
1449
|
type: "PV";
|
|
@@ -1455,7 +1460,6 @@ interface components$1 {
|
|
|
1455
1460
|
* '!=' = not an exact match
|
|
1456
1461
|
* '<' = less than match expression
|
|
1457
1462
|
* '>' = greater than match expression
|
|
1458
|
-
*
|
|
1459
1463
|
* @enum {string}
|
|
1460
1464
|
*/
|
|
1461
1465
|
op: "=" | "<" | ">" | "!=";
|
|
@@ -1479,7 +1483,6 @@ interface components$1 {
|
|
|
1479
1483
|
* | = OR
|
|
1480
1484
|
*
|
|
1481
1485
|
* Default is `&` if unspecified
|
|
1482
|
-
*
|
|
1483
1486
|
* @default &
|
|
1484
1487
|
* @enum {string}
|
|
1485
1488
|
*/
|
|
@@ -1504,7 +1507,6 @@ interface components$1 {
|
|
|
1504
1507
|
* 's' = current session (expires after a period of inactivity)
|
|
1505
1508
|
* 'p' = permanent (expires as far in the future as possible, may be limited by browser security settings)
|
|
1506
1509
|
* 't' = transient (score tracks the current state of the criteria every time scores are updated)
|
|
1507
|
-
*
|
|
1508
1510
|
* @enum {string}
|
|
1509
1511
|
*/
|
|
1510
1512
|
dur: "s" | "p" | "t";
|
|
@@ -1976,4 +1978,4 @@ declare class CachedContextClient extends ContextClient {
|
|
|
1976
1978
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
|
1977
1979
|
}
|
|
1978
1980
|
|
|
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 };
|
|
1981
|
+
export { type Aggregate, AggregateClient, type AggregateDeleteParameters, type AggregateGetParameters, type AggregateGetResponse, type AggregatePutParameters, ApiClient, ApiClientError, BearerTokenNotValidOrExpiredError, 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, UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, UncachedTestClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, defaultLimitPolicy, handleRateLimits, nullLimitPolicy, rewriteFiltersForApi };
|
package/dist/api/api.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(api_exports, {
|
|
|
41
41
|
AggregateClient: () => AggregateClient,
|
|
42
42
|
ApiClient: () => ApiClient,
|
|
43
43
|
ApiClientError: () => ApiClientError,
|
|
44
|
+
BearerTokenNotValidOrExpiredError: () => BearerTokenNotValidOrExpiredError,
|
|
44
45
|
CachedAggregateClient: () => CachedAggregateClient,
|
|
45
46
|
CachedContextClient: () => CachedContextClient,
|
|
46
47
|
CachedDimensionClient: () => CachedDimensionClient,
|
|
@@ -56,6 +57,7 @@ __export(api_exports, {
|
|
|
56
57
|
QuirkClient: () => QuirkClient,
|
|
57
58
|
SignalClient: () => SignalClient,
|
|
58
59
|
TestClient: () => TestClient,
|
|
60
|
+
UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE: () => UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE,
|
|
59
61
|
UncachedAggregateClient: () => UncachedAggregateClient,
|
|
60
62
|
UncachedContextClient: () => UncachedContextClient,
|
|
61
63
|
UncachedDimensionClient: () => UncachedDimensionClient,
|
|
@@ -69,7 +71,8 @@ __export(api_exports, {
|
|
|
69
71
|
computeDimensionDisplayName: () => computeDimensionDisplayName,
|
|
70
72
|
defaultLimitPolicy: () => defaultLimitPolicy,
|
|
71
73
|
handleRateLimits: () => handleRateLimits,
|
|
72
|
-
nullLimitPolicy: () => nullLimitPolicy
|
|
74
|
+
nullLimitPolicy: () => nullLimitPolicy,
|
|
75
|
+
rewriteFiltersForApi: () => rewriteFiltersForApi
|
|
73
76
|
});
|
|
74
77
|
module.exports = __toCommonJS(api_exports);
|
|
75
78
|
|
|
@@ -77,21 +80,28 @@ module.exports = __toCommonJS(api_exports);
|
|
|
77
80
|
var import_p_limit = __toESM(require("p-limit"));
|
|
78
81
|
var nullLimitPolicy = async (func) => await func();
|
|
79
82
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
83
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
80
84
|
var ApiClientError = class _ApiClientError extends Error {
|
|
81
85
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
82
86
|
super(
|
|
83
87
|
`${errorMessage}
|
|
84
88
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
85
89
|
);
|
|
86
|
-
this
|
|
87
|
-
this
|
|
88
|
-
this
|
|
89
|
-
this
|
|
90
|
-
this
|
|
91
|
-
this
|
|
90
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
91
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
92
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
93
|
+
__publicField(this, "statusCode", statusCode);
|
|
94
|
+
__publicField(this, "statusText", statusText);
|
|
95
|
+
__publicField(this, "requestId", requestId);
|
|
92
96
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
93
97
|
}
|
|
94
98
|
};
|
|
99
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
100
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
101
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
102
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
95
105
|
|
|
96
106
|
// src/api/ApiClient.ts
|
|
97
107
|
var ApiClient = class _ApiClient {
|
|
@@ -127,7 +137,7 @@ var ApiClient = class _ApiClient {
|
|
|
127
137
|
}
|
|
128
138
|
async apiClientWithResponse(fetchUri, options) {
|
|
129
139
|
return this.options.limitPolicy(async () => {
|
|
130
|
-
var _a;
|
|
140
|
+
var _a, _b;
|
|
131
141
|
const coreHeaders = this.options.apiKey ? {
|
|
132
142
|
"x-api-key": this.options.apiKey
|
|
133
143
|
} : {
|
|
@@ -163,9 +173,19 @@ var ApiClient = class _ApiClient {
|
|
|
163
173
|
} catch (e) {
|
|
164
174
|
message = `General error`;
|
|
165
175
|
}
|
|
176
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
177
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
178
|
+
message,
|
|
179
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
180
|
+
fetchUri.toString(),
|
|
181
|
+
apiResponse.status,
|
|
182
|
+
apiResponse.statusText,
|
|
183
|
+
_ApiClient.getRequestId(apiResponse)
|
|
184
|
+
);
|
|
185
|
+
}
|
|
166
186
|
throw new ApiClientError(
|
|
167
187
|
message,
|
|
168
|
-
(
|
|
188
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
169
189
|
fetchUri.toString(),
|
|
170
190
|
apiResponse.status,
|
|
171
191
|
apiResponse.statusText,
|
|
@@ -239,11 +259,25 @@ async function handleRateLimits(callApi) {
|
|
|
239
259
|
}
|
|
240
260
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
241
261
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
242
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
262
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
243
263
|
backoffRetriesLeft -= 1;
|
|
244
264
|
}
|
|
245
265
|
return response;
|
|
246
266
|
}
|
|
267
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
268
|
+
function rewriteFiltersForApi(filters) {
|
|
269
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
270
|
+
(acc, [key, value]) => {
|
|
271
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
272
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
273
|
+
return {
|
|
274
|
+
...acc,
|
|
275
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
{}
|
|
279
|
+
);
|
|
280
|
+
}
|
|
247
281
|
|
|
248
282
|
// src/api/AggregateClient.ts
|
|
249
283
|
var _url;
|
|
@@ -622,6 +656,7 @@ var CachedContextClient = class extends ContextClient {
|
|
|
622
656
|
AggregateClient,
|
|
623
657
|
ApiClient,
|
|
624
658
|
ApiClientError,
|
|
659
|
+
BearerTokenNotValidOrExpiredError,
|
|
625
660
|
CachedAggregateClient,
|
|
626
661
|
CachedContextClient,
|
|
627
662
|
CachedDimensionClient,
|
|
@@ -637,6 +672,7 @@ var CachedContextClient = class extends ContextClient {
|
|
|
637
672
|
QuirkClient,
|
|
638
673
|
SignalClient,
|
|
639
674
|
TestClient,
|
|
675
|
+
UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE,
|
|
640
676
|
UncachedAggregateClient,
|
|
641
677
|
UncachedContextClient,
|
|
642
678
|
UncachedDimensionClient,
|
|
@@ -650,5 +686,6 @@ var CachedContextClient = class extends ContextClient {
|
|
|
650
686
|
computeDimensionDisplayName,
|
|
651
687
|
defaultLimitPolicy,
|
|
652
688
|
handleRateLimits,
|
|
653
|
-
nullLimitPolicy
|
|
689
|
+
nullLimitPolicy,
|
|
690
|
+
rewriteFiltersForApi
|
|
654
691
|
});
|