lucid-extension-sdk 0.0.152 → 0.0.154
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 +14 -0
- package/commandtypes.js +2 -0
- package/dataconnector/debugserver.js +2 -2
- package/document/documentproxy.js +1 -1
- package/document/elementproxy.d.ts +2 -2
- package/document/elementproxy.js +1 -1
- package/document/propertystoreproxy.d.ts +3 -3
- package/document/propertystoreproxy.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/user/userproxy.d.ts +9 -0
- package/user/userproxy.js +13 -0
package/commandtypes.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare const enum CommandName {
|
|
|
53
53
|
GetCurrentPage = "gcp",
|
|
54
54
|
GetCustomShape = "gcs",
|
|
55
55
|
GetDataItemField = "gdif",
|
|
56
|
+
GetDocumentId = "gdid",
|
|
56
57
|
GetElementType = "get",
|
|
57
58
|
GetItemPageId = "gip",
|
|
58
59
|
GetItemsAt = "gia",
|
|
@@ -64,6 +65,7 @@ export declare const enum CommandName {
|
|
|
64
65
|
GetSelection = "gs",
|
|
65
66
|
GetShapeData = "gsd",
|
|
66
67
|
GetTextStyle = "gts",
|
|
68
|
+
GetUserId = "guid",
|
|
67
69
|
GetVisibleRect = "gvr",
|
|
68
70
|
HideModal = "hm",
|
|
69
71
|
HidePanel = "hp",
|
|
@@ -259,6 +261,10 @@ export declare type CommandArgs = {
|
|
|
259
261
|
query: GetDataItemFieldQuery;
|
|
260
262
|
result: GetDataItemFieldResult;
|
|
261
263
|
};
|
|
264
|
+
[CommandName.GetDocumentId]: {
|
|
265
|
+
query: GetDocumentIdQuery;
|
|
266
|
+
result: GetDocumentIdResult;
|
|
267
|
+
};
|
|
262
268
|
[CommandName.GetElementType]: {
|
|
263
269
|
query: GetElementTypeQuery;
|
|
264
270
|
result: GetElementTypeResult;
|
|
@@ -303,6 +309,10 @@ export declare type CommandArgs = {
|
|
|
303
309
|
query: GetTextStyleQuery;
|
|
304
310
|
result: GetTextStyleResult;
|
|
305
311
|
};
|
|
312
|
+
[CommandName.GetUserId]: {
|
|
313
|
+
query: GetUserIdQuery;
|
|
314
|
+
result: GetUserIdResult;
|
|
315
|
+
};
|
|
306
316
|
[CommandName.GetVisibleRect]: {
|
|
307
317
|
query: GetVisibleRectQuery;
|
|
308
318
|
result: GetVisibleRectResult;
|
|
@@ -865,6 +875,8 @@ export declare type GetDataItemFieldQuery = {
|
|
|
865
875
|
'f': string;
|
|
866
876
|
};
|
|
867
877
|
export declare type GetDataItemFieldResult = SerializedFieldType;
|
|
878
|
+
export declare type GetDocumentIdQuery = void;
|
|
879
|
+
export declare type GetDocumentIdResult = string;
|
|
868
880
|
export declare type GetItemPageIdQuery = string;
|
|
869
881
|
export declare type GetItemPageIdResult = string;
|
|
870
882
|
export declare enum GetItemsAtSearchType {
|
|
@@ -926,6 +938,8 @@ export declare type GetTextStyleQuery = {
|
|
|
926
938
|
'n': string;
|
|
927
939
|
};
|
|
928
940
|
export declare type GetTextStyleResult = TextStyle;
|
|
941
|
+
export declare type GetUserIdQuery = void;
|
|
942
|
+
export declare type GetUserIdResult = string;
|
|
929
943
|
export declare type GetVisibleRectQuery = void;
|
|
930
944
|
export declare type GetVisibleRectResult = Box;
|
|
931
945
|
export declare type HideModalQuery = {
|
package/commandtypes.js
CHANGED
|
@@ -35,6 +35,7 @@ exports.commandTitles = new Map([
|
|
|
35
35
|
["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
|
|
36
36
|
["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
|
|
37
37
|
["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
|
|
38
|
+
["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
|
|
38
39
|
["get" /* CommandName.GetElementType */, 'GetElementType'],
|
|
39
40
|
["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
|
|
40
41
|
["gia" /* CommandName.GetItemsAt */, 'GetItemsAt'],
|
|
@@ -46,6 +47,7 @@ exports.commandTitles = new Map([
|
|
|
46
47
|
["gs" /* CommandName.GetSelection */, 'GetSelection'],
|
|
47
48
|
["gsd" /* CommandName.GetShapeData */, 'GetShapeData'],
|
|
48
49
|
["gts" /* CommandName.GetTextStyle */, 'GetTextStyle'],
|
|
50
|
+
["guid" /* CommandName.GetUserId */, 'GetUserId'],
|
|
49
51
|
["gvr" /* CommandName.GetVisibleRect */, 'GetVisibleRect'],
|
|
50
52
|
["hm" /* CommandName.HideModal */, 'HideModal'],
|
|
51
53
|
["hp" /* CommandName.HidePanel */, 'HidePanel'],
|
|
@@ -22,7 +22,7 @@ function routeDebugServer(dataConnector, options) {
|
|
|
22
22
|
next();
|
|
23
23
|
});
|
|
24
24
|
const prefix = (_b = options.prefix) !== null && _b !== void 0 ? _b : '/';
|
|
25
|
-
console.log(`Routing ${prefix}
|
|
25
|
+
console.log(`Routing ${prefix} (${Object.keys(dataConnector.actions).join(', ')})`);
|
|
26
26
|
if (dataConnector.routes) {
|
|
27
27
|
for (const routeName of Object.keys(dataConnector.routes)) {
|
|
28
28
|
console.log(`Routing ${prefix}?kind=route&name=${routeName}`);
|
|
@@ -31,7 +31,7 @@ function routeDebugServer(dataConnector, options) {
|
|
|
31
31
|
app.post(prefix, async (req, res) => {
|
|
32
32
|
try {
|
|
33
33
|
const routeKind = req.query['kind'];
|
|
34
|
-
if (routeKind === 'action') {
|
|
34
|
+
if (routeKind === 'action' || routeKind == undefined || routeKind === '') {
|
|
35
35
|
const { body, status } = await dataConnector.runAction(req.url, req.headers, JSON.parse(req.body.toString()));
|
|
36
36
|
res.status(status).json(body);
|
|
37
37
|
}
|
|
@@ -11,7 +11,7 @@ const pageproxy_1 = require("./pageproxy");
|
|
|
11
11
|
*/
|
|
12
12
|
class DocumentProxy extends elementproxy_1.ElementProxy {
|
|
13
13
|
constructor(client) {
|
|
14
|
-
super(undefined, client);
|
|
14
|
+
super(client.sendCommand("gdid" /* CommandName.GetDocumentId */, undefined), client);
|
|
15
15
|
/**
|
|
16
16
|
* The set of pages on this document, organized by ID
|
|
17
17
|
*/
|
|
@@ -42,10 +42,10 @@ export declare class ElementProxy extends PropertyStoreProxy {
|
|
|
42
42
|
removeReferenceKey(key: number | string): void;
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
|
-
* @param id ID of this element
|
|
45
|
+
* @param id ID of this element
|
|
46
46
|
* @param client
|
|
47
47
|
*/
|
|
48
|
-
constructor(id: string
|
|
48
|
+
constructor(id: string, client: EditorClient);
|
|
49
49
|
/**
|
|
50
50
|
* @returns `true` if this element still exists on the document, or `false` otherwise
|
|
51
51
|
*/
|
package/document/elementproxy.js
CHANGED
|
@@ -17,7 +17,7 @@ const shapedataproxy_1 = require("./shapedataproxy");
|
|
|
17
17
|
class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
|
-
* @param id ID of this element
|
|
20
|
+
* @param id ID of this element
|
|
21
21
|
* @param client
|
|
22
22
|
*/
|
|
23
23
|
constructor(id, client) {
|
|
@@ -4,7 +4,7 @@ import { WriteableMapProxy } from './mapproxy';
|
|
|
4
4
|
* Base class for anything on a Lucid document that has an ID and properties.
|
|
5
5
|
*/
|
|
6
6
|
export declare class PropertyStoreProxy {
|
|
7
|
-
readonly id: string
|
|
7
|
+
readonly id: string;
|
|
8
8
|
protected readonly client: EditorClient;
|
|
9
9
|
/**
|
|
10
10
|
* All properties available on this element, organized by name.
|
|
@@ -14,8 +14,8 @@ export declare class PropertyStoreProxy {
|
|
|
14
14
|
readonly properties: WriteableMapProxy<string, import("..").JsonSerializable, void, import("..").JsonSerializable>;
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
|
-
* @param id ID of this element
|
|
17
|
+
* @param id ID of this element
|
|
18
18
|
* @param client
|
|
19
19
|
*/
|
|
20
|
-
constructor(id: string
|
|
20
|
+
constructor(id: string, client: EditorClient);
|
|
21
21
|
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorClient } from '../editorclient';
|
|
2
|
+
/**
|
|
3
|
+
* The UserProxy class gives access to the current user on the current Lucid document.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UserProxy {
|
|
6
|
+
private readonly client;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
constructor(client: EditorClient);
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserProxy = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The UserProxy class gives access to the current user on the current Lucid document.
|
|
6
|
+
*/
|
|
7
|
+
class UserProxy {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.id = this.client.sendCommand("guid" /* CommandName.GetUserId */, undefined);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.UserProxy = UserProxy;
|