lucid-extension-sdk 0.0.50 → 0.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  "devDependencies": {
11
11
  "@types/jasmine": "^3.10.3",
12
12
  "@types/node": "^16.11.11",
13
- "typedoc": "^0.22.15",
14
- "typedoc-plugin-markdown": "^3.12.1",
15
- "typescript": "4.3.5"
13
+ "typedoc": "^0.23.15",
14
+ "typedoc-plugin-markdown": "^3.13.6",
15
+ "typescript": "4.7.4"
16
16
  }
17
17
  }
@@ -4,80 +4,80 @@ exports.isRawSendXHRResponse = exports.commandTitles = void 0;
4
4
  const checks_1 = require("./core/checks");
5
5
  /** @ignore */
6
6
  exports.commandTitles = new Map([
7
- ["aci" /* AddCardIntegration */, 'AddCardIntegration'],
8
- ["alta" /* AddLineTextArea */, 'AddLineTextArea'],
9
- ["ami" /* AddMenuItem */, 'AddMenuItem'],
10
- ["asd" /* AddShapeData */, 'AddShapeData'],
11
- ["a" /* Alert */, 'Alert'],
12
- ["av" /* AnimateViewport */, 'AnimateViewport'],
13
- ["ai" /* AwaitImport */, 'AwaitImport'],
14
- ["b" /* Bootstrap */, 'Bootstrap'],
15
- ["cdc" /* CancelDragBlockToCanvas */, 'CancelDragBlockToCanvas'],
16
- ["c" /* Confirm */, 'Confirm'],
17
- ["cb" /* CreateBlock */, 'CreateBlock'],
18
- ["cc" /* CreateCollection */, 'CreateCollection'],
19
- ["cds" /* CreateDataSource */, 'CreateDataSource'],
20
- ["cl" /* CreateLine */, 'CreateLine'],
21
- ["cp" /* CreatePage */, 'CreatePage'],
22
- ["die" /* DataItemExists */, 'DataItemExists'],
23
- ["di" /* DeleteItem */, 'DeleteItem'],
24
- ["dp" /* DeletePage */, 'DeletePage'],
25
- ["dsd" /* DeleteShapeData */, 'DeleteShapeData'],
26
- ["d" /* Download */, 'Download'],
27
- ["ee" /* ElementExists */, 'ElementExists'],
28
- ["ef" /* ExecuteFormula */, 'ExecuteFormula'],
29
- ["gcl" /* GetConnectedLines */, 'GetConnectedLines'],
30
- ["gcp" /* GetCurrentPage */, 'GetCurrentPage'],
31
- ["gcs" /* GetCustomShape */, 'GetCustomShape'],
32
- ["gdif" /* GetDataItemField */, 'GetDataItemField'],
33
- ["get" /* GetElementType */, 'GetElementType'],
34
- ["gip" /* GetItemPageId */, 'GetItemPageId'],
35
- ["gp" /* GetProperty */, 'GetProperty'],
36
- ["grk" /* GetReferenceKey */, 'GetReferenceKey'],
37
- ["grlp" /* GetRelativeLinePosition */, 'GetRelativeLinePosition'],
38
- ["gs" /* GetSelection */, 'GetSelection'],
39
- ["gsd" /* GetShapeData */, 'GetShapeData'],
40
- ["hm" /* HideModal */, 'HideModal'],
41
- ["hp" /* HidePanel */, 'HidePanel'],
42
- ["hci" /* HookCreateItems */, 'HookCreateItems'],
43
- ["hs" /* HookSelection */, 'HookSelection'],
44
- ["hte" /* HookTextEdit */, 'HookTextEdit'],
45
- ["ic" /* ImportCards */, 'ImportCards'],
46
- ["k" /* KillExtension */, 'KillExtension'],
47
- ["lb" /* ListBlocks */, 'ListBlocks'],
48
- ["lcf" /* ListCollectionFields */, 'ListCollectionFields'],
49
- ["lc" /* ListCollections */, 'ListCollections'],
50
- ["ldi" /* ListDataItems */, 'ListDataItems'],
51
- ["lds" /* ListDataSources */, 'ListDataSources'],
52
- ["lg" /* ListGroups */, 'ListGroups'],
53
- ["ll" /* ListLines */, 'ListLines'],
54
- ["lp" /* ListPages */, 'ListPages'],
55
- ["lpr" /* ListProperties */, 'ListProperties'],
56
- ["lrk" /* ListReferenceKeys */, 'ListReferenceKeys'],
57
- ["lsd" /* ListShapeData */, 'ListShapeData'],
58
- ["lta" /* ListTextAreas */, 'ListTextAreas'],
59
- ["lbc" /* LoadBlockClasses */, 'LoadBlockClasses'],
60
- ["log" /* LogForTestCase */, 'LogForTestCase'],
61
- ["oi" /* OffsetItems */, 'OffsetItems'],
62
- ["pdi" /* PatchDataItems */, 'PatchDataItems'],
63
- ["rp" /* RegisterPanel */, 'RegisterPanel'],
64
- ["ru" /* RegisterUnfurl */, 'RegisterUnfurl'],
65
- ["r" /* ReloadExtension */, 'ReloadExtension'],
66
- ["oauth" /* SendOAuthRequest */, 'SendOAuthRequest'],
67
- ["suim" /* SendUIMessage */, 'SendUIMessage'],
68
- ["xhr" /* SendXHR */, 'SendXHR'],
69
- ["scp" /* SetCurrentPage */, 'SetCurrentPage'],
70
- ["sp" /* SetProperty */, 'SetProperty'],
71
- ["srk" /* SetReferenceKey */, 'SetReferenceKey'],
72
- ["ssd" /* SetShapeData */, 'SetShapeData'],
73
- ["sm" /* ShowModal */, 'ShowModal'],
74
- ["spn" /* ShowPanel */, 'ShowPanel'],
75
- ["sleep" /* SleepForTestCase */, 'SleepForTestCase'],
76
- ["sdc" /* StartDragBlockToCanvas */, 'StartDragBlockToCanvas'],
77
- ["throw" /* ThrowForTestCase */, 'ThrowForTestCase'],
78
- ["uci" /* UnhookCreateItems */, 'UnhookCreateItems'],
79
- ["us" /* UnhookSelection */, 'UnhookSelection'],
80
- ["ute" /* UnhookTextEdit */, 'UnhookTextEdit'],
7
+ ["aci" /* CommandName.AddCardIntegration */, 'AddCardIntegration'],
8
+ ["alta" /* CommandName.AddLineTextArea */, 'AddLineTextArea'],
9
+ ["ami" /* CommandName.AddMenuItem */, 'AddMenuItem'],
10
+ ["asd" /* CommandName.AddShapeData */, 'AddShapeData'],
11
+ ["a" /* CommandName.Alert */, 'Alert'],
12
+ ["av" /* CommandName.AnimateViewport */, 'AnimateViewport'],
13
+ ["ai" /* CommandName.AwaitImport */, 'AwaitImport'],
14
+ ["b" /* CommandName.Bootstrap */, 'Bootstrap'],
15
+ ["cdc" /* CommandName.CancelDragBlockToCanvas */, 'CancelDragBlockToCanvas'],
16
+ ["c" /* CommandName.Confirm */, 'Confirm'],
17
+ ["cb" /* CommandName.CreateBlock */, 'CreateBlock'],
18
+ ["cc" /* CommandName.CreateCollection */, 'CreateCollection'],
19
+ ["cds" /* CommandName.CreateDataSource */, 'CreateDataSource'],
20
+ ["cl" /* CommandName.CreateLine */, 'CreateLine'],
21
+ ["cp" /* CommandName.CreatePage */, 'CreatePage'],
22
+ ["die" /* CommandName.DataItemExists */, 'DataItemExists'],
23
+ ["di" /* CommandName.DeleteItem */, 'DeleteItem'],
24
+ ["dp" /* CommandName.DeletePage */, 'DeletePage'],
25
+ ["dsd" /* CommandName.DeleteShapeData */, 'DeleteShapeData'],
26
+ ["d" /* CommandName.Download */, 'Download'],
27
+ ["ee" /* CommandName.ElementExists */, 'ElementExists'],
28
+ ["ef" /* CommandName.ExecuteFormula */, 'ExecuteFormula'],
29
+ ["gcl" /* CommandName.GetConnectedLines */, 'GetConnectedLines'],
30
+ ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
31
+ ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
32
+ ["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
33
+ ["get" /* CommandName.GetElementType */, 'GetElementType'],
34
+ ["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
35
+ ["gp" /* CommandName.GetProperty */, 'GetProperty'],
36
+ ["grk" /* CommandName.GetReferenceKey */, 'GetReferenceKey'],
37
+ ["grlp" /* CommandName.GetRelativeLinePosition */, 'GetRelativeLinePosition'],
38
+ ["gs" /* CommandName.GetSelection */, 'GetSelection'],
39
+ ["gsd" /* CommandName.GetShapeData */, 'GetShapeData'],
40
+ ["hm" /* CommandName.HideModal */, 'HideModal'],
41
+ ["hp" /* CommandName.HidePanel */, 'HidePanel'],
42
+ ["hci" /* CommandName.HookCreateItems */, 'HookCreateItems'],
43
+ ["hs" /* CommandName.HookSelection */, 'HookSelection'],
44
+ ["hte" /* CommandName.HookTextEdit */, 'HookTextEdit'],
45
+ ["ic" /* CommandName.ImportCards */, 'ImportCards'],
46
+ ["k" /* CommandName.KillExtension */, 'KillExtension'],
47
+ ["lb" /* CommandName.ListBlocks */, 'ListBlocks'],
48
+ ["lcf" /* CommandName.ListCollectionFields */, 'ListCollectionFields'],
49
+ ["lc" /* CommandName.ListCollections */, 'ListCollections'],
50
+ ["ldi" /* CommandName.ListDataItems */, 'ListDataItems'],
51
+ ["lds" /* CommandName.ListDataSources */, 'ListDataSources'],
52
+ ["lg" /* CommandName.ListGroups */, 'ListGroups'],
53
+ ["ll" /* CommandName.ListLines */, 'ListLines'],
54
+ ["lp" /* CommandName.ListPages */, 'ListPages'],
55
+ ["lpr" /* CommandName.ListProperties */, 'ListProperties'],
56
+ ["lrk" /* CommandName.ListReferenceKeys */, 'ListReferenceKeys'],
57
+ ["lsd" /* CommandName.ListShapeData */, 'ListShapeData'],
58
+ ["lta" /* CommandName.ListTextAreas */, 'ListTextAreas'],
59
+ ["lbc" /* CommandName.LoadBlockClasses */, 'LoadBlockClasses'],
60
+ ["log" /* CommandName.LogForTestCase */, 'LogForTestCase'],
61
+ ["oi" /* CommandName.OffsetItems */, 'OffsetItems'],
62
+ ["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'],
63
+ ["rp" /* CommandName.RegisterPanel */, 'RegisterPanel'],
64
+ ["ru" /* CommandName.RegisterUnfurl */, 'RegisterUnfurl'],
65
+ ["r" /* CommandName.ReloadExtension */, 'ReloadExtension'],
66
+ ["oauth" /* CommandName.SendOAuthRequest */, 'SendOAuthRequest'],
67
+ ["suim" /* CommandName.SendUIMessage */, 'SendUIMessage'],
68
+ ["xhr" /* CommandName.SendXHR */, 'SendXHR'],
69
+ ["scp" /* CommandName.SetCurrentPage */, 'SetCurrentPage'],
70
+ ["sp" /* CommandName.SetProperty */, 'SetProperty'],
71
+ ["srk" /* CommandName.SetReferenceKey */, 'SetReferenceKey'],
72
+ ["ssd" /* CommandName.SetShapeData */, 'SetShapeData'],
73
+ ["sm" /* CommandName.ShowModal */, 'ShowModal'],
74
+ ["spn" /* CommandName.ShowPanel */, 'ShowPanel'],
75
+ ["sleep" /* CommandName.SleepForTestCase */, 'SleepForTestCase'],
76
+ ["sdc" /* CommandName.StartDragBlockToCanvas */, 'StartDragBlockToCanvas'],
77
+ ["throw" /* CommandName.ThrowForTestCase */, 'ThrowForTestCase'],
78
+ ["uci" /* CommandName.UnhookCreateItems */, 'UnhookCreateItems'],
79
+ ["us" /* CommandName.UnhookSelection */, 'UnhookSelection'],
80
+ ["ute" /* CommandName.UnhookTextEdit */, 'UnhookTextEdit'],
81
81
  ]);
82
82
  function isRawSendXHRResponse(val) {
83
83
  return (0, checks_1.isString)(val['url']) && (0, checks_1.isString)(val['t']) && (0, checks_1.isNumber)(val['s']) && (0, checks_1.isObject)(val['h']);
@@ -19,7 +19,16 @@ export declare enum FieldDisplayType {
19
19
  * Given a number, display the number in the bottom-left of the card. If the number is higher than 999,
20
20
  * display 999.
21
21
  */
22
- StandardEstimation = "StandardEstimation"
22
+ StandardEstimation = "StandardEstimation",
23
+ /**
24
+ * Given a URL, display a small image cropped into a circle in the lower-left of the card.
25
+ */
26
+ ImageBadge = "ImageBadge",
27
+ /**
28
+ * Given a date, display a small calendar icon alongside a very short version of the date
29
+ * as a string, e.g. "Sep 9"
30
+ */
31
+ DateBadge = "DateBadge"
23
32
  }
24
33
  export declare const isFieldDisplayType: (x: unknown) => x is FieldDisplayType;
25
34
  /**
@@ -30,9 +39,13 @@ export declare enum OnClickHandlerKeys {
30
39
  /**
31
40
  * Display the UI panel to edit fields on the data associated with the card
32
41
  */
33
- BasicEditPanel = "BasicEditPanel"
42
+ BasicEditPanel = "BasicEditPanel",
43
+ /**
44
+ * Open a new browser window to a URL specified by linkFormula
45
+ */
46
+ OpenBrowserWindow = "OpenBrowserWindow"
34
47
  }
35
- export declare const isOnClickHandlerKey: (x: unknown) => x is OnClickHandlerKeys.BasicEditPanel;
48
+ export declare const isOnClickHandlerKey: (x: unknown) => x is OnClickHandlerKeys;
36
49
  export interface StencilConfig {
37
50
  /**
38
51
  * How should we generate the stencil/data graphic from the specified field value?
@@ -48,6 +61,19 @@ export interface StencilConfig {
48
61
  * by starting the string with "=", e.g. "=darken("#ffffff", 0.5)"
49
62
  */
50
63
  backgroundColor?: string;
64
+ /**
65
+ * If specified, the result of this formula (executed in the context of the data item
66
+ * associated with this card) will be used instead of the raw field value when
67
+ * creating the data graphic. This can be useful if, for example, you see to convert
68
+ * an ID into a URL.
69
+ */
70
+ valueFormula?: string;
71
+ /**
72
+ * If specified, the result of this formula (executed in the context of the data item
73
+ * associated with this card) will be used as a tooltip when the user hovers the
74
+ * cursor over this data graphic.
75
+ */
76
+ tooltipFormula?: string;
51
77
  /**
52
78
  * Each display type has its default location on the card. You can override those
53
79
  * default locations by setting these values.
@@ -63,6 +89,10 @@ export interface StencilConfig {
63
89
  * generated via the above displayType?
64
90
  */
65
91
  onClickHandlerKey?: OnClickHandlerKeys;
92
+ /**
93
+ * If onClickHandlerKey is OpenBrowserWindow, this formula calculates the URL to open.
94
+ */
95
+ linkFormula?: string;
66
96
  }
67
97
  /**
68
98
  * Configuration settings for how to display a particular field on the card itself.
@@ -77,6 +107,9 @@ export declare type SerializedLucidCardFieldDisplaySettings = {
77
107
  /** Since renamed to displayType, but we can't change the serialized name */
78
108
  'getterKey': FieldDisplayType;
79
109
  'bg'?: string;
110
+ 'f'?: string;
111
+ 't'?: string;
112
+ 'l'?: string;
80
113
  'h'?: HorizontalBadgePos;
81
114
  'v'?: VerticalBadgePos;
82
115
  'onClickHandlerKey'?: OnClickHandlerKeys;
@@ -24,6 +24,15 @@ var FieldDisplayType;
24
24
  * display 999.
25
25
  */
26
26
  FieldDisplayType["StandardEstimation"] = "StandardEstimation";
27
+ /**
28
+ * Given a URL, display a small image cropped into a circle in the lower-left of the card.
29
+ */
30
+ FieldDisplayType["ImageBadge"] = "ImageBadge";
31
+ /**
32
+ * Given a date, display a small calendar icon alongside a very short version of the date
33
+ * as a string, e.g. "Sep 9"
34
+ */
35
+ FieldDisplayType["DateBadge"] = "DateBadge";
27
36
  })(FieldDisplayType = exports.FieldDisplayType || (exports.FieldDisplayType = {}));
28
37
  exports.isFieldDisplayType = (0, validators_1.enumValidator)(FieldDisplayType);
29
38
  /**
@@ -36,6 +45,10 @@ var OnClickHandlerKeys;
36
45
  * Display the UI panel to edit fields on the data associated with the card
37
46
  */
38
47
  OnClickHandlerKeys["BasicEditPanel"] = "BasicEditPanel";
48
+ /**
49
+ * Open a new browser window to a URL specified by linkFormula
50
+ */
51
+ OnClickHandlerKeys["OpenBrowserWindow"] = "OpenBrowserWindow";
39
52
  })(OnClickHandlerKeys = exports.OnClickHandlerKeys || (exports.OnClickHandlerKeys = {}));
40
53
  exports.isOnClickHandlerKey = (0, validators_1.enumValidator)(OnClickHandlerKeys);
41
54
  /** @ignore */
@@ -43,6 +56,9 @@ function serializeLucidCardFieldDisplaySettings(settings) {
43
56
  return {
44
57
  'StencilConfig': settings.stencilConfig && {
45
58
  'getterKey': settings.stencilConfig.displayType,
59
+ 'f': settings.stencilConfig.valueFormula,
60
+ 't': settings.stencilConfig.tooltipFormula,
61
+ 'l': settings.stencilConfig.linkFormula,
46
62
  'bg': settings.stencilConfig.backgroundColor,
47
63
  'h': settings.stencilConfig.horizontalPosition,
48
64
  'v': settings.stencilConfig.verticalPosition,
@@ -56,6 +72,9 @@ function deserializeLucidCardFieldDisplaySettings(settings) {
56
72
  return {
57
73
  stencilConfig: settings['StencilConfig'] && {
58
74
  displayType: settings['StencilConfig']['getterKey'],
75
+ valueFormula: settings['StencilConfig']['f'],
76
+ tooltipFormula: settings['StencilConfig']['t'],
77
+ linkFormula: settings['StencilConfig']['l'],
59
78
  backgroundColor: settings['StencilConfig']['bg'],
60
79
  horizontalPosition: settings['StencilConfig']['h'],
61
80
  verticalPosition: settings['StencilConfig']['v'],
@@ -23,7 +23,7 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
23
23
  * from the content of the data item, but may differ from the expected value in some circumstances, e.g. if
24
24
  * there are two data items that would have the same primary key.
25
25
  */
26
- this.items = new mapproxy_1.MapProxy(() => this.client.sendCommand("ldi" /* ListDataItems */, { 'id': this.id }), (primaryKey) => new dataitemproxy_1.DataItemProxy(primaryKey, this, this.client));
26
+ this.items = new mapproxy_1.MapProxy(() => this.client.sendCommand("ldi" /* CommandName.ListDataItems */, { 'id': this.id }), (primaryKey) => new dataitemproxy_1.DataItemProxy(primaryKey, this, this.client));
27
27
  }
28
28
  /**
29
29
  * @returns a human-readable name for this collection
@@ -51,7 +51,7 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
51
51
  changed[primaryKey] = record;
52
52
  }
53
53
  }
54
- return this.client.sendCommand("pdi" /* PatchDataItems */, {
54
+ return this.client.sendCommand("pdi" /* CommandName.PatchDataItems */, {
55
55
  'id': this.id,
56
56
  'a': (_a = patch.added) !== null && _a !== void 0 ? _a : [],
57
57
  'c': changed,
@@ -62,7 +62,7 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
62
62
  * @returns an array of field names that are accessible on the items in this collection
63
63
  */
64
64
  getFields() {
65
- return this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.id });
65
+ return this.client.sendCommand("lcf" /* CommandName.ListCollectionFields */, { 'id': this.id });
66
66
  }
67
67
  getSchema() {
68
68
  return (0, schemadefinition_1.parseSchemaDefinition)(this.properties.get('Schema'));
@@ -18,7 +18,7 @@ class DataItemProxy {
18
18
  /**
19
19
  * The fields on this data item, organized by their name.
20
20
  */
21
- this.fields = new mapproxy_1.MapProxy(() => this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.collection.id }), (name) => this.client.sendCommand("gdif" /* GetDataItemField */, {
21
+ this.fields = new mapproxy_1.MapProxy(() => this.client.sendCommand("lcf" /* CommandName.ListCollectionFields */, { 'id': this.collection.id }), (name) => this.client.sendCommand("gdif" /* CommandName.GetDataItemField */, {
22
22
  'c': this.collection.id,
23
23
  'pk': this.primaryKey,
24
24
  'f': name,
@@ -28,7 +28,7 @@ class DataItemProxy {
28
28
  * @returns True if a data item exists in this collection at this primary key
29
29
  */
30
30
  exists() {
31
- return this.client.sendCommand("die" /* DataItemExists */, { 'c': this.collection.id, 'pk': this.primaryKey });
31
+ return this.client.sendCommand("die" /* CommandName.DataItemExists */, { 'c': this.collection.id, 'pk': this.primaryKey });
32
32
  }
33
33
  }
34
34
  exports.DataItemProxy = DataItemProxy;
@@ -17,7 +17,7 @@ class DataProxy {
17
17
  * remain stable for as long as the data source exists on this document, but will vary from
18
18
  * the data source ID on other documents if the same data is imported there.
19
19
  */
20
- this.dataSources = new mapproxy_1.MapProxy(() => this.client.sendCommand("lds" /* ListDataSources */, undefined), (dataSourceId) => new datasourceproxy_1.DataSourceProxy(dataSourceId, this.client));
20
+ this.dataSources = new mapproxy_1.MapProxy(() => this.client.sendCommand("lds" /* CommandName.ListDataSources */, undefined), (dataSourceId) => new datasourceproxy_1.DataSourceProxy(dataSourceId, this.client));
21
21
  }
22
22
  /**
23
23
  * Creates a new empty data source, which you can then add collections of data to.
@@ -28,7 +28,7 @@ class DataProxy {
28
28
  * @returns the newly created data source
29
29
  */
30
30
  addDataSource(name, sourceConfig) {
31
- return new datasourceproxy_1.DataSourceProxy(this.client.sendCommand("cds" /* CreateDataSource */, { 'n': name, 's': sourceConfig }), this.client);
31
+ return new datasourceproxy_1.DataSourceProxy(this.client.sendCommand("cds" /* CommandName.CreateDataSource */, { 'n': name, 's': sourceConfig }), this.client);
32
32
  }
33
33
  }
34
34
  exports.DataProxy = DataProxy;
@@ -23,7 +23,7 @@ class DataSourceProxy extends propertystoreproxy_1.PropertyStoreProxy {
23
23
  * remain stable for as long as the collection exists on this document, but will vary from
24
24
  * the collection ID on other documents if the same data is imported there.
25
25
  */
26
- this.collections = new mapproxy_1.MapProxy(() => this.client.sendCommand("lc" /* ListCollections */, { 'id': this.id }), (id) => new collectionproxy_1.CollectionProxy(id, this.client));
26
+ this.collections = new mapproxy_1.MapProxy(() => this.client.sendCommand("lc" /* CommandName.ListCollections */, { 'id': this.id }), (id) => new collectionproxy_1.CollectionProxy(id, this.client));
27
27
  }
28
28
  /**
29
29
  * Create a new collection as part of this data source.
@@ -32,7 +32,7 @@ class DataSourceProxy extends propertystoreproxy_1.PropertyStoreProxy {
32
32
  * @returns The newly created collection
33
33
  */
34
34
  addCollection(name, schema) {
35
- return new collectionproxy_1.CollectionProxy(this.client.sendCommand("cc" /* CreateCollection */, {
35
+ return new collectionproxy_1.CollectionProxy(this.client.sendCommand("cc" /* CommandName.CreateCollection */, {
36
36
  's': this.id,
37
37
  'n': name,
38
38
  'f': schema.fields.map((field) => {
@@ -7,7 +7,7 @@ class CustomBlockProxy extends blockproxy_1.BlockProxy {
7
7
  isFromStencil(library, shape) {
8
8
  const stencil = this.properties.get('Stencil');
9
9
  if ((0, checks_1.isObject)(stencil)) {
10
- const sourceStencil = this.client.sendCommand("gp" /* GetProperty */, { 'p': 'Stencil-' + stencil['id'] });
10
+ const sourceStencil = this.client.sendCommand("gp" /* CommandName.GetProperty */, { 'p': 'Stencil-' + stencil['id'] });
11
11
  if ((0, checks_1.isObject)(sourceStencil) && (0, checks_1.isObject)(sourceStencil['sourcePackage'])) {
12
12
  return (sourceStencil['sourcePackage']['packageId'] === lucid.getPackageId() &&
13
13
  sourceStencil['sourcePackage']['library'] === library &&
@@ -63,7 +63,7 @@ class BlockProxy extends itemproxy_1.ItemProxy {
63
63
  * @returns An array of lines that have one or both endpoints connected to this block.
64
64
  */
65
65
  getConnectedLines() {
66
- const ids = this.client.sendCommand("gcl" /* GetConnectedLines */, this.id);
66
+ const ids = this.client.sendCommand("gcl" /* CommandName.GetConnectedLines */, this.id);
67
67
  return ids.map((id) => this.client.getLineProxy(id));
68
68
  }
69
69
  /**
@@ -13,7 +13,7 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
13
13
  /**
14
14
  * The set of pages on this document, organized by ID
15
15
  */
16
- this.pages = new mapproxy_1.MapProxy(() => this.client.sendCommand("lp" /* ListPages */, undefined), (pageId) => new pageproxy_1.PageProxy(pageId, this.client));
16
+ this.pages = new mapproxy_1.MapProxy(() => this.client.sendCommand("lp" /* CommandName.ListPages */, undefined), (pageId) => new pageproxy_1.PageProxy(pageId, this.client));
17
17
  }
18
18
  static getNextHookName() {
19
19
  return '__documentproxy__hook' + DocumentProxy.nextHookId++;
@@ -34,7 +34,7 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
34
34
  * @returns The created page
35
35
  */
36
36
  addPage(def) {
37
- const id = this.client.sendCommand("cp" /* CreatePage */, undefined);
37
+ const id = this.client.sendCommand("cp" /* CommandName.CreatePage */, undefined);
38
38
  const page = new pageproxy_1.PageProxy(id, this.client);
39
39
  page.setTitle(def.title);
40
40
  return page;
@@ -69,7 +69,7 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
69
69
  this.client.registerAction(actionName, (msg) => {
70
70
  callback(msg['ids'].map((id) => this.client.getItemProxy(id)));
71
71
  });
72
- this.client.sendCommand("hci" /* HookCreateItems */, { 'n': actionName });
72
+ this.client.sendCommand("hci" /* CommandName.HookCreateItems */, { 'n': actionName });
73
73
  return actionName;
74
74
  }
75
75
  /**
@@ -77,7 +77,7 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
77
77
  */
78
78
  unhookCreateItems(handle) {
79
79
  this.client.deleteAction(handle);
80
- this.client.sendCommand("uci" /* UnhookCreateItems */, { 'n': handle });
80
+ this.client.sendCommand("uci" /* CommandName.UnhookCreateItems */, { 'n': handle });
81
81
  }
82
82
  }
83
83
  exports.DocumentProxy = DocumentProxy;
@@ -30,7 +30,7 @@ class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
30
30
  * All shape data accessible on this element, including shape data inherited from the page or a containing group.
31
31
  * This collection is read-only.
32
32
  */
33
- this.allShapeData = new mapproxy_1.MapProxy(() => this.client.sendCommand("lsd" /* ListShapeData */, { 'id': this.id, 'i': true }), (name) => shapedataproxy_1.ShapeDataProxy.parseData(this.client.sendCommand("gsd" /* GetShapeData */, {
33
+ this.allShapeData = new mapproxy_1.MapProxy(() => this.client.sendCommand("lsd" /* CommandName.ListShapeData */, { 'id': this.id, 'i': true }), (name) => shapedataproxy_1.ShapeDataProxy.parseData(this.client.sendCommand("gsd" /* CommandName.GetShapeData */, {
34
34
  'id': this.id,
35
35
  'n': name,
36
36
  })));
@@ -39,7 +39,7 @@ class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
39
39
  *
40
40
  * For more information, see the [Developer Guide](/extension-api#guide-reference-keys).
41
41
  */
42
- this.referenceKeys = new mapproxy_1.MapProxy(() => this.client.sendCommand("lrk" /* ListReferenceKeys */, { 'id': this.id }), (key) => new referencekeyproxy_1.ReferenceKeyProxy(this.id, key, this.client, this.client.sendCommand("grk" /* GetReferenceKey */, { 'id': this.id, 'k': key })));
42
+ this.referenceKeys = new mapproxy_1.MapProxy(() => this.client.sendCommand("lrk" /* CommandName.ListReferenceKeys */, { 'id': this.id }), (key) => new referencekeyproxy_1.ReferenceKeyProxy(this.id, key, this.client, this.client.sendCommand("grk" /* CommandName.GetReferenceKey */, { 'id': this.id, 'k': key })));
43
43
  }
44
44
  /**
45
45
  * Set a reference key on this element, replacing any existing reference at the specified key.
@@ -48,7 +48,7 @@ class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
48
48
  * @param settings
49
49
  */
50
50
  setReferenceKey(key, settings) {
51
- this.client.sendCommand("srk" /* SetReferenceKey */, {
51
+ this.client.sendCommand("srk" /* CommandName.SetReferenceKey */, {
52
52
  'id': this.id,
53
53
  'k': key,
54
54
  'v': (0, referencekeydefinition_1.serializeReferenceKeyDefinition)(settings),
@@ -59,13 +59,13 @@ class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
59
59
  * @param key
60
60
  */
61
61
  removeReferenceKey(key) {
62
- this.client.sendCommand("srk" /* SetReferenceKey */, { 'id': this.id, 'k': key });
62
+ this.client.sendCommand("srk" /* CommandName.SetReferenceKey */, { 'id': this.id, 'k': key });
63
63
  }
64
64
  /**
65
65
  * @returns `true` if this element still exists on the document, or `false` otherwise
66
66
  */
67
67
  exists() {
68
- return this.client.sendCommand("ee" /* ElementExists */, { 'id': this.id });
68
+ return this.client.sendCommand("ee" /* CommandName.ElementExists */, { 'id': this.id });
69
69
  }
70
70
  /**
71
71
  * Execute a formula in the context of this element
@@ -73,7 +73,7 @@ class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
73
73
  * @returns The result of the formula, or an error.
74
74
  */
75
75
  executeFormula(formula) {
76
- return shapedataproxy_1.ShapeDataProxy.parseData(this.client.sendCommand("ef" /* ExecuteFormula */, { 'id': this.id || '', 'f': formula }));
76
+ return shapedataproxy_1.ShapeDataProxy.parseData(this.client.sendCommand("ef" /* CommandName.ExecuteFormula */, { 'id': this.id || '', 'f': formula }));
77
77
  }
78
78
  }
79
79
  exports.ElementProxy = ElementProxy;
@@ -13,27 +13,27 @@ class GroupProxy extends itemproxy_1.ItemProxy {
13
13
  /**
14
14
  * The blocks that are directly contained in this group, organized by ID.
15
15
  */
16
- this.blocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* ListBlocks */, { 'id': this.id }), (id) => this.client.getBlockProxy(id));
16
+ this.blocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* CommandName.ListBlocks */, { 'id': this.id }), (id) => this.client.getBlockProxy(id));
17
17
  /**
18
18
  * The lines that are directly contained in this group, organized by ID.
19
19
  */
20
- this.lines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* ListLines */, { 'id': this.id }), (id) => new lineproxy_1.LineProxy(id, this.client));
20
+ this.lines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* CommandName.ListLines */, { 'id': this.id }), (id) => new lineproxy_1.LineProxy(id, this.client));
21
21
  /**
22
22
  * The groups that are directly contained in this group, organized by ID.
23
23
  */
24
- this.groups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* ListGroups */, { 'id': this.id }), (id) => new GroupProxy(id, this.client));
24
+ this.groups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* CommandName.ListGroups */, { 'id': this.id }), (id) => new GroupProxy(id, this.client));
25
25
  /**
26
26
  * The blocks that are contained in this group, including those nested in deeper groups, organized by ID.
27
27
  */
28
- this.allBlocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* ListBlocks */, { 'id': this.id, 'd': true }), (id) => this.client.getBlockProxy(id));
28
+ this.allBlocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* CommandName.ListBlocks */, { 'id': this.id, 'd': true }), (id) => this.client.getBlockProxy(id));
29
29
  /**
30
30
  * The lines that are contained in this group, including those nested in deeper groups, organized by ID.
31
31
  */
32
- this.allLines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* ListLines */, { 'id': this.id, 'd': true }), (id) => new lineproxy_1.LineProxy(id, this.client));
32
+ this.allLines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* CommandName.ListLines */, { 'id': this.id, 'd': true }), (id) => new lineproxy_1.LineProxy(id, this.client));
33
33
  /**
34
34
  * The groups that are contained in this group, including those nested in deeper groups, organized by ID.
35
35
  */
36
- this.allGroups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* ListGroups */, { 'id': this.id, 'd': true }), (id) => new GroupProxy(id, this.client));
36
+ this.allGroups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* CommandName.ListGroups */, { 'id': this.id, 'd': true }), (id) => new GroupProxy(id, this.client));
37
37
  }
38
38
  }
39
39
  exports.GroupProxy = GroupProxy;
@@ -18,10 +18,10 @@ class ItemProxy extends elementproxy_1.ElementProxy {
18
18
  /**
19
19
  * The plain text in each of the text areas on this item, organized by text area name.
20
20
  */
21
- this.textAreas = new mapproxy_1.WriteableMapProxy(() => this.client.sendCommand("lta" /* ListTextAreas */, this.id), (name) => this.client.sendCommand("gp" /* GetProperty */, {
21
+ this.textAreas = new mapproxy_1.WriteableMapProxy(() => this.client.sendCommand("lta" /* CommandName.ListTextAreas */, this.id), (name) => this.client.sendCommand("gp" /* CommandName.GetProperty */, {
22
22
  'id': this.id,
23
23
  'p': name,
24
- }), (name, plainText, options) => this.client.sendCommand("st" /* SetText */, {
24
+ }), (name, plainText, options) => this.client.sendCommand("st" /* CommandName.SetText */, {
25
25
  'id': this.id,
26
26
  'n': name,
27
27
  't': plainText,
@@ -64,7 +64,7 @@ class ItemProxy extends elementproxy_1.ElementProxy {
64
64
  * @returns The page containing this item
65
65
  */
66
66
  getPage() {
67
- return this.client.getPageProxy(this.client.sendCommand("gip" /* GetItemPageId */, this.id));
67
+ return this.client.getPageProxy(this.client.sendCommand("gip" /* CommandName.GetItemPageId */, this.id));
68
68
  }
69
69
  /**
70
70
  * @returns The x/y location of this item
@@ -89,13 +89,13 @@ class ItemProxy extends elementproxy_1.ElementProxy {
89
89
  * @param offset The amount to offset
90
90
  */
91
91
  offset(type, offset) {
92
- this.client.sendCommand("oi" /* OffsetItems */, { 'ids': [this.id], 't': type, 'o': offset });
92
+ this.client.sendCommand("oi" /* CommandName.OffsetItems */, { 'ids': [this.id], 't': type, 'o': offset });
93
93
  }
94
94
  /**
95
95
  * Delete this item from the document
96
96
  */
97
97
  delete() {
98
- this.client.sendCommand("di" /* DeleteItem */, this.id);
98
+ this.client.sendCommand("di" /* CommandName.DeleteItem */, this.id);
99
99
  }
100
100
  /**
101
101
  * @returns An array of blocks whose bounding boxes contain this item's upper-left corner
@@ -128,7 +128,7 @@ class LineProxy extends itemproxy_1.ItemProxy {
128
128
  * @returns A list of lines whose endpoints are connected to this line
129
129
  */
130
130
  getConnectedLines() {
131
- const ids = this.client.sendCommand("gcl" /* GetConnectedLines */, this.id);
131
+ const ids = this.client.sendCommand("gcl" /* CommandName.GetConnectedLines */, this.id);
132
132
  return ids.map((id) => this.client.getLineProxy(id));
133
133
  }
134
134
  /**
@@ -136,7 +136,7 @@ class LineProxy extends itemproxy_1.ItemProxy {
136
136
  * @returns The coordinate of that relative position, relative to the containing page
137
137
  */
138
138
  getRelativePosition(relative) {
139
- return this.client.sendCommand("grlp" /* GetRelativeLinePosition */, { 'id': this.id, 'p': relative });
139
+ return this.client.sendCommand("grlp" /* CommandName.GetRelativeLinePosition */, { 'id': this.id, 'p': relative });
140
140
  }
141
141
  /**
142
142
  *
@@ -169,7 +169,7 @@ class LineProxy extends itemproxy_1.ItemProxy {
169
169
  * @returns The name of the text area added
170
170
  */
171
171
  addTextArea(text, position) {
172
- return this.client.sendCommand("alta" /* AddLineTextArea */, {
172
+ return this.client.sendCommand("alta" /* CommandName.AddLineTextArea */, {
173
173
  'id': this.id,
174
174
  'p': (0, linetextareapositioning_1.serializeLineTextAreaPositioning)(position),
175
175
  't': text,
@@ -19,27 +19,27 @@ class PageProxy extends elementproxy_1.ElementProxy {
19
19
  /**
20
20
  * The blocks contained directly on this page, not including ones inside groups
21
21
  */
22
- this.blocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* ListBlocks */, { id: this.id }), (id) => this.client.getBlockProxy(id));
22
+ this.blocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* CommandName.ListBlocks */, { id: this.id }), (id) => this.client.getBlockProxy(id));
23
23
  /**
24
24
  * The lines contained directly on this page, not including ones inside groups
25
25
  */
26
- this.lines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* ListLines */, { id: this.id }), (id) => new lineproxy_1.LineProxy(id, this.client));
26
+ this.lines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* CommandName.ListLines */, { id: this.id }), (id) => new lineproxy_1.LineProxy(id, this.client));
27
27
  /**
28
28
  * The groups contained directly on this page, not including ones inside groups
29
29
  */
30
- this.groups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* ListGroups */, { id: this.id }), (id) => new groupproxy_1.GroupProxy(id, this.client));
30
+ this.groups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* CommandName.ListGroups */, { id: this.id }), (id) => new groupproxy_1.GroupProxy(id, this.client));
31
31
  /**
32
32
  * The blocks contained on this page, including ones inside groups
33
33
  */
34
- this.allBlocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* ListBlocks */, { id: this.id, d: true }), (id) => this.client.getBlockProxy(id));
34
+ this.allBlocks = new mapproxy_1.MapProxy(() => this.client.sendCommand("lb" /* CommandName.ListBlocks */, { id: this.id, d: true }), (id) => this.client.getBlockProxy(id));
35
35
  /**
36
36
  * The lines contained on this page, including ones inside groups
37
37
  */
38
- this.allLines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* ListLines */, { id: this.id, d: true }), (id) => new lineproxy_1.LineProxy(id, this.client));
38
+ this.allLines = new mapproxy_1.MapProxy(() => this.client.sendCommand("ll" /* CommandName.ListLines */, { id: this.id, d: true }), (id) => new lineproxy_1.LineProxy(id, this.client));
39
39
  /**
40
40
  * The groups contained on this page, including ones inside groups
41
41
  */
42
- this.allGroups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* ListGroups */, { id: this.id, d: true }), (id) => new groupproxy_1.GroupProxy(id, this.client));
42
+ this.allGroups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* CommandName.ListGroups */, { id: this.id, d: true }), (id) => new groupproxy_1.GroupProxy(id, this.client));
43
43
  }
44
44
  /**
45
45
  * Add a new block to this page.
@@ -52,7 +52,7 @@ class PageProxy extends elementproxy_1.ElementProxy {
52
52
  * @returns The added block
53
53
  */
54
54
  addBlock(def) {
55
- const id = this.client.sendCommand("cb" /* CreateBlock */, {
55
+ const id = this.client.sendCommand("cb" /* CommandName.CreateBlock */, {
56
56
  'p': this.id,
57
57
  'c': def.className,
58
58
  's': def.stencil,
@@ -78,7 +78,7 @@ class PageProxy extends elementproxy_1.ElementProxy {
78
78
  * @returns The added line
79
79
  */
80
80
  addLine(def) {
81
- const id = this.client.sendCommand("cl" /* CreateLine */, {
81
+ const id = this.client.sendCommand("cl" /* CommandName.CreateLine */, {
82
82
  'p': this.id,
83
83
  });
84
84
  const line = new lineproxy_1.LineProxy(id, this.client);
@@ -103,7 +103,7 @@ class PageProxy extends elementproxy_1.ElementProxy {
103
103
  * Delete this page from the document if possible
104
104
  */
105
105
  delete() {
106
- this.client.sendCommand("dp" /* DeletePage */, this.id);
106
+ this.client.sendCommand("dp" /* CommandName.DeletePage */, this.id);
107
107
  }
108
108
  }
109
109
  exports.PageProxy = PageProxy;
@@ -19,14 +19,14 @@ class PropertyStoreProxy {
19
19
  * Not all properties are writeable (e.g. "ClassName" on a block).
20
20
  * To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.
21
21
  */
22
- this.properties = new mapproxy_1.WriteableMapProxy(() => this.client.sendCommand("lpr" /* ListProperties */, { 'id': this.id }), (name) => this.client.sendCommand("gp" /* GetProperty */, {
22
+ this.properties = new mapproxy_1.WriteableMapProxy(() => this.client.sendCommand("lpr" /* CommandName.ListProperties */, { 'id': this.id }), (name) => this.client.sendCommand("gp" /* CommandName.GetProperty */, {
23
23
  'id': this.id,
24
24
  'p': name,
25
25
  }), (name, value) => {
26
26
  if (name === 'BoundingBox') {
27
27
  throw new Error('Do not use properties.set() to move or resize items; use setLocation() or setBoundingBox() or offset()');
28
28
  }
29
- this.client.sendCommand("sp" /* SetProperty */, {
29
+ this.client.sendCommand("sp" /* CommandName.SetProperty */, {
30
30
  'id': this.id,
31
31
  'p': name,
32
32
  'v': value,
@@ -15,7 +15,7 @@ class ShapeDataProxy extends mapproxy_1.WriteableMapProxy {
15
15
  * @param client
16
16
  */
17
17
  constructor(id, client) {
18
- super(() => this.client.sendCommand("lsd" /* ListShapeData */, { 'id': this.id }), (name) => ShapeDataProxy.parseData(this.client.sendCommand("gsd" /* GetShapeData */, {
18
+ super(() => this.client.sendCommand("lsd" /* CommandName.ListShapeData */, { 'id': this.id }), (name) => ShapeDataProxy.parseData(this.client.sendCommand("gsd" /* CommandName.GetShapeData */, {
19
19
  'id': this.id,
20
20
  'n': name,
21
21
  })), (name, value) => {
@@ -23,10 +23,10 @@ class ShapeDataProxy extends mapproxy_1.WriteableMapProxy {
23
23
  throw new Error('Cannot store an error value');
24
24
  }
25
25
  if (this.keys().includes(name)) {
26
- this.client.sendCommand("ssd" /* SetShapeData */, { 'id': this.id, 'n': name, 'v': value });
26
+ this.client.sendCommand("ssd" /* CommandName.SetShapeData */, { 'id': this.id, 'n': name, 'v': value });
27
27
  }
28
28
  else {
29
- this.client.sendCommand("asd" /* AddShapeData */, {
29
+ this.client.sendCommand("asd" /* CommandName.AddShapeData */, {
30
30
  'id': this.id,
31
31
  'i': shapedatainheritance_1.ShapeDataInheritance.NONE,
32
32
  'n': name,
@@ -43,7 +43,7 @@ class ShapeDataProxy extends mapproxy_1.WriteableMapProxy {
43
43
  */
44
44
  delete(key) {
45
45
  if (this.keys().includes(key)) {
46
- this.client.sendCommand("dsd" /* DeleteShapeData */, { 'id': this.id, 'n': key });
46
+ this.client.sendCommand("dsd" /* CommandName.DeleteShapeData */, { 'id': this.id, 'n': key });
47
47
  }
48
48
  }
49
49
  /** @ignore */
@@ -87,10 +87,10 @@ class TaskManagementCardIntegration {
87
87
  };
88
88
  });
89
89
  }
90
- this.client.sendCommand("aci" /* AddCardIntegration */, serialized);
90
+ this.client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
91
91
  }
92
92
  showCardImport(name) {
93
- return this.client.sendCommand("ic" /* ImportCards */, name);
93
+ return this.client.sendCommand("ic" /* CommandName.ImportCards */, name);
94
94
  }
95
95
  }
96
96
  exports.TaskManagementCardIntegration = TaskManagementCardIntegration;
@@ -45,13 +45,13 @@ class EditorClient {
45
45
  * Unload this extension immediately, removing any custom menu items etc., until the user refreshes the browser tab.
46
46
  */
47
47
  killExtension() {
48
- this.sendCommand("k" /* KillExtension */, undefined);
48
+ this.sendCommand("k" /* CommandName.KillExtension */, undefined);
49
49
  }
50
50
  /**
51
51
  * Unload this extension, and then re-execute it.
52
52
  */
53
53
  reloadExtension() {
54
- this.sendCommand("r" /* ReloadExtension */, undefined);
54
+ this.sendCommand("r" /* CommandName.ReloadExtension */, undefined);
55
55
  }
56
56
  /**
57
57
  * Initiate a browser file download of custom content
@@ -61,7 +61,7 @@ class EditorClient {
61
61
  * @param base64 If true, base64 decode the data before downloading it
62
62
  */
63
63
  download(filename, data, mime, base64) {
64
- this.sendCommand("d" /* Download */, {
64
+ this.sendCommand("d" /* CommandName.Download */, {
65
65
  'f': filename,
66
66
  'd': data,
67
67
  'm': mime,
@@ -78,7 +78,7 @@ class EditorClient {
78
78
  * @ignore
79
79
  */
80
80
  async experimentalCreateUserImage(mediaType, data) {
81
- const result = await this.sendCommand("cui" /* CreateUserImage */, {
81
+ const result = await this.sendCommand("cui" /* CommandName.CreateUserImage */, {
82
82
  't': mediaType,
83
83
  'd': (0, checks_1.isString)(data) ? data : (0, base64_1.encodeBase64)(data),
84
84
  });
@@ -95,7 +95,7 @@ class EditorClient {
95
95
  * @throws A string with an error from the data sync server
96
96
  */
97
97
  async performDataAction(flowName, dataConnectorName, syncDataSourceId = undefined, flowData = undefined, async = true) {
98
- const result = await this.sendCommand("da" /* DataAction */, {
98
+ const result = await this.sendCommand("da" /* CommandName.DataAction */, {
99
99
  'fn': flowName,
100
100
  'a': async,
101
101
  's': syncDataSourceId,
@@ -114,7 +114,7 @@ class EditorClient {
114
114
  };
115
115
  }
116
116
  async awaitDataImport(dataConnectorName, syncDataSourceId, syncCollectionId, primaryKeys, timeout = 30000) {
117
- return new collectionproxy_1.CollectionProxy(await this.sendCommand("ai" /* AwaitImport */, {
117
+ return new collectionproxy_1.CollectionProxy(await this.sendCommand("ai" /* CommandName.AwaitImport */, {
118
118
  'n': dataConnectorName,
119
119
  's': syncDataSourceId,
120
120
  'c': syncCollectionId,
@@ -124,7 +124,7 @@ class EditorClient {
124
124
  }
125
125
  xhr(request) {
126
126
  const responseFormat = request.responseFormat || 'utf8';
127
- return this.sendCommand("xhr" /* SendXHR */, {
127
+ return this.sendCommand("xhr" /* CommandName.SendXHR */, {
128
128
  'url': request.url,
129
129
  'm': request.method,
130
130
  'd': request.data,
@@ -142,7 +142,7 @@ class EditorClient {
142
142
  }
143
143
  oauthXhr(providerName, request) {
144
144
  const responseFormat = request.responseFormat || 'utf8';
145
- return this.sendCommand("oauth" /* SendOAuthRequest */, {
145
+ return this.sendCommand("oauth" /* CommandName.SendOAuthRequest */, {
146
146
  'url': request.url,
147
147
  'm': request.method,
148
148
  'd': request.data,
@@ -234,7 +234,7 @@ class EditorClient {
234
234
  }
235
235
  return undefined;
236
236
  });
237
- this.sendCommand("ru" /* RegisterUnfurl */, { 'd': domain, 'a': action });
237
+ this.sendCommand("ru" /* CommandName.RegisterUnfurl */, { 'd': domain, 'a': action });
238
238
  }
239
239
  /**
240
240
  * Remove the callback for a given action. If the action is later invoked, nothing will happen.
@@ -273,7 +273,7 @@ class EditorClient {
273
273
  * @returns the given block
274
274
  */
275
275
  getBlockProxy(id) {
276
- const className = this.sendCommand("gp" /* GetProperty */, { 'id': id, 'p': 'ClassName' });
276
+ const className = this.sendCommand("gp" /* CommandName.GetProperty */, { 'id': id, 'p': 'ClassName' });
277
277
  const proxy = (0, blockproxyregistry_1.findProxyClass)(className);
278
278
  if (proxy) {
279
279
  return new proxy(id, this);
@@ -292,7 +292,7 @@ class EditorClient {
292
292
  * @returns a promise that resolves when the block classes can be used to create new blocks on the document
293
293
  */
294
294
  loadBlockClasses(classNames) {
295
- return this.sendCommand("lbc" /* LoadBlockClasses */, classNames);
295
+ return this.sendCommand("lbc" /* CommandName.LoadBlockClasses */, classNames);
296
296
  }
297
297
  /**
298
298
  * Load the requested shape library's content, and if it was found, return a block definition ready to be
@@ -325,7 +325,7 @@ class EditorClient {
325
325
  */
326
326
  async getCustomShapeDefinition(library, shape) {
327
327
  await this.loadBlockClasses(['CustomBlock']);
328
- const shapeData = await this.sendCommand("gcs" /* GetCustomShape */, { 'l': library, 's': shape });
328
+ const shapeData = await this.sendCommand("gcs" /* CommandName.GetCustomShape */, { 'l': library, 's': shape });
329
329
  if (shapeData) {
330
330
  return {
331
331
  className: 'CustomBlock',
@@ -356,7 +356,7 @@ class EditorClient {
356
356
  this.registerAction(name, (msg) => {
357
357
  return callback(msg['d']);
358
358
  });
359
- await this.sendCommand("b" /* Bootstrap */, { 'c': name, 'm': markExtensionAsRequired });
359
+ await this.sendCommand("b" /* CommandName.Bootstrap */, { 'c': name, 'm': markExtensionAsRequired });
360
360
  this.deleteAction(name);
361
361
  }
362
362
  /**
@@ -378,7 +378,7 @@ class EditorClient {
378
378
  * @returns the given item
379
379
  */
380
380
  getItemProxy(id) {
381
- const type = this.sendCommand("get" /* GetElementType */, { 'id': id });
381
+ const type = this.sendCommand("get" /* CommandName.GetElementType */, { 'id': id });
382
382
  switch (type) {
383
383
  case 'block':
384
384
  return this.getBlockProxy(id);
@@ -395,7 +395,7 @@ class EditorClient {
395
395
  * @returns the given element
396
396
  */
397
397
  getElementProxy(id) {
398
- const type = this.sendCommand("get" /* GetElementType */, { 'id': id });
398
+ const type = this.sendCommand("get" /* CommandName.GetElementType */, { 'id': id });
399
399
  switch (type) {
400
400
  case 'block':
401
401
  return this.getBlockProxy(id);
@@ -428,7 +428,7 @@ class EditorClient {
428
428
  * @returns a Promise that resolves true if the user clicks OK, false if they otherwise dismiss the modal
429
429
  */
430
430
  alert(text, title, buttonText) {
431
- return this.sendCommand("a" /* Alert */, { 't': title, 'b': text, 'bt': buttonText });
431
+ return this.sendCommand("a" /* CommandName.Alert */, { 't': title, 'b': text, 'bt': buttonText });
432
432
  }
433
433
  /**
434
434
  * Display a confirm modal to the user
@@ -439,7 +439,7 @@ class EditorClient {
439
439
  * @returns a Promise that resolves true if the user clicks OK, false if they click Cancel or otherwise dismiss the modal
440
440
  */
441
441
  confirm(text, title, okText, cancelText) {
442
- return this.sendCommand("c" /* Confirm */, { 't': title, 'b': text, 'o': okText, 'c': cancelText });
442
+ return this.sendCommand("c" /* CommandName.Confirm */, { 't': title, 'b': text, 'o': okText, 'c': cancelText });
443
443
  }
444
444
  }
445
445
  exports.EditorClient = EditorClient;
package/sdk/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -57,7 +57,7 @@ class IframeUI {
57
57
  */
58
58
  sendMessage(data) {
59
59
  if (this.loaded) {
60
- this.client.sendCommand("suim" /* SendUIMessage */, {
60
+ this.client.sendCommand("suim" /* CommandName.SendUIMessage */, {
61
61
  'n': this.messageActionName,
62
62
  'd': data,
63
63
  });
package/sdk/ui/menu.js CHANGED
@@ -41,7 +41,7 @@ class Menu {
41
41
  if (item.disabledAction && !this.client.actionExists(item.disabledAction)) {
42
42
  throw new Error('Unregistered action: ' + item.disabledAction);
43
43
  }
44
- this.client.sendCommand("ami" /* AddMenuItem */, {
44
+ this.client.sendCommand("ami" /* CommandName.AddMenuItem */, {
45
45
  'l': item.label,
46
46
  'a': item.action,
47
47
  'v': item.visibleAction,
package/sdk/ui/modal.js CHANGED
@@ -24,7 +24,7 @@ class Modal extends iframeui_1.IframeUI {
24
24
  show() {
25
25
  if (!this.visible) {
26
26
  this.hookMessages();
27
- this.client.sendCommand("sm" /* ShowModal */, {
27
+ this.client.sendCommand("sm" /* CommandName.ShowModal */, {
28
28
  'n': this.messageActionName,
29
29
  't': this.config.title,
30
30
  'w': this.config.width,
@@ -39,7 +39,7 @@ class Modal extends iframeui_1.IframeUI {
39
39
  */
40
40
  hide() {
41
41
  if (this.visible) {
42
- this.client.sendCommand("hm" /* HideModal */, { 'n': this.messageActionName });
42
+ this.client.sendCommand("hm" /* CommandName.HideModal */, { 'n': this.messageActionName });
43
43
  this.visible = false;
44
44
  }
45
45
  }
package/sdk/ui/panel.js CHANGED
@@ -27,7 +27,7 @@ class Panel extends iframeui_1.IframeUI {
27
27
  super(client);
28
28
  this.config = config;
29
29
  this.hookMessages();
30
- this.client.sendCommand("rp" /* RegisterPanel */, {
30
+ this.client.sendCommand("rp" /* CommandName.RegisterPanel */, {
31
31
  'n': this.messageActionName,
32
32
  't': this.config.title,
33
33
  'l': this.config.location,
@@ -40,13 +40,13 @@ class Panel extends iframeui_1.IframeUI {
40
40
  * Show this panel in its specified location, if it is not already visible.
41
41
  */
42
42
  show() {
43
- this.client.sendCommand("spn" /* ShowPanel */, { 'n': this.messageActionName });
43
+ this.client.sendCommand("spn" /* CommandName.ShowPanel */, { 'n': this.messageActionName });
44
44
  }
45
45
  /**
46
46
  * Hide this panel if it is currently visible.
47
47
  */
48
48
  hide() {
49
- this.client.sendCommand("hp" /* HidePanel */, { 'n': this.messageActionName });
49
+ this.client.sendCommand("hp" /* CommandName.HidePanel */, { 'n': this.messageActionName });
50
50
  }
51
51
  }
52
52
  exports.Panel = Panel;
@@ -18,7 +18,7 @@ class Viewport {
18
18
  * @returns An array of currently-selected items on the currently-visible page
19
19
  */
20
20
  getSelectedItems(deep) {
21
- const ids = this.client.sendCommand("gs" /* GetSelection */, { 'd': deep });
21
+ const ids = this.client.sendCommand("gs" /* CommandName.GetSelection */, { 'd': deep });
22
22
  return ids
23
23
  .map((id) => this.client.getElementProxy(id))
24
24
  .filter((proxy) => proxy instanceof itemproxy_1.ItemProxy);
@@ -27,7 +27,7 @@ class Viewport {
27
27
  * @returns the page currently being viewed
28
28
  */
29
29
  getCurrentPage() {
30
- const id = this.client.sendCommand("gcp" /* GetCurrentPage */, undefined);
30
+ const id = this.client.sendCommand("gcp" /* CommandName.GetCurrentPage */, undefined);
31
31
  return id == null ? id : new pageproxy_1.PageProxy(id, this.client);
32
32
  }
33
33
  /**
@@ -35,7 +35,7 @@ class Viewport {
35
35
  * @param page The page to view
36
36
  */
37
37
  setCurrentPage(page) {
38
- this.client.sendCommand("scp" /* SetCurrentPage */, page.id);
38
+ this.client.sendCommand("scp" /* CommandName.SetCurrentPage */, page.id);
39
39
  }
40
40
  /**
41
41
  * Switch to the page containing these items, if necessary, and then animate the viewport
@@ -46,7 +46,7 @@ class Viewport {
46
46
  const bb = (0, math_1.combinedBoundingBox)(items.map((e) => e.getBoundingBox()));
47
47
  if (bb) {
48
48
  //TODO: A reasonable max zoom level (e.g. 200%)
49
- this.client.sendCommand("av" /* AnimateViewport */, {
49
+ this.client.sendCommand("av" /* CommandName.AnimateViewport */, {
50
50
  'bb': (0, math_1.padBox)(bb, 80),
51
51
  'p': items[0].getPage().id,
52
52
  });
@@ -90,7 +90,7 @@ class Viewport {
90
90
  return true;
91
91
  }
92
92
  });
93
- this.client.sendCommand("hte" /* HookTextEdit */, { 'n': actionName });
93
+ this.client.sendCommand("hte" /* CommandName.HookTextEdit */, { 'n': actionName });
94
94
  return actionName;
95
95
  }
96
96
  /**
@@ -100,7 +100,7 @@ class Viewport {
100
100
  */
101
101
  unhookTextEdit(handle) {
102
102
  this.client.deleteAction(handle);
103
- this.client.sendCommand("ute" /* UnhookTextEdit */, { 'n': handle });
103
+ this.client.sendCommand("ute" /* CommandName.UnhookTextEdit */, { 'n': handle });
104
104
  }
105
105
  /**
106
106
  * @param callback Called when the user changes their selection of items
@@ -115,7 +115,7 @@ class Viewport {
115
115
  .filter((element) => element instanceof itemproxy_1.ItemProxy);
116
116
  callback(elements);
117
117
  });
118
- this.client.sendCommand("hs" /* HookSelection */, { 'n': actionName });
118
+ this.client.sendCommand("hs" /* CommandName.HookSelection */, { 'n': actionName });
119
119
  return actionName;
120
120
  }
121
121
  /**
@@ -125,7 +125,7 @@ class Viewport {
125
125
  */
126
126
  unhookSelection(handle) {
127
127
  this.client.deleteAction(handle);
128
- this.client.sendCommand("us" /* UnhookSelection */, { 'n': handle });
128
+ this.client.sendCommand("us" /* CommandName.UnhookSelection */, { 'n': handle });
129
129
  }
130
130
  /**
131
131
  * Start an interaction of the current user dragging a new block onto the current page, exactly
@@ -145,7 +145,7 @@ class Viewport {
145
145
  if (definition.lineWidth !== undefined) {
146
146
  properties['LineWidth'] = definition.lineWidth;
147
147
  }
148
- const maybeBlockId = await this.client.sendCommand("sdc" /* StartDragBlockToCanvas */, {
148
+ const maybeBlockId = await this.client.sendCommand("sdc" /* CommandName.StartDragBlockToCanvas */, {
149
149
  'c': definition.className,
150
150
  'sz': {
151
151
  'w': definition.boundingBox.w,
@@ -161,7 +161,7 @@ class Viewport {
161
161
  * cancel that interaction.
162
162
  */
163
163
  cancelDraggingNewBlock() {
164
- this.client.sendCommand("cdc" /* CancelDragBlockToCanvas */, undefined);
164
+ this.client.sendCommand("cdc" /* CommandName.CancelDragBlockToCanvas */, undefined);
165
165
  }
166
166
  }
167
167
  exports.Viewport = Viewport;