lucid-extension-sdk
Advanced tools
Comparing version 0.0.136 to 0.0.137
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.136", | ||
"version": "0.0.137", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "sdk/index.js", |
@@ -605,16 +605,16 @@ import { SerializedFieldTypeDefinition } from './core/data/fieldtypedefinition/fieldtypedefinition'; | ||
export declare type AddSpreadsheetIntegrationQuery = { | ||
/** name */ | ||
'n': string; | ||
/** label */ | ||
'l': string; | ||
/** iconUrl */ | ||
'iu': string; | ||
/** getSpreadsheetToImportDetails */ | ||
/** labelDescription */ | ||
'ld': string; | ||
/** labelIconUrl */ | ||
'li': string; | ||
/** dataConnectorName */ | ||
'dc': string; | ||
/** getSpreadsheetDetailsToImport */ | ||
'gs': string; | ||
/** getMultipleSheetsForSpreadsheetDetails */ | ||
'gm': string; | ||
/** getSpreadsheetData */ | ||
'gd': string; | ||
/** getSpreadsheetSheetIdsAndNames */ | ||
'gs': string; | ||
/** getPreviewData */ | ||
'gp': string; | ||
/** importSheets */ | ||
'i': string; | ||
/** importIsComplete */ | ||
'ic': string; | ||
}; | ||
@@ -621,0 +621,0 @@ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */ |
import { SerializedImportedDataSource } from '../data/datasource/serializedimporteddatasource'; | ||
import { SerializedUpstreamConfig } from '../data/datasource/serializedupstreamconfig'; | ||
import { SerializedSchema } from '../data/serializedfield/serializedschema'; | ||
import { JsonSerializable } from '../jsonserializable'; | ||
@@ -12,14 +14,22 @@ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */ | ||
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */ | ||
export declare type ImportedResults = { | ||
'dataSourceId': string; | ||
'syncDataSourceId': string; | ||
'upstreamConfig': SerializedUpstreamConfig; | ||
'collections': { | ||
'collectionId': string; | ||
'headerRow': number; | ||
'schema': SerializedSchema; | ||
'upstreamConfig': JsonSerializable; | ||
}[]; | ||
}; | ||
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */ | ||
export declare abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable> { | ||
abstract name: string; | ||
abstract label: string; | ||
abstract iconUrl: string; | ||
abstract getSpreadsheetToImportDetails(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>; | ||
abstract getSpreadsheetSheetIdsAndNames(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>; | ||
abstract getPreviewData(spreadsheetDetails: CONFIG, sheetsToPreview: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>; | ||
abstract importSheets(spreadsheetDetails: CONFIG, sheetsConfig: { | ||
'sheet': SHEET; | ||
'headerRowIndex': number; | ||
'primaryKeys': string[]; | ||
}[]): Promise<string | LucidSpreadsheetIntegrationFailureType>; | ||
abstract labelDescription: string; | ||
abstract labelIconUrl: string; | ||
abstract dataConnectorName: string; | ||
abstract getSpreadsheetDetailsToImport(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>; | ||
abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>; | ||
abstract getSpreadsheetData(spreadsheetDetails: CONFIG, sheets: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>; | ||
abstract importIsComplete(importedResults: ImportedResults): void; | ||
} |
@@ -14,6 +14,6 @@ "use strict"; | ||
static addSpreadsheetIntegration(client, spreadsheetIntegration) { | ||
const getSpreadsheetToImportDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getSpreadsheetToImportDetailsActionName, async () => { | ||
const getSpreadsheetDetailsToImportActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getSpreadsheetDetailsToImportActionName, async () => { | ||
try { | ||
return await spreadsheetIntegration.getSpreadsheetToImportDetails(); | ||
return await spreadsheetIntegration.getSpreadsheetDetailsToImport(); | ||
} | ||
@@ -23,6 +23,6 @@ catch (error) { } | ||
}); | ||
const getSpreadsheetSheetIdsAndNamesActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getSpreadsheetSheetIdsAndNamesActionName, async (message) => { | ||
const getMultipleSheetsForSpreadsheetDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getMultipleSheetsForSpreadsheetDetailsActionName, async (message) => { | ||
try { | ||
const result = await spreadsheetIntegration.getSpreadsheetSheetIdsAndNames(message['dataDetails']); | ||
const result = await spreadsheetIntegration.getMultipleSheetsForSpreadsheetDetails(message['spreadsheetDetails']); | ||
if ((0, lucidspreadsheetintegration_1.lucidSpreadsheetIntegrationFailureTypeValidator)(result)) { | ||
@@ -39,6 +39,6 @@ return result; | ||
}); | ||
const getPreviewDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getPreviewDataActionName, async (message) => { | ||
const getSpreadsheetDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(getSpreadsheetDataActionName, async (message) => { | ||
try { | ||
return await spreadsheetIntegration.getPreviewData(message['dataDetails'], message['sheets']); | ||
return await spreadsheetIntegration.getSpreadsheetData(message['spreadsheetDetails'], message['sheets']); | ||
} | ||
@@ -48,18 +48,14 @@ catch (error) { } | ||
}); | ||
const importSheetsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(importSheetsActionName, async (message) => { | ||
try { | ||
return await spreadsheetIntegration.importSheets(message['dataDetails'], message['sheetsConfig']); | ||
} | ||
catch (error) { } | ||
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure; | ||
const importIsCompleteActionName = LucidSpreadsheetIntegrationRegistry.nextHookName(); | ||
client.registerAction(importIsCompleteActionName, async (message) => { | ||
spreadsheetIntegration.importIsComplete(message['ImportedResults']); | ||
}); | ||
const serialized = { | ||
'n': spreadsheetIntegration.name, | ||
'l': spreadsheetIntegration.label, | ||
'iu': spreadsheetIntegration.iconUrl, | ||
'gd': getSpreadsheetToImportDetailsActionName, | ||
'gs': getSpreadsheetSheetIdsAndNamesActionName, | ||
'gp': getPreviewDataActionName, | ||
'i': importSheetsActionName, | ||
'ld': spreadsheetIntegration.labelDescription, | ||
'li': spreadsheetIntegration.labelIconUrl, | ||
'dc': spreadsheetIntegration.dataConnectorName, | ||
'gs': getSpreadsheetDetailsToImportActionName, | ||
'gm': getMultipleSheetsForSpreadsheetDetailsActionName, | ||
'gd': getSpreadsheetDataActionName, | ||
'ic': importIsCompleteActionName, | ||
}; | ||
@@ -66,0 +62,0 @@ client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized); |
546663
12519