lucid-extension-sdk 0.0.136 → 0.0.138
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/package.json +1 -1
- package/sdk/commandtypes.d.ts +13 -13
- package/sdk/core/data/serializedfield/serializedfielddefinition.d.ts +2 -1
- package/sdk/core/data/serializedfield/serializedfielddefinition.js +1 -0
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +21 -11
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +19 -23
- package/sdk/data/schemadefinition.d.ts +6 -2
- package/sdk/data/schemadefinition.js +1 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -602,20 +602,20 @@ export declare type AddShapeDataQuery = {
|
|
|
602
602
|
export declare type AddShapeDataResult = undefined;
|
|
603
603
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
604
604
|
export declare type AddSpreadsheetIntegrationQuery = {
|
|
605
|
-
/**
|
|
606
|
-
'
|
|
607
|
-
/**
|
|
608
|
-
'
|
|
609
|
-
/**
|
|
610
|
-
'
|
|
611
|
-
/**
|
|
612
|
-
'gd': string;
|
|
613
|
-
/** getSpreadsheetSheetIdsAndNames */
|
|
605
|
+
/** labelDescription */
|
|
606
|
+
'ld': string;
|
|
607
|
+
/** labelIconUrl */
|
|
608
|
+
'li': string;
|
|
609
|
+
/** dataConnectorName */
|
|
610
|
+
'dc': string;
|
|
611
|
+
/** getSpreadsheetDetailsToImport */
|
|
614
612
|
'gs': string;
|
|
615
|
-
/**
|
|
616
|
-
'
|
|
617
|
-
/**
|
|
618
|
-
'
|
|
613
|
+
/** getMultipleSheetsForSpreadsheetDetails */
|
|
614
|
+
'gm': string;
|
|
615
|
+
/** getSpreadsheetData */
|
|
616
|
+
'gd': string;
|
|
617
|
+
/** importIsComplete */
|
|
618
|
+
'ic': string;
|
|
619
619
|
};
|
|
620
620
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
621
621
|
export declare type AddSpreadsheetIntegrationResult = undefined;
|
|
@@ -8,7 +8,8 @@ export declare enum FieldConstraintType {
|
|
|
8
8
|
MIN_VALUE = "minValue",
|
|
9
9
|
MAX_VALUE = "maxValue",
|
|
10
10
|
SINGLE_LINE_ONLY = "singleLineOnly",
|
|
11
|
-
NO_WHITESPACE = "noWhitespace"
|
|
11
|
+
NO_WHITESPACE = "noWhitespace",
|
|
12
|
+
UNIQUE_EDIT = "uniqueEditType"
|
|
12
13
|
}
|
|
13
14
|
export declare const isFieldConstraintType: (x: unknown) => x is FieldConstraintType;
|
|
14
15
|
export declare type SerializedFieldConstraint = {
|
|
@@ -14,6 +14,7 @@ var FieldConstraintType;
|
|
|
14
14
|
FieldConstraintType["MAX_VALUE"] = "maxValue";
|
|
15
15
|
FieldConstraintType["SINGLE_LINE_ONLY"] = "singleLineOnly";
|
|
16
16
|
FieldConstraintType["NO_WHITESPACE"] = "noWhitespace";
|
|
17
|
+
FieldConstraintType["UNIQUE_EDIT"] = "uniqueEditType";
|
|
17
18
|
})(FieldConstraintType = exports.FieldConstraintType || (exports.FieldConstraintType = {}));
|
|
18
19
|
exports.isFieldConstraintType = (0, validators_1.enumValidator)(FieldConstraintType);
|
|
19
20
|
exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SerializedImportedDataSource } from '../data/datasource/serializedimporteddatasource';
|
|
2
|
+
import { SerializedUpstreamConfig } from '../data/datasource/serializedupstreamconfig';
|
|
3
|
+
import { SerializedSchema } from '../data/serializedfield/serializedschema';
|
|
2
4
|
import { JsonSerializable } from '../jsonserializable';
|
|
3
5
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
4
6
|
export declare enum LucidSpreadsheetIntegrationFailureType {
|
|
@@ -9,16 +11,24 @@ export declare enum LucidSpreadsheetIntegrationFailureType {
|
|
|
9
11
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
10
12
|
export declare const lucidSpreadsheetIntegrationFailureTypeValidator: (x: unknown) => x is LucidSpreadsheetIntegrationFailureType;
|
|
11
13
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
14
|
+
export declare type ImportedResults = {
|
|
15
|
+
'dataSourceId': string;
|
|
16
|
+
'syncDataSourceId': string;
|
|
17
|
+
'upstreamConfig': SerializedUpstreamConfig;
|
|
18
|
+
'collections': {
|
|
19
|
+
'collectionId': string;
|
|
20
|
+
'headerRow': number;
|
|
21
|
+
'schema': SerializedSchema;
|
|
22
|
+
'upstreamConfig': JsonSerializable;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
12
26
|
export declare abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable> {
|
|
13
|
-
abstract
|
|
14
|
-
abstract
|
|
15
|
-
abstract
|
|
16
|
-
abstract
|
|
17
|
-
abstract
|
|
18
|
-
abstract
|
|
19
|
-
abstract
|
|
20
|
-
'sheet': SHEET;
|
|
21
|
-
'headerRowIndex': number;
|
|
22
|
-
'primaryKeys': string[];
|
|
23
|
-
}[]): Promise<string | LucidSpreadsheetIntegrationFailureType>;
|
|
27
|
+
abstract labelDescription: string;
|
|
28
|
+
abstract labelIconUrl: string;
|
|
29
|
+
abstract dataConnectorName: string;
|
|
30
|
+
abstract getSpreadsheetDetailsToImport(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
|
|
31
|
+
abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>;
|
|
32
|
+
abstract getSpreadsheetData(spreadsheetDetails: CONFIG, sheets: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>;
|
|
33
|
+
abstract importIsComplete(importedResults: ImportedResults): void;
|
|
24
34
|
}
|
|
@@ -11,18 +11,18 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
11
11
|
* Register a spreadsheet integration.
|
|
12
12
|
*/
|
|
13
13
|
static addSpreadsheetIntegration(client, spreadsheetIntegration) {
|
|
14
|
-
const
|
|
15
|
-
client.registerAction(
|
|
14
|
+
const getSpreadsheetDetailsToImportActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
15
|
+
client.registerAction(getSpreadsheetDetailsToImportActionName, async () => {
|
|
16
16
|
try {
|
|
17
|
-
return await spreadsheetIntegration.
|
|
17
|
+
return await spreadsheetIntegration.getSpreadsheetDetailsToImport();
|
|
18
18
|
}
|
|
19
19
|
catch (error) { }
|
|
20
20
|
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
client.registerAction(
|
|
22
|
+
const getMultipleSheetsForSpreadsheetDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
23
|
+
client.registerAction(getMultipleSheetsForSpreadsheetDetailsActionName, async (message) => {
|
|
24
24
|
try {
|
|
25
|
-
const result = await spreadsheetIntegration.
|
|
25
|
+
const result = await spreadsheetIntegration.getMultipleSheetsForSpreadsheetDetails(message['spreadsheetDetails']);
|
|
26
26
|
if ((0, lucidspreadsheetintegration_1.lucidSpreadsheetIntegrationFailureTypeValidator)(result)) {
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
@@ -34,30 +34,26 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
34
34
|
catch (error) { }
|
|
35
35
|
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
36
36
|
});
|
|
37
|
-
const
|
|
38
|
-
client.registerAction(
|
|
37
|
+
const getSpreadsheetDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
38
|
+
client.registerAction(getSpreadsheetDataActionName, async (message) => {
|
|
39
39
|
try {
|
|
40
|
-
return await spreadsheetIntegration.
|
|
40
|
+
return await spreadsheetIntegration.getSpreadsheetData(message['spreadsheetDetails'], message['sheets']);
|
|
41
41
|
}
|
|
42
42
|
catch (error) { }
|
|
43
43
|
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
client.registerAction(
|
|
47
|
-
|
|
48
|
-
return await spreadsheetIntegration.importSheets(message['dataDetails'], message['sheetsConfig']);
|
|
49
|
-
}
|
|
50
|
-
catch (error) { }
|
|
51
|
-
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
45
|
+
const importIsCompleteActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
46
|
+
client.registerAction(importIsCompleteActionName, async (message) => {
|
|
47
|
+
spreadsheetIntegration.importIsComplete(message['ImportedResults']);
|
|
52
48
|
});
|
|
53
49
|
const serialized = {
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
50
|
+
'ld': spreadsheetIntegration.labelDescription,
|
|
51
|
+
'li': spreadsheetIntegration.labelIconUrl,
|
|
52
|
+
'dc': spreadsheetIntegration.dataConnectorName,
|
|
53
|
+
'gs': getSpreadsheetDetailsToImportActionName,
|
|
54
|
+
'gm': getMultipleSheetsForSpreadsheetDetailsActionName,
|
|
55
|
+
'gd': getSpreadsheetDataActionName,
|
|
56
|
+
'ic': importIsCompleteActionName,
|
|
61
57
|
};
|
|
62
58
|
client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized);
|
|
63
59
|
}
|
|
@@ -27,7 +27,11 @@ export interface NoWhitespaceFieldConstraintDefinition {
|
|
|
27
27
|
type: FieldConstraintType.NO_WHITESPACE;
|
|
28
28
|
value?: undefined;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export interface UniqueEditFieldConstraintDefinition {
|
|
31
|
+
type: FieldConstraintType.UNIQUE_EDIT;
|
|
32
|
+
value?: undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition;
|
|
31
35
|
export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE;
|
|
32
36
|
export declare const isFieldConstraintDefinition: (x: unknown) => x is {
|
|
33
37
|
type?: FieldConstraintType | undefined;
|
|
@@ -37,7 +41,7 @@ export declare const isFieldConstraintDefinition: (x: unknown) => x is {
|
|
|
37
41
|
type: typeof minMaxFieldConstraintValidator;
|
|
38
42
|
value: typeof isNumber;
|
|
39
43
|
}> | import("..").DestructureGuardedTypeObj<{
|
|
40
|
-
type: (x: unknown) => x is FieldConstraintType.REQUIRED | FieldConstraintType.LOCKED | FieldConstraintType.SINGLE_LINE_ONLY | FieldConstraintType.NO_WHITESPACE;
|
|
44
|
+
type: (x: unknown) => x is FieldConstraintType.REQUIRED | FieldConstraintType.LOCKED | FieldConstraintType.SINGLE_LINE_ONLY | FieldConstraintType.NO_WHITESPACE | FieldConstraintType.UNIQUE_EDIT;
|
|
41
45
|
value: typeof isUndefined;
|
|
42
46
|
}>);
|
|
43
47
|
/**
|
|
@@ -62,6 +62,7 @@ function parseFieldDefinition(field) {
|
|
|
62
62
|
case serializedfielddefinition_1.FieldConstraintType.LOCKED:
|
|
63
63
|
case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
|
|
64
64
|
case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
|
|
65
|
+
case serializedfielddefinition_1.FieldConstraintType.UNIQUE_EDIT:
|
|
65
66
|
return { type: constraint['Type'] };
|
|
66
67
|
default:
|
|
67
68
|
throw new Error('Invalid constraint format');
|