lucid-extension-sdk 0.0.8 → 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 +151 -1
- 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 +2 -2
- package/sdk/document/documentproxy.js +2 -2
- 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 +1 -2
- package/sdk/editorclient.js +1 -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,6 +7,14 @@ 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",
|
|
@@ -35,6 +43,7 @@ export declare const enum CommandName {
|
|
|
35
43
|
GetSelection = "gs",
|
|
36
44
|
GetShapeData = "gsd",
|
|
37
45
|
HideModal = "hm",
|
|
46
|
+
HidePanel = "hp",
|
|
38
47
|
KillExtension = "k",
|
|
39
48
|
ListBlocks = "lb",
|
|
40
49
|
ListCollectionFields = "lcf",
|
|
@@ -52,6 +61,7 @@ export declare const enum CommandName {
|
|
|
52
61
|
LogForTestCase = "log",
|
|
53
62
|
OffsetItems = "oi",
|
|
54
63
|
PatchDataItems = "pdi",
|
|
64
|
+
RegisterPanel = "rp",
|
|
55
65
|
ReloadExtension = "r",
|
|
56
66
|
SendOAuthRequest = "oauth",
|
|
57
67
|
SendUIMessage = "suim",
|
|
@@ -61,8 +71,14 @@ export declare const enum CommandName {
|
|
|
61
71
|
SetReferenceKey = "srk",
|
|
62
72
|
SetShapeData = "ssd",
|
|
63
73
|
ShowModal = "sm",
|
|
74
|
+
ShowPanel = "spn",
|
|
64
75
|
SleepForTestCase = "sleep"
|
|
65
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
|
+
*/
|
|
66
82
|
export declare type CommandArgs = {
|
|
67
83
|
[CommandName.AnimateViewport]: {
|
|
68
84
|
query: AnimateViewportQuery;
|
|
@@ -172,6 +188,10 @@ export declare type CommandArgs = {
|
|
|
172
188
|
query: HideModalQuery;
|
|
173
189
|
result: HideModalResult;
|
|
174
190
|
};
|
|
191
|
+
[CommandName.HidePanel]: {
|
|
192
|
+
query: HidePanelQuery;
|
|
193
|
+
result: HidePanelResult;
|
|
194
|
+
};
|
|
175
195
|
[CommandName.KillExtension]: {
|
|
176
196
|
query: KillExtensionQuery;
|
|
177
197
|
result: KillExtensionResult;
|
|
@@ -230,7 +250,7 @@ export declare type CommandArgs = {
|
|
|
230
250
|
};
|
|
231
251
|
[CommandName.LogForTestCase]: {
|
|
232
252
|
query: JsonSerializable;
|
|
233
|
-
result:
|
|
253
|
+
result: JsonSerializable;
|
|
234
254
|
};
|
|
235
255
|
[CommandName.OffsetItems]: {
|
|
236
256
|
query: OffsetItemsQuery;
|
|
@@ -240,6 +260,10 @@ export declare type CommandArgs = {
|
|
|
240
260
|
query: PatchDataItemsQuery;
|
|
241
261
|
result: PatchDataItemsResult;
|
|
242
262
|
};
|
|
263
|
+
[CommandName.RegisterPanel]: {
|
|
264
|
+
query: RegisterPanelQuery;
|
|
265
|
+
result: RegisterPanelResult;
|
|
266
|
+
};
|
|
243
267
|
[CommandName.ReloadExtension]: {
|
|
244
268
|
query: ReloadExtensionQuery;
|
|
245
269
|
result: ReloadExtensionResult;
|
|
@@ -276,25 +300,40 @@ export declare type CommandArgs = {
|
|
|
276
300
|
query: ShowModalQuery;
|
|
277
301
|
result: ShowModalResult;
|
|
278
302
|
};
|
|
303
|
+
[CommandName.ShowPanel]: {
|
|
304
|
+
query: ShowPanelQuery;
|
|
305
|
+
result: ShowPanelResult;
|
|
306
|
+
};
|
|
279
307
|
[CommandName.SleepForTestCase]: {
|
|
280
308
|
query: SleepForTestCaseQuery;
|
|
281
309
|
result: SleepForTestCaseResult;
|
|
282
310
|
};
|
|
283
311
|
};
|
|
312
|
+
/** @ignore */
|
|
284
313
|
export declare type UnionToIntersection<T> = (T extends any ? (x: T) => unknown : never) extends (x: infer R) => unknown ? R : never;
|
|
285
314
|
export declare type AddMenuItemQuery = {
|
|
315
|
+
/** Label to display on the menu item */
|
|
286
316
|
'l': string;
|
|
317
|
+
/** Named action to run when the menu item is clicked */
|
|
287
318
|
'a': string;
|
|
319
|
+
/** Named action that returns whether the menu item should be visible */
|
|
288
320
|
'v'?: string;
|
|
321
|
+
/** Named action that returns whether the menu item should be disabled */
|
|
289
322
|
'd'?: string;
|
|
323
|
+
/** Which menu to put the item in */
|
|
290
324
|
't': MenuType;
|
|
325
|
+
/** If specified, where to place the menu item; defaults to MenuLocation.Extension */
|
|
291
326
|
'loc'?: MenuLocation;
|
|
292
327
|
};
|
|
293
328
|
export declare type AddMenuItemResult = undefined;
|
|
294
329
|
export declare type AddShapeDataQuery = {
|
|
330
|
+
/** ID of the element to add this shape data to */
|
|
295
331
|
'id'?: string | undefined;
|
|
332
|
+
/** Name for this shape data */
|
|
296
333
|
'n': string;
|
|
334
|
+
/** Inheritance setting for the new shape data */
|
|
297
335
|
'i': ShapeDataInheritance;
|
|
336
|
+
/** Initial value of this shape data; use a string beginning with '=' for a formula */
|
|
298
337
|
'v'?: SerializedFieldType;
|
|
299
338
|
};
|
|
300
339
|
export declare type AddShapeDataResult = undefined;
|
|
@@ -307,30 +346,48 @@ export declare type BootstrapQuery = {
|
|
|
307
346
|
};
|
|
308
347
|
export declare type BootstrapResult = Promise<void>;
|
|
309
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
|
+
*/
|
|
310
353
|
'p'?: string;
|
|
354
|
+
/** Class name of the block to create */
|
|
311
355
|
'c': string;
|
|
356
|
+
/** If specified, the stencil for a custom shape. Only valid if the class name is 'CustomBlock' */
|
|
312
357
|
's'?: JsonSerializable | undefined;
|
|
313
358
|
};
|
|
314
359
|
export declare type CreateBlockResult = string;
|
|
315
360
|
export declare type CreateCollectionFieldDefinition = {
|
|
361
|
+
/** Name of the field */
|
|
316
362
|
'n': string;
|
|
363
|
+
/** Type of the values in this field */
|
|
317
364
|
't': SerializedFieldTypeDefinition;
|
|
318
365
|
};
|
|
319
366
|
export declare type CreateCollectionQuery = {
|
|
367
|
+
/** ID of the data source to add this collection to */
|
|
320
368
|
's': string;
|
|
369
|
+
/** Name of the collection */
|
|
321
370
|
'n': string;
|
|
371
|
+
/** Fields that can be set on data items in this collection */
|
|
322
372
|
'f': CreateCollectionFieldDefinition[];
|
|
373
|
+
/** Field(s) to use as the primary key of this collection */
|
|
323
374
|
'p': string[];
|
|
324
375
|
};
|
|
325
376
|
export declare type CreateCollectionResult = string;
|
|
326
377
|
export declare type CreateDataSourceQuery = {
|
|
378
|
+
/** Name of the data source */
|
|
327
379
|
'n': string;
|
|
380
|
+
/** Source configuration for this data source--information about where it came from, or any metadata that might be useful */
|
|
328
381
|
's': {
|
|
329
382
|
[key: string]: JsonSerializable;
|
|
330
383
|
};
|
|
331
384
|
};
|
|
332
385
|
export declare type CreateDataSourceResult = string;
|
|
333
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
|
+
*/
|
|
334
391
|
'p'?: string;
|
|
335
392
|
};
|
|
336
393
|
export declare type CreateLineResult = string;
|
|
@@ -341,14 +398,20 @@ export declare type DeleteItemResult = boolean;
|
|
|
341
398
|
export declare type DeletePageQuery = string;
|
|
342
399
|
export declare type DeletePageResult = boolean;
|
|
343
400
|
export declare type DeleteShapeDataQuery = {
|
|
401
|
+
/** ID of the element to delete this shape data from */
|
|
344
402
|
'id'?: string | undefined;
|
|
403
|
+
/** Name for this shape data */
|
|
345
404
|
'n': string;
|
|
346
405
|
};
|
|
347
406
|
export declare type DeleteShapeDataResult = undefined;
|
|
348
407
|
export declare type DownloadQuery = {
|
|
408
|
+
/** Filename of the download */
|
|
349
409
|
'f': string;
|
|
410
|
+
/** Data to put in the file */
|
|
350
411
|
'd': string;
|
|
412
|
+
/** MIME type for the download */
|
|
351
413
|
'm': string;
|
|
414
|
+
/** If true, data is base64-encoded and should be converted to binary for download */
|
|
352
415
|
'b64': boolean;
|
|
353
416
|
};
|
|
354
417
|
export declare type DownloadResult = undefined;
|
|
@@ -357,12 +420,16 @@ export declare type ElementExistsQuery = {
|
|
|
357
420
|
};
|
|
358
421
|
export declare type ElementExistsResult = boolean;
|
|
359
422
|
export declare type ExecuteFormulaQuery = {
|
|
423
|
+
/** ID of the element to execute a formula on */
|
|
360
424
|
'id': string;
|
|
425
|
+
/** Formula to execute, e.g. '@a + @b' or 'CONTAINEDBY' */
|
|
361
426
|
'f': string;
|
|
362
427
|
};
|
|
363
428
|
export declare type ExecuteFormulaResult = SerializedFieldType | SerializedDataError;
|
|
364
429
|
export declare type AnimateViewportQuery = {
|
|
430
|
+
/** ID of the page to view */
|
|
365
431
|
'p': string;
|
|
432
|
+
/** Bounding box on that page that will fill as much of the viewport as possible */
|
|
366
433
|
'bb': Box;
|
|
367
434
|
};
|
|
368
435
|
export declare type AnimateViewportResult = Promise<void>;
|
|
@@ -375,66 +442,94 @@ export declare type GetConnectedLinesResult = string[];
|
|
|
375
442
|
export declare type GetCurrentPageQuery = void;
|
|
376
443
|
export declare type GetCurrentPageResult = string | undefined;
|
|
377
444
|
export declare type GetCustomShapeQuery = {
|
|
445
|
+
/** Name of the custom shape library in this same extension package */
|
|
378
446
|
'l': string;
|
|
447
|
+
/** Name of the shape in that library to find */
|
|
379
448
|
's': string;
|
|
380
449
|
};
|
|
381
450
|
export declare type GetCustomShapeResult = Promise<{
|
|
451
|
+
/** Value which can be used as the Stencil property on a dynamic shape */
|
|
382
452
|
's': JsonSerializable;
|
|
453
|
+
/** Default size (x:0, y:0) of this custom shape */
|
|
383
454
|
'bb': Box;
|
|
455
|
+
/** Other default property values */
|
|
384
456
|
'p': JsonObject;
|
|
385
457
|
} | undefined>;
|
|
386
458
|
export declare type GetDataItemFieldQuery = {
|
|
459
|
+
/** Collection ID to query */
|
|
387
460
|
'c': string;
|
|
461
|
+
/** Primary key of the data item to read */
|
|
388
462
|
'pk': string;
|
|
463
|
+
/** Name of field to read */
|
|
389
464
|
'f': string;
|
|
390
465
|
};
|
|
391
466
|
export declare type GetDataItemFieldResult = SerializedFieldType;
|
|
392
467
|
export declare type GetItemPageIdQuery = string;
|
|
393
468
|
export declare type GetItemPageIdResult = string;
|
|
394
469
|
export declare type GetReferenceKeyQuery = {
|
|
470
|
+
/** ID of the LucidElement to read a reference key from, or undefined to read from the LucidDocument */
|
|
395
471
|
'id'?: string;
|
|
472
|
+
/** Reference key to get */
|
|
396
473
|
'k': number | string;
|
|
397
474
|
};
|
|
398
475
|
export declare type GetReferenceKeyResult = SerializedReferenceKeyType;
|
|
399
476
|
export declare type GetPropertyQuery = {
|
|
477
|
+
/** ID of the LucidElement to read a property from, or undefined to read from the LucidDocument */
|
|
400
478
|
'id'?: string | undefined;
|
|
479
|
+
/** Name of the property to read */
|
|
401
480
|
'p': string;
|
|
402
481
|
};
|
|
403
482
|
export declare type GetPropertyResult = JsonSerializable;
|
|
404
483
|
export declare type GetRelativeLinePositionQuery = {
|
|
484
|
+
/** Block or line ID to check the connections on */
|
|
405
485
|
'id': string;
|
|
486
|
+
/** Relative position in range of [0,1] along the line */
|
|
406
487
|
'p': number;
|
|
407
488
|
};
|
|
408
489
|
export declare type GetRelativeLinePositionResult = Point;
|
|
409
490
|
export declare type GetSelectionQuery = {
|
|
491
|
+
/** If set, additionally return all items inside selected groups */
|
|
410
492
|
'd'?: boolean;
|
|
411
493
|
};
|
|
412
494
|
export declare type GetSelectionResult = string[];
|
|
413
495
|
export declare type GetShapeDataQuery = {
|
|
496
|
+
/** ID of the element to query shape data from */
|
|
414
497
|
'id'?: string | undefined;
|
|
498
|
+
/** Name of the shape data to read */
|
|
415
499
|
'n': string;
|
|
416
500
|
};
|
|
417
501
|
export declare type GetShapeDataResult = SerializedFieldType | SerializedDataError;
|
|
418
502
|
export declare type HideModalQuery = {
|
|
503
|
+
/** Name of the modal's action for receiving events, i.e. ShowModalQuery['n'] */
|
|
419
504
|
'n': string;
|
|
420
505
|
};
|
|
421
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;
|
|
422
512
|
export declare type KillExtensionQuery = void;
|
|
423
513
|
export declare type KillExtensionResult = undefined;
|
|
424
514
|
export declare type ListChildrenQuery = {
|
|
515
|
+
/** Parent ID to search inside */
|
|
425
516
|
'id': string;
|
|
517
|
+
/** "deep" - If true, get all children at any level of group nesting; otherwise only immediate children */
|
|
426
518
|
'd'?: boolean;
|
|
427
519
|
};
|
|
428
520
|
export declare type ListChildrenResult = string[];
|
|
429
521
|
export declare type ListCollectionsQuery = {
|
|
522
|
+
/** ID of the data source to list collections for */
|
|
430
523
|
'id': string;
|
|
431
524
|
};
|
|
432
525
|
export declare type ListCollectionsResult = string[];
|
|
433
526
|
export declare type ListDataItemsQuery = {
|
|
527
|
+
/** Collection ID to list items from */
|
|
434
528
|
'id': string;
|
|
435
529
|
};
|
|
436
530
|
export declare type ListDataItemsResult = string[];
|
|
437
531
|
export declare type ListCollectionFieldsQuery = {
|
|
532
|
+
/** Collection ID to query */
|
|
438
533
|
'id': string;
|
|
439
534
|
};
|
|
440
535
|
export declare type ListCollectionFieldsResult = string[];
|
|
@@ -443,8 +538,10 @@ export declare type ListDataSourcesResult = string[];
|
|
|
443
538
|
export declare type ListPagesQuery = void;
|
|
444
539
|
export declare type ListPagesResult = string[];
|
|
445
540
|
export declare type ListReferenceKeysQuery = {
|
|
541
|
+
/** ID of the element to list reference keys for, or undefined for the document */
|
|
446
542
|
'id'?: string | undefined;
|
|
447
543
|
};
|
|
544
|
+
/** Reference key IDs */
|
|
448
545
|
export declare type ListReferenceKeysResult = (string | number)[];
|
|
449
546
|
export declare type ListPropertiesQuery = {
|
|
450
547
|
'id'?: string | undefined;
|
|
@@ -452,6 +549,7 @@ export declare type ListPropertiesQuery = {
|
|
|
452
549
|
export declare type ListPropertiesResult = string[];
|
|
453
550
|
export declare type ListShapeDataQuery = {
|
|
454
551
|
'id'?: string | undefined;
|
|
552
|
+
/** True to include inherited shape data from containing groups and/or page */
|
|
455
553
|
'i'?: boolean | undefined;
|
|
456
554
|
};
|
|
457
555
|
export declare type ListShapeDataResult = string[];
|
|
@@ -460,31 +558,57 @@ export declare type ListTextAreasResult = string[];
|
|
|
460
558
|
export declare type LoadBlockClassesQuery = string[];
|
|
461
559
|
export declare type LoadBlockClassesResult = Promise<undefined>;
|
|
462
560
|
export declare type OffsetItemsQuery = {
|
|
561
|
+
/** IDs of the items (blocks, lines, groups) to move */
|
|
463
562
|
'ids': string[];
|
|
563
|
+
/** What kind of offset to perform */
|
|
464
564
|
't': LinearOffsetType;
|
|
565
|
+
/** How far to offset */
|
|
465
566
|
'o': Point;
|
|
466
567
|
};
|
|
467
568
|
export declare type OffsetItemsResult = undefined;
|
|
468
569
|
export declare type PatchDataItemsQuery = {
|
|
570
|
+
/** ID of the data collection to patch */
|
|
469
571
|
'id': string;
|
|
572
|
+
/** Data items to add to the collection */
|
|
470
573
|
'a': Record<string, SerializedFieldType>[];
|
|
574
|
+
/** Data items to change field values on, keyed by primary key */
|
|
471
575
|
'c': Record<string, Record<string, SerializedFieldType>>;
|
|
576
|
+
/** Primary keys of items to delete */
|
|
472
577
|
'd': string[];
|
|
473
578
|
};
|
|
474
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;
|
|
475
595
|
export declare type ReloadExtensionQuery = void;
|
|
476
596
|
export declare type ReloadExtensionResult = undefined;
|
|
477
597
|
export declare type SendOAuthRequestQuery = SendXHRQuery & {
|
|
598
|
+
/** OAuth provider name as specified in the package manifest */
|
|
478
599
|
'p': string;
|
|
479
600
|
};
|
|
480
601
|
export declare type SendOAuthRequestResponse = SendXHRResponse;
|
|
481
602
|
export declare type SendUIMessageQuery = {
|
|
603
|
+
/** Name of the UI component's action for receiving events, e.g. ShowModalQuery['n'] */
|
|
482
604
|
'n': string;
|
|
605
|
+
/** Content of the message to send to the custom UI component */
|
|
483
606
|
'd'?: JsonSerializable;
|
|
484
607
|
};
|
|
485
608
|
export declare type SendUIMessageResult = undefined;
|
|
486
609
|
export declare type SendXHRQuery = {
|
|
487
610
|
'url': string;
|
|
611
|
+
/** HTTP method, e.g. 'GET', 'FETCH', etc. Defaults to GET */
|
|
488
612
|
'm'?: string;
|
|
489
613
|
/**
|
|
490
614
|
* The data to send with the request.
|
|
@@ -495,48 +619,74 @@ export declare type SendXHRQuery = {
|
|
|
495
619
|
* no 'Content-Type' header is specified, a 'text/plain; charset=utf-8' content type is sent.
|
|
496
620
|
*/
|
|
497
621
|
'd'?: string;
|
|
622
|
+
/** Headers to send with the request */
|
|
498
623
|
'h'?: {
|
|
499
624
|
[key: string]: string | string[];
|
|
500
625
|
};
|
|
626
|
+
/** Timeout in milliseconds, if specified */
|
|
501
627
|
'ms'?: number;
|
|
502
628
|
};
|
|
503
629
|
export declare type RawSendXHRResponse = {
|
|
630
|
+
/** URL of the response after any redirects */
|
|
504
631
|
'url': string;
|
|
632
|
+
/** Plain-text response body */
|
|
505
633
|
't': string;
|
|
634
|
+
/** Status code of the response */
|
|
506
635
|
's': number;
|
|
636
|
+
/** Headers sent with the response */
|
|
507
637
|
'h': {
|
|
508
638
|
[key: string]: string;
|
|
509
639
|
};
|
|
640
|
+
/** true if the request timed out */
|
|
510
641
|
'to'?: boolean;
|
|
511
642
|
};
|
|
512
643
|
export declare type SendXHRResponse = Promise<RawSendXHRResponse>;
|
|
513
644
|
export declare type SetCurrentPageQuery = string;
|
|
514
645
|
export declare type SetCurrentPageResult = Promise<void>;
|
|
515
646
|
export declare type SetPropertyQuery = {
|
|
647
|
+
/** ID of the element to change */
|
|
516
648
|
'id'?: string | undefined;
|
|
649
|
+
/** Name of the property to change */
|
|
517
650
|
'p': string;
|
|
651
|
+
/** New value of the property */
|
|
518
652
|
'v'?: JsonSerializable;
|
|
519
653
|
};
|
|
520
654
|
export declare type SetPropertyResult = undefined;
|
|
521
655
|
export declare type SetReferenceKeyQuery = {
|
|
656
|
+
/** ID of the element to set the reference key on */
|
|
522
657
|
'id'?: string | undefined;
|
|
658
|
+
/** ID of the reference key to set */
|
|
523
659
|
'k': string | number;
|
|
660
|
+
/** New reference key settings, or undefined to remove the reference key */
|
|
524
661
|
'v'?: SerializedReferenceKeyType;
|
|
525
662
|
};
|
|
526
663
|
export declare type SetReferenceKeyResult = undefined;
|
|
527
664
|
export declare type SetShapeDataQuery = {
|
|
665
|
+
/** ID of the element to set this shape data on */
|
|
528
666
|
'id'?: string | undefined;
|
|
667
|
+
/** Name for the already-existing shape data to update */
|
|
529
668
|
'n': string;
|
|
669
|
+
/** Value to set; use a string beginning with '=' for a formula */
|
|
530
670
|
'v'?: SerializedFieldType;
|
|
531
671
|
};
|
|
532
672
|
export declare type SetShapeDataResult = undefined;
|
|
533
673
|
export declare type ShowModalQuery = {
|
|
674
|
+
/** Name of the modal's action for receiving events; generated automatically by Modal base class */
|
|
534
675
|
'n': string;
|
|
676
|
+
/** Title to show on the modal */
|
|
535
677
|
't': string;
|
|
678
|
+
/** Desired modal width */
|
|
536
679
|
'w': number;
|
|
680
|
+
/** Desired modal height */
|
|
537
681
|
'h': number;
|
|
682
|
+
/** Content to display in the modal; full HTML page preferred */
|
|
538
683
|
'c': string;
|
|
539
684
|
};
|
|
540
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;
|
|
541
691
|
export declare type SleepForTestCaseQuery = number;
|
|
542
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;
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.serializeReferenceKeyDefinition = exports.isCollectionReferenceKeyDefinition = void 0;
|
|
4
4
|
const checks_1 = require("../core/checks");
|
|
5
5
|
const schemadefinition_1 = require("./schemadefinition");
|
|
6
|
+
/** @ignore */
|
|
6
7
|
function isCollectionReferenceKeyDefinition(def) {
|
|
7
8
|
return (0, checks_1.isString)(def.collectionId);
|
|
8
9
|
}
|
|
9
10
|
exports.isCollectionReferenceKeyDefinition = isCollectionReferenceKeyDefinition;
|
|
11
|
+
/** @ignore */
|
|
10
12
|
function serializeReferenceKeyDefinition(def) {
|
|
11
13
|
if (isCollectionReferenceKeyDefinition(def)) {
|
|
12
14
|
return {
|