Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lucid-extension-sdk

Package Overview
Dependencies
Maintainers
2
Versions
320
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucid-extension-sdk - npm Package Compare versions

Comparing version 0.0.263 to 0.0.264

core/cardintegration/lucidcardintegrationcustomimportmodal.d.ts

23

commandtypes.d.ts

@@ -45,2 +45,3 @@ import { SerializedFieldTypeDefinition } from './core/data/fieldtypedefinition/fieldtypedefinition';

CreateBlock = "cb",
CreateCards = "ca",
CreateCollection = "cc",

@@ -236,2 +237,6 @@ CreateDataSource = "cds",

};
[CommandName.CreateCards]: {
query: CreateCardsQuery;
result: CreateCardsResult;
};
[CommandName.CreateCollection]: {

@@ -719,9 +724,6 @@ query: CreateCollectionQuery;

} | undefined;
/** If specified, custom import modal via iframe url */
/** If specified, custom import modal*/
'cim'?: {
'su': string;
'w': number;
'h': number;
'i': string;
};
'sh': string;
} | undefined;
/** If specified, add-card settings */

@@ -907,2 +909,11 @@ 'ac'?: {

export type CreateBlockResult = string;
export type CreateCardsQuery = {
/** Identifier for the cards integration. */
'cid': string;
/** Identifier for the collection. */
'coid': string;
/** Primary keys of the items to import. */
'pks': string[];
};
export type CreateCardsResult = Promise<string[]>;
export type CreateGroupQuery = {

@@ -909,0 +920,0 @@ /**

@@ -1,2 +0,1 @@

import { CollectionDefinition } from '../../data/collectiondefinition';
import { CollectionProxy } from '../../data/collectionproxy';

@@ -7,23 +6,7 @@ import { DataSourceProxy } from '../../data/datasourceproxy';

import { SerializedFieldType } from '../data/serializedfield/serializedfields';
import { JsonSerializable } from '../jsonserializable';
import { CardIntegrationConfig } from './cardintegrationconfig';
import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
/**
* Result of searching for data in the import modal
*/
export interface SearchResult {
partialImportMetadata?: {
collectionId: string;
syncDataSourceId?: string;
};
data: CollectionDefinition;
fields: ExtensionCardFieldDefinition[];
}
/**
* Result of importing data from the import modal
*/
export interface ImportResult {
collection: CollectionProxy;
primaryKeys: string[];
}
import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
import { LucidCardIntegrationStandardImportModal } from './lucidcardintegrationstandardimportmodal';
export { ImportResult, SearchResult } from './lucidcardintegrationstandardimportmodal';
export declare abstract class LucidCardIntegration {

@@ -93,62 +76,7 @@ protected readonly client: EditorClient;

/**
* If specified, allow the user to import cards using the standard card-import modal.
*
* getSearchFields:
* Given the values entered by the user so far into search fields, return the list of all search fields
* to display in the search form.
*
* search:
* Given values entered by the user into the search fields so far, return a collection of data to
* display in the results table. If partialImportMetadata is also returned, it will be used to create the tasks cards before
* the import is completed—which allows users to interact with the cards while the
* data is fetched asynchronously. The collectionId needs to match the id that will be
* returned from the completed import. The syncDataSourceId needs to match the
* syncDataSourceId that is passed into performDataAction.
* The last requirement for the partial import to work is that the primary keys in the data also
* returned in this search need to match the primary keys that will be returned
* on import.
*
* import:
* The user checked the boxes beside the given list of items in the collection returned from search().
* Import them, and return the collection and primary keys in that final collection that were imported.
*
* onSetup:
* If specified, it's going to be called everytime the modal is setting up, right after the modal is displayed
* and before the initial form fields are shown to the user.
*
* The config provided here is only used on the first import from a given source; on subsequent imports,
* the existing config will remain unchanged to preserve any customizations by the user.
* This allows the user to import cards by selecting items from within a modal. You can either create a custom
* import modal or the standard import modal can be used.
*/
importModal?: {
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
search: (fields: Map<string, SerializedFieldType>) => Promise<SearchResult>;
import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult>;
onSetup?: () => Promise<void>;
};
importModal?: LucidCardIntegrationStandardImportModal | LucidCardIntegrationCustomImportModal;
/**
* If specified, allow the user to import cards using a custom card-import modal.
*
* srcUrl:
* The url to be displayed in an iframe. This can either be a public url, or a local
* file located in the public folder of your packages root directory.
*
* width:
* The width of the iframe. The maximum width is 1344px.
*
* height:
* The height of the iframe. The maximum height is 1000px.
*
* import:
* Imports the items selected from you custom iframe. You can pass in whatever data is needed to import the items
* through you data-connector. The data must be of type JsonSerializable. Return the collection created and the
* primary keys of the items that were imported.
*
*/
customImportModal?: {
srcUrl: string;
width: number;
height: number;
import: (data: JsonSerializable) => Promise<ImportResult>;
};
/**
* If specified, allow the user to create new cards and convert other shapes to cards

@@ -155,0 +83,0 @@ */

@@ -8,2 +8,3 @@ "use strict";

const cardintegrationdefinitions_1 = require("./cardintegrationdefinitions");
const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
class LucidCardIntegrationRegistry {

@@ -77,53 +78,45 @@ static nextHookName() {

const importModal = cardIntegration.importModal;
serialized['im'] = {
'gsf': LucidCardIntegrationRegistry.nextHookName(),
's': LucidCardIntegrationRegistry.nextHookName(),
'i': LucidCardIntegrationRegistry.nextHookName(),
'os': importModal.onSetup ? LucidCardIntegrationRegistry.nextHookName() : undefined,
};
client.registerAction(serialized['im']['gsf'], async ({ 's': searchSoFar }) => {
const result = await importModal.getSearchFields(new Map(searchSoFar));
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
});
client.registerAction(serialized['im']['s'], async ({ 's': param }) => {
const result = await importModal.search(new Map(param));
return {
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(result.data),
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result.fields),
'm': result.partialImportMetadata && {
'cid': result.partialImportMetadata.collectionId,
'sid': result.partialImportMetadata.syncDataSourceId,
},
if (importModal instanceof lucidcardintegrationcustomimportmodal_1.LucidCardIntegrationCustomImportModal) {
serialized['cim'] = {
'sh': LucidCardIntegrationRegistry.nextHookName(),
};
});
client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
const result = await importModal.import(primaryKeys, new Map(searchFields));
return {
'c': result.collection.id,
'pks': result.primaryKeys,
client.registerAction(serialized['cim']['sh'], () => importModal.show());
}
else {
serialized['im'] = {
'gsf': LucidCardIntegrationRegistry.nextHookName(),
's': LucidCardIntegrationRegistry.nextHookName(),
'i': LucidCardIntegrationRegistry.nextHookName(),
'os': importModal.onSetup ? LucidCardIntegrationRegistry.nextHookName() : undefined,
};
});
if (serialized['im']['os']) {
client.registerAction(serialized['im']['os'], async () => {
var _a;
await ((_a = importModal.onSetup) === null || _a === void 0 ? void 0 : _a.call(importModal));
client.registerAction(serialized['im']['gsf'], async ({ 's': searchSoFar }) => {
const result = await importModal.getSearchFields(new Map(searchSoFar));
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
});
client.registerAction(serialized['im']['s'], async ({ 's': param }) => {
const result = await importModal.search(new Map(param));
return {
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(result.data),
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result.fields),
'm': result.partialImportMetadata && {
'cid': result.partialImportMetadata.collectionId,
'sid': result.partialImportMetadata.syncDataSourceId,
},
};
});
client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
const result = await importModal.import(primaryKeys, new Map(searchFields));
return {
'c': result.collection.id,
'pks': result.primaryKeys,
};
});
if (serialized['im']['os']) {
client.registerAction(serialized['im']['os'], async () => {
var _a;
await ((_a = importModal.onSetup) === null || _a === void 0 ? void 0 : _a.call(importModal));
});
}
}
}
if (cardIntegration.customImportModal) {
const customImportModal = cardIntegration.customImportModal;
serialized['cim'] = {
'su': customImportModal.srcUrl,
'w': customImportModal.width,
'h': customImportModal.height,
'i': LucidCardIntegrationRegistry.nextHookName(),
};
client.registerAction(serialized['cim']['i'], async ({ 'd': data }) => {
const result = await customImportModal.import(data);
return {
'c': result.collection.id,
'pks': result.primaryKeys,
};
});
}
if (cardIntegration.addCard) {

@@ -130,0 +123,0 @@ const addCard = cardIntegration.addCard;

{
"name": "lucid-extension-sdk",
"version": "0.0.263",
"version": "0.0.264",
"description": "Utility classes for writing Lucid Software editor extensions",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc