lucid-extension-sdk 0.0.291 → 0.0.293
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 +3 -1
- package/core/data/serializedfield/serializedfields.d.ts +2 -2
- package/core/data/serializedfield/serializedfields.js +1 -1
- package/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +28 -3
- package/core/spreadsheetintegration/lucidspreadsheetintegration.js +16 -1
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.d.ts +1 -2
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +33 -9
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -804,7 +804,9 @@ export type AddSpreadsheetIntegrationQuery = {
|
|
|
804
804
|
/** dataConnectorName */
|
|
805
805
|
'dc': string;
|
|
806
806
|
/** getSpreadsheetDetailsToImport */
|
|
807
|
-
'gs': string
|
|
807
|
+
'gs': string | {
|
|
808
|
+
'l': string;
|
|
809
|
+
};
|
|
808
810
|
/** getMultipleSheetsForSpreadsheetDetails */
|
|
809
811
|
'gm': string;
|
|
810
812
|
/** addCardsIntegration */
|
|
@@ -23,7 +23,7 @@ export type SerializedFields = {
|
|
|
23
23
|
};
|
|
24
24
|
export type SerializedIsoDateObject = {
|
|
25
25
|
'isoDate': string;
|
|
26
|
-
'displayTimezone'?: string;
|
|
26
|
+
'displayTimezone'?: string | null;
|
|
27
27
|
};
|
|
28
28
|
export type SerializedMillisecondsDateObject = {
|
|
29
29
|
'ms': number;
|
|
@@ -102,7 +102,7 @@ export declare const isSerializedLucidDateObject: (x: unknown) => x is import(".
|
|
|
102
102
|
isDateOnly: (x: unknown) => x is boolean | undefined;
|
|
103
103
|
}> | import("../../guards").DestructureGuardedTypeObj<{
|
|
104
104
|
isoDate: typeof isString;
|
|
105
|
-
displayTimezone: (x: unknown) => x is string | undefined;
|
|
105
|
+
displayTimezone: (x: unknown) => x is string | null | undefined;
|
|
106
106
|
}>;
|
|
107
107
|
export declare const isSerializedTimeObject: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
108
108
|
hours: typeof isNumber;
|
|
@@ -26,7 +26,7 @@ exports.isSerializedMillisecondsDateObject = (0, validators_1.objectValidator)({
|
|
|
26
26
|
});
|
|
27
27
|
const isSerializedIsoDateObject = (0, validators_1.objectValidator)({
|
|
28
28
|
'isoDate': checks_1.isString,
|
|
29
|
-
'displayTimezone': (0, validators_1.
|
|
29
|
+
'displayTimezone': (0, validators_1.nullableOption)(checks_1.isString),
|
|
30
30
|
});
|
|
31
31
|
exports.isSerializedLucidDateObject = (0, validators_1.either)(exports.isSerializedMillisecondsDateObject, isSerializedIsoDateObject);
|
|
32
32
|
exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
|
|
@@ -19,13 +19,38 @@ export type ImportedResults = {
|
|
|
19
19
|
'upstreamConfig'?: JsonSerializable;
|
|
20
20
|
}[];
|
|
21
21
|
};
|
|
22
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
22
23
|
export declare const isImportedResults: (x: unknown) => x is ImportedResults;
|
|
23
24
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
24
|
-
export declare
|
|
25
|
+
export declare class ListChooser {
|
|
26
|
+
readonly getList: () => Promise<{
|
|
27
|
+
header: string[];
|
|
28
|
+
rows: {
|
|
29
|
+
id: string;
|
|
30
|
+
values: string[];
|
|
31
|
+
icon: string;
|
|
32
|
+
}[];
|
|
33
|
+
} | LucidSpreadsheetIntegrationFailureType>;
|
|
34
|
+
constructor(getList: () => Promise<{
|
|
35
|
+
header: string[];
|
|
36
|
+
rows: {
|
|
37
|
+
id: string;
|
|
38
|
+
values: string[];
|
|
39
|
+
icon: string;
|
|
40
|
+
}[];
|
|
41
|
+
} | LucidSpreadsheetIntegrationFailureType>);
|
|
42
|
+
}
|
|
43
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
44
|
+
export declare class CustomDetailsChooser {
|
|
45
|
+
readonly getConfig: () => Promise<string | LucidSpreadsheetIntegrationFailureType>;
|
|
46
|
+
constructor(getConfig: () => Promise<string | LucidSpreadsheetIntegrationFailureType>);
|
|
47
|
+
}
|
|
48
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
49
|
+
export declare abstract class LucidSpreadsheetIntegration {
|
|
25
50
|
abstract labelDescription: string;
|
|
26
51
|
abstract labelIconUrl: string;
|
|
27
52
|
abstract dataConnectorName: string;
|
|
28
53
|
addCardsIntegration: boolean;
|
|
29
|
-
abstract
|
|
30
|
-
abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails:
|
|
54
|
+
abstract configChooser: ListChooser | CustomDetailsChooser;
|
|
55
|
+
abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: string): Promise<Map<string, string> | LucidSpreadsheetIntegrationFailureType>;
|
|
31
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LucidSpreadsheetIntegration = exports.isImportedResults = exports.lucidSpreadsheetIntegrationFailureTypeValidator = exports.LucidSpreadsheetIntegrationFailureType = void 0;
|
|
3
|
+
exports.LucidSpreadsheetIntegration = exports.CustomDetailsChooser = exports.ListChooser = exports.isImportedResults = exports.lucidSpreadsheetIntegrationFailureTypeValidator = exports.LucidSpreadsheetIntegrationFailureType = void 0;
|
|
4
4
|
const checks_1 = require("../checks");
|
|
5
5
|
const serializedupstreamconfig_1 = require("../data/datasource/serializedupstreamconfig");
|
|
6
6
|
const serializedschema_1 = require("../data/serializedfield/serializedschema");
|
|
@@ -15,6 +15,7 @@ var LucidSpreadsheetIntegrationFailureType;
|
|
|
15
15
|
})(LucidSpreadsheetIntegrationFailureType || (exports.LucidSpreadsheetIntegrationFailureType = LucidSpreadsheetIntegrationFailureType = {}));
|
|
16
16
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
17
17
|
exports.lucidSpreadsheetIntegrationFailureTypeValidator = (0, validators_1.stringEnumValidator)(LucidSpreadsheetIntegrationFailureType);
|
|
18
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
18
19
|
exports.isImportedResults = (0, validators_1.strictObjectValidator)({
|
|
19
20
|
'upstreamConfig': serializedupstreamconfig_1.isSerializedUpstreamConfig,
|
|
20
21
|
'collections': (0, validators_1.arrayValidator)((0, validators_1.strictObjectValidator)({
|
|
@@ -25,6 +26,20 @@ exports.isImportedResults = (0, validators_1.strictObjectValidator)({
|
|
|
25
26
|
})),
|
|
26
27
|
});
|
|
27
28
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
29
|
+
class ListChooser {
|
|
30
|
+
constructor(getList) {
|
|
31
|
+
this.getList = getList;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ListChooser = ListChooser;
|
|
35
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
36
|
+
class CustomDetailsChooser {
|
|
37
|
+
constructor(getConfig) {
|
|
38
|
+
this.getConfig = getConfig;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.CustomDetailsChooser = CustomDetailsChooser;
|
|
42
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
28
43
|
class LucidSpreadsheetIntegration {
|
|
29
44
|
constructor() {
|
|
30
45
|
this.addCardsIntegration = true;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EditorClient } from '../../editorclient';
|
|
2
|
-
import { JsonSerializable } from '../jsonserializable';
|
|
3
2
|
import { LucidSpreadsheetIntegration } from './lucidspreadsheetintegration';
|
|
4
3
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
4
|
export declare class LucidSpreadsheetIntegrationRegistry {
|
|
@@ -8,5 +7,5 @@ export declare class LucidSpreadsheetIntegrationRegistry {
|
|
|
8
7
|
/**
|
|
9
8
|
* Register a spreadsheet integration.
|
|
10
9
|
*/
|
|
11
|
-
static addSpreadsheetIntegration
|
|
10
|
+
static addSpreadsheetIntegration(client: EditorClient, spreadsheetIntegration: LucidSpreadsheetIntegration): void;
|
|
12
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LucidSpreadsheetIntegrationRegistry = void 0;
|
|
4
|
+
const checks_1 = require("../checks");
|
|
4
5
|
const lucidspreadsheetintegration_1 = require("./lucidspreadsheetintegration");
|
|
5
6
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
6
7
|
class LucidSpreadsheetIntegrationRegistry {
|
|
@@ -11,14 +12,37 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
11
12
|
* Register a spreadsheet integration.
|
|
12
13
|
*/
|
|
13
14
|
static addSpreadsheetIntegration(client, spreadsheetIntegration) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
let configChooserActions;
|
|
16
|
+
const configChooser = spreadsheetIntegration.configChooser;
|
|
17
|
+
if (configChooser instanceof lucidspreadsheetintegration_1.CustomDetailsChooser) {
|
|
18
|
+
const actionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
19
|
+
configChooserActions = actionName;
|
|
20
|
+
client.registerAction(actionName, async () => {
|
|
21
|
+
try {
|
|
22
|
+
return await configChooser.getConfig();
|
|
23
|
+
}
|
|
24
|
+
catch (error) { }
|
|
25
|
+
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const actionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
30
|
+
configChooserActions = { 'l': actionName };
|
|
31
|
+
client.registerAction(actionName, async () => {
|
|
32
|
+
try {
|
|
33
|
+
const result = await configChooser.getList();
|
|
34
|
+
if ((0, checks_1.isString)(result)) {
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'h': result.header,
|
|
39
|
+
'r': result.rows.map(({ icon, id, values }) => ({ 'i': icon, 'd': id, 'l': values })),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (error) { }
|
|
43
|
+
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
22
46
|
const getMultipleSheetsForSpreadsheetDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
23
47
|
client.registerAction(getMultipleSheetsForSpreadsheetDetailsActionName, async (message) => {
|
|
24
48
|
try {
|
|
@@ -39,7 +63,7 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
39
63
|
'li': spreadsheetIntegration.labelIconUrl,
|
|
40
64
|
'dc': spreadsheetIntegration.dataConnectorName,
|
|
41
65
|
'c': spreadsheetIntegration.addCardsIntegration,
|
|
42
|
-
'gs':
|
|
66
|
+
'gs': configChooserActions,
|
|
43
67
|
'gm': getMultipleSheetsForSpreadsheetDetailsActionName,
|
|
44
68
|
};
|
|
45
69
|
client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized);
|