@uniformdev/canvas 11.0.1-alpha.95 → 12.0.1-alpha.47
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/README.md +3 -1
- package/dist/cjs/CanvasClient.d.ts +2 -2
- package/dist/cjs/cli/commands/composition/get.d.ts +1 -0
- package/dist/cjs/cli/commands/composition/get.js +1 -1
- package/dist/cjs/cli/commands/composition/list.d.ts +3 -1
- package/dist/cjs/cli/commands/composition/list.js +1 -1
- package/dist/cjs/cli/componentInstanceEngineDataSource.js +1 -1
- package/dist/cjs/cli/util.d.ts +1 -0
- package/dist/cjs/types/componentInstances.d.ts +15 -7
- package/dist/cjs/utils/constants.d.ts +0 -2
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/esm/CanvasClient.d.ts +2 -2
- package/dist/esm/cli/commands/composition/get.d.ts +1 -0
- package/dist/esm/cli/commands/composition/get.js +1 -1
- package/dist/esm/cli/commands/composition/list.d.ts +3 -1
- package/dist/esm/cli/commands/composition/list.js +1 -1
- package/dist/esm/cli/componentInstanceEngineDataSource.js +1 -1
- package/dist/esm/cli/util.d.ts +1 -0
- package/dist/esm/types/componentInstances.d.ts +15 -7
- package/dist/esm/utils/constants.d.ts +0 -2
- package/dist/esm/utils/constants.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
-
|
1
|
+
Uniform Canvas JavaScript SDK
|
2
|
+
|
3
|
+
Contains the Canvas API client, Canvas CLI, and core typings.
|
2
4
|
|
3
5
|
part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
|
@@ -32,9 +32,9 @@ export declare class CanvasClient {
|
|
32
32
|
/** Fetches lists of Canvas compositions, optionally by type */
|
33
33
|
getCompositionList(options?: Omit<CompositionAPIOptions, 'projectId'>): Promise<CompositionListAPIResponse>;
|
34
34
|
/** Fetches a Canvas composition by string name (slug) */
|
35
|
-
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>;
|
35
|
+
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>;
|
36
36
|
/** Fetches a Canvas composition by its public UUID */
|
37
|
-
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>;
|
37
|
+
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>;
|
38
38
|
/** Updates or creates a Canvas component definition */
|
39
39
|
updateComposition(body: Omit<CompositionAPIPutRequest, 'projectId'>): Promise<void>;
|
40
40
|
/** Deletes a Canvas component definition */
|
@@ -2,6 +2,7 @@ import { CommandModule } from 'yargs';
|
|
2
2
|
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util';
|
3
3
|
declare type GetCompositionArgs = {
|
4
4
|
id: string;
|
5
|
+
resolvePatterns?: boolean;
|
5
6
|
} & ApiArgs & FormatArgs & StateArgs & ProjectArgs;
|
6
7
|
export declare const CompositionGetModule: CommandModule<GetCompositionArgs, GetCompositionArgs>;
|
7
8
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,u,
|
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.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]}})})}};
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { CommandModule } from 'yargs';
|
2
2
|
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util';
|
3
3
|
import { CompositionAPIOptions } from '../../../types/componentInstances';
|
4
|
-
declare type ListCompositionArgs =
|
4
|
+
declare type ListCompositionArgs = {
|
5
|
+
resolvePatterns?: boolean;
|
6
|
+
} & Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs;
|
5
7
|
export declare const CompositionListModule: CommandModule<ListCompositionArgs, ListCompositionArgs>;
|
6
8
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(t,a,u
|
1
|
+
"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 @@
|
|
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;
|
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,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;
|
package/dist/cjs/cli/util.d.ts
CHANGED
@@ -27,6 +27,7 @@ export declare function prepCompositionForDisk(composition: CompositionAPIRespon
|
|
27
27
|
state: number;
|
28
28
|
projectId: string;
|
29
29
|
composition: import("../types/componentInstances").RootComponentInstance;
|
30
|
+
pattern: boolean;
|
30
31
|
created?: string | undefined;
|
31
32
|
modified?: string | undefined;
|
32
33
|
};
|
@@ -8,6 +8,8 @@ export declare type CompositionAPIResponse = {
|
|
8
8
|
projectId: string;
|
9
9
|
/** Layout data being read or written */
|
10
10
|
composition: RootComponentInstance;
|
11
|
+
/** Whether this composition is a pattern (can be referenced by other compositions) */
|
12
|
+
pattern: boolean;
|
11
13
|
/** Created date string for this definition */
|
12
14
|
created?: string;
|
13
15
|
/** Modified date string for this definition */
|
@@ -52,6 +54,12 @@ export declare type CompositionAPIOptions = {
|
|
52
54
|
* If calling the Canvas API directly with no enhancer proxy, this has no effect.
|
53
55
|
*/
|
54
56
|
skipEnhance?: boolean;
|
57
|
+
/**
|
58
|
+
* If true, any pattern references in the composition will be left unresolved.
|
59
|
+
* This is appropriate if you intend to serialize the composition data without pattern
|
60
|
+
* data embedded into it, and serialize the pattern data separately.
|
61
|
+
*/
|
62
|
+
skipPatternResolution?: boolean;
|
55
63
|
};
|
56
64
|
export declare type ComponentParameter<TValue = unknown> = {
|
57
65
|
/** The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
|
@@ -76,14 +84,14 @@ export declare type ComponentInstance = {
|
|
76
84
|
slots?: Record<string, ComponentInstance[]>;
|
77
85
|
/** Data for the component instance, provided by a component enhancer. Never set in unenhanced data. */
|
78
86
|
data?: Record<string, unknown>;
|
79
|
-
/**
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
*
|
87
|
+
/** Indicates this component instance should be sourced from a pattern library pattern */
|
88
|
+
_pattern?: string;
|
89
|
+
/**
|
90
|
+
* If an error occurs resolving a pattern reference, it is left unresolved and this property is set to indicate why.
|
91
|
+
* CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop.
|
92
|
+
* NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet.
|
85
93
|
*/
|
86
|
-
|
94
|
+
_patternError?: 'CYCLIC' | 'NOTFOUND';
|
87
95
|
};
|
88
96
|
/** Defines the shape of the root component in a composition */
|
89
97
|
export declare type RootComponentInstance = ComponentInstance & {
|
@@ -4,8 +4,6 @@ export declare const CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
4
4
|
export declare const CANVAS_TEST_TYPE = "$test";
|
5
5
|
/** Public ID of the intent tag parameter on the Canvas personalization component type */
|
6
6
|
export declare const CANVAS_INTENT_TAG_PARAM = "intentTag";
|
7
|
-
/** Public ID of the Canvas reference component type */
|
8
|
-
export declare const CANVAS_REFERENCE_TYPE = "$reference";
|
9
7
|
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */
|
10
8
|
export declare const CANVAS_PERSONALIZE_SLOT = "pz";
|
11
9
|
/** Name of the slot on CANVAS_TEST_TYPE */
|
@@ -1 +1 @@
|
|
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.
|
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_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;
|
@@ -32,9 +32,9 @@ export declare class CanvasClient {
|
|
32
32
|
/** Fetches lists of Canvas compositions, optionally by type */
|
33
33
|
getCompositionList(options?: Omit<CompositionAPIOptions, 'projectId'>): Promise<CompositionListAPIResponse>;
|
34
34
|
/** Fetches a Canvas composition by string name (slug) */
|
35
|
-
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>;
|
35
|
+
getCompositionBySlug(options: Pick<CompositionAPIOptions, 'slug' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>;
|
36
36
|
/** Fetches a Canvas composition by its public UUID */
|
37
|
-
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance'>): Promise<CompositionAPIResponse>;
|
37
|
+
getCompositionById(options: Pick<CompositionAPIOptions, 'compositionId' | 'state' | 'skipEnhance' | 'skipPatternResolution'>): Promise<CompositionAPIResponse>;
|
38
38
|
/** Updates or creates a Canvas component definition */
|
39
39
|
updateComposition(body: Omit<CompositionAPIPutRequest, 'projectId'>): Promise<void>;
|
40
40
|
/** Deletes a Canvas component definition */
|
@@ -2,6 +2,7 @@ import { CommandModule } from 'yargs';
|
|
2
2
|
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util';
|
3
3
|
declare type GetCompositionArgs = {
|
4
4
|
id: string;
|
5
|
+
resolvePatterns?: boolean;
|
5
6
|
} & ApiArgs & FormatArgs & StateArgs & ProjectArgs;
|
6
7
|
export declare const CompositionGetModule: CommandModule<GetCompositionArgs, GetCompositionArgs>;
|
7
8
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,a,c
|
1
|
+
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};
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { CommandModule } from 'yargs';
|
2
2
|
import { ApiArgs, FormatArgs, ProjectArgs, StateArgs } from '../../util';
|
3
3
|
import { CompositionAPIOptions } from '../../../types/componentInstances';
|
4
|
-
declare type ListCompositionArgs =
|
4
|
+
declare type ListCompositionArgs = {
|
5
|
+
resolvePatterns?: boolean;
|
6
|
+
} & Pick<CompositionAPIOptions, 'offset' | 'limit'> & ApiArgs & FormatArgs & ProjectArgs & StateArgs;
|
5
7
|
export declare const CompositionListModule: CommandModule<ListCompositionArgs, ListCompositionArgs>;
|
6
8
|
export {};
|
@@ -1 +1 @@
|
|
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.
|
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},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 @@
|
|
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};
|
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,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};
|
package/dist/esm/cli/util.d.ts
CHANGED
@@ -27,6 +27,7 @@ export declare function prepCompositionForDisk(composition: CompositionAPIRespon
|
|
27
27
|
state: number;
|
28
28
|
projectId: string;
|
29
29
|
composition: import("../types/componentInstances").RootComponentInstance;
|
30
|
+
pattern: boolean;
|
30
31
|
created?: string | undefined;
|
31
32
|
modified?: string | undefined;
|
32
33
|
};
|
@@ -8,6 +8,8 @@ export declare type CompositionAPIResponse = {
|
|
8
8
|
projectId: string;
|
9
9
|
/** Layout data being read or written */
|
10
10
|
composition: RootComponentInstance;
|
11
|
+
/** Whether this composition is a pattern (can be referenced by other compositions) */
|
12
|
+
pattern: boolean;
|
11
13
|
/** Created date string for this definition */
|
12
14
|
created?: string;
|
13
15
|
/** Modified date string for this definition */
|
@@ -52,6 +54,12 @@ export declare type CompositionAPIOptions = {
|
|
52
54
|
* If calling the Canvas API directly with no enhancer proxy, this has no effect.
|
53
55
|
*/
|
54
56
|
skipEnhance?: boolean;
|
57
|
+
/**
|
58
|
+
* If true, any pattern references in the composition will be left unresolved.
|
59
|
+
* This is appropriate if you intend to serialize the composition data without pattern
|
60
|
+
* data embedded into it, and serialize the pattern data separately.
|
61
|
+
*/
|
62
|
+
skipPatternResolution?: boolean;
|
55
63
|
};
|
56
64
|
export declare type ComponentParameter<TValue = unknown> = {
|
57
65
|
/** The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
|
@@ -76,14 +84,14 @@ export declare type ComponentInstance = {
|
|
76
84
|
slots?: Record<string, ComponentInstance[]>;
|
77
85
|
/** Data for the component instance, provided by a component enhancer. Never set in unenhanced data. */
|
78
86
|
data?: Record<string, unknown>;
|
79
|
-
/**
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
*
|
87
|
+
/** Indicates this component instance should be sourced from a pattern library pattern */
|
88
|
+
_pattern?: string;
|
89
|
+
/**
|
90
|
+
* If an error occurs resolving a pattern reference, it is left unresolved and this property is set to indicate why.
|
91
|
+
* CYCLIC: A cyclic pattern graph was detected, which could not be resolved because it would cause an infinite loop.
|
92
|
+
* NOTFOUND: The pattern ID referenced could not be found. It may have been deleted, or not be published yet.
|
85
93
|
*/
|
86
|
-
|
94
|
+
_patternError?: 'CYCLIC' | 'NOTFOUND';
|
87
95
|
};
|
88
96
|
/** Defines the shape of the root component in a composition */
|
89
97
|
export declare type RootComponentInstance = ComponentInstance & {
|
@@ -4,8 +4,6 @@ export declare const CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
4
4
|
export declare const CANVAS_TEST_TYPE = "$test";
|
5
5
|
/** Public ID of the intent tag parameter on the Canvas personalization component type */
|
6
6
|
export declare const CANVAS_INTENT_TAG_PARAM = "intentTag";
|
7
|
-
/** Public ID of the Canvas reference component type */
|
8
|
-
export declare const CANVAS_REFERENCE_TYPE = "$reference";
|
9
7
|
/** Name of the slot on CANVAS_PERSONALIZE_TYPE */
|
10
8
|
export declare const CANVAS_PERSONALIZE_SLOT = "pz";
|
11
9
|
/** Name of the slot on CANVAS_TEST_TYPE */
|
@@ -1 +1 @@
|
|
1
|
-
var CANVAS_PERSONALIZE_TYPE="$personalization",CANVAS_TEST_TYPE="$test",CANVAS_INTENT_TAG_PARAM="intentTag",
|
1
|
+
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};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "
|
3
|
+
"version": "12.0.1-alpha.47+58b9e61d",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/cjs/index.js",
|
@@ -47,11 +47,11 @@
|
|
47
47
|
"@types/lodash.isequalwith": "4.4.6",
|
48
48
|
"@types/node": "16.7.1",
|
49
49
|
"@types/yargs": "17.0.3",
|
50
|
-
"@uniformdev/cli": "^
|
50
|
+
"@uniformdev/cli": "^12.0.1-alpha.47+58b9e61d",
|
51
51
|
"eslint": "7.32.0",
|
52
|
-
"eslint-plugin-react": "7.26.
|
52
|
+
"eslint-plugin-react": "7.26.1",
|
53
53
|
"eslint-plugin-react-hooks": "4.2.0",
|
54
|
-
"jest": "27.2.
|
54
|
+
"jest": "27.2.5",
|
55
55
|
"npm-run-all": "4.1.5",
|
56
56
|
"rimraf": "3.0.2",
|
57
57
|
"ts-jest": "27.0.5",
|
@@ -61,8 +61,8 @@
|
|
61
61
|
"yargs": "^17.0.1"
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
|
-
"@uniformdev/optimize-common": "^
|
65
|
-
"@uniformdev/optimize-tracker-common": "^
|
64
|
+
"@uniformdev/optimize-common": "^12.0.1-alpha.47+58b9e61d",
|
65
|
+
"@uniformdev/optimize-tracker-common": "^12.0.1-alpha.47+58b9e61d",
|
66
66
|
"chalk": "^4.1.2",
|
67
67
|
"diff": "^5.0.0",
|
68
68
|
"isomorphic-unfetch": "^3.1.0",
|
@@ -79,5 +79,5 @@
|
|
79
79
|
"publishConfig": {
|
80
80
|
"access": "public"
|
81
81
|
},
|
82
|
-
"gitHead": "
|
82
|
+
"gitHead": "58b9e61dc17f861c6990b1d6a3786f4443cee34f"
|
83
83
|
}
|