lucid-extension-sdk 0.0.448 → 0.0.449
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 +24 -4
- package/core/cardintegration/cardintegrationautosyncconfig.d.ts +10 -0
- package/core/cardintegration/cardintegrationparams.d.ts +10 -0
- package/core/cardintegration/lucidcardintegration.d.ts +20 -1
- package/core/cardintegration/lucidcardintegrationpresetsetupmodal.d.ts +29 -0
- package/core/cardintegration/lucidcardintegrationpresetsetupmodal.js +15 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +2 -1
- package/core/cardintegration/lucidcardintegrationregistry.js +54 -0
- package/core/cardintegration/lucidcardintegrationstandardimportmodal.d.ts +1 -0
- package/core/checks.d.ts +1 -1
- package/core/data/fieldtypedefinition/collectionenumfieldtype.d.ts +2 -1
- package/core/data/fieldtypedefinition/collectionenumfieldtype.js +1 -0
- package/core/data/fieldtypedefinition/deserializedmapenumfieldtype.d.ts +8 -0
- package/core/data/fieldtypedefinition/deserializedmapenumfieldtype.js +26 -1
- package/core/defer.d.ts +1 -1
- package/core/format/enumformat.d.ts +2 -1
- package/core/format/enumformat.js +2 -3
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +57 -0
- package/core/sharedcardintegration/cardintegrationdefinitions.js +35 -3
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.d.ts +3 -1
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +16 -5
- package/core/validators/validators.d.ts +1 -1
- package/core/validators/validators.js +6 -1
- package/data/collectionproxy.js +2 -2
- package/dataconnector/actions/serializedpatchtypes.d.ts +4 -0
- package/document/blockclasses/customblockproxy.d.ts +3 -3
- package/editorclient.d.ts +1 -1
- package/editorclient.js +1 -1
- package/package.json +3 -3
package/commandtypes.d.ts
CHANGED
|
@@ -252,8 +252,8 @@ export type CommandArgs = {
|
|
|
252
252
|
result: CancelDragBlockToCanvasResult;
|
|
253
253
|
};
|
|
254
254
|
[CommandName.CheckUserFlagAssignment]: {
|
|
255
|
-
query:
|
|
256
|
-
result:
|
|
255
|
+
query: CheckUserFeatureFlagAssignmentQuery;
|
|
256
|
+
result: CheckUserFeatureFlagAssignmentResult;
|
|
257
257
|
};
|
|
258
258
|
[CommandName.Confirm]: {
|
|
259
259
|
query: ConfirmQuery;
|
|
@@ -765,6 +765,13 @@ export type AutoSyncSettings = {
|
|
|
765
765
|
'gsf': string;
|
|
766
766
|
'sqs'?: string | undefined;
|
|
767
767
|
'syqs'?: string | undefined;
|
|
768
|
+
/** If specified, setup fields that allow user to create query template that auto applies to dynamic tables when created*/
|
|
769
|
+
'dpf'?: {
|
|
770
|
+
/** Get search fields action */
|
|
771
|
+
'gsf': string;
|
|
772
|
+
/** Generate preset value action */
|
|
773
|
+
'gpv': string;
|
|
774
|
+
} | undefined;
|
|
768
775
|
};
|
|
769
776
|
export type SerializedFieldConfiguration = {
|
|
770
777
|
/** Callback to get field definitions for all fields supported by the card integration */
|
|
@@ -773,6 +780,8 @@ export type SerializedFieldConfiguration = {
|
|
|
773
780
|
'osfc'?: string | undefined;
|
|
774
781
|
/** Field name -> callback name tuples for searching for legal field values in an enum */
|
|
775
782
|
'fvsc'?: [string, string][] | undefined;
|
|
783
|
+
/** Field name -> callback name tuples for some function that should be called before the field value is updated */
|
|
784
|
+
'fttic'?: [string, string][] | undefined;
|
|
776
785
|
/** Field type -> callback name tuples for searching for legal field values in an enum */
|
|
777
786
|
'ftvsc'?: [string, string][] | undefined;
|
|
778
787
|
/** Default search callback for searching for legal field values in an enum */
|
|
@@ -823,6 +832,8 @@ export type AddCardIntegrationQuery = {
|
|
|
823
832
|
'mmw'?: number | undefined;
|
|
824
833
|
/** Use Isolated Search Bar */
|
|
825
834
|
'uisbui'?: boolean;
|
|
835
|
+
/** Use Updated Filter UI */
|
|
836
|
+
'uufui'?: boolean;
|
|
826
837
|
/** Get search fields action */
|
|
827
838
|
'gsf': string;
|
|
828
839
|
/** Search action */
|
|
@@ -942,6 +953,15 @@ export type AddCardIntegrationQuery = {
|
|
|
942
953
|
'cei'?: string | undefined;
|
|
943
954
|
/** getAdditionalPanelTabsForCard -- Cards' additional details via tabs in panel */
|
|
944
955
|
'gaptfc'?: string | undefined;
|
|
956
|
+
/** Instance switching configuration */
|
|
957
|
+
'is'?: {
|
|
958
|
+
/** Get instances action */
|
|
959
|
+
'gi': string;
|
|
960
|
+
/** On instance change action */
|
|
961
|
+
'oic': string;
|
|
962
|
+
/** Get selected instance ID action */
|
|
963
|
+
'gsii': string;
|
|
964
|
+
} | undefined;
|
|
945
965
|
};
|
|
946
966
|
export type AddCardIntegrationResult = undefined;
|
|
947
967
|
export type AddLineTextAreaQuery = {
|
|
@@ -2071,9 +2091,9 @@ export type ZOrderQuery = {
|
|
|
2071
2091
|
'o': ZOrderOperation;
|
|
2072
2092
|
};
|
|
2073
2093
|
export type ZOrderResult = undefined;
|
|
2074
|
-
export type
|
|
2094
|
+
export type CheckUserFeatureFlagAssignmentQuery = {
|
|
2075
2095
|
/** The name of the flag that will be checked */
|
|
2076
2096
|
'f': string;
|
|
2077
2097
|
};
|
|
2078
|
-
export type
|
|
2098
|
+
export type CheckUserFeatureFlagAssignmentResult = boolean;
|
|
2079
2099
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
2
|
import type { ExtensionCardFieldDefinition, ImportResult, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
3
|
+
import type { DocumentPresetSetupFields } from './lucidcardintegrationpresetsetupmodal';
|
|
3
4
|
/**
|
|
4
5
|
* The amount of results that will be displayed per page when using pagination. To enable pagination, define the
|
|
5
6
|
* {@link SearchResult.itemsPerSearchResult} field in your search results and return workitems equal to this variable's
|
|
@@ -39,6 +40,15 @@ export interface CardIntegrationAutoSyncConfig {
|
|
|
39
40
|
* @returns the ImportResult for the query string.
|
|
40
41
|
*/
|
|
41
42
|
syncQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>) => Promise<ImportResult | ImportResult[]>;
|
|
43
|
+
/**
|
|
44
|
+
* @experimental
|
|
45
|
+
* Document preset setup configuration for this card integration's auto sync.
|
|
46
|
+
*
|
|
47
|
+
* When specified, this enables your card integration to participate in Lucid's document preset
|
|
48
|
+
* system, which allows users to configure dynamic matrix templates that automatically populate new
|
|
49
|
+
* documents with cards from your integration.
|
|
50
|
+
*/
|
|
51
|
+
documentPresetSetupFields?: DocumentPresetSetupFields | undefined;
|
|
42
52
|
}
|
|
43
53
|
export interface AutoSyncConfigPhrasesType {
|
|
44
54
|
/**
|
|
@@ -110,4 +110,14 @@ export interface DataItemCallbackParam {
|
|
|
110
110
|
export interface ImportFromSerializedFieldsCallbackParam {
|
|
111
111
|
'sf': SerializedFields[];
|
|
112
112
|
}
|
|
113
|
+
/** @ignore */
|
|
114
|
+
export interface FieldTypeValueToItemsCallbackParams {
|
|
115
|
+
'd'?: string | undefined;
|
|
116
|
+
'v': SerializedFieldType;
|
|
117
|
+
'f': string;
|
|
118
|
+
}
|
|
119
|
+
/** @ignore */
|
|
120
|
+
export interface GeneratePresetValueParam {
|
|
121
|
+
'f': [string, SerializedFieldType][];
|
|
122
|
+
}
|
|
113
123
|
export {};
|
|
@@ -9,7 +9,7 @@ import { isString } from '../checks';
|
|
|
9
9
|
import type { SerializedFieldType, SerializedFields } from '../data/serializedfield/serializedfields';
|
|
10
10
|
import type { ImportCardFromDetails } from '../importcardfromdetails/importcardfromdetails';
|
|
11
11
|
import type { ImportCardFromPastedLinkCallback } from '../importcardfrompastedlink/importcardfrompastedlinkcallback';
|
|
12
|
-
import
|
|
12
|
+
import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult, Instance } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
13
13
|
import type { CardIntegrationAutoSyncConfig } from './cardintegrationautosyncconfig';
|
|
14
14
|
import type { CardIntegrationConfig } from './cardintegrationconfig';
|
|
15
15
|
import type { AdditionalPanelTabsCallback } from './cardpaneltabs/tabs';
|
|
@@ -192,4 +192,23 @@ export declare abstract class LucidCardIntegration {
|
|
|
192
192
|
* via tabs that are configured by the extension and displayed in the card details panel.
|
|
193
193
|
*/
|
|
194
194
|
getAdditionalPanelTabsForCard?: AdditionalPanelTabsCallback;
|
|
195
|
+
/**
|
|
196
|
+
* Configuration for instance switching. An instance is a singular context for which a user can perform search actions
|
|
197
|
+
* or import actions in. Switching between instances will reset the state for searching and creating.
|
|
198
|
+
*/
|
|
199
|
+
instanceSwitching?: {
|
|
200
|
+
/**
|
|
201
|
+
* Returns available instances the user can switch between.
|
|
202
|
+
*/
|
|
203
|
+
getInstances: () => Promise<Instance[]>;
|
|
204
|
+
/**
|
|
205
|
+
* Called when the user selects a different instance.
|
|
206
|
+
* The extension should update its state for subsequent operations.
|
|
207
|
+
*/
|
|
208
|
+
onInstanceChange: (instance: Instance) => Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Returns the currently selected instance ID.
|
|
211
|
+
*/
|
|
212
|
+
getSelectedInstanceId: () => string | undefined;
|
|
213
|
+
};
|
|
195
214
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
|
+
import { type FormatToSerializedType } from '../format/format';
|
|
3
|
+
import { ExtensionCardFieldDefinition } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
4
|
+
declare const ExtensionGeneratorDocumentPresetInputSourceFormatter: import("../format/format").Format<import("../format/objectformat").ObjectFormatSerializedType<{
|
|
5
|
+
readonly dataConnectorName: readonly ["dcn", import("../format/format").Format<string, string>];
|
|
6
|
+
readonly instanceId: readonly ["iid", import("../format/format").Format<string, string>];
|
|
7
|
+
readonly query: readonly ["q", import("../format/format").Format<string, string>];
|
|
8
|
+
}>, {
|
|
9
|
+
readonly dataConnectorName: string;
|
|
10
|
+
readonly instanceId: string;
|
|
11
|
+
readonly query: string;
|
|
12
|
+
}>;
|
|
13
|
+
export interface ExtensionGeneratorDocumentPresetInputSource {
|
|
14
|
+
dataConnectorName: string;
|
|
15
|
+
instanceId: string;
|
|
16
|
+
query: string;
|
|
17
|
+
}
|
|
18
|
+
/** @ignore */
|
|
19
|
+
export type SerializedExtensionGeneratorDocumentPresetInputSource = FormatToSerializedType<typeof ExtensionGeneratorDocumentPresetInputSourceFormatter>;
|
|
20
|
+
export declare const isSerializedExtensionGeneratorDocumentPresetInputSource: typeof ExtensionGeneratorDocumentPresetInputSourceFormatter.validator;
|
|
21
|
+
/** @ignore */
|
|
22
|
+
export declare const serializeExtensionGeneratorDocumentPresetInputSource: typeof ExtensionGeneratorDocumentPresetInputSourceFormatter.toJson;
|
|
23
|
+
/** @ignore */
|
|
24
|
+
export declare const deserializeExtensionGeneratorDocumentPresetInputSource: typeof ExtensionGeneratorDocumentPresetInputSourceFormatter.fromJson;
|
|
25
|
+
export interface DocumentPresetSetupFields {
|
|
26
|
+
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
27
|
+
generatePresetValue: (fields: Map<string, SerializedFieldType>) => Promise<ExtensionGeneratorDocumentPresetInputSource>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeExtensionGeneratorDocumentPresetInputSource = exports.serializeExtensionGeneratorDocumentPresetInputSource = exports.isSerializedExtensionGeneratorDocumentPresetInputSource = void 0;
|
|
4
|
+
const objectformat_1 = require("../format/objectformat");
|
|
5
|
+
const primitiveformat_1 = require("../format/primitiveformat");
|
|
6
|
+
const ExtensionGeneratorDocumentPresetInputSourceFormatter = (0, objectformat_1.ObjectFormat)({
|
|
7
|
+
dataConnectorName: ['dcn', primitiveformat_1.StringFormat],
|
|
8
|
+
instanceId: ['iid', primitiveformat_1.StringFormat],
|
|
9
|
+
query: ['q', primitiveformat_1.StringFormat],
|
|
10
|
+
});
|
|
11
|
+
exports.isSerializedExtensionGeneratorDocumentPresetInputSource = ExtensionGeneratorDocumentPresetInputSourceFormatter.validator;
|
|
12
|
+
/** @ignore */
|
|
13
|
+
exports.serializeExtensionGeneratorDocumentPresetInputSource = ExtensionGeneratorDocumentPresetInputSourceFormatter.toJson;
|
|
14
|
+
/** @ignore */
|
|
15
|
+
exports.deserializeExtensionGeneratorDocumentPresetInputSource = ExtensionGeneratorDocumentPresetInputSourceFormatter.fromJson;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataItemProxy } from '../../data/dataitemproxy';
|
|
2
2
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
3
3
|
import { EditorClient } from '../../editorclient';
|
|
4
|
-
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
4
|
+
import { SerializedFieldType, SerializedFields } from '../data/serializedfield/serializedfields';
|
|
5
5
|
import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData, TagCallback } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
6
6
|
import { LucidCardIntegration } from './lucidcardintegration';
|
|
7
7
|
export declare class LucidCardIntegrationRegistry {
|
|
@@ -13,6 +13,7 @@ export declare class LucidCardIntegrationRegistry {
|
|
|
13
13
|
dataSourceId?: string | undefined;
|
|
14
14
|
}) => Promise<ExtensionCardFieldOption[]>): string;
|
|
15
15
|
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
|
|
16
|
+
static registerFieldTypeToCollectionItemsCallback(client: EditorClient, callback: (fieldName: string, value: SerializedFieldType, dataSourceProxy?: DataSourceProxy | undefined) => Promise<[string, SerializedFields][]>): string;
|
|
16
17
|
static registerFieldLabelIconsCallback(client: EditorClient, callback: (dataSourceProxy: DataSourceProxy, dataItemProxy: DataItemProxy) => Promise<ExtensionCardFieldLabelIcons>): string;
|
|
17
18
|
static registerTagCallback(client: EditorClient, callback: TagCallback): string;
|
|
18
19
|
static registerBannerActionCallback(client: EditorClient, callback: (actionId: string) => void): string;
|
|
@@ -46,6 +46,14 @@ class LucidCardIntegrationRegistry {
|
|
|
46
46
|
});
|
|
47
47
|
return name;
|
|
48
48
|
}
|
|
49
|
+
static registerFieldTypeToCollectionItemsCallback(client, callback) {
|
|
50
|
+
const name = LucidCardIntegrationRegistry.nextHookName();
|
|
51
|
+
client.registerAction(name, async ({ 'd': dataSourceId, 'v': value, 'f': fieldName }) => {
|
|
52
|
+
const dataSourceProxy = dataSourceId ? new datasourceproxy_1.DataSourceProxy(dataSourceId, client) : undefined;
|
|
53
|
+
return await callback(fieldName, value, dataSourceProxy);
|
|
54
|
+
});
|
|
55
|
+
return name;
|
|
56
|
+
}
|
|
49
57
|
static registerFieldLabelIconsCallback(client, callback) {
|
|
50
58
|
const name = LucidCardIntegrationRegistry.nextHookName();
|
|
51
59
|
client.registerAction(name, async ({ 'd': dataSourceId, 'c': collectionId, 'p': primaryKey }) => {
|
|
@@ -312,6 +320,9 @@ class LucidCardIntegrationRegistry {
|
|
|
312
320
|
'fvsc': cardIntegration.fieldConfiguration.fieldValueSearchCallbacks
|
|
313
321
|
? [...cardIntegration.fieldConfiguration.fieldValueSearchCallbacks.entries()]
|
|
314
322
|
: undefined,
|
|
323
|
+
'fttic': cardIntegration.fieldConfiguration.fieldTypeToItemsCallback
|
|
324
|
+
? [...cardIntegration.fieldConfiguration.fieldTypeToItemsCallback.entries()]
|
|
325
|
+
: undefined,
|
|
315
326
|
'dsc': cardIntegration.fieldConfiguration.defaultSearchCallback,
|
|
316
327
|
'gfte': getFieldsToEditActionName,
|
|
317
328
|
},
|
|
@@ -354,6 +365,9 @@ class LucidCardIntegrationRegistry {
|
|
|
354
365
|
if (importModal.useIsolatedSearchBarUI) {
|
|
355
366
|
serialized['im']['uisbui'] = importModal.useIsolatedSearchBarUI;
|
|
356
367
|
}
|
|
368
|
+
if (importModal.useUpdatedFilterUI) {
|
|
369
|
+
serialized['im']['uufui'] = importModal.useUpdatedFilterUI;
|
|
370
|
+
}
|
|
357
371
|
if (importModal.maxModalWidth !== undefined) {
|
|
358
372
|
serialized['im']['mmw'] = importModal.maxModalWidth;
|
|
359
373
|
}
|
|
@@ -480,6 +494,25 @@ class LucidCardIntegrationRegistry {
|
|
|
480
494
|
return LucidCardIntegrationRegistry.serializeImportResults(result);
|
|
481
495
|
});
|
|
482
496
|
}
|
|
497
|
+
if (autoSync.documentPresetSetupFields) {
|
|
498
|
+
const documentPresetSetupFields = autoSync.documentPresetSetupFields;
|
|
499
|
+
serialized['as']['dpf'] = {
|
|
500
|
+
'gsf': LucidCardIntegrationRegistry.nextHookName(),
|
|
501
|
+
'gpv': LucidCardIntegrationRegistry.nextHookName(),
|
|
502
|
+
};
|
|
503
|
+
client.registerAction(serialized['as']['dpf']['gsf'], async ({ 's': searchSoFar }) => {
|
|
504
|
+
const result = await documentPresetSetupFields.getSearchFields(new Map(searchSoFar));
|
|
505
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
506
|
+
});
|
|
507
|
+
client.registerAction(serialized['as']['dpf']['gpv'], async ({ 'f': fields }) => {
|
|
508
|
+
const result = await documentPresetSetupFields.generatePresetValue(new Map(fields));
|
|
509
|
+
return {
|
|
510
|
+
'dcn': result.dataConnectorName,
|
|
511
|
+
'iid': result.instanceId,
|
|
512
|
+
'q': result.query,
|
|
513
|
+
};
|
|
514
|
+
});
|
|
515
|
+
}
|
|
483
516
|
}
|
|
484
517
|
if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
|
|
485
518
|
serialized['fc']['cfds'] = {
|
|
@@ -527,6 +560,27 @@ class LucidCardIntegrationRegistry {
|
|
|
527
560
|
return (0, useritemeditpermissions_1.serializeUserItemEditPermissionsMap)(result);
|
|
528
561
|
});
|
|
529
562
|
}
|
|
563
|
+
if (cardIntegration.instanceSwitching) {
|
|
564
|
+
const instanceSwitching = cardIntegration.instanceSwitching;
|
|
565
|
+
const getInstancesActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
566
|
+
const onInstanceChangeActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
567
|
+
const getSelectedInstanceIdActionName = LucidCardIntegrationRegistry.nextHookName();
|
|
568
|
+
serialized['is'] = {
|
|
569
|
+
'gi': getInstancesActionName,
|
|
570
|
+
'oic': onInstanceChangeActionName,
|
|
571
|
+
'gsii': getSelectedInstanceIdActionName,
|
|
572
|
+
};
|
|
573
|
+
client.registerAction(getInstancesActionName, async () => {
|
|
574
|
+
return (await instanceSwitching.getInstances()).map((instance) => (0, cardintegrationdefinitions_1.serializeInstance)(instance));
|
|
575
|
+
});
|
|
576
|
+
client.registerAction(onInstanceChangeActionName, async (params) => {
|
|
577
|
+
const instance = (0, cardintegrationdefinitions_1.deserializeInstance)(params);
|
|
578
|
+
await instanceSwitching.onInstanceChange(instance);
|
|
579
|
+
});
|
|
580
|
+
client.registerAction(getSelectedInstanceIdActionName, () => {
|
|
581
|
+
return instanceSwitching.getSelectedInstanceId();
|
|
582
|
+
});
|
|
583
|
+
}
|
|
530
584
|
client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
|
|
531
585
|
}
|
|
532
586
|
}
|
|
@@ -45,6 +45,7 @@ export interface LucidCardIntegrationStandardImportModal {
|
|
|
45
45
|
*/
|
|
46
46
|
importModalHeading?: string;
|
|
47
47
|
useIsolatedSearchBarUI?: boolean;
|
|
48
|
+
useUpdatedFilterUI?: boolean;
|
|
48
49
|
maxModalWidth?: ExtensionImportModalWidthBreakpoint;
|
|
49
50
|
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
50
51
|
search: (fields: Map<string, SerializedFieldType>, offset?: number, limit?: number) => Promise<SearchResult | DeprecatedSearchResult | DeprecatedSearchResult[]>;
|
package/core/checks.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare function isObject(val: unknown): val is object;
|
|
|
81
81
|
* @return Whether variable is an object.
|
|
82
82
|
*/
|
|
83
83
|
export declare function isObjectUnsafe(val: any): val is {
|
|
84
|
-
[key: string]: unknown;
|
|
84
|
+
[key: string | symbol]: unknown;
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
87
87
|
* Returns true for objects, includings arrays and functions.
|
|
@@ -10,7 +10,8 @@ export declare enum CollectionEnumFieldNames {
|
|
|
10
10
|
Id = "id",
|
|
11
11
|
Description = "description",
|
|
12
12
|
Color = "color",
|
|
13
|
-
IconUrl = "iconUrl"
|
|
13
|
+
IconUrl = "iconUrl",
|
|
14
|
+
Category = "category"
|
|
14
15
|
}
|
|
15
16
|
export declare const isCollectionEnumFieldNames: (x: unknown) => x is {} extends typeof CollectionEnumFieldNames ? never : CollectionEnumFieldNames;
|
|
16
17
|
export declare class CollectionEnumFieldType {
|
|
@@ -18,6 +18,7 @@ var CollectionEnumFieldNames;
|
|
|
18
18
|
CollectionEnumFieldNames["Description"] = "description";
|
|
19
19
|
CollectionEnumFieldNames["Color"] = "color";
|
|
20
20
|
CollectionEnumFieldNames["IconUrl"] = "iconUrl";
|
|
21
|
+
CollectionEnumFieldNames["Category"] = "category";
|
|
21
22
|
})(CollectionEnumFieldNames || (exports.CollectionEnumFieldNames = CollectionEnumFieldNames = {}));
|
|
22
23
|
exports.isCollectionEnumFieldNames = (0, validators_1.enumValidator)(CollectionEnumFieldNames);
|
|
23
24
|
class CollectionEnumFieldType {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export declare class DeserializedMapEnumFieldType {
|
|
2
2
|
readonly validEntries: ReadonlyMap<EnumKeyType, DeserializedMapEnumFieldTypeEntry>;
|
|
3
3
|
constructor(validEntries: ReadonlyMap<EnumKeyType, DeserializedMapEnumFieldTypeEntry>);
|
|
4
|
+
hasId(id: EnumKeyType): boolean;
|
|
5
|
+
ids(): IterableIterator<EnumKeyType>;
|
|
6
|
+
getName(id: EnumKeyType): string | undefined;
|
|
7
|
+
getDescription(id: EnumKeyType): string | undefined;
|
|
8
|
+
getColor(id: EnumKeyType): string | undefined;
|
|
9
|
+
getIconUrl(id: EnumKeyType): string | undefined;
|
|
4
10
|
toJSON(): SerializedMapEnumFieldType;
|
|
5
11
|
static fromJSON(val: SerializedMapEnumFieldType): DeserializedMapEnumFieldType;
|
|
6
12
|
}
|
|
@@ -14,6 +20,7 @@ export interface DeserializedMapEnumFieldTypeEntry {
|
|
|
14
20
|
description?: string | null;
|
|
15
21
|
color?: string | null;
|
|
16
22
|
iconUrl?: string | null;
|
|
23
|
+
category?: string | null;
|
|
17
24
|
}
|
|
18
25
|
export interface SerializedEnumEntry {
|
|
19
26
|
'Id': EnumKeyType;
|
|
@@ -21,6 +28,7 @@ export interface SerializedEnumEntry {
|
|
|
21
28
|
'Description'?: string | undefined | null;
|
|
22
29
|
'Color'?: string | undefined | null;
|
|
23
30
|
'IconUrl'?: string | undefined | null;
|
|
31
|
+
'Category'?: string | undefined | null;
|
|
24
32
|
}
|
|
25
33
|
export declare function isSerializedEnumEntry(entry: any): entry is SerializedEnumEntry;
|
|
26
34
|
export declare function serializeEnumEntry(id: EnumKeyType, entry: DeserializedMapEnumFieldTypeEntry): SerializedEnumEntry;
|
|
@@ -12,6 +12,28 @@ class DeserializedMapEnumFieldType {
|
|
|
12
12
|
constructor(validEntries) {
|
|
13
13
|
this.validEntries = validEntries;
|
|
14
14
|
}
|
|
15
|
+
hasId(id) {
|
|
16
|
+
return this.validEntries.has(id);
|
|
17
|
+
}
|
|
18
|
+
ids() {
|
|
19
|
+
return this.validEntries.keys();
|
|
20
|
+
}
|
|
21
|
+
getName(id) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
return (_b = (_a = this.validEntries.get(id)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : undefined;
|
|
24
|
+
}
|
|
25
|
+
getDescription(id) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (_b = (_a = this.validEntries.get(id)) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : undefined;
|
|
28
|
+
}
|
|
29
|
+
getColor(id) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return (_b = (_a = this.validEntries.get(id)) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : undefined;
|
|
32
|
+
}
|
|
33
|
+
getIconUrl(id) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return (_b = (_a = this.validEntries.get(id)) === null || _a === void 0 ? void 0 : _a.iconUrl) !== null && _b !== void 0 ? _b : undefined;
|
|
36
|
+
}
|
|
15
37
|
toJSON() {
|
|
16
38
|
return {
|
|
17
39
|
'ValidItems': [...this.validEntries.entries()].map(([key, value]) => serializeEnumEntry(key, value)),
|
|
@@ -36,7 +58,8 @@ function isSerializedEnumEntry(entry) {
|
|
|
36
58
|
(0, validators_1.nullableOption)(checks_1.isString)(entry['Name']) &&
|
|
37
59
|
(0, validators_1.nullableOption)(checks_1.isString)(entry['Description']) &&
|
|
38
60
|
(0, validators_1.nullableOption)(checks_1.isString)(entry['Color']) &&
|
|
39
|
-
(0, validators_1.nullableOption)(checks_1.isString)(entry['IconUrl'])
|
|
61
|
+
(0, validators_1.nullableOption)(checks_1.isString)(entry['IconUrl']) &&
|
|
62
|
+
(0, validators_1.nullableOption)(checks_1.isString)(entry['Category']));
|
|
40
63
|
}
|
|
41
64
|
function serializeEnumEntry(id, entry) {
|
|
42
65
|
return {
|
|
@@ -45,6 +68,7 @@ function serializeEnumEntry(id, entry) {
|
|
|
45
68
|
'Description': entry.description,
|
|
46
69
|
'Color': entry.color,
|
|
47
70
|
'IconUrl': entry.iconUrl,
|
|
71
|
+
'Category': entry.category,
|
|
48
72
|
};
|
|
49
73
|
}
|
|
50
74
|
function deserializeEnumEntry(entry) {
|
|
@@ -55,6 +79,7 @@ function deserializeEnumEntry(entry) {
|
|
|
55
79
|
description: entry['Description'],
|
|
56
80
|
color: entry['Color'],
|
|
57
81
|
iconUrl: entry['IconUrl'],
|
|
82
|
+
category: entry['Category'],
|
|
58
83
|
},
|
|
59
84
|
];
|
|
60
85
|
}
|
package/core/defer.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Validator } from '../guards';
|
|
1
2
|
import { Format } from './format';
|
|
2
3
|
/**
|
|
3
4
|
* Generates a Formatter for your enum. Underneath the hood it is just an IdentityFormat.
|
|
@@ -13,4 +14,4 @@ export { EnumFormat as enumFormatter };
|
|
|
13
14
|
* Enum formatter that will map any unknown values to the enum's fallback value.
|
|
14
15
|
* Allows new enum entries to be safely written (but not consumed) to the frontend in one release
|
|
15
16
|
*/
|
|
16
|
-
export declare function EnumFormatWithFallback<T extends
|
|
17
|
+
export declare function EnumFormatWithFallback<Primitive extends string | number, T extends Record<string, Primitive>>(enumMap: T, fallbackValue: T[keyof T], primitiveValidator: Validator<Primitive>): Format<Primitive, T[keyof T]>;
|
|
@@ -33,8 +33,7 @@ function EnumFormat(enumMap) {
|
|
|
33
33
|
* Enum formatter that will map any unknown values to the enum's fallback value.
|
|
34
34
|
* Allows new enum entries to be safely written (but not consumed) to the frontend in one release
|
|
35
35
|
*/
|
|
36
|
-
function EnumFormatWithFallback(enumMap, fallbackValue) {
|
|
37
|
-
const validator = ((x) => true);
|
|
36
|
+
function EnumFormatWithFallback(enumMap, fallbackValue, primitiveValidator) {
|
|
38
37
|
const trueValidator = (0, validators_1.enumValidator)(enumMap);
|
|
39
|
-
return new format_1.Format((x) => (trueValidator(x) ? x : fallbackValue), identity_1.identity,
|
|
38
|
+
return new format_1.Format((x) => (trueValidator(x) ? x : fallbackValue), identity_1.identity, primitiveValidator, getEnumGenerator(enumMap));
|
|
40
39
|
}
|
|
@@ -11,6 +11,15 @@ import { isArray, isString } from '../checks';
|
|
|
11
11
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
12
12
|
import { type SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
13
13
|
import { isSerializedFieldType, type SerializedFieldType, type SerializedLucidIconData } from '../data/serializedfield/serializedfields';
|
|
14
|
+
/**
|
|
15
|
+
* The type of a field option, used to create non-selectable items like section headers or dividers.
|
|
16
|
+
*/
|
|
17
|
+
export declare enum FieldOptionType {
|
|
18
|
+
/** A section header that groups related options */
|
|
19
|
+
SectionHeader = "section-header",
|
|
20
|
+
/** A horizontal rule divider between sections */
|
|
21
|
+
HorizontalRule = "hr"
|
|
22
|
+
}
|
|
14
23
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
15
24
|
export interface ExtensionCardFieldOption {
|
|
16
25
|
label: string;
|
|
@@ -25,6 +34,12 @@ export interface ExtensionCardFieldOption {
|
|
|
25
34
|
* decoding).
|
|
26
35
|
*/
|
|
27
36
|
iconUrlForCollection?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The type of this option. If not specified, the option is a normal selectable item.
|
|
39
|
+
* Use FieldOptionType.SectionHeader to create a non-selectable section header.
|
|
40
|
+
* Use FieldOptionType.HorizontalRule to create a divider between sections.
|
|
41
|
+
*/
|
|
42
|
+
type?: FieldOptionType | undefined;
|
|
28
43
|
}
|
|
29
44
|
export interface ExtensionCardFieldDefinition extends FieldDefinition {
|
|
30
45
|
/** The label to display in the UI */
|
|
@@ -115,6 +130,7 @@ export type SerializedCardFieldOption = {
|
|
|
115
130
|
'v'?: SerializedFieldType;
|
|
116
131
|
'i'?: string | undefined;
|
|
117
132
|
'ic'?: string | undefined;
|
|
133
|
+
'ty'?: FieldOptionType | undefined;
|
|
118
134
|
};
|
|
119
135
|
/** @ignore */
|
|
120
136
|
export declare function serializeCardFieldOption(option: ExtensionCardFieldOption): SerializedCardFieldOption;
|
|
@@ -138,11 +154,13 @@ export declare const isSerializedFieldOption: (subject: unknown) => subject is i
|
|
|
138
154
|
l: typeof isString;
|
|
139
155
|
v: typeof isSerializedFieldType;
|
|
140
156
|
i: (x: unknown) => x is string | undefined;
|
|
157
|
+
ty: (x: unknown) => x is FieldOptionType | undefined;
|
|
141
158
|
}>;
|
|
142
159
|
export declare const isSerializedFieldOptions: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{
|
|
143
160
|
l: typeof isString;
|
|
144
161
|
v: typeof isSerializedFieldType;
|
|
145
162
|
i: (x: unknown) => x is string | undefined;
|
|
163
|
+
ty: (x: unknown) => x is FieldOptionType | undefined;
|
|
146
164
|
}>[];
|
|
147
165
|
/** @ignore */
|
|
148
166
|
export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
@@ -160,6 +178,7 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
160
178
|
l: typeof isString;
|
|
161
179
|
v: typeof isSerializedFieldType;
|
|
162
180
|
i: (x: unknown) => x is string | undefined;
|
|
181
|
+
ty: (x: unknown) => x is FieldOptionType | undefined;
|
|
163
182
|
}>[]) | undefined;
|
|
164
183
|
s: (x: unknown) => x is string | undefined;
|
|
165
184
|
u: (x: unknown) => x is string[] | undefined;
|
|
@@ -196,6 +215,7 @@ export declare const isSerializedExtensionCardFieldsGroup: (subject: unknown) =>
|
|
|
196
215
|
l: typeof isString;
|
|
197
216
|
v: typeof isSerializedFieldType;
|
|
198
217
|
i: (x: unknown) => x is string | undefined;
|
|
218
|
+
ty: (x: unknown) => x is FieldOptionType | undefined;
|
|
199
219
|
}>[]) | undefined;
|
|
200
220
|
s: (x: unknown) => x is string | undefined;
|
|
201
221
|
u: (x: unknown) => x is string[] | undefined;
|
|
@@ -220,6 +240,7 @@ export declare const isSerializedExtensionCardFieldsGroupArray: (val: unknown) =
|
|
|
220
240
|
l: typeof isString;
|
|
221
241
|
v: typeof isSerializedFieldType;
|
|
222
242
|
i: (x: unknown) => x is string | undefined;
|
|
243
|
+
ty: (x: unknown) => x is FieldOptionType | undefined;
|
|
223
244
|
}>[]) | undefined;
|
|
224
245
|
s: (x: unknown) => x is string | undefined;
|
|
225
246
|
u: (x: unknown) => x is string[] | undefined;
|
|
@@ -412,6 +433,16 @@ export type ExtensionFieldConfiguration = {
|
|
|
412
433
|
* be all the current field values on the item being edited.
|
|
413
434
|
*/
|
|
414
435
|
fieldValueSearchCallbacks?: Map<string, string>;
|
|
436
|
+
/**
|
|
437
|
+
* Specify callbacks that should be called before a field type has a new value set by the user.
|
|
438
|
+
*
|
|
439
|
+
* For example, some fields do not contain all of their possible options stored in the collection on the document
|
|
440
|
+
* (i.e, you have a fieldValueSearchCallback or fieldTypeValueSearchCallback defined for a field). When a user edits
|
|
441
|
+
* those fields, you might want to add that item to the collection before it actually gets set on the field. If so,
|
|
442
|
+
* specifiy a callback for that field type here and have it return the items that should be added to the field's
|
|
443
|
+
* collection
|
|
444
|
+
*/
|
|
445
|
+
fieldTypeToItemsCallback?: Map<string, string>;
|
|
415
446
|
/**
|
|
416
447
|
* Specify callbacks for searching for legal values for the given field type. It is similar to fieldValueSearchCallbacks.
|
|
417
448
|
*
|
|
@@ -493,3 +524,29 @@ export declare function serializeTagCallbackResult(tag: TagCallbackResult): Seri
|
|
|
493
524
|
* @returns A promise that maps items' primary key to their edit permissions.
|
|
494
525
|
*/
|
|
495
526
|
export type AsyncCanEditItemCallback = (items: DataItemCallbackParam[]) => Promise<Map<string, UserItemEditPermissions>>;
|
|
527
|
+
export interface Instance {
|
|
528
|
+
id: string;
|
|
529
|
+
name: string;
|
|
530
|
+
}
|
|
531
|
+
export declare const isInstance: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
532
|
+
id: typeof isString;
|
|
533
|
+
name: typeof isString;
|
|
534
|
+
}>;
|
|
535
|
+
export declare const isInstances: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{
|
|
536
|
+
id: typeof isString;
|
|
537
|
+
name: typeof isString;
|
|
538
|
+
}>[];
|
|
539
|
+
export interface SerializedInstance {
|
|
540
|
+
'insid': string;
|
|
541
|
+
'n': string;
|
|
542
|
+
}
|
|
543
|
+
export declare const isSerializedInstance: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
544
|
+
insid: typeof isString;
|
|
545
|
+
n: typeof isString;
|
|
546
|
+
}>;
|
|
547
|
+
export declare const isSerializedInstances: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{
|
|
548
|
+
insid: typeof isString;
|
|
549
|
+
n: typeof isString;
|
|
550
|
+
}>[];
|
|
551
|
+
export declare function serializeInstance(instance: Instance): SerializedInstance;
|
|
552
|
+
export declare function deserializeInstance(ins: SerializedInstance): Instance;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedTagCallbackResult = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = exports.isImportErrorBanner = exports.isActionButton = exports.ErrorBannerType = exports.BannerType = exports.isSerializedExtensionCardFieldsGroupArray = exports.isSerializedExtensionCardFieldsGroup = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.isExtensionCardUserData = void 0;
|
|
3
|
+
exports.isSerializedInstances = exports.isSerializedInstance = exports.isInstances = exports.isInstance = exports.isSerializedTagCallbackResult = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = exports.isImportErrorBanner = exports.isActionButton = exports.ErrorBannerType = exports.BannerType = exports.isSerializedExtensionCardFieldsGroupArray = exports.isSerializedExtensionCardFieldsGroup = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.isExtensionCardUserData = exports.FieldOptionType = void 0;
|
|
4
4
|
exports.serializeCardUserData = serializeCardUserData;
|
|
5
5
|
exports.deserializeCardUserData = deserializeCardUserData;
|
|
6
6
|
exports.serializeCardFieldOption = serializeCardFieldOption;
|
|
@@ -15,6 +15,8 @@ exports.deserializeExtensionCardFieldsGroupArray = deserializeExtensionCardField
|
|
|
15
15
|
exports.serializePlaceholderImportMetadata = serializePlaceholderImportMetadata;
|
|
16
16
|
exports.deserializePlaceholderImportMetadata = deserializePlaceholderImportMetadata;
|
|
17
17
|
exports.serializeTagCallbackResult = serializeTagCallbackResult;
|
|
18
|
+
exports.serializeInstance = serializeInstance;
|
|
19
|
+
exports.deserializeInstance = deserializeInstance;
|
|
18
20
|
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
19
21
|
const schemadefinition_1 = require("../../data/schemadefinition");
|
|
20
22
|
const checks_1 = require("../checks");
|
|
@@ -22,6 +24,16 @@ const fieldtypedefinition_1 = require("../data/fieldtypedefinition/fieldtypedefi
|
|
|
22
24
|
const serializedfielddefinition_1 = require("../data/serializedfield/serializedfielddefinition");
|
|
23
25
|
const serializedfields_1 = require("../data/serializedfield/serializedfields");
|
|
24
26
|
const validators_1 = require("../validators/validators");
|
|
27
|
+
/**
|
|
28
|
+
* The type of a field option, used to create non-selectable items like section headers or dividers.
|
|
29
|
+
*/
|
|
30
|
+
var FieldOptionType;
|
|
31
|
+
(function (FieldOptionType) {
|
|
32
|
+
/** A section header that groups related options */
|
|
33
|
+
FieldOptionType["SectionHeader"] = "section-header";
|
|
34
|
+
/** A horizontal rule divider between sections */
|
|
35
|
+
FieldOptionType["HorizontalRule"] = "hr";
|
|
36
|
+
})(FieldOptionType || (exports.FieldOptionType = FieldOptionType = {}));
|
|
25
37
|
exports.isExtensionCardUserData = (0, validators_1.objectValidator)({
|
|
26
38
|
label: checks_1.isString,
|
|
27
39
|
value: serializedfields_1.isSerializedFieldType,
|
|
@@ -46,7 +58,7 @@ exports.isSerializedCardUserData = (0, validators_1.objectValidator)({
|
|
|
46
58
|
exports.isSerializedCardUserDataArray = (0, validators_1.arrayValidator)(exports.isSerializedCardUserData);
|
|
47
59
|
/** @ignore */
|
|
48
60
|
function serializeCardFieldOption(option) {
|
|
49
|
-
return Object.assign({ 'l': option.label, 'v': option.value, 'i': option.iconUrl }, ((0, checks_1.isDefAndNotNull)(option.iconUrlForCollection) && { 'ic': option.iconUrlForCollection }));
|
|
61
|
+
return Object.assign(Object.assign({ 'l': option.label, 'v': option.value, 'i': option.iconUrl }, ((0, checks_1.isDefAndNotNull)(option.iconUrlForCollection) && { 'ic': option.iconUrlForCollection })), ((0, checks_1.isDefAndNotNull)(option.type) && { 'ty': option.type }));
|
|
50
62
|
}
|
|
51
63
|
/** @ignore */
|
|
52
64
|
function serializeCardFieldDefinition(field) {
|
|
@@ -59,12 +71,13 @@ function serializeCardFieldArrayDefinition(fields) {
|
|
|
59
71
|
}
|
|
60
72
|
/** @ignore */
|
|
61
73
|
function deserializeFieldOption(option) {
|
|
62
|
-
return Object.assign({ label: option['l'], value: option['v'], iconUrl: option['i'] }, ((0, checks_1.isDefAndNotNull)(option['ic']) && { iconUrlForCollection: option['ic'] }));
|
|
74
|
+
return Object.assign(Object.assign({ label: option['l'], value: option['v'], iconUrl: option['i'] }, ((0, checks_1.isDefAndNotNull)(option['ic']) && { iconUrlForCollection: option['ic'] })), ((0, checks_1.isDefAndNotNull)(option['ty']) && { type: option['ty'] }));
|
|
63
75
|
}
|
|
64
76
|
exports.isSerializedFieldOption = (0, validators_1.objectValidator)({
|
|
65
77
|
'l': checks_1.isString,
|
|
66
78
|
'v': serializedfields_1.isSerializedFieldType,
|
|
67
79
|
'i': (0, validators_1.option)(checks_1.isString),
|
|
80
|
+
'ty': (0, validators_1.option)((0, validators_1.someValue)(FieldOptionType.SectionHeader, FieldOptionType.HorizontalRule)),
|
|
68
81
|
});
|
|
69
82
|
exports.isSerializedFieldOptions = (0, validators_1.arrayValidator)(exports.isSerializedFieldOption);
|
|
70
83
|
/** @ignore */
|
|
@@ -181,3 +194,22 @@ function serializeTagCallbackResult(tag) {
|
|
|
181
194
|
'i': tag === null || tag === void 0 ? void 0 : tag.icon,
|
|
182
195
|
};
|
|
183
196
|
}
|
|
197
|
+
exports.isInstance = (0, validators_1.objectValidator)({
|
|
198
|
+
id: checks_1.isString,
|
|
199
|
+
name: checks_1.isString,
|
|
200
|
+
});
|
|
201
|
+
exports.isInstances = (0, validators_1.arrayValidator)(exports.isInstance);
|
|
202
|
+
exports.isSerializedInstance = (0, validators_1.objectValidator)({
|
|
203
|
+
'insid': checks_1.isString,
|
|
204
|
+
'n': checks_1.isString,
|
|
205
|
+
});
|
|
206
|
+
exports.isSerializedInstances = (0, validators_1.arrayValidator)(exports.isSerializedInstance);
|
|
207
|
+
function serializeInstance(instance) {
|
|
208
|
+
return { 'insid': instance.id, 'n': instance.name };
|
|
209
|
+
}
|
|
210
|
+
function deserializeInstance(ins) {
|
|
211
|
+
return {
|
|
212
|
+
id: ins['insid'],
|
|
213
|
+
name: ins['n'],
|
|
214
|
+
};
|
|
215
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
1
2
|
import { EditorClient } from '../../editorclient';
|
|
2
|
-
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
3
|
+
import { SerializedFieldType, SerializedFields } from '../data/serializedfield/serializedfields';
|
|
3
4
|
import { ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
4
5
|
import { LucidSpreadsheetIntegration } from './lucidspreadsheetintegration';
|
|
5
6
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
@@ -10,6 +11,7 @@ export declare class LucidSpreadsheetIntegrationRegistry {
|
|
|
10
11
|
name?: string | undefined;
|
|
11
12
|
dataSourceId?: string | undefined;
|
|
12
13
|
}) => Promise<ExtensionCardUserData[]>): string;
|
|
14
|
+
static registerFieldTypeToCollectionItemsCallback(client: EditorClient, callback: (fieldName: string, value: SerializedFieldType, dataSourceProxy?: DataSourceProxy | undefined) => Promise<[string, SerializedFields][]>): string;
|
|
13
15
|
/**
|
|
14
16
|
* Register a spreadsheet integration.
|
|
15
17
|
*/
|
|
@@ -21,11 +21,19 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
21
21
|
});
|
|
22
22
|
return name;
|
|
23
23
|
}
|
|
24
|
+
static registerFieldTypeToCollectionItemsCallback(client, callback) {
|
|
25
|
+
const name = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
26
|
+
client.registerAction(name, async ({ 'd': dataSourceId, 'v': value, 'f': fieldName }) => {
|
|
27
|
+
const dataSourceProxy = dataSourceId ? new datasourceproxy_1.DataSourceProxy(dataSourceId, client) : undefined;
|
|
28
|
+
return await callback(fieldName, value, dataSourceProxy);
|
|
29
|
+
});
|
|
30
|
+
return name;
|
|
31
|
+
}
|
|
24
32
|
/**
|
|
25
33
|
* Register a spreadsheet integration.
|
|
26
34
|
*/
|
|
27
35
|
static addSpreadsheetIntegration(client, spreadsheetIntegration) {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
29
37
|
let configChooserActions;
|
|
30
38
|
const configChooser = spreadsheetIntegration.configChooser;
|
|
31
39
|
if (configChooser instanceof lucidspreadsheetintegration_1.CustomDetailsChooser) {
|
|
@@ -93,13 +101,16 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
93
101
|
'gm': getMultipleSheetsForSpreadsheetDetailsActionName,
|
|
94
102
|
'fc': {
|
|
95
103
|
'gf': getFieldsActionName,
|
|
96
|
-
'
|
|
104
|
+
'fttic': ((_b = spreadsheetIntegration.fieldConfiguration) === null || _b === void 0 ? void 0 : _b.fieldTypeToItemsCallback)
|
|
105
|
+
? [...spreadsheetIntegration.fieldConfiguration.fieldTypeToItemsCallback.entries()]
|
|
106
|
+
: undefined,
|
|
107
|
+
'ftvsc': ((_c = spreadsheetIntegration.fieldConfiguration) === null || _c === void 0 ? void 0 : _c.fieldTypeValueSearchCallbacks)
|
|
97
108
|
? [...spreadsheetIntegration.fieldConfiguration.fieldTypeValueSearchCallbacks.entries()]
|
|
98
109
|
: undefined,
|
|
99
110
|
'cfds': {
|
|
100
|
-
'd': (
|
|
101
|
-
'uri': (
|
|
102
|
-
'dadr': (
|
|
111
|
+
'd': (_e = (_d = spreadsheetIntegration.fieldConfiguration) === null || _d === void 0 ? void 0 : _d.customFieldDisplaySettings) === null || _e === void 0 ? void 0 : _e.defaultToMultilineText,
|
|
112
|
+
'uri': (_g = (_f = spreadsheetIntegration.fieldConfiguration) === null || _f === void 0 ? void 0 : _f.customFieldDisplaySettings) === null || _g === void 0 ? void 0 : _g.useRoundIcons,
|
|
113
|
+
'dadr': (_j = (_h = spreadsheetIntegration.fieldConfiguration) === null || _h === void 0 ? void 0 : _h.customFieldDisplaySettings) === null || _j === void 0 ? void 0 : _j.displayMappedDatesAsDateRange,
|
|
103
114
|
},
|
|
104
115
|
},
|
|
105
116
|
};
|
|
@@ -72,7 +72,7 @@ export declare function mapValidator<T>(subValidator: (p1: unknown) => p1 is T):
|
|
|
72
72
|
* in validation structure.
|
|
73
73
|
*/
|
|
74
74
|
export declare function objectValidator<T extends {
|
|
75
|
-
[key: string]: (p1: unknown) => p1 is unknown;
|
|
75
|
+
[key: string | symbol]: (p1: unknown) => p1 is unknown;
|
|
76
76
|
}>(validatorStructure: T): (subject: unknown) => subject is DestructureGuardedTypeObj<T>;
|
|
77
77
|
/**
|
|
78
78
|
* This validator functions the same as {@link objectValidator}, with the option of passing in a map
|
|
@@ -192,7 +192,12 @@ function objectValidator(validatorStructure) {
|
|
|
192
192
|
return false;
|
|
193
193
|
}
|
|
194
194
|
else {
|
|
195
|
-
|
|
195
|
+
const keys = [
|
|
196
|
+
...Object.getOwnPropertyNames(validatorStructure),
|
|
197
|
+
...Object.getOwnPropertySymbols(validatorStructure),
|
|
198
|
+
];
|
|
199
|
+
return keys.every((key) => {
|
|
200
|
+
const validator = validatorStructure[key];
|
|
196
201
|
return validator(subject[key]);
|
|
197
202
|
});
|
|
198
203
|
}
|
package/data/collectionproxy.js
CHANGED
|
@@ -59,8 +59,8 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
|
59
59
|
* via this mechanism.
|
|
60
60
|
*/
|
|
61
61
|
isHiddenFromDataPanel() {
|
|
62
|
-
var _a;
|
|
63
|
-
const isHiddenFromDataPanel = (_a = this.getBranchedFrom()) === null || _a === void 0 ? void 0 : _a.properties.get('IsHiddenFromDataPanel');
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const isHiddenFromDataPanel = (_b = (_a = this.getBranchedFrom()) === null || _a === void 0 ? void 0 : _a.properties.get('IsHiddenFromDataPanel')) !== null && _b !== void 0 ? _b : this.properties.get('IsHiddenFromDataPanel');
|
|
64
64
|
return !!isHiddenFromDataPanel;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -4,9 +4,11 @@ import type { GuardToType } from '../../core/guards';
|
|
|
4
4
|
export declare const patchItemValidator: (subject: unknown) => subject is import("../../core/guards").DestructureGuardedTypeObj<{
|
|
5
5
|
itemsAdded: (x: unknown) => x is Record<string, {
|
|
6
6
|
[key: string]: unknown;
|
|
7
|
+
[key: symbol]: unknown;
|
|
7
8
|
}>;
|
|
8
9
|
itemsChanged: (x: unknown) => x is Record<string, {
|
|
9
10
|
[key: string]: unknown;
|
|
11
|
+
[key: symbol]: unknown;
|
|
10
12
|
}>;
|
|
11
13
|
itemsDeleted: (p1: unknown) => p1 is string[];
|
|
12
14
|
itemOrderChanged: (x: unknown) => x is [string, string | null][] | null | undefined;
|
|
@@ -45,9 +47,11 @@ export type SerializedSchemaPatch = GuardToType<typeof patchSchemaValidator>;
|
|
|
45
47
|
export declare const patchValidator: (x: unknown) => x is import("../../core/guards").DestructureGuardedTypeObj<{
|
|
46
48
|
itemsAdded: (x: unknown) => x is Record<string, {
|
|
47
49
|
[key: string]: unknown;
|
|
50
|
+
[key: symbol]: unknown;
|
|
48
51
|
}>;
|
|
49
52
|
itemsChanged: (x: unknown) => x is Record<string, {
|
|
50
53
|
[key: string]: unknown;
|
|
54
|
+
[key: symbol]: unknown;
|
|
51
55
|
}>;
|
|
52
56
|
itemsDeleted: (p1: unknown) => p1 is string[];
|
|
53
57
|
itemOrderChanged: (x: unknown) => x is [string, string | null][] | null | undefined;
|
|
@@ -18,9 +18,9 @@ export declare class CustomBlockProxy extends BlockProxy {
|
|
|
18
18
|
static getCustomBlockClass(client: EditorClient, id: string): CustomBlockProxyConstructor | typeof CustomBlockProxy;
|
|
19
19
|
isFromStencil(library: string, shape: string): boolean;
|
|
20
20
|
getCustomShapeType(): {
|
|
21
|
-
packageId:
|
|
22
|
-
library:
|
|
23
|
-
shape:
|
|
21
|
+
packageId: unknown;
|
|
22
|
+
library: unknown;
|
|
23
|
+
shape: unknown;
|
|
24
24
|
};
|
|
25
25
|
getStencilTextAreaName(stencilTextAreaName: string): string | undefined;
|
|
26
26
|
}
|
package/editorclient.d.ts
CHANGED
|
@@ -451,6 +451,6 @@ export declare class EditorClient {
|
|
|
451
451
|
* Checks the current value of the given feature flag for the current user. This takes into
|
|
452
452
|
* account any local overrides, and can only be used for feature flags (not other forms of AB test).
|
|
453
453
|
*/
|
|
454
|
-
|
|
454
|
+
checkUserFeatureFlagAssignment(flagName: string): boolean;
|
|
455
455
|
constructor();
|
|
456
456
|
}
|
package/editorclient.js
CHANGED
|
@@ -739,7 +739,7 @@ class EditorClient {
|
|
|
739
739
|
* Checks the current value of the given feature flag for the current user. This takes into
|
|
740
740
|
* account any local overrides, and can only be used for feature flags (not other forms of AB test).
|
|
741
741
|
*/
|
|
742
|
-
|
|
742
|
+
checkUserFeatureFlagAssignment(flagName) {
|
|
743
743
|
return this.sendCommand("cufa" /* CommandName.CheckUserFlagAssignment */, { 'f': flagName });
|
|
744
744
|
}
|
|
745
745
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucid-extension-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.449",
|
|
4
4
|
"description": "Utility classes for writing Lucid Software editor extensions",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"declaration": true,
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@types/jasmine": "4.0.3",
|
|
12
|
-
"typedoc": "^0.
|
|
13
|
-
"typedoc-plugin-markdown": "^
|
|
12
|
+
"typedoc": "^0.25.13",
|
|
13
|
+
"typedoc-plugin-markdown": "^4.0.2",
|
|
14
14
|
"typescript": "5.1.6",
|
|
15
15
|
"prettier": "3.4.1",
|
|
16
16
|
"prettier-plugin-organize-imports": "4.1.0"
|