@uniformdev/canvas 17.5.1-alpha.130 → 17.5.1-alpha.131
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-VKEQONOQ.mjs → chunk-PVRSC7Y6.mjs} +2 -2
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.mjs +1 -1
- package/dist/{createEventBus-e55b26b0.d.ts → createEventBus-aba716d8.d.ts} +127 -116
- package/dist/index.d.ts +42 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
@@ -1,4 +1,4 @@
|
|
1
|
-
var ae=Object.create;var x=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ue=(t,e,n)=>e in t?x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Oe=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),be=(t,e)=>{for(var n in e)x(t,n,{get:e[n],enumerable:!0})},U=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ce(e))!le.call(t,r)&&r!==n&&x(t,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return t};var de=(t,e,n)=>(n=t!=null?ae(me(t)):{},U(e||!t||!t.__esModule?x(n,"default",{value:t,enumerable:!0}):n,t)),De=t=>U(x({},"__esModule",{value:!0}),t);var Me=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n),j=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var v=(t,e,n)=>(j(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},he=(t,e,n,o)=>(j(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n),Ne=(t,e,n,o)=>({set _(r){he(t,e,r,n)},get _(){return v(t,e,o)}});var F=I((Ge,$)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}$.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var k=I(P=>{var fe=F();P.operation=function(t){var e=P.timeouts(t);return new fe(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};P.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};P.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};P.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=P.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var z=I((Ue,J)=>{J.exports=k()});import{ApiClient as Pe}from"@uniformdev/context/api";var W=de(z(),1),ye=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),w=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Ce=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ge=t=>ye.has(t),H=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function S(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=W.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof w)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ge(i.message))r.stop(),o(i);else{Ce(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?H("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:H(s))},{once:!0})})}var O=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function b({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new O);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function Z({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?b(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>S(i,e)}return s()}}var E=async t=>await t();var D=class extends Pe{constructor(n){n.limitPolicy||(n.limitPolicy=Z({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},Y=class extends D{constructor(e){super({...e,bypassCache:!0})}};import{ApiClient as Ee}from"@uniformdev/context/api";var M="/api/v1/data-source",Te="/api/v1/data-sources",q=class extends Ee{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(M,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(Te,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(M);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(M);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};import{ApiClient as xe}from"@uniformdev/context/api";var T,_=class extends xe{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(v(_,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(v(_,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(v(_,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},N=_;T=new WeakMap,V(N,T,"/api/v1/data-types");var B=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function st({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new B(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var at=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=ve(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function ve(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function A(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function G(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function ct(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function ht({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
|
1
|
+
var ae=Object.create;var _=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ue=(t,e,n)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Se=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Oe=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),De=(t,e)=>{for(var n in e)_(t,n,{get:e[n],enumerable:!0})},U=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ce(e))!le.call(t,r)&&r!==n&&_(t,r,{get:()=>e[r],enumerable:!(o=pe(e,r))||o.enumerable});return t};var de=(t,e,n)=>(n=t!=null?ae(me(t)):{},U(e||!t||!t.__esModule?_(n,"default",{value:t,enumerable:!0}):n,t)),be=t=>U(_({},"__esModule",{value:!0}),t);var Me=(t,e,n)=>(ue(t,typeof e!="symbol"?e+"":e,n),n),j=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var x=(t,e,n)=>(j(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},he=(t,e,n,o)=>(j(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n),Ne=(t,e,n,o)=>({set _(r){he(t,e,r,n)},get _(){return x(t,e,o)}});var F=I((Be,$)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}$.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var k=I(P=>{var fe=F();P.operation=function(t){var e=P.timeouts(t);return new fe(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};P.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};P.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};P.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=P.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var J=I((Ue,H)=>{H.exports=k()});import{ApiClient as Pe}from"@uniformdev/context/api";var W=de(J(),1),ye=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),w=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Ce=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ge=t=>ye.has(t),z=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function S(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=W.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof w)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ge(i.message))r.stop(),o(i);else{Ce(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?z("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:z(s))},{once:!0})})}var O=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function D({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new O);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function Z({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?D(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>S(i,e)}return s()}}var E=async t=>await t();var b=class extends Pe{constructor(n){n.limitPolicy||(n.limitPolicy=Z({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},Y=class extends b{constructor(e){super({...e,bypassCache:!0})}};import{ApiClient as Ee}from"@uniformdev/context/api";var M="/api/v1/data-source",Te="/api/v1/data-sources",q=class extends Ee{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(M,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(Te,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(M);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(M);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};import{ApiClient as _e}from"@uniformdev/context/api";var T,v=class extends _e{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(x(v,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(x(v,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(x(v,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},N=v;T=new WeakMap,V(N,T,"/api/v1/data-types");var G=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function st({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new G(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var at=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=xe(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function xe(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function A(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function B(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function ct(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function ht({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
|
2
2
|
${typeof s.error=="object"&&"stack"in s.error?s.error.stack:s.error}`).join(`
|
3
3
|
|
4
|
-
`))}}){let r=[],s=new Set,i=new Set;A(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(Ae(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(
|
4
|
+
`))}}){let r=[],s=new Set,i=new Set;A(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(Ae(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(ve(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:E)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:E)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function ve(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?E:(i=s.limitPolicy)!=null?i:E)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${B(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function Ae(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?E:(i=r.limitPolicy)!=null?i:E)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${B(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var R=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},Q=class{constructor(){this._componentIndex={};this._rootBuilder=new R}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new R,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var Ct="$personalization",gt="$test",X="$localization",Pt="intentTag",K="locale",Et="pz",Tt="test",ee="localized",_t=0,xt=64,te="$pzCrit",ne="$tstVrnt",vt="$enr",At="is_incontext_editing_mode",Rt="uniform-component-start",It="placeholder",wt=15,St=600,Ot=30,Dt=-1,bt=1,Mt=672,Nt=24;function Re({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[ee];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[K];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function Ut({composition:t,locale:e}){A(t,(n,o,r)=>{if(n.type===X){let s=Re({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var oe=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var re=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var kt=t=>t.type==="select-component"&&t.id!==void 0,Ht=t=>t.type==="ready",Jt=t=>t.type==="update-composition",zt=t=>t.type==="add-component",Wt=t=>t.type==="move-component",Zt=t=>t.type==="dismiss-placeholder",Yt=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:re({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let L=o[y];L.types.includes(h.type)&&L.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var se="https://js.pusher.com/7.0.3/pusher.min.js";async function Ie(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${se}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=se,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function Qt(){let t=await Ie();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function ie(t,e,n){return`${t}.${e}@${n}`}function tn({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=ie(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var on=t=>t.startsWith("$");function an(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[te])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function mn(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[ne])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}import{ApiClientError as we}from"@uniformdev/context/api";var dn=we;export{Se as a,Oe as b,I as c,De as d,de as e,be as f,Me as g,x as h,V as i,he as j,Ne as k,Z as l,E as m,b as n,Y as o,q as p,N as q,G as r,st as s,at as t,A as u,B as v,ct as w,ht as x,R as y,Q as z,Ct as A,gt as B,X as C,Pt as D,K as E,Et as F,Tt as G,ee as H,_t as I,xt as J,te as K,ne as L,vt as M,At as N,Rt as O,It as P,wt as Q,St as R,Ot as S,Dt as T,bt as U,Mt as V,Nt as W,Re as X,Ut as Y,oe as Z,re as _,kt as $,Ht as aa,Jt as ba,zt as ca,Wt as da,Zt as ea,Yt as fa,Qt as ga,ie as ha,tn as ia,on as ja,an as ka,mn as la,we as ma,dn as na};
|
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 { a1 as CanvasDefinitions } from '../createEventBus-
|
3
|
+
import { a1 as CanvasDefinitions } from '../createEventBus-aba716d8.js';
|
4
4
|
import 'pusher-js';
|
5
5
|
|
6
6
|
declare type CanvasPackage = UniformPackage & CanvasDefinitions;
|
package/dist/cli/cli.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import{I as As,J as ni,a as te,b as C2,c as H,d as x2,e as Gp,f as A2,g as di,h as wa,i as Yp,j as $1,k as ri,o as ie,q as Xe}from"../chunk-
|
1
|
+
import{I as As,J as ni,a as te,b as C2,c as H,d as x2,e as Gp,f as A2,g as di,h as wa,i as Yp,j as $1,k as ri,o as ie,q as Xe}from"../chunk-PVRSC7Y6.mjs";var O0=H((N7,E0)=>{var Qa=1e3,Za=Qa*60,Xa=Za*60,Fa=Xa*24,j6=Fa*7,L6=Fa*365.25;E0.exports=function(e,a){a=a||{};var p=typeof e;if(p==="string"&&e.length>0)return M6(e);if(p==="number"&&isFinite(e))return a.long?R6(e):B6(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function M6(e){if(e=String(e),!(e.length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!a){var p=parseFloat(a[1]),t=(a[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return p*L6;case"weeks":case"week":case"w":return p*j6;case"days":case"day":case"d":return p*Fa;case"hours":case"hour":case"hrs":case"hr":case"h":return p*Xa;case"minutes":case"minute":case"mins":case"min":case"m":return p*Za;case"seconds":case"second":case"secs":case"sec":case"s":return p*Qa;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function B6(e){var a=Math.abs(e);return a>=Fa?Math.round(e/Fa)+"d":a>=Xa?Math.round(e/Xa)+"h":a>=Za?Math.round(e/Za)+"m":a>=Qa?Math.round(e/Qa)+"s":e+"ms"}function R6(e){var a=Math.abs(e);return a>=Fa?ct(e,a,Fa,"day"):a>=Xa?ct(e,a,Xa,"hour"):a>=Za?ct(e,a,Za,"minute"):a>=Qa?ct(e,a,Qa,"second"):e+" ms"}function ct(e,a,p,t){var i=a>=p*1.5;return Math.round(e/p)+" "+t+(i?"s":"")}});var ji=H((E7,T0)=>{function U6(e){p.debug=p,p.default=p,p.coerce=o,p.disable=r,p.enable=i,p.enabled=d,p.humanize=O0(),p.destroy=s,Object.keys(e).forEach(l=>{p[l]=e[l]}),p.names=[],p.skips=[],p.formatters={};function a(l){let m=0;for(let c=0;c<l.length;c++)m=(m<<5)-m+l.charCodeAt(c),m|=0;return p.colors[Math.abs(m)%p.colors.length]}p.selectColor=a;function p(l){let m,c=null,u,g;function v(...h){if(!v.enabled)return;let C=v,x=Number(new Date),I=x-(m||x);C.diff=I,C.prev=m,C.curr=x,m=x,h[0]=p.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let V=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(L,T)=>{if(L==="%%")return"%";V++;let Y=p.formatters[T];if(typeof Y=="function"){let ae=h[V];L=Y.call(C,ae),h.splice(V,1),V--}return L}),p.formatArgs.call(C,h),(C.log||p.log).apply(C,h)}return v.namespace=l,v.useColors=p.useColors(),v.color=p.selectColor(l),v.extend=t,v.destroy=p.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(u!==p.namespaces&&(u=p.namespaces,g=p.enabled(l)),g),set:h=>{c=h}}),typeof p.init=="function"&&p.init(v),v}function t(l,m){let c=p(this.namespace+(typeof m=="undefined"?":":m)+l);return c.log=this.log,c}function i(l){p.save(l),p.namespaces=l,p.names=[],p.skips=[];let m,c=(typeof l=="string"?l:"").split(/[\s,]+/),u=c.length;for(m=0;m<u;m++)!c[m]||(l=c[m].replace(/\*/g,".*?"),l[0]==="-"?p.skips.push(new RegExp("^"+l.slice(1)+"$")):p.names.push(new RegExp("^"+l+"$")))}function r(){let l=[...p.names.map(n),...p.skips.map(n).map(m=>"-"+m)].join(",");return p.enable(""),l}function d(l){if(l[l.length-1]==="*")return!0;let m,c;for(m=0,c=p.skips.length;m<c;m++)if(p.skips[m].test(l))return!1;for(m=0,c=p.names.length;m<c;m++)if(p.names[m].test(l))return!0;return!1}function n(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function o(l){return l instanceof Error?l.stack||l.message:l}function s(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return p.enable(p.load()),p}T0.exports=U6});var P0=H((Je,ut)=>{Je.formatArgs=$6;Je.save=q6;Je.load=H6;Je.useColors=k6;Je.storage=z6();Je.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Je.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function k6(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $6(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ut.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;e.splice(1,0,a,"color: inherit");let p=0,t=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(p++,i==="%c"&&(t=p))}),e.splice(t,0,a)}Je.log=console.debug||console.log||(()=>{});function q6(e){try{e?Je.storage.setItem("debug",e):Je.storage.removeItem("debug")}catch(a){}}function H6(){let e;try{e=Je.storage.getItem("debug")}catch(a){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function z6(){try{return localStorage}catch(e){}}ut.exports=ji()(Je);var{formatters:W6}=ut.exports;W6.j=function(e){try{return JSON.stringify(e)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}});var I0=H((O7,F0)=>{"use strict";F0.exports=(e,a=process.argv)=>{let p=e.startsWith("-")?"":e.length===1?"-":"--",t=a.indexOf(p+e),i=a.indexOf("--");return t!==-1&&(i===-1||t<i)}});var L0=H((T7,j0)=>{"use strict";var G6=te("os"),V0=te("tty"),d1=I0(),{env:Ne}=process,J1;d1("no-color")||d1("no-colors")||d1("color=false")||d1("color=never")?J1=0:(d1("color")||d1("colors")||d1("color=true")||d1("color=always"))&&(J1=1);"FORCE_COLOR"in Ne&&(Ne.FORCE_COLOR==="true"?J1=1:Ne.FORCE_COLOR==="false"?J1=0:J1=Ne.FORCE_COLOR.length===0?1:Math.min(parseInt(Ne.FORCE_COLOR,10),3));function Li(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Mi(e,a){if(J1===0)return 0;if(d1("color=16m")||d1("color=full")||d1("color=truecolor"))return 3;if(d1("color=256"))return 2;if(e&&!a&&J1===void 0)return 0;let p=J1||0;if(Ne.TERM==="dumb")return p;if(process.platform==="win32"){let t=G6.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in Ne)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(t=>t in Ne)||Ne.CI_NAME==="codeship"?1:p;if("TEAMCITY_VERSION"in Ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ne.TEAMCITY_VERSION)?1:0;if(Ne.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ne){let t=parseInt((Ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ne.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ne.TERM)||"COLORTERM"in Ne?1:p}function Y6(e){let a=Mi(e,e&&e.isTTY);return Li(a)}j0.exports={supportsColor:Y6,stdout:Li(Mi(!0,V0.isatty(1))),stderr:Li(Mi(!0,V0.isatty(2)))}});var B0=H((Te,ht)=>{var K6=te("tty"),ft=te("util");Te.init=p4;Te.log=X6;Te.formatArgs=Q6;Te.save=e4;Te.load=a4;Te.useColors=J6;Te.destroy=ft.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Te.colors=[6,2,3,4,5,1];try{let e=L0();e&&(e.stderr||e).level>=2&&(Te.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}Te.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,a)=>{let p=a.substring(6).toLowerCase().replace(/_([a-z])/g,(i,r)=>r.toUpperCase()),t=process.env[a];return/^(yes|on|true|enabled)$/i.test(t)?t=!0:/^(no|off|false|disabled)$/i.test(t)?t=!1:t==="null"?t=null:t=Number(t),e[p]=t,e},{});function J6(){return"colors"in Te.inspectOpts?Boolean(Te.inspectOpts.colors):K6.isatty(process.stderr.fd)}function Q6(e){let{namespace:a,useColors:p}=this;if(p){let t=this.color,i="\x1B[3"+(t<8?t:"8;5;"+t),r=` ${i};1m${a} \x1B[0m`;e[0]=r+e[0].split(`
|
2
2
|
`).join(`
|
3
3
|
`+r),e.push(i+"m+"+ht.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Z6()+a+" "+e[0]}function Z6(){return Te.inspectOpts.hideDate?"":new Date().toISOString()+" "}function X6(...e){return process.stderr.write(ft.format(...e)+`
|
4
4
|
`)}function e4(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function a4(){return process.env.DEBUG}function p4(e){e.inspectOpts={};let a=Object.keys(Te.inspectOpts);for(let p=0;p<a.length;p++)e.inspectOpts[a[p]]=Te.inspectOpts[a[p]]}ht.exports=ji()(Te);var{formatters:M0}=ht.exports;M0.o=function(e){return this.inspectOpts.colors=this.useColors,ft.inspect(e,this.inspectOpts).split(`
|
@@ -208,25 +208,16 @@ interface components$2 {
|
|
208
208
|
_slug?: string | null;
|
209
209
|
/** @description Friendly name of this component. */
|
210
210
|
_name: string;
|
211
|
+
/** @description Branch of this component. */
|
212
|
+
_branch: string;
|
211
213
|
_dataResources?: components$2["schemas"]["DataResourceDefinitions"];
|
212
214
|
};
|
213
215
|
/**
|
214
216
|
* @deprecated
|
215
|
-
* @description
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
id: string;
|
220
|
-
/** @description Display name of the data source */
|
221
|
-
displayName: string;
|
222
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
223
|
-
connectorType: string;
|
224
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
225
|
-
baseUrl: string;
|
226
|
-
};
|
227
|
-
/**
|
228
|
-
* @deprecated
|
229
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
217
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
218
|
+
* These are created in the UI and shared across a whole project.
|
219
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
220
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
230
221
|
*/
|
231
222
|
DataSource: {
|
232
223
|
/** @description Public ID of the data source */
|
@@ -278,8 +269,15 @@ interface components$2 {
|
|
278
269
|
allowedOnComponents?: string[];
|
279
270
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
280
271
|
path: string;
|
281
|
-
/** @description Time-to-live for the resource data cache. */
|
272
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
282
273
|
ttl?: number;
|
274
|
+
/** @description Long term data resource cache configuration. */
|
275
|
+
longTermCache?: {
|
276
|
+
/** @description A flag to turn the long term cache on. */
|
277
|
+
enabled: boolean;
|
278
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
279
|
+
ttlInHours?: number;
|
280
|
+
};
|
283
281
|
/** @description A key for the resource data cache purging. */
|
284
282
|
purgeKey?: string;
|
285
283
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -712,25 +710,16 @@ interface external$5 {
|
|
712
710
|
_slug?: string | null;
|
713
711
|
/** @description Friendly name of this component. */
|
714
712
|
_name: string;
|
713
|
+
/** @description Branch of this component. */
|
714
|
+
_branch: string;
|
715
715
|
_dataResources?: external$5["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
716
716
|
};
|
717
717
|
/**
|
718
718
|
* @deprecated
|
719
|
-
* @description
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
id: string;
|
724
|
-
/** @description Display name of the data source */
|
725
|
-
displayName: string;
|
726
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
727
|
-
connectorType: string;
|
728
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
729
|
-
baseUrl: string;
|
730
|
-
};
|
731
|
-
/**
|
732
|
-
* @deprecated
|
733
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
719
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
720
|
+
* These are created in the UI and shared across a whole project.
|
721
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
722
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
734
723
|
*/
|
735
724
|
DataSource: {
|
736
725
|
/** @description Public ID of the data source */
|
@@ -782,8 +771,15 @@ interface external$5 {
|
|
782
771
|
allowedOnComponents?: string[];
|
783
772
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
784
773
|
path: string;
|
785
|
-
/** @description Time-to-live for the resource data cache. */
|
774
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
786
775
|
ttl?: number;
|
776
|
+
/** @description Long term data resource cache configuration. */
|
777
|
+
longTermCache?: {
|
778
|
+
/** @description A flag to turn the long term cache on. */
|
779
|
+
enabled: boolean;
|
780
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
781
|
+
ttlInHours?: number;
|
782
|
+
};
|
787
783
|
/** @description A key for the resource data cache purging. */
|
788
784
|
purgeKey?: string;
|
789
785
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -986,6 +982,10 @@ interface paths$3 {
|
|
986
982
|
* This internal status is subject to change without notice, and is thus marked deprecated to discourage use of internal data.
|
987
983
|
*/
|
988
984
|
withUIStatus?: components$1["parameters"]["withUIStatus"];
|
985
|
+
/** Specify the branch to retrieve the composition from. */
|
986
|
+
branch?: components$1["parameters"]["branch"];
|
987
|
+
/** Disable branch inheritance */
|
988
|
+
disableBranchInheritance?: components$1["parameters"]["disableBranchInheritance"];
|
989
989
|
};
|
990
990
|
};
|
991
991
|
responses: {
|
@@ -1039,6 +1039,8 @@ interface paths$3 {
|
|
1039
1039
|
created?: string;
|
1040
1040
|
/** @description Ignored if present */
|
1041
1041
|
modified?: string;
|
1042
|
+
/** @description Branch to write composition to */
|
1043
|
+
branch?: string;
|
1042
1044
|
};
|
1043
1045
|
};
|
1044
1046
|
};
|
@@ -1194,6 +1196,10 @@ interface components$1 {
|
|
1194
1196
|
* Has no effect when not fetching a list. This does impact performance when enabled.
|
1195
1197
|
*/
|
1196
1198
|
withTotalCount: boolean;
|
1199
|
+
/** @description Specify the branch to retrieve the composition from. */
|
1200
|
+
branch: string;
|
1201
|
+
/** @description Disable branch inheritance */
|
1202
|
+
disableBranchInheritance: boolean;
|
1197
1203
|
};
|
1198
1204
|
}
|
1199
1205
|
interface external$4 {
|
@@ -1449,25 +1455,16 @@ interface external$4 {
|
|
1449
1455
|
_slug?: string | null;
|
1450
1456
|
/** @description Friendly name of this component. */
|
1451
1457
|
_name: string;
|
1458
|
+
/** @description Branch of this component. */
|
1459
|
+
_branch: string;
|
1452
1460
|
_dataResources?: external$4["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
1453
1461
|
};
|
1454
1462
|
/**
|
1455
1463
|
* @deprecated
|
1456
|
-
* @description
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
id: string;
|
1461
|
-
/** @description Display name of the data source */
|
1462
|
-
displayName: string;
|
1463
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
1464
|
-
connectorType: string;
|
1465
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
1466
|
-
baseUrl: string;
|
1467
|
-
};
|
1468
|
-
/**
|
1469
|
-
* @deprecated
|
1470
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
1464
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
1465
|
+
* These are created in the UI and shared across a whole project.
|
1466
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
1467
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
1471
1468
|
*/
|
1472
1469
|
DataSource: {
|
1473
1470
|
/** @description Public ID of the data source */
|
@@ -1519,8 +1516,15 @@ interface external$4 {
|
|
1519
1516
|
allowedOnComponents?: string[];
|
1520
1517
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
1521
1518
|
path: string;
|
1522
|
-
/** @description Time-to-live for the resource data cache. */
|
1519
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
1523
1520
|
ttl?: number;
|
1521
|
+
/** @description Long term data resource cache configuration. */
|
1522
|
+
longTermCache?: {
|
1523
|
+
/** @description A flag to turn the long term cache on. */
|
1524
|
+
enabled: boolean;
|
1525
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
1526
|
+
ttlInHours?: number;
|
1527
|
+
};
|
1524
1528
|
/** @description A key for the resource data cache purging. */
|
1525
1529
|
purgeKey?: string;
|
1526
1530
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -1630,6 +1634,7 @@ interface components {
|
|
1630
1634
|
total: number;
|
1631
1635
|
retryCount: number;
|
1632
1636
|
retryDelay: number;
|
1637
|
+
sourceCache?: string;
|
1633
1638
|
};
|
1634
1639
|
data: unknown;
|
1635
1640
|
};
|
@@ -1969,25 +1974,16 @@ interface external$3 {
|
|
1969
1974
|
_slug?: string | null;
|
1970
1975
|
/** @description Friendly name of this component. */
|
1971
1976
|
_name: string;
|
1977
|
+
/** @description Branch of this component. */
|
1978
|
+
_branch: string;
|
1972
1979
|
_dataResources?: external$3["../../../lambda/functions/uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
1973
1980
|
};
|
1974
1981
|
/**
|
1975
1982
|
* @deprecated
|
1976
|
-
* @description
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
id: string;
|
1981
|
-
/** @description Display name of the data source */
|
1982
|
-
displayName: string;
|
1983
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
1984
|
-
connectorType: string;
|
1985
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
1986
|
-
baseUrl: string;
|
1987
|
-
};
|
1988
|
-
/**
|
1989
|
-
* @deprecated
|
1990
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
1983
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
1984
|
+
* These are created in the UI and shared across a whole project.
|
1985
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
1986
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
1991
1987
|
*/
|
1992
1988
|
DataSource: {
|
1993
1989
|
/** @description Public ID of the data source */
|
@@ -2039,8 +2035,15 @@ interface external$3 {
|
|
2039
2035
|
allowedOnComponents?: string[];
|
2040
2036
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
2041
2037
|
path: string;
|
2042
|
-
/** @description Time-to-live for the resource data cache. */
|
2038
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
2043
2039
|
ttl?: number;
|
2040
|
+
/** @description Long term data resource cache configuration. */
|
2041
|
+
longTermCache?: {
|
2042
|
+
/** @description A flag to turn the long term cache on. */
|
2043
|
+
enabled: boolean;
|
2044
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
2045
|
+
ttlInHours?: number;
|
2046
|
+
};
|
2044
2047
|
/** @description A key for the resource data cache purging. */
|
2045
2048
|
purgeKey?: string;
|
2046
2049
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -2203,6 +2206,10 @@ interface external$3 {
|
|
2203
2206
|
* This internal status is subject to change without notice, and is thus marked deprecated to discourage use of internal data.
|
2204
2207
|
*/
|
2205
2208
|
withUIStatus?: external$3["../../../lambda/functions/v1-canvas.swagger.yml"]["components"]["parameters"]["withUIStatus"];
|
2209
|
+
/** Specify the branch to retrieve the composition from. */
|
2210
|
+
branch?: external$3["../../../lambda/functions/v1-canvas.swagger.yml"]["components"]["parameters"]["branch"];
|
2211
|
+
/** Disable branch inheritance */
|
2212
|
+
disableBranchInheritance?: external$3["../../../lambda/functions/v1-canvas.swagger.yml"]["components"]["parameters"]["disableBranchInheritance"];
|
2206
2213
|
};
|
2207
2214
|
};
|
2208
2215
|
responses: {
|
@@ -2256,6 +2263,8 @@ interface external$3 {
|
|
2256
2263
|
created?: string;
|
2257
2264
|
/** @description Ignored if present */
|
2258
2265
|
modified?: string;
|
2266
|
+
/** @description Branch to write composition to */
|
2267
|
+
branch?: string;
|
2259
2268
|
};
|
2260
2269
|
};
|
2261
2270
|
};
|
@@ -2411,6 +2420,10 @@ interface external$3 {
|
|
2411
2420
|
* Has no effect when not fetching a list. This does impact performance when enabled.
|
2412
2421
|
*/
|
2413
2422
|
withTotalCount: boolean;
|
2423
|
+
/** @description Specify the branch to retrieve the composition from. */
|
2424
|
+
branch: string;
|
2425
|
+
/** @description Disable branch inheritance */
|
2426
|
+
disableBranchInheritance: boolean;
|
2414
2427
|
};
|
2415
2428
|
};
|
2416
2429
|
operations: {};
|
@@ -2880,25 +2893,16 @@ interface external$2 {
|
|
2880
2893
|
_slug?: string | null;
|
2881
2894
|
/** @description Friendly name of this component. */
|
2882
2895
|
_name: string;
|
2896
|
+
/** @description Branch of this component. */
|
2897
|
+
_branch: string;
|
2883
2898
|
_dataResources?: external$2["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
2884
2899
|
};
|
2885
2900
|
/**
|
2886
2901
|
* @deprecated
|
2887
|
-
* @description
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
id: string;
|
2892
|
-
/** @description Display name of the data source */
|
2893
|
-
displayName: string;
|
2894
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
2895
|
-
connectorType: string;
|
2896
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
2897
|
-
baseUrl: string;
|
2898
|
-
};
|
2899
|
-
/**
|
2900
|
-
* @deprecated
|
2901
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
2902
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
2903
|
+
* These are created in the UI and shared across a whole project.
|
2904
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
2905
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
2902
2906
|
*/
|
2903
2907
|
DataSource: {
|
2904
2908
|
/** @description Public ID of the data source */
|
@@ -2950,8 +2954,15 @@ interface external$2 {
|
|
2950
2954
|
allowedOnComponents?: string[];
|
2951
2955
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
2952
2956
|
path: string;
|
2953
|
-
/** @description Time-to-live for the resource data cache. */
|
2957
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
2954
2958
|
ttl?: number;
|
2959
|
+
/** @description Long term data resource cache configuration. */
|
2960
|
+
longTermCache?: {
|
2961
|
+
/** @description A flag to turn the long term cache on. */
|
2962
|
+
enabled: boolean;
|
2963
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
2964
|
+
ttlInHours?: number;
|
2965
|
+
};
|
2955
2966
|
/** @description A key for the resource data cache purging. */
|
2956
2967
|
purgeKey?: string;
|
2957
2968
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -3051,11 +3062,16 @@ interface paths$1 {
|
|
3051
3062
|
};
|
3052
3063
|
};
|
3053
3064
|
responses: {
|
3054
|
-
/**
|
3065
|
+
/**
|
3066
|
+
* Gets a list of data sources.
|
3067
|
+
* Note that all parameters, headers, and variables will have the value 'SECRET', as this endpoint
|
3068
|
+
* requires minimal permissions. To decrypt secrets, you must be an admin or manage-data-sources privileged
|
3069
|
+
* user, and fetch using the `data-source` endpoint for each data source.
|
3070
|
+
*/
|
3055
3071
|
200: {
|
3056
3072
|
content: {
|
3057
3073
|
"application/json": {
|
3058
|
-
results: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["
|
3074
|
+
results: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataSource"][];
|
3059
3075
|
};
|
3060
3076
|
};
|
3061
3077
|
};
|
@@ -3321,25 +3337,16 @@ interface external$1 {
|
|
3321
3337
|
_slug?: string | null;
|
3322
3338
|
/** @description Friendly name of this component. */
|
3323
3339
|
_name: string;
|
3340
|
+
/** @description Branch of this component. */
|
3341
|
+
_branch: string;
|
3324
3342
|
_dataResources?: external$1["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
3325
3343
|
};
|
3326
3344
|
/**
|
3327
3345
|
* @deprecated
|
3328
|
-
* @description
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
id: string;
|
3333
|
-
/** @description Display name of the data source */
|
3334
|
-
displayName: string;
|
3335
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
3336
|
-
connectorType: string;
|
3337
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
3338
|
-
baseUrl: string;
|
3339
|
-
};
|
3340
|
-
/**
|
3341
|
-
* @deprecated
|
3342
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
3346
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
3347
|
+
* These are created in the UI and shared across a whole project.
|
3348
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
3349
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
3343
3350
|
*/
|
3344
3351
|
DataSource: {
|
3345
3352
|
/** @description Public ID of the data source */
|
@@ -3391,8 +3398,15 @@ interface external$1 {
|
|
3391
3398
|
allowedOnComponents?: string[];
|
3392
3399
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
3393
3400
|
path: string;
|
3394
|
-
/** @description Time-to-live for the resource data cache. */
|
3401
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
3395
3402
|
ttl?: number;
|
3403
|
+
/** @description Long term data resource cache configuration. */
|
3404
|
+
longTermCache?: {
|
3405
|
+
/** @description A flag to turn the long term cache on. */
|
3406
|
+
enabled: boolean;
|
3407
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
3408
|
+
ttlInHours?: number;
|
3409
|
+
};
|
3396
3410
|
/** @description A key for the resource data cache purging. */
|
3397
3411
|
purgeKey?: string;
|
3398
3412
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -3802,25 +3816,16 @@ interface external {
|
|
3802
3816
|
_slug?: string | null;
|
3803
3817
|
/** @description Friendly name of this component. */
|
3804
3818
|
_name: string;
|
3819
|
+
/** @description Branch of this component. */
|
3820
|
+
_branch: string;
|
3805
3821
|
_dataResources?: external["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataResourceDefinitions"];
|
3806
3822
|
};
|
3807
3823
|
/**
|
3808
3824
|
* @deprecated
|
3809
|
-
* @description
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
id: string;
|
3814
|
-
/** @description Display name of the data source */
|
3815
|
-
displayName: string;
|
3816
|
-
/** @description The type of data connector this connects to (e.g. 'cms-items', provided by an intalled integration) */
|
3817
|
-
connectorType: string;
|
3818
|
-
/** @description Base resource URL of the data source. No trailing slash. */
|
3819
|
-
baseUrl: string;
|
3820
|
-
};
|
3821
|
-
/**
|
3822
|
-
* @deprecated
|
3823
|
-
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset"). These are created in the UI and shared across a whole project.
|
3825
|
+
* @description An instance of a data source (i.e. "Master environment of the stable space", "Yelp API", "Sanity dev dataset").
|
3826
|
+
* These are created in the UI and shared across a whole project.
|
3827
|
+
* NOTE: if you acquire a list of data sources or do not have manage permissions, you will receive "SECRET"
|
3828
|
+
* for all header, parameter, and variable values to obscure the actual encrypted secret value.
|
3824
3829
|
*/
|
3825
3830
|
DataSource: {
|
3826
3831
|
/** @description Public ID of the data source */
|
@@ -3872,8 +3877,15 @@ interface external {
|
|
3872
3877
|
allowedOnComponents?: string[];
|
3873
3878
|
/** @description Resource path, appended to the data source's baseUrl (e.g. baseUrl = https://base.url, path = /v1/endpoint -> final URL https://base.url/v1/endpoint). Must have leading slash. */
|
3874
3879
|
path: string;
|
3875
|
-
/** @description Time-to-live for the resource data cache. */
|
3880
|
+
/** @description Time-to-live (in seconds) for the primary resource data cache. */
|
3876
3881
|
ttl?: number;
|
3882
|
+
/** @description Long term data resource cache configuration. */
|
3883
|
+
longTermCache?: {
|
3884
|
+
/** @description A flag to turn the long term cache on. */
|
3885
|
+
enabled: boolean;
|
3886
|
+
/** @description Time-to-live (in hours) for the long term resource data cache. */
|
3887
|
+
ttlInHours?: number;
|
3888
|
+
};
|
3877
3889
|
/** @description A key for the resource data cache purging. */
|
3878
3890
|
purgeKey?: string;
|
3879
3891
|
/** @description URL to a custom badge icon for the Uniform dashboard for this data type. If not set falls back to the data connector or integration icons. */
|
@@ -3985,7 +3997,6 @@ declare type DataSourcePutParameters = DataSourceApi['put']['requestBody']['cont
|
|
3985
3997
|
declare type DataSourceDeleteParameters = DataSourceApi['delete']['requestBody']['content']['application/json'];
|
3986
3998
|
declare type DataType = components$2['schemas']['DataType'];
|
3987
3999
|
declare type DataSource = components$2['schemas']['DataSource'];
|
3988
|
-
declare type DataSourceInfo = components$2['schemas']['DataSourceInfo'];
|
3989
4000
|
declare type DataVariableDefinition = components$2['schemas']['DataVariableDefinition'];
|
3990
4001
|
|
3991
4002
|
/**
|
@@ -4013,4 +4024,4 @@ declare global {
|
|
4013
4024
|
*/
|
4014
4025
|
declare function createEventBus(): Promise<PreviewEventBus | undefined>;
|
4015
4026
|
|
4016
|
-
export { DataResourceDefinitions as $, ChannelSubscription as A, createEventBus as B, CompositionGetParameters as C, DataResolutionOptionNegative as D, ComponentDefinitionGetResponse as E, ComponentDefinitionAPIResponse as F, ComponentDefinitionAPIPutRequest as G, ComponentDefinitionAPIDeleteRequest as H, ComponentDefinitionListAPIOptions as I, ComponentDefinitionParameter as J, ComponentDefinitionVariant as K, ComponentDefinitionSlugSettings as L, ComponentDefinitionSlot as M, ComponentDefinitionPermission as N, ComponentDefinition as O, PreviewEventBus as P, CreatingComponentDefinition as Q, RootComponentInstance as R, CompositionGetOrderBy as S, CompositionUIStatus as T, CompositionGetListResponse as U, CompositionAPIResponse as V, CompositionAPIDeleteRequest as W, CompositionListAPIResponse as X, CompositionAPIOptions as Y, DataElementConnectionDefinition as Z, DataResourceVariables as _, CompositionGetByNodePathParameters as a, DataResourceDefinition as a0, CanvasDefinitions as a1, CompositionIssue as a2, CompositionPatternIssue as a3, DataElementBindingIssue as a4, DataResourceIssue as a5, DataResourceVariableIssue as a6, DataResolutionConfigIssue as a7, CompositionDataDiagnostic as a8, DataSourceGetResponse as a9, DataSourcesGetResponse as aa, DataType as ab, DataSource as ac,
|
4027
|
+
export { DataResourceDefinitions as $, ChannelSubscription as A, createEventBus as B, CompositionGetParameters as C, DataResolutionOptionNegative as D, ComponentDefinitionGetResponse as E, ComponentDefinitionAPIResponse as F, ComponentDefinitionAPIPutRequest as G, ComponentDefinitionAPIDeleteRequest as H, ComponentDefinitionListAPIOptions as I, ComponentDefinitionParameter as J, ComponentDefinitionVariant as K, ComponentDefinitionSlugSettings as L, ComponentDefinitionSlot as M, ComponentDefinitionPermission as N, ComponentDefinition as O, PreviewEventBus as P, CreatingComponentDefinition as Q, RootComponentInstance as R, CompositionGetOrderBy as S, CompositionUIStatus as T, CompositionGetListResponse as U, CompositionAPIResponse as V, CompositionAPIDeleteRequest as W, CompositionListAPIResponse as X, CompositionAPIOptions as Y, DataElementConnectionDefinition as Z, DataResourceVariables as _, CompositionGetByNodePathParameters as a, DataResourceDefinition as a0, CanvasDefinitions as a1, CompositionIssue as a2, CompositionPatternIssue as a3, DataElementBindingIssue as a4, DataResourceIssue as a5, DataResourceVariableIssue as a6, DataResolutionConfigIssue as a7, CompositionDataDiagnostic as a8, DataSourceGetResponse as a9, DataSourcesGetResponse as aa, DataType as ab, DataSource as ac, DataVariableDefinition as ad, CompositionGetResponse as b, DataResolutionOptionPositive as c, DataResolutionParameters as d, CompositionResolvedGetResponse as e, CompositionGetValidResponses as f, DataResolutionOption as g, CompositionGetByNodeIdParameters as h, CompositionGetBySlugParameters as i, CompositionGetByIdParameters as j, CompositionPutParameters as k, CompositionDeleteParameters as l, ComponentDefinitionGetParameters as m, ComponentDefinitionPutParameters as n, ComponentDefinitionDeleteParameters as o, ComponentInstance as p, ComponentParameter as q, components as r, DataSourceGetParameters as s, DataSourcesGetParameters as t, DataSourcePutParameters as u, DataSourceDeleteParameters as v, DataTypeGetParameters as w, DataTypeGetResponse as x, DataTypePutParameters as y, DataTypeDeleteParameters as z };
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ApiClient, ClientOptions, ExceptProject, ApiClientError } from '@uniformdev/context/api';
|
2
2
|
export { ApiClientError } from '@uniformdev/context/api';
|
3
|
-
import { C as CompositionGetParameters, a as CompositionGetByNodePathParameters, D as DataResolutionOptionNegative, b as CompositionGetResponse, c as DataResolutionOptionPositive, d as DataResolutionParameters, e as CompositionResolvedGetResponse, f as CompositionGetValidResponses, g as DataResolutionOption, h as CompositionGetByNodeIdParameters, i as CompositionGetBySlugParameters, j as CompositionGetByIdParameters, k as CompositionPutParameters, l as CompositionDeleteParameters, m as ComponentDefinitionGetParameters, n as ComponentDefinitionPutParameters, o as ComponentDefinitionDeleteParameters, p as ComponentInstance, q as ComponentParameter, r as components, s as DataSourceGetParameters, t as DataSourcesGetParameters, u as DataSourcePutParameters, v as DataSourceDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, z as DataTypeDeleteParameters, R as RootComponentInstance, P as PreviewEventBus } from './createEventBus-
|
4
|
-
export { a1 as CanvasDefinitions, A as ChannelSubscription, O as ComponentDefinition, H as ComponentDefinitionAPIDeleteRequest, G as ComponentDefinitionAPIPutRequest, F as ComponentDefinitionAPIResponse, o as ComponentDefinitionDeleteParameters, m as ComponentDefinitionGetParameters, E as ComponentDefinitionGetResponse, I as ComponentDefinitionListAPIOptions, J as ComponentDefinitionParameter, N as ComponentDefinitionPermission, n as ComponentDefinitionPutParameters, M as ComponentDefinitionSlot, L as ComponentDefinitionSlugSettings, K as ComponentDefinitionVariant, p as ComponentInstance, q as ComponentParameter, W as CompositionAPIDeleteRequest, Y as CompositionAPIOptions, V as CompositionAPIResponse, a8 as CompositionDataDiagnostic, l as CompositionDeleteParameters, j as CompositionGetByIdParameters, h as CompositionGetByNodeIdParameters, a as CompositionGetByNodePathParameters, i as CompositionGetBySlugParameters, U as CompositionGetListResponse, S as CompositionGetOrderBy, C as CompositionGetParameters, b as CompositionGetResponse, f as CompositionGetValidResponses, a2 as CompositionIssue, X as CompositionListAPIResponse, a3 as CompositionPatternIssue, k as CompositionPutParameters, e as CompositionResolvedGetResponse, T as CompositionUIStatus, Q as CreatingComponentDefinition, a4 as DataElementBindingIssue, Z as DataElementConnectionDefinition, a7 as DataResolutionConfigIssue, g as DataResolutionOption, D as DataResolutionOptionNegative, c as DataResolutionOptionPositive, d as DataResolutionParameters, a0 as DataResourceDefinition, $ as DataResourceDefinitions, a5 as DataResourceIssue, a6 as DataResourceVariableIssue, _ as DataResourceVariables, ac as DataSource, v as DataSourceDeleteParameters, s as DataSourceGetParameters, a9 as DataSourceGetResponse,
|
3
|
+
import { C as CompositionGetParameters, a as CompositionGetByNodePathParameters, D as DataResolutionOptionNegative, b as CompositionGetResponse, c as DataResolutionOptionPositive, d as DataResolutionParameters, e as CompositionResolvedGetResponse, f as CompositionGetValidResponses, g as DataResolutionOption, h as CompositionGetByNodeIdParameters, i as CompositionGetBySlugParameters, j as CompositionGetByIdParameters, k as CompositionPutParameters, l as CompositionDeleteParameters, m as ComponentDefinitionGetParameters, n as ComponentDefinitionPutParameters, o as ComponentDefinitionDeleteParameters, p as ComponentInstance, q as ComponentParameter, r as components, s as DataSourceGetParameters, t as DataSourcesGetParameters, u as DataSourcePutParameters, v as DataSourceDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, z as DataTypeDeleteParameters, R as RootComponentInstance, P as PreviewEventBus } from './createEventBus-aba716d8.js';
|
4
|
+
export { a1 as CanvasDefinitions, A as ChannelSubscription, O as ComponentDefinition, H as ComponentDefinitionAPIDeleteRequest, G as ComponentDefinitionAPIPutRequest, F as ComponentDefinitionAPIResponse, o as ComponentDefinitionDeleteParameters, m as ComponentDefinitionGetParameters, E as ComponentDefinitionGetResponse, I as ComponentDefinitionListAPIOptions, J as ComponentDefinitionParameter, N as ComponentDefinitionPermission, n as ComponentDefinitionPutParameters, M as ComponentDefinitionSlot, L as ComponentDefinitionSlugSettings, K as ComponentDefinitionVariant, p as ComponentInstance, q as ComponentParameter, W as CompositionAPIDeleteRequest, Y as CompositionAPIOptions, V as CompositionAPIResponse, a8 as CompositionDataDiagnostic, l as CompositionDeleteParameters, j as CompositionGetByIdParameters, h as CompositionGetByNodeIdParameters, a as CompositionGetByNodePathParameters, i as CompositionGetBySlugParameters, U as CompositionGetListResponse, S as CompositionGetOrderBy, C as CompositionGetParameters, b as CompositionGetResponse, f as CompositionGetValidResponses, a2 as CompositionIssue, X as CompositionListAPIResponse, a3 as CompositionPatternIssue, k as CompositionPutParameters, e as CompositionResolvedGetResponse, T as CompositionUIStatus, Q as CreatingComponentDefinition, a4 as DataElementBindingIssue, Z as DataElementConnectionDefinition, a7 as DataResolutionConfigIssue, g as DataResolutionOption, D as DataResolutionOptionNegative, c as DataResolutionOptionPositive, d as DataResolutionParameters, a0 as DataResourceDefinition, $ as DataResourceDefinitions, a5 as DataResourceIssue, a6 as DataResourceVariableIssue, _ as DataResourceVariables, ac as DataSource, v as DataSourceDeleteParameters, s as DataSourceGetParameters, a9 as DataSourceGetResponse, u as DataSourcePutParameters, t as DataSourcesGetParameters, aa as DataSourcesGetResponse, ab as DataType, z as DataTypeDeleteParameters, w as DataTypeGetParameters, x as DataTypeGetResponse, y as DataTypePutParameters, ad as DataVariableDefinition, P as PreviewEventBus, R as RootComponentInstance, B as createEventBus } from './createEventBus-aba716d8.js';
|
5
5
|
import { Options as Options$1 } from 'p-retry';
|
6
6
|
import { Options } from 'p-throttle';
|
7
7
|
import { PersonalizedVariant, TestVariant } from '@uniformdev/context';
|
@@ -77,6 +77,7 @@ declare class CanvasClient extends ApiClient<ClientOptions> {
|
|
77
77
|
_id: string;
|
78
78
|
_slug?: string | null | undefined;
|
79
79
|
_name: string;
|
80
|
+
_branch: string;
|
80
81
|
_dataResources?: {
|
81
82
|
[key: string]: {
|
82
83
|
type: string;
|
@@ -330,6 +331,30 @@ declare class DataSourceClient extends ApiClient {
|
|
330
331
|
displayName: string;
|
331
332
|
connectorType: string;
|
332
333
|
baseUrl: string;
|
334
|
+
headers?: {
|
335
|
+
[key: string]: string;
|
336
|
+
} | {
|
337
|
+
key: string;
|
338
|
+
value: string;
|
339
|
+
}[] | undefined;
|
340
|
+
parameters?: {
|
341
|
+
[key: string]: string;
|
342
|
+
} | {
|
343
|
+
key: string;
|
344
|
+
value: string;
|
345
|
+
}[] | undefined;
|
346
|
+
variables?: {
|
347
|
+
[key: string]: {
|
348
|
+
displayName?: string | undefined;
|
349
|
+
helpText?: string | undefined;
|
350
|
+
type?: string | undefined;
|
351
|
+
default: string;
|
352
|
+
order?: number | undefined;
|
353
|
+
};
|
354
|
+
} | undefined;
|
355
|
+
custom?: {
|
356
|
+
[key: string]: unknown;
|
357
|
+
} | undefined;
|
333
358
|
}[];
|
334
359
|
}>;
|
335
360
|
/** Updates or creates (based on id) a DataSource */
|
@@ -644,6 +669,20 @@ declare const IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode"
|
|
644
669
|
declare const IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
645
670
|
/** The ID we give to placeholder components */
|
646
671
|
declare const PLACEHOLDER_ID = "placeholder";
|
672
|
+
/** Minimal value for Edgehancers Cache TTL (in seconds) */
|
673
|
+
declare const EDGE_MIN_CACHE_TTL = 15;
|
674
|
+
/** Maximal value for Edgehancers Cache TTL (in seconds) */
|
675
|
+
declare const EDGE_MAX_CACHE_TTL = 600;
|
676
|
+
/** Default value for Edgehancers Cache TTL (in seconds) */
|
677
|
+
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
678
|
+
/** A value that indicates that Edgehancers caching is disabled */
|
679
|
+
declare const EDGE_CACHE_DISABLED = -1;
|
680
|
+
/** Minimal value for Edgehancers Long Term Cache TTL (in hours) */
|
681
|
+
declare const EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
|
682
|
+
/** Maximal value for Edgehancers Long Term Cache TTL (in hours) */
|
683
|
+
declare const EDGE_MAX_L2_CACHE_TTL_IN_HOURS: number;
|
684
|
+
/** Default value for Edgehancers Long Term Cache TTL (in hours) */
|
685
|
+
declare const EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
|
647
686
|
|
648
687
|
declare const generateHash: ({ composition, secret, }: {
|
649
688
|
composition: RootComponentInstance;
|
@@ -667,4 +706,4 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
667
706
|
|
668
707
|
declare const CanvasClientError: typeof ApiClientError;
|
669
708
|
|
670
|
-
export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
|
709
|
+
export { AddComponentMessage, BatchEnhancer, BatchEntry, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, Channel, ChannelMessage, ChildEnhancerBuilder, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentLocationReference, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, DataSourceClient, DataTypeClient, DismissPlaceholderMessage, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS, EDGE_MAX_CACHE_TTL, EDGE_MAX_L2_CACHE_TTL_IN_HOURS, EDGE_MIN_CACHE_TTL, EDGE_MIN_L2_CACHE_TTL_IN_HOURS, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, InvalidationInput, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, PLACEHOLDER_ID, ReadyMessage, SelectComponentMessage, SubscribeToCompositionOptions, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateCompositionMessage, WalkComponentTreeActions, compose, createBatchEnhancer, createCanvasChannel, createLimitPolicy, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isSelectComponentMessage, isSystemComponentDefinition, isUpdateCompositionMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, walkComponentTree };
|
package/dist/index.esm.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-
|
1
|
+
import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,ha as Y,ia as Z,ja as _,ka as $,l as a,la as aa,m as b,ma as ba,n as c,na as ca,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-PVRSC7Y6.mjs";export{ba as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,ca as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,I as EDGE_CACHE_DISABLED,H as EDGE_DEFAULT_CACHE_TTL,L as EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,G as EDGE_MAX_CACHE_TTL,K as EDGE_MAX_L2_CACHE_TTL_IN_HOURS,F as EDGE_MIN_CACHE_TTL,J as EDGE_MIN_L2_CACHE_TTL_IN_HOURS,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,O as UniqueBatchEntries,i as compose,h as createBatchEnhancer,W as createCanvasChannel,X as createEventBus,a as createLimitPolicy,m as enhance,M as extractLocales,P as generateHash,Y as getChannelName,l as getComponentJsonPointer,k as getComponentPath,T as isAddComponentMessage,V as isDismissPlaceholderMessage,U as isMovingComponentMessage,R as isReadyMessage,Q as isSelectComponentMessage,_ as isSystemComponentDefinition,S as isUpdateCompositionMessage,N as localize,$ as mapSlotToPersonalizedVariations,aa as mapSlotToTestVariations,b as nullLimitPolicy,Z as subscribeToComposition,j as walkComponentTree};
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var le=Object.create;var A=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ye=(t,e)=>{for(var n in e)A(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of de(e))!fe.call(t,r)&&r!==n&&A(t,r,{get:()=>e[r],enumerable:!(o=ue(e,r))||o.enumerable});return t};var Ce=(t,e,n)=>(n=t!=null?le(he(t)):{},Q(e||!t||!t.__esModule?A(n,"default",{value:t,enumerable:!0}):n,t)),ge=t=>Q(A({},"__esModule",{value:!0}),t);var Pe=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var R=(t,e,n)=>(Pe(t,e,"read from private field"),n?n.call(t):e.get(t)),K=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)};var ee=b((rt,X)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}X.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var te=b(E=>{var Ee=ee();E.operation=function(t){var e=E.timeouts(t);return new Ee(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};E.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};E.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};E.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=E.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var oe=b((it,ne)=>{ne.exports=te()});var nt={};ye(nt,{ApiClientError:()=>Y.ApiClientError,BatchEntry:()=>S,CANVAS_DRAFT_STATE:()=>Dt,CANVAS_ENRICHMENT_TAG_PARAM:()=>Le,CANVAS_INTENT_TAG_PARAM:()=>Ne,CANVAS_LOCALE_TAG_PARAM:()=>F,CANVAS_LOCALIZATION_SLOT:()=>k,CANVAS_LOCALIZATION_TYPE:()=>$,CANVAS_PERSONALIZATION_PARAM:()=>J,CANVAS_PERSONALIZE_SLOT:()=>Be,CANVAS_PERSONALIZE_TYPE:()=>De,CANVAS_PUBLISHED_STATE:()=>Mt,CANVAS_TEST_SLOT:()=>Ge,CANVAS_TEST_TYPE:()=>Me,CANVAS_TEST_VARIANT_PARAM:()=>z,CanvasClient:()=>I,CanvasClientError:()=>tt,ChildEnhancerBuilder:()=>_,DataSourceClient:()=>j,DataTypeClient:()=>w,EnhancerBuilder:()=>V,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE:()=>je,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM:()=>Ue,PLACEHOLDER_ID:()=>Ve,UncachedCanvasClient:()=>L,UniqueBatchEntries:()=>H,compose:()=>Re,createBatchEnhancer:()=>Ae,createCanvasChannel:()=>Ze,createEventBus:()=>qe,createLimitPolicy:()=>G,enhance:()=>Se,extractLocales:()=>ce,generateHash:()=>W,getChannelName:()=>Z,getComponentJsonPointer:()=>we,getComponentPath:()=>O,isAddComponentMessage:()=>ze,isDismissPlaceholderMessage:()=>We,isMovingComponentMessage:()=>He,isReadyMessage:()=>ke,isSelectComponentMessage:()=>Fe,isSystemComponentDefinition:()=>Ke,isUpdateCompositionMessage:()=>Je,localize:()=>$e,mapSlotToPersonalizedVariations:()=>Xe,mapSlotToTestVariations:()=>et,nullLimitPolicy:()=>P,subscribeToComposition:()=>Qe,walkComponentTree:()=>v});module.exports=ge(nt);var ie=require("@uniformdev/context/api");var se=Ce(oe(),1),Te=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),D=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},xe=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},ve=t=>Te.has(t),re=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function M(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=se.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof D)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!ve(i.message))r.stop(),o(i);else{xe(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?re("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:re(s))},{once:!0})})}var N=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function B({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new N);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function G({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?B(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>M(i,e)}return s()}}var P=async t=>await t();var I=class extends ie.ApiClient{constructor(n){n.limitPolicy||(n.limitPolicy=G({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},L=class extends I{constructor(e){super({...e,bypassCache:!0})}};var ae=require("@uniformdev/context/api"),U="/api/v1/data-source",_e="/api/v1/data-sources",j=class extends ae.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(U,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(_e,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(U);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(U);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};var pe=require("@uniformdev/context/api");var T,x=class extends pe.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(R(x,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(R(x,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=x;T=new WeakMap,K(w,T,"/api/v1/data-types");var S=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function Ae({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new S(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var Re=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=Ie(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function Ie(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function v(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function O(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function we(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function Se({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
|
1
|
+
"use strict";var le=Object.create;var A=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ye=(t,e)=>{for(var n in e)A(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of de(e))!fe.call(t,r)&&r!==n&&A(t,r,{get:()=>e[r],enumerable:!(o=ue(e,r))||o.enumerable});return t};var Ce=(t,e,n)=>(n=t!=null?le(he(t)):{},Q(e||!t||!t.__esModule?A(n,"default",{value:t,enumerable:!0}):n,t)),ge=t=>Q(A({},"__esModule",{value:!0}),t);var Pe=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var R=(t,e,n)=>(Pe(t,e,"read from private field"),n?n.call(t):e.get(t)),X=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)};var ee=D((rt,K)=>{function g(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}K.exports=g;g.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};g.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};g.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};g.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};g.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};g.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};g.prototype.start=g.prototype.try;g.prototype.errors=function(){return this._errors};g.prototype.attempts=function(){return this._attempts};g.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,n=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,i=(t[s]||0)+1;t[s]=i,i>=n&&(e=r,n=i)}return e}});var te=D(E=>{var Ee=ee();E.operation=function(t){var e=E.timeouts(t);return new Ee(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};E.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r<e.retries;r++)o.push(this.createTimeout(r,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(r,e)),o.sort(function(s,i){return s-i}),o};E.createTimeout=function(t,e){var n=e.randomize?Math.random()+1:1,o=Math.round(n*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};E.wrap=function(t,e,n){if(e instanceof Array&&(n=e,e=null),!n){n=[];for(var o in t)typeof t[o]=="function"&&n.push(o)}for(var r=0;r<n.length;r++){var s=n[r],i=t[s];t[s]=function(a){var d=E.operation(e),l=Array.prototype.slice.call(arguments,1),c=l.pop();l.push(function(u){d.retry(u)||(u&&(arguments[0]=d.mainError()),c.apply(this,arguments))}),d.attempt(function(){a.apply(t,l)})}.bind(t,i),t[s].options=e}}});var oe=D((it,ne)=>{ne.exports=te()});var nt={};ye(nt,{ApiClientError:()=>Y.ApiClientError,BatchEntry:()=>S,CANVAS_DRAFT_STATE:()=>bt,CANVAS_ENRICHMENT_TAG_PARAM:()=>Le,CANVAS_INTENT_TAG_PARAM:()=>Ne,CANVAS_LOCALE_TAG_PARAM:()=>F,CANVAS_LOCALIZATION_SLOT:()=>k,CANVAS_LOCALIZATION_TYPE:()=>$,CANVAS_PERSONALIZATION_PARAM:()=>H,CANVAS_PERSONALIZE_SLOT:()=>Ge,CANVAS_PERSONALIZE_TYPE:()=>be,CANVAS_PUBLISHED_STATE:()=>Mt,CANVAS_TEST_SLOT:()=>Be,CANVAS_TEST_TYPE:()=>Me,CANVAS_TEST_VARIANT_PARAM:()=>J,CanvasClient:()=>I,CanvasClientError:()=>tt,ChildEnhancerBuilder:()=>v,DataSourceClient:()=>j,DataTypeClient:()=>w,EDGE_CACHE_DISABLED:()=>Lt,EDGE_DEFAULT_CACHE_TTL:()=>Bt,EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS:()=>Vt,EDGE_MAX_CACHE_TTL:()=>Gt,EDGE_MAX_L2_CACHE_TTL_IN_HOURS:()=>jt,EDGE_MIN_CACHE_TTL:()=>Nt,EDGE_MIN_L2_CACHE_TTL_IN_HOURS:()=>Ut,EnhancerBuilder:()=>V,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE:()=>je,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM:()=>Ue,PLACEHOLDER_ID:()=>Ve,UncachedCanvasClient:()=>L,UniqueBatchEntries:()=>z,compose:()=>Re,createBatchEnhancer:()=>Ae,createCanvasChannel:()=>Ze,createEventBus:()=>qe,createLimitPolicy:()=>B,enhance:()=>Se,extractLocales:()=>ce,generateHash:()=>W,getChannelName:()=>Z,getComponentJsonPointer:()=>we,getComponentPath:()=>O,isAddComponentMessage:()=>Je,isDismissPlaceholderMessage:()=>We,isMovingComponentMessage:()=>ze,isReadyMessage:()=>ke,isSelectComponentMessage:()=>Fe,isSystemComponentDefinition:()=>Xe,isUpdateCompositionMessage:()=>He,localize:()=>$e,mapSlotToPersonalizedVariations:()=>Ke,mapSlotToTestVariations:()=>et,nullLimitPolicy:()=>P,subscribeToComposition:()=>Qe,walkComponentTree:()=>x});module.exports=ge(nt);var ie=require("@uniformdev/context/api");var se=Ce(oe(),1),Te=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]),b=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},_e=(t,e,n)=>{let o=n.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},xe=t=>Te.has(t),re=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function M(t,e){return new Promise((n,o)=>{e={onFailedAttempt(){},retries:10,...e};let r=se.default.operation(e);r.attempt(async s=>{try{n(await t(s))}catch(i){if(!(i instanceof Error)){o(new TypeError(`Non-error was thrown: "${i}". You should only throw errors.`));return}if(i instanceof b)r.stop(),o(i.originalError);else if(i instanceof TypeError&&!xe(i.message))r.stop(),o(i);else{_e(i,s,e);try{await e.onFailedAttempt(i)}catch(p){o(p);return}r.retry(i)||o(r.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{r.stop();let s=e.signal.reason===void 0?re("The operation was aborted."):e.signal.reason;o(s instanceof Error?s:re(s))},{once:!0})})}var N=class extends Error{constructor(){super("Throttled function aborted"),this.name="AbortError"}};function G({limit:t,interval:e,strict:n}){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");let o=new Map,r=0,s=0;function i(){let l=Date.now();return l-r>e?(s=1,r=l,0):(s<t?s++:(r+=e,s=1),r-l)}let p=[];function a(){let l=Date.now();if(p.length<t)return p.push(l),0;let c=p.shift()+e;return l>=c?(p.push(l),0):(p.push(c),c-l)}let d=n?a:i;return l=>{let c=function(...u){if(!c.isEnabled)return(async()=>l.apply(this,u))();let f;return new Promise((C,m)=>{f=setTimeout(()=>{C(l.apply(this,u)),o.delete(f)},d()),o.set(f,m)})};return c.abort=()=>{for(let u of o.keys())clearTimeout(u),o.get(u)(new N);o.clear(),p.splice(0,p.length)},c.isEnabled=!0,c}}function B({throttle:t={interval:1e3,limit:10},retry:e={retries:1,factor:1.66}}){let n=t?G(t):null;return function(r){let s=async()=>await r();if(n&&(s=n(s)),e){let i=s;s=()=>M(i,e)}return s()}}var P=async t=>await t();var I=class extends ie.ApiClient{constructor(n){n.limitPolicy||(n.limitPolicy=B({}));super(n);this.canvasUrl="/api/v1/canvas"}async getCompositionList(n){let{projectId:o}=this.options,r=this.createUrl(this.canvasUrl,{...n,projectId:o});return await this.apiClient(r)}unstable_getCompositionByNodePath(n){return this.getOneComposition(n)}unstable_getCompositionByNodeId(n){return this.getOneComposition(n)}getCompositionBySlug(n){return this.getOneComposition(n)}getCompositionById(n){return this.getOneComposition(n)}getOneComposition({unstable_resolveData:n,unstable_dynamicVariables:o,unstable_dataDiagnostics:r,...s}){let{projectId:i}=this.options,p=n?"/api/edge/v1/composition":this.canvasUrl,a={};return n&&(o&&(a.dynamicVariables=JSON.stringify(o)),r&&(a.dataDiagnostics="true")),this.apiClient(this.createUrl(p,{...s,...a,projectId:i}))}async updateComposition(n){let o=this.createUrl("/api/v1/canvas");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComposition(n){let o=this.createUrl("/api/v1/canvas"),{projectId:r}=this.options;await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:r}),expectNoContent:!0})}async getComponentDefinitions(n){let{projectId:o}=this.options,r=this.createUrl("/api/v1/canvas-definitions",{...n,projectId:o});return await this.apiClient(r)}async updateComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"PUT",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}async removeComponentDefinition(n){let o=this.createUrl("/api/v1/canvas-definitions");await this.apiClient(o,{method:"DELETE",body:JSON.stringify({...n,projectId:this.options.projectId}),expectNoContent:!0})}},L=class extends I{constructor(e){super({...e,bypassCache:!0})}};var ae=require("@uniformdev/context/api"),U="/api/v1/data-source",ve="/api/v1/data-sources",j=class extends ae.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(U,{...e,projectId:n});return await this.apiClient(o)}async getList(e){let{projectId:n}=this.options,o=this.createUrl(ve,{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(U);await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(U);await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}};var pe=require("@uniformdev/context/api");var T,_=class extends pe.ApiClient{constructor(e){super(e)}async get(e){let{projectId:n}=this.options,o=this.createUrl(R(_,T),{...e,projectId:n});return await this.apiClient(o)}async upsert(e){let n=this.createUrl(R(_,T));await this.apiClient(n,{method:"PUT",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}async remove(e){let n=this.createUrl(R(_,T));await this.apiClient(n,{method:"DELETE",body:JSON.stringify({...e,projectId:this.options.projectId}),expectNoContent:!0})}},w=_;T=new WeakMap,X(w,T,"/api/v1/data-types");var S=class{constructor(e,n,o){this._resolve=e;this._reject=n;this.args=o;this._isCompleted=!1}resolve(e){this._resolve(e),this._isCompleted=!0}reject(e){this._reject(e),this._isCompleted=!0}get isCompleted(){return this._isCompleted}};function Ae({handleBatch:t,shouldQueue:e,limitPolicy:n}){let o=[];return{enhanceOne:async i=>{if(!e||e(i))return new Promise((p,a)=>{o.push(new S(p,a,i))})},completeAll:async()=>{if(o.length>0){try{await t(o)}catch(p){o.forEach(a=>a.reject(p))}if(o.some(p=>!p.isCompleted))throw new Error("The completeAll() function failed to resolve or reject all promises in the batch!")}let i=o.length;return o=[],i},limitPolicy:n}}var Re=(t,...e)=>({enhanceOne:o=>{let r="enhanceOne"in t?t.enhanceOne(o):t(o);for(let s of e){let i=Ie(r)?r:Promise.resolve(r),p="enhanceOne"in s?s.enhanceOne:s;r=i.then(a=>p({...o,parameter:{type:o.parameter.type,value:a}}))}return r},completeAll:async()=>{var o,r;for(let s of e)if("completeAll"in s)throw new Error("Only the first enhancer in a compose chain can use the completeAll function (batching)");return(r="completeAll"in t?(o=t.completeAll)==null?void 0:o.call(t):0)!=null?r:0}});function Ie(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function x(t,e,n){var s;let o=[{ancestorsAndSelf:[{component:t,parentSlot:void 0,parentSlotIndex:void 0}],context:n}],r=new Map;do{let i=o.pop();if(!i)continue;let p=i.ancestorsAndSelf[0],a=!0,d=(s=r.get(p.component))!=null?s:i.context;e(p.component,i.ancestorsAndSelf,{replaceComponent:c=>{Object.assign(p.component,c),["parameters","variant","slots","data","_pattern","_patternError"].forEach(f=>{c[f]||delete p.component[f]})},removeComponent:()=>{let{parentSlot:c,parentSlotIndex:u}=i.ancestorsAndSelf[0],f=i.ancestorsAndSelf[1];if(c&&typeof u!="undefined")f.component.slots[c].splice(u,1);else throw new Error("Unable to delete composition.")},insertAfter:c=>{let u=Array.isArray(c)?c:[c],{parentSlot:f,parentSlotIndex:C}=i.ancestorsAndSelf[0],m=i.ancestorsAndSelf[1];if(f&&typeof C!="undefined")m.component.slots[f].splice(C+1,0,...u),o.unshift(...u.map(h=>({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return m.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})));else throw new Error("Unable to insert after a component not in a slot.")},stopProcessingDescendants(){a=!1},setDescendantsContext(c){d=c},setChildContext(c,u){r.set(c,u)}},d);let l=p.component.slots;if(a&&l){let c=Object.keys(l);for(let u=c.length-1;u>=0;u--){let f=c[u],C=l[f];for(let m=C.length-1;m>=0;m--){let h=C[m];o.push({ancestorsAndSelf:[{component:h,parentSlot:f,get parentSlotIndex(){return p.component.slots[f].findIndex(y=>y===h)}},...i.ancestorsAndSelf],context:d})}}}}while(o.length>0)}function O(t){let e=[];for(let n=t.length-1;n>=0;n--){let{parentSlot:o,parentSlotIndex:r}=t[n];o&&r!==void 0&&e.push(`${o}[${r}]`)}return`.${e.join(".")}`}function we(t,{withSlots:e=!1}={}){let n=[];for(let o=t.length-1;o>=0;o--){let{parentSlot:r,parentSlotIndex:s}=t[o];r&&s!==void 0&&n.push(`${r}/${s}`)}return e?`/slots/${n.join("/slots/")}`:`/${n.join("/")}`}async function Se({composition:t,enhancers:e,context:n,onErrors:o=r=>{throw new Error(r.map(s=>`${s.message}
|
2
2
|
${typeof s.error=="object"&&"stack"in s.error?s.error.stack:s.error}`).join(`
|
3
3
|
|
4
|
-
`))}}){let r=[],s=new Set,i=new Set;
|
4
|
+
`))}}){let r=[],s=new Set,i=new Set;x(t,(a,d)=>{var c;Object.entries((c=a.parameters)!=null?c:{}).forEach(([u,f])=>{let C=e.resolveParameterEnhancer(a,u,f);C&&(i.add(C),r.push(De(a,d,u,f,C,n)))});let l=e.resolveComponentEnhancers(a);r.push(Oe(a,d,l,n)),s.add(l)}),r.push(...Array.from(s).flatMap(a=>Array.from(a).map(async([,d])=>{var l;try{d.completeAll&&await((l=d.limitPolicy)!=null?l:P)(()=>d.completeAll())}catch(c){return{error:c,message:"Batch component enhancer failed. Individual failed components should receive their own rejections."}}}))),r.push(...Array.from(i).map(async a=>{var d;try{a.completeAll&&await((d=a.limitPolicy)!=null?d:P)(()=>a.completeAll())}catch(l){return{error:l,message:"Batch parameter enhancer failed. Individual failed parameters should receive their own rejections."}}}));let p=(await Promise.all(r)).flatMap(a=>Array.isArray(a)?a:[a]).filter(a=>a);p.length&&o(p)}async function Oe(t,e,n,o){return n.size&&(t.data={}),await Promise.all(Array.from(n).map(async([r,s])=>{var i;try{let a=await(s.completeAll?P:(i=s.limitPolicy)!=null?i:P)(async()=>s.enhanceOne({component:t,context:o}));a!=null&&(t.data[r]=a)}catch(p){let a=`Component ${O(e)} (type: ${t.type}): data.${r} enhancer threw exception. Data key will not be present.`;return delete t.data[r],{message:a,error:p}}}))}async function De(t,e,n,o,r,s){var i;try{let a=await(r.completeAll?P:(i=r.limitPolicy)!=null?i:P)(async()=>r.enhanceOne({parameter:o,parameterName:n,component:t,context:s}));a===null?delete t.parameters[n]:typeof a=="undefined"?t.parameters[n]={...o,value:o.value}:t.parameters[n]={...o,value:a}}catch(p){let a=`Component ${O(e)} (type: ${t.type}): enhancing parameter ${n} (type: ${o.type}) threw exception. Parameter will be removed.`;return delete t.parameters[n],{message:a,error:p}}}var v=class{constructor(){this._paramMatches=Array();this._dataMatches=new Map}parameter(e){return this._paramMatches.push({enhancer:this._resolveParameterEnhancer(e)}),this}parameterName(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({name:r,enhancer:this._resolveParameterEnhancer(n)})),this}parameterType(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>this._paramMatches.push({type:r,enhancer:this._resolveParameterEnhancer(n)})),this}data(e,n){if(this._dataMatches.has(e))throw new Error(`${e} enhancer data key has been used more than once. This will cause data loss.`);return this._dataMatches.set(e,typeof n=="function"?{enhanceOne:n}:n),this}resolveParameterEnhancer(e,n){var o;return(o=this._paramMatches.find(r=>r.name&&r.name===e||r.type&&r.type===n.type||!r.type&&!r.name))==null?void 0:o.enhancer}resolveComponentEnhancers(){return this._dataMatches}_resolveParameterEnhancer(e){return typeof e=="function"?{enhanceOne:e}:e}},V=class{constructor(){this._componentIndex={};this._rootBuilder=new v}parameter(e){return this._rootBuilder.parameter(e),this}parameterName(e,n){return this._rootBuilder.parameterName(e,n),this}parameterType(e,n){return this._rootBuilder.parameterType(e,n),this}data(e,n){return this._rootBuilder.data(e,n),this}component(e,n){return(Array.isArray(e)?e:[e]).forEach(r=>{this._componentIndex[r]=this._componentIndex[r]||new v,n(this._componentIndex[r])}),this}resolveParameterEnhancer(e,n,o){let r=this._componentIndex[e.type];if(r){let s=r.resolveParameterEnhancer(n,o);if(s)return s}return this._rootBuilder.resolveParameterEnhancer(n,o)}resolveComponentEnhancers(e){let n=this._rootBuilder.resolveComponentEnhancers(),o=this._componentIndex[e.type];if(o){n=new Map(n);for(let[r,s]of o.resolveComponentEnhancers())n.set(r,s)}return n}};var be="$personalization",Me="$test",$="$localization",Ne="intentTag",F="locale",Ge="pz",Be="test",k="localized",bt=0,Mt=64,H="$pzCrit",J="$tstVrnt",Le="$enr",Ue="is_incontext_editing_mode",je="uniform-component-start",Ve="placeholder",Nt=15,Gt=600,Bt=30,Lt=-1,Ut=1,jt=672,Vt=24;function ce({component:t}){var o;let e={},n=(o=t.slots)==null?void 0:o[k];return n==null||n.forEach(r=>{var i;let s=(i=r.parameters)==null?void 0:i[F];(s==null?void 0:s.value)&&typeof s.value=="string"&&(e[s.value]=e[s.value]||[],e[s.value].push(r))}),e}function $e({composition:t,locale:e}){x(t,(n,o,r)=>{if(n.type===$){let s=ce({component:n}),i=typeof e=="string"?e:e({component:n,locales:s}),p;if(i&&(p=s[i]),p!=null&&p.length){let[a,...d]=p;r.replaceComponent(a),d.length&&r.insertAfter(d)}else r.removeComponent()}})}var z=class{constructor(e,n){this.groups=e.reduce((o,r)=>{var i;let s=n(r.args);return o[s]=(i=o[s])!=null?i:[],o[s].push(r),o},{})}resolveKey(e,n){this.groups[e].forEach(o=>o.resolve(n))}resolveRemaining(e){Object.keys(this.groups).forEach(n=>{this.groups[n].forEach(o=>{o.isCompleted||o.resolve(e)})})}};var W=({composition:t,secret:e})=>{if(!e)return;let n=`${JSON.stringify(t)}-${e}`,o=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);o=(o<<5)-o+s,o|=0}return o};var Fe=t=>t.type==="select-component"&&t.id!==void 0,ke=t=>t.type==="ready",He=t=>t.type==="update-composition",Je=t=>t.type==="add-component",ze=t=>t.type==="move-component",We=t=>t.type==="dismiss-placeholder",Ze=({listenTo:t,broadcastTo:e})=>{let n=0,o={},r=[...e],s=m=>{r.forEach(h=>h.postMessage(JSON.stringify(m),"*"))},i=m=>{s({type:"select-component",id:m})},p=()=>{s({type:"ready"})},a=(m,h)=>{let y=++n;return o[y]={types:Array.isArray(m)?m:[m],handler:h},()=>{delete o[y]}},d=(m,h)=>{let y={type:"update-composition",composition:m,hash:W({composition:m,secret:h})};s(y)},l=m=>{let h={...m,type:"add-component"};s(h)},c=m=>{let h={...m,type:"move-component"};s(h)},u=m=>{let h={...m,type:"dismiss-placeholder"};s(h)},f=m=>{if(typeof m.data!="string"||m.source===window)return;let h=null;try{let y=JSON.parse(m.data);Object.hasOwn(y,"type")&&(h=y)}catch(y){}if(!!h)for(let y in o){let q=o[y];q.types.includes(h.type)&&q.handler(h,m)}};return t.forEach(m=>m.addEventListener("message",f)),{ready:p,destroy:()=>{t.forEach(m=>m.removeEventListener("message",f))},selectComponent:i,updateComposition:d,on:a,addComponent:l,moveComponent:c,dismissPlaceholder:u}};var me="https://js.pusher.com/7.0.3/pusher.min.js";async function Ye(){if(!(typeof document=="undefined"||typeof window=="undefined"))return window.Pusher?window.Pusher:new Promise((t,e)=>{let n=setTimeout(()=>{window.Pusher&&t(window.Pusher),e(`Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${me}"><\/script> manually.`)},5e3),o=document.createElement("script");o.src=me,o.addEventListener("load",()=>{clearTimeout(n),t(window.Pusher)}),document.head.appendChild(o)})}async function qe(){let t=await Ye();if(!t)return;let e=window.__UNIFORM_EVENT_BUS__;if(!e){let n=new t("7b5f5abd160fea549ffe",{cluster:"mt1"});n.connect(),console.log("[canvas] \u{1F525} preview connected"),e=window.__UNIFORM_EVENT_BUS__={subscribe:o=>{let r=n.subscribe(o);return{unsubscribe:()=>n.unsubscribe(o),addEventHandler:(s,i)=>(r.bind(s,i),()=>r.unbind(s,i))}}}}return e}function Z(t,e,n){return`${t}.${e}@${n}`}function Qe({projectId:t,compositionId:e,compositionState:n=0,eventBus:{subscribe:o},callback:r,event:s="updated"}){let i=Z(t,e,n),p=o(i),a=p.addEventHandler(s,r);return()=>{a(),p.unsubscribe()}}var Xe=t=>t.startsWith("$");function Ke(t){return t?t.map((e,n)=>{var s,i;let o=(i=(s=e.parameters)==null?void 0:s[H])==null?void 0:i.value,r=(o==null?void 0:o.name)||`pz-${n}-${e.type}`;return{...e,id:r,pz:o}}):[]}function et(t){return t?t.map((e,n)=>{var s,i,p;let o=(i=(s=e.parameters)==null?void 0:s[J])==null?void 0:i.value,r=(p=o==null?void 0:o.id)!=null?p:"testId"in e?e.testId:`ab-${n}-${e.type}`;return{...e,id:r}}):[]}var Y=require("@uniformdev/context/api"),tt=Y.ApiClientError;0&&(module.exports={ApiClientError,BatchEntry,CANVAS_DRAFT_STATE,CANVAS_ENRICHMENT_TAG_PARAM,CANVAS_INTENT_TAG_PARAM,CANVAS_LOCALE_TAG_PARAM,CANVAS_LOCALIZATION_SLOT,CANVAS_LOCALIZATION_TYPE,CANVAS_PERSONALIZATION_PARAM,CANVAS_PERSONALIZE_SLOT,CANVAS_PERSONALIZE_TYPE,CANVAS_PUBLISHED_STATE,CANVAS_TEST_SLOT,CANVAS_TEST_TYPE,CANVAS_TEST_VARIANT_PARAM,CanvasClient,CanvasClientError,ChildEnhancerBuilder,DataSourceClient,DataTypeClient,EDGE_CACHE_DISABLED,EDGE_DEFAULT_CACHE_TTL,EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,EDGE_MAX_CACHE_TTL,EDGE_MAX_L2_CACHE_TTL_IN_HOURS,EDGE_MIN_CACHE_TTL,EDGE_MIN_L2_CACHE_TTL_IN_HOURS,EnhancerBuilder,IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,PLACEHOLDER_ID,UncachedCanvasClient,UniqueBatchEntries,compose,createBatchEnhancer,createCanvasChannel,createEventBus,createLimitPolicy,enhance,extractLocales,generateHash,getChannelName,getComponentJsonPointer,getComponentPath,isAddComponentMessage,isDismissPlaceholderMessage,isMovingComponentMessage,isReadyMessage,isSelectComponentMessage,isSystemComponentDefinition,isUpdateCompositionMessage,localize,mapSlotToPersonalizedVariations,mapSlotToTestVariations,nullLimitPolicy,subscribeToComposition,walkComponentTree});
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,l as a,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-
|
1
|
+
import{$ as Q,A as p,B as q,C as r,D as s,E as t,F as u,G as v,H as w,I as x,J as y,K as z,L as A,M as B,N as C,O as D,P as E,Q as F,R as G,S as H,T as I,U as J,V as K,W as L,X as M,Y as N,Z as O,_ as P,aa as R,ba as S,ca as T,da as U,ea as V,fa as W,ga as X,ha as Y,ia as Z,ja as _,ka as $,l as a,la as aa,m as b,ma as ba,n as c,na as ca,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-PVRSC7Y6.mjs";export{ba as ApiClientError,g as BatchEntry,x as CANVAS_DRAFT_STATE,B as CANVAS_ENRICHMENT_TAG_PARAM,s as CANVAS_INTENT_TAG_PARAM,t as CANVAS_LOCALE_TAG_PARAM,w as CANVAS_LOCALIZATION_SLOT,r as CANVAS_LOCALIZATION_TYPE,z as CANVAS_PERSONALIZATION_PARAM,u as CANVAS_PERSONALIZE_SLOT,p as CANVAS_PERSONALIZE_TYPE,y as CANVAS_PUBLISHED_STATE,v as CANVAS_TEST_SLOT,q as CANVAS_TEST_TYPE,A as CANVAS_TEST_VARIANT_PARAM,c as CanvasClient,ca as CanvasClientError,n as ChildEnhancerBuilder,e as DataSourceClient,f as DataTypeClient,I as EDGE_CACHE_DISABLED,H as EDGE_DEFAULT_CACHE_TTL,L as EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,G as EDGE_MAX_CACHE_TTL,K as EDGE_MAX_L2_CACHE_TTL_IN_HOURS,F as EDGE_MIN_CACHE_TTL,J as EDGE_MIN_L2_CACHE_TTL_IN_HOURS,o as EnhancerBuilder,D as IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,C as IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,E as PLACEHOLDER_ID,d as UncachedCanvasClient,O as UniqueBatchEntries,i as compose,h as createBatchEnhancer,W as createCanvasChannel,X as createEventBus,a as createLimitPolicy,m as enhance,M as extractLocales,P as generateHash,Y as getChannelName,l as getComponentJsonPointer,k as getComponentPath,T as isAddComponentMessage,V as isDismissPlaceholderMessage,U as isMovingComponentMessage,R as isReadyMessage,Q as isSelectComponentMessage,_ as isSystemComponentDefinition,S as isUpdateCompositionMessage,N as localize,$ as mapSlotToPersonalizedVariations,aa as mapSlotToTestVariations,b as nullLimitPolicy,Z as subscribeToComposition,j as walkComponentTree};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "17.5.1-alpha.
|
3
|
+
"version": "17.5.1-alpha.131+1a06e230b",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -48,8 +48,8 @@
|
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@types/retry": "0.12.1",
|
51
|
-
"@types/yargs": "17.0.
|
52
|
-
"@uniformdev/cli": "^17.5.1-alpha.
|
51
|
+
"@types/yargs": "17.0.15",
|
52
|
+
"@uniformdev/cli": "^17.5.1-alpha.131+1a06e230b",
|
53
53
|
"p-limit": "4.0.0",
|
54
54
|
"p-retry": "5.1.1",
|
55
55
|
"p-throttle": "5.0.0",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"yargs": "17.6.2"
|
58
58
|
},
|
59
59
|
"dependencies": {
|
60
|
-
"@uniformdev/context": "^17.5.1-alpha.
|
60
|
+
"@uniformdev/context": "^17.5.1-alpha.131+1a06e230b"
|
61
61
|
},
|
62
62
|
"files": [
|
63
63
|
"/dist"
|
@@ -65,5 +65,5 @@
|
|
65
65
|
"publishConfig": {
|
66
66
|
"access": "public"
|
67
67
|
},
|
68
|
-
"gitHead": "
|
68
|
+
"gitHead": "1a06e230be7112298a5d5bf6d93bd66c9cbc39f6"
|
69
69
|
}
|