lucid-extension-sdk 0.0.5 → 0.0.9
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/interop.d.ts +2 -0
- package/package.json +3 -3
- package/sdk/commandtypes.d.ts +181 -2
- package/sdk/core/jsonserializable.d.ts +4 -0
- package/sdk/data/collectionproxy.d.ts +2 -2
- package/sdk/data/collectionproxy.js +2 -2
- package/sdk/data/datasourceproxy.d.ts +9 -3
- package/sdk/data/datasourceproxy.js +9 -3
- package/sdk/data/referencekeydefinition.d.ts +27 -1
- package/sdk/data/referencekeydefinition.js +2 -0
- package/sdk/data/schemadefinition.d.ts +11 -0
- package/sdk/data/schemadefinition.js +1 -0
- package/sdk/document/blockdefinition.d.ts +4 -2
- package/sdk/document/blockproxy.d.ts +8 -4
- package/sdk/document/blockproxy.js +8 -4
- package/sdk/document/documentproxy.d.ts +10 -1
- package/sdk/document/documentproxy.js +14 -1
- package/sdk/document/elementproxy.d.ts +26 -18
- package/sdk/document/elementproxy.js +26 -29
- package/sdk/document/groupproxy.d.ts +1 -1
- package/sdk/document/groupproxy.js +1 -1
- package/sdk/document/itemproxy.d.ts +5 -5
- package/sdk/document/itemproxy.js +5 -5
- package/sdk/document/lineproxy.d.ts +6 -6
- package/sdk/document/lineproxy.js +6 -6
- package/sdk/document/mapproxy.d.ts +5 -0
- package/sdk/document/mapproxy.js +5 -0
- package/sdk/document/propertystoreproxy.d.ts +21 -0
- package/sdk/document/propertystoreproxy.js +37 -0
- package/sdk/document/shapedataproxy.d.ts +5 -0
- package/sdk/document/shapedataproxy.js +5 -0
- package/sdk/editorclient.d.ts +14 -2
- package/sdk/editorclient.js +53 -2
- package/sdk/index.d.ts +1 -0
- package/sdk/index.js +1 -0
- package/sdk/ui/alertmodal.d.ts +2 -3
- package/sdk/ui/alertmodal.js +2 -3
- package/sdk/ui/iframeui.d.ts +57 -0
- package/sdk/ui/iframeui.js +82 -0
- package/sdk/ui/modal.d.ts +11 -33
- package/sdk/ui/modal.js +9 -46
- package/sdk/ui/panel.d.ts +43 -0
- package/sdk/ui/panel.js +50 -0
package/interop.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucid-extension-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Utility classes for writing Lucid Software editor extensions",
|
|
5
5
|
"main": "sdk/index.js",
|
|
6
6
|
"types": "sdk/index.d.ts",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"declaration": true,
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@bazel/typescript": "2.0.1",
|
|
12
11
|
"@types/jasmine": "^3.10.3",
|
|
13
12
|
"@types/node": "^16.11.11",
|
|
14
|
-
"typedoc": "^0.22.
|
|
13
|
+
"typedoc": "^0.22.15",
|
|
14
|
+
"typedoc-plugin-markdown": "^3.12.1",
|
|
15
15
|
"typescript": "4.3.5"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -7,10 +7,19 @@ import { SerializedDataError } from './core/serializeddataerror';
|
|
|
7
7
|
import { ShapeDataInheritance } from './core/shapedatainheritance';
|
|
8
8
|
import { Box, Point } from './math';
|
|
9
9
|
import { MenuLocation, MenuType } from './ui/menu';
|
|
10
|
+
import { PanelLocation } from './ui/panel';
|
|
11
|
+
/**
|
|
12
|
+
* The lucid-extension-sdk library interacts with core Lucid products through this set of possible commands.
|
|
13
|
+
* Typically, an extension author will not need to access any of these commands directly, as they are all
|
|
14
|
+
* exposed through appropriate classes and methods elsewhere in this SDK.
|
|
15
|
+
*
|
|
16
|
+
* To use these directly, use [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand).
|
|
17
|
+
*/
|
|
10
18
|
export declare const enum CommandName {
|
|
11
19
|
AddMenuItem = "ami",
|
|
12
20
|
AddShapeData = "asd",
|
|
13
21
|
AnimateViewport = "av",
|
|
22
|
+
Bootstrap = "b",
|
|
14
23
|
CreateBlock = "cb",
|
|
15
24
|
CreateCollection = "cc",
|
|
16
25
|
CreateDataSource = "cds",
|
|
@@ -34,6 +43,7 @@ export declare const enum CommandName {
|
|
|
34
43
|
GetSelection = "gs",
|
|
35
44
|
GetShapeData = "gsd",
|
|
36
45
|
HideModal = "hm",
|
|
46
|
+
HidePanel = "hp",
|
|
37
47
|
KillExtension = "k",
|
|
38
48
|
ListBlocks = "lb",
|
|
39
49
|
ListCollectionFields = "lcf",
|
|
@@ -51,15 +61,24 @@ export declare const enum CommandName {
|
|
|
51
61
|
LogForTestCase = "log",
|
|
52
62
|
OffsetItems = "oi",
|
|
53
63
|
PatchDataItems = "pdi",
|
|
64
|
+
RegisterPanel = "rp",
|
|
54
65
|
ReloadExtension = "r",
|
|
66
|
+
SendOAuthRequest = "oauth",
|
|
55
67
|
SendUIMessage = "suim",
|
|
56
68
|
SendXHR = "xhr",
|
|
57
69
|
SetCurrentPage = "scp",
|
|
58
70
|
SetProperty = "sp",
|
|
59
71
|
SetReferenceKey = "srk",
|
|
60
72
|
SetShapeData = "ssd",
|
|
61
|
-
ShowModal = "sm"
|
|
73
|
+
ShowModal = "sm",
|
|
74
|
+
ShowPanel = "spn",
|
|
75
|
+
SleepForTestCase = "sleep"
|
|
62
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* This is a type declaration whose purpose is to allow TypeScript to enforce the correct parameter and
|
|
79
|
+
* return types from [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand) based on
|
|
80
|
+
* which command name you pass in as the first parameter.
|
|
81
|
+
*/
|
|
63
82
|
export declare type CommandArgs = {
|
|
64
83
|
[CommandName.AnimateViewport]: {
|
|
65
84
|
query: AnimateViewportQuery;
|
|
@@ -73,6 +92,10 @@ export declare type CommandArgs = {
|
|
|
73
92
|
query: AddShapeDataQuery;
|
|
74
93
|
result: AddShapeDataResult;
|
|
75
94
|
};
|
|
95
|
+
[CommandName.Bootstrap]: {
|
|
96
|
+
query: BootstrapQuery;
|
|
97
|
+
result: BootstrapResult;
|
|
98
|
+
};
|
|
76
99
|
[CommandName.CreateBlock]: {
|
|
77
100
|
query: CreateBlockQuery;
|
|
78
101
|
result: CreateBlockResult;
|
|
@@ -165,6 +188,10 @@ export declare type CommandArgs = {
|
|
|
165
188
|
query: HideModalQuery;
|
|
166
189
|
result: HideModalResult;
|
|
167
190
|
};
|
|
191
|
+
[CommandName.HidePanel]: {
|
|
192
|
+
query: HidePanelQuery;
|
|
193
|
+
result: HidePanelResult;
|
|
194
|
+
};
|
|
168
195
|
[CommandName.KillExtension]: {
|
|
169
196
|
query: KillExtensionQuery;
|
|
170
197
|
result: KillExtensionResult;
|
|
@@ -223,7 +250,7 @@ export declare type CommandArgs = {
|
|
|
223
250
|
};
|
|
224
251
|
[CommandName.LogForTestCase]: {
|
|
225
252
|
query: JsonSerializable;
|
|
226
|
-
result:
|
|
253
|
+
result: JsonSerializable;
|
|
227
254
|
};
|
|
228
255
|
[CommandName.OffsetItems]: {
|
|
229
256
|
query: OffsetItemsQuery;
|
|
@@ -233,10 +260,18 @@ export declare type CommandArgs = {
|
|
|
233
260
|
query: PatchDataItemsQuery;
|
|
234
261
|
result: PatchDataItemsResult;
|
|
235
262
|
};
|
|
263
|
+
[CommandName.RegisterPanel]: {
|
|
264
|
+
query: RegisterPanelQuery;
|
|
265
|
+
result: RegisterPanelResult;
|
|
266
|
+
};
|
|
236
267
|
[CommandName.ReloadExtension]: {
|
|
237
268
|
query: ReloadExtensionQuery;
|
|
238
269
|
result: ReloadExtensionResult;
|
|
239
270
|
};
|
|
271
|
+
[CommandName.SendOAuthRequest]: {
|
|
272
|
+
query: SendOAuthRequestQuery;
|
|
273
|
+
result: SendOAuthRequestResponse;
|
|
274
|
+
};
|
|
240
275
|
[CommandName.SendUIMessage]: {
|
|
241
276
|
query: SendUIMessageQuery;
|
|
242
277
|
result: SendUIMessageResult;
|
|
@@ -265,49 +300,94 @@ export declare type CommandArgs = {
|
|
|
265
300
|
query: ShowModalQuery;
|
|
266
301
|
result: ShowModalResult;
|
|
267
302
|
};
|
|
303
|
+
[CommandName.ShowPanel]: {
|
|
304
|
+
query: ShowPanelQuery;
|
|
305
|
+
result: ShowPanelResult;
|
|
306
|
+
};
|
|
307
|
+
[CommandName.SleepForTestCase]: {
|
|
308
|
+
query: SleepForTestCaseQuery;
|
|
309
|
+
result: SleepForTestCaseResult;
|
|
310
|
+
};
|
|
268
311
|
};
|
|
312
|
+
/** @ignore */
|
|
269
313
|
export declare type UnionToIntersection<T> = (T extends any ? (x: T) => unknown : never) extends (x: infer R) => unknown ? R : never;
|
|
270
314
|
export declare type AddMenuItemQuery = {
|
|
315
|
+
/** Label to display on the menu item */
|
|
271
316
|
'l': string;
|
|
317
|
+
/** Named action to run when the menu item is clicked */
|
|
272
318
|
'a': string;
|
|
319
|
+
/** Named action that returns whether the menu item should be visible */
|
|
273
320
|
'v'?: string;
|
|
321
|
+
/** Named action that returns whether the menu item should be disabled */
|
|
274
322
|
'd'?: string;
|
|
323
|
+
/** Which menu to put the item in */
|
|
275
324
|
't': MenuType;
|
|
325
|
+
/** If specified, where to place the menu item; defaults to MenuLocation.Extension */
|
|
276
326
|
'loc'?: MenuLocation;
|
|
277
327
|
};
|
|
278
328
|
export declare type AddMenuItemResult = undefined;
|
|
279
329
|
export declare type AddShapeDataQuery = {
|
|
330
|
+
/** ID of the element to add this shape data to */
|
|
280
331
|
'id'?: string | undefined;
|
|
332
|
+
/** Name for this shape data */
|
|
281
333
|
'n': string;
|
|
334
|
+
/** Inheritance setting for the new shape data */
|
|
282
335
|
'i': ShapeDataInheritance;
|
|
336
|
+
/** Initial value of this shape data; use a string beginning with '=' for a formula */
|
|
283
337
|
'v'?: SerializedFieldType;
|
|
284
338
|
};
|
|
285
339
|
export declare type AddShapeDataResult = undefined;
|
|
340
|
+
export declare type BootstrapQuery = {
|
|
341
|
+
/**
|
|
342
|
+
* Named action that accepts the bootstrap data, and which may return a Promise or void. After awaiting\
|
|
343
|
+
* the result of the callback, the bootstrap data is cleared.
|
|
344
|
+
*/
|
|
345
|
+
'c': string;
|
|
346
|
+
};
|
|
347
|
+
export declare type BootstrapResult = Promise<void>;
|
|
286
348
|
export declare type CreateBlockQuery = {
|
|
349
|
+
/**
|
|
350
|
+
* By default, we add the block to the current page & currently active group. If specified, the
|
|
351
|
+
* block will instead be created as a direct child of the given page.
|
|
352
|
+
*/
|
|
287
353
|
'p'?: string;
|
|
354
|
+
/** Class name of the block to create */
|
|
288
355
|
'c': string;
|
|
356
|
+
/** If specified, the stencil for a custom shape. Only valid if the class name is 'CustomBlock' */
|
|
289
357
|
's'?: JsonSerializable | undefined;
|
|
290
358
|
};
|
|
291
359
|
export declare type CreateBlockResult = string;
|
|
292
360
|
export declare type CreateCollectionFieldDefinition = {
|
|
361
|
+
/** Name of the field */
|
|
293
362
|
'n': string;
|
|
363
|
+
/** Type of the values in this field */
|
|
294
364
|
't': SerializedFieldTypeDefinition;
|
|
295
365
|
};
|
|
296
366
|
export declare type CreateCollectionQuery = {
|
|
367
|
+
/** ID of the data source to add this collection to */
|
|
297
368
|
's': string;
|
|
369
|
+
/** Name of the collection */
|
|
298
370
|
'n': string;
|
|
371
|
+
/** Fields that can be set on data items in this collection */
|
|
299
372
|
'f': CreateCollectionFieldDefinition[];
|
|
373
|
+
/** Field(s) to use as the primary key of this collection */
|
|
300
374
|
'p': string[];
|
|
301
375
|
};
|
|
302
376
|
export declare type CreateCollectionResult = string;
|
|
303
377
|
export declare type CreateDataSourceQuery = {
|
|
378
|
+
/** Name of the data source */
|
|
304
379
|
'n': string;
|
|
380
|
+
/** Source configuration for this data source--information about where it came from, or any metadata that might be useful */
|
|
305
381
|
's': {
|
|
306
382
|
[key: string]: JsonSerializable;
|
|
307
383
|
};
|
|
308
384
|
};
|
|
309
385
|
export declare type CreateDataSourceResult = string;
|
|
310
386
|
export declare type CreateLineQuery = {
|
|
387
|
+
/**
|
|
388
|
+
* By default, we add the line to the current page & currently active group. If specified, the
|
|
389
|
+
* line will instead be created as a direct child of the given page.
|
|
390
|
+
*/
|
|
311
391
|
'p'?: string;
|
|
312
392
|
};
|
|
313
393
|
export declare type CreateLineResult = string;
|
|
@@ -318,14 +398,20 @@ export declare type DeleteItemResult = boolean;
|
|
|
318
398
|
export declare type DeletePageQuery = string;
|
|
319
399
|
export declare type DeletePageResult = boolean;
|
|
320
400
|
export declare type DeleteShapeDataQuery = {
|
|
401
|
+
/** ID of the element to delete this shape data from */
|
|
321
402
|
'id'?: string | undefined;
|
|
403
|
+
/** Name for this shape data */
|
|
322
404
|
'n': string;
|
|
323
405
|
};
|
|
324
406
|
export declare type DeleteShapeDataResult = undefined;
|
|
325
407
|
export declare type DownloadQuery = {
|
|
408
|
+
/** Filename of the download */
|
|
326
409
|
'f': string;
|
|
410
|
+
/** Data to put in the file */
|
|
327
411
|
'd': string;
|
|
412
|
+
/** MIME type for the download */
|
|
328
413
|
'm': string;
|
|
414
|
+
/** If true, data is base64-encoded and should be converted to binary for download */
|
|
329
415
|
'b64': boolean;
|
|
330
416
|
};
|
|
331
417
|
export declare type DownloadResult = undefined;
|
|
@@ -334,12 +420,16 @@ export declare type ElementExistsQuery = {
|
|
|
334
420
|
};
|
|
335
421
|
export declare type ElementExistsResult = boolean;
|
|
336
422
|
export declare type ExecuteFormulaQuery = {
|
|
423
|
+
/** ID of the element to execute a formula on */
|
|
337
424
|
'id': string;
|
|
425
|
+
/** Formula to execute, e.g. '@a + @b' or 'CONTAINEDBY' */
|
|
338
426
|
'f': string;
|
|
339
427
|
};
|
|
340
428
|
export declare type ExecuteFormulaResult = SerializedFieldType | SerializedDataError;
|
|
341
429
|
export declare type AnimateViewportQuery = {
|
|
430
|
+
/** ID of the page to view */
|
|
342
431
|
'p': string;
|
|
432
|
+
/** Bounding box on that page that will fill as much of the viewport as possible */
|
|
343
433
|
'bb': Box;
|
|
344
434
|
};
|
|
345
435
|
export declare type AnimateViewportResult = Promise<void>;
|
|
@@ -352,66 +442,94 @@ export declare type GetConnectedLinesResult = string[];
|
|
|
352
442
|
export declare type GetCurrentPageQuery = void;
|
|
353
443
|
export declare type GetCurrentPageResult = string | undefined;
|
|
354
444
|
export declare type GetCustomShapeQuery = {
|
|
445
|
+
/** Name of the custom shape library in this same extension package */
|
|
355
446
|
'l': string;
|
|
447
|
+
/** Name of the shape in that library to find */
|
|
356
448
|
's': string;
|
|
357
449
|
};
|
|
358
450
|
export declare type GetCustomShapeResult = Promise<{
|
|
451
|
+
/** Value which can be used as the Stencil property on a dynamic shape */
|
|
359
452
|
's': JsonSerializable;
|
|
453
|
+
/** Default size (x:0, y:0) of this custom shape */
|
|
360
454
|
'bb': Box;
|
|
455
|
+
/** Other default property values */
|
|
361
456
|
'p': JsonObject;
|
|
362
457
|
} | undefined>;
|
|
363
458
|
export declare type GetDataItemFieldQuery = {
|
|
459
|
+
/** Collection ID to query */
|
|
364
460
|
'c': string;
|
|
461
|
+
/** Primary key of the data item to read */
|
|
365
462
|
'pk': string;
|
|
463
|
+
/** Name of field to read */
|
|
366
464
|
'f': string;
|
|
367
465
|
};
|
|
368
466
|
export declare type GetDataItemFieldResult = SerializedFieldType;
|
|
369
467
|
export declare type GetItemPageIdQuery = string;
|
|
370
468
|
export declare type GetItemPageIdResult = string;
|
|
371
469
|
export declare type GetReferenceKeyQuery = {
|
|
470
|
+
/** ID of the LucidElement to read a reference key from, or undefined to read from the LucidDocument */
|
|
372
471
|
'id'?: string;
|
|
472
|
+
/** Reference key to get */
|
|
373
473
|
'k': number | string;
|
|
374
474
|
};
|
|
375
475
|
export declare type GetReferenceKeyResult = SerializedReferenceKeyType;
|
|
376
476
|
export declare type GetPropertyQuery = {
|
|
477
|
+
/** ID of the LucidElement to read a property from, or undefined to read from the LucidDocument */
|
|
377
478
|
'id'?: string | undefined;
|
|
479
|
+
/** Name of the property to read */
|
|
378
480
|
'p': string;
|
|
379
481
|
};
|
|
380
482
|
export declare type GetPropertyResult = JsonSerializable;
|
|
381
483
|
export declare type GetRelativeLinePositionQuery = {
|
|
484
|
+
/** Block or line ID to check the connections on */
|
|
382
485
|
'id': string;
|
|
486
|
+
/** Relative position in range of [0,1] along the line */
|
|
383
487
|
'p': number;
|
|
384
488
|
};
|
|
385
489
|
export declare type GetRelativeLinePositionResult = Point;
|
|
386
490
|
export declare type GetSelectionQuery = {
|
|
491
|
+
/** If set, additionally return all items inside selected groups */
|
|
387
492
|
'd'?: boolean;
|
|
388
493
|
};
|
|
389
494
|
export declare type GetSelectionResult = string[];
|
|
390
495
|
export declare type GetShapeDataQuery = {
|
|
496
|
+
/** ID of the element to query shape data from */
|
|
391
497
|
'id'?: string | undefined;
|
|
498
|
+
/** Name of the shape data to read */
|
|
392
499
|
'n': string;
|
|
393
500
|
};
|
|
394
501
|
export declare type GetShapeDataResult = SerializedFieldType | SerializedDataError;
|
|
395
502
|
export declare type HideModalQuery = {
|
|
503
|
+
/** Name of the modal's action for receiving events, i.e. ShowModalQuery['n'] */
|
|
396
504
|
'n': string;
|
|
397
505
|
};
|
|
398
506
|
export declare type HideModalResult = undefined;
|
|
507
|
+
export declare type HidePanelQuery = {
|
|
508
|
+
/** Name of the panel's action for receiving events, i.e. RegisterPanelQuery['n'] */
|
|
509
|
+
'n': string;
|
|
510
|
+
};
|
|
511
|
+
export declare type HidePanelResult = undefined;
|
|
399
512
|
export declare type KillExtensionQuery = void;
|
|
400
513
|
export declare type KillExtensionResult = undefined;
|
|
401
514
|
export declare type ListChildrenQuery = {
|
|
515
|
+
/** Parent ID to search inside */
|
|
402
516
|
'id': string;
|
|
517
|
+
/** "deep" - If true, get all children at any level of group nesting; otherwise only immediate children */
|
|
403
518
|
'd'?: boolean;
|
|
404
519
|
};
|
|
405
520
|
export declare type ListChildrenResult = string[];
|
|
406
521
|
export declare type ListCollectionsQuery = {
|
|
522
|
+
/** ID of the data source to list collections for */
|
|
407
523
|
'id': string;
|
|
408
524
|
};
|
|
409
525
|
export declare type ListCollectionsResult = string[];
|
|
410
526
|
export declare type ListDataItemsQuery = {
|
|
527
|
+
/** Collection ID to list items from */
|
|
411
528
|
'id': string;
|
|
412
529
|
};
|
|
413
530
|
export declare type ListDataItemsResult = string[];
|
|
414
531
|
export declare type ListCollectionFieldsQuery = {
|
|
532
|
+
/** Collection ID to query */
|
|
415
533
|
'id': string;
|
|
416
534
|
};
|
|
417
535
|
export declare type ListCollectionFieldsResult = string[];
|
|
@@ -420,8 +538,10 @@ export declare type ListDataSourcesResult = string[];
|
|
|
420
538
|
export declare type ListPagesQuery = void;
|
|
421
539
|
export declare type ListPagesResult = string[];
|
|
422
540
|
export declare type ListReferenceKeysQuery = {
|
|
541
|
+
/** ID of the element to list reference keys for, or undefined for the document */
|
|
423
542
|
'id'?: string | undefined;
|
|
424
543
|
};
|
|
544
|
+
/** Reference key IDs */
|
|
425
545
|
export declare type ListReferenceKeysResult = (string | number)[];
|
|
426
546
|
export declare type ListPropertiesQuery = {
|
|
427
547
|
'id'?: string | undefined;
|
|
@@ -429,6 +549,7 @@ export declare type ListPropertiesQuery = {
|
|
|
429
549
|
export declare type ListPropertiesResult = string[];
|
|
430
550
|
export declare type ListShapeDataQuery = {
|
|
431
551
|
'id'?: string | undefined;
|
|
552
|
+
/** True to include inherited shape data from containing groups and/or page */
|
|
432
553
|
'i'?: boolean | undefined;
|
|
433
554
|
};
|
|
434
555
|
export declare type ListShapeDataResult = string[];
|
|
@@ -437,27 +558,57 @@ export declare type ListTextAreasResult = string[];
|
|
|
437
558
|
export declare type LoadBlockClassesQuery = string[];
|
|
438
559
|
export declare type LoadBlockClassesResult = Promise<undefined>;
|
|
439
560
|
export declare type OffsetItemsQuery = {
|
|
561
|
+
/** IDs of the items (blocks, lines, groups) to move */
|
|
440
562
|
'ids': string[];
|
|
563
|
+
/** What kind of offset to perform */
|
|
441
564
|
't': LinearOffsetType;
|
|
565
|
+
/** How far to offset */
|
|
442
566
|
'o': Point;
|
|
443
567
|
};
|
|
444
568
|
export declare type OffsetItemsResult = undefined;
|
|
445
569
|
export declare type PatchDataItemsQuery = {
|
|
570
|
+
/** ID of the data collection to patch */
|
|
446
571
|
'id': string;
|
|
572
|
+
/** Data items to add to the collection */
|
|
447
573
|
'a': Record<string, SerializedFieldType>[];
|
|
574
|
+
/** Data items to change field values on, keyed by primary key */
|
|
448
575
|
'c': Record<string, Record<string, SerializedFieldType>>;
|
|
576
|
+
/** Primary keys of items to delete */
|
|
449
577
|
'd': string[];
|
|
450
578
|
};
|
|
451
579
|
export declare type PatchDataItemsResult = undefined;
|
|
580
|
+
export declare type RegisterPanelQuery = {
|
|
581
|
+
/** Name of the panel's action for receiving events; generated automatically by Panel base class */
|
|
582
|
+
'n': string;
|
|
583
|
+
/** Title to show on the panel */
|
|
584
|
+
't': string;
|
|
585
|
+
/** Where to display the panel */
|
|
586
|
+
'l': PanelLocation;
|
|
587
|
+
/** Named action that returns whether the button to open the panel should be visible */
|
|
588
|
+
'v'?: string;
|
|
589
|
+
/** Content to display in the panel; full HTML page preferred */
|
|
590
|
+
'c': string;
|
|
591
|
+
/** Icon URL, preferably a base64-encoded URL */
|
|
592
|
+
'i': string;
|
|
593
|
+
};
|
|
594
|
+
export declare type RegisterPanelResult = undefined;
|
|
452
595
|
export declare type ReloadExtensionQuery = void;
|
|
453
596
|
export declare type ReloadExtensionResult = undefined;
|
|
597
|
+
export declare type SendOAuthRequestQuery = SendXHRQuery & {
|
|
598
|
+
/** OAuth provider name as specified in the package manifest */
|
|
599
|
+
'p': string;
|
|
600
|
+
};
|
|
601
|
+
export declare type SendOAuthRequestResponse = SendXHRResponse;
|
|
454
602
|
export declare type SendUIMessageQuery = {
|
|
603
|
+
/** Name of the UI component's action for receiving events, e.g. ShowModalQuery['n'] */
|
|
455
604
|
'n': string;
|
|
605
|
+
/** Content of the message to send to the custom UI component */
|
|
456
606
|
'd'?: JsonSerializable;
|
|
457
607
|
};
|
|
458
608
|
export declare type SendUIMessageResult = undefined;
|
|
459
609
|
export declare type SendXHRQuery = {
|
|
460
610
|
'url': string;
|
|
611
|
+
/** HTTP method, e.g. 'GET', 'FETCH', etc. Defaults to GET */
|
|
461
612
|
'm'?: string;
|
|
462
613
|
/**
|
|
463
614
|
* The data to send with the request.
|
|
@@ -468,46 +619,74 @@ export declare type SendXHRQuery = {
|
|
|
468
619
|
* no 'Content-Type' header is specified, a 'text/plain; charset=utf-8' content type is sent.
|
|
469
620
|
*/
|
|
470
621
|
'd'?: string;
|
|
622
|
+
/** Headers to send with the request */
|
|
471
623
|
'h'?: {
|
|
472
624
|
[key: string]: string | string[];
|
|
473
625
|
};
|
|
626
|
+
/** Timeout in milliseconds, if specified */
|
|
474
627
|
'ms'?: number;
|
|
475
628
|
};
|
|
476
629
|
export declare type RawSendXHRResponse = {
|
|
630
|
+
/** URL of the response after any redirects */
|
|
477
631
|
'url': string;
|
|
632
|
+
/** Plain-text response body */
|
|
478
633
|
't': string;
|
|
634
|
+
/** Status code of the response */
|
|
479
635
|
's': number;
|
|
636
|
+
/** Headers sent with the response */
|
|
480
637
|
'h': {
|
|
481
638
|
[key: string]: string;
|
|
482
639
|
};
|
|
640
|
+
/** true if the request timed out */
|
|
483
641
|
'to'?: boolean;
|
|
484
642
|
};
|
|
485
643
|
export declare type SendXHRResponse = Promise<RawSendXHRResponse>;
|
|
486
644
|
export declare type SetCurrentPageQuery = string;
|
|
487
645
|
export declare type SetCurrentPageResult = Promise<void>;
|
|
488
646
|
export declare type SetPropertyQuery = {
|
|
647
|
+
/** ID of the element to change */
|
|
489
648
|
'id'?: string | undefined;
|
|
649
|
+
/** Name of the property to change */
|
|
490
650
|
'p': string;
|
|
651
|
+
/** New value of the property */
|
|
491
652
|
'v'?: JsonSerializable;
|
|
492
653
|
};
|
|
493
654
|
export declare type SetPropertyResult = undefined;
|
|
494
655
|
export declare type SetReferenceKeyQuery = {
|
|
656
|
+
/** ID of the element to set the reference key on */
|
|
495
657
|
'id'?: string | undefined;
|
|
658
|
+
/** ID of the reference key to set */
|
|
496
659
|
'k': string | number;
|
|
660
|
+
/** New reference key settings, or undefined to remove the reference key */
|
|
497
661
|
'v'?: SerializedReferenceKeyType;
|
|
498
662
|
};
|
|
499
663
|
export declare type SetReferenceKeyResult = undefined;
|
|
500
664
|
export declare type SetShapeDataQuery = {
|
|
665
|
+
/** ID of the element to set this shape data on */
|
|
501
666
|
'id'?: string | undefined;
|
|
667
|
+
/** Name for the already-existing shape data to update */
|
|
502
668
|
'n': string;
|
|
669
|
+
/** Value to set; use a string beginning with '=' for a formula */
|
|
503
670
|
'v'?: SerializedFieldType;
|
|
504
671
|
};
|
|
505
672
|
export declare type SetShapeDataResult = undefined;
|
|
506
673
|
export declare type ShowModalQuery = {
|
|
674
|
+
/** Name of the modal's action for receiving events; generated automatically by Modal base class */
|
|
507
675
|
'n': string;
|
|
676
|
+
/** Title to show on the modal */
|
|
508
677
|
't': string;
|
|
678
|
+
/** Desired modal width */
|
|
509
679
|
'w': number;
|
|
680
|
+
/** Desired modal height */
|
|
510
681
|
'h': number;
|
|
682
|
+
/** Content to display in the modal; full HTML page preferred */
|
|
511
683
|
'c': string;
|
|
512
684
|
};
|
|
513
685
|
export declare type ShowModalResult = undefined;
|
|
686
|
+
export declare type ShowPanelQuery = {
|
|
687
|
+
/** Name of the panel's action for receiving events, i.e. RegisterPanelQuery['n'] */
|
|
688
|
+
'n': string;
|
|
689
|
+
};
|
|
690
|
+
export declare type ShowPanelResult = undefined;
|
|
691
|
+
export declare type SleepForTestCaseQuery = number;
|
|
692
|
+
export declare type SleepForTestCaseResult = Promise<void>;
|
|
@@ -2,6 +2,10 @@ export declare type JsonArray = Array<JsonSerializable>;
|
|
|
2
2
|
export interface JsonObject {
|
|
3
3
|
[key: string]: JsonSerializable;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* 'json-able' but specificallyfor json objects
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
5
9
|
export interface JsonObjectConvertible {
|
|
6
10
|
toJsonObject(): JsonObject;
|
|
7
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SerializedFieldType } from '../core/data/serializedfield/serializedfields';
|
|
2
|
-
import { ElementProxy } from '../document/elementproxy';
|
|
3
2
|
import { MapProxy } from '../document/mapproxy';
|
|
3
|
+
import { PropertyStoreProxy } from '../document/propertystoreproxy';
|
|
4
4
|
import { EditorClient } from '../editorclient';
|
|
5
5
|
import { DataItemProxy } from './dataitemproxy';
|
|
6
6
|
/**
|
|
7
7
|
* A collection is a set of data items, each with the same set of fields (though some data items may not have all
|
|
8
8
|
* fields defined).
|
|
9
9
|
*/
|
|
10
|
-
export declare class CollectionProxy extends
|
|
10
|
+
export declare class CollectionProxy extends PropertyStoreProxy {
|
|
11
11
|
readonly id: string;
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollectionProxy = void 0;
|
|
4
|
-
const elementproxy_1 = require("../document/elementproxy");
|
|
5
4
|
const mapproxy_1 = require("../document/mapproxy");
|
|
5
|
+
const propertystoreproxy_1 = require("../document/propertystoreproxy");
|
|
6
6
|
const dataitemproxy_1 = require("./dataitemproxy");
|
|
7
7
|
/**
|
|
8
8
|
* A collection is a set of data items, each with the same set of fields (though some data items may not have all
|
|
9
9
|
* fields defined).
|
|
10
10
|
*/
|
|
11
|
-
class CollectionProxy extends
|
|
11
|
+
class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @param id ID of this collection on the current document
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonSerializable } from '../core/jsonserializable';
|
|
2
|
-
import { ElementProxy } from '../document/elementproxy';
|
|
3
2
|
import { MapProxy } from '../document/mapproxy';
|
|
3
|
+
import { PropertyStoreProxy } from '../document/propertystoreproxy';
|
|
4
4
|
import { EditorClient } from '../editorclient';
|
|
5
5
|
import { CollectionProxy } from './collectionproxy';
|
|
6
6
|
import { SchemaDefinition } from './schemadefinition';
|
|
@@ -8,7 +8,7 @@ import { SchemaDefinition } from './schemadefinition';
|
|
|
8
8
|
* A data source represents a set of related data collections on a document. Typically one data source
|
|
9
9
|
* is produced for each data import.
|
|
10
10
|
*/
|
|
11
|
-
export declare class DataSourceProxy extends
|
|
11
|
+
export declare class DataSourceProxy extends PropertyStoreProxy {
|
|
12
12
|
readonly id: string;
|
|
13
13
|
/**
|
|
14
14
|
* @param id ID of the collection on the current document
|
|
@@ -21,9 +21,15 @@ export declare class DataSourceProxy extends ElementProxy {
|
|
|
21
21
|
* the collection ID on other documents if the same data is imported there.
|
|
22
22
|
*/
|
|
23
23
|
readonly collections: MapProxy<string, CollectionProxy>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new collection as part of this data source.
|
|
26
|
+
* @param name
|
|
27
|
+
* @param schema
|
|
28
|
+
* @returns The newly created collection
|
|
29
|
+
*/
|
|
24
30
|
addCollection(name: string, schema: SchemaDefinition): CollectionProxy;
|
|
25
31
|
/**
|
|
26
|
-
* @returns
|
|
32
|
+
* @returns A human-readable name for this data source
|
|
27
33
|
*/
|
|
28
34
|
getName(): string;
|
|
29
35
|
/**
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DataSourceProxy = void 0;
|
|
4
4
|
const checks_1 = require("../core/checks");
|
|
5
5
|
const fieldtypedefinition_1 = require("../core/data/fieldtypedefinition/fieldtypedefinition");
|
|
6
|
-
const elementproxy_1 = require("../document/elementproxy");
|
|
7
6
|
const mapproxy_1 = require("../document/mapproxy");
|
|
7
|
+
const propertystoreproxy_1 = require("../document/propertystoreproxy");
|
|
8
8
|
const collectionproxy_1 = require("./collectionproxy");
|
|
9
9
|
/**
|
|
10
10
|
* A data source represents a set of related data collections on a document. Typically one data source
|
|
11
11
|
* is produced for each data import.
|
|
12
12
|
*/
|
|
13
|
-
class DataSourceProxy extends
|
|
13
|
+
class DataSourceProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
14
14
|
/**
|
|
15
15
|
* @param id ID of the collection on the current document
|
|
16
16
|
* @param client
|
|
@@ -25,6 +25,12 @@ class DataSourceProxy extends elementproxy_1.ElementProxy {
|
|
|
25
25
|
*/
|
|
26
26
|
this.collections = new mapproxy_1.MapProxy(() => this.client.sendCommand("lc" /* ListCollections */, { 'id': this.id }), (id) => new collectionproxy_1.CollectionProxy(id, this.client));
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new collection as part of this data source.
|
|
30
|
+
* @param name
|
|
31
|
+
* @param schema
|
|
32
|
+
* @returns The newly created collection
|
|
33
|
+
*/
|
|
28
34
|
addCollection(name, schema) {
|
|
29
35
|
return new collectionproxy_1.CollectionProxy(this.client.sendCommand("cc" /* CreateCollection */, {
|
|
30
36
|
's': this.id,
|
|
@@ -34,7 +40,7 @@ class DataSourceProxy extends elementproxy_1.ElementProxy {
|
|
|
34
40
|
}), this.client);
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
|
-
* @returns
|
|
43
|
+
* @returns A human-readable name for this data source
|
|
38
44
|
*/
|
|
39
45
|
getName() {
|
|
40
46
|
return this.properties.get('Name');
|
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
import { SerializedReferenceKeyType } from '../core/data/referencekeys/serializedreferencekey';
|
|
2
2
|
import { SerializedFieldType } from '../core/data/serializedfield/serializedfields';
|
|
3
3
|
import { SchemaDefinition } from './schemadefinition';
|
|
4
|
+
/**
|
|
5
|
+
* A reference key that points to a [DataItem](#classes_data_dataitemproxy-DataItemProxy) in a
|
|
6
|
+
* [Collection](#classes_data_collectionproxy-CollectionProxy). This is the most common type of
|
|
7
|
+
* reference key to create.
|
|
8
|
+
*
|
|
9
|
+
* For more information, see the [Developer Guide](/extension-api#guide-reference-keys).
|
|
10
|
+
*/
|
|
4
11
|
export interface CollectionReferenceKeyDefinition {
|
|
12
|
+
/** The ID of the collection referenced */
|
|
5
13
|
collectionId: string;
|
|
14
|
+
/** The [primary key](#classes_data_dataitemproxy-DataItemProxy_primarykey) of the data item referenced */
|
|
6
15
|
primaryKey: string;
|
|
7
|
-
|
|
16
|
+
/** If true, prevent the user from editing the field values of this reference key through the normal UI */
|
|
8
17
|
readonly?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If specified, only expose this list of fields through this reference key. This can be used to limit
|
|
20
|
+
* namespace pollution in shape data from lots of unnecessary fields, or just to hide information you'd
|
|
21
|
+
* prefer not to be visible in the UI or through formulas.
|
|
22
|
+
*/
|
|
23
|
+
fieldWhitelist?: string[];
|
|
9
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A reference key that has the field values embedded directly in the reference definition. This can be
|
|
27
|
+
* useful in cases when you want to have a standard schema of data associated with an element but do not
|
|
28
|
+
* for whatever reason want to construct an actual [Collection](#classes_data_collectionproxy-CollectionProxy)
|
|
29
|
+
* to house that data.
|
|
30
|
+
*/
|
|
10
31
|
export interface FlattenedReferenceDefinition {
|
|
32
|
+
/** Name to display to the user for the reference key (what would normally be the collection name) */
|
|
11
33
|
name: string;
|
|
34
|
+
/** Schema of the data stored at this key */
|
|
12
35
|
schema: SchemaDefinition;
|
|
36
|
+
/** Field values available at this reference key */
|
|
13
37
|
data: Record<string, SerializedFieldType>;
|
|
14
38
|
}
|
|
15
39
|
export declare type ReferenceKeyDefinition = CollectionReferenceKeyDefinition | FlattenedReferenceDefinition;
|
|
40
|
+
/** @ignore */
|
|
16
41
|
export declare function isCollectionReferenceKeyDefinition(def: ReferenceKeyDefinition): def is CollectionReferenceKeyDefinition;
|
|
42
|
+
/** @ignore */
|
|
17
43
|
export declare function serializeReferenceKeyDefinition(def: ReferenceKeyDefinition): SerializedReferenceKeyType;
|