@uniformdev/canvas
Advanced tools
Comparing version 12.0.0 to 12.0.1-alpha.41
@@ -35,5 +35,5 @@ import { LimitPolicy } from './enhancement/createLimitPolicy'; | ||
/** Fetches a Canvas composition by string name (slug) */ | ||
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>; | ||
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>; | ||
/** Fetches a Canvas composition by its public UUID */ | ||
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>; | ||
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>; | ||
/** Updates or creates a Canvas component definition */ | ||
@@ -40,0 +40,0 @@ updateComposition(body: Omit<CompositionAPIPutRequest, 'projectId'>): Promise<void>; |
@@ -5,4 +5,5 @@ import { CommandModule } from 'yargs'; | ||
id: string; | ||
resolvePatterns?: boolean; | ||
} & ApiArgs & FormatArgs & StateArgs & ProjectArgs; | ||
export declare const CompositionGetModule: CommandModule<GetCompositionArgs, GetCompositionArgs>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,o)}r((l=l.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(i,n){var o,r,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,r=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){u.label=e[1];break}if(6===e[0]&&u.label<a[1]){u.label=a[1],a=e;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(e);break}a[2]&&u.ops.pop(),u.trys.pop();continue}e=n.call(i,u)}catch(t){e=[6,t],r=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CompositionGetModule=void 0;var CanvasClient_1=require("../../../CanvasClient"),util_1=require("../../util"),isomorphic_unfetch_1=__importDefault(require("isomorphic-unfetch"));exports.CompositionGetModule={command:"get <id>",describe:"Fetch a composition",builder:function(t){return(0,util_1.withFormatOptions)((0,util_1.withApiOptions)((0,util_1.withProjectOptions)((0,util_1.withStateOptions)(t.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"})))))},handler:function(t){var n=t.apiHost,o=t.apiKey,r=t.id,a=t.format,u=t.filename,l=t.state,s=t.project;return __awaiter(void 0,void 0,void 0,function(){var e,i;return __generator(this,function(t){switch(t.label){case 0:return e=new CanvasClient_1.CanvasClient({apiKey:o,apiHost:n,fetch:isomorphic_unfetch_1.default,projectId:s}),i=util_1.prepCompositionForDisk,[4,e.getCompositionById({compositionId:r,state:(0,util_1.convertCompositionState)(l)})];case 1:return e=i.apply(void 0,[t.sent()]),(0,util_1.emitWithFormat)(e,a,u),[2]}})})}}; | ||
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,u,s){return new(u=u||Promise)(function(i,e){function o(t){try{r(s.next(t))}catch(t){e(t)}}function n(t){try{r(s.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(o,n)}r((s=s.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(i,o){var n,r,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,r=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){u.label=e[1];break}if(6===e[0]&&u.label<a[1]){u.label=a[1],a=e;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(e);break}a[2]&&u.ops.pop(),u.trys.pop();continue}e=o.call(i,u)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CompositionGetModule=void 0;var CanvasClient_1=require("../../../CanvasClient"),util_1=require("../../util"),isomorphic_unfetch_1=__importDefault(require("isomorphic-unfetch"));exports.CompositionGetModule={command:"get <id>",describe:"Fetch a composition",builder:function(t){return(0,util_1.withFormatOptions)((0,util_1.withApiOptions)((0,util_1.withProjectOptions)((0,util_1.withStateOptions)(t.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"}).option({resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}})))))},handler:function(t){var o=t.apiHost,n=t.apiKey,r=t.id,a=t.format,u=t.filename,s=t.state,l=t.project,c=t.resolvePatterns;return __awaiter(void 0,void 0,void 0,function(){var e,i;return __generator(this,function(t){switch(t.label){case 0:return e=new CanvasClient_1.CanvasClient({apiKey:n,apiHost:o,fetch:isomorphic_unfetch_1.default,projectId:l}),i=util_1.prepCompositionForDisk,[4,e.getCompositionById({compositionId:r,state:(0,util_1.convertCompositionState)(s),skipPatternResolution:!c})];case 1:return e=i.apply(void 0,[t.sent()]),(0,util_1.emitWithFormat)(e,a,u),[2]}})})}}; |
import { CommandModule } from 'yargs'; | ||
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util'; | ||
import { CompositionAPIOptions } from '../../../types/componentInstances'; | ||
declare type ListCompositionArgs = Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs; | ||
declare type ListCompositionArgs = { | ||
resolvePatterns?: boolean; | ||
} & Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs; | ||
export declare const CompositionListModule: CommandModule<ListCompositionArgs, ListCompositionArgs>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,u,s){return new(u=u||Promise)(function(i,e){function o(t){try{r(s.next(t))}catch(t){e(t)}}function n(t){try{r(s.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(o,n)}r((s=s.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(i,o){var n,r,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,r=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){u.label=e[1];break}if(6===e[0]&&u.label<a[1]){u.label=a[1],a=e;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(e);break}a[2]&&u.ops.pop(),u.trys.pop();continue}e=o.call(i,u)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CompositionListModule=void 0;var CanvasClient_1=require("../../../CanvasClient"),util_1=require("../../util"),isomorphic_unfetch_1=__importDefault(require("isomorphic-unfetch"));exports.CompositionListModule={command:"list",describe:"List compositions",aliases:["ls"],builder:function(t){return(0,util_1.withFormatOptions)((0,util_1.withApiOptions)((0,util_1.withProjectOptions)((0,util_1.withStateOptions)(t.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20}})))))},handler:function(t){var i=t.apiHost,o=t.apiKey,n=t.limit,r=t.offset,a=t.format,u=t.filename,s=t.project,l=t.state;return __awaiter(void 0,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,new CanvasClient_1.CanvasClient({apiKey:o,apiHost:i,fetch:isomorphic_unfetch_1.default,projectId:s}).getCompositionList({limit:n,offset:r,state:(0,util_1.convertCompositionState)(l)})];case 1:return e=t.sent(),(0,util_1.emitWithFormat)(e.compositions,a,u),[2]}})})}}; | ||
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,s,u){return new(s=s||Promise)(function(i,e){function o(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?i(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(o,n)}r((u=u.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(i,o){var n,r,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,r=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=o.call(i,s)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CompositionListModule=void 0;var CanvasClient_1=require("../../../CanvasClient"),util_1=require("../../util"),isomorphic_unfetch_1=__importDefault(require("isomorphic-unfetch"));exports.CompositionListModule={command:"list",describe:"List compositions",aliases:["ls"],builder:function(t){return(0,util_1.withFormatOptions)((0,util_1.withApiOptions)((0,util_1.withProjectOptions)((0,util_1.withStateOptions)(t.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20},resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}})))))},handler:function(t){var i=t.apiHost,o=t.apiKey,n=t.limit,r=t.offset,a=t.format,s=t.filename,u=t.project,l=t.state,c=t.resolvePatterns;return __awaiter(void 0,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,new CanvasClient_1.CanvasClient({apiKey:o,apiHost:i,fetch:isomorphic_unfetch_1.default,projectId:u}).getCompositionList({limit:n,offset:r,state:(0,util_1.convertCompositionState)(l),skipPatternResolution:!c})];case 1:return e=t.sent(),(0,util_1.emitWithFormat)(e.compositions,a,s),[2]}})})}}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,i,s,c){return new(s=s||Promise)(function(n,e){function r(t){try{a(c.next(t))}catch(t){e(t)}}function o(t){try{a(c.throw(t))}catch(t){e(t)}}function a(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,o)}a((c=c.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(n,r){var o,a,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(i=2&e[0]?a.return:e[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,e[1])).done)return i;switch(a=0,(e=i?[2&e[0],i.value]:e)[0]){case 0:case 1:i=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,a=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(i=0<(i=s.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){s.label=e[1];break}if(6===e[0]&&s.label<i[1]){s.label=i[1],i=e;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(e);break}i[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],a=0}finally{o=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__asyncValues=this&&this.__asyncValues||function(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=i[Symbol.asyncIterator];return e?e.call(i):(i="function"==typeof __values?__values(i):i[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=i[a]&&function(o){return new Promise(function(t,e){var n,r;o=i[a](o),n=t,t=e,r=o.done,e=o.value,Promise.resolve(e).then(function(t){n({value:t,done:r})},t)})}}},__await=this&&this.__await||function(t){return this instanceof __await?(this.v=t,this):new __await(t)},__asyncGenerator=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=n.apply(t,e||[]),a=[],i={};return r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i;function r(r){o[r]&&(i[r]=function(n){return new Promise(function(t,e){1<a.push([r,n,t,e])||s(r,n)})})}function s(t,e){try{(n=o[t](e)).value instanceof __await?Promise.resolve(n.value.v).then(c,u):l(a[0][2],n)}catch(t){l(a[0][3],t)}var n}function c(t){s("next",t)}function u(t){s("throw",t)}function l(t,e){t(e),a.shift(),a.length&&s(a[0][0],a[0][1])}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createComponentInstanceEngineDataSource=void 0;var util_1=require("./util"),_util_1=require("./commands/composition/_util");function createComponentInstanceEngineDataSource(t){var n=this,c=t.client,t=t.state,u=(0,util_1.convertCompositionState)(t);return{objects:function(){return __asyncGenerator(this,arguments,function(){var e,n,r,o,a,i,s=this;return __generator(this,function(t){switch(t.label){case 0:e=(0,util_1.paginateAsync)(function(e,n){return __awaiter(s,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.getCompositionList({limit:n,offset:e,state:u})];case 1:return[2,t.sent().compositions]}})})},{pageSize:100}),t.label=1;case 1:t.trys.push([1,8,9,14]),n=__asyncValues(e),t.label=2;case 2:return[4,__await(n.next())];case 3:return(r=t.sent()).done?[3,7]:(o=r.value,o={id:(0,_util_1.selectIdentifier)(o),displayName:(0,_util_1.selectDisplayName)(o),providerId:o.composition._id,object:(0,util_1.prepCompositionForDisk)(o)},[4,__await(o)]);case 4:return[4,t.sent()];case 5:t.sent(),t.label=6;case 6:return[3,2];case 7:return[3,14];case 8:return a=t.sent(),a={error:a},[3,14];case 9:return t.trys.push([9,,12,13]),r&&!r.done&&(i=n.return)?[4,__await(i.call(n))]:[3,11];case 10:t.sent(),t.label=11;case 11:return[3,13];case 12:if(a)throw a.error;return[7];case 13:return[7];case 14:return[2]}})})}(),deleteObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.removeComposition({compositionId:e})];case 1:return t.sent(),[2]}})})},writeObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.updateComposition(__assign(__assign({},e.object),{state:u}))];case 1:return t.sent(),[2]}})})}}}exports.createComponentInstanceEngineDataSource=createComponentInstanceEngineDataSource; | ||
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,i,s,c){return new(s=s||Promise)(function(n,e){function r(t){try{a(c.next(t))}catch(t){e(t)}}function o(t){try{a(c.throw(t))}catch(t){e(t)}}function a(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,o)}a((c=c.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(n,r){var o,a,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(i=2&e[0]?a.return:e[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,e[1])).done)return i;switch(a=0,(e=i?[2&e[0],i.value]:e)[0]){case 0:case 1:i=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,a=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(i=0<(i=s.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){s.label=e[1];break}if(6===e[0]&&s.label<i[1]){s.label=i[1],i=e;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(e);break}i[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],a=0}finally{o=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__asyncValues=this&&this.__asyncValues||function(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=i[Symbol.asyncIterator];return e?e.call(i):(i="function"==typeof __values?__values(i):i[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=i[a]&&function(o){return new Promise(function(t,e){var n,r;o=i[a](o),n=t,t=e,r=o.done,e=o.value,Promise.resolve(e).then(function(t){n({value:t,done:r})},t)})}}},__await=this&&this.__await||function(t){return this instanceof __await?(this.v=t,this):new __await(t)},__asyncGenerator=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=n.apply(t,e||[]),a=[],i={};return r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i;function r(r){o[r]&&(i[r]=function(n){return new Promise(function(t,e){1<a.push([r,n,t,e])||s(r,n)})})}function s(t,e){try{(n=o[t](e)).value instanceof __await?Promise.resolve(n.value.v).then(c,u):l(a[0][2],n)}catch(t){l(a[0][3],t)}var n}function c(t){s("next",t)}function u(t){s("throw",t)}function l(t,e){t(e),a.shift(),a.length&&s(a[0][0],a[0][1])}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createComponentInstanceEngineDataSource=void 0;var util_1=require("./util"),_util_1=require("./commands/composition/_util");function createComponentInstanceEngineDataSource(t){var n=this,c=t.client,t=t.state,u=(0,util_1.convertCompositionState)(t);return{objects:function(){return __asyncGenerator(this,arguments,function(){var e,n,r,o,a,i,s=this;return __generator(this,function(t){switch(t.label){case 0:e=(0,util_1.paginateAsync)(function(e,n){return __awaiter(s,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.getCompositionList({limit:n,offset:e,state:u,skipPatternResolution:!0})];case 1:return[2,t.sent().compositions]}})})},{pageSize:100}),t.label=1;case 1:t.trys.push([1,8,9,14]),n=__asyncValues(e),t.label=2;case 2:return[4,__await(n.next())];case 3:return(r=t.sent()).done?[3,7]:(o=r.value,o={id:(0,_util_1.selectIdentifier)(o),displayName:(0,_util_1.selectDisplayName)(o),providerId:o.composition._id,object:(0,util_1.prepCompositionForDisk)(o)},[4,__await(o)]);case 4:return[4,t.sent()];case 5:t.sent(),t.label=6;case 6:return[3,2];case 7:return[3,14];case 8:return a=t.sent(),a={error:a},[3,14];case 9:return t.trys.push([9,,12,13]),r&&!r.done&&(i=n.return)?[4,__await(i.call(n))]:[3,11];case 10:t.sent(),t.label=11;case 11:return[3,13];case 12:if(a)throw a.error;return[7];case 13:return[7];case 14:return[2]}})})}(),deleteObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.removeComposition({compositionId:e})];case 1:return t.sent(),[2]}})})},writeObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.updateComposition(__assign(__assign({},e.object),{state:u}))];case 1:return t.sent(),[2]}})})}}}exports.createComponentInstanceEngineDataSource=createComponentInstanceEngineDataSource; |
@@ -30,2 +30,3 @@ import { Argv } from 'yargs'; | ||
composition: import("../types/componentInstances").RootComponentInstance; | ||
pattern: boolean; | ||
created?: string | undefined; | ||
@@ -32,0 +33,0 @@ modified?: string | undefined; |
@@ -11,2 +11,4 @@ /** @deprecated use CANVAS_DRAFT_STATE and CANVAS_PUBLISHED_STATE instead */ | ||
composition: RootComponentInstance; | ||
/** Whether this composition is a pattern (can be referenced by other compositions) */ | ||
pattern: boolean; | ||
/** Created date string for this definition */ | ||
@@ -56,2 +58,8 @@ created?: string; | ||
skipEnhance?: boolean; | ||
/** | ||
* If true, any pattern references in the composition will be left unresolved. | ||
* This is appropriate if you intend to serialize the composition data without pattern | ||
* data embedded into it, and serialize the pattern data separately. | ||
*/ | ||
skipPatternResolution?: boolean; | ||
}; | ||
@@ -81,10 +89,10 @@ export declare type ComponentParameter<TValue = unknown> = { | ||
data?: Record<string, unknown>; | ||
/** If this component is part of a referenced separate component subtree, this is the public UUID of the subtree root it is part of. | ||
* @deprecated may change later | ||
/** Indicates this component instance should be sourced from a pattern library pattern */ | ||
_pattern?: string; | ||
/** | ||
* If an error occurs resolving a pattern reference, it is left unresolved and this property is set to indicate why. | ||
* CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop. | ||
* NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet. | ||
*/ | ||
_refRootId?: string; | ||
/** If this component refers to a referenced subtree, this is the public ID of the reference to the subtree (this is only set on the reference root component). | ||
* @deprecated may change later | ||
*/ | ||
_refId?: string; | ||
_patternError?: 'CYCLIC' | 'NOTFOUND'; | ||
}; | ||
@@ -91,0 +99,0 @@ /** Defines the shape of the root component in a composition */ |
@@ -7,4 +7,2 @@ /** Public ID of Canvas personalization component type */ | ||
export declare const CANVAS_INTENT_TAG_PARAM = "intentTag"; | ||
/** Public ID of the Canvas reference component type */ | ||
export declare const CANVAS_REFERENCE_TYPE = "$reference"; | ||
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */ | ||
@@ -11,0 +9,0 @@ export declare const CANVAS_PERSONALIZE_SLOT = "pz"; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CANVAS_PUBLISHED_STATE=exports.CANVAS_DRAFT_STATE=exports.CANVAS_TEST_SLOT=exports.CANVAS_PERSONALIZE_SLOT=exports.CANVAS_REFERENCE_TYPE=exports.CANVAS_INTENT_TAG_PARAM=exports.CANVAS_TEST_TYPE=exports.CANVAS_PERSONALIZE_TYPE=void 0,exports.CANVAS_PERSONALIZE_TYPE="$personalization",exports.CANVAS_TEST_TYPE="$test",exports.CANVAS_INTENT_TAG_PARAM="intentTag",exports.CANVAS_REFERENCE_TYPE="$reference",exports.CANVAS_PERSONALIZE_SLOT="pz",exports.CANVAS_TEST_SLOT="test",exports.CANVAS_DRAFT_STATE=0,exports.CANVAS_PUBLISHED_STATE=64; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CANVAS_PUBLISHED_STATE=exports.CANVAS_DRAFT_STATE=exports.CANVAS_TEST_SLOT=exports.CANVAS_PERSONALIZE_SLOT=exports.CANVAS_INTENT_TAG_PARAM=exports.CANVAS_TEST_TYPE=exports.CANVAS_PERSONALIZE_TYPE=void 0,exports.CANVAS_PERSONALIZE_TYPE="$personalization",exports.CANVAS_TEST_TYPE="$test",exports.CANVAS_INTENT_TAG_PARAM="intentTag",exports.CANVAS_PERSONALIZE_SLOT="pz",exports.CANVAS_TEST_SLOT="test",exports.CANVAS_DRAFT_STATE=0,exports.CANVAS_PUBLISHED_STATE=64; |
@@ -35,5 +35,5 @@ import { LimitPolicy } from './enhancement/createLimitPolicy'; | ||
/** Fetches a Canvas composition by string name (slug) */ | ||
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>; | ||
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>; | ||
/** Fetches a Canvas composition by its public UUID */ | ||
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>; | ||
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>; | ||
/** Updates or creates a Canvas component definition */ | ||
@@ -40,0 +40,0 @@ updateComposition(body: Omit<CompositionAPIPutRequest, 'projectId'>): Promise<void>; |
@@ -5,4 +5,5 @@ import { CommandModule } from 'yargs'; | ||
id: string; | ||
resolvePatterns?: boolean; | ||
} & ApiArgs & FormatArgs & StateArgs & ProjectArgs; | ||
export declare const CompositionGetModule: CommandModule<GetCompositionArgs, GetCompositionArgs>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(t,a,c,s){return new(c=c||Promise)(function(o,e){function i(t){try{r(s.next(t))}catch(t){e(t)}}function n(t){try{r(s.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof c?e:new c(function(t){t(e)})).then(i,n)}r((s=s.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(o,i){var n,r,a,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return c.label++,{value:e[1],done:!1};case 5:c.label++,r=e[1],e=[0];continue;case 7:e=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){c=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){c.label=e[1];break}if(6===e[0]&&c.label<a[1]){c.label=a[1],a=e;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(e);break}a[2]&&c.ops.pop(),c.trys.pop();continue}e=i.call(o,c)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};import{CanvasClient}from"../../../CanvasClient";import{convertCompositionState,emitWithFormat,prepCompositionForDisk,withApiOptions,withFormatOptions,withProjectOptions,withStateOptions}from"../../util";import fetch from"isomorphic-unfetch";var CompositionGetModule={command:"get <id>",describe:"Fetch a composition",builder:function(t){return withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(t.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"})))))},handler:function(t){var i=t.apiHost,n=t.apiKey,r=t.id,a=t.format,c=t.filename,s=t.state,p=t.project;return __awaiter(void 0,void 0,void 0,function(){var e,o;return __generator(this,function(t){switch(t.label){case 0:return e=new CanvasClient({apiKey:n,apiHost:i,fetch:fetch,projectId:p}),o=prepCompositionForDisk,[4,e.getCompositionById({compositionId:r,state:convertCompositionState(s)})];case 1:return e=o.apply(void 0,[t.sent()]),emitWithFormat(e,a,c),[2]}})})}};export{CompositionGetModule}; | ||
var __awaiter=this&&this.__awaiter||function(t,a,s,c){return new(s=s||Promise)(function(o,e){function n(t){try{r(c.next(t))}catch(t){e(t)}}function i(t){try{r(c.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(n,i)}r((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(o,n){var i,r,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,r=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=n.call(o,s)}catch(t){e=[6,t],r=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};import{CanvasClient}from"../../../CanvasClient";import{convertCompositionState,emitWithFormat,prepCompositionForDisk,withApiOptions,withFormatOptions,withProjectOptions,withStateOptions}from"../../util";import fetch from"isomorphic-unfetch";var CompositionGetModule={command:"get <id>",describe:"Fetch a composition",builder:function(t){return withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(t.positional("id",{demandOption:!0,describe:"Composition public ID to fetch"}).option({resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}})))))},handler:function(t){var n=t.apiHost,i=t.apiKey,r=t.id,a=t.format,s=t.filename,c=t.state,p=t.project,l=t.resolvePatterns;return __awaiter(void 0,void 0,void 0,function(){var e,o;return __generator(this,function(t){switch(t.label){case 0:return e=new CanvasClient({apiKey:i,apiHost:n,fetch:fetch,projectId:p}),o=prepCompositionForDisk,[4,e.getCompositionById({compositionId:r,state:convertCompositionState(c),skipPatternResolution:!l})];case 1:return e=o.apply(void 0,[t.sent()]),emitWithFormat(e,a,s),[2]}})})}};export{CompositionGetModule}; |
import { CommandModule } from 'yargs'; | ||
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util'; | ||
import { CompositionAPIOptions } from '../../../types/componentInstances'; | ||
declare type ListCompositionArgs = Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs; | ||
declare type ListCompositionArgs = { | ||
resolvePatterns?: boolean; | ||
} & Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs; | ||
export declare const CompositionListModule: CommandModule<ListCompositionArgs, ListCompositionArgs>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(t,a,s,c){return new(s=s||Promise)(function(o,e){function i(t){try{r(c.next(t))}catch(t){e(t)}}function n(t){try{r(c.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(i,n)}r((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(o,i){var n,r,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,r=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=i.call(o,s)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};import{CanvasClient}from"../../../CanvasClient";import{convertCompositionState,emitWithFormat,withApiOptions,withFormatOptions,withProjectOptions,withStateOptions}from"../../util";import fetch from"isomorphic-unfetch";var CompositionListModule={command:"list",describe:"List compositions",aliases:["ls"],builder:function(t){return withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(t.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20}})))))},handler:function(t){var o=t.apiHost,i=t.apiKey,n=t.limit,r=t.offset,a=t.format,s=t.filename,c=t.project,u=t.state;return __awaiter(void 0,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,new CanvasClient({apiKey:i,apiHost:o,fetch:fetch,projectId:c}).getCompositionList({limit:n,offset:r,state:convertCompositionState(u)})];case 1:return e=t.sent(),emitWithFormat(e.compositions,a,s),[2]}})})}};export{CompositionListModule}; | ||
var __awaiter=this&&this.__awaiter||function(t,a,s,c){return new(s=s||Promise)(function(o,e){function i(t){try{r(c.next(t))}catch(t){e(t)}}function n(t){try{r(c.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(i,n)}r((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(o,i){var n,r,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(a=2&e[0]?r.return:e[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,e[1])).done)return a;switch(r=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,r=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=i.call(o,s)}catch(t){e=[6,t],r=0}finally{n=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};import{CanvasClient}from"../../../CanvasClient";import{convertCompositionState,emitWithFormat,withApiOptions,withFormatOptions,withProjectOptions,withStateOptions}from"../../util";import fetch from"isomorphic-unfetch";var CompositionListModule={command:"list",describe:"List compositions",aliases:["ls"],builder:function(t){return withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(t.options({offset:{describe:"Number of rows to skip before fetching",type:"number",default:0},limit:{describe:"Number of rows to fetch",type:"number",default:20},resolvePatterns:{type:"boolean",default:!1,describe:"Resolve pattern references in the composition"}})))))},handler:function(t){var o=t.apiHost,i=t.apiKey,n=t.limit,r=t.offset,a=t.format,s=t.filename,c=t.project,l=t.state,u=t.resolvePatterns;return __awaiter(void 0,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,new CanvasClient({apiKey:i,apiHost:o,fetch:fetch,projectId:c}).getCompositionList({limit:n,offset:r,state:convertCompositionState(l),skipPatternResolution:!u})];case 1:return e=t.sent(),emitWithFormat(e.compositions,a,s),[2]}})})}};export{CompositionListModule}; |
@@ -1,1 +0,1 @@ | ||
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,a,s,c){return new(s=s||Promise)(function(n,e){function r(t){try{i(c.next(t))}catch(t){e(t)}}function o(t){try{i(c.throw(t))}catch(t){e(t)}}function i(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,r){var o,i,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&e[0]?i.return:e[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,e[1])).done)return a;switch(i=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,i=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],i=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__asyncValues=this&&this.__asyncValues||function(a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=a[Symbol.asyncIterator];return e?e.call(a):(a="function"==typeof __values?__values(a):a[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=a[i]&&function(o){return new Promise(function(t,e){var n,r;o=a[i](o),n=t,t=e,r=o.done,e=o.value,Promise.resolve(e).then(function(t){n({value:t,done:r})},t)})}}},__await=this&&this.__await||function(t){return this instanceof __await?(this.v=t,this):new __await(t)},__asyncGenerator=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=n.apply(t,e||[]),i=[],a={};return r("next"),r("throw"),r("return"),a[Symbol.asyncIterator]=function(){return this},a;function r(r){o[r]&&(a[r]=function(n){return new Promise(function(t,e){1<i.push([r,n,t,e])||s(r,n)})})}function s(t,e){try{(n=o[t](e)).value instanceof __await?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function c(t){s("next",t)}function u(t){s("throw",t)}function l(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}};import{convertCompositionState,paginateAsync,prepCompositionForDisk}from"./util";import{selectDisplayName,selectIdentifier}from"./commands/composition/_util";function createComponentInstanceEngineDataSource(t){var n=this,c=t.client,t=t.state,u=convertCompositionState(t);return{objects:function(){return __asyncGenerator(this,arguments,function(){var e,n,r,o,i,a,s=this;return __generator(this,function(t){switch(t.label){case 0:e=paginateAsync(function(e,n){return __awaiter(s,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.getCompositionList({limit:n,offset:e,state:u})];case 1:return[2,t.sent().compositions]}})})},{pageSize:100}),t.label=1;case 1:t.trys.push([1,8,9,14]),n=__asyncValues(e),t.label=2;case 2:return[4,__await(n.next())];case 3:return(r=t.sent()).done?[3,7]:(o=r.value,o={id:selectIdentifier(o),displayName:selectDisplayName(o),providerId:o.composition._id,object:prepCompositionForDisk(o)},[4,__await(o)]);case 4:return[4,t.sent()];case 5:t.sent(),t.label=6;case 6:return[3,2];case 7:return[3,14];case 8:return i=t.sent(),i={error:i},[3,14];case 9:return t.trys.push([9,,12,13]),r&&!r.done&&(a=n.return)?[4,__await(a.call(n))]:[3,11];case 10:t.sent(),t.label=11;case 11:return[3,13];case 12:if(i)throw i.error;return[7];case 13:return[7];case 14:return[2]}})})}(),deleteObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.removeComposition({compositionId:e})];case 1:return t.sent(),[2]}})})},writeObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.updateComposition(__assign(__assign({},e.object),{state:u}))];case 1:return t.sent(),[2]}})})}}}export{createComponentInstanceEngineDataSource}; | ||
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(t,a,s,c){return new(s=s||Promise)(function(n,e){function r(t){try{i(c.next(t))}catch(t){e(t)}}function o(t){try{i(c.throw(t))}catch(t){e(t)}}function i(t){var e;t.done?n(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(r,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,r){var o,i,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&e[0]?i.return:e[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,e[1])).done)return a;switch(i=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,i=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],i=0}finally{o=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},__asyncValues=this&&this.__asyncValues||function(a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=a[Symbol.asyncIterator];return e?e.call(a):(a="function"==typeof __values?__values(a):a[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=a[i]&&function(o){return new Promise(function(t,e){var n,r;o=a[i](o),n=t,t=e,r=o.done,e=o.value,Promise.resolve(e).then(function(t){n({value:t,done:r})},t)})}}},__await=this&&this.__await||function(t){return this instanceof __await?(this.v=t,this):new __await(t)},__asyncGenerator=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=n.apply(t,e||[]),i=[],a={};return r("next"),r("throw"),r("return"),a[Symbol.asyncIterator]=function(){return this},a;function r(r){o[r]&&(a[r]=function(n){return new Promise(function(t,e){1<i.push([r,n,t,e])||s(r,n)})})}function s(t,e){try{(n=o[t](e)).value instanceof __await?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function c(t){s("next",t)}function u(t){s("throw",t)}function l(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}};import{convertCompositionState,paginateAsync,prepCompositionForDisk}from"./util";import{selectDisplayName,selectIdentifier}from"./commands/composition/_util";function createComponentInstanceEngineDataSource(t){var n=this,c=t.client,t=t.state,u=convertCompositionState(t);return{objects:function(){return __asyncGenerator(this,arguments,function(){var e,n,r,o,i,a,s=this;return __generator(this,function(t){switch(t.label){case 0:e=paginateAsync(function(e,n){return __awaiter(s,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.getCompositionList({limit:n,offset:e,state:u,skipPatternResolution:!0})];case 1:return[2,t.sent().compositions]}})})},{pageSize:100}),t.label=1;case 1:t.trys.push([1,8,9,14]),n=__asyncValues(e),t.label=2;case 2:return[4,__await(n.next())];case 3:return(r=t.sent()).done?[3,7]:(o=r.value,o={id:selectIdentifier(o),displayName:selectDisplayName(o),providerId:o.composition._id,object:prepCompositionForDisk(o)},[4,__await(o)]);case 4:return[4,t.sent()];case 5:t.sent(),t.label=6;case 6:return[3,2];case 7:return[3,14];case 8:return i=t.sent(),i={error:i},[3,14];case 9:return t.trys.push([9,,12,13]),r&&!r.done&&(a=n.return)?[4,__await(a.call(n))]:[3,11];case 10:t.sent(),t.label=11;case 11:return[3,13];case 12:if(i)throw i.error;return[7];case 13:return[7];case 14:return[2]}})})}(),deleteObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.removeComposition({compositionId:e})];case 1:return t.sent(),[2]}})})},writeObject:function(e){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,c.updateComposition(__assign(__assign({},e.object),{state:u}))];case 1:return t.sent(),[2]}})})}}}export{createComponentInstanceEngineDataSource}; |
@@ -30,2 +30,3 @@ import { Argv } from 'yargs'; | ||
composition: import("../types/componentInstances").RootComponentInstance; | ||
pattern: boolean; | ||
created?: string | undefined; | ||
@@ -32,0 +33,0 @@ modified?: string | undefined; |
@@ -11,2 +11,4 @@ /** @deprecated use CANVAS_DRAFT_STATE and CANVAS_PUBLISHED_STATE instead */ | ||
composition: RootComponentInstance; | ||
/** Whether this composition is a pattern (can be referenced by other compositions) */ | ||
pattern: boolean; | ||
/** Created date string for this definition */ | ||
@@ -56,2 +58,8 @@ created?: string; | ||
skipEnhance?: boolean; | ||
/** | ||
* If true, any pattern references in the composition will be left unresolved. | ||
* This is appropriate if you intend to serialize the composition data without pattern | ||
* data embedded into it, and serialize the pattern data separately. | ||
*/ | ||
skipPatternResolution?: boolean; | ||
}; | ||
@@ -81,10 +89,10 @@ export declare type ComponentParameter<TValue = unknown> = { | ||
data?: Record<string, unknown>; | ||
/** If this component is part of a referenced separate component subtree, this is the public UUID of the subtree root it is part of. | ||
* @deprecated may change later | ||
/** Indicates this component instance should be sourced from a pattern library pattern */ | ||
_pattern?: string; | ||
/** | ||
* If an error occurs resolving a pattern reference, it is left unresolved and this property is set to indicate why. | ||
* CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop. | ||
* NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet. | ||
*/ | ||
_refRootId?: string; | ||
/** If this component refers to a referenced subtree, this is the public ID of the reference to the subtree (this is only set on the reference root component). | ||
* @deprecated may change later | ||
*/ | ||
_refId?: string; | ||
_patternError?: 'CYCLIC' | 'NOTFOUND'; | ||
}; | ||
@@ -91,0 +99,0 @@ /** Defines the shape of the root component in a composition */ |
@@ -7,4 +7,2 @@ /** Public ID of Canvas personalization component type */ | ||
export declare const CANVAS_INTENT_TAG_PARAM = "intentTag"; | ||
/** Public ID of the Canvas reference component type */ | ||
export declare const CANVAS_REFERENCE_TYPE = "$reference"; | ||
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */ | ||
@@ -11,0 +9,0 @@ export declare const CANVAS_PERSONALIZE_SLOT = "pz"; |
@@ -1,1 +0,1 @@ | ||
var CANVAS_PERSONALIZE_TYPE="$personalization",CANVAS_TEST_TYPE="$test",CANVAS_INTENT_TAG_PARAM="intentTag",CANVAS_REFERENCE_TYPE="$reference",CANVAS_PERSONALIZE_SLOT="pz",CANVAS_TEST_SLOT="test",CANVAS_DRAFT_STATE=0,CANVAS_PUBLISHED_STATE=64;export{CANVAS_PERSONALIZE_TYPE,CANVAS_TEST_TYPE,CANVAS_INTENT_TAG_PARAM,CANVAS_REFERENCE_TYPE,CANVAS_PERSONALIZE_SLOT,CANVAS_TEST_SLOT,CANVAS_DRAFT_STATE,CANVAS_PUBLISHED_STATE}; | ||
var CANVAS_PERSONALIZE_TYPE="$personalization",CANVAS_TEST_TYPE="$test",CANVAS_INTENT_TAG_PARAM="intentTag",CANVAS_PERSONALIZE_SLOT="pz",CANVAS_TEST_SLOT="test",CANVAS_DRAFT_STATE=0,CANVAS_PUBLISHED_STATE=64;export{CANVAS_PERSONALIZE_TYPE,CANVAS_TEST_TYPE,CANVAS_INTENT_TAG_PARAM,CANVAS_PERSONALIZE_SLOT,CANVAS_TEST_SLOT,CANVAS_DRAFT_STATE,CANVAS_PUBLISHED_STATE}; |
{ | ||
"name": "@uniformdev/canvas", | ||
"version": "12.0.0", | ||
"version": "12.0.1-alpha.41+ea8128e", | ||
"description": "Common functionality and types for Uniform Canvas", | ||
@@ -50,7 +50,7 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"@types/yargs": "17.0.3", | ||
"@uniformdev/cli": "^12.0.0", | ||
"@uniformdev/cli": "^12.0.1-alpha.41+ea8128e", | ||
"eslint": "7.32.0", | ||
"eslint-plugin-react": "7.26.0", | ||
"eslint-plugin-react": "7.26.1", | ||
"eslint-plugin-react-hooks": "4.2.0", | ||
"jest": "27.2.3", | ||
"jest": "27.2.5", | ||
"npm-run-all": "4.1.5", | ||
@@ -65,4 +65,4 @@ "rimraf": "3.0.2", | ||
"dependencies": { | ||
"@uniformdev/optimize-common": "^12.0.0", | ||
"@uniformdev/optimize-tracker-common": "^12.0.0", | ||
"@uniformdev/optimize-common": "^12.0.1-alpha.41+ea8128e", | ||
"@uniformdev/optimize-tracker-common": "^12.0.1-alpha.41+ea8128e", | ||
"chalk": "^4.1.2", | ||
@@ -84,3 +84,3 @@ "diff": "^5.0.0", | ||
}, | ||
"gitHead": "2b051635cb8d3a56c938c3a9dee07c0056d63404" | ||
"gitHead": "ea8128ef54022ca921cedd97eb95e37c949ed919" | ||
} |
@@ -0,0 +0,0 @@ Uniform Canvas JavaScript SDK |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
286333
1594
32
17