@uniformdev/context 16.2.0 → 16.2.1-alpha.106

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, 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-0d7326f7.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-0d7326f7.js';
3
+ import { g as ManifestV2 } from '../types-17d56dd5.js';
4
+ import '../v2-manifest.swagger-2ea6ebb4.js';
5
5
  import 'mitt';
6
6
 
7
7
  declare type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
@@ -83,6 +83,8 @@ declare class ManifestClient extends ApiClient {
83
83
  constructor(options: ClientOptions);
84
84
  /** Fetches the Context manifest for a project */
85
85
  get(options?: ExceptProject<ManifestGetParameters>): Promise<ManifestGetResponse>;
86
+ /** Publishes the Context manifest for a project */
87
+ publish(): Promise<void>;
86
88
  }
87
89
 
88
90
  declare class QuirkClient extends ApiClient {
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 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 m=(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:()=>f,ApiClientError:()=>h,ContextClient:()=>J,DimensionClient:()=>P,EnrichmentClient:()=>y,ManifestClient:()=>x,QuirkClient:()=>j,SignalClient:()=>C,computeDimensionDefinitionDisplayData:()=>M,computeDimensionDisplayData:()=>F,computeDimensionDisplayName:()=>W,nullLimitPolicy:()=>k});module.exports=B(X);var k=async r=>await r(),h=class extends Error{constructor(t,i,n,a,c,l){super(`${t}
2
+ ${a}${c?" "+c:""} (${i} ${n}${l?` Request ID: ${l}`:""})`);this.errorMessage=t;this.fetchMethod=i;this.fetchUri=n;this.statusCode=a;this.statusText=c;this.requestId=l;Object.setPrototypeOf(this,h.prototype)}};var o=class{constructor(e){m(this,"options");var t,i,n,a,c,l;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:(l=e.limitPolicy)!=null?l: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 l=await n.text();try{let R=JSON.parse(l);R.errorMessage?c=Array.isArray(R.errorMessage)?R.errorMessage.join(", "):R.errorMessage:c=l}catch(R){c=l}}catch(l){c="General error"}throw new h(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 g,I=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(I,g),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(I,g));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,g));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},f=I;g=new WeakMap,p(f,g,"/api/v2/aggregate");var S,v=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(v,S),{...e,projectId:t});return await this.apiClient(i)}},P=v;S=new WeakMap,p(P,S,"/api/v2/dimension");var d,T,u=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(u,d),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(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 removeCategory(e){let t=this.createUrl(s(u,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(u,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(u,T));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},y=u;d=new WeakMap,T=new WeakMap,p(y,d,"/api/v1/enrichments"),p(y,T,"/api/v1/enrichment-values");var A,L=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(L,A),{...e,projectId:t});return await this.apiClient(i)}async publish(){let{projectId:e}=this.options,t=this.createUrl("/api/v1/publish",{siteId:e});await this.apiClient(t,{method:"POST",expectNoContent:!0})}},x=L;A=new WeakMap,p(x,A,"/api/v2/manifest");var E,O=class extends o{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(O,E),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(s(O,E));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,E));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},j=O;E=new WeakMap,p(j,E,"/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){m(this,"enrichments");m(this,"aggregates");m(this,"dimensions");m(this,"manifest");m(this,"quirks");m(this,"signals");m(this,"tests");this.enrichments=new y(e),this.aggregates=new f(e),this.dimensions=new P(e),this.manifest=new x(e),this.quirks=new j(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,l]=r.split($);return{dim:r,name:l,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});
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 M=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(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 L=async r=>await r(),u=class extends Error{constructor(t,i,o,a,c,l){super(`${t}
2
+ ${a}${c?" "+c:""} (${i} ${o}${l?` Request ID: ${l}`:""})`);this.errorMessage=t;this.fetchMethod=i;this.fetchUri=o;this.statusCode=a;this.statusText=c;this.requestId=l;Object.setPrototypeOf(this,u.prototype)}};var n=class{constructor(e){m(this,"options");var t,i,o,a,c,l;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:(l=e.limitPolicy)!=null?l:L}}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 l=await o.text();try{let j=JSON.parse(l);j.errorMessage?c=Array.isArray(j.errorMessage)?j.errorMessage.join(", "):j.errorMessage:c=l}catch(j){c=l}}catch(l){c="General error"}throw new u(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})}},E=C;y=new WeakMap,p(E,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 g,D,h=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(s(h,g),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(s(h,g));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,g));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,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(h,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},f=h;g=new WeakMap,D=new WeakMap,p(f,g,"/api/v1/enrichments"),p(f,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)}async publish(){let{projectId:e}=this.options,t=this.createUrl("/api/v1/publish",{siteId:e});await this.apiClient(t,{method:"POST",expectNoContent:!0})}},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){m(this,"enrichments");m(this,"aggregates");m(this,"dimensions");m(this,"manifest");m(this,"quirks");m(this,"signals");m(this,"tests");this.enrichments=new f(e),this.aggregates=new E(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 v="_";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(v)>=0){let[c,l]=r.split(v);return{dim:r,name:l,type:"Enrichment",category:c}}}function xe(r){let{type:e,name:t}=Q(r);return`${e}: ${t}`}export{E as AggregateClient,u as ApiClientError,J as ContextClient,U as DimensionClient,f as EnrichmentClient,R as ManifestClient,I as QuirkClient,O as SignalClient,Q as computeDimensionDefinitionDisplayData,de as computeDimensionDisplayData,xe as computeDimensionDisplayName,L as nullLimitPolicy};
package/dist/cli/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
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 { A as Aggregate, Q as Quirk, S as SignalWithId, E as EnrichmentCategoryWithValues, T as Test } from '../contextTypes-0d7326f7.js';
4
+ import '../v2-manifest.swagger-2ea6ebb4.js';
5
5
 
6
6
  declare type ContextPackage = UniformPackage & {
7
7
  aggregates?: Array<Aggregate>;