@uniformdev/context 17.7.0 → 17.7.1-alpha.167

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.mjs CHANGED
@@ -1,2 +1,507 @@
1
- var _=Object.defineProperty;var ee=(r,e,t)=>e in r?_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(r,e,t)=>(ee(r,typeof e!="symbol"?e+"":e,t),t),te=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var i=(r,e,t)=>(te(r,e,"read from private field"),t?t.call(r):e.get(r)),c=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)};var J=async r=>await r(),C=class extends Error{constructor(t,s,a,o,p,l){super(`${t}
2
- ${o}${p?" "+p:""} (${s} ${a}${l?` Request ID: ${l}`:""})`);this.errorMessage=t;this.fetchMethod=s;this.fetchUri=a;this.statusCode=o;this.statusText=p;this.requestId=l;Object.setPrototypeOf(this,C.prototype)}};var n=class{constructor(e){m(this,"options");var s,a,o,p,l,u;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");let t=e.fetch;if(!t)if(typeof window!="undefined")t=window.fetch.bind(window);else if(typeof fetch!="undefined")t=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...e,fetch:t,apiHost:(s=e.apiHost)!=null?s:"https://uniform.app",apiKey:(a=e.apiKey)!=null?a:null,projectId:(o=e.projectId)!=null?o:null,bearerToken:(p=e.bearerToken)!=null?p:null,limitPolicy:(l=e.limitPolicy)!=null?l:J,bypassCache:(u=e.bypassCache)!=null?u:!1}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var o;let s=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`};this.options.bypassCache&&(s["x-bypass-cache"]="true");let a=await this.options.fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...s}});if(!a.ok){let p="";try{let l=await a.text();try{let u=JSON.parse(l);u.errorMessage?p=Array.isArray(u.errorMessage)?u.errorMessage.join(", "):u.errorMessage:p=l}catch(u){p=l}}catch(l){p="General error"}throw new C(p,(o=t==null?void 0:t.method)!=null?o:"GET",e.toString(),a.status,a.statusText,n.getRequestId(a))}return t!=null&&t.expectNoContent?null:await a.json()})}createUrl(e,t){let s=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([a,o])=>{var p;typeof o!="undefined"&&o!==null&&s.searchParams.append(a,Array.isArray(o)?o.join(","):(p=o==null?void 0:o.toString())!=null?p:"")}),s}static getRequestId(e){let t=e.headers.get("apigw-requestid");if(t)return t}};var b,U=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(U,b),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(U,b));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(U,b));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},y=U;b=new WeakMap,c(y,b,"/api/v2/aggregate");var $=class extends y{constructor(e){super({...e,bypassCache:!0})}},V=class extends y{constructor(e){super({...e,bypassCache:!1})}};var k="_";function re(r){let e=r.category==="ENR"?"Enrichment":r.category==="SIG"?"Signal":r.subcategory==="1"?"Intent":r.subcategory==="0"?"Audience":"Aggregate";return{dim:r.dim,name:r.name,type:e,category:r.category==="ENR"?r.subcategory:void 0}}function ye(r,e){var t,s,a,o;if((s=(t=e.project.pz)==null?void 0:t.agg)!=null&&s[r])return{dim:r,name:r,type:"Aggregate"};if((o=(a=e.project.pz)==null?void 0:a.sig)!=null&&o[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf(k)>=0){let[p,l]=r.split(k);return{dim:r,name:l,type:"Enrichment",category:p}}}function fe(r){let{type:e,name:t}=re(r);return`${e}: ${t}`}var N,v=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(v,N),{...e,projectId:t});return await this.apiClient(s)}},f=v;N=new WeakMap,c(f,N,"/api/v2/dimension");var M=class extends f{constructor(e){super({...e,bypassCache:!0})}},Q=class extends f{constructor(e){super({...e,bypassCache:!1})}};var O,w,x=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(x,O),{...e,projectId:t});return await this.apiClient(s)}async upsertCategory(e){let t=this.createUrl(i(x,O));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(i(x,O));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(i(x,w));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(i(x,w));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},h=x;O=new WeakMap,w=new WeakMap,c(h,O,"/api/v1/enrichments"),c(h,w,"/api/v1/enrichment-values");var H=class extends h{constructor(e){super({...e,bypassCache:!0})}},K=class extends h{constructor(e){super({...e,bypassCache:!1})}};var S,L=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(L,S),{...e,projectId:t});return await this.apiClient(s)}async publish(){let{projectId:e}=this.options,t=this.createUrl("/api/v1/publish",{siteId:e});await this.apiClient(t,{method:"POST",expectNoContent:!0})}},g=L;S=new WeakMap,c(g,S,"/api/v2/manifest");var q=class extends g{constructor(e){super({...e,bypassCache:!0})}},z=class extends g{constructor(e){super({...e,bypassCache:!1})}};var j,R=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(R,j),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(R,j));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(R,j));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},d=R;j=new WeakMap,c(d,j,"/api/v2/quirk");var Y=class extends d{constructor(e){super({...e,bypassCache:!0})}},B=class extends d{constructor(e){super({...e,bypassCache:!1})}};var E,I=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(I,E),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(I,E));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(I,E));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},P=I;E=new WeakMap,c(P,E,"/api/v2/signal");var F=class extends P{constructor(e){super({...e,bypassCache:!0})}},W=class extends P{constructor(e){super({...e,bypassCache:!1})}};var D,G=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(G,D),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(G,D));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(G,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},T=G;D=new WeakMap,c(T,D,"/api/v2/test");var A=class{constructor(e){m(this,"enrichments");m(this,"aggregates");m(this,"dimensions");m(this,"manifest");m(this,"quirks");m(this,"signals");m(this,"tests");this.enrichments=new h(e),this.aggregates=new y(e),this.dimensions=new f(e),this.manifest=new g(e),this.quirks=new d(e),this.signals=new P(e),this.tests=new T(e)}},X=class extends A{constructor(e){super({...e,bypassCache:!0})}},Z=class extends A{constructor(e){super({...e,bypassCache:!1})}};export{y as AggregateClient,n as ApiClient,C as ApiClientError,V as CachedAggregateClient,Z as CachedContextClient,Q as CachedDimensionClient,K as CachedEnrichmentClient,z as CachedManifestClient,B as CachedQuirkClient,W as CachedSignalClient,A as ContextClient,f as DimensionClient,h as EnrichmentClient,g as ManifestClient,d as QuirkClient,P as SignalClient,$ as UncachedAggregateClient,X as UncachedContextClient,M as UncachedDimensionClient,H as UncachedEnrichmentClient,q as UncachedManifestClient,Y as UncachedQuirkClient,F as UncachedSignalClient,re as computeDimensionDefinitionDisplayData,ye as computeDimensionDisplayData,fe as computeDimensionDisplayName,J as nullLimitPolicy};
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ var __accessCheck = (obj, member, msg) => {
8
+ if (!member.has(obj))
9
+ throw TypeError("Cannot " + msg);
10
+ };
11
+ var __privateGet = (obj, member, getter) => {
12
+ __accessCheck(obj, member, "read from private field");
13
+ return getter ? getter.call(obj) : member.get(obj);
14
+ };
15
+ var __privateAdd = (obj, member, value) => {
16
+ if (member.has(obj))
17
+ throw TypeError("Cannot add the same private member more than once");
18
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
+ };
20
+
21
+ // src/api/apiClientUtils.ts
22
+ var nullLimitPolicy = async (func) => await func();
23
+ var ApiClientError = class extends Error {
24
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
25
+ super(
26
+ `${errorMessage}
27
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
28
+ );
29
+ this.errorMessage = errorMessage;
30
+ this.fetchMethod = fetchMethod;
31
+ this.fetchUri = fetchUri;
32
+ this.statusCode = statusCode;
33
+ this.statusText = statusText;
34
+ this.requestId = requestId;
35
+ Object.setPrototypeOf(this, ApiClientError.prototype);
36
+ }
37
+ };
38
+
39
+ // src/api/ApiClient.ts
40
+ var ApiClient = class {
41
+ constructor(options) {
42
+ __publicField(this, "options");
43
+ var _a, _b, _c, _d, _e, _f;
44
+ if (!options.apiKey && !options.bearerToken) {
45
+ throw new Error("You must provide an API key or a bearer token");
46
+ }
47
+ let leFetch = options.fetch;
48
+ if (!leFetch) {
49
+ if (typeof window !== "undefined") {
50
+ leFetch = window.fetch.bind(window);
51
+ } else if (typeof fetch !== "undefined") {
52
+ leFetch = fetch;
53
+ } else {
54
+ throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
55
+ }
56
+ }
57
+ this.options = {
58
+ ...options,
59
+ fetch: leFetch,
60
+ apiHost: (_a = options.apiHost) != null ? _a : "https://uniform.app",
61
+ apiKey: (_b = options.apiKey) != null ? _b : null,
62
+ projectId: (_c = options.projectId) != null ? _c : null,
63
+ bearerToken: (_d = options.bearerToken) != null ? _d : null,
64
+ limitPolicy: (_e = options.limitPolicy) != null ? _e : nullLimitPolicy,
65
+ bypassCache: (_f = options.bypassCache) != null ? _f : false
66
+ };
67
+ }
68
+ async apiClient(fetchUri, options) {
69
+ return this.options.limitPolicy(async () => {
70
+ var _a;
71
+ const coreHeaders = this.options.apiKey ? {
72
+ "x-api-key": this.options.apiKey
73
+ } : {
74
+ Authorization: `Bearer ${this.options.bearerToken}`
75
+ };
76
+ if (this.options.bypassCache) {
77
+ coreHeaders["x-bypass-cache"] = "true";
78
+ }
79
+ const apiResponse = await this.options.fetch(fetchUri.toString(), {
80
+ ...options,
81
+ headers: {
82
+ ...options == null ? void 0 : options.headers,
83
+ ...coreHeaders
84
+ }
85
+ });
86
+ if (!apiResponse.ok) {
87
+ let message = "";
88
+ try {
89
+ const responseText = await apiResponse.text();
90
+ try {
91
+ const parsed = JSON.parse(responseText);
92
+ if (parsed.errorMessage) {
93
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
94
+ } else {
95
+ message = responseText;
96
+ }
97
+ } catch (e) {
98
+ message = responseText;
99
+ }
100
+ } catch (e) {
101
+ message = `General error`;
102
+ }
103
+ throw new ApiClientError(
104
+ message,
105
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
106
+ fetchUri.toString(),
107
+ apiResponse.status,
108
+ apiResponse.statusText,
109
+ ApiClient.getRequestId(apiResponse)
110
+ );
111
+ }
112
+ if (options == null ? void 0 : options.expectNoContent) {
113
+ return null;
114
+ }
115
+ return await apiResponse.json();
116
+ });
117
+ }
118
+ createUrl(path, queryParams) {
119
+ const url = new URL(`${this.options.apiHost}${path}`);
120
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
121
+ var _a;
122
+ if (typeof value !== "undefined" && value !== null) {
123
+ url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
124
+ }
125
+ });
126
+ return url;
127
+ }
128
+ static getRequestId(response) {
129
+ const apigRequestId = response.headers.get("apigw-requestid");
130
+ if (apigRequestId) {
131
+ return apigRequestId;
132
+ }
133
+ return void 0;
134
+ }
135
+ };
136
+
137
+ // src/api/AggregateClient.ts
138
+ var _url;
139
+ var _AggregateClient = class extends ApiClient {
140
+ constructor(options) {
141
+ super(options);
142
+ }
143
+ async get(options) {
144
+ const { projectId } = this.options;
145
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url), { ...options, projectId });
146
+ return await this.apiClient(fetchUri);
147
+ }
148
+ async upsert(body) {
149
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
150
+ await this.apiClient(fetchUri, {
151
+ method: "PUT",
152
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
153
+ expectNoContent: true
154
+ });
155
+ }
156
+ async remove(body) {
157
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
158
+ await this.apiClient(fetchUri, {
159
+ method: "DELETE",
160
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
161
+ expectNoContent: true
162
+ });
163
+ }
164
+ };
165
+ var AggregateClient = _AggregateClient;
166
+ _url = new WeakMap();
167
+ __privateAdd(AggregateClient, _url, "/api/v2/aggregate");
168
+ var UncachedAggregateClient = class extends AggregateClient {
169
+ constructor(options) {
170
+ super({ ...options, bypassCache: true });
171
+ }
172
+ };
173
+ var CachedAggregateClient = class extends AggregateClient {
174
+ constructor(options) {
175
+ super({ ...options, bypassCache: false });
176
+ }
177
+ };
178
+
179
+ // src/manifest/constants.ts
180
+ var ENR_SEPARATOR = "_";
181
+
182
+ // src/api/computeDimensionDisplayName.ts
183
+ function computeDimensionDefinitionDisplayData(dim) {
184
+ const type = dim.category === "ENR" ? "Enrichment" : dim.category === "SIG" ? "Signal" : dim.subcategory === "1" ? "Intent" : dim.subcategory === "0" ? "Audience" : "Aggregate";
185
+ return {
186
+ dim: dim.dim,
187
+ name: dim.name,
188
+ type,
189
+ category: dim.category === "ENR" ? dim.subcategory : void 0
190
+ };
191
+ }
192
+ function computeDimensionDisplayData(dim, manifest) {
193
+ var _a, _b, _c, _d;
194
+ if ((_b = (_a = manifest.project.pz) == null ? void 0 : _a.agg) == null ? void 0 : _b[dim]) {
195
+ return { dim, name: dim, type: "Aggregate" };
196
+ } else if ((_d = (_c = manifest.project.pz) == null ? void 0 : _c.sig) == null ? void 0 : _d[dim]) {
197
+ return { dim, name: dim, type: "Signal" };
198
+ } else if (dim.indexOf(ENR_SEPARATOR) >= 0) {
199
+ const [cat, value] = dim.split(ENR_SEPARATOR);
200
+ return {
201
+ dim,
202
+ name: value,
203
+ type: "Enrichment",
204
+ category: cat
205
+ };
206
+ }
207
+ return void 0;
208
+ }
209
+ function computeDimensionDisplayName(dim) {
210
+ const { type, name } = computeDimensionDefinitionDisplayData(dim);
211
+ return `${type}: ${name}`;
212
+ }
213
+
214
+ // src/api/DimensionClient.ts
215
+ var _url2;
216
+ var _DimensionClient = class extends ApiClient {
217
+ constructor(options) {
218
+ super(options);
219
+ }
220
+ async get(options) {
221
+ const { projectId } = this.options;
222
+ const fetchUri = this.createUrl(__privateGet(_DimensionClient, _url2), { ...options, projectId });
223
+ return await this.apiClient(fetchUri);
224
+ }
225
+ };
226
+ var DimensionClient = _DimensionClient;
227
+ _url2 = new WeakMap();
228
+ __privateAdd(DimensionClient, _url2, "/api/v2/dimension");
229
+ var UncachedDimensionClient = class extends DimensionClient {
230
+ constructor(options) {
231
+ super({ ...options, bypassCache: true });
232
+ }
233
+ };
234
+ var CachedDimensionClient = class extends DimensionClient {
235
+ constructor(options) {
236
+ super({ ...options, bypassCache: false });
237
+ }
238
+ };
239
+
240
+ // src/api/EnrichmentClient.ts
241
+ var _url3, _valueUrl;
242
+ var _EnrichmentClient = class extends ApiClient {
243
+ constructor(options) {
244
+ super(options);
245
+ }
246
+ async get(options) {
247
+ const { projectId } = this.options;
248
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3), { ...options, projectId });
249
+ return await this.apiClient(fetchUri);
250
+ }
251
+ async upsertCategory(body) {
252
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
253
+ await this.apiClient(fetchUri, {
254
+ method: "PUT",
255
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
256
+ expectNoContent: true
257
+ });
258
+ }
259
+ async removeCategory(body) {
260
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url3));
261
+ await this.apiClient(fetchUri, {
262
+ method: "DELETE",
263
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
264
+ expectNoContent: true
265
+ });
266
+ }
267
+ async upsertValue(body) {
268
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
269
+ await this.apiClient(fetchUri, {
270
+ method: "PUT",
271
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
272
+ expectNoContent: true
273
+ });
274
+ }
275
+ async removeValue(body) {
276
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
277
+ await this.apiClient(fetchUri, {
278
+ method: "DELETE",
279
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
280
+ expectNoContent: true
281
+ });
282
+ }
283
+ };
284
+ var EnrichmentClient = _EnrichmentClient;
285
+ _url3 = new WeakMap();
286
+ _valueUrl = new WeakMap();
287
+ __privateAdd(EnrichmentClient, _url3, "/api/v1/enrichments");
288
+ __privateAdd(EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
289
+ var UncachedEnrichmentClient = class extends EnrichmentClient {
290
+ constructor(options) {
291
+ super({ ...options, bypassCache: true });
292
+ }
293
+ };
294
+ var CachedEnrichmentClient = class extends EnrichmentClient {
295
+ constructor(options) {
296
+ super({ ...options, bypassCache: false });
297
+ }
298
+ };
299
+
300
+ // src/api/ManifestClient.ts
301
+ var _url4;
302
+ var _ManifestClient = class extends ApiClient {
303
+ constructor(options) {
304
+ super(options);
305
+ }
306
+ async get(options) {
307
+ const { projectId } = this.options;
308
+ const fetchUri = this.createUrl(__privateGet(_ManifestClient, _url4), { ...options, projectId });
309
+ return await this.apiClient(fetchUri);
310
+ }
311
+ async publish() {
312
+ const { projectId } = this.options;
313
+ const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
314
+ await this.apiClient(fetchUri, {
315
+ method: "POST",
316
+ expectNoContent: true
317
+ });
318
+ }
319
+ };
320
+ var ManifestClient = _ManifestClient;
321
+ _url4 = new WeakMap();
322
+ __privateAdd(ManifestClient, _url4, "/api/v2/manifest");
323
+ var UncachedManifestClient = class extends ManifestClient {
324
+ constructor(options) {
325
+ super({ ...options, bypassCache: true });
326
+ }
327
+ };
328
+ var CachedManifestClient = class extends ManifestClient {
329
+ constructor(options) {
330
+ super({ ...options, bypassCache: false });
331
+ }
332
+ };
333
+
334
+ // src/api/QuirkClient.ts
335
+ var _url5;
336
+ var _QuirkClient = class extends ApiClient {
337
+ constructor(options) {
338
+ super(options);
339
+ }
340
+ async get(options) {
341
+ const { projectId } = this.options;
342
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5), { ...options, projectId });
343
+ return await this.apiClient(fetchUri);
344
+ }
345
+ async upsert(body) {
346
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
347
+ await this.apiClient(fetchUri, {
348
+ method: "PUT",
349
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
350
+ expectNoContent: true
351
+ });
352
+ }
353
+ async remove(body) {
354
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url5));
355
+ await this.apiClient(fetchUri, {
356
+ method: "DELETE",
357
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
358
+ expectNoContent: true
359
+ });
360
+ }
361
+ };
362
+ var QuirkClient = _QuirkClient;
363
+ _url5 = new WeakMap();
364
+ __privateAdd(QuirkClient, _url5, "/api/v2/quirk");
365
+ var UncachedQuirkClient = class extends QuirkClient {
366
+ constructor(options) {
367
+ super({ ...options, bypassCache: true });
368
+ }
369
+ };
370
+ var CachedQuirkClient = class extends QuirkClient {
371
+ constructor(options) {
372
+ super({ ...options, bypassCache: false });
373
+ }
374
+ };
375
+
376
+ // src/api/SignalClient.ts
377
+ var _url6;
378
+ var _SignalClient = class extends ApiClient {
379
+ constructor(options) {
380
+ super(options);
381
+ }
382
+ async get(options) {
383
+ const { projectId } = this.options;
384
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6), { ...options, projectId });
385
+ return await this.apiClient(fetchUri);
386
+ }
387
+ async upsert(body) {
388
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
389
+ await this.apiClient(fetchUri, {
390
+ method: "PUT",
391
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
392
+ expectNoContent: true
393
+ });
394
+ }
395
+ async remove(body) {
396
+ const fetchUri = this.createUrl(__privateGet(_SignalClient, _url6));
397
+ await this.apiClient(fetchUri, {
398
+ method: "DELETE",
399
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
400
+ expectNoContent: true
401
+ });
402
+ }
403
+ };
404
+ var SignalClient = _SignalClient;
405
+ _url6 = new WeakMap();
406
+ __privateAdd(SignalClient, _url6, "/api/v2/signal");
407
+ var UncachedSignalClient = class extends SignalClient {
408
+ constructor(options) {
409
+ super({ ...options, bypassCache: true });
410
+ }
411
+ };
412
+ var CachedSignalClient = class extends SignalClient {
413
+ constructor(options) {
414
+ super({ ...options, bypassCache: false });
415
+ }
416
+ };
417
+
418
+ // src/api/TestClient.ts
419
+ var _url7;
420
+ var _TestClient = class extends ApiClient {
421
+ constructor(options) {
422
+ super(options);
423
+ }
424
+ async get(options) {
425
+ const { projectId } = this.options;
426
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7), { ...options, projectId });
427
+ return await this.apiClient(fetchUri);
428
+ }
429
+ async upsert(body) {
430
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
431
+ await this.apiClient(fetchUri, {
432
+ method: "PUT",
433
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
434
+ expectNoContent: true
435
+ });
436
+ }
437
+ async remove(body) {
438
+ const fetchUri = this.createUrl(__privateGet(_TestClient, _url7));
439
+ await this.apiClient(fetchUri, {
440
+ method: "DELETE",
441
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
442
+ expectNoContent: true
443
+ });
444
+ }
445
+ };
446
+ var TestClient = _TestClient;
447
+ _url7 = new WeakMap();
448
+ __privateAdd(TestClient, _url7, "/api/v2/test");
449
+
450
+ // src/api/ContextClient.ts
451
+ var ContextClient = class {
452
+ constructor(options) {
453
+ __publicField(this, "enrichments");
454
+ __publicField(this, "aggregates");
455
+ __publicField(this, "dimensions");
456
+ __publicField(this, "manifest");
457
+ __publicField(this, "quirks");
458
+ __publicField(this, "signals");
459
+ __publicField(this, "tests");
460
+ this.enrichments = new EnrichmentClient(options);
461
+ this.aggregates = new AggregateClient(options);
462
+ this.dimensions = new DimensionClient(options);
463
+ this.manifest = new ManifestClient(options);
464
+ this.quirks = new QuirkClient(options);
465
+ this.signals = new SignalClient(options);
466
+ this.tests = new TestClient(options);
467
+ }
468
+ };
469
+ var UncachedContextClient = class extends ContextClient {
470
+ constructor(options) {
471
+ super({ ...options, bypassCache: true });
472
+ }
473
+ };
474
+ var CachedContextClient = class extends ContextClient {
475
+ constructor(options) {
476
+ super({ ...options, bypassCache: false });
477
+ }
478
+ };
479
+ export {
480
+ AggregateClient,
481
+ ApiClient,
482
+ ApiClientError,
483
+ CachedAggregateClient,
484
+ CachedContextClient,
485
+ CachedDimensionClient,
486
+ CachedEnrichmentClient,
487
+ CachedManifestClient,
488
+ CachedQuirkClient,
489
+ CachedSignalClient,
490
+ ContextClient,
491
+ DimensionClient,
492
+ EnrichmentClient,
493
+ ManifestClient,
494
+ QuirkClient,
495
+ SignalClient,
496
+ UncachedAggregateClient,
497
+ UncachedContextClient,
498
+ UncachedDimensionClient,
499
+ UncachedEnrichmentClient,
500
+ UncachedManifestClient,
501
+ UncachedQuirkClient,
502
+ UncachedSignalClient,
503
+ computeDimensionDefinitionDisplayData,
504
+ computeDimensionDisplayData,
505
+ computeDimensionDisplayName,
506
+ nullLimitPolicy
507
+ };
package/dist/cli/cli.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { UniformCLIPlugin } from '@uniformdev/cli';
2
2
  import { UniformPackage } from '@uniformdev/cli/sync';
3
- import { C as ContextDefinitions } from '../contextTypes-1907a553.js';
4
- import '../v2-manifest.swagger-200ca5ee.js';
3
+ import { C as ContextDefinitions } from '../contextTypes-defd0c5d.js';
4
+ import '../v2-manifest.swagger-74a3dcac.js';
5
5
 
6
- declare type ContextPackage = UniformPackage & ContextDefinitions;
6
+ type ContextPackage = UniformPackage & ContextDefinitions;
7
7
  declare function readContextPackage(filename: string, assertExists: boolean): ContextPackage;
8
8
  declare function writeContextPackage(filename: string, packageContents: ContextPackage): void;
9
9