@uniformdev/context 16.2.4 → 17.1.1-alpha.151

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.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, d as AggregateDeleteParameters, D as DimensionGetParameters, e as DimensionGetResponse, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, i as EnrichmentDeleteParameters, j as EnrichmentValuePutParameters, k as EnrichmentValueDeleteParameters, M as ManifestGetParameters, l as ManifestGetResponse, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, p as QuirkDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, t as SignalDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters, x as TestDeleteParameters, y as DimensionDefinition } from '../contextTypes-572b0d33.js';
2
- export { A as Aggregate, d as AggregateDeleteParameters, a as AggregateGetParameters, b as AggregateGetResponse, c as AggregatePutParameters, C as CookieCriteria, I as CurrentPageCriteria, y as DimensionDefinition, D as DimensionGetParameters, e as DimensionGetResponse, z as EnrichmentCategory, E as EnrichmentCategoryWithValues, i as EnrichmentDeleteParameters, f as EnrichmentGetParameters, g as EnrichmentGetResponse, h as EnrichmentPutParameters, B as EnrichmentValue, k as EnrichmentValueDeleteParameters, j as EnrichmentValuePutParameters, H as EventCriteria, M as ManifestGetParameters, l as ManifestGetResponse, P as PageViewCountCriteria, F as QueryStringCriteria, Q as Quirk, G as QuirkCriteria, p as QuirkDeleteParameters, m as QuirkGetParameters, n as QuirkGetResponse, o as QuirkPutParameters, R as RootSignalCriteriaGroup, t as SignalDeleteParameters, q as SignalGetParameters, r as SignalGetResponse, s as SignalPutParameters, S as SignalWithId, T as Test, x as TestDeleteParameters, u as TestGetParameters, v as TestGetResponse, w as TestPutParameters } from '../contextTypes-572b0d33.js';
3
- import { g as ManifestV2 } from '../types-682b51bf.js';
4
- import '../v2-manifest.swagger-ff2af13e.js';
1
+ import { A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, c as AggregateDeleteParameters, D as DimensionGetParameters, d as DimensionGetResponse, E as EnrichmentGetParameters, e as EnrichmentGetResponse, f as EnrichmentPutParameters, g as EnrichmentDeleteParameters, h as EnrichmentValuePutParameters, i as EnrichmentValueDeleteParameters, M as ManifestGetParameters, j as ManifestGetResponse, Q as QuirkGetParameters, k as QuirkGetResponse, l as QuirkPutParameters, m as QuirkDeleteParameters, S as SignalGetParameters, n as SignalGetResponse, o as SignalPutParameters, p as SignalDeleteParameters, T as TestGetParameters, q as TestGetResponse, r as TestPutParameters, s as TestDeleteParameters, t as DimensionDefinition } from '../contextTypes-ec62120f.js';
2
+ export { x as Aggregate, c as AggregateDeleteParameters, A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, C as ContextDefinitions, F as CookieCriteria, J as CurrentPageCriteria, t as DimensionDefinition, D as DimensionGetParameters, d as DimensionGetResponse, u as EnrichmentCategory, v as EnrichmentCategoryWithValues, g as EnrichmentDeleteParameters, E as EnrichmentGetParameters, e as EnrichmentGetResponse, f as EnrichmentPutParameters, w as EnrichmentValue, i as EnrichmentValueDeleteParameters, h as EnrichmentValuePutParameters, I as EventCriteria, M as ManifestGetParameters, j as ManifestGetResponse, P as PageViewCountCriteria, G as QueryStringCriteria, y as Quirk, H as QuirkCriteria, m as QuirkDeleteParameters, Q as QuirkGetParameters, k as QuirkGetResponse, l as QuirkPutParameters, R as RootSignalCriteriaGroup, p as SignalDeleteParameters, S as SignalGetParameters, n as SignalGetResponse, o as SignalPutParameters, B as SignalWithId, z as Test, s as TestDeleteParameters, T as TestGetParameters, q as TestGetResponse, r as TestPutParameters } from '../contextTypes-ec62120f.js';
3
+ import { g as ManifestV2 } from '../types-c398dba8.js';
4
+ import '../v2-manifest.swagger-200ca5ee.js';
5
5
  import 'mitt';
6
6
 
7
7
  declare type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
@@ -22,6 +22,8 @@ declare type ClientOptions = {
22
22
  * Default: no limit policy.
23
23
  */
24
24
  limitPolicy?: LimitPolicy;
25
+ /** Specify whether caching is disabled. */
26
+ bypassCache?: boolean;
25
27
  };
26
28
  declare type ExceptProject<T> = Omit<T, 'projectId'>;
27
29
  declare class ApiClientError extends Error {
@@ -34,14 +36,14 @@ declare class ApiClientError extends Error {
34
36
  constructor(errorMessage: string, fetchMethod: string, fetchUri: string, statusCode?: number | undefined, statusText?: string | undefined, requestId?: string | undefined);
35
37
  }
36
38
 
37
- declare class ApiClient {
38
- protected options: Required<ClientOptions>;
39
- constructor(options: ClientOptions);
39
+ declare class ApiClient<TOptions extends ClientOptions = ClientOptions> {
40
+ protected options: TOptions;
41
+ constructor(options: TOptions);
40
42
  protected apiClient<TResponse>(fetchUri: URL, options?: RequestInit & {
41
43
  /** Whether to expect a JSON response or not */
42
44
  expectNoContent?: boolean;
43
45
  }): Promise<TResponse>;
44
- protected createUrl(path: string, queryParams?: Record<string, string | boolean | undefined | null | number>): URL;
46
+ protected createUrl(path: string, queryParams?: Record<string, string | boolean | undefined | null | number | Array<string | boolean | number>>): URL;
45
47
  private static getRequestId;
46
48
  }
47
49
 
@@ -55,6 +57,12 @@ declare class AggregateClient extends ApiClient {
55
57
  /** Deletes an Aggregate */
56
58
  remove(body: ExceptProject<AggregateDeleteParameters>): Promise<void>;
57
59
  }
60
+ declare class UncachedAggregateClient extends AggregateClient {
61
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
62
+ }
63
+ declare class CachedAggregateClient extends AggregateClient {
64
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
65
+ }
58
66
 
59
67
  declare class DimensionClient extends ApiClient {
60
68
  #private;
@@ -62,6 +70,12 @@ declare class DimensionClient extends ApiClient {
62
70
  /** Fetches the known score dimensions for a project */
63
71
  get(options?: ExceptProject<DimensionGetParameters>): Promise<DimensionGetResponse>;
64
72
  }
73
+ declare class UncachedDimensionClient extends DimensionClient {
74
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
75
+ }
76
+ declare class CachedDimensionClient extends DimensionClient {
77
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
78
+ }
65
79
 
66
80
  declare class EnrichmentClient extends ApiClient {
67
81
  #private;
@@ -77,12 +91,26 @@ declare class EnrichmentClient extends ApiClient {
77
91
  /** Deletes an enrichment value within an enrichment category. The category is left alone. */
78
92
  removeValue(body: ExceptProject<EnrichmentValueDeleteParameters>): Promise<void>;
79
93
  }
94
+ declare class UncachedEnrichmentClient extends EnrichmentClient {
95
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
96
+ }
97
+ declare class CachedEnrichmentClient extends EnrichmentClient {
98
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
99
+ }
80
100
 
81
101
  declare class ManifestClient extends ApiClient {
82
102
  #private;
83
103
  constructor(options: ClientOptions);
84
104
  /** Fetches the Context manifest for a project */
85
105
  get(options?: ExceptProject<ManifestGetParameters>): Promise<ManifestGetResponse>;
106
+ /** Publishes the Context manifest for a project */
107
+ publish(): Promise<void>;
108
+ }
109
+ declare class UncachedManifestClient extends ManifestClient {
110
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
111
+ }
112
+ declare class CachedManifestClient extends ManifestClient {
113
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
86
114
  }
87
115
 
88
116
  declare class QuirkClient extends ApiClient {
@@ -95,6 +123,12 @@ declare class QuirkClient extends ApiClient {
95
123
  /** Deletes a Quirk */
96
124
  remove(body: ExceptProject<QuirkDeleteParameters>): Promise<void>;
97
125
  }
126
+ declare class UncachedQuirkClient extends QuirkClient {
127
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
128
+ }
129
+ declare class CachedQuirkClient extends QuirkClient {
130
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
131
+ }
98
132
 
99
133
  declare class SignalClient extends ApiClient {
100
134
  #private;
@@ -106,6 +140,12 @@ declare class SignalClient extends ApiClient {
106
140
  /** Deletes a Signal */
107
141
  remove(body: ExceptProject<SignalDeleteParameters>): Promise<void>;
108
142
  }
143
+ declare class UncachedSignalClient extends SignalClient {
144
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
145
+ }
146
+ declare class CachedSignalClient extends SignalClient {
147
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
148
+ }
109
149
 
110
150
  declare class TestClient extends ApiClient {
111
151
  #private;
@@ -128,6 +168,12 @@ declare class ContextClient {
128
168
  readonly signals: SignalClient;
129
169
  readonly tests: TestClient;
130
170
  }
171
+ declare class UncachedContextClient extends ContextClient {
172
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
173
+ }
174
+ declare class CachedContextClient extends ContextClient {
175
+ constructor(options: Omit<ClientOptions, 'bypassCache'>);
176
+ }
131
177
 
132
178
  declare type DimensionDisplayData = {
133
179
  dim: string;
@@ -140,4 +186,4 @@ declare function computeDimensionDisplayData(dim: string, manifest: ManifestV2):
140
186
  /** Computes the standard display name for a given dimension from the dimensions API */
141
187
  declare function computeDimensionDisplayName(dim: DimensionDefinition): string;
142
188
 
143
- export { AggregateClient, ApiClientError, ClientOptions, ContextClient, DimensionClient, DimensionDisplayData, EnrichmentClient, ExceptProject, LimitPolicy, ManifestClient, QuirkClient, SignalClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, nullLimitPolicy };
189
+ export { AggregateClient, ApiClient, ApiClientError, CachedAggregateClient, CachedContextClient, CachedDimensionClient, CachedEnrichmentClient, CachedManifestClient, CachedQuirkClient, CachedSignalClient, ClientOptions, ContextClient, DimensionClient, DimensionDisplayData, EnrichmentClient, ExceptProject, LimitPolicy, ManifestClient, QuirkClient, SignalClient, UncachedAggregateClient, UncachedContextClient, UncachedDimensionClient, UncachedEnrichmentClient, UncachedManifestClient, UncachedQuirkClient, UncachedSignalClient, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, nullLimitPolicy };
package/dist/api/api.js CHANGED
@@ -1,2 +1,2 @@
1
- var N=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var K=(r,e,t)=>e in r?N(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var q=(r,e)=>{for(var t in e)N(r,t,{get:e[t],enumerable:!0})},z=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Q(e))!H.call(r,n)&&n!==t&&N(r,n,{get:()=>e[n],enumerable:!(i=V(e,n))||i.enumerable});return r};var B=r=>z(N({},"__esModule",{value:!0}),r);var l=(r,e,t)=>(K(r,typeof e!="symbol"?e+"":e,t),t),Y=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(Y(r,e,"read from private field"),t?t.call(r):e.get(r)),p=(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 X={};q(X,{AggregateClient:()=>g,ApiClientError:()=>u,ContextClient:()=>J,DimensionClient:()=>P,EnrichmentClient:()=>y,ManifestClient:()=>x,QuirkClient:()=>E,SignalClient:()=>C,computeDimensionDefinitionDisplayData:()=>M,computeDimensionDisplayData:()=>F,computeDimensionDisplayName:()=>W,nullLimitPolicy:()=>k});module.exports=B(X);var k=async r=>await r(),u=class extends Error{constructor(t,i,n,a,c,m){super(`${t}
2
- ${a}${c?" "+c:""} (${i} ${n}${m?` Request ID: ${m}`:""})`);this.errorMessage=t;this.fetchMethod=i;this.fetchUri=n;this.statusCode=a;this.statusText=c;this.requestId=m;Object.setPrototypeOf(this,u.prototype)}};var o=class{constructor(e){l(this,"options");var t,i,n,a,c,m;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");this.options={...e,fetch:(t=e.fetch)!=null?t:fetch,apiHost:(i=e.apiHost)!=null?i:"https://uniform.app",apiKey:(n=e.apiKey)!=null?n:null,projectId:(a=e.projectId)!=null?a:null,bearerToken:(c=e.bearerToken)!=null?c:null,limitPolicy:(m=e.limitPolicy)!=null?m:k}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var a;let i=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`},n=await fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...i}});if(!n.ok){let c="";try{let m=await n.text();try{let R=JSON.parse(m);R.errorMessage?c=Array.isArray(R.errorMessage)?R.errorMessage.join(", "):R.errorMessage:c=m}catch(R){c=m}}catch(m){c="General error"}throw new u(c,(a=t==null?void 0:t.method)!=null?a:"GET",e.toString(),n.status,n.statusText,o.getRequestId(n))}return t!=null&&t.expectNoContent?null:await n.json()})}createUrl(e,t){let i=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([n,a])=>{var c;typeof a!="undefined"&&a!==null&&i.searchParams.append(n,(c=a==null?void 0:a.toString())!=null?c:"")}),i}static getRequestId(e){let t=e.headers.get("x-nf-request-id");if(t)return t}};var f,I=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(I,f),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(I,f));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(I,f));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},g=I;f=new WeakMap,p(g,f,"/api/v2/aggregate");var S,L=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(L,S),{...e,projectId:t});return await this.apiClient(i)}},P=L;S=new WeakMap,p(P,S,"/api/v2/dimension");var d,T,h=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(h,d),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(s(h,d));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(s(h,d));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(s(h,T));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(s(h,T));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},y=h;d=new WeakMap,T=new WeakMap,p(y,d,"/api/v1/enrichments"),p(y,T,"/api/v1/enrichment-values");var A,v=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(v,A),{...e,projectId:t});return await this.apiClient(i)}},x=v;A=new WeakMap,p(x,A,"/api/v2/manifest");var j,O=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(O,j),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(O,j));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(O,j));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},E=O;j=new WeakMap,p(E,j,"/api/v2/quirk");var U,G=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(G,U),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(G,U));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(G,U));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},C=G;U=new WeakMap,p(C,U,"/api/v2/signal");var D,b=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(b,D),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(b,D));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(b,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=b;D=new WeakMap,p(w,D,"/api/v2/test");var J=class{constructor(e){l(this,"enrichments");l(this,"aggregates");l(this,"dimensions");l(this,"manifest");l(this,"quirks");l(this,"signals");l(this,"tests");this.enrichments=new y(e),this.aggregates=new g(e),this.dimensions=new P(e),this.manifest=new x(e),this.quirks=new E(e),this.signals=new C(e),this.tests=new w(e)}};var $="_";function M(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 F(r,e){var t,i,n,a;if((i=(t=e.project.pz)==null?void 0:t.agg)!=null&&i[r])return{dim:r,name:r,type:"Aggregate"};if((a=(n=e.project.pz)==null?void 0:n.sig)!=null&&a[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf($)>=0){let[c,m]=r.split($);return{dim:r,name:m,type:"Enrichment",category:c}}}function W(r){let{type:e,name:t}=M(r);return`${e}: ${t}`}0&&(module.exports={AggregateClient,ApiClientError,ContextClient,DimensionClient,EnrichmentClient,ManifestClient,QuirkClient,SignalClient,computeDimensionDefinitionDisplayData,computeDimensionDisplayData,computeDimensionDisplayName,nullLimitPolicy});
1
+ "use strict";var S=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var ie=(r,e,t)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var oe=(r,e)=>{for(var t in e)S(r,t,{get:e[t],enumerable:!0})},ne=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of re(e))!se.call(r,o)&&o!==t&&S(r,o,{get:()=>e[o],enumerable:!(s=te(e,o))||s.enumerable});return r};var ae=r=>ne(S({},"__esModule",{value:!0}),r);var m=(r,e,t)=>(ie(r,typeof e!="symbol"?e+"":e,t),t),pe=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var i=(r,e,t)=>(pe(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 me={};oe(me,{AggregateClient:()=>y,ApiClient:()=>n,ApiClientError:()=>P,CachedAggregateClient:()=>J,CachedContextClient:()=>Z,CachedDimensionClient:()=>V,CachedEnrichmentClient:()=>H,CachedManifestClient:()=>q,CachedQuirkClient:()=>B,CachedSignalClient:()=>W,ContextClient:()=>N,DimensionClient:()=>f,EnrichmentClient:()=>u,ManifestClient:()=>x,QuirkClient:()=>g,SignalClient:()=>d,UncachedAggregateClient:()=>L,UncachedContextClient:()=>X,UncachedDimensionClient:()=>$,UncachedEnrichmentClient:()=>Q,UncachedManifestClient:()=>K,UncachedQuirkClient:()=>Y,UncachedSignalClient:()=>F,computeDimensionDefinitionDisplayData:()=>ee,computeDimensionDisplayData:()=>ce,computeDimensionDisplayName:()=>le,nullLimitPolicy:()=>v});module.exports=ae(me);var v=async r=>await r(),P=class extends Error{constructor(t,s,o,a,p,l){super(`${t}
2
+ ${a}${p?" "+p:""} (${s} ${o}${l?` Request ID: ${l}`:""})`);this.errorMessage=t;this.fetchMethod=s;this.fetchUri=o;this.statusCode=a;this.statusText=p;this.requestId=l;Object.setPrototypeOf(this,P.prototype)}};var n=class{constructor(e){m(this,"options");var s,o,a,p,l,h;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:(o=e.apiKey)!=null?o:null,projectId:(a=e.projectId)!=null?a:null,bearerToken:(p=e.bearerToken)!=null?p:null,limitPolicy:(l=e.limitPolicy)!=null?l:v,bypassCache:(h=e.bypassCache)!=null?h:!1}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var a;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 o=await this.options.fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...s}});if(!o.ok){let p="";try{let l=await o.text();try{let h=JSON.parse(l);h.errorMessage?p=Array.isArray(h.errorMessage)?h.errorMessage.join(", "):h.errorMessage:p=l}catch(h){p=l}}catch(l){p="General error"}throw new P(p,(a=t==null?void 0:t.method)!=null?a:"GET",e.toString(),o.status,o.statusText,n.getRequestId(o))}return t!=null&&t.expectNoContent?null:await o.json()})}createUrl(e,t){let s=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([o,a])=>{var p;typeof a!="undefined"&&a!==null&&s.searchParams.append(o,Array.isArray(a)?a.join(","):(p=a==null?void 0:a.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 L=class extends y{constructor(e){super({...e,bypassCache:!0})}},J=class extends y{constructor(e){super({...e,bypassCache:!1})}};var A,M=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(M,A),{...e,projectId:t});return await this.apiClient(s)}},f=M;A=new WeakMap,c(f,A,"/api/v2/dimension");var $=class extends f{constructor(e){super({...e,bypassCache:!0})}},V=class extends f{constructor(e){super({...e,bypassCache:!1})}};var O,w,C=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(C,O),{...e,projectId:t});return await this.apiClient(s)}async upsertCategory(e){let t=this.createUrl(i(C,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(C,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(C,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(C,w));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},u=C;O=new WeakMap,w=new WeakMap,c(u,O,"/api/v1/enrichments"),c(u,w,"/api/v1/enrichment-values");var Q=class extends u{constructor(e){super({...e,bypassCache:!0})}},H=class extends u{constructor(e){super({...e,bypassCache:!1})}};var k,z=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(z,k),{...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})}},x=z;k=new WeakMap,c(x,k,"/api/v2/manifest");var K=class extends x{constructor(e){super({...e,bypassCache:!0})}},q=class extends x{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})}},g=R;j=new WeakMap,c(g,j,"/api/v2/quirk");var Y=class extends g{constructor(e){super({...e,bypassCache:!0})}},B=class extends g{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})}},d=I;E=new WeakMap,c(d,E,"/api/v2/signal");var F=class extends d{constructor(e){super({...e,bypassCache:!0})}},W=class extends d{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 N=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 u(e),this.aggregates=new y(e),this.dimensions=new f(e),this.manifest=new x(e),this.quirks=new g(e),this.signals=new d(e),this.tests=new T(e)}},X=class extends N{constructor(e){super({...e,bypassCache:!0})}},Z=class extends N{constructor(e){super({...e,bypassCache:!1})}};var _="_";function ee(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 ce(r,e){var t,s,o,a;if((s=(t=e.project.pz)==null?void 0:t.agg)!=null&&s[r])return{dim:r,name:r,type:"Aggregate"};if((a=(o=e.project.pz)==null?void 0:o.sig)!=null&&a[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf(_)>=0){let[p,l]=r.split(_);return{dim:r,name:l,type:"Enrichment",category:p}}}function le(r){let{type:e,name:t}=ee(r);return`${e}: ${t}`}0&&(module.exports={AggregateClient,ApiClient,ApiClientError,CachedAggregateClient,CachedContextClient,CachedDimensionClient,CachedEnrichmentClient,CachedManifestClient,CachedQuirkClient,CachedSignalClient,ContextClient,DimensionClient,EnrichmentClient,ManifestClient,QuirkClient,SignalClient,UncachedAggregateClient,UncachedContextClient,UncachedDimensionClient,UncachedEnrichmentClient,UncachedManifestClient,UncachedQuirkClient,UncachedSignalClient,computeDimensionDefinitionDisplayData,computeDimensionDisplayData,computeDimensionDisplayName,nullLimitPolicy});
package/dist/api/api.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var $=Object.defineProperty;var M=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),V=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var s=(r,e,t)=>(V(r,e,"read from private field"),t?t.call(r):e.get(r)),p=(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 v=async r=>await r(),h=class extends Error{constructor(t,i,o,a,c,m){super(`${t}
2
- ${a}${c?" "+c:""} (${i} ${o}${m?` Request ID: ${m}`:""})`);this.errorMessage=t;this.fetchMethod=i;this.fetchUri=o;this.statusCode=a;this.statusText=c;this.requestId=m;Object.setPrototypeOf(this,h.prototype)}};var n=class{constructor(e){l(this,"options");var t,i,o,a,c,m;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");this.options={...e,fetch:(t=e.fetch)!=null?t:fetch,apiHost:(i=e.apiHost)!=null?i:"https://uniform.app",apiKey:(o=e.apiKey)!=null?o:null,projectId:(a=e.projectId)!=null?a:null,bearerToken:(c=e.bearerToken)!=null?c:null,limitPolicy:(m=e.limitPolicy)!=null?m:v}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var a;let i=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`},o=await fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...i}});if(!o.ok){let c="";try{let m=await o.text();try{let E=JSON.parse(m);E.errorMessage?c=Array.isArray(E.errorMessage)?E.errorMessage.join(", "):E.errorMessage:c=m}catch(E){c=m}}catch(m){c="General error"}throw new h(c,(a=t==null?void 0:t.method)!=null?a:"GET",e.toString(),o.status,o.statusText,n.getRequestId(o))}return t!=null&&t.expectNoContent?null:await o.json()})}createUrl(e,t){let i=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([o,a])=>{var c;typeof a!="undefined"&&a!==null&&i.searchParams.append(o,(c=a==null?void 0:a.toString())!=null?c:"")}),i}static getRequestId(e){let t=e.headers.get("x-nf-request-id");if(t)return t}};var y,C=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(C,y),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(C,y));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(C,y));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},j=C;y=new WeakMap,p(j,y,"/api/v2/aggregate");var N,A=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(A,N),{...e,projectId:t});return await this.apiClient(i)}},U=A;N=new WeakMap,p(U,N,"/api/v2/dimension");var f,D,u=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(u,f),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(s(u,f));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(s(u,f));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(s(u,D));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(s(u,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},g=u;f=new WeakMap,D=new WeakMap,p(g,f,"/api/v1/enrichments"),p(g,D,"/api/v1/enrichment-values");var S,k=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(k,S),{...e,projectId:t});return await this.apiClient(i)}},R=k;S=new WeakMap,p(R,S,"/api/v2/manifest");var P,T=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(T,P),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(T,P));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(T,P));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},I=T;P=new WeakMap,p(I,P,"/api/v2/quirk");var d,G=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(G,d),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(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(s(G,d));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},O=G;d=new WeakMap,p(O,d,"/api/v2/signal");var x,b=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(b,x),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(b,x));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(s(b,x));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=b;x=new WeakMap,p(w,x,"/api/v2/test");var J=class{constructor(e){l(this,"enrichments");l(this,"aggregates");l(this,"dimensions");l(this,"manifest");l(this,"quirks");l(this,"signals");l(this,"tests");this.enrichments=new g(e),this.aggregates=new j(e),this.dimensions=new U(e),this.manifest=new R(e),this.quirks=new I(e),this.signals=new O(e),this.tests=new w(e)}};var L="_";function Q(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 de(r,e){var t,i,o,a;if((i=(t=e.project.pz)==null?void 0:t.agg)!=null&&i[r])return{dim:r,name:r,type:"Aggregate"};if((a=(o=e.project.pz)==null?void 0:o.sig)!=null&&a[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf(L)>=0){let[c,m]=r.split(L);return{dim:r,name:m,type:"Enrichment",category:c}}}function xe(r){let{type:e,name:t}=Q(r);return`${e}: ${t}`}export{j as AggregateClient,h as ApiClientError,J as ContextClient,U as DimensionClient,g as EnrichmentClient,R as ManifestClient,I as QuirkClient,O as SignalClient,Q as computeDimensionDefinitionDisplayData,de as computeDimensionDisplayData,xe as computeDimensionDisplayName,v as nullLimitPolicy};
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 N,k=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(k,N),{...e,projectId:t});return await this.apiClient(s)}},f=k;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,v=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(v,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=v;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})}};var L="_";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 Ne(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(L)>=0){let[p,l]=r.split(L);return{dim:r,name:l,type:"Enrichment",category:p}}}function Se(r){let{type:e,name:t}=re(r);return`${e}: ${t}`}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,Ne as computeDimensionDisplayData,Se as computeDimensionDisplayName,J as nullLimitPolicy};
package/dist/cli/cli.d.ts CHANGED
@@ -1,15 +1,9 @@
1
1
  import { UniformCLIPlugin } from '@uniformdev/cli';
2
2
  import { UniformPackage } from '@uniformdev/cli/sync';
3
- import { A as Aggregate, Q as Quirk, S as SignalWithId, E as EnrichmentCategoryWithValues, T as Test } from '../contextTypes-572b0d33.js';
4
- import '../v2-manifest.swagger-ff2af13e.js';
3
+ import { C as ContextDefinitions } from '../contextTypes-ec62120f.js';
4
+ import '../v2-manifest.swagger-200ca5ee.js';
5
5
 
6
- declare type ContextPackage = UniformPackage & {
7
- aggregates?: Array<Aggregate>;
8
- quirks?: Array<Quirk>;
9
- signals?: Array<SignalWithId>;
10
- enrichments?: Array<EnrichmentCategoryWithValues>;
11
- tests?: Array<Test>;
12
- };
6
+ declare type ContextPackage = UniformPackage & ContextDefinitions;
13
7
  declare function readContextPackage(filename: string, assertExists: boolean): ContextPackage;
14
8
  declare function writeContextPackage(filename: string, packageContents: ContextPackage): void;
15
9