lucid-extension-sdk 0.0.186 → 0.0.187

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
@@ -113,6 +113,7 @@ export declare const enum CommandName {
113
113
  SendUIMessage = "suim",
114
114
  SendXHR = "xhr",
115
115
  SetCurrentPage = "scp",
116
+ SetPackageSettings = "sps",
116
117
  SetProperty = "sp",
117
118
  SetReferenceKey = "srk",
118
119
  SetShapeData = "ssd",
@@ -511,6 +512,10 @@ export type CommandArgs = {
511
512
  query: SetCurrentPageQuery;
512
513
  result: SetCurrentPageResult;
513
514
  };
515
+ [CommandName.SetPackageSettings]: {
516
+ query: SetPackageSettingsQuery;
517
+ result: SetPackageSettingsResult;
518
+ };
514
519
  [CommandName.SetProperty]: {
515
520
  query: SetPropertyQuery;
516
521
  result: SetPropertyResult;
@@ -1293,6 +1298,8 @@ export type SendXHRResponse = Promise<RawSendXHRResponse>;
1293
1298
  export declare function isRawSendXHRResponse(val: any): val is RawSendXHRResponse;
1294
1299
  export type SetCurrentPageQuery = string;
1295
1300
  export type SetCurrentPageResult = Promise<void>;
1301
+ export type SetPackageSettingsQuery = Record<string, string>;
1302
+ export type SetPackageSettingsResult = Promise<undefined>;
1296
1303
  export type SetPropertyQuery = {
1297
1304
  /** ID of the element to change */
1298
1305
  'id'?: string | undefined;
package/commandtypes.js CHANGED
@@ -92,6 +92,7 @@ exports.commandTitles = new Map([
92
92
  ["suim" /* CommandName.SendUIMessage */, 'SendUIMessage'],
93
93
  ["xhr" /* CommandName.SendXHR */, 'SendXHR'],
94
94
  ["scp" /* CommandName.SetCurrentPage */, 'SetCurrentPage'],
95
+ ["sps" /* CommandName.SetPackageSettings */, 'SetPackageSettings'],
95
96
  ["sp" /* CommandName.SetProperty */, 'SetProperty'],
96
97
  ["srk" /* CommandName.SetReferenceKey */, 'SetReferenceKey'],
97
98
  ["ssd" /* CommandName.SetShapeData */, 'SetShapeData'],
package/editorclient.d.ts CHANGED
@@ -77,6 +77,15 @@ export declare class EditorClient {
77
77
  * @returns A promise that resolves when the user closes the settings modal.
78
78
  */
79
79
  showPackageSettingsModal(): Promise<void>;
80
+ /**
81
+ * If the extension package containing this editor extension has configurable settings, set the
82
+ * value of those settings for this installation of this extension. A subset of setting values
83
+ * can be provided to update those values while leaving others unchanged.
84
+ *
85
+ * If the user does not have permission to change settings on this installation of this
86
+ * extension, or if no settings exist, an error is thrown.
87
+ */
88
+ setPackageSettings(settings: Record<string, string> | Map<string, string>): Promise<undefined>;
80
89
  /**
81
90
  * If the extension package containing this editor extension has configurable settings,
82
91
  * fetch the current values of those settings for this installation of this extension.
package/editorclient.js CHANGED
@@ -126,6 +126,26 @@ class EditorClient {
126
126
  async showPackageSettingsModal() {
127
127
  return this.sendCommand("spsm" /* CommandName.ShowPackageSettingsModal */, undefined);
128
128
  }
129
+ /**
130
+ * If the extension package containing this editor extension has configurable settings, set the
131
+ * value of those settings for this installation of this extension. A subset of setting values
132
+ * can be provided to update those values while leaving others unchanged.
133
+ *
134
+ * If the user does not have permission to change settings on this installation of this
135
+ * extension, or if no settings exist, an error is thrown.
136
+ */
137
+ async setPackageSettings(settings) {
138
+ let settingsAsRecord = {};
139
+ if (settings instanceof Map) {
140
+ for (const [key, value] of settings.entries()) {
141
+ settingsAsRecord[key] = value;
142
+ }
143
+ }
144
+ else {
145
+ settingsAsRecord = settings;
146
+ }
147
+ return this.sendCommand("sps" /* CommandName.SetPackageSettings */, settingsAsRecord);
148
+ }
129
149
  /**
130
150
  * If the extension package containing this editor extension has configurable settings,
131
151
  * fetch the current values of those settings for this installation of this extension.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.186",
3
+ "version": "0.0.187",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",