@uniformdev/context 12.2.1-alpha.170 → 12.2.1-alpha.183

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,4 +1,5 @@
1
- import { p as paths$6 } from '../v2-manifest.swagger-d0899723';
1
+ import { ao as paths$6, g as ManifestV2 } from '../types-1ad8439c';
2
+ import 'mitt';
2
3
 
3
4
  /**
4
5
  * This file was auto-generated by openapi-typescript.
@@ -378,6 +379,12 @@ interface paths$3 {
378
379
  aggregate: components$4["schemas"]["AggregateData"];
379
380
  /** Format: uuid */
380
381
  projectId: string;
382
+ /**
383
+ * @description Skips updating aggregate inputs and upserts only the aggregate definition.
384
+ * Inputs data is still required, but is ignored and not saved or validated.
385
+ * Useful when creating aggregates that reference each other: Create the definitions, then the inputs.
386
+ */
387
+ skipInputs?: boolean;
381
388
  };
382
389
  };
383
390
  };
@@ -1504,7 +1511,15 @@ declare class ContextClient {
1504
1511
  readonly signals: SignalClient;
1505
1512
  }
1506
1513
 
1514
+ declare type DimensionDisplayData = {
1515
+ dim: string;
1516
+ type: 'Aggregate' | 'Enrichment' | 'Signal' | 'Intent' | 'Audience';
1517
+ category?: string;
1518
+ name: string;
1519
+ };
1520
+ declare function computeDimensionDefinitionDisplayData(dim: DimensionDefinition): DimensionDisplayData;
1521
+ declare function computeDimensionDisplayData(dim: string, manifest: ManifestV2): DimensionDisplayData | undefined;
1507
1522
  /** Computes the standard display name for a given dimension from the dimensions API */
1508
1523
  declare function computeDimensionDisplayName(dim: DimensionDefinition): string;
1509
1524
 
1510
- export { Aggregate, AggregateClient, AggregateDeleteParameters, AggregateGetParameters, AggregateGetResponse, AggregatePutParameters, ApiClientError, ClientOptions, ContextClient, CookieCriteria, CurrentPageCriteria, DimensionClient, DimensionDefinition, DimensionGetParameters, DimensionGetResponse, EnrichmentCategory, EnrichmentCategoryWithValues, EnrichmentClient, EnrichmentDeleteParameters, EnrichmentGetParameters, EnrichmentGetResponse, EnrichmentPutParameters, EnrichmentValue, EnrichmentValueDeleteParameters, EnrichmentValuePutParameters, EventCriteria, ExceptProject, LimitPolicy, ManifestClient, ManifestGetParameters, ManifestGetResponse, PageViewCountCriteria, QueryStringCriteria, Quirk, QuirkClient, QuirkCriteria, QuirkDeleteParameters, QuirkGetParameters, QuirkGetResponse, QuirkPutParameters, RootSignalCriteriaGroup, SignalClient, SignalDeleteParameters, SignalGetParameters, SignalGetResponse, SignalPutParameters, SignalWithId, computeDimensionDisplayName, nullLimitPolicy };
1525
+ export { Aggregate, AggregateClient, AggregateDeleteParameters, AggregateGetParameters, AggregateGetResponse, AggregatePutParameters, ApiClientError, ClientOptions, ContextClient, CookieCriteria, CurrentPageCriteria, DimensionClient, DimensionDefinition, DimensionDisplayData, DimensionGetParameters, DimensionGetResponse, EnrichmentCategory, EnrichmentCategoryWithValues, EnrichmentClient, EnrichmentDeleteParameters, EnrichmentGetParameters, EnrichmentGetResponse, EnrichmentPutParameters, EnrichmentValue, EnrichmentValueDeleteParameters, EnrichmentValuePutParameters, EventCriteria, ExceptProject, LimitPolicy, ManifestClient, ManifestGetParameters, ManifestGetResponse, PageViewCountCriteria, QueryStringCriteria, Quirk, QuirkClient, QuirkCriteria, QuirkDeleteParameters, QuirkGetParameters, QuirkGetResponse, QuirkPutParameters, RootSignalCriteriaGroup, SignalClient, SignalDeleteParameters, SignalGetParameters, SignalGetResponse, SignalPutParameters, SignalWithId, computeDimensionDefinitionDisplayData, computeDimensionDisplayData, computeDimensionDisplayName, nullLimitPolicy };
package/dist/api/api.js CHANGED
@@ -1,2 +1,2 @@
1
- var T=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var $=(r,e,t)=>e in r?T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var v=r=>T(r,"__esModule",{value:!0});var V=(r,e)=>{for(var t in e)T(r,t,{get:e[t],enumerable:!0})},H=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of M(e))!Q.call(r,n)&&(t||n!=="default")&&T(r,n,{get:()=>e[n],enumerable:!(i=J(e,n))||i.enumerable});return r};var K=(r=>(e,t)=>r&&r.get(e)||(t=H(v({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var m=(r,e,t)=>($(r,typeof e!="symbol"?e+"":e,t),t),q=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var o=(r,e,t)=>(q(r,e,"read from private field"),t?t.call(r):e.get(r)),a=(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 B={};V(B,{AggregateClient:()=>j,ApiClientError:()=>y,ContextClient:()=>L,DimensionClient:()=>U,EnrichmentClient:()=>f,ManifestClient:()=>G,QuirkClient:()=>O,SignalClient:()=>w,computeDimensionDisplayName:()=>z,nullLimitPolicy:()=>N});var N=async r=>await r(),y=class extends Error{constructor(e,t,i,n,s){super(`${e}
2
- ${n}${s?" "+s:""} (${t} ${i})`);this.errorMessage=e;this.fetchMethod=t;this.fetchUri=i;this.statusCode=n;this.statusText=s;Object.setPrototypeOf(this,y.prototype)}};var c=class{constructor(e){m(this,"options");var t,i,n,s,p,h;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:(s=e.projectId)!=null?s:null,bearerToken:(p=e.bearerToken)!=null?p:null,limitPolicy:(h=e.limitPolicy)!=null?h:N}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var s;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 p="";try{let h=await n.text();try{let C=JSON.parse(h);C.errorMessage?p=Array.isArray(C.errorMessage)?C.errorMessage.join(", "):C.errorMessage:p=h}catch(C){p=h}}catch(h){p="General error"}throw new y(p,(s=t==null?void 0:t.method)!=null?s:"GET",e.toString(),n.status)}return(t==null?void 0: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,s])=>{var p;typeof s!="undefined"&&s!==null&&i.searchParams.append(n,(p=s==null?void 0:s.toString())!=null?p:"")}),i}};var g,E=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(E,g),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(o(E,g));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(o(E,g));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},j=E;g=new WeakMap,a(j,g,"/api/v2/aggregate");var D,k=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(k,D),{...e,projectId:t});return await this.apiClient(i)}},U=k;D=new WeakMap,a(U,D,"/api/v2/dimension");var P,I,u=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(u,P),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(o(u,P));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(o(u,P));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(o(u,I));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(o(u,I));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},f=u;P=new WeakMap,I=new WeakMap,a(f,P,"/api/v1/enrichments"),a(f,I,"/api/v1/enrichment-values");var S,A=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(A,S),{...e,projectId:t});return await this.apiClient(i)}},G=A;S=new WeakMap,a(G,S,"/api/v2/manifest");var d,R=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(R,d),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(o(R,d));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(o(R,d));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},O=R;d=new WeakMap,a(O,d,"/api/v2/quirk");var x,b=class extends c{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(o(b,x),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(o(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(o(b,x));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=b;x=new WeakMap,a(w,x,"/api/v2/signal");var L=class{constructor(e){m(this,"enrichments");m(this,"aggregates");m(this,"dimensions");m(this,"manifest");m(this,"quirks");m(this,"signals");this.enrichments=new f(e),this.aggregates=new j(e),this.dimensions=new U(e),this.manifest=new G(e),this.quirks=new O(e),this.signals=new w(e)}};function z(r){return`${r.category==="ENR"?r.subcategory:r.category==="SIG"?"Signal":r.subcategory==="1"?"Intent":"Audience"}: ${r.name}`}module.exports=K(B);0&&(module.exports={AggregateClient,ApiClientError,ContextClient,DimensionClient,EnrichmentClient,ManifestClient,QuirkClient,SignalClient,computeDimensionDisplayName,nullLimitPolicy});
1
+ var b=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var $=(r,e,t)=>e in r?b(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var H=r=>b(r,"__esModule",{value:!0});var K=(r,e)=>{for(var t in e)b(r,t,{get:e[t],enumerable:!0})},z=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!Q.call(r,o)&&(t||o!=="default")&&b(r,o,{get:()=>e[o],enumerable:!(i=V(e,o))||i.enumerable});return r};var q=(r=>(e,t)=>r&&r.get(e)||(t=z(H({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var h=(r,e,t)=>($(r,typeof e!="symbol"?e+"":e,t),t),B=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var n=(r,e,t)=>(B(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 W={};K(W,{AggregateClient:()=>E,ApiClientError:()=>g,ContextClient:()=>M,DimensionClient:()=>D,EnrichmentClient:()=>f,ManifestClient:()=>R,QuirkClient:()=>I,SignalClient:()=>G,computeDimensionDefinitionDisplayData:()=>J,computeDimensionDisplayData:()=>Y,computeDimensionDisplayName:()=>F,nullLimitPolicy:()=>A});var A=async r=>await r(),g=class extends Error{constructor(e,t,i,o,s){super(`${e}
2
+ ${o}${s?" "+s:""} (${t} ${i})`);this.errorMessage=e;this.fetchMethod=t;this.fetchUri=i;this.statusCode=o;this.statusText=s;Object.setPrototypeOf(this,g.prototype)}};var p=class{constructor(e){h(this,"options");var t,i,o,s,a,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:(s=e.projectId)!=null?s:null,bearerToken:(a=e.bearerToken)!=null?a:null,limitPolicy:(m=e.limitPolicy)!=null?m:A}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var s;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 a="";try{let m=await o.text();try{let C=JSON.parse(m);C.errorMessage?a=Array.isArray(C.errorMessage)?C.errorMessage.join(", "):C.errorMessage:a=m}catch(C){a=m}}catch(m){a="General error"}throw new g(a,(s=t==null?void 0:t.method)!=null?s:"GET",e.toString(),o.status)}return(t==null?void 0: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,s])=>{var a;typeof s!="undefined"&&s!==null&&i.searchParams.append(o,(a=s==null?void 0:s.toString())!=null?a:"")}),i}};var y,j=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(j,y),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(n(j,y));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(n(j,y));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},E=j;y=new WeakMap,c(E,y,"/api/v2/aggregate");var S,N=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(N,S),{...e,projectId:t});return await this.apiClient(i)}},D=N;S=new WeakMap,c(D,S,"/api/v2/dimension");var P,U,u=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(u,P),{...e,projectId:t});return await this.apiClient(i)}async upsertCategory(e){let t=this.createUrl(n(u,P));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(n(u,P));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(n(u,U));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(n(u,U));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},f=u;P=new WeakMap,U=new WeakMap,c(f,P,"/api/v1/enrichments"),c(f,U,"/api/v1/enrichment-values");var T,k=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(k,T),{...e,projectId:t});return await this.apiClient(i)}},R=k;T=new WeakMap,c(R,T,"/api/v2/manifest");var d,O=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(O,d),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(n(O,d));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(n(O,d));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},I=O;d=new WeakMap,c(I,d,"/api/v2/quirk");var x,w=class extends p{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,i=this.createUrl(n(w,x),{...e,projectId:t});return await this.apiClient(i)}async upsert(e){let t=this.createUrl(n(w,x));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(n(w,x));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},G=w;x=new WeakMap,c(G,x,"/api/v2/signal");var M=class{constructor(e){h(this,"enrichments");h(this,"aggregates");h(this,"dimensions");h(this,"manifest");h(this,"quirks");h(this,"signals");this.enrichments=new f(e),this.aggregates=new E(e),this.dimensions=new D(e),this.manifest=new R(e),this.quirks=new I(e),this.signals=new G(e)}};var L="_";function J(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 Y(r,e){var t,i,o,s;if((i=(t=e.project.pz)==null?void 0:t.agg)==null?void 0:i[r])return{dim:r,name:r,type:"Aggregate"};if((s=(o=e.project.pz)==null?void 0:o.sig)==null?void 0:s[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf(L)>=0){let[a,m]=r.split(L);return{dim:r,name:m,type:"Enrichment",category:a}}}function F(r){let{type:e,name:t}=J(r);return`${e}: ${t}`}module.exports=q(W);0&&(module.exports={AggregateClient,ApiClientError,ContextClient,DimensionClient,EnrichmentClient,ManifestClient,QuirkClient,SignalClient,computeDimensionDefinitionDisplayData,computeDimensionDisplayData,computeDimensionDisplayName,nullLimitPolicy});
package/dist/api/api.mjs CHANGED
@@ -1 +1 @@
1
- import{a as d,b as w,c,d as f,e as g,f as C,g as x,h as y}from"../chunk-JKQJOIRC.mjs";import{d as n,e as p,f as l,i as t}from"../chunk-KZPEO35A.mjs";t();t();t();var o,a=class extends c{constructor(e){super(e)}async get(e){let{projectId:u}=this.options,h=this.createUrl(p(a,o),{...e,projectId:u});return await this.apiClient(h)}},r=a;o=new WeakMap,l(r,o,"/api/v2/dimension");var D=class{constructor(e){n(this,"enrichments");n(this,"aggregates");n(this,"dimensions");n(this,"manifest");n(this,"quirks");n(this,"signals");this.enrichments=new g(e),this.aggregates=new f(e),this.dimensions=new r(e),this.manifest=new C(e),this.quirks=new x(e),this.signals=new y(e)}};t();function I(i){return`${i.category==="ENR"?i.subcategory:i.category==="SIG"?"Signal":i.subcategory==="1"?"Intent":"Audience"}: ${i.name}`}export{f as AggregateClient,w as ApiClientError,D as ContextClient,r as DimensionClient,g as EnrichmentClient,C as ManifestClient,x as QuirkClient,y as SignalClient,I as computeDimensionDisplayName,d as nullLimitPolicy};
1
+ import{a as p}from"../chunk-GU2YFM6V.mjs";import{a as G,b as O,c as u,d as x,e as C,f as h,g as E,h as A}from"../chunk-JKQJOIRC.mjs";import{d as i,e as y,f as D,i as n}from"../chunk-KZPEO35A.mjs";n();n();n();var a,l=class extends u{constructor(t){super(t)}async get(t){let{projectId:r}=this.options,o=this.createUrl(y(l,a),{...t,projectId:r});return await this.apiClient(o)}},s=l;a=new WeakMap,D(s,a,"/api/v2/dimension");var w=class{constructor(t){i(this,"enrichments");i(this,"aggregates");i(this,"dimensions");i(this,"manifest");i(this,"quirks");i(this,"signals");this.enrichments=new C(t),this.aggregates=new x(t),this.dimensions=new s(t),this.manifest=new h(t),this.quirks=new E(t),this.signals=new A(t)}};n();function S(e){let t=e.category==="ENR"?"Enrichment":e.category==="SIG"?"Signal":e.subcategory==="1"?"Intent":e.subcategory==="0"?"Audience":"Aggregate";return{dim:e.dim,name:e.name,type:t,category:e.category==="ENR"?e.subcategory:void 0}}function z(e,t){var r,o,g,f;if((o=(r=t.project.pz)==null?void 0:r.agg)==null?void 0:o[e])return{dim:e,name:e,type:"Aggregate"};if((f=(g=t.project.pz)==null?void 0:g.sig)==null?void 0:f[e])return{dim:e,name:e,type:"Signal"};if(e.indexOf(p)>=0){let[d,R]=e.split(p);return{dim:e,name:R,type:"Enrichment",category:d}}}function Q(e){let{type:t,name:r}=S(e);return`${t}: ${r}`}export{x as AggregateClient,O as ApiClientError,w as ContextClient,s as DimensionClient,C as EnrichmentClient,h as ManifestClient,E as QuirkClient,A as SignalClient,S as computeDimensionDefinitionDisplayData,z as computeDimensionDisplayData,Q as computeDimensionDisplayName,G as nullLimitPolicy};
@@ -0,0 +1 @@
1
+ import{i as R}from"./chunk-KZPEO35A.mjs";R();var A="_";export{A as a};