lucid-extension-sdk 0.0.440 → 0.0.442
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 +26 -0
- package/core/cardintegration/cardfielddisplaysettings.d.ts +12 -1
- package/core/cardintegration/cardfielddisplaysettings.js +11 -0
- package/core/cardintegration/cardintegrationparams.d.ts +4 -2
- package/core/cardintegration/cardpaneltabs/tab.d.ts +23 -0
- package/core/cardintegration/cardpaneltabs/tab.js +30 -0
- package/core/cardintegration/cardpaneltabs/tabs/listtab.d.ts +29 -0
- package/core/cardintegration/cardpaneltabs/tabs/listtab.js +31 -0
- package/core/cardintegration/cardpaneltabs/tabs.d.ts +37 -0
- package/core/cardintegration/cardpaneltabs/tabs.js +60 -0
- package/core/cardintegration/lucidcardintegration.d.ts +10 -2
- package/core/cardintegration/lucidcardintegrationregistry.js +19 -3
- package/core/cardintegration/useritemeditpermissions.d.ts +10 -7
- package/core/cardintegration/useritemeditpermissions.js +40 -2
- package/core/enum.d.ts +26 -0
- package/core/enum.js +46 -0
- package/core/identity.d.ts +11 -0
- package/core/identity.js +20 -0
- package/core/iterable.d.ts +22 -0
- package/core/iterable.js +63 -0
- package/core/map.d.ts +22 -0
- package/core/map.js +51 -0
- package/core/maybepartialrecord.d.ts +12 -0
- package/core/maybepartialrecord.js +2 -0
- package/core/opaque.d.ts +24 -0
- package/core/opaque.js +17 -0
- package/core/prettify.d.ts +6 -0
- package/core/prettify.js +2 -0
- package/core/primitivedata.d.ts +37 -0
- package/core/primitivedata.js +109 -0
- package/core/properties/datagraphic/datagraphicindexes.d.ts +1 -1
- package/core/publicinterface.d.ts +12 -0
- package/core/publicinterface.js +2 -0
- package/core/rules/serializedeffect.d.ts +1 -1
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +83 -14
- package/core/sharedcardintegration/cardintegrationdefinitions.js +30 -14
- package/core/validators/validators.d.ts +4 -0
- package/core/validators/validators.js +5 -1
- package/data/patcherrortype.d.ts +7 -0
- package/data/patcherrortype.js +11 -0
- package/dataconnector/actions/patch.test.d.ts +1 -1
- package/dataconnector/actions/patchresponsebody.d.ts +10 -5
- package/dataconnector/actions/patchresponsebody.js +9 -8
- package/dataconnector/dataconnector.d.ts +2 -2
- package/document/graphdefinition.d.ts +31 -0
- package/document/graphdefinition.js +8 -0
- package/document/pageproxy.d.ts +12 -0
- package/document/pageproxy.js +24 -0
- package/editorclient.d.ts +8 -0
- package/editorclient.js +2 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/math.d.ts +10 -1
- package/math.js +8 -1
- package/object.d.ts +15 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare const enum CommandName {
|
|
|
53
53
|
CreateCollection = "cc",
|
|
54
54
|
CreateDataSource = "cds",
|
|
55
55
|
CreateDocumentElement = "cde",
|
|
56
|
+
CreateGraph = "cgr",
|
|
56
57
|
CreateGroup = "cg",
|
|
57
58
|
CreateLine = "cl",
|
|
58
59
|
CreatePage = "cp",
|
|
@@ -282,6 +283,10 @@ export type CommandArgs = {
|
|
|
282
283
|
query: CreateDocumentElementQuery;
|
|
283
284
|
result: CreateDocumentElementResult;
|
|
284
285
|
};
|
|
286
|
+
[CommandName.CreateGraph]: {
|
|
287
|
+
query: CreateGraphQuery;
|
|
288
|
+
result: CreateGraphResult;
|
|
289
|
+
};
|
|
285
290
|
[CommandName.CreateGroup]: {
|
|
286
291
|
query: CreateGroupQuery;
|
|
287
292
|
result: CreateGroupResult;
|
|
@@ -779,6 +784,8 @@ export type SerializedFieldConfiguration = {
|
|
|
779
784
|
'cfds'?: SerializedCustomFieldDisplaySettings;
|
|
780
785
|
/** Non-customizable fields */
|
|
781
786
|
'ncf'?: string[] | undefined;
|
|
787
|
+
/** Callback to get fields to edit related to a field passed as an argument */
|
|
788
|
+
'gfte'?: string | undefined;
|
|
782
789
|
};
|
|
783
790
|
export type AddCardIntegrationQuery = {
|
|
784
791
|
/** Title/name */
|
|
@@ -928,6 +935,8 @@ export type AddCardIntegrationQuery = {
|
|
|
928
935
|
* Whether the user can edit an item in the data source.
|
|
929
936
|
*/
|
|
930
937
|
'cei'?: string | undefined;
|
|
938
|
+
/** getAdditionalPanelTabsForCard -- Cards' additional details via tabs in panel */
|
|
939
|
+
'gaptfc'?: string | undefined;
|
|
931
940
|
};
|
|
932
941
|
export type AddCardIntegrationResult = undefined;
|
|
933
942
|
/** @ignore */
|
|
@@ -1196,6 +1205,20 @@ export type CreateGroupQuery = {
|
|
|
1196
1205
|
'i': string[];
|
|
1197
1206
|
};
|
|
1198
1207
|
export type CreateGroupResult = string;
|
|
1208
|
+
export type CreateGraphQuery = {
|
|
1209
|
+
/**
|
|
1210
|
+
* By default, we add the graph to the current page. If specified, the
|
|
1211
|
+
* graph will instead be created as a direct child of the given page.
|
|
1212
|
+
*/
|
|
1213
|
+
'p'?: string | undefined;
|
|
1214
|
+
/** Type of graph to create, e.g. 'BarGraphCollectionBlock' or 'LineGraphCollectionBlock' */
|
|
1215
|
+
't': string;
|
|
1216
|
+
/** ID of the collection */
|
|
1217
|
+
'col': string;
|
|
1218
|
+
/** Title of the graph */
|
|
1219
|
+
'ti': string;
|
|
1220
|
+
};
|
|
1221
|
+
export type CreateGraphResult = Promise<string>;
|
|
1199
1222
|
export type CreateCollectionFieldDefinition = {
|
|
1200
1223
|
/** Name of the field */
|
|
1201
1224
|
'n': string;
|
|
@@ -1270,6 +1293,9 @@ export type DataActionQuery = {
|
|
|
1270
1293
|
's'?: string | undefined;
|
|
1271
1294
|
/** Data Connector Name */
|
|
1272
1295
|
'n': string;
|
|
1296
|
+
/**Requested Primary keys or keys of items we
|
|
1297
|
+
* are requesting info for in the data action */
|
|
1298
|
+
'rpk'?: Record<string, string[]> | undefined;
|
|
1273
1299
|
};
|
|
1274
1300
|
export type RawDataActionResult = {
|
|
1275
1301
|
/** The external service responded with this code */
|
|
@@ -29,6 +29,12 @@ export declare enum FieldDisplayType {
|
|
|
29
29
|
* Given a URL, display a small image cropped into a square in the lower-left of the card.
|
|
30
30
|
*/
|
|
31
31
|
SquareImageBadge = "SquareImageBadge",
|
|
32
|
+
/**
|
|
33
|
+
* Displays an icon and value as a badge in the bottom-left of the card. Takes an object containing an iconUrl
|
|
34
|
+
* and value. If value is a string longer than 20 characters, it will be truncated to be a maximum of 20 chars
|
|
35
|
+
* appending '...' to the given value. If value is a number higher than 999, displays 999.
|
|
36
|
+
*/
|
|
37
|
+
TagBadge = "TagBadge",
|
|
32
38
|
/**
|
|
33
39
|
* Given a date, display a small calendar icon alongside a very short version of the date
|
|
34
40
|
* as a string, e.g. "Sep 9"
|
|
@@ -80,7 +86,12 @@ export declare enum OnClickHandlerKeys {
|
|
|
80
86
|
* Display a panel on the canvas when a stencil is clicked, showing editable input fields for the values that
|
|
81
87
|
* calculate what is shown on the stencil
|
|
82
88
|
*/
|
|
83
|
-
EditFieldsStencilPanel = "EditFieldsStencilPanel"
|
|
89
|
+
EditFieldsStencilPanel = "EditFieldsStencilPanel",
|
|
90
|
+
/**
|
|
91
|
+
* Display a panel on the canvas when a stencil is clicked, showing editable input fields for the values that
|
|
92
|
+
* calculate what is shown on the stencil
|
|
93
|
+
*/
|
|
94
|
+
DataRowStencilPanel = "DataRowStencilPanel"
|
|
84
95
|
}
|
|
85
96
|
export declare const isOnClickHandlerKey: (x: unknown) => x is OnClickHandlerKeys;
|
|
86
97
|
export type ImageBadgeSettings = {
|
|
@@ -34,6 +34,12 @@ var FieldDisplayType;
|
|
|
34
34
|
* Given a URL, display a small image cropped into a square in the lower-left of the card.
|
|
35
35
|
*/
|
|
36
36
|
FieldDisplayType["SquareImageBadge"] = "SquareImageBadge";
|
|
37
|
+
/**
|
|
38
|
+
* Displays an icon and value as a badge in the bottom-left of the card. Takes an object containing an iconUrl
|
|
39
|
+
* and value. If value is a string longer than 20 characters, it will be truncated to be a maximum of 20 chars
|
|
40
|
+
* appending '...' to the given value. If value is a number higher than 999, displays 999.
|
|
41
|
+
*/
|
|
42
|
+
FieldDisplayType["TagBadge"] = "TagBadge";
|
|
37
43
|
/**
|
|
38
44
|
* Given a date, display a small calendar icon alongside a very short version of the date
|
|
39
45
|
* as a string, e.g. "Sep 9"
|
|
@@ -87,6 +93,11 @@ var OnClickHandlerKeys;
|
|
|
87
93
|
* calculate what is shown on the stencil
|
|
88
94
|
*/
|
|
89
95
|
OnClickHandlerKeys["EditFieldsStencilPanel"] = "EditFieldsStencilPanel";
|
|
96
|
+
/**
|
|
97
|
+
* Display a panel on the canvas when a stencil is clicked, showing editable input fields for the values that
|
|
98
|
+
* calculate what is shown on the stencil
|
|
99
|
+
*/
|
|
100
|
+
OnClickHandlerKeys["DataRowStencilPanel"] = "DataRowStencilPanel";
|
|
90
101
|
})(OnClickHandlerKeys || (exports.OnClickHandlerKeys = OnClickHandlerKeys = {}));
|
|
91
102
|
exports.isOnClickHandlerKey = (0, validators_1.enumValidator)(OnClickHandlerKeys);
|
|
92
103
|
const isImageBadgeSettings = (0, validators_1.objectValidator)({
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LucidCardPanelListTab, SerializedLucidCardPanelListTab } from './tabs/listtab';
|
|
2
|
+
/**
|
|
3
|
+
* @experimental Information to represent a tab, in the card details panel.
|
|
4
|
+
* There exist various kinds of tabs in the panel.
|
|
5
|
+
* Each kind has its own corresponding information and type definition, found in the `tabs` subdirectory.
|
|
6
|
+
*/
|
|
7
|
+
export type LucidCardPanelTab = LucidCardPanelListTab;
|
|
8
|
+
/** @ignore */
|
|
9
|
+
export declare const isValidLucidCardPanelTab: (x: any) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
10
|
+
type: (x: unknown) => x is "LucidCardPanelListTab";
|
|
11
|
+
label: typeof import("../../checks").isString;
|
|
12
|
+
}>;
|
|
13
|
+
/** @ignore */
|
|
14
|
+
export type SerializedLucidCardPanelTab = SerializedLucidCardPanelListTab;
|
|
15
|
+
/** @ignore */
|
|
16
|
+
export declare const isValidSerializedLucidCardPanelTab: (x: any) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
17
|
+
type: (x: unknown) => x is "lcplt";
|
|
18
|
+
l: typeof import("../../checks").isString;
|
|
19
|
+
}>;
|
|
20
|
+
/** @ignore */
|
|
21
|
+
export declare function serializeLucidCardPanelTab(concrete: LucidCardPanelTab): SerializedLucidCardPanelTab;
|
|
22
|
+
/** @ignore */
|
|
23
|
+
export declare function deserializeLucidCardPanelTab(serialized: SerializedLucidCardPanelTab): LucidCardPanelTab;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeLucidCardPanelTab = exports.serializeLucidCardPanelTab = exports.isValidSerializedLucidCardPanelTab = exports.isValidLucidCardPanelTab = void 0;
|
|
4
|
+
const assertnever_1 = require("../../assertnever");
|
|
5
|
+
const validators_1 = require("../../validators/validators");
|
|
6
|
+
const listtab_1 = require("./tabs/listtab");
|
|
7
|
+
/** @ignore */
|
|
8
|
+
exports.isValidLucidCardPanelTab = (0, validators_1.someValidator)(listtab_1.isValidLucidCardPanelListTab);
|
|
9
|
+
/** @ignore */
|
|
10
|
+
exports.isValidSerializedLucidCardPanelTab = (0, validators_1.someValidator)(listtab_1.isValidSerializedLucidCardPanelListTab);
|
|
11
|
+
/** @ignore */
|
|
12
|
+
function serializeLucidCardPanelTab(concrete) {
|
|
13
|
+
switch (concrete.type) {
|
|
14
|
+
case 'LucidCardPanelListTab':
|
|
15
|
+
return (0, listtab_1.serializeLucidCardPanelListTab)(concrete);
|
|
16
|
+
default:
|
|
17
|
+
(0, assertnever_1.assertNever)(concrete.type);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.serializeLucidCardPanelTab = serializeLucidCardPanelTab;
|
|
21
|
+
/** @ignore */
|
|
22
|
+
function deserializeLucidCardPanelTab(serialized) {
|
|
23
|
+
switch (serialized.type) {
|
|
24
|
+
case 'lcplt':
|
|
25
|
+
return (0, listtab_1.deserializeLucidCardPanelListTab)(serialized);
|
|
26
|
+
default:
|
|
27
|
+
(0, assertnever_1.assertNever)(serialized.type);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.deserializeLucidCardPanelTab = deserializeLucidCardPanelTab;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isString } from '../../../checks';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore Will be implemented soon.
|
|
4
|
+
* Information that represents a list of items.
|
|
5
|
+
* (Currently blank and unimplemented.)
|
|
6
|
+
*/
|
|
7
|
+
export interface LucidCardPanelListTab {
|
|
8
|
+
type: 'LucidCardPanelListTab';
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
/** @ignore */
|
|
12
|
+
export declare const isValidLucidCardPanelListTab: (subject: unknown) => subject is import("../../../guards").DestructureGuardedTypeObj<{
|
|
13
|
+
type: (x: unknown) => x is "LucidCardPanelListTab";
|
|
14
|
+
label: typeof isString;
|
|
15
|
+
}>;
|
|
16
|
+
/** @ignore */
|
|
17
|
+
export interface SerializedLucidCardPanelListTab {
|
|
18
|
+
'type': 'lcplt';
|
|
19
|
+
'l': string;
|
|
20
|
+
}
|
|
21
|
+
/** @ignore */
|
|
22
|
+
export declare const isValidSerializedLucidCardPanelListTab: (subject: unknown) => subject is import("../../../guards").DestructureGuardedTypeObj<{
|
|
23
|
+
type: (x: unknown) => x is "lcplt";
|
|
24
|
+
l: typeof isString;
|
|
25
|
+
}>;
|
|
26
|
+
/** @ignore */
|
|
27
|
+
export declare function serializeLucidCardPanelListTab(concrete: LucidCardPanelListTab): SerializedLucidCardPanelListTab;
|
|
28
|
+
/** @ignore */
|
|
29
|
+
export declare function deserializeLucidCardPanelListTab(serialized: SerializedLucidCardPanelListTab): LucidCardPanelListTab;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeLucidCardPanelListTab = exports.serializeLucidCardPanelListTab = exports.isValidSerializedLucidCardPanelListTab = exports.isValidLucidCardPanelListTab = void 0;
|
|
4
|
+
const checks_1 = require("../../../checks");
|
|
5
|
+
const validators_1 = require("../../../validators/validators");
|
|
6
|
+
/** @ignore */
|
|
7
|
+
exports.isValidLucidCardPanelListTab = (0, validators_1.objectValidator)({
|
|
8
|
+
type: (0, validators_1.someValue)('LucidCardPanelListTab'),
|
|
9
|
+
label: checks_1.isString,
|
|
10
|
+
});
|
|
11
|
+
/** @ignore */
|
|
12
|
+
exports.isValidSerializedLucidCardPanelListTab = (0, validators_1.objectValidator)({
|
|
13
|
+
'type': (0, validators_1.someValue)('lcplt'),
|
|
14
|
+
'l': checks_1.isString,
|
|
15
|
+
});
|
|
16
|
+
/** @ignore */
|
|
17
|
+
function serializeLucidCardPanelListTab(concrete) {
|
|
18
|
+
return {
|
|
19
|
+
'type': 'lcplt',
|
|
20
|
+
'l': concrete.label,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.serializeLucidCardPanelListTab = serializeLucidCardPanelListTab;
|
|
24
|
+
/** @ignore */
|
|
25
|
+
function deserializeLucidCardPanelListTab(serialized) {
|
|
26
|
+
return {
|
|
27
|
+
type: 'LucidCardPanelListTab',
|
|
28
|
+
label: serialized['l'],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.deserializeLucidCardPanelListTab = deserializeLucidCardPanelListTab;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AddCardIntegrationQuery } from '../../../commandtypes';
|
|
2
|
+
import { DataItemProxy } from '../../../data/dataitemproxy';
|
|
3
|
+
import { EditorClient, PostMessageType } from '../../../editorclient';
|
|
4
|
+
import { DataItemCallbackParam } from '../cardintegrationparams';
|
|
5
|
+
import { LucidCardPanelTab, SerializedLucidCardPanelTab } from './tab';
|
|
6
|
+
/**
|
|
7
|
+
* @experimental Information to represent a collection of tabs, in the card details panel.
|
|
8
|
+
*/
|
|
9
|
+
export type LucidCardPanelTabs = LucidCardPanelTab[];
|
|
10
|
+
/** @ignore */
|
|
11
|
+
export declare const areValidLucidCardPanelTabs: (p1: unknown) => p1 is import("../../guards").DestructureGuardedTypeObj<{
|
|
12
|
+
type: (x: unknown) => x is "LucidCardPanelListTab";
|
|
13
|
+
label: typeof import("../../checks").isString;
|
|
14
|
+
}>[];
|
|
15
|
+
/** @ignore */
|
|
16
|
+
export type SerializedLucidCardPanelTabs = SerializedLucidCardPanelTab[];
|
|
17
|
+
/** @ignore */
|
|
18
|
+
export declare const areValidSerializedLucidCardPanelTabs: (p1: unknown) => p1 is import("../../guards").DestructureGuardedTypeObj<{
|
|
19
|
+
type: (x: unknown) => x is "lcplt";
|
|
20
|
+
l: typeof import("../../checks").isString;
|
|
21
|
+
}>[];
|
|
22
|
+
/** @ignore */
|
|
23
|
+
export declare function serializeLucidCardPanelTabs(concrete: LucidCardPanelTabs): SerializedLucidCardPanelTabs;
|
|
24
|
+
/** @ignore */
|
|
25
|
+
export declare function deserializeLucidCardPanelTabs(serialized: SerializedLucidCardPanelTabs): LucidCardPanelTabs;
|
|
26
|
+
/**
|
|
27
|
+
* @experimental Callback function that, from a data item, derives additional tabs to show in the card details panel.
|
|
28
|
+
*/
|
|
29
|
+
export type AdditionalPanelTabsCallback = (dataItemProxy: DataItemProxy) => Promise<LucidCardPanelTabs | undefined>;
|
|
30
|
+
/** @ignore */
|
|
31
|
+
export type AdditionalPanelTabsCallbackInternal = (dataItemCallbackParam: DataItemCallbackParam) => Promise<SerializedLucidCardPanelTabs | undefined>;
|
|
32
|
+
/** @ignore */
|
|
33
|
+
export declare function registerGetAdditionalPanelTabsForCardCallback(client: EditorClient, tabsCallback: AdditionalPanelTabsCallback, serialized: AddCardIntegrationQuery, actionName: string): void;
|
|
34
|
+
/** @ignore */
|
|
35
|
+
export type TabsCallbackInternal = (dataSourceId: string, collectionId: string, primaryKey: string) => Promise<LucidCardPanelTabs | undefined>;
|
|
36
|
+
/** @ignore */
|
|
37
|
+
export declare function deserializeTabsCallback(callbackHookName: string, postMessage: PostMessageType): TabsCallbackInternal;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeTabsCallback = exports.registerGetAdditionalPanelTabsForCardCallback = exports.deserializeLucidCardPanelTabs = exports.serializeLucidCardPanelTabs = exports.areValidSerializedLucidCardPanelTabs = exports.areValidLucidCardPanelTabs = void 0;
|
|
4
|
+
const collectionproxy_1 = require("../../../data/collectionproxy");
|
|
5
|
+
const dataitemproxy_1 = require("../../../data/dataitemproxy");
|
|
6
|
+
const validators_1 = require("../../validators/validators");
|
|
7
|
+
const tab_1 = require("./tab");
|
|
8
|
+
/** @ignore */
|
|
9
|
+
exports.areValidLucidCardPanelTabs = (0, validators_1.arrayValidator)(tab_1.isValidLucidCardPanelTab);
|
|
10
|
+
/** @ignore */
|
|
11
|
+
exports.areValidSerializedLucidCardPanelTabs = (0, validators_1.arrayValidator)(tab_1.isValidSerializedLucidCardPanelTab);
|
|
12
|
+
/** @ignore */
|
|
13
|
+
function serializeLucidCardPanelTabs(concrete) {
|
|
14
|
+
return concrete.map(tab_1.serializeLucidCardPanelTab);
|
|
15
|
+
}
|
|
16
|
+
exports.serializeLucidCardPanelTabs = serializeLucidCardPanelTabs;
|
|
17
|
+
/** @ignore */
|
|
18
|
+
function deserializeLucidCardPanelTabs(serialized) {
|
|
19
|
+
return serialized.map(tab_1.deserializeLucidCardPanelTab);
|
|
20
|
+
}
|
|
21
|
+
exports.deserializeLucidCardPanelTabs = deserializeLucidCardPanelTabs;
|
|
22
|
+
/** @ignore */
|
|
23
|
+
function registerGetAdditionalPanelTabsForCardCallback(client, tabsCallback, serialized, actionName) {
|
|
24
|
+
serialized['gaptfc'] = actionName;
|
|
25
|
+
const serializedAction = async ({ 'd': dataSourceId, 'c': collectionId, 'p': primaryKey, }) => {
|
|
26
|
+
try {
|
|
27
|
+
const collectionProxy = new collectionproxy_1.CollectionProxy(collectionId, client);
|
|
28
|
+
const dataItemProxy = new dataitemproxy_1.DataItemProxy(primaryKey, collectionProxy, client);
|
|
29
|
+
const result = await tabsCallback(dataItemProxy);
|
|
30
|
+
if (result === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return serializeLucidCardPanelTabs(result);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
client.registerAction(actionName, serializedAction);
|
|
40
|
+
}
|
|
41
|
+
exports.registerGetAdditionalPanelTabsForCardCallback = registerGetAdditionalPanelTabsForCardCallback;
|
|
42
|
+
/** @ignore */
|
|
43
|
+
function deserializeTabsCallback(callbackHookName, postMessage) {
|
|
44
|
+
// Serializes, runs callback, and deserializes the result
|
|
45
|
+
const wrappedCallback = async (dataSourceId, collectionId, primaryKey) => {
|
|
46
|
+
const callbackParam = {
|
|
47
|
+
'd': dataSourceId,
|
|
48
|
+
'c': collectionId,
|
|
49
|
+
'p': primaryKey,
|
|
50
|
+
};
|
|
51
|
+
const serializedTabs = await postMessage(Object.assign({ 'id': callbackHookName }, callbackParam));
|
|
52
|
+
if (!(0, exports.areValidSerializedLucidCardPanelTabs)(serializedTabs)) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const result = deserializeLucidCardPanelTabs(serializedTabs);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
return wrappedCallback;
|
|
59
|
+
}
|
|
60
|
+
exports.deserializeTabsCallback = deserializeTabsCallback;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CollectionProxy } from '../../data/collectionproxy';
|
|
2
|
+
import { DataItemProxy } from '../../data/dataitemproxy';
|
|
2
3
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
3
4
|
import { TextStyle } from '../../document/text/textstyle';
|
|
4
5
|
import { EditorClient } from '../../editorclient';
|
|
@@ -9,6 +10,7 @@ import { ImportCardFromPastedLinkCallback } from '../importcardfrompastedlink/im
|
|
|
9
10
|
import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
10
11
|
import { CardIntegrationAutoSyncConfig } from './cardintegrationautosyncconfig';
|
|
11
12
|
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
13
|
+
import { AdditionalPanelTabsCallback } from './cardpaneltabs/tabs';
|
|
12
14
|
import { DependencyMappingPhrasesType } from './dependencymappingphrases';
|
|
13
15
|
import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
|
|
14
16
|
import { LucidCardIntegrationStandardImportModal } from './lucidcardintegrationstandardimportmodal';
|
|
@@ -156,7 +158,13 @@ export declare abstract class LucidCardIntegration {
|
|
|
156
158
|
*/
|
|
157
159
|
importFromSerializedFields?: (data: SerializedFields[]) => Promise<ImportCardFromDetails>;
|
|
158
160
|
/**
|
|
159
|
-
* @experimental
|
|
161
|
+
* @experimental If specified, allows the extension to check whether the user can edit the given items.
|
|
162
|
+
* Returns a Map with per-item permission results, keyed by item primary key.
|
|
160
163
|
*/
|
|
161
|
-
canEditItems?: (
|
|
164
|
+
canEditItems?: (items: DataItemProxy[]) => Promise<Map<string, UserItemEditPermissions>>;
|
|
165
|
+
/**
|
|
166
|
+
* @experimental If specified, allows for cards to display additional details,
|
|
167
|
+
* via tabs that are configured by the extension and displayed in the card details panel.
|
|
168
|
+
*/
|
|
169
|
+
getAdditionalPanelTabsForCard?: AdditionalPanelTabsCallback;
|
|
162
170
|
}
|
|
@@ -11,6 +11,7 @@ const importcardfromdetails_1 = require("../importcardfromdetails/importcardfrom
|
|
|
11
11
|
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
12
12
|
const cardintegrationautosyncconfig_1 = require("./cardintegrationautosyncconfig");
|
|
13
13
|
const cardintegrationconfig_1 = require("./cardintegrationconfig");
|
|
14
|
+
const tabs_1 = require("./cardpaneltabs/tabs");
|
|
14
15
|
const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
|
|
15
16
|
const useritemeditpermissions_1 = require("./useritemeditpermissions");
|
|
16
17
|
class LucidCardIntegrationRegistry {
|
|
@@ -258,6 +259,14 @@ class LucidCardIntegrationRegistry {
|
|
|
258
259
|
const dataSource = new datasourceproxy_1.DataSourceProxy(param['d'], client);
|
|
259
260
|
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await cardIntegration.getDefaultConfig(dataSource));
|
|
260
261
|
});
|
|
262
|
+
let getFieldsToEditActionName = undefined;
|
|
263
|
+
const getFieldsToEdit = cardIntegration.fieldConfiguration.getFieldsToEdit;
|
|
264
|
+
if (getFieldsToEdit) {
|
|
265
|
+
getFieldsToEditActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
266
|
+
client.registerAction(getFieldsToEditActionName, async ({ 'f': fieldId }) => {
|
|
267
|
+
return (0, cardintegrationdefinitions_1.serializeExtensionCardFieldsGroupArray)(await getFieldsToEdit(fieldId));
|
|
268
|
+
});
|
|
269
|
+
}
|
|
261
270
|
let showIntroActionName = undefined;
|
|
262
271
|
if (cardIntegration.showIntro) {
|
|
263
272
|
showIntroActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
@@ -278,6 +287,7 @@ class LucidCardIntegrationRegistry {
|
|
|
278
287
|
? [...cardIntegration.fieldConfiguration.fieldValueSearchCallbacks.entries()]
|
|
279
288
|
: undefined,
|
|
280
289
|
'dsc': cardIntegration.fieldConfiguration.defaultSearchCallback,
|
|
290
|
+
'gfte': getFieldsToEditActionName,
|
|
281
291
|
},
|
|
282
292
|
'subn': cardIntegration.searchUserByName,
|
|
283
293
|
'usc': cardIntegration.userSearchCallback,
|
|
@@ -455,6 +465,10 @@ class LucidCardIntegrationRegistry {
|
|
|
455
465
|
}
|
|
456
466
|
this.registerDependencyMapping(client, cardIntegration, serialized);
|
|
457
467
|
this.registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized);
|
|
468
|
+
if (cardIntegration.getAdditionalPanelTabsForCard) {
|
|
469
|
+
const actionName = LucidCardIntegrationRegistry.nextHookName();
|
|
470
|
+
(0, tabs_1.registerGetAdditionalPanelTabsForCardCallback)(client, cardIntegration.getAdditionalPanelTabsForCard, serialized, actionName);
|
|
471
|
+
}
|
|
458
472
|
if (cardIntegration.importFromSerializedFields) {
|
|
459
473
|
const importFromSerializedFields = cardIntegration.importFromSerializedFields;
|
|
460
474
|
serialized['ifs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
@@ -465,10 +479,12 @@ class LucidCardIntegrationRegistry {
|
|
|
465
479
|
}
|
|
466
480
|
if (cardIntegration.canEditItems) {
|
|
467
481
|
const canEditItemsActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
482
|
+
const canEditItems = cardIntegration.canEditItems;
|
|
468
483
|
serialized['cei'] = canEditItemsActionName;
|
|
469
|
-
client.registerAction(canEditItemsActionName, async ({
|
|
470
|
-
const
|
|
471
|
-
|
|
484
|
+
client.registerAction(canEditItemsActionName, async ({ i }) => {
|
|
485
|
+
const dataItemProxies = i.map((item) => new dataitemproxy_1.DataItemProxy(item['pk'], new collectionproxy_1.CollectionProxy(item['cid'], client), client));
|
|
486
|
+
const result = await canEditItems(dataItemProxies);
|
|
487
|
+
return (0, useritemeditpermissions_1.serializeUserItemEditPermissionsMap)(result);
|
|
472
488
|
});
|
|
473
489
|
}
|
|
474
490
|
client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
@@ -6,7 +6,7 @@ export interface UserItemEditPermissions {
|
|
|
6
6
|
hasPermission: boolean;
|
|
7
7
|
constraints: {
|
|
8
8
|
fieldName: string;
|
|
9
|
-
constraints
|
|
9
|
+
constraints: SerializedFieldConstraint[];
|
|
10
10
|
}[];
|
|
11
11
|
}
|
|
12
12
|
export declare class UserCanEditItem implements UserItemEditPermissions {
|
|
@@ -17,10 +17,13 @@ export declare class UserCannotEditItem implements UserItemEditPermissions {
|
|
|
17
17
|
readonly hasPermission = false;
|
|
18
18
|
constraints: never[];
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
hp: boolean;
|
|
22
|
-
c: {
|
|
23
|
-
fn: string;
|
|
24
|
-
cs: SerializedFieldConstraint[]
|
|
20
|
+
export interface SerializedUserItemEditPermissions {
|
|
21
|
+
'hp': boolean;
|
|
22
|
+
'c': {
|
|
23
|
+
'fn': string;
|
|
24
|
+
'cs': SerializedFieldConstraint[];
|
|
25
25
|
}[];
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
export declare function serializeUserItemEditPermissionsMap(map: Map<string, UserItemEditPermissions>): Record<string, SerializedUserItemEditPermissions>;
|
|
28
|
+
export declare function deserializeUserItemEditPermissionsRecord(serializedMap: Record<string, SerializedUserItemEditPermissions>): Map<string, UserItemEditPermissions>;
|
|
29
|
+
export declare function isValidSerializedUserItemEditPermissionsRecord(value: unknown): value is Record<string, SerializedUserItemEditPermissions>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isValidSerializedUserItemEditPermissionsRecord = exports.deserializeUserItemEditPermissionsRecord = exports.serializeUserItemEditPermissionsMap = exports.UserCannotEditItem = exports.UserCanEditItem = void 0;
|
|
4
|
+
const checks_1 = require("../checks");
|
|
5
|
+
const serializedfielddefinition_1 = require("../data/serializedfield/serializedfielddefinition");
|
|
6
|
+
const validators_1 = require("../validators/validators");
|
|
4
7
|
class UserCanEditItem {
|
|
5
8
|
constructor() {
|
|
6
9
|
this.hasPermission = true;
|
|
@@ -15,6 +18,13 @@ class UserCannotEditItem {
|
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
exports.UserCannotEditItem = UserCannotEditItem;
|
|
21
|
+
const isSerializedUserItemEditPermissions = (0, validators_1.objectValidator)({
|
|
22
|
+
'hp': checks_1.isBoolean,
|
|
23
|
+
'c': (0, validators_1.arrayValidator)((0, validators_1.objectValidator)({
|
|
24
|
+
'fn': checks_1.isString,
|
|
25
|
+
'cs': (0, validators_1.arrayValidator)(serializedfielddefinition_1.isSerializedFieldConstraint),
|
|
26
|
+
})),
|
|
27
|
+
});
|
|
18
28
|
function serializeUserItemEditPermissions(result) {
|
|
19
29
|
return {
|
|
20
30
|
'hp': result.hasPermission,
|
|
@@ -24,4 +34,32 @@ function serializeUserItemEditPermissions(result) {
|
|
|
24
34
|
})),
|
|
25
35
|
};
|
|
26
36
|
}
|
|
27
|
-
|
|
37
|
+
function deserializeUserItemEditPermissions(serialized) {
|
|
38
|
+
return {
|
|
39
|
+
hasPermission: serialized['hp'],
|
|
40
|
+
constraints: serialized['c'].map((c) => ({
|
|
41
|
+
fieldName: c['fn'],
|
|
42
|
+
constraints: c['cs'],
|
|
43
|
+
})),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function serializeUserItemEditPermissionsMap(map) {
|
|
47
|
+
const serializedMap = {};
|
|
48
|
+
for (const [primaryKey, permissions] of map) {
|
|
49
|
+
serializedMap[primaryKey] = serializeUserItemEditPermissions(permissions);
|
|
50
|
+
}
|
|
51
|
+
return serializedMap;
|
|
52
|
+
}
|
|
53
|
+
exports.serializeUserItemEditPermissionsMap = serializeUserItemEditPermissionsMap;
|
|
54
|
+
function deserializeUserItemEditPermissionsRecord(serializedMap) {
|
|
55
|
+
const map = new Map();
|
|
56
|
+
for (const [primaryKey, serializedPermissions] of Object.entries(serializedMap)) {
|
|
57
|
+
map.set(primaryKey, deserializeUserItemEditPermissions(serializedPermissions));
|
|
58
|
+
}
|
|
59
|
+
return map;
|
|
60
|
+
}
|
|
61
|
+
exports.deserializeUserItemEditPermissionsRecord = deserializeUserItemEditPermissionsRecord;
|
|
62
|
+
function isValidSerializedUserItemEditPermissionsRecord(value) {
|
|
63
|
+
return (0, checks_1.isRecord)(isSerializedUserItemEditPermissions)(value);
|
|
64
|
+
}
|
|
65
|
+
exports.isValidSerializedUserItemEditPermissionsRecord = isValidSerializedUserItemEditPermissionsRecord;
|
package/core/enum.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
3
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getEnumValues<T extends object>(enumObj: T): keyof T extends never ? [] : T[keyof T][];
|
|
6
|
+
/**
|
|
7
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
8
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getEnumKeys<T extends object>(enumObj: T): (keyof T)[];
|
|
11
|
+
/**
|
|
12
|
+
* Returns all real entries of enum. That is, removes the reverse-map entries that TS adds
|
|
13
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
14
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getRealEnumEntries<T extends object>(enumObj: T): [keyof T, T[keyof T]][];
|
|
17
|
+
/**
|
|
18
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
19
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isEnumValue<T extends object>(value: any, enumObj: T): value is T[keyof T];
|
|
22
|
+
/**
|
|
23
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
24
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
25
|
+
*/
|
|
26
|
+
export declare function asEnumValue<T extends object>(value: unknown, enumObj: T): T[keyof T] | undefined;
|
package/core/enum.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asEnumValue = exports.isEnumValue = exports.getRealEnumEntries = exports.getEnumKeys = exports.getEnumValues = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
6
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
7
|
+
*/
|
|
8
|
+
function getEnumValues(enumObj) {
|
|
9
|
+
return getRealEnumEntries(enumObj).map((e) => e[1]);
|
|
10
|
+
}
|
|
11
|
+
exports.getEnumValues = getEnumValues;
|
|
12
|
+
/**
|
|
13
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
14
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
15
|
+
*/
|
|
16
|
+
function getEnumKeys(enumObj) {
|
|
17
|
+
return getRealEnumEntries(enumObj).map((e) => e[0]);
|
|
18
|
+
}
|
|
19
|
+
exports.getEnumKeys = getEnumKeys;
|
|
20
|
+
/**
|
|
21
|
+
* Returns all real entries of enum. That is, removes the reverse-map entries that TS adds
|
|
22
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
23
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
24
|
+
*/
|
|
25
|
+
function getRealEnumEntries(enumObj) {
|
|
26
|
+
return Object.keys(enumObj)
|
|
27
|
+
.map((key) => [key, enumObj[key]])
|
|
28
|
+
.filter(([key, value]) => value === key || enumObj[value] != key || typeof value == 'number');
|
|
29
|
+
}
|
|
30
|
+
exports.getRealEnumEntries = getRealEnumEntries;
|
|
31
|
+
/**
|
|
32
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
33
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
34
|
+
*/
|
|
35
|
+
function isEnumValue(value, enumObj) {
|
|
36
|
+
return getEnumValues(enumObj).includes(value);
|
|
37
|
+
}
|
|
38
|
+
exports.isEnumValue = isEnumValue;
|
|
39
|
+
/**
|
|
40
|
+
* Note, this will NOT work for const enums, as const enums are compiled out!!
|
|
41
|
+
* This works because as of TS 2.5 enums can't have number keys.
|
|
42
|
+
*/
|
|
43
|
+
function asEnumValue(value, enumObj) {
|
|
44
|
+
return isEnumValue(value, enumObj) ? value : undefined;
|
|
45
|
+
}
|
|
46
|
+
exports.asEnumValue = asEnumValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from https://google.github.io/closure-library/api/goog.functions.html#identity
|
|
3
|
+
*
|
|
4
|
+
* A simple function that returns the first argument of whatever is passed
|
|
5
|
+
* into it.
|
|
6
|
+
* @param opt_returnValue The single value that will be returned.
|
|
7
|
+
* @param var_args Optional trailing arguments. These are ignored.
|
|
8
|
+
* @return The first argument passed in, or undefined if nothing was passed.
|
|
9
|
+
* @template T
|
|
10
|
+
*/
|
|
11
|
+
export declare const identity: <T>(opt_returnValue?: T | undefined, ...var_args: any[]) => T;
|
package/core/identity.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identity = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Adapted from https://google.github.io/closure-library/api/goog.functions.html#identity
|
|
6
|
+
*
|
|
7
|
+
* A simple function that returns the first argument of whatever is passed
|
|
8
|
+
* into it.
|
|
9
|
+
* @param opt_returnValue The single value that will be returned.
|
|
10
|
+
* @param var_args Optional trailing arguments. These are ignored.
|
|
11
|
+
* @return The first argument passed in, or undefined if nothing was passed.
|
|
12
|
+
* @template T
|
|
13
|
+
*/
|
|
14
|
+
const identity = function (opt_returnValue, ...var_args) {
|
|
15
|
+
// This non-null assertion is needed to maintain the behavior inherited from the closure library implementation
|
|
16
|
+
// (specifically, the fact that library has a JS implementation which means we don't quite have the same types to
|
|
17
|
+
// line up).
|
|
18
|
+
return opt_returnValue;
|
|
19
|
+
};
|
|
20
|
+
exports.identity = identity;
|