@uniformdev/context 17.5.1-alpha.105 → 17.5.1-alpha.130
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 +14 -14
- package/dist/api/api.js +2 -2
- package/dist/api/api.mjs +1 -1
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.js +37 -37
- package/dist/cli/cli.mjs +37 -37
- package/dist/{contextTypes-ec62120f.d.ts → contextTypes-1907a553.d.ts} +560 -560
- package/dist/index.d.ts +32 -32
- package/dist/index.esm.js +3 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{types-c398dba8.d.ts → types-cb64a6b4.d.ts} +212 -212
- package/package.json +3 -3
package/dist/api/api.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, c as AggregateDeleteParameters, D as
|
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,
|
3
|
-
import {
|
1
|
+
import { A as AggregateGetParameters, a as AggregateGetResponse, b as AggregatePutParameters, c as AggregateDeleteParameters, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, h as EnrichmentDeleteParameters, i as EnrichmentValuePutParameters, j as EnrichmentValueDeleteParameters, M as ManifestGetParameters, k as ManifestGetResponse, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, n as QuirkDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, q as SignalDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters, t as TestDeleteParameters } from '../contextTypes-1907a553.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, D as DimensionDefinition, d as DimensionGetParameters, e as DimensionGetResponse, u as EnrichmentCategory, v as EnrichmentCategoryWithValues, h as EnrichmentDeleteParameters, E as EnrichmentGetParameters, f as EnrichmentGetResponse, g as EnrichmentPutParameters, w as EnrichmentValue, j as EnrichmentValueDeleteParameters, i as EnrichmentValuePutParameters, I as EventCriteria, M as ManifestGetParameters, k as ManifestGetResponse, P as PageViewCountCriteria, G as QueryStringCriteria, y as Quirk, H as QuirkCriteria, n as QuirkDeleteParameters, Q as QuirkGetParameters, l as QuirkGetResponse, m as QuirkPutParameters, R as RootSignalCriteriaGroup, q as SignalDeleteParameters, S as SignalGetParameters, o as SignalGetResponse, p as SignalPutParameters, B as SignalWithId, z as Test, t as TestDeleteParameters, T as TestGetParameters, r as TestGetResponse, s as TestPutParameters } from '../contextTypes-1907a553.js';
|
3
|
+
import { I as ManifestV2 } from '../types-cb64a6b4.js';
|
4
4
|
import '../v2-manifest.swagger-200ca5ee.js';
|
5
5
|
import 'mitt';
|
6
6
|
|
@@ -64,6 +64,17 @@ declare class CachedAggregateClient extends AggregateClient {
|
|
64
64
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
65
65
|
}
|
66
66
|
|
67
|
+
declare type DimensionDisplayData = {
|
68
|
+
dim: string;
|
69
|
+
type: 'Aggregate' | 'Enrichment' | 'Signal' | 'Intent' | 'Audience';
|
70
|
+
category?: string;
|
71
|
+
name: string;
|
72
|
+
};
|
73
|
+
declare function computeDimensionDefinitionDisplayData(dim: DimensionDefinition): DimensionDisplayData;
|
74
|
+
declare function computeDimensionDisplayData(dim: string, manifest: ManifestV2): DimensionDisplayData | undefined;
|
75
|
+
/** Computes the standard display name for a given dimension from the dimensions API */
|
76
|
+
declare function computeDimensionDisplayName(dim: DimensionDefinition): string;
|
77
|
+
|
67
78
|
declare class DimensionClient extends ApiClient {
|
68
79
|
#private;
|
69
80
|
constructor(options: ClientOptions);
|
@@ -175,15 +186,4 @@ declare class CachedContextClient extends ContextClient {
|
|
175
186
|
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
176
187
|
}
|
177
188
|
|
178
|
-
declare type DimensionDisplayData = {
|
179
|
-
dim: string;
|
180
|
-
type: 'Aggregate' | 'Enrichment' | 'Signal' | 'Intent' | 'Audience';
|
181
|
-
category?: string;
|
182
|
-
name: string;
|
183
|
-
};
|
184
|
-
declare function computeDimensionDefinitionDisplayData(dim: DimensionDefinition): DimensionDisplayData;
|
185
|
-
declare function computeDimensionDisplayData(dim: string, manifest: ManifestV2): DimensionDisplayData | undefined;
|
186
|
-
/** Computes the standard display name for a given dimension from the dimensions API */
|
187
|
-
declare function computeDimensionDisplayName(dim: DimensionDefinition): string;
|
188
|
-
|
189
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
|
-
"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:()=>
|
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,
|
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:()=>_,CachedDimensionClient:()=>M,CachedEnrichmentClient:()=>K,CachedManifestClient:()=>z,CachedQuirkClient:()=>F,CachedSignalClient:()=>X,ContextClient:()=>N,DimensionClient:()=>f,EnrichmentClient:()=>u,ManifestClient:()=>x,QuirkClient:()=>g,SignalClient:()=>d,UncachedAggregateClient:()=>L,UncachedContextClient:()=>Z,UncachedDimensionClient:()=>V,UncachedEnrichmentClient:()=>H,UncachedManifestClient:()=>q,UncachedQuirkClient:()=>B,UncachedSignalClient:()=>W,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 $="_";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}`}var A,Q=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(Q,A),{...e,projectId:t});return await this.apiClient(s)}},f=Q;A=new WeakMap,c(f,A,"/api/v2/dimension");var V=class extends f{constructor(e){super({...e,bypassCache:!0})}},M=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 H=class extends u{constructor(e){super({...e,bypassCache:!0})}},K=class extends u{constructor(e){super({...e,bypassCache:!1})}};var k,Y=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(Y,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=Y;k=new WeakMap,c(x,k,"/api/v2/manifest");var q=class extends x{constructor(e){super({...e,bypassCache:!0})}},z=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 B=class extends g{constructor(e){super({...e,bypassCache:!0})}},F=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 W=class extends d{constructor(e){super({...e,bypassCache:!0})}},X=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)}},Z=class extends N{constructor(e){super({...e,bypassCache:!0})}},_=class extends N{constructor(e){super({...e,bypassCache:!1})}};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
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
|
2
|
+
${o}${p?" "+p:""} (${s} ${a}${l?` Request ID: ${l}`:""})`);this.errorMessage=t;this.fetchMethod=s;this.fetchUri=a;this.statusCode=o;this.statusText=p;this.requestId=l;Object.setPrototypeOf(this,C.prototype)}};var n=class{constructor(e){m(this,"options");var s,a,o,p,l,u;if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");let t=e.fetch;if(!t)if(typeof window!="undefined")t=window.fetch.bind(window);else if(typeof fetch!="undefined")t=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...e,fetch:t,apiHost:(s=e.apiHost)!=null?s:"https://uniform.app",apiKey:(a=e.apiKey)!=null?a:null,projectId:(o=e.projectId)!=null?o:null,bearerToken:(p=e.bearerToken)!=null?p:null,limitPolicy:(l=e.limitPolicy)!=null?l:J,bypassCache:(u=e.bypassCache)!=null?u:!1}}async apiClient(e,t){return this.options.limitPolicy(async()=>{var o;let s=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`};this.options.bypassCache&&(s["x-bypass-cache"]="true");let a=await this.options.fetch(e.toString(),{...t,headers:{...t==null?void 0:t.headers,...s}});if(!a.ok){let p="";try{let l=await a.text();try{let u=JSON.parse(l);u.errorMessage?p=Array.isArray(u.errorMessage)?u.errorMessage.join(", "):u.errorMessage:p=l}catch(u){p=l}}catch(l){p="General error"}throw new C(p,(o=t==null?void 0:t.method)!=null?o:"GET",e.toString(),a.status,a.statusText,n.getRequestId(a))}return t!=null&&t.expectNoContent?null:await a.json()})}createUrl(e,t){let s=new URL(`${this.options.apiHost}${e}`);return Object.entries(t!=null?t:{}).forEach(([a,o])=>{var p;typeof o!="undefined"&&o!==null&&s.searchParams.append(a,Array.isArray(o)?o.join(","):(p=o==null?void 0:o.toString())!=null?p:"")}),s}static getRequestId(e){let t=e.headers.get("apigw-requestid");if(t)return t}};var b,U=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(U,b),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(U,b));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(U,b));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},y=U;b=new WeakMap,c(y,b,"/api/v2/aggregate");var $=class extends y{constructor(e){super({...e,bypassCache:!0})}},V=class extends y{constructor(e){super({...e,bypassCache:!1})}};var k="_";function re(r){let e=r.category==="ENR"?"Enrichment":r.category==="SIG"?"Signal":r.subcategory==="1"?"Intent":r.subcategory==="0"?"Audience":"Aggregate";return{dim:r.dim,name:r.name,type:e,category:r.category==="ENR"?r.subcategory:void 0}}function ye(r,e){var t,s,a,o;if((s=(t=e.project.pz)==null?void 0:t.agg)!=null&&s[r])return{dim:r,name:r,type:"Aggregate"};if((o=(a=e.project.pz)==null?void 0:a.sig)!=null&&o[r])return{dim:r,name:r,type:"Signal"};if(r.indexOf(k)>=0){let[p,l]=r.split(k);return{dim:r,name:l,type:"Enrichment",category:p}}}function fe(r){let{type:e,name:t}=re(r);return`${e}: ${t}`}var N,v=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(v,N),{...e,projectId:t});return await this.apiClient(s)}},f=v;N=new WeakMap,c(f,N,"/api/v2/dimension");var M=class extends f{constructor(e){super({...e,bypassCache:!0})}},Q=class extends f{constructor(e){super({...e,bypassCache:!1})}};var O,w,x=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(x,O),{...e,projectId:t});return await this.apiClient(s)}async upsertCategory(e){let t=this.createUrl(i(x,O));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeCategory(e){let t=this.createUrl(i(x,O));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async upsertValue(e){let t=this.createUrl(i(x,w));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async removeValue(e){let t=this.createUrl(i(x,w));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},h=x;O=new WeakMap,w=new WeakMap,c(h,O,"/api/v1/enrichments"),c(h,w,"/api/v1/enrichment-values");var H=class extends h{constructor(e){super({...e,bypassCache:!0})}},K=class extends h{constructor(e){super({...e,bypassCache:!1})}};var S,L=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(L,S),{...e,projectId:t});return await this.apiClient(s)}async publish(){let{projectId:e}=this.options,t=this.createUrl("/api/v1/publish",{siteId:e});await this.apiClient(t,{method:"POST",expectNoContent:!0})}},g=L;S=new WeakMap,c(g,S,"/api/v2/manifest");var q=class extends g{constructor(e){super({...e,bypassCache:!0})}},z=class extends g{constructor(e){super({...e,bypassCache:!1})}};var j,R=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(R,j),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(R,j));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(R,j));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},d=R;j=new WeakMap,c(d,j,"/api/v2/quirk");var Y=class extends d{constructor(e){super({...e,bypassCache:!0})}},B=class extends d{constructor(e){super({...e,bypassCache:!1})}};var E,I=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(I,E),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(I,E));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(I,E));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},P=I;E=new WeakMap,c(P,E,"/api/v2/signal");var F=class extends P{constructor(e){super({...e,bypassCache:!0})}},W=class extends P{constructor(e){super({...e,bypassCache:!1})}};var D,G=class extends n{constructor(e){super(e)}async get(e){let{projectId:t}=this.options,s=this.createUrl(i(G,D),{...e,projectId:t});return await this.apiClient(s)}async upsert(e){let t=this.createUrl(i(G,D));await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let t=this.createUrl(i(G,D));await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},T=G;D=new WeakMap,c(T,D,"/api/v2/test");var A=class{constructor(e){m(this,"enrichments");m(this,"aggregates");m(this,"dimensions");m(this,"manifest");m(this,"quirks");m(this,"signals");m(this,"tests");this.enrichments=new h(e),this.aggregates=new y(e),this.dimensions=new f(e),this.manifest=new g(e),this.quirks=new d(e),this.signals=new P(e),this.tests=new T(e)}},X=class extends A{constructor(e){super({...e,bypassCache:!0})}},Z=class extends A{constructor(e){super({...e,bypassCache:!1})}};export{y as AggregateClient,n as ApiClient,C as ApiClientError,V as CachedAggregateClient,Z as CachedContextClient,Q as CachedDimensionClient,K as CachedEnrichmentClient,z as CachedManifestClient,B as CachedQuirkClient,W as CachedSignalClient,A as ContextClient,f as DimensionClient,h as EnrichmentClient,g as ManifestClient,d as QuirkClient,P as SignalClient,$ as UncachedAggregateClient,X as UncachedContextClient,M as UncachedDimensionClient,H as UncachedEnrichmentClient,q as UncachedManifestClient,Y as UncachedQuirkClient,F as UncachedSignalClient,re as computeDimensionDefinitionDisplayData,ye as computeDimensionDisplayData,fe as computeDimensionDisplayName,J as nullLimitPolicy};
|
package/dist/cli/cli.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { UniformCLIPlugin } from '@uniformdev/cli';
|
2
2
|
import { UniformPackage } from '@uniformdev/cli/sync';
|
3
|
-
import { C as ContextDefinitions } from '../contextTypes-
|
3
|
+
import { C as ContextDefinitions } from '../contextTypes-1907a553.js';
|
4
4
|
import '../v2-manifest.swagger-200ca5ee.js';
|
5
5
|
|
6
6
|
declare type ContextPackage = UniformPackage & ContextDefinitions;
|