lucid-extension-sdk 0.0.159 → 0.0.161

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/commandtypes.d.ts CHANGED
@@ -69,6 +69,7 @@ export declare const enum CommandName {
69
69
  GetVisibleRect = "gvr",
70
70
  HideModal = "hm",
71
71
  HidePanel = "hp",
72
+ HookAllChanges = "hac",
72
73
  HookCreateItems = "hci",
73
74
  HookDeleteItems = "hdi",
74
75
  HookSelection = "hs",
@@ -115,6 +116,7 @@ export declare const enum CommandName {
115
116
  StartPDFUploadRequest = "pdf",
116
117
  ThrowForTestCase = "throw",
117
118
  TriggerAuthFlow = "tauth",
119
+ UnhookAllChanges = "uac",
118
120
  UnhookCreateItems = "uci",
119
121
  UnhookDeleteItems = "udi",
120
122
  UnhookSelection = "us",
@@ -327,6 +329,10 @@ export declare type CommandArgs = {
327
329
  query: HidePanelQuery;
328
330
  result: HidePanelResult;
329
331
  };
332
+ [CommandName.HookAllChanges]: {
333
+ query: HookAllChangesQuery;
334
+ result: HookAllChangesResult;
335
+ };
330
336
  [CommandName.HookCreateItems]: {
331
337
  query: HookCreateItemsQuery;
332
338
  result: HookCreateItemsResult;
@@ -511,6 +517,10 @@ export declare type CommandArgs = {
511
517
  query: TriggerAuthFlowQuery;
512
518
  result: TriggerAuthFlowResult;
513
519
  };
520
+ [CommandName.UnhookAllChanges]: {
521
+ query: UnhookAllChangesQuery;
522
+ result: UnhookAllChangesResult;
523
+ };
514
524
  [CommandName.UnhookCreateItems]: {
515
525
  query: UnhookCreateItemsQuery;
516
526
  result: UnhookCreateItemsResult;
@@ -962,6 +972,11 @@ export declare type HidePanelQuery = {
962
972
  'n': string;
963
973
  };
964
974
  export declare type HidePanelResult = undefined;
975
+ export declare type HookAllChangesQuery = {
976
+ /** Name of the action for receiving events. Will be called with no parameters periodically as changes are made to the document */
977
+ 'n': string;
978
+ };
979
+ export declare type HookAllChangesResult = undefined;
965
980
  export declare type HookCreateItemsQuery = {
966
981
  /** Name of the action for receiving events. Will be called with an array of strings of all recently created item IDs. */
967
982
  'n': string;
@@ -1271,6 +1286,11 @@ export declare type TriggerAuthFlowResult = Promise<RawTriggerAuthFlowResult>;
1271
1286
  export declare type RawTriggerAuthFlowResult = {
1272
1287
  's': boolean;
1273
1288
  };
1289
+ export declare type UnhookAllChangesQuery = {
1290
+ /** Name of the action passed to HookAllChanges */
1291
+ 'n': string;
1292
+ };
1293
+ export declare type UnhookAllChangesResult = undefined;
1274
1294
  export declare type UnhookCreateItemsQuery = {
1275
1295
  /** Name of the action passed to HookCreateItems */
1276
1296
  'n': string;
package/commandtypes.js CHANGED
@@ -51,6 +51,7 @@ exports.commandTitles = new Map([
51
51
  ["gvr" /* CommandName.GetVisibleRect */, 'GetVisibleRect'],
52
52
  ["hm" /* CommandName.HideModal */, 'HideModal'],
53
53
  ["hp" /* CommandName.HidePanel */, 'HidePanel'],
54
+ ["hac" /* CommandName.HookAllChanges */, 'HookAllChanges'],
54
55
  ["hci" /* CommandName.HookCreateItems */, 'HookCreateItems'],
55
56
  ["hdi" /* CommandName.HookDeleteItems */, 'HookDeleteItems'],
56
57
  ["hs" /* CommandName.HookSelection */, 'HookSelection'],
@@ -95,6 +96,7 @@ exports.commandTitles = new Map([
95
96
  ["pdf" /* CommandName.StartPDFUploadRequest */, 'StartPDFUploadRequest'],
96
97
  ["throw" /* CommandName.ThrowForTestCase */, 'ThrowForTestCase'],
97
98
  ["tauth" /* CommandName.TriggerAuthFlow */, 'TriggerAuthFlow'],
99
+ ["uac" /* CommandName.UnhookAllChanges */, 'UnhookAllChanges'],
98
100
  ["uci" /* CommandName.UnhookCreateItems */, 'UnhookCreateItems'],
99
101
  ["udi" /* CommandName.UnhookDeleteItems */, 'UnhookDeleteItems'],
100
102
  ["us" /* CommandName.UnhookSelection */, 'UnhookSelection'],
@@ -148,3 +148,20 @@ export declare type SerializedLucidCardFieldDisplaySettings = {
148
148
  export declare function serializeLucidCardFieldDisplaySettings(settings: LucidCardFieldDisplaySettings): SerializedLucidCardFieldDisplaySettings;
149
149
  /** @ignore */
150
150
  export declare function deserializeLucidCardFieldDisplaySettings(settings: SerializedLucidCardFieldDisplaySettings): LucidCardFieldDisplaySettings;
151
+ /**
152
+ * These are the three possible values for the status of a basic card block.
153
+ */
154
+ export declare enum StatusValues {
155
+ Todo = "To Do",
156
+ InProgress = "In Progress",
157
+ Done = "Done"
158
+ }
159
+ export declare enum LucidCardFields {
160
+ Title = "Title",
161
+ Description = "Description",
162
+ Assignee = "Assignee",
163
+ Estimate = "Estimate",
164
+ Status = "Status",
165
+ StartTime = "StartTime",
166
+ EndTime = "EndTime"
167
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeLucidCardFieldDisplaySettings = exports.serializeLucidCardFieldDisplaySettings = exports.isOnClickHandlerKey = exports.OnClickHandlerKeys = exports.isFieldDisplayType = exports.FieldDisplayType = void 0;
3
+ exports.LucidCardFields = exports.StatusValues = exports.deserializeLucidCardFieldDisplaySettings = exports.serializeLucidCardFieldDisplaySettings = exports.isOnClickHandlerKey = exports.OnClickHandlerKeys = exports.isFieldDisplayType = exports.FieldDisplayType = void 0;
4
4
  const validators_1 = require("../validators/validators");
5
5
  /**
6
6
  * When configuring a field on a LucidCardBlock to be displayed as a data graphic, one of these values specifies
@@ -95,3 +95,22 @@ function deserializeLucidCardFieldDisplaySettings(settings) {
95
95
  };
96
96
  }
97
97
  exports.deserializeLucidCardFieldDisplaySettings = deserializeLucidCardFieldDisplaySettings;
98
+ /**
99
+ * These are the three possible values for the status of a basic card block.
100
+ */
101
+ var StatusValues;
102
+ (function (StatusValues) {
103
+ StatusValues["Todo"] = "To Do";
104
+ StatusValues["InProgress"] = "In Progress";
105
+ StatusValues["Done"] = "Done";
106
+ })(StatusValues = exports.StatusValues || (exports.StatusValues = {}));
107
+ var LucidCardFields;
108
+ (function (LucidCardFields) {
109
+ LucidCardFields["Title"] = "Title";
110
+ LucidCardFields["Description"] = "Description";
111
+ LucidCardFields["Assignee"] = "Assignee";
112
+ LucidCardFields["Estimate"] = "Estimate";
113
+ LucidCardFields["Status"] = "Status";
114
+ LucidCardFields["StartTime"] = "StartTime";
115
+ LucidCardFields["EndTime"] = "EndTime";
116
+ })(LucidCardFields = exports.LucidCardFields || (exports.LucidCardFields = {}));
@@ -1,4 +1,47 @@
1
+ import { StatusValues } from '../../core/cardintegration/cardfielddisplaysettings';
2
+ import { SerializedIsoDateObject } from '../../core/data/serializedfield/serializedfields';
1
3
  import { BlockProxy } from '../blockproxy';
4
+ /**
5
+ * A generic lucid card block.
6
+ * This shape has all of the base functionality as a BlockProxy, as well as additional card specific properties.
7
+ */
2
8
  export declare class CardBlockProxy extends BlockProxy {
3
9
  static classNameRegex: RegExp;
10
+ private getSettings;
11
+ getTitle(): string;
12
+ getDescription(): string;
13
+ getStatus(): StatusValues;
14
+ getAssignee(): string;
15
+ getStartTime(): SerializedIsoDateObject;
16
+ getEndTime(): SerializedIsoDateObject;
17
+ getEstimate(): number;
18
+ /**
19
+ * @param title The title that you want to set for this card.
20
+ */
21
+ setTitle(title: string): void;
22
+ /**
23
+ * @param description The description that you want to set for this card.
24
+ */
25
+ setDescription(description: string): void;
26
+ /**
27
+ * @param status The status that you want to set for this card.
28
+ * This can be one of three values: "To Do", "In Progress", or "Done".
29
+ */
30
+ setStatus(status: StatusValues): void;
31
+ /**
32
+ * @param assignee The assignee that you want to set for this card.
33
+ */
34
+ setAssignee(assignee: string): void;
35
+ /**
36
+ * @param startTime The start time that you want to set for this card.
37
+ */
38
+ setStartTime(startTime: SerializedIsoDateObject): void;
39
+ /**
40
+ * @param endTime The end time that you want to set for this card.
41
+ */
42
+ setEndTime(endTime: SerializedIsoDateObject): void;
43
+ /**
44
+ * @param estimate The estimate that you want to set for this card.
45
+ */
46
+ setEstimate(estimate: number): void;
4
47
  }
@@ -1,8 +1,94 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CardBlockProxy = void 0;
4
+ const cardfielddisplaysettings_1 = require("../../core/cardintegration/cardfielddisplaysettings");
4
5
  const blockproxy_1 = require("../blockproxy");
6
+ /**
7
+ * A generic lucid card block.
8
+ * This shape has all of the base functionality as a BlockProxy, as well as additional card specific properties.
9
+ */
5
10
  class CardBlockProxy extends blockproxy_1.BlockProxy {
11
+ getSettings() {
12
+ return this.referenceKeys.get(this.referenceKeys.keys()[0]).definition;
13
+ }
14
+ getTitle() {
15
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.Title];
16
+ }
17
+ getDescription() {
18
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.Description];
19
+ }
20
+ getStatus() {
21
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.Status];
22
+ }
23
+ getAssignee() {
24
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.Assignee];
25
+ }
26
+ getStartTime() {
27
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.StartTime];
28
+ }
29
+ getEndTime() {
30
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.EndTime];
31
+ }
32
+ getEstimate() {
33
+ return this.getSettings().data[cardfielddisplaysettings_1.LucidCardFields.Estimate];
34
+ }
35
+ /**
36
+ * @param title The title that you want to set for this card.
37
+ */
38
+ setTitle(title) {
39
+ const settings = this.getSettings();
40
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.Title] = title;
41
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
42
+ }
43
+ /**
44
+ * @param description The description that you want to set for this card.
45
+ */
46
+ setDescription(description) {
47
+ const settings = this.getSettings();
48
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.Description] = description;
49
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
50
+ }
51
+ /**
52
+ * @param status The status that you want to set for this card.
53
+ * This can be one of three values: "To Do", "In Progress", or "Done".
54
+ */
55
+ setStatus(status) {
56
+ const settings = this.getSettings();
57
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.Status] = status;
58
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
59
+ }
60
+ /**
61
+ * @param assignee The assignee that you want to set for this card.
62
+ */
63
+ setAssignee(assignee) {
64
+ const settings = this.getSettings();
65
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.Assignee] = assignee;
66
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
67
+ }
68
+ /**
69
+ * @param startTime The start time that you want to set for this card.
70
+ */
71
+ setStartTime(startTime) {
72
+ const settings = this.getSettings();
73
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.StartTime] = startTime;
74
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
75
+ }
76
+ /**
77
+ * @param endTime The end time that you want to set for this card.
78
+ */
79
+ setEndTime(endTime) {
80
+ const settings = this.getSettings();
81
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.EndTime] = endTime;
82
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
83
+ }
84
+ /**
85
+ * @param estimate The estimate that you want to set for this card.
86
+ */
87
+ setEstimate(estimate) {
88
+ const settings = this.getSettings();
89
+ settings.data[cardfielddisplaysettings_1.LucidCardFields.Estimate] = estimate;
90
+ this.setReferenceKey(this.referenceKeys.keys()[0], settings);
91
+ }
6
92
  }
7
93
  exports.CardBlockProxy = CardBlockProxy;
8
94
  CardBlockProxy.classNameRegex = /^LucidCardBlock$/;
@@ -35,6 +35,22 @@ export declare class DocumentProxy extends ElementProxy {
35
35
  * @returns The title of this document
36
36
  */
37
37
  getTitle(): string;
38
+ /**
39
+ * Infrequently, you may need to watch for *any* changes to the document. These changes may be
40
+ * the local user adding content, or a data integration sending updated records to a data collection,
41
+ * or a remote user hitting undo, or any user entering or exiting an intra-document mutex.
42
+ *
43
+ * Because these changes may happen rapidly, the callback you provide here will only be called on
44
+ * a heavily-debounced schedule. The callback will happen between 1-10 seconds after changes are
45
+ * made to the document, depending on the frequency with which changes are happening.
46
+ * @param callback
47
+ * @returns A handle that can be passed into `unhookAllChanges`
48
+ */
49
+ hookAllChanges(callback: () => void): string;
50
+ /**
51
+ * @param handle Return value from `hookAllChanges`
52
+ */
53
+ unhookAllChanges(handle: string): void;
38
54
  /**
39
55
  * Watch for new blocks, lines, or groups added to this document. The callback will
40
56
  * be called with new items created by the current user, but will not be called with items
@@ -55,6 +55,32 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
55
55
  getTitle() {
56
56
  return this.properties.get('Title');
57
57
  }
58
+ /**
59
+ * Infrequently, you may need to watch for *any* changes to the document. These changes may be
60
+ * the local user adding content, or a data integration sending updated records to a data collection,
61
+ * or a remote user hitting undo, or any user entering or exiting an intra-document mutex.
62
+ *
63
+ * Because these changes may happen rapidly, the callback you provide here will only be called on
64
+ * a heavily-debounced schedule. The callback will happen between 1-10 seconds after changes are
65
+ * made to the document, depending on the frequency with which changes are happening.
66
+ * @param callback
67
+ * @returns A handle that can be passed into `unhookAllChanges`
68
+ */
69
+ hookAllChanges(callback) {
70
+ const actionName = DocumentProxy.getNextHookName();
71
+ this.client.registerAction(actionName, () => {
72
+ callback();
73
+ });
74
+ this.client.sendCommand("hac" /* CommandName.HookAllChanges */, { 'n': actionName });
75
+ return actionName;
76
+ }
77
+ /**
78
+ * @param handle Return value from `hookAllChanges`
79
+ */
80
+ unhookAllChanges(handle) {
81
+ this.client.deleteAction(handle);
82
+ this.client.sendCommand("uac" /* CommandName.UnhookAllChanges */, { 'n': handle });
83
+ }
58
84
  /**
59
85
  * Watch for new blocks, lines, or groups added to this document. The callback will
60
86
  * be called with new items created by the current user, but will not be called with items
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.159",
3
+ "version": "0.0.161",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",