lucid-extension-sdk 1.1.2 → 1.1.3
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 -4
- package/core/cardintegration/cardintegrationautosyncconfig.d.ts +20 -2
- package/core/cardintegration/cardintegrationparams.d.ts +4 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +0 -5
- package/core/cardintegration/lucidcardintegrationregistry.js +8 -198
- package/core/checks.d.ts +1 -0
- package/core/checks.js +14 -0
- package/core/sharedcardintegration/sharedregistryutil.d.ts +47 -1
- package/core/sharedcardintegration/sharedregistryutil.js +203 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +5 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +3 -0
- package/dataconnector/actions/action.d.ts +20 -1
- package/dataconnector/actions/action.js +7 -1
- package/dataconnector/actions/serializedactions.js +7 -5
- package/dataconnector/datasourceupdatetypes.d.ts +14 -0
- package/dataconnector/datasourceupdatetypes.js +19 -1
- package/dataconnector/querycollection/buildpatches.d.ts +38 -0
- package/dataconnector/querycollection/buildpatches.js +66 -0
- package/dataconnector/querycollection/derivequerycollectionschema.d.ts +15 -0
- package/dataconnector/querycollection/derivequerycollectionschema.js +36 -0
- package/dataconnector/querycollection/diffprimarykeys.d.ts +21 -0
- package/dataconnector/querycollection/diffprimarykeys.js +31 -0
- package/dataconnector/querycollection/getquerycollections.d.ts +21 -0
- package/dataconnector/querycollection/getquerycollections.js +44 -0
- package/dataconnector/querycollection/index.d.ts +5 -0
- package/dataconnector/querycollection/index.js +15 -0
- package/dataconnector/querycollection/sendquerycollectionpatch.d.ts +15 -0
- package/dataconnector/querycollection/sendquerycollectionpatch.js +21 -0
- package/document/linetextareapositioning.d.ts +13 -0
- package/document/linetextareapositioning.js +11 -2
- package/index.d.ts +190 -121
- package/index.js +583 -135
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -858,13 +858,11 @@ export type AutoSyncSettings = {
|
|
|
858
858
|
'gsf': string;
|
|
859
859
|
'sqs'?: string | undefined;
|
|
860
860
|
'syqs'?: string | undefined;
|
|
861
|
-
/** getDefaultFilterFields action ID - field-only config */
|
|
862
|
-
'gdf'?: string | undefined;
|
|
863
861
|
/** searchFields action ID - field-only config */
|
|
864
862
|
'sf'?: string | undefined;
|
|
865
863
|
/** syncFields action ID - field-only config */
|
|
866
864
|
'syf'?: string | undefined;
|
|
867
|
-
/** If specified, setup fields that allow user to create query template that auto applies to dynamic tables when created*/
|
|
865
|
+
/** If specified, setup fields that allow user to create query template that auto applies to dynamic tables when created */
|
|
868
866
|
'dpf'?: {
|
|
869
867
|
/** Get search fields action */
|
|
870
868
|
'gsf': string;
|
|
@@ -872,8 +870,10 @@ export type AutoSyncSettings = {
|
|
|
872
870
|
'gpv': string;
|
|
873
871
|
} | undefined;
|
|
874
872
|
'cftqs'?: string | undefined;
|
|
875
|
-
/** Get default filter fields action */
|
|
873
|
+
/** Get default filter fields action. Used in both field-only and query-string configurations. */
|
|
876
874
|
'gdff'?: string | undefined;
|
|
875
|
+
/** Get more filter fields action. Used in both field-only and query-string configurations. */
|
|
876
|
+
'gmff'?: string | undefined;
|
|
877
877
|
};
|
|
878
878
|
export type SerializedFieldConfiguration = {
|
|
879
879
|
/** Callback to get field definitions for all fields supported by the card integration */
|
|
@@ -1137,6 +1137,8 @@ export type AddSpreadsheetIntegrationQuery = {
|
|
|
1137
1137
|
[K in keyof SerializedFieldConfiguration]?: SerializedFieldConfiguration[K] | undefined;
|
|
1138
1138
|
} | undefined;
|
|
1139
1139
|
'dm'?: DependencyMappingSettings | undefined;
|
|
1140
|
+
/** Auto-sync configuration (only honored when `c` / addCardsIntegration is true) */
|
|
1141
|
+
'as'?: AutoSyncSettings | undefined;
|
|
1140
1142
|
};
|
|
1141
1143
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
1142
1144
|
export type AddSpreadsheetIntegrationResult = undefined;
|
|
@@ -74,9 +74,17 @@ export interface QueryStringCardIntegrationAutoSyncConfig extends BaseCardIntegr
|
|
|
74
74
|
* type a raw query string.
|
|
75
75
|
*
|
|
76
76
|
* @param searchSoFar The fields the user has populated so far (e.g. the selected data source id)
|
|
77
|
-
* @returns The filter fields to render
|
|
77
|
+
* @returns The filter fields to always render
|
|
78
78
|
*/
|
|
79
79
|
getDefaultFilterFields?: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Provides the additional filter fields a user can pin from the "More filters" picker.
|
|
82
|
+
* Implementations **MUST exclude** any field already returned by {@link getDefaultFilterFields}.
|
|
83
|
+
*
|
|
84
|
+
* @param searchSoFar The fields the user has populated so far (e.g. the selected data source id)
|
|
85
|
+
* @returns The additional filter fields, excluding default fields
|
|
86
|
+
*/
|
|
87
|
+
getMoreFilterFields?: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
80
88
|
}
|
|
81
89
|
/**
|
|
82
90
|
* @experimental
|
|
@@ -88,10 +96,20 @@ export interface FieldOnlyCardIntegrationAutoSyncConfig extends BaseCardIntegrat
|
|
|
88
96
|
* Returns the filter field definitions available for the user to configure. Called whenever the
|
|
89
97
|
* current field selections change, allowing fields to be dynamically updated based on prior selections.
|
|
90
98
|
*
|
|
99
|
+
* Keep this callback fast — it is called eagerly whenever the filter form is shown.
|
|
100
|
+
*
|
|
91
101
|
* @param searchSoFar The filter field values selected so far
|
|
92
|
-
* @returns the field definitions to display for filtering
|
|
102
|
+
* @returns the field definitions to display for filtering by default
|
|
93
103
|
*/
|
|
94
104
|
getDefaultFilterFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Provides the additional filter fields a user can pin from the "More filters" picker.
|
|
107
|
+
* Implementations **MUST exclude** any field already returned by {@link getDefaultFilterFields}.
|
|
108
|
+
*
|
|
109
|
+
* @param searchSoFar The filter field values selected so far
|
|
110
|
+
* @returns The additional filter fields, excluding default fields
|
|
111
|
+
*/
|
|
112
|
+
getMoreFilterFields?: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
95
113
|
/**
|
|
96
114
|
* Perform a search using the selected filter field values. This should support pagination
|
|
97
115
|
* (See {@link AutoSyncPaginationSize}).
|
|
@@ -56,6 +56,10 @@ export interface GetDefaultFilterFieldsParam {
|
|
|
56
56
|
's': [string, SerializedFieldType][];
|
|
57
57
|
}
|
|
58
58
|
/** @ignore */
|
|
59
|
+
export interface GetMoreFilterFieldsParam {
|
|
60
|
+
's': [string, SerializedFieldType][];
|
|
61
|
+
}
|
|
62
|
+
/** @ignore */
|
|
59
63
|
export interface QuerySyncRemoveNonMatchingLabelParam {
|
|
60
64
|
'g': string;
|
|
61
65
|
}
|
|
@@ -18,11 +18,6 @@ export declare class LucidCardIntegrationRegistry {
|
|
|
18
18
|
static registerTagCallback(client: EditorClient, callback: TagCallback): string;
|
|
19
19
|
static registerBannerActionCallback(client: EditorClient, callback: (actionId: string) => void): string;
|
|
20
20
|
private static registerDependencyMapping;
|
|
21
|
-
private static serializeSearchResult;
|
|
22
|
-
/**
|
|
23
|
-
* Helper to serialize import results (single or array) to the expected format.
|
|
24
|
-
*/
|
|
25
|
-
private static serializeImportResults;
|
|
26
21
|
private static registerImportCardFromPastedLinkHandler;
|
|
27
22
|
/**
|
|
28
23
|
* Register a card integration.
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LucidCardIntegrationRegistry = void 0;
|
|
4
4
|
const commandtypes_1 = require("../../commandtypes");
|
|
5
|
-
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
6
5
|
const collectionproxy_1 = require("../../data/collectionproxy");
|
|
7
6
|
const dataitemproxy_1 = require("../../data/dataitemproxy");
|
|
8
7
|
const datasourceproxy_1 = require("../../data/datasourceproxy");
|
|
@@ -11,7 +10,6 @@ const checks_1 = require("../checks");
|
|
|
11
10
|
const importcardfromdetails_1 = require("../importcardfromdetails/importcardfromdetails");
|
|
12
11
|
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
13
12
|
const sharedregistryutil_1 = require("../sharedcardintegration/sharedregistryutil");
|
|
14
|
-
const cardintegrationautosyncconfig_1 = require("./cardintegrationautosyncconfig");
|
|
15
13
|
const cardintegrationconfig_1 = require("./cardintegrationconfig");
|
|
16
14
|
const tabs_1 = require("./cardpaneltabs/tabs");
|
|
17
15
|
const extensiondatapanellistitem_1 = require("./extensiondatapanel/extensiondatapanellistitem");
|
|
@@ -99,50 +97,6 @@ class LucidCardIntegrationRegistry {
|
|
|
99
97
|
static registerDependencyMapping(client, cardIntegration, serialized) {
|
|
100
98
|
return (0, sharedregistryutil_1.registerDependencyMapping)(client, cardIntegration, serialized, () => LucidCardIntegrationRegistry.nextHookName());
|
|
101
99
|
}
|
|
102
|
-
static serializeSearchResult(searchResult) {
|
|
103
|
-
var _a;
|
|
104
|
-
return {
|
|
105
|
-
'srs': searchResult.searchResults.map((resultPerCollection) => ({
|
|
106
|
-
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(resultPerCollection.data),
|
|
107
|
-
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(resultPerCollection.fields),
|
|
108
|
-
'm': resultPerCollection.partialImportMetadata && {
|
|
109
|
-
'cid': resultPerCollection.partialImportMetadata.collectionId,
|
|
110
|
-
'sid': resultPerCollection.partialImportMetadata.syncDataSourceId,
|
|
111
|
-
},
|
|
112
|
-
})),
|
|
113
|
-
'ipsr': searchResult.itemsPerSearchResult,
|
|
114
|
-
'e': searchResult.error,
|
|
115
|
-
'bs': (_a = searchResult.banners) === null || _a === void 0 ? void 0 : _a.map((banner) => ({
|
|
116
|
-
'ty': banner.type,
|
|
117
|
-
'msg': banner.message,
|
|
118
|
-
'btyp': banner.bannerType,
|
|
119
|
-
'actbtn': banner.actionButton
|
|
120
|
-
? {
|
|
121
|
-
'lab': banner.actionButton.label,
|
|
122
|
-
'aid': banner.actionButton.actionId,
|
|
123
|
-
'href': banner.actionButton.href,
|
|
124
|
-
}
|
|
125
|
-
: undefined,
|
|
126
|
-
})),
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Helper to serialize import results (single or array) to the expected format.
|
|
131
|
-
*/
|
|
132
|
-
static serializeImportResults(result) {
|
|
133
|
-
if ((0, checks_1.isArray)(result)) {
|
|
134
|
-
return result.map((importResult) => {
|
|
135
|
-
return {
|
|
136
|
-
'c': importResult.collection.id,
|
|
137
|
-
'pks': importResult.primaryKeys,
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
'c': result.collection.id,
|
|
143
|
-
'pks': result.primaryKeys,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
100
|
static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
|
|
147
101
|
if (!cardIntegration.importCardFromPastedLink) {
|
|
148
102
|
return;
|
|
@@ -175,7 +129,7 @@ class LucidCardIntegrationRegistry {
|
|
|
175
129
|
* Register a card integration.
|
|
176
130
|
*/
|
|
177
131
|
static addCardIntegration(client, cardIntegration) {
|
|
178
|
-
var _a, _b, _c, _d
|
|
132
|
+
var _a, _b, _c, _d;
|
|
179
133
|
const getFieldsActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
180
134
|
client.registerAction(getFieldsActionName, async (param) => {
|
|
181
135
|
const dataSource = new datasourceproxy_1.DataSourceProxy(param['d'], client);
|
|
@@ -282,32 +236,21 @@ class LucidCardIntegrationRegistry {
|
|
|
282
236
|
const result = await importModal.search(new Map(param), offset, limit);
|
|
283
237
|
if (!(0, cardintegrationdefinitions_1.isSearchResult)(result)) {
|
|
284
238
|
if ((0, checks_1.isArray)(result)) {
|
|
285
|
-
return
|
|
239
|
+
return (0, sharedregistryutil_1.serializeSearchResult)({
|
|
286
240
|
searchResults: result,
|
|
287
241
|
});
|
|
288
242
|
}
|
|
289
243
|
else {
|
|
290
|
-
return
|
|
244
|
+
return (0, sharedregistryutil_1.serializeSearchResult)({
|
|
291
245
|
searchResults: [result],
|
|
292
246
|
});
|
|
293
247
|
}
|
|
294
248
|
}
|
|
295
|
-
return
|
|
249
|
+
return (0, sharedregistryutil_1.serializeSearchResult)(result);
|
|
296
250
|
});
|
|
297
251
|
client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
|
|
298
252
|
const result = await importModal.import(primaryKeys, new Map(searchFields));
|
|
299
|
-
|
|
300
|
-
return result.map((importResult) => {
|
|
301
|
-
return {
|
|
302
|
-
'c': importResult.collection.id,
|
|
303
|
-
'pks': importResult.primaryKeys,
|
|
304
|
-
};
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
return {
|
|
308
|
-
'c': result.collection.id,
|
|
309
|
-
'pks': result.primaryKeys,
|
|
310
|
-
};
|
|
253
|
+
return (0, sharedregistryutil_1.serializeImportResults)(result);
|
|
311
254
|
});
|
|
312
255
|
if (serialized['im']['os']) {
|
|
313
256
|
client.registerAction(serialized['im']['os'], async () => {
|
|
@@ -336,146 +279,13 @@ class LucidCardIntegrationRegistry {
|
|
|
336
279
|
});
|
|
337
280
|
}
|
|
338
281
|
if (cardIntegration.autoSync) {
|
|
339
|
-
|
|
340
|
-
serialized['as'] = {
|
|
341
|
-
'gsf': LucidCardIntegrationRegistry.nextHookName(),
|
|
342
|
-
};
|
|
343
|
-
if (autoSync.phrases) {
|
|
344
|
-
serialized['as']['p'] = {
|
|
345
|
-
'h': autoSync.phrases.header,
|
|
346
|
-
'l': autoSync.phrases.label,
|
|
347
|
-
'qph': autoSync.phrases.queryPlaceholder,
|
|
348
|
-
'rnml': LucidCardIntegrationRegistry.nextHookName(),
|
|
349
|
-
'nml': autoSync.phrases.noMatchedLabel,
|
|
350
|
-
'esl': autoSync.phrases.emptyStateLabel,
|
|
351
|
-
};
|
|
352
|
-
client.registerAction(serialized['as']['p']['rnml'], ({ 'g': inputSoFar }) => {
|
|
353
|
-
var _a;
|
|
354
|
-
if (!(0, cardintegrationautosyncconfig_1.isSupportedAutoSyncGeneratorType)(inputSoFar)) {
|
|
355
|
-
return '';
|
|
356
|
-
}
|
|
357
|
-
return (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.removeNonMatchingLabel(inputSoFar);
|
|
358
|
-
});
|
|
359
|
-
if ((_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.syncingGrowlMessage) {
|
|
360
|
-
serialized['as']['p']['sgm'] = LucidCardIntegrationRegistry.nextHookName();
|
|
361
|
-
client.registerAction(serialized['as']['p']['sgm'], ({ 'c': count }) => {
|
|
362
|
-
var _a, _b;
|
|
363
|
-
return (_b = (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.syncingGrowlMessage) === null || _b === void 0 ? void 0 : _b.call(_a, count);
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
if ((_b = autoSync.phrases) === null || _b === void 0 ? void 0 : _b.removingGrowlMessage) {
|
|
367
|
-
serialized['as']['p']['rgm'] = LucidCardIntegrationRegistry.nextHookName();
|
|
368
|
-
client.registerAction(serialized['as']['p']['rgm'], ({ 'c': count }) => {
|
|
369
|
-
var _a, _b;
|
|
370
|
-
return (_b = (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.removingGrowlMessage) === null || _b === void 0 ? void 0 : _b.call(_a, count);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
client.registerAction(serialized['as']['gsf'], async ({ 'i': inputSoFar }) => {
|
|
375
|
-
const result = await autoSync.getSyncDataSourceIdField(new Map(inputSoFar));
|
|
376
|
-
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
377
|
-
});
|
|
378
|
-
if ('searchFields' in autoSync) {
|
|
379
|
-
const fieldOnlyAutoSync = autoSync;
|
|
380
|
-
serialized['as']['gdf'] = LucidCardIntegrationRegistry.nextHookName();
|
|
381
|
-
client.registerAction(serialized['as']['gdf'], async ({ 'i': inputSoFar }) => {
|
|
382
|
-
const result = await fieldOnlyAutoSync.getDefaultFilterFields(new Map(inputSoFar));
|
|
383
|
-
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
384
|
-
});
|
|
385
|
-
serialized['as']['sf'] = LucidCardIntegrationRegistry.nextHookName();
|
|
386
|
-
client.registerAction(serialized['as']['sf'], async ({ 'f': fields, 'if': instanceFields, 'pn': pageNumber, 'npt': nextPageToken, }) => {
|
|
387
|
-
const result = await fieldOnlyAutoSync.searchFields(new Map(fields), new Map(instanceFields), pageNumber, nextPageToken);
|
|
388
|
-
if (result) {
|
|
389
|
-
return this.serializeSearchResult(result);
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
return this.serializeSearchResult({
|
|
393
|
-
searchResults: [],
|
|
394
|
-
error: 'Unknown Error Occurred',
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
serialized['as']['syf'] = LucidCardIntegrationRegistry.nextHookName();
|
|
399
|
-
client.registerAction(serialized['as']['syf'], async ({ 'f': fields, 'if': instanceFields }) => {
|
|
400
|
-
var _a;
|
|
401
|
-
const result = (_a = (await fieldOnlyAutoSync.syncFields(new Map(fields), new Map(instanceFields)))) !== null && _a !== void 0 ? _a : [];
|
|
402
|
-
return LucidCardIntegrationRegistry.serializeImportResults(result);
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
const queryStringAutoSync = autoSync;
|
|
407
|
-
if (queryStringAutoSync.searchQueryString) {
|
|
408
|
-
serialized['as']['sqs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
409
|
-
client.registerAction(serialized['as']['sqs'], async ({ 'qs': queryString, 'of': otherFields, 'pn': pageNumber, 'npt': nextPageToken, }) => {
|
|
410
|
-
var _a;
|
|
411
|
-
const result = await ((_a = queryStringAutoSync.searchQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, queryString, new Map(otherFields), pageNumber, nextPageToken));
|
|
412
|
-
if (result) {
|
|
413
|
-
return this.serializeSearchResult(result);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
return this.serializeSearchResult({
|
|
417
|
-
searchResults: [],
|
|
418
|
-
error: 'Unknown Error Occurred',
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
if (queryStringAutoSync.syncQueryString) {
|
|
424
|
-
serialized['as']['syqs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
425
|
-
client.registerAction(serialized['as']['syqs'], async ({ 'qs': queryString, 'of': otherFields }) => {
|
|
426
|
-
var _a, _b;
|
|
427
|
-
const result = (_b = (await ((_a = queryStringAutoSync.syncQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, queryString, new Map(otherFields))))) !== null && _b !== void 0 ? _b : [];
|
|
428
|
-
return LucidCardIntegrationRegistry.serializeImportResults(result);
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
if (queryStringAutoSync.convertFiltersToQueryString) {
|
|
432
|
-
serialized['as']['cftqs'] = LucidCardIntegrationRegistry.nextHookName();
|
|
433
|
-
client.registerAction(serialized['as']['cftqs'], async ({ 'ff': filterFields }) => {
|
|
434
|
-
var _a;
|
|
435
|
-
const result = await ((_a = queryStringAutoSync.convertFiltersToQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, new Map(filterFields)));
|
|
436
|
-
if ((0, cardintegrationautosyncconfig_1.isConvertFiltersToQueryStringResult)(result)) {
|
|
437
|
-
return {
|
|
438
|
-
'qs': result.queryString,
|
|
439
|
-
'e': result.error,
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
return result;
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
if (queryStringAutoSync.getDefaultFilterFields) {
|
|
446
|
-
serialized['as']['gdff'] = LucidCardIntegrationRegistry.nextHookName();
|
|
447
|
-
client.registerAction(serialized['as']['gdff'], async ({ 's': searchSoFar }) => {
|
|
448
|
-
var _a, _b;
|
|
449
|
-
const result = (_b = (await ((_a = queryStringAutoSync.getDefaultFilterFields) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, new Map(searchSoFar))))) !== null && _b !== void 0 ? _b : [];
|
|
450
|
-
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (autoSync.documentPresetSetupFields) {
|
|
455
|
-
const documentPresetSetupFields = autoSync.documentPresetSetupFields;
|
|
456
|
-
serialized['as']['dpf'] = {
|
|
457
|
-
'gsf': LucidCardIntegrationRegistry.nextHookName(),
|
|
458
|
-
'gpv': LucidCardIntegrationRegistry.nextHookName(),
|
|
459
|
-
};
|
|
460
|
-
client.registerAction(serialized['as']['dpf']['gsf'], async ({ 's': searchSoFar }) => {
|
|
461
|
-
const result = await documentPresetSetupFields.getSearchFields(new Map(searchSoFar));
|
|
462
|
-
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
463
|
-
});
|
|
464
|
-
client.registerAction(serialized['as']['dpf']['gpv'], async ({ 'f': fields }) => {
|
|
465
|
-
const result = await documentPresetSetupFields.generatePresetValue(new Map(fields));
|
|
466
|
-
return {
|
|
467
|
-
'dcn': result.dataConnectorName,
|
|
468
|
-
'iid': result.instanceId,
|
|
469
|
-
'q': result.query,
|
|
470
|
-
};
|
|
471
|
-
});
|
|
472
|
-
}
|
|
282
|
+
serialized['as'] = (0, sharedregistryutil_1.registerAutoSync)(client, cardIntegration.autoSync, () => LucidCardIntegrationRegistry.nextHookName());
|
|
473
283
|
}
|
|
474
284
|
if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
|
|
475
285
|
serialized['fc']['cfds'] = {
|
|
476
286
|
'd': cardIntegration.fieldConfiguration.customFieldDisplaySettings.defaultToMultilineText,
|
|
477
|
-
'uri': (
|
|
478
|
-
'dadr': (
|
|
287
|
+
'uri': (_b = (_a = cardIntegration.fieldConfiguration) === null || _a === void 0 ? void 0 : _a.customFieldDisplaySettings) === null || _b === void 0 ? void 0 : _b.useRoundIcons,
|
|
288
|
+
'dadr': (_d = (_c = cardIntegration.fieldConfiguration) === null || _c === void 0 ? void 0 : _c.customFieldDisplaySettings) === null || _d === void 0 ? void 0 : _d.displayMappedDatesAsDateRange,
|
|
479
289
|
};
|
|
480
290
|
}
|
|
481
291
|
if (cardIntegration.fieldConfiguration.nonCustomizableFields) {
|
package/core/checks.d.ts
CHANGED
|
@@ -138,6 +138,7 @@ export declare function isTypedTuple<const Tuple extends readonly unknown[]>(gua
|
|
|
138
138
|
* @return Whether variable is a map.
|
|
139
139
|
*/
|
|
140
140
|
export declare function isMap(val: unknown): val is Map<unknown, unknown>;
|
|
141
|
+
export declare function isTypedMap<K, V>(kTest: (k: unknown) => k is K, vTest: (v: unknown) => v is V): (val: unknown) => val is Map<K, V>;
|
|
141
142
|
export type Tuple<T, N extends number> = N extends N ? (number extends N ? T[] : TupleOfHelper<T, N, []>) : never;
|
|
142
143
|
type TupleOfHelper<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : TupleOfHelper<T, N, [T, ...R]>;
|
|
143
144
|
export declare function isExactLength<T, N extends number>(arr: readonly T[], exactLength: N): arr is Tuple<T, N>;
|
package/core/checks.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.isTypedArray = isTypedArray;
|
|
|
21
21
|
exports.isDefinedArray = isDefinedArray;
|
|
22
22
|
exports.isTypedTuple = isTypedTuple;
|
|
23
23
|
exports.isMap = isMap;
|
|
24
|
+
exports.isTypedMap = isTypedMap;
|
|
24
25
|
exports.isExactLength = isExactLength;
|
|
25
26
|
exports.isAtLeastLength = isAtLeastLength;
|
|
26
27
|
exports.isPair = isPair;
|
|
@@ -215,6 +216,19 @@ function isTypedTuple(guards) {
|
|
|
215
216
|
function isMap(val) {
|
|
216
217
|
return val instanceof Map;
|
|
217
218
|
}
|
|
219
|
+
function isTypedMap(kTest, vTest) {
|
|
220
|
+
return function (val) {
|
|
221
|
+
if (!isMap(val)) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
for (const [k, v] of val) {
|
|
225
|
+
if (!kTest(k) || !vTest(v)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
218
232
|
function isExactLength(arr, exactLength) {
|
|
219
233
|
return arr.length === exactLength;
|
|
220
234
|
}
|
|
@@ -1,4 +1,50 @@
|
|
|
1
|
-
import { DependencyMappingSettings } from '../../commandtypes';
|
|
1
|
+
import { AutoSyncSettings, DependencyMappingSettings } from '../../commandtypes';
|
|
2
2
|
import { EditorClient } from '../../editorclient';
|
|
3
|
+
import { type CardIntegrationAutoSyncConfig } from '../cardintegration/cardintegrationautosyncconfig';
|
|
4
|
+
import { ImportResult, SearchResult } from './cardintegrationdefinitions';
|
|
3
5
|
import { CardIntegrationDependencyMappingConfig } from './dependencymappingconfig';
|
|
6
|
+
/**
|
|
7
|
+
* Serializes a `SearchResult` into the wire-format object the editor expects. Shared between the
|
|
8
|
+
* import-modal `search` path and the auto-sync `searchQueryString` / `searchFields` paths.
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeSearchResult(searchResult: SearchResult): {
|
|
11
|
+
srs: {
|
|
12
|
+
d: import("../../data/collectiondefinition").SerializedCollectionDefinition;
|
|
13
|
+
f: import("./cardintegrationdefinitions").SerializedExtensionCardFieldDefinition[];
|
|
14
|
+
m: {
|
|
15
|
+
cid: string;
|
|
16
|
+
sid: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
ipsr: number | undefined;
|
|
20
|
+
e: string | undefined;
|
|
21
|
+
bs: {
|
|
22
|
+
ty: "error-banner";
|
|
23
|
+
msg: string;
|
|
24
|
+
btyp: import("./cardintegrationdefinitions").BannerType | undefined;
|
|
25
|
+
actbtn: {
|
|
26
|
+
lab: string;
|
|
27
|
+
aid: string | undefined;
|
|
28
|
+
href: string | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}[] | undefined;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Serializes import results (single or array) to the wire-format the editor expects. Shared
|
|
34
|
+
* between the import-modal `import` path, the dependency-mapping path, and the auto-sync `sync*`
|
|
35
|
+
* paths.
|
|
36
|
+
*/
|
|
37
|
+
export declare function serializeImportResults(result: ImportResult | ImportResult[]): {
|
|
38
|
+
c: string;
|
|
39
|
+
pks: string[];
|
|
40
|
+
}[] | {
|
|
41
|
+
c: string;
|
|
42
|
+
pks: string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Registers the editor-side actions for a `CardIntegrationAutoSyncConfig` on the given client and
|
|
46
|
+
* returns the corresponding `AutoSyncSettings` wire-format payload. Used by both
|
|
47
|
+
* `LucidCardIntegrationRegistry` and `LucidSpreadsheetIntegrationRegistry`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function registerAutoSync(client: EditorClient, autoSync: CardIntegrationAutoSyncConfig, getNextHookName: () => string): AutoSyncSettings;
|
|
4
50
|
export declare function registerDependencyMapping(client: EditorClient, dependencyMapping: CardIntegrationDependencyMappingConfig, serialized: DependencyMappingSettings, getNextHookName: () => string): void;
|