@uniformdev/canvas 16.2.1 → 16.2.4
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/chunk-ADDR7SB6.mjs +2 -0
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.js +38 -38
- package/dist/cli/cli.mjs +36 -36
- package/dist/{createEventBus-f5cdcc4e.d.ts → createEventBus-a6696d11.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +1 -1
- package/package.json +8 -7
- package/CHANGELOG.md +0 -151
- package/dist/chunk-4MW5D2TW.mjs +0 -2
- package/dist/chunk-ELYMSEKS.mjs +0 -2
- package/dist/chunk-HJHWEOMG.mjs +0 -2
- package/dist/chunk-REQRKU67.mjs +0 -2
- package/dist/chunk-TCXTKDSU.mjs +0 -2
@@ -0,0 +1,2 @@
|
|
1
|
+
var h=Object.create;var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var R=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+i+'" is not supported')});var T=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var C=(i,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!I.call(i,n)&&n!==e&&u(i,n,{get:()=>t[n],enumerable:!(o=m(t,n))||o.enumerable});return i};var O=(i,t,e)=>(e=i!=null?h(d(i)):{},C(t||!i||!i.__esModule?u(e,"default",{value:i,enumerable:!0}):e,i));import y from"p-throttle";import P from"p-retry";function A({throttle:i={interval:1e3,limit:10},retry:t={retries:1,factor:1.66}}){let e=i?y(i):null;return function(n){let s=async()=>await n();if(e&&(s=e(s)),t){let r=s;s=()=>P(r,t)}return s()}}var E=async i=>await i();var a=class extends Error{constructor(e,o,n,s,r,p){super(`${e}
|
2
|
+
${s}${r?" "+r:""} (${o} ${n}${p?` Request ID: ${p}`:""})`);this.errorMessage=e;this.fetchMethod=o;this.fetchUri=n;this.statusCode=s;this.statusText=r;this.requestId=p;Object.setPrototypeOf(this,a.prototype)}},l=class{constructor(t){var o,n,s,r,p;if(!t.apiKey&&!t.bearerToken)throw new Error("You must provide an API key or a bearer token");let e=t.fetch;if(!e)if(typeof window!="undefined")e=window.fetch.bind(window);else if(typeof fetch!="undefined")e=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...t,fetch:e,apiHost:(o=t.apiHost)!=null?o:"https://uniform.app",apiKey:(n=t.apiKey)!=null?n:null,projectId:(s=t.projectId)!=null?s:null,bearerToken:(r=t.bearerToken)!=null?r:null,limitPolicy:(p=t.limitPolicy)!=null?p:A({})}}async getCompositionList(t){let{projectId:e}=this.options,o=this.createUrl("/api/v1/canvas",{...t,projectId:e});return await this.apiClient(o)}async getCompositionBySlug(t){let{projectId:e}=this.options,o=this.createUrl("/api/v1/canvas",{...t,projectId:e});return await this.apiClient(o)}async getCompositionById(t){let{projectId:e}=this.options,o=this.createUrl("/api/v1/canvas",{...t,projectId:e});return await this.apiClient(o)}async updateComposition(t){let e=this.createUrl("/api/v1/canvas");await this.apiClient(e,{method:"PUT",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(t){let e=this.createUrl("/api/v1/canvas");await this.apiClient(e,{method:"DELETE",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async getComponentDefinitions(t){let{projectId:e}=this.options,o=this.createUrl("/api/v1/canvas-definitions",{...t,projectId:e});return await this.apiClient(o)}async updateComponentDefinition(t){let e=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(e,{method:"PUT",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(t){let e=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(e,{method:"DELETE",body:JSON.stringify({...t,projectId:this.options.projectId}),expectNoContent:!0})}async apiClient(t,e){return this.options.limitPolicy(async()=>{var s;let o=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`},n=await this.options.fetch(t.toString(),{...e,headers:{...e==null?void 0:e.headers,...o}});if(!n.ok){let r="";try{let p=await n.text();try{let c=JSON.parse(p);c.errorMessage?r=Array.isArray(c.errorMessage)?c.errorMessage.join(", "):c.errorMessage:r=p}catch(c){r=p}}catch(p){r="General error"}throw new a(r,(s=e==null?void 0:e.method)!=null?s:"GET",t.toString(),n.status,n.statusText,l.getRequestId(n))}return e!=null&&e.expectNoContent?null:await n.json()})}createUrl(t,e){let o=new URL(`${this.options.apiHost}${t}`);return Object.entries(e!=null?e:{}).forEach(([n,s])=>{var r;typeof s!==void 0&&s!==null&&o.searchParams.append(n,(r=s==null?void 0:s.toString())!=null?r:"")}),o}static getRequestId(t){let e=t.headers.get("x-nf-request-id");if(e)return e}};var U="$personalization",V="$test",D="$localization",v="intentTag",k="locale",$="pz",M="test",q="localized",H=0,z=64,F="$pzCrit",K="$tstVrnt",G="$enr";export{R as a,T as b,O as c,A as d,E as e,a as f,l as g,U as h,V as i,D as j,v as k,k as l,$ as m,M as n,q as o,H as p,z as q,F as r,K as s,G as t};
|
package/dist/cli/cli.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { UniformCLIPlugin } from '@uniformdev/cli';
|
2
|
-
import { o as ComponentDefinition, d as CompositionAPIResponse } from '../createEventBus-
|
2
|
+
import { o as ComponentDefinition, d as CompositionAPIResponse } from '../createEventBus-a6696d11.js';
|
3
3
|
import { UniformPackage } from '@uniformdev/cli/sync';
|
4
4
|
import 'pusher-js';
|
5
5
|
|