lucid-extension-sdk 0.0.400 → 0.0.403
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 +10 -0
- package/core/cardintegration/cardintegrationparams.d.ts +6 -0
- package/core/cardintegration/lucidcardintegration.d.ts +16 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +5 -1
- package/core/cardintegration/lucidcardintegrationregistry.js +45 -0
- package/core/data/lucidicon.d.ts +0 -1
- package/core/data/lucidicon.js +0 -1
- package/core/importcardfrompastedlink/importcardfrompastedlinkcallback.d.ts +8 -0
- package/core/importcardfrompastedlink/importcardfrompastedlinkcallback.js +2 -0
- package/core/importcardfrompastedlink/importcardfrompastedlinkdetails.d.ts +50 -0
- package/core/importcardfrompastedlink/importcardfrompastedlinkdetails.js +35 -0
- package/core/pruners/pruners.d.ts +7 -0
- package/core/pruners/pruners.js +18 -1
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +49 -2
- package/core/sharedcardintegration/cardintegrationdefinitions.js +28 -1
- package/data/collectiondefinition.d.ts +5 -1
- package/data/collectiondefinition.js +9 -1
- package/message/importcardfrompastedlinkeventmessage.d.ts +17 -0
- package/message/importcardfrompastedlinkeventmessage.js +19 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -810,6 +810,8 @@ export type AddCardIntegrationQuery = {
|
|
|
810
810
|
'pi': string;
|
|
811
811
|
/** Light Icon URl */
|
|
812
812
|
'li'?: string | undefined;
|
|
813
|
+
/** Callback to fetch icons that show next to the field labels in the card details panel */
|
|
814
|
+
'flic'?: string | undefined;
|
|
813
815
|
} | undefined;
|
|
814
816
|
/**
|
|
815
817
|
* If specified, the text phrases to show in the dependency mapping UI.
|
|
@@ -872,6 +874,14 @@ export type AddCardIntegrationQuery = {
|
|
|
872
874
|
*/
|
|
873
875
|
'ilp'?: string;
|
|
874
876
|
} | undefined;
|
|
877
|
+
/**
|
|
878
|
+
* If provided, this data is used to turn links pasted on the canvas that match the domain into primary keys and
|
|
879
|
+
* other helpful data, which are sent back to the extension as an import action.
|
|
880
|
+
*/
|
|
881
|
+
'icfpl'?: {
|
|
882
|
+
'd': string;
|
|
883
|
+
'cb': string;
|
|
884
|
+
} | undefined;
|
|
875
885
|
};
|
|
876
886
|
export type AddCardIntegrationResult = undefined;
|
|
877
887
|
/** @ignore */
|
|
@@ -78,4 +78,10 @@ export interface DependencyMappingNoDependencyHeadingParam {
|
|
|
78
78
|
export interface DependencyMappingSelectedIssueHeadingParam {
|
|
79
79
|
'k': string;
|
|
80
80
|
}
|
|
81
|
+
/** @ignore */
|
|
82
|
+
export interface FieldLabelIconsCallbackParam {
|
|
83
|
+
'd': string;
|
|
84
|
+
'c': string;
|
|
85
|
+
'p': string;
|
|
86
|
+
}
|
|
81
87
|
export {};
|
|
@@ -4,6 +4,7 @@ import { TextStyle } from '../../document/text/textstyle';
|
|
|
4
4
|
import { EditorClient } from '../../editorclient';
|
|
5
5
|
import { isString } from '../checks';
|
|
6
6
|
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
7
|
+
import { ImportCardFromPastedLinkCallback } from '../importcardfrompastedlink/importcardfrompastedlinkcallback';
|
|
7
8
|
import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
8
9
|
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
9
10
|
import { DependencyMappingPhrasesType } from './dependencymappingphrases';
|
|
@@ -72,6 +73,10 @@ export declare abstract class LucidCardIntegration {
|
|
|
72
73
|
* If not provided, the primaryIconUrl will be used. Should be at least 24x24.
|
|
73
74
|
*/
|
|
74
75
|
lightIconUrl?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Optional. Callback function to fetch icons that show next to the field labels in the card details panel
|
|
78
|
+
*/
|
|
79
|
+
fieldLabelIconsCallback?: string;
|
|
75
80
|
};
|
|
76
81
|
/** If we are only able to search by name and not email in the card integration (ex: for JDC) */
|
|
77
82
|
searchUserByName?: boolean;
|
|
@@ -120,4 +125,15 @@ export declare abstract class LucidCardIntegration {
|
|
|
120
125
|
* If not specified, dependency mapping for this integration uses the default fallback phrases.
|
|
121
126
|
*/
|
|
122
127
|
dependencyMappingPhrases?: DependencyMappingPhrasesType;
|
|
128
|
+
/**
|
|
129
|
+
* A definition of the details required to import a card onto the canvas from a pasted url. The callback returns
|
|
130
|
+
* necessary data to import cards onto the canvas, or `undefined` if the link couldn't be interpreted.
|
|
131
|
+
*
|
|
132
|
+
* If the domain has already been registered by another card integration for importing cards from pasted links, this
|
|
133
|
+
* callback will be prevented from being registered.
|
|
134
|
+
*/
|
|
135
|
+
importCardFromPastedLink?: {
|
|
136
|
+
domain: string;
|
|
137
|
+
callback: ImportCardFromPastedLinkCallback;
|
|
138
|
+
};
|
|
123
139
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { DataItemProxy } from '../../data/dataitemproxy';
|
|
2
|
+
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
1
3
|
import { EditorClient } from '../../editorclient';
|
|
2
4
|
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
3
|
-
import { ExtensionCardFieldOption, ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
5
|
+
import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
4
6
|
import { LucidCardIntegration } from './lucidcardintegration';
|
|
5
7
|
export declare class LucidCardIntegrationRegistry {
|
|
6
8
|
private static nextHookId;
|
|
@@ -11,8 +13,10 @@ export declare class LucidCardIntegrationRegistry {
|
|
|
11
13
|
dataSourceId?: string | undefined;
|
|
12
14
|
}) => Promise<ExtensionCardFieldOption[]>): string;
|
|
13
15
|
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
|
|
16
|
+
static registerFieldLabelIconsCallback(client: EditorClient, callback: (dataSourceProxy: DataSourceProxy, dataItemProxy: DataItemProxy) => Promise<ExtensionCardFieldLabelIcons>): string;
|
|
14
17
|
private static registerDependencyMapping;
|
|
15
18
|
private static serializeSearchResult;
|
|
19
|
+
private static registerImportCardFromPastedLinkHandler;
|
|
16
20
|
/**
|
|
17
21
|
* Register a card integration.
|
|
18
22
|
*/
|
|
@@ -5,7 +5,9 @@ const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
|
5
5
|
const collectionproxy_1 = require("../../data/collectionproxy");
|
|
6
6
|
const dataitemproxy_1 = require("../../data/dataitemproxy");
|
|
7
7
|
const datasourceproxy_1 = require("../../data/datasourceproxy");
|
|
8
|
+
const importcardfrompastedlinkeventmessage_1 = require("../../message/importcardfrompastedlinkeventmessage");
|
|
8
9
|
const checks_1 = require("../checks");
|
|
10
|
+
const importcardfrompastedlinkdetails_1 = require("../importcardfrompastedlink/importcardfrompastedlinkdetails");
|
|
9
11
|
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
10
12
|
const cardintegrationconfig_1 = require("./cardintegrationconfig");
|
|
11
13
|
const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
|
|
@@ -40,6 +42,23 @@ class LucidCardIntegrationRegistry {
|
|
|
40
42
|
});
|
|
41
43
|
return name;
|
|
42
44
|
}
|
|
45
|
+
static registerFieldLabelIconsCallback(client, callback) {
|
|
46
|
+
const name = LucidCardIntegrationRegistry.nextHookName();
|
|
47
|
+
client.registerAction(name, async ({ 'd': dataSourceId, 'c': collectionId, 'p': primaryKey }) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const dataSourceProxy = new datasourceproxy_1.DataSourceProxy(dataSourceId, client);
|
|
50
|
+
const collectionProxy = new collectionproxy_1.CollectionProxy(collectionId, client);
|
|
51
|
+
const dataItemProxy = new dataitemproxy_1.DataItemProxy(primaryKey, collectionProxy, client);
|
|
52
|
+
const result = (_a = (await callback(dataSourceProxy, dataItemProxy))) !== null && _a !== void 0 ? _a : new Map();
|
|
53
|
+
return [...result].map(([key, value]) => {
|
|
54
|
+
return {
|
|
55
|
+
'k': key,
|
|
56
|
+
'v': value, // the createLucidIconData() helper serializes the value before this step
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return name;
|
|
61
|
+
}
|
|
43
62
|
static registerDependencyMapping(client, cardIntegration, serialized) {
|
|
44
63
|
if (cardIntegration.showDependencyMapping) {
|
|
45
64
|
serialized['sdm'] = true;
|
|
@@ -152,6 +171,30 @@ class LucidCardIntegrationRegistry {
|
|
|
152
171
|
},
|
|
153
172
|
};
|
|
154
173
|
}
|
|
174
|
+
static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
|
|
175
|
+
if (!cardIntegration.importCardFromPastedLink) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const importCardFromPastedLinkAction = LucidCardIntegrationRegistry.nextHookName();
|
|
179
|
+
const callback = cardIntegration.importCardFromPastedLink.callback;
|
|
180
|
+
serialized['icfpl'] = {
|
|
181
|
+
'd': cardIntegration.importCardFromPastedLink.domain,
|
|
182
|
+
'cb': importCardFromPastedLinkAction,
|
|
183
|
+
};
|
|
184
|
+
client.registerAction(importCardFromPastedLinkAction, async (rawMsg) => {
|
|
185
|
+
try {
|
|
186
|
+
const msg = (0, importcardfrompastedlinkeventmessage_1.deserializeImportCardFromPastedLinkEventMessage)(rawMsg);
|
|
187
|
+
const result = await callback(msg.url);
|
|
188
|
+
if (result) {
|
|
189
|
+
return (0, importcardfrompastedlinkdetails_1.serializeImportCardFromPastedLinkDetails)(result);
|
|
190
|
+
}
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
155
198
|
/**
|
|
156
199
|
* Register a card integration.
|
|
157
200
|
*/
|
|
@@ -207,6 +250,7 @@ class LucidCardIntegrationRegistry {
|
|
|
207
250
|
serialized['icu'] = {
|
|
208
251
|
'pi': cardIntegration.iconConfiguration.primaryIconUrl,
|
|
209
252
|
'li': cardIntegration.iconConfiguration.lightIconUrl,
|
|
253
|
+
'flic': cardIntegration.iconConfiguration.fieldLabelIconsCallback,
|
|
210
254
|
};
|
|
211
255
|
}
|
|
212
256
|
if (cardIntegration.importModal) {
|
|
@@ -297,6 +341,7 @@ class LucidCardIntegrationRegistry {
|
|
|
297
341
|
};
|
|
298
342
|
}
|
|
299
343
|
this.registerDependencyMapping(client, cardIntegration, serialized);
|
|
344
|
+
this.registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized);
|
|
300
345
|
client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
301
346
|
}
|
|
302
347
|
}
|
package/core/data/lucidicon.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { SerializedLucidDictionary } from './serializedfield/serializedfields';
|
|
|
2
2
|
/**
|
|
3
3
|
* Creates icon data as a SerializedLucidDictionary.
|
|
4
4
|
* Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
|
|
5
|
-
*
|
|
6
5
|
* @param icon - The URL or SVG data for the icon
|
|
7
6
|
* @param ariaLabel - The accessible label for the icon
|
|
8
7
|
* @param tooltipLabel - Optional tooltip text
|
package/core/data/lucidicon.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.createLucidIconData = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates icon data as a SerializedLucidDictionary.
|
|
6
6
|
* Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
|
|
7
|
-
*
|
|
8
7
|
* @param icon - The URL or SVG data for the icon
|
|
9
8
|
* @param ariaLabel - The accessible label for the icon
|
|
10
9
|
* @param tooltipLabel - Optional tooltip text
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImportCardFromPastedLinkDetails } from './importcardfrompastedlinkdetails';
|
|
2
|
+
/**
|
|
3
|
+
* Callback to attempt to extract primary keys from a pasted url to be imported as cards onto the canvas.
|
|
4
|
+
*
|
|
5
|
+
* @param url The url to be interpreted into primary keys for the extension to import.
|
|
6
|
+
* @return The details of the cards, or `undefined` if the url couldn't be interpreted.
|
|
7
|
+
*/
|
|
8
|
+
export type ImportCardFromPastedLinkCallback = (url: string) => Promise<ImportCardFromPastedLinkDetails | undefined>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isString } from '../checks';
|
|
2
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
3
|
+
import { PlaceholderImportMetadata, SerializedPlaceholderImportMetadata } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
4
|
+
/**
|
|
5
|
+
* A definition of the details required to import a card into the editor from a pasted url.
|
|
6
|
+
*/
|
|
7
|
+
export interface ImportCardFromPastedLinkDetails {
|
|
8
|
+
/**
|
|
9
|
+
* A list of primary keys to import onto the canvas via your extension's import action.
|
|
10
|
+
*
|
|
11
|
+
* These should be formatted the same as primary keys on the document's collection. For example, numeric keys would
|
|
12
|
+
* be formatted as `['123']`, and string keys would be formatted inside double quotes `['"my-item"']`
|
|
13
|
+
*/
|
|
14
|
+
primaryKeys: string[];
|
|
15
|
+
/**
|
|
16
|
+
* If `placeholderImportMetadataList` is provided, it is used to quickly splat a card on the canvas while waiting
|
|
17
|
+
* for the import action to finish, identical to how modal-based imports use search results to splat cards. Ensure
|
|
18
|
+
* that the schema of the `collectionDefinition` field in each placeholder import metadata is a subset of the
|
|
19
|
+
* collection that the imported cards will be added to.
|
|
20
|
+
*/
|
|
21
|
+
placeholderImportMetadataList?: PlaceholderImportMetadata[] | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* `importActionData` can be used to pass key-value pairs to your action. This data will be sent to your import
|
|
24
|
+
* modal's `import` method as the `searchFields: Map<string, SerializedFieldType>` parameter.
|
|
25
|
+
*/
|
|
26
|
+
importActionData?: Map<string, SerializedFieldType> | undefined;
|
|
27
|
+
}
|
|
28
|
+
/** @ignore */
|
|
29
|
+
export interface SerializedImportCardFromPastedLinkDetails {
|
|
30
|
+
'pk': string[];
|
|
31
|
+
'piml'?: SerializedPlaceholderImportMetadata[] | undefined;
|
|
32
|
+
'iad'?: [string, SerializedFieldType][] | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** @ignore */
|
|
35
|
+
export declare const isValidImportCardFromPastedLinkDetails: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
36
|
+
pk: (val: unknown) => val is string[];
|
|
37
|
+
piml: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
38
|
+
cid: typeof isString;
|
|
39
|
+
sid: (x: unknown) => x is string | undefined;
|
|
40
|
+
cd: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
41
|
+
Schema: typeof import("../..").isSerializedSchema;
|
|
42
|
+
Items: (val: unknown) => val is [string, Record<string | number, SerializedFieldType>][];
|
|
43
|
+
}>;
|
|
44
|
+
}>[] | undefined;
|
|
45
|
+
iad: (x: unknown) => x is [string, SerializedFieldType][] | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
/** @ignore */
|
|
48
|
+
export declare function serializeImportCardFromPastedLinkDetails(concrete: ImportCardFromPastedLinkDetails): SerializedImportCardFromPastedLinkDetails;
|
|
49
|
+
/** @ignore */
|
|
50
|
+
export declare function deserializeImportCardFromPastedLinkDetails(serialized: SerializedImportCardFromPastedLinkDetails): ImportCardFromPastedLinkDetails;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeImportCardFromPastedLinkDetails = exports.serializeImportCardFromPastedLinkDetails = exports.isValidImportCardFromPastedLinkDetails = void 0;
|
|
4
|
+
const checks_1 = require("../checks");
|
|
5
|
+
const serializedfields_1 = require("../data/serializedfield/serializedfields");
|
|
6
|
+
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
7
|
+
const validators_1 = require("../validators/validators");
|
|
8
|
+
/** @ignore */
|
|
9
|
+
exports.isValidImportCardFromPastedLinkDetails = (0, validators_1.objectValidator)({
|
|
10
|
+
'pk': (0, checks_1.isTypedArray)(checks_1.isString),
|
|
11
|
+
'piml': (0, validators_1.option)((0, checks_1.isTypedArray)(cardintegrationdefinitions_1.isSerializedPlaceholderImportMetadata)),
|
|
12
|
+
'iad': (0, validators_1.option)((0, checks_1.isTypedArray)((0, checks_1.isPair)(checks_1.isString, serializedfields_1.isSerializedFieldType))),
|
|
13
|
+
});
|
|
14
|
+
/** @ignore */
|
|
15
|
+
function serializeImportCardFromPastedLinkDetails(concrete) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
return {
|
|
18
|
+
'pk': concrete.primaryKeys,
|
|
19
|
+
'piml': (_a = concrete.placeholderImportMetadataList) === null || _a === void 0 ? void 0 : _a.map((data) => (0, cardintegrationdefinitions_1.serializePlaceholderImportMetadata)(data)),
|
|
20
|
+
'iad': concrete.importActionData ? [...(_b = concrete.importActionData) === null || _b === void 0 ? void 0 : _b.entries()] : undefined,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.serializeImportCardFromPastedLinkDetails = serializeImportCardFromPastedLinkDetails;
|
|
24
|
+
/** @ignore */
|
|
25
|
+
function deserializeImportCardFromPastedLinkDetails(serialized) {
|
|
26
|
+
var _a;
|
|
27
|
+
const placeholderImportMetadataList = serialized['piml']
|
|
28
|
+
? {
|
|
29
|
+
placeholderImportMetadataList: (_a = serialized['piml']) === null || _a === void 0 ? void 0 : _a.map((data) => (0, cardintegrationdefinitions_1.deserializePlaceholderImportMetadata)(data)),
|
|
30
|
+
}
|
|
31
|
+
: {};
|
|
32
|
+
const importActionData = serialized['iad'] ? { importActionData: new Map(serialized['iad']) } : {};
|
|
33
|
+
return Object.assign(Object.assign({ primaryKeys: serialized['pk'] }, placeholderImportMetadataList), importActionData);
|
|
34
|
+
}
|
|
35
|
+
exports.deserializeImportCardFromPastedLinkDetails = deserializeImportCardFromPastedLinkDetails;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Pruner } from '../guards';
|
|
2
|
+
/**
|
|
3
|
+
* Create a pruner which allows the target to be either null or satisfy the
|
|
4
|
+
* sub-pruner.
|
|
5
|
+
*
|
|
6
|
+
* @return A pruner for the subpruner or a null value
|
|
7
|
+
*/
|
|
8
|
+
export declare function nullablePruner(subPruner: Pruner): (data: unknown, invalidFields?: Map<number, unknown[]>, level?: number) => unknown;
|
|
2
9
|
/**
|
|
3
10
|
* Creates a pruner function that will remove object fields that are invalid.
|
|
4
11
|
* If a sub-pruner is provided for a field, then the object field values will be pruned.
|
package/core/pruners/pruners.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pruneObjectField = exports.arrayPruner = exports.objectOfPruner = exports.objectPruner = void 0;
|
|
3
|
+
exports.pruneObjectField = exports.arrayPruner = exports.objectOfPruner = exports.objectPruner = exports.nullablePruner = void 0;
|
|
4
4
|
const checks_1 = require("../checks");
|
|
5
|
+
/**
|
|
6
|
+
* Create a pruner which allows the target to be either null or satisfy the
|
|
7
|
+
* sub-pruner.
|
|
8
|
+
*
|
|
9
|
+
* @return A pruner for the subpruner or a null value
|
|
10
|
+
*/
|
|
11
|
+
function nullablePruner(subPruner) {
|
|
12
|
+
return (data, invalidFields, level = 0) => {
|
|
13
|
+
if (data === null) {
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return subPruner(data, invalidFields, level);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.nullablePruner = nullablePruner;
|
|
5
22
|
/**
|
|
6
23
|
* Creates a pruner function that will remove object fields that are invalid.
|
|
7
24
|
* If a sub-pruner is provided for a field, then the object field values will be pruned.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionDefinition } from '../../data/collectiondefinition';
|
|
1
|
+
import { CollectionDefinition, SerializedCollectionDefinition } from '../../data/collectiondefinition';
|
|
2
2
|
import { CollectionProxy } from '../../data/collectionproxy';
|
|
3
3
|
import { DataItemProxy } from '../../data/dataitemproxy';
|
|
4
4
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
@@ -7,7 +7,7 @@ import { FieldDescriptor } from '../cardintegration/lucidcardintegration';
|
|
|
7
7
|
import { isString } from '../checks';
|
|
8
8
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
9
9
|
import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
10
|
-
import { SerializedFieldType, isSerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
10
|
+
import { SerializedFieldType, SerializedLucidDictionary, isSerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
11
11
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
12
12
|
export interface ExtensionCardFieldOption {
|
|
13
13
|
label: string;
|
|
@@ -105,6 +105,7 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
105
105
|
Type: typeof isSerializedFieldTypeDefinition;
|
|
106
106
|
Constraints: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
107
107
|
Type: (x: unknown) => x is import("../data/serializedfield/serializedfielddefinition").FieldConstraintType;
|
|
108
|
+
/** The label to display in the UI */
|
|
108
109
|
Details: (x: unknown) => x is any;
|
|
109
110
|
}>[] | undefined;
|
|
110
111
|
l: typeof isString;
|
|
@@ -137,6 +138,35 @@ export interface SearchResult {
|
|
|
137
138
|
data: CollectionDefinition;
|
|
138
139
|
fields: ExtensionCardFieldDefinition[];
|
|
139
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Partial import metadata used to splat cards on the canvas while importing the rest of the data
|
|
143
|
+
*
|
|
144
|
+
* If you change this interface, check if your changes need to be synced with cardintegration.ts
|
|
145
|
+
*/
|
|
146
|
+
export interface PlaceholderImportMetadata {
|
|
147
|
+
collectionId: string;
|
|
148
|
+
syncDataSourceId?: string | undefined;
|
|
149
|
+
collectionDefinition: CollectionDefinition;
|
|
150
|
+
}
|
|
151
|
+
/** @ignore */
|
|
152
|
+
export interface SerializedPlaceholderImportMetadata {
|
|
153
|
+
'cid': string;
|
|
154
|
+
'sid'?: string | undefined;
|
|
155
|
+
'cd': SerializedCollectionDefinition;
|
|
156
|
+
}
|
|
157
|
+
/** @ignore */
|
|
158
|
+
export declare const isSerializedPlaceholderImportMetadata: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
159
|
+
cid: typeof isString;
|
|
160
|
+
sid: (x: unknown) => x is string | undefined;
|
|
161
|
+
cd: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
162
|
+
Schema: typeof import("../..").isSerializedSchema;
|
|
163
|
+
Items: (val: unknown) => val is [string, Record<string | number, SerializedFieldType>][];
|
|
164
|
+
}>;
|
|
165
|
+
}>;
|
|
166
|
+
/** @ignore */
|
|
167
|
+
export declare function serializePlaceholderImportMetadata(placeholderImportMetadata: PlaceholderImportMetadata): SerializedPlaceholderImportMetadata;
|
|
168
|
+
/** @ignore */
|
|
169
|
+
export declare function deserializePlaceholderImportMetadata(serializedPlaceholderImportMetadata: SerializedPlaceholderImportMetadata): PlaceholderImportMetadata;
|
|
140
170
|
/**
|
|
141
171
|
* Result of importing data from the import modal or dependency mapping
|
|
142
172
|
*/
|
|
@@ -199,3 +229,20 @@ export type ExtensionFieldConfiguration = {
|
|
|
199
229
|
/** Optional properties to configure how fields are displayed */
|
|
200
230
|
customFieldDisplaySettings?: CustomFieldDisplaySettings;
|
|
201
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* Maps item field names to icons that show next to the field labels in the card details panel.
|
|
234
|
+
* Use the `createLucidIconData()` helper to format the icon data in this map.
|
|
235
|
+
*/
|
|
236
|
+
export type ExtensionCardFieldLabelIcons = Map<string, SerializedLucidDictionary>;
|
|
237
|
+
/** @ignore */
|
|
238
|
+
export declare const isSerializedExtensionCardFieldLabelIcons: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{
|
|
239
|
+
k: typeof isString;
|
|
240
|
+
v: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
241
|
+
dict: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
242
|
+
icon: typeof isString;
|
|
243
|
+
ariaLabel: typeof isString;
|
|
244
|
+
tooltipLabel: (x: unknown) => x is string | undefined;
|
|
245
|
+
}>;
|
|
246
|
+
}>;
|
|
247
|
+
}>[];
|
|
248
|
+
export type ExtensionCardFieldLabelIconsCallback = ((dataSourceId: string, collectionId: string, primaryKey: string) => Promise<ExtensionCardFieldLabelIcons>) | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.deserializeCardUserData = exports.serializeCardUserData = void 0;
|
|
3
|
+
exports.isSerializedExtensionCardFieldLabelIcons = exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.deserializeCardUserData = exports.serializeCardUserData = void 0;
|
|
4
|
+
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
4
5
|
const schemadefinition_1 = require("../../data/schemadefinition");
|
|
5
6
|
const checks_1 = require("../checks");
|
|
6
7
|
const fieldtypedefinition_1 = require("../data/fieldtypedefinition/fieldtypedefinition");
|
|
@@ -82,3 +83,29 @@ function deserializeCardFieldArrayDefinition(fields) {
|
|
|
82
83
|
return fields.map(deserializeCardFieldDefinition);
|
|
83
84
|
}
|
|
84
85
|
exports.deserializeCardFieldArrayDefinition = deserializeCardFieldArrayDefinition;
|
|
86
|
+
/** @ignore */
|
|
87
|
+
exports.isSerializedPlaceholderImportMetadata = (0, validators_1.objectValidator)({
|
|
88
|
+
'cid': checks_1.isString,
|
|
89
|
+
'sid': (0, validators_1.option)(checks_1.isString),
|
|
90
|
+
'cd': collectiondefinition_1.isSerializedCollectionDefinition,
|
|
91
|
+
});
|
|
92
|
+
/** @ignore */
|
|
93
|
+
function serializePlaceholderImportMetadata(placeholderImportMetadata) {
|
|
94
|
+
return {
|
|
95
|
+
'cid': placeholderImportMetadata.collectionId,
|
|
96
|
+
'sid': placeholderImportMetadata.syncDataSourceId,
|
|
97
|
+
'cd': (0, collectiondefinition_1.serializeCollectionDefinition)(placeholderImportMetadata.collectionDefinition),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
exports.serializePlaceholderImportMetadata = serializePlaceholderImportMetadata;
|
|
101
|
+
/** @ignore */
|
|
102
|
+
function deserializePlaceholderImportMetadata(serializedPlaceholderImportMetadata) {
|
|
103
|
+
return {
|
|
104
|
+
collectionId: serializedPlaceholderImportMetadata['cid'],
|
|
105
|
+
syncDataSourceId: serializedPlaceholderImportMetadata['sid'],
|
|
106
|
+
collectionDefinition: (0, collectiondefinition_1.deserializeCollectionDefinition)(serializedPlaceholderImportMetadata['cd']),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
exports.deserializePlaceholderImportMetadata = deserializePlaceholderImportMetadata;
|
|
110
|
+
/** @ignore */
|
|
111
|
+
exports.isSerializedExtensionCardFieldLabelIcons = (0, validators_1.arrayValidator)((0, validators_1.objectValidator)({ 'k': checks_1.isString, 'v': serializedfields_1.isSerializedLucidIconDataDictionary }));
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { SerializedFields } from '../core/data/serializedfield/serializedfields';
|
|
2
|
-
import { SerializedSchema } from '../core/data/serializedfield/serializedschema';
|
|
2
|
+
import { SerializedSchema, isSerializedSchema } from '../core/data/serializedfield/serializedschema';
|
|
3
3
|
import { SchemaDefinition } from './schemadefinition';
|
|
4
4
|
export interface CollectionDefinition {
|
|
5
5
|
schema: SchemaDefinition;
|
|
6
6
|
items: Map<string, SerializedFields>;
|
|
7
7
|
}
|
|
8
|
+
export declare const isSerializedCollectionDefinition: (subject: unknown) => subject is import("..").DestructureGuardedTypeObj<{
|
|
9
|
+
Schema: typeof isSerializedSchema;
|
|
10
|
+
Items: (val: unknown) => val is [string, Record<string | number, import("../core/data/serializedfield/serializedfields").SerializedFieldType>][];
|
|
11
|
+
}>;
|
|
8
12
|
/** @ignore */
|
|
9
13
|
export declare function serializeCollectionDefinition(def: CollectionDefinition): SerializedCollectionDefinition;
|
|
10
14
|
/** @ignore */
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeCollectionDefinition = exports.serializeCollectionDefinition = void 0;
|
|
3
|
+
exports.deserializeCollectionDefinition = exports.serializeCollectionDefinition = exports.isSerializedCollectionDefinition = void 0;
|
|
4
|
+
const checks_1 = require("../core/checks");
|
|
5
|
+
const serializedfields_1 = require("../core/data/serializedfield/serializedfields");
|
|
6
|
+
const serializedschema_1 = require("../core/data/serializedfield/serializedschema");
|
|
7
|
+
const validators_1 = require("../core/validators/validators");
|
|
4
8
|
const schemadefinition_1 = require("./schemadefinition");
|
|
9
|
+
exports.isSerializedCollectionDefinition = (0, validators_1.objectValidator)({
|
|
10
|
+
'Schema': serializedschema_1.isSerializedSchema,
|
|
11
|
+
'Items': (0, checks_1.isTypedArray)((0, checks_1.isPair)(checks_1.isString, serializedfields_1.isSerializedFields)),
|
|
12
|
+
});
|
|
5
13
|
/** @ignore */
|
|
6
14
|
function serializeCollectionDefinition(def) {
|
|
7
15
|
return {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JsonObject } from '../core/jsonserializable';
|
|
2
|
+
/** @ignore */
|
|
3
|
+
export interface ImportCardFromPastedLinkEventMessage {
|
|
4
|
+
/** @ignore */
|
|
5
|
+
id: string;
|
|
6
|
+
/** @ignore */
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
/** @ignore */
|
|
10
|
+
export interface SerializedImportCardFromPastedLinkEventMessage extends JsonObject {
|
|
11
|
+
'id': string;
|
|
12
|
+
'u': string;
|
|
13
|
+
}
|
|
14
|
+
/** @ignore */
|
|
15
|
+
export declare function deserializeImportCardFromPastedLinkEventMessage(raw: SerializedImportCardFromPastedLinkEventMessage): ImportCardFromPastedLinkEventMessage;
|
|
16
|
+
/** @ignore */
|
|
17
|
+
export declare function serializeImportCardFromPastedLinkEventMessage(concrete: ImportCardFromPastedLinkEventMessage): SerializedImportCardFromPastedLinkEventMessage;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeImportCardFromPastedLinkEventMessage = exports.deserializeImportCardFromPastedLinkEventMessage = void 0;
|
|
4
|
+
/** @ignore */
|
|
5
|
+
function deserializeImportCardFromPastedLinkEventMessage(raw) {
|
|
6
|
+
return {
|
|
7
|
+
id: raw['id'],
|
|
8
|
+
url: raw['u'],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.deserializeImportCardFromPastedLinkEventMessage = deserializeImportCardFromPastedLinkEventMessage;
|
|
12
|
+
/** @ignore */
|
|
13
|
+
function serializeImportCardFromPastedLinkEventMessage(concrete) {
|
|
14
|
+
return {
|
|
15
|
+
'id': concrete.id,
|
|
16
|
+
'u': concrete.url,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.serializeImportCardFromPastedLinkEventMessage = serializeImportCardFromPastedLinkEventMessage;
|