lucid-extension-sdk 0.0.83 → 0.0.85
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 +1 -1
- package/sdk/commandtypes.d.ts +29 -0
- package/sdk/commandtypes.js +4 -0
- package/sdk/core/lucidproduct.d.ts +7 -0
- package/sdk/core/lucidproduct.js +11 -0
- package/sdk/core/object.d.ts +3 -0
- package/sdk/core/object.js +6 -1
- package/sdk/editorclient.d.ts +29 -0
- package/sdk/editorclient.js +38 -0
- package/sdk/index.d.ts +1 -0
- package/sdk/index.js +1 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SerializedFieldTypeDefinition } from './core/data/fieldtypedefinition/f
|
|
|
2
2
|
import { SerializedReferenceKeyType } from './core/data/referencekeys/serializedreferencekey';
|
|
3
3
|
import { SerializedFieldType } from './core/data/serializedfield/serializedfields';
|
|
4
4
|
import { JsonObject, JsonSerializable } from './core/jsonserializable';
|
|
5
|
+
import { LucidProduct } from './core/lucidproduct';
|
|
5
6
|
import { LinearOffsetType } from './core/offsettype';
|
|
6
7
|
import { SerializedDataError } from './core/serializeddataerror';
|
|
7
8
|
import { ShapeDataInheritance } from './core/shapedatainheritance';
|
|
@@ -27,6 +28,7 @@ export declare const enum CommandName {
|
|
|
27
28
|
AwaitImport = "ai",
|
|
28
29
|
Bootstrap = "b",
|
|
29
30
|
CancelDragBlockToCanvas = "cdc",
|
|
31
|
+
CanEditPackageSettings = "ceps",
|
|
30
32
|
Confirm = "c",
|
|
31
33
|
CreateBlock = "cb",
|
|
32
34
|
CreateCollection = "cc",
|
|
@@ -50,6 +52,8 @@ export declare const enum CommandName {
|
|
|
50
52
|
GetDataItemField = "gdif",
|
|
51
53
|
GetElementType = "get",
|
|
52
54
|
GetItemPageId = "gip",
|
|
55
|
+
GetPackageSettings = "gps",
|
|
56
|
+
GetProduct = "gpr",
|
|
53
57
|
GetProperty = "gp",
|
|
54
58
|
GetReferenceKey = "grk",
|
|
55
59
|
GetRelativeLinePosition = "grlp",
|
|
@@ -93,6 +97,7 @@ export declare const enum CommandName {
|
|
|
93
97
|
SetText = "st",
|
|
94
98
|
ShowModal = "sm",
|
|
95
99
|
ShowPanel = "spn",
|
|
100
|
+
ShowPackageSettingsModal = "spsm",
|
|
96
101
|
SleepForTestCase = "sleep",
|
|
97
102
|
StartDragBlockToCanvas = "sdc",
|
|
98
103
|
StartPDFUploadRequest = "pdf",
|
|
@@ -141,6 +146,10 @@ export declare type CommandArgs = {
|
|
|
141
146
|
query: BootstrapQuery;
|
|
142
147
|
result: BootstrapResult;
|
|
143
148
|
};
|
|
149
|
+
[CommandName.CanEditPackageSettings]: {
|
|
150
|
+
query: CanEditPackageSettingsQuery;
|
|
151
|
+
result: CanEditPackageSettingsResult;
|
|
152
|
+
};
|
|
144
153
|
[CommandName.CancelDragBlockToCanvas]: {
|
|
145
154
|
query: CancelDragBlockToCanvasQuery;
|
|
146
155
|
result: CancelDragBlockToCanvasResult;
|
|
@@ -237,6 +246,14 @@ export declare type CommandArgs = {
|
|
|
237
246
|
query: GetItemPageIdQuery;
|
|
238
247
|
result: GetItemPageIdResult;
|
|
239
248
|
};
|
|
249
|
+
[CommandName.GetPackageSettings]: {
|
|
250
|
+
query: GetPackageSettingsQuery;
|
|
251
|
+
result: GetPackageSettingsResult;
|
|
252
|
+
};
|
|
253
|
+
[CommandName.GetProduct]: {
|
|
254
|
+
query: GetProductQuery;
|
|
255
|
+
result: GetProductResult;
|
|
256
|
+
};
|
|
240
257
|
[CommandName.GetProperty]: {
|
|
241
258
|
query: GetPropertyQuery;
|
|
242
259
|
result: GetPropertyResult;
|
|
@@ -405,6 +422,10 @@ export declare type CommandArgs = {
|
|
|
405
422
|
query: ShowModalQuery;
|
|
406
423
|
result: ShowModalResult;
|
|
407
424
|
};
|
|
425
|
+
[CommandName.ShowPackageSettingsModal]: {
|
|
426
|
+
query: ShowPackageSettingsModalQuery;
|
|
427
|
+
result: ShowPackageSettingsModalResult;
|
|
428
|
+
};
|
|
408
429
|
[CommandName.ShowPanel]: {
|
|
409
430
|
query: ShowPanelQuery;
|
|
410
431
|
result: ShowPanelResult;
|
|
@@ -563,6 +584,8 @@ export declare type BootstrapQuery = {
|
|
|
563
584
|
'm'?: boolean;
|
|
564
585
|
};
|
|
565
586
|
export declare type BootstrapResult = Promise<void>;
|
|
587
|
+
export declare type CanEditPackageSettingsQuery = undefined;
|
|
588
|
+
export declare type CanEditPackageSettingsResult = Promise<boolean>;
|
|
566
589
|
export declare type CancelDragBlockToCanvasQuery = void;
|
|
567
590
|
export declare type CancelDragBlockToCanvasResult = undefined;
|
|
568
591
|
export declare type ConfirmQuery = {
|
|
@@ -756,6 +779,8 @@ export declare type GetReferenceKeyQuery = {
|
|
|
756
779
|
'k': number | string;
|
|
757
780
|
};
|
|
758
781
|
export declare type GetReferenceKeyResult = SerializedReferenceKeyType;
|
|
782
|
+
export declare type GetProductQuery = undefined;
|
|
783
|
+
export declare type GetProductResult = LucidProduct;
|
|
759
784
|
export declare type GetPropertyQuery = {
|
|
760
785
|
/** ID of the LucidElement to read a property from, or undefined to read from the LucidDocument */
|
|
761
786
|
'id'?: string | undefined;
|
|
@@ -763,6 +788,8 @@ export declare type GetPropertyQuery = {
|
|
|
763
788
|
'p': string;
|
|
764
789
|
};
|
|
765
790
|
export declare type GetPropertyResult = JsonSerializable;
|
|
791
|
+
export declare type GetPackageSettingsQuery = undefined;
|
|
792
|
+
export declare type GetPackageSettingsResult = Promise<Record<string, JsonSerializable>>;
|
|
766
793
|
export declare type GetRelativeLinePositionQuery = {
|
|
767
794
|
/** Block or line ID to check the connections on */
|
|
768
795
|
'id': string;
|
|
@@ -1026,6 +1053,8 @@ export declare type ShowModalQuery = {
|
|
|
1026
1053
|
'c': string;
|
|
1027
1054
|
};
|
|
1028
1055
|
export declare type ShowModalResult = undefined;
|
|
1056
|
+
export declare type ShowPackageSettingsModalQuery = undefined;
|
|
1057
|
+
export declare type ShowPackageSettingsModalResult = Promise<void>;
|
|
1029
1058
|
export declare type ShowPanelQuery = {
|
|
1030
1059
|
/** Name of the panel's action for receiving events, i.e. RegisterPanelQuery['n'] */
|
|
1031
1060
|
'n': string;
|
package/sdk/commandtypes.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.commandTitles = new Map([
|
|
|
12
12
|
["av" /* CommandName.AnimateViewport */, 'AnimateViewport'],
|
|
13
13
|
["ai" /* CommandName.AwaitImport */, 'AwaitImport'],
|
|
14
14
|
["b" /* CommandName.Bootstrap */, 'Bootstrap'],
|
|
15
|
+
["ceps" /* CommandName.CanEditPackageSettings */, 'CanEditPackageSettings'],
|
|
15
16
|
["cdc" /* CommandName.CancelDragBlockToCanvas */, 'CancelDragBlockToCanvas'],
|
|
16
17
|
["c" /* CommandName.Confirm */, 'Confirm'],
|
|
17
18
|
["cb" /* CommandName.CreateBlock */, 'CreateBlock'],
|
|
@@ -34,6 +35,8 @@ exports.commandTitles = new Map([
|
|
|
34
35
|
["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
|
|
35
36
|
["get" /* CommandName.GetElementType */, 'GetElementType'],
|
|
36
37
|
["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
|
|
38
|
+
["gps" /* CommandName.GetPackageSettings */, 'GetPackageSettings'],
|
|
39
|
+
["gpr" /* CommandName.GetProduct */, 'GetProduct'],
|
|
37
40
|
["gp" /* CommandName.GetProperty */, 'GetProperty'],
|
|
38
41
|
["grk" /* CommandName.GetReferenceKey */, 'GetReferenceKey'],
|
|
39
42
|
["grlp" /* CommandName.GetRelativeLinePosition */, 'GetRelativeLinePosition'],
|
|
@@ -74,6 +77,7 @@ exports.commandTitles = new Map([
|
|
|
74
77
|
["srk" /* CommandName.SetReferenceKey */, 'SetReferenceKey'],
|
|
75
78
|
["ssd" /* CommandName.SetShapeData */, 'SetShapeData'],
|
|
76
79
|
["sm" /* CommandName.ShowModal */, 'ShowModal'],
|
|
80
|
+
["spsm" /* CommandName.ShowPackageSettingsModal */, 'ShowPackageSettingsModal'],
|
|
77
81
|
["spn" /* CommandName.ShowPanel */, 'ShowPanel'],
|
|
78
82
|
["sleep" /* CommandName.SleepForTestCase */, 'SleepForTestCase'],
|
|
79
83
|
["sdc" /* CommandName.StartDragBlockToCanvas */, 'StartDragBlockToCanvas'],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LucidProduct = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Lucid products supporting the extension API
|
|
6
|
+
*/
|
|
7
|
+
var LucidProduct;
|
|
8
|
+
(function (LucidProduct) {
|
|
9
|
+
LucidProduct["Chart"] = "chart";
|
|
10
|
+
LucidProduct["Spark"] = "spark";
|
|
11
|
+
})(LucidProduct = exports.LucidProduct || (exports.LucidProduct = {}));
|
package/sdk/core/object.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare function objectEvery<T, O extends {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}>(obj: O, f: (this: T | undefined, _0: O[typeof _1], _1: string & keyof O, _2: O) => any, opt_this?: T): boolean;
|
|
4
|
+
export declare function entries<T>(obj: {
|
|
5
|
+
[key: string]: T;
|
|
6
|
+
}): [string, T][];
|
package/sdk/core/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectEvery = void 0;
|
|
3
|
+
exports.entries = exports.objectEvery = void 0;
|
|
4
4
|
function objectEvery(obj, f, opt_this) {
|
|
5
5
|
for (const key in obj) {
|
|
6
6
|
if (!f.call(opt_this, obj[key], key, obj)) {
|
|
@@ -10,3 +10,8 @@ function objectEvery(obj, f, opt_this) {
|
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
exports.objectEvery = objectEvery;
|
|
13
|
+
// TODO: Placeholder until we adopt ES8 and can use Object.entries(obj)
|
|
14
|
+
function entries(obj) {
|
|
15
|
+
return Object.keys(obj).map((key) => [key, obj[key]]);
|
|
16
|
+
}
|
|
17
|
+
exports.entries = entries;
|
package/sdk/editorclient.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export declare class EditorClient {
|
|
|
24
24
|
private nextId;
|
|
25
25
|
private readonly callbacks;
|
|
26
26
|
private getUniqueActionName;
|
|
27
|
+
/**
|
|
28
|
+
* Get which Lucid product this editor extension has been loaded in.
|
|
29
|
+
*/
|
|
30
|
+
getProduct(): import(".").LucidProduct;
|
|
27
31
|
/**
|
|
28
32
|
* Unload this extension immediately, removing any custom menu items etc., until the user refreshes the browser tab.
|
|
29
33
|
*/
|
|
@@ -61,6 +65,31 @@ export declare class EditorClient {
|
|
|
61
65
|
* @throws A string with an error from the data sync server
|
|
62
66
|
*/
|
|
63
67
|
performDataAction(flowName: string, dataConnectorName: string, syncDataSourceId?: undefined | string, flowData?: unknown, async?: boolean): Promise<DataActionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* If the extension package containing this editor extension has configurable settings,
|
|
70
|
+
* show a standard modal allowing the user to view or change those settings.
|
|
71
|
+
*
|
|
72
|
+
* If the user does not have permission to change settings on this installation of this
|
|
73
|
+
* extension, or if no settings exist, an error is thrown.
|
|
74
|
+
*
|
|
75
|
+
* @returns A promise that resolves when the user closes the settings modal.
|
|
76
|
+
*/
|
|
77
|
+
showPackageSettingsModal(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* If the extension package containing this editor extension has configurable settings,
|
|
80
|
+
* fetch the current values of those settings for this installation of this extension.
|
|
81
|
+
*
|
|
82
|
+
* Only settings that have been set by the installing user will have a value in the map,
|
|
83
|
+
* other settings will be missing.
|
|
84
|
+
*
|
|
85
|
+
* @returns A promise that resolves to a map of setting names to current setting values
|
|
86
|
+
*/
|
|
87
|
+
getPackageSettings(): Promise<Map<string, JsonSerializable>>;
|
|
88
|
+
/**
|
|
89
|
+
* @returns True if the current user is allowed to edit package settings on this installation
|
|
90
|
+
* of this extension (if any settings exist), or false otherwise.
|
|
91
|
+
*/
|
|
92
|
+
canEditPackageSettings(): Promise<boolean>;
|
|
64
93
|
awaitDataImport(dataConnectorName: string, syncDataSourceId: undefined | string, syncCollectionId: string, primaryKeys: string[], timeout?: number): Promise<CollectionProxy>;
|
|
65
94
|
/**
|
|
66
95
|
* Make a network request
|
package/sdk/editorclient.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.EditorClient = void 0;
|
|
|
4
4
|
const commandtypes_1 = require("./commandtypes");
|
|
5
5
|
const base64_1 = require("./core/base64");
|
|
6
6
|
const checks_1 = require("./core/checks");
|
|
7
|
+
const object_1 = require("./core/object");
|
|
7
8
|
const unfurlcallbacks_1 = require("./core/unfurl/unfurlcallbacks");
|
|
8
9
|
const unfurldetails_1 = require("./core/unfurl/unfurldetails");
|
|
9
10
|
const unfurlrefresherrortype_1 = require("./core/unfurl/unfurlrefresherrortype");
|
|
@@ -41,6 +42,12 @@ class EditorClient {
|
|
|
41
42
|
}
|
|
42
43
|
return 'a' + this.nextId;
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Get which Lucid product this editor extension has been loaded in.
|
|
47
|
+
*/
|
|
48
|
+
getProduct() {
|
|
49
|
+
return this.sendCommand("gpr" /* CommandName.GetProduct */, undefined);
|
|
50
|
+
}
|
|
44
51
|
/**
|
|
45
52
|
* Unload this extension immediately, removing any custom menu items etc., until the user refreshes the browser tab.
|
|
46
53
|
*/
|
|
@@ -113,6 +120,37 @@ class EditorClient {
|
|
|
113
120
|
'json': result['j'],
|
|
114
121
|
};
|
|
115
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* If the extension package containing this editor extension has configurable settings,
|
|
125
|
+
* show a standard modal allowing the user to view or change those settings.
|
|
126
|
+
*
|
|
127
|
+
* If the user does not have permission to change settings on this installation of this
|
|
128
|
+
* extension, or if no settings exist, an error is thrown.
|
|
129
|
+
*
|
|
130
|
+
* @returns A promise that resolves when the user closes the settings modal.
|
|
131
|
+
*/
|
|
132
|
+
async showPackageSettingsModal() {
|
|
133
|
+
return this.sendCommand("spsm" /* CommandName.ShowPackageSettingsModal */, undefined);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* If the extension package containing this editor extension has configurable settings,
|
|
137
|
+
* fetch the current values of those settings for this installation of this extension.
|
|
138
|
+
*
|
|
139
|
+
* Only settings that have been set by the installing user will have a value in the map,
|
|
140
|
+
* other settings will be missing.
|
|
141
|
+
*
|
|
142
|
+
* @returns A promise that resolves to a map of setting names to current setting values
|
|
143
|
+
*/
|
|
144
|
+
async getPackageSettings() {
|
|
145
|
+
return new Map((0, object_1.entries)(await this.sendCommand("gps" /* CommandName.GetPackageSettings */, undefined)));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @returns True if the current user is allowed to edit package settings on this installation
|
|
149
|
+
* of this extension (if any settings exist), or false otherwise.
|
|
150
|
+
*/
|
|
151
|
+
async canEditPackageSettings() {
|
|
152
|
+
return this.sendCommand("ceps" /* CommandName.CanEditPackageSettings */, undefined);
|
|
153
|
+
}
|
|
116
154
|
async awaitDataImport(dataConnectorName, syncDataSourceId, syncCollectionId, primaryKeys, timeout = 30000) {
|
|
117
155
|
return new collectionproxy_1.CollectionProxy(await this.sendCommand("ai" /* CommandName.AwaitImport */, {
|
|
118
156
|
'n': dataConnectorName,
|
package/sdk/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './core/dataerrortype';
|
|
|
23
23
|
export * from './core/guards';
|
|
24
24
|
export * from './core/iframe/iframeutils';
|
|
25
25
|
export * from './core/jsonserializable';
|
|
26
|
+
export * from './core/lucidproduct';
|
|
26
27
|
export * from './core/object';
|
|
27
28
|
export * from './core/offsettype';
|
|
28
29
|
export * from './core/optionalkey';
|
package/sdk/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __exportStar(require("./core/dataerrortype"), exports);
|
|
|
39
39
|
__exportStar(require("./core/guards"), exports);
|
|
40
40
|
__exportStar(require("./core/iframe/iframeutils"), exports);
|
|
41
41
|
__exportStar(require("./core/jsonserializable"), exports);
|
|
42
|
+
__exportStar(require("./core/lucidproduct"), exports);
|
|
42
43
|
__exportStar(require("./core/object"), exports);
|
|
43
44
|
__exportStar(require("./core/offsettype"), exports);
|
|
44
45
|
__exportStar(require("./core/optionalkey"), exports);
|