lucid-extension-sdk 0.0.370 → 0.0.372
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 +2 -0
- package/core/cardintegration/cardintegrationparams.d.ts +3 -0
- package/core/cardintegration/lucidcardintegration.d.ts +5 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +3 -1
- package/core/cardintegration/lucidcardintegrationregistry.js +4 -2
- package/core/checks.d.ts +7 -0
- package/core/checks.js +11 -1
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +1 -1
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -756,6 +756,8 @@ export type AddCardIntegrationQuery = {
|
|
|
756
756
|
'osfc'?: string | undefined;
|
|
757
757
|
/** Field name -> callback name tuples for searching for legal field values in an enum */
|
|
758
758
|
'fvsc'?: [string, string][] | undefined;
|
|
759
|
+
/** Default search callback for searching for legal field values in an enum */
|
|
760
|
+
'dsc'?: string | undefined;
|
|
759
761
|
};
|
|
760
762
|
/** If we can only search for user by their name (and not email) in the card integration. */
|
|
761
763
|
'subn'?: boolean | undefined;
|
|
@@ -73,6 +73,11 @@ export declare abstract class LucidCardIntegration {
|
|
|
73
73
|
* be all the current field values on the item being edited.
|
|
74
74
|
*/
|
|
75
75
|
fieldValueSearchCallbacks?: Map<string, string>;
|
|
76
|
+
/**
|
|
77
|
+
* Optional callback that's used when a field name may not map to any field defined in fieldValueSearchCallbacks.
|
|
78
|
+
* Useful for when you don't know the field name ahead of time (e.g. a dynamically generated field name).
|
|
79
|
+
*/
|
|
80
|
+
defaultSearchCallback?: string;
|
|
76
81
|
};
|
|
77
82
|
iconConfiguration?: {
|
|
78
83
|
/**
|
|
@@ -6,7 +6,9 @@ export declare class LucidCardIntegrationRegistry {
|
|
|
6
6
|
private static nextHookId;
|
|
7
7
|
private static nextHookName;
|
|
8
8
|
static registerFieldOptionsCallback(client: EditorClient, callback: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
|
|
9
|
-
static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType
|
|
9
|
+
static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>, fieldData?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
}) => Promise<ExtensionCardFieldOption[]>): string;
|
|
10
12
|
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
|
|
11
13
|
private static registerDependencyMapping;
|
|
12
14
|
private static serializeSearchResult;
|
|
@@ -23,8 +23,9 @@ class LucidCardIntegrationRegistry {
|
|
|
23
23
|
}
|
|
24
24
|
static registerFieldSearchCallback(client, callback) {
|
|
25
25
|
const name = LucidCardIntegrationRegistry.nextHookName();
|
|
26
|
-
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText }) => {
|
|
27
|
-
const
|
|
26
|
+
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText, 'fd': serializedFieldData }) => {
|
|
27
|
+
const fieldData = serializedFieldData ? { name: serializedFieldData.n } : undefined;
|
|
28
|
+
const result = await callback(searchText, new Map(inputSoFar), fieldData);
|
|
28
29
|
return result.map((option) => (0, cardintegrationdefinitions_1.serializeCardFieldOption)(option));
|
|
29
30
|
});
|
|
30
31
|
return name;
|
|
@@ -180,6 +181,7 @@ class LucidCardIntegrationRegistry {
|
|
|
180
181
|
'fvsc': cardIntegration.fieldConfiguration.fieldValueSearchCallbacks
|
|
181
182
|
? [...cardIntegration.fieldConfiguration.fieldValueSearchCallbacks.entries()]
|
|
182
183
|
: undefined,
|
|
184
|
+
'dsc': cardIntegration.fieldConfiguration.defaultSearchCallback,
|
|
183
185
|
},
|
|
184
186
|
'subn': cardIntegration.searchUserByName,
|
|
185
187
|
'usc': cardIntegration.userSearchCallback,
|
package/core/checks.d.ts
CHANGED
|
@@ -117,6 +117,13 @@ export declare function isArray(val: unknown): val is unknown[];
|
|
|
117
117
|
* @return Whether variable is an array of the given type.
|
|
118
118
|
*/
|
|
119
119
|
export declare function isTypedArray<T>(typeGuard: (a: unknown) => a is T): (val: unknown) => val is T[];
|
|
120
|
+
/**
|
|
121
|
+
* Returns true if the specified value is an array and every element is defined and not null.
|
|
122
|
+
*
|
|
123
|
+
* @param val Variable to test.
|
|
124
|
+
* @returns Whether variable is an array of defined and not null elements.
|
|
125
|
+
*/
|
|
126
|
+
export declare function isDefinedArray<T>(val: (T | undefined | null)[]): val is T[];
|
|
120
127
|
/**
|
|
121
128
|
* Returns true if the specified value is a map.
|
|
122
129
|
*
|
package/core/checks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isPair = exports.isAtLeastLength = exports.isExactLength = exports.isMap = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObjectUnsafer = exports.isObjectUnsafe = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isVoid = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
3
|
+
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isPair = exports.isAtLeastLength = exports.isExactLength = exports.isMap = exports.isDefinedArray = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObjectUnsafer = exports.isObjectUnsafe = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isVoid = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if the specified value is not undefined.
|
|
6
6
|
*
|
|
@@ -177,6 +177,16 @@ function isTypedArray(typeGuard) {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
exports.isTypedArray = isTypedArray;
|
|
180
|
+
/**
|
|
181
|
+
* Returns true if the specified value is an array and every element is defined and not null.
|
|
182
|
+
*
|
|
183
|
+
* @param val Variable to test.
|
|
184
|
+
* @returns Whether variable is an array of defined and not null elements.
|
|
185
|
+
*/
|
|
186
|
+
function isDefinedArray(val) {
|
|
187
|
+
return isArray(val) && val.every(isDefAndNotNull);
|
|
188
|
+
}
|
|
189
|
+
exports.isDefinedArray = isDefinedArray;
|
|
180
190
|
/**
|
|
181
191
|
* Returns true if the specified value is a map.
|
|
182
192
|
*
|
|
@@ -10,7 +10,7 @@ import { SerializedFieldType, isSerializedFieldType } from '../data/serializedfi
|
|
|
10
10
|
export interface ExtensionCardFieldOption {
|
|
11
11
|
label: string;
|
|
12
12
|
value: SerializedFieldType;
|
|
13
|
-
iconUrl?: string;
|
|
13
|
+
iconUrl?: string | undefined;
|
|
14
14
|
}
|
|
15
15
|
export interface ExtensionCardFieldDefinition extends FieldDefinition {
|
|
16
16
|
/** The label to display in the UI */
|