lucid-extension-sdk 0.0.436 → 0.0.437
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 +6 -0
- package/core/cardintegration/cardintegrationautosyncconfig.d.ts +5 -1
- package/core/cardintegration/cardintegrationparams.d.ts +5 -1
- package/core/cardintegration/lucidcardintegration.d.ts +6 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +6 -1
- package/core/cardintegration/lucidcardintegrationregistry.js +43 -0
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +30 -0
- package/core/sharedcardintegration/cardintegrationdefinitions.js +14 -1
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -749,6 +749,7 @@ export type AutoSyncSettings = {
|
|
|
749
749
|
'h': string;
|
|
750
750
|
'gsf': string;
|
|
751
751
|
'sqs'?: string | undefined;
|
|
752
|
+
'syqs'?: string | undefined;
|
|
752
753
|
};
|
|
753
754
|
export type SerializedFieldConfiguration = {
|
|
754
755
|
/** Callback to get field definitions for all fields supported by the card integration */
|
|
@@ -832,6 +833,11 @@ export type AddCardIntegrationQuery = {
|
|
|
832
833
|
/** Callback to fetch icons that show next to the field labels in the card details panel */
|
|
833
834
|
'flic'?: string | undefined;
|
|
834
835
|
} | undefined;
|
|
836
|
+
/**
|
|
837
|
+
* @experimental
|
|
838
|
+
* Tag callback, to display tag information for any card
|
|
839
|
+
*/
|
|
840
|
+
'tc'?: string | undefined;
|
|
835
841
|
/**
|
|
836
842
|
* If specified, the text phrases to show in the dependency mapping UI.
|
|
837
843
|
* If not specified, dependency mapping for this integration uses the default fallback phrases.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
|
-
import { ExtensionCardFieldDefinition, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
2
|
+
import { ExtensionCardFieldDefinition, ImportResult, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
3
3
|
export interface CardIntegrationAutoSyncConfig {
|
|
4
4
|
/**
|
|
5
5
|
* The header to display for the integration. For example, the Jira integration displays "JQL query sync"
|
|
@@ -20,4 +20,8 @@ export interface CardIntegrationAutoSyncConfig {
|
|
|
20
20
|
* @returns either an error AutoSyncError or an array of issues / tasks / cards represented as an AutoSyncRow
|
|
21
21
|
*/
|
|
22
22
|
searchQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>, pageNumber: number, nextPageToken: string | undefined) => Promise<SearchResult>;
|
|
23
|
+
/**
|
|
24
|
+
* @returns the ImportResult for the query string.
|
|
25
|
+
*/
|
|
26
|
+
syncQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>) => Promise<ImportResult | ImportResult[]>;
|
|
23
27
|
}
|
|
@@ -29,6 +29,10 @@ export interface QuerySearchParam {
|
|
|
29
29
|
'pn': number;
|
|
30
30
|
'npt': string | undefined;
|
|
31
31
|
}
|
|
32
|
+
export interface QuerySyncParam {
|
|
33
|
+
'qs': string;
|
|
34
|
+
'of': [string, SerializedFieldType][];
|
|
35
|
+
}
|
|
32
36
|
/** @ignore */
|
|
33
37
|
export interface ImportParam {
|
|
34
38
|
'pks': string[];
|
|
@@ -87,7 +91,7 @@ export interface DependencyMappingSelectedIssueHeadingParam {
|
|
|
87
91
|
'k': string;
|
|
88
92
|
}
|
|
89
93
|
/** @ignore */
|
|
90
|
-
export interface
|
|
94
|
+
export interface DataItemCallbackParam {
|
|
91
95
|
'd': string;
|
|
92
96
|
'c': string;
|
|
93
97
|
'p': string;
|
|
@@ -81,6 +81,12 @@ export declare abstract class LucidCardIntegration {
|
|
|
81
81
|
*/
|
|
82
82
|
fieldLabelIconsCallback?: string;
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* @experimental Optional. Callback function to derive a tag for any given card.
|
|
86
|
+
* A tag is a combination of a text label (preferably short, less than two words) and an icon,
|
|
87
|
+
* which can provide extra user-facing information in the card details panel.
|
|
88
|
+
*/
|
|
89
|
+
tagCallback?: string;
|
|
84
90
|
/** If we are only able to search by name and not email in the card integration (ex: for JDC) */
|
|
85
91
|
searchUserByName?: boolean;
|
|
86
92
|
/** This is used to search for users in the card integration. It returns an additional email field of the user if available.*/
|
|
@@ -2,7 +2,7 @@ import { DataItemProxy } from '../../data/dataitemproxy';
|
|
|
2
2
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
3
3
|
import { EditorClient } from '../../editorclient';
|
|
4
4
|
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
5
|
-
import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
5
|
+
import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData, TagCallback } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
6
6
|
import { LucidCardIntegration } from './lucidcardintegration';
|
|
7
7
|
export declare class LucidCardIntegrationRegistry {
|
|
8
8
|
private static nextHookId;
|
|
@@ -14,8 +14,13 @@ export declare class LucidCardIntegrationRegistry {
|
|
|
14
14
|
}) => Promise<ExtensionCardFieldOption[]>): string;
|
|
15
15
|
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
|
|
16
16
|
static registerFieldLabelIconsCallback(client: EditorClient, callback: (dataSourceProxy: DataSourceProxy, dataItemProxy: DataItemProxy) => Promise<ExtensionCardFieldLabelIcons>): string;
|
|
17
|
+
static registerTagCallback(client: EditorClient, callback: TagCallback): string;
|
|
17
18
|
private static registerDependencyMapping;
|
|
18
19
|
private static serializeSearchResult;
|
|
20
|
+
/**
|
|
21
|
+
* Helper to serialize import results (single or array) to the expected format.
|
|
22
|
+
*/
|
|
23
|
+
private static serializeImportResults;
|
|
19
24
|
private static registerImportCardFromPastedLinkHandler;
|
|
20
25
|
/**
|
|
21
26
|
* Register a card integration.
|
|
@@ -60,6 +60,21 @@ class LucidCardIntegrationRegistry {
|
|
|
60
60
|
});
|
|
61
61
|
return name;
|
|
62
62
|
}
|
|
63
|
+
static registerTagCallback(client, callback) {
|
|
64
|
+
const name = LucidCardIntegrationRegistry.nextHookName();
|
|
65
|
+
client.registerAction(name, async ({ 'd': dataSourceId, 'c': collectionId, 'p': primaryKey, }) => {
|
|
66
|
+
const dataSourceProxy = new datasourceproxy_1.DataSourceProxy(dataSourceId, client);
|
|
67
|
+
const collectionProxy = new collectionproxy_1.CollectionProxy(collectionId, client);
|
|
68
|
+
const dataItemProxy = new dataitemproxy_1.DataItemProxy(primaryKey, collectionProxy, client);
|
|
69
|
+
const result = await callback(dataSourceProxy, collectionProxy, dataItemProxy);
|
|
70
|
+
if (result === undefined) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const serializedResult = (0, cardintegrationdefinitions_1.serializeTagCallbackResult)(result);
|
|
74
|
+
return serializedResult;
|
|
75
|
+
});
|
|
76
|
+
return name;
|
|
77
|
+
}
|
|
63
78
|
static registerDependencyMapping(client, cardIntegration, serialized) {
|
|
64
79
|
if (cardIntegration.showDependencyMapping) {
|
|
65
80
|
serialized['sdm'] = true;
|
|
@@ -176,6 +191,23 @@ class LucidCardIntegrationRegistry {
|
|
|
176
191
|
'e': searchResult.error,
|
|
177
192
|
};
|
|
178
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Helper to serialize import results (single or array) to the expected format.
|
|
196
|
+
*/
|
|
197
|
+
static serializeImportResults(result) {
|
|
198
|
+
if ((0, checks_1.isArray)(result)) {
|
|
199
|
+
return result.map((importResult) => {
|
|
200
|
+
return {
|
|
201
|
+
'c': importResult.collection.id,
|
|
202
|
+
'pks': importResult.primaryKeys,
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
'c': result.collection.id,
|
|
208
|
+
'pks': result.primaryKeys,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
179
211
|
static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
|
|
180
212
|
if (!cardIntegration.importCardFromPastedLink) {
|
|
181
213
|
return;
|
|
@@ -258,6 +290,9 @@ class LucidCardIntegrationRegistry {
|
|
|
258
290
|
'flic': cardIntegration.iconConfiguration.fieldLabelIconsCallback,
|
|
259
291
|
};
|
|
260
292
|
}
|
|
293
|
+
if (cardIntegration.tagCallback) {
|
|
294
|
+
serialized['tc'] = cardIntegration.tagCallback;
|
|
295
|
+
}
|
|
261
296
|
if (cardIntegration.importModal) {
|
|
262
297
|
const importModal = cardIntegration.importModal;
|
|
263
298
|
if (importModal instanceof lucidcardintegrationcustomimportmodal_1.LucidCardIntegrationCustomImportModal) {
|
|
@@ -369,6 +404,14 @@ class LucidCardIntegrationRegistry {
|
|
|
369
404
|
}
|
|
370
405
|
});
|
|
371
406
|
}
|
|
407
|
+
if (autoSync.syncQueryString) {
|
|
408
|
+
serialized['as']['syqs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
409
|
+
client.registerAction(serialized['as']['syqs'], async ({ 'qs': queryString, 'of': otherFields }) => {
|
|
410
|
+
var _a, _b;
|
|
411
|
+
const result = (_b = (await ((_a = autoSync.syncQueryString) === null || _a === void 0 ? void 0 : _a.call(autoSync, queryString, new Map(otherFields))))) !== null && _b !== void 0 ? _b : [];
|
|
412
|
+
return LucidCardIntegrationRegistry.serializeImportResults(result);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
372
415
|
}
|
|
373
416
|
if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
|
|
374
417
|
serialized['fc']['cfds'] = {
|
|
@@ -277,3 +277,33 @@ export type ExtensionFieldConfiguration = {
|
|
|
277
277
|
* Use the `createLucidIconData()` helper to format the icon data in this map.
|
|
278
278
|
*/
|
|
279
279
|
export type ExtensionCardFieldLabelIcons = Map<string, SerializedLucidIconData>;
|
|
280
|
+
/**
|
|
281
|
+
* @experimental Callback function to derive a tag for any given card's data item.
|
|
282
|
+
* A tag is a combination of a text label (preferably short, less than two words) and an icon,
|
|
283
|
+
* which can provide extra user-facing information in the card details panel.
|
|
284
|
+
*/
|
|
285
|
+
export type TagCallback = (dataSourceProxy: DataSourceProxy, collectionProxy: CollectionProxy, dataItemProxy: DataItemProxy) => Promise<TagCallbackResult | undefined>;
|
|
286
|
+
/** @ignore */
|
|
287
|
+
export type TagCallbackResult = {
|
|
288
|
+
label: string;
|
|
289
|
+
icon?: SerializedLucidIconData | undefined;
|
|
290
|
+
};
|
|
291
|
+
/** @ignore */
|
|
292
|
+
export interface SerializedTagCallbackResult {
|
|
293
|
+
'l': string;
|
|
294
|
+
'i'?: SerializedLucidIconData | undefined;
|
|
295
|
+
}
|
|
296
|
+
/** @ignore */
|
|
297
|
+
export declare const isSerializedTagCallbackResult: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
298
|
+
l: typeof isString;
|
|
299
|
+
i: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
300
|
+
dict: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
301
|
+
icon: typeof isString;
|
|
302
|
+
ariaLabel: typeof isString;
|
|
303
|
+
tooltipLabel: (x: unknown) => x is string | undefined;
|
|
304
|
+
roundedIcon: (x: unknown) => x is boolean | undefined;
|
|
305
|
+
}>;
|
|
306
|
+
}> | undefined;
|
|
307
|
+
}>;
|
|
308
|
+
/** @ignore */
|
|
309
|
+
export declare function serializeTagCallbackResult(tag: TagCallbackResult): SerializedTagCallbackResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = 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.serializeTagCallbackResult = exports.isSerializedTagCallbackResult = exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = 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
4
|
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
5
5
|
const schemadefinition_1 = require("../../data/schemadefinition");
|
|
6
6
|
const checks_1 = require("../checks");
|
|
@@ -104,3 +104,16 @@ function deserializePlaceholderImportMetadata(serializedPlaceholderImportMetadat
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
exports.deserializePlaceholderImportMetadata = deserializePlaceholderImportMetadata;
|
|
107
|
+
/** @ignore */
|
|
108
|
+
exports.isSerializedTagCallbackResult = (0, validators_1.objectValidator)({
|
|
109
|
+
'l': checks_1.isString,
|
|
110
|
+
'i': (0, validators_1.option)(serializedfields_1.isSerializedLucidIconData),
|
|
111
|
+
});
|
|
112
|
+
/** @ignore */
|
|
113
|
+
function serializeTagCallbackResult(tag) {
|
|
114
|
+
return {
|
|
115
|
+
'l': tag.label,
|
|
116
|
+
'i': tag === null || tag === void 0 ? void 0 : tag.icon,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
exports.serializeTagCallbackResult = serializeTagCallbackResult;
|