lucid-extension-sdk
Advanced tools
Comparing version 0.0.319 to 0.0.320
@@ -733,2 +733,6 @@ import { SerializedFieldTypeDefinition } from './core/data/fieldtypedefinition/fieldtypedefinition'; | ||
}; | ||
/** If we can only search for user by their name (and not email) in the card integration. */ | ||
'subn'?: boolean | undefined; | ||
/** Callback to search for a user in the card integration */ | ||
'usc'?: string | undefined; | ||
/** Show intro if user has not yet authorized this integration | ||
@@ -735,0 +739,0 @@ * String, not function; this is the name of the client's registered action hook |
@@ -33,3 +33,27 @@ import { FieldDefinition } from '../../data/schemadefinition'; | ||
} | ||
export type ExtensionCardUserData = ExtensionCardFieldOption & { | ||
email: string | undefined; | ||
}; | ||
/** @ignore */ | ||
export type SerializedExtensionCardUserData = SerializedCardFieldOption & { | ||
'e'?: string | undefined; | ||
}; | ||
/** @ignore */ | ||
export declare function serializeCardUserData(userData: ExtensionCardUserData): SerializedExtensionCardUserData; | ||
/** @ignore */ | ||
export declare function deserializeCardUserData(userData: SerializedExtensionCardUserData): ExtensionCardUserData; | ||
export declare const isSerializedCardUserData: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{ | ||
e: (x: unknown) => x is string | undefined; | ||
l: typeof isString; | ||
v: typeof isSerializedFieldType; | ||
i: (x: unknown) => x is string | undefined; | ||
}>; | ||
export declare const isSerializedCardUserDataArray: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{ | ||
e: (x: unknown) => x is string | undefined; | ||
l: typeof isString; | ||
v: typeof isSerializedFieldType; | ||
i: (x: unknown) => x is string | undefined; | ||
}>[]; | ||
export type ExtensionCardUserDataSearch = ((searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>) | undefined; | ||
/** @ignore */ | ||
export type SerializedCardFieldOption = { | ||
@@ -36,0 +60,0 @@ 'l': string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0; | ||
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; | ||
const schemadefinition_1 = require("../../data/schemadefinition"); | ||
@@ -11,2 +11,19 @@ const checks_1 = require("../checks"); | ||
/** @ignore */ | ||
function serializeCardUserData(userData) { | ||
return Object.assign({ 'e': userData.email }, serializeCardFieldOption(userData)); | ||
} | ||
exports.serializeCardUserData = serializeCardUserData; | ||
/** @ignore */ | ||
function deserializeCardUserData(userData) { | ||
return Object.assign({ email: userData['e'] }, deserializeFieldOption(userData)); | ||
} | ||
exports.deserializeCardUserData = deserializeCardUserData; | ||
exports.isSerializedCardUserData = (0, validators_1.objectValidator)({ | ||
'e': (0, validators_1.option)(checks_1.isString), | ||
'l': checks_1.isString, | ||
'v': serializedfields_1.isSerializedFieldType, | ||
'i': (0, validators_1.option)(checks_1.isString), | ||
}); | ||
exports.isSerializedCardUserDataArray = (0, validators_1.arrayValidator)(exports.isSerializedCardUserData); | ||
/** @ignore */ | ||
function serializeCardFieldOption(option) { | ||
@@ -13,0 +30,0 @@ return { |
@@ -79,2 +79,6 @@ import { CollectionProxy } from '../../data/collectionproxy'; | ||
}; | ||
/** If we are only able to search by name and not email in the card integration (ex: for JDC) */ | ||
searchUserByName?: boolean; | ||
/** This is used to search for users in the card integration. It returns an additional email field of the user if available.*/ | ||
userSearchCallback?: string; | ||
/** | ||
@@ -81,0 +85,0 @@ * @deprecated Use AuthorizationFlowHandlerRegistry.registerAuthorizationFlowHandler. |
import { EditorClient } from '../../editorclient'; | ||
import { SerializedFieldType } from '../data/serializedfield/serializedfields'; | ||
import { ExtensionCardFieldOption } from './cardintegrationdefinitions'; | ||
import { ExtensionCardFieldOption, ExtensionCardUserData } from './cardintegrationdefinitions'; | ||
import { LucidCardIntegration } from './lucidcardintegration'; | ||
@@ -10,2 +10,3 @@ export declare class LucidCardIntegrationRegistry { | ||
static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string; | ||
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string; | ||
private static registerDependencyMapping; | ||
@@ -12,0 +13,0 @@ /** |
@@ -29,2 +29,10 @@ "use strict"; | ||
} | ||
static registerUserSearchCallback(client, callback) { | ||
const name = LucidCardIntegrationRegistry.nextHookName(); | ||
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText }) => { | ||
const result = await callback(searchText, new Map(inputSoFar)); | ||
return result.map((userData) => (0, cardintegrationdefinitions_1.serializeCardUserData)(userData)); | ||
}); | ||
return name; | ||
} | ||
static registerDependencyMapping(client, cardIntegration, serialized) { | ||
@@ -144,2 +152,4 @@ if (cardIntegration.showDependencyMapping) { | ||
}, | ||
'subn': cardIntegration.searchUserByName, | ||
'usc': cardIntegration.userSearchCallback, | ||
'gdc': getDefaultConfigActionName, | ||
@@ -146,0 +156,0 @@ 'i': showIntroActionName, |
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.319", | ||
"version": "0.0.320", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
863945
19726
9
4