lucid-extension-sdk 0.0.121 → 0.0.122
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 +24 -0
- package/sdk/commandtypes.js +1 -0
- package/sdk/core/checks.d.ts +6 -0
- package/sdk/core/checks.js +10 -1
- package/sdk/core/data/datasource/datasourcetype.d.ts +1 -1
- package/sdk/core/data/datasource/datasourcetype.js +1 -1
- package/sdk/core/data/datasource/metadatatypes.d.ts +1 -1
- package/sdk/core/data/datasource/metadatatypes.js +1 -1
- package/sdk/core/data/datasource/serializeddatasourceproperties.d.ts +1 -1
- package/sdk/core/data/datasource/serializedimporteddatasource.d.ts +3 -3
- package/sdk/core/data/datasource/serializedupstreamconfig.d.ts +1 -1
- package/sdk/core/data/datasource/upstreampatchtype.d.ts +1 -1
- package/sdk/core/data/datasource/upstreampatchtype.js +1 -1
- package/sdk/core/data/datasource/upstreamupdatetype.d.ts +1 -1
- package/sdk/core/data/datasource/upstreamupdatetype.js +1 -1
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +20 -0
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegration.js +17 -0
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.d.ts +11 -0
- package/sdk/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +53 -0
- package/sdk/index.d.ts +2 -0
- package/sdk/index.js +2 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const enum CommandName {
|
|
|
24
24
|
AddLineTextArea = "alta",
|
|
25
25
|
AddMenuItem = "ami",
|
|
26
26
|
AddShapeData = "asd",
|
|
27
|
+
AddSpreadsheetIntegration = "asi",
|
|
27
28
|
Alert = "a",
|
|
28
29
|
AnimateViewport = "av",
|
|
29
30
|
AwaitImport = "ai",
|
|
@@ -136,6 +137,10 @@ export declare type CommandArgs = {
|
|
|
136
137
|
query: AddShapeDataQuery;
|
|
137
138
|
result: AddShapeDataResult;
|
|
138
139
|
};
|
|
140
|
+
[CommandName.AddSpreadsheetIntegration]: {
|
|
141
|
+
query: AddSpreadsheetIntegrationQuery;
|
|
142
|
+
result: AddSpreadsheetIntegrationResult;
|
|
143
|
+
};
|
|
139
144
|
[CommandName.Alert]: {
|
|
140
145
|
query: AlertQuery;
|
|
141
146
|
result: AlertResult;
|
|
@@ -576,6 +581,25 @@ export declare type AddShapeDataQuery = {
|
|
|
576
581
|
'v'?: SerializedFieldType;
|
|
577
582
|
};
|
|
578
583
|
export declare type AddShapeDataResult = undefined;
|
|
584
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
585
|
+
export declare type AddSpreadsheetIntegrationQuery = {
|
|
586
|
+
/** name */
|
|
587
|
+
'n': string;
|
|
588
|
+
/** label */
|
|
589
|
+
'l': string;
|
|
590
|
+
/** iconUrl */
|
|
591
|
+
'iu': string;
|
|
592
|
+
/** getSpreadsheetToImportDetails */
|
|
593
|
+
'gd': string;
|
|
594
|
+
/** getSpreadsheetSheetIdsAndNames */
|
|
595
|
+
'gs': string;
|
|
596
|
+
/** getPreviewData */
|
|
597
|
+
'gp': string;
|
|
598
|
+
/** importSheets */
|
|
599
|
+
'i': string;
|
|
600
|
+
};
|
|
601
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
602
|
+
export declare type AddSpreadsheetIntegrationResult = undefined;
|
|
579
603
|
export declare type AlertQuery = {
|
|
580
604
|
/** Title; defaults to extension title */
|
|
581
605
|
't'?: string | undefined;
|
package/sdk/commandtypes.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.commandTitles = new Map([
|
|
|
8
8
|
["alta" /* CommandName.AddLineTextArea */, 'AddLineTextArea'],
|
|
9
9
|
["ami" /* CommandName.AddMenuItem */, 'AddMenuItem'],
|
|
10
10
|
["asd" /* CommandName.AddShapeData */, 'AddShapeData'],
|
|
11
|
+
["asi" /* CommandName.AddSpreadsheetIntegration */, 'AddSpreadsheetIntegration'],
|
|
11
12
|
["a" /* CommandName.Alert */, 'Alert'],
|
|
12
13
|
["av" /* CommandName.AnimateViewport */, 'AnimateViewport'],
|
|
13
14
|
["ai" /* CommandName.AwaitImport */, 'AwaitImport'],
|
package/sdk/core/checks.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ export declare function isNull(val: unknown): val is null;
|
|
|
17
17
|
* @return Whether variable is undefined.
|
|
18
18
|
*/
|
|
19
19
|
export declare function isUndefined(val: unknown): val is undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if the specified value is undefined.
|
|
22
|
+
* @param val Variable to test.
|
|
23
|
+
* @return Whether variable is undefined.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isVoid(x: unknown): x is void;
|
|
20
26
|
/**
|
|
21
27
|
* Returns true if the specified value is defined and not null.
|
|
22
28
|
* @param val Variable to test.
|
package/sdk/core/checks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
3
|
+
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInfinite = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isVoid = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if the specified value is not undefined.
|
|
6
6
|
*
|
|
@@ -29,6 +29,15 @@ function isUndefined(val) {
|
|
|
29
29
|
return val === undefined;
|
|
30
30
|
}
|
|
31
31
|
exports.isUndefined = isUndefined;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if the specified value is undefined.
|
|
34
|
+
* @param val Variable to test.
|
|
35
|
+
* @return Whether variable is undefined.
|
|
36
|
+
*/
|
|
37
|
+
function isVoid(x) {
|
|
38
|
+
return x === undefined;
|
|
39
|
+
}
|
|
40
|
+
exports.isVoid = isVoid;
|
|
32
41
|
/**
|
|
33
42
|
* Returns true if the specified value is defined and not null.
|
|
34
43
|
* @param val Variable to test.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataSourceType = void 0;
|
|
4
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
4
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
5
|
var DataSourceType;
|
|
6
6
|
(function (DataSourceType) {
|
|
7
7
|
DataSourceType[DataSourceType["GoogleSheets"] = 0] = "GoogleSheets";
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MetadataTypes = void 0;
|
|
4
4
|
// Google Sheets has both notes and comments, we store notes in the comment metadata collection. Comments are not
|
|
5
5
|
// meant to be permanent in Google Sheets whereas they are in Excel, resulting in some confusion with our naming.
|
|
6
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
6
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
7
7
|
var MetadataTypes;
|
|
8
8
|
(function (MetadataTypes) {
|
|
9
9
|
MetadataTypes["Format"] = "Format";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedUpstreamConfig } from './serializedupstreamconfig';
|
|
2
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
2
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
3
3
|
export interface SerializedDataSourceProperties {
|
|
4
4
|
'Name': string;
|
|
5
5
|
'UpstreamConfig'?: SerializedUpstreamConfig | null | undefined;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SerializedDataItems } from '../serializedfield/serializeddataitems';
|
|
2
2
|
import { SerializedSchema } from '../serializedfield/serializedschema';
|
|
3
3
|
import { SerializedDataSourceProperties } from './serializeddatasourceproperties';
|
|
4
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
4
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
5
|
export interface SerializedImportedMetadataCollection {
|
|
6
6
|
'Name': string;
|
|
7
7
|
'Schema': SerializedSchema;
|
|
8
8
|
'Items': SerializedDataItems;
|
|
9
9
|
}
|
|
10
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
10
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
11
11
|
export interface SerializedImportedCollection {
|
|
12
12
|
'Name': string;
|
|
13
13
|
'Schema': SerializedSchema;
|
|
@@ -19,7 +19,7 @@ export interface SerializedImportedCollection {
|
|
|
19
19
|
[key: string]: SerializedImportedMetadataCollection;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
22
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
23
23
|
export interface SerializedImportedDataSource {
|
|
24
24
|
'Properties': SerializedDataSourceProperties;
|
|
25
25
|
'Collections': SerializedImportedCollection[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataSourceType } from './datasourcetype';
|
|
2
2
|
import { UpstreamPatchType } from './upstreampatchtype';
|
|
3
3
|
import { UpstreamUpdateType } from './upstreamupdatetype';
|
|
4
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
4
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
5
|
export interface SerializedUpstreamConfig {
|
|
6
6
|
'SourceType': DataSourceType;
|
|
7
7
|
'UpdateType': UpstreamUpdateType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpstreamPatchType = void 0;
|
|
4
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
4
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
5
|
var UpstreamPatchType;
|
|
6
6
|
(function (UpstreamPatchType) {
|
|
7
7
|
UpstreamPatchType[UpstreamPatchType["NONE"] = 0] = "NONE";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpstreamUpdateType = void 0;
|
|
4
|
-
/** @ignore until spreadsheet integration is ready for launch */
|
|
4
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
5
5
|
var UpstreamUpdateType;
|
|
6
6
|
(function (UpstreamUpdateType) {
|
|
7
7
|
UpstreamUpdateType[UpstreamUpdateType["NONE"] = 0] = "NONE";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CollectionProxy } from '../../data/collectionproxy';
|
|
2
|
+
import { SerializedImportedDataSource } from '../data/datasource/serializedimporteddatasource';
|
|
3
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
4
|
+
export declare enum LucidSpreadsheetIntegrationFailureType {
|
|
5
|
+
AuthorizationFailure = "AuthorizationFailure",
|
|
6
|
+
GenericFailure = "GenericFailure",
|
|
7
|
+
UserCancelled = "UserCanceled"
|
|
8
|
+
}
|
|
9
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
10
|
+
export declare const lucidSpreadsheetIntegrationFailureTypeValidator: (x: unknown) => x is LucidSpreadsheetIntegrationFailureType;
|
|
11
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
12
|
+
export declare abstract class LucidSpreadsheetIntegration<CONFIG, SHEET> {
|
|
13
|
+
abstract name: string;
|
|
14
|
+
abstract label: string;
|
|
15
|
+
abstract iconUrl: string;
|
|
16
|
+
abstract getSpreadsheetToImportDetails: () => Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
|
|
17
|
+
abstract getSpreadsheetSheetIdsAndNames(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>;
|
|
18
|
+
abstract getPreviewData(spreadsheetDetails: CONFIG, sheetIdsToPreview: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>;
|
|
19
|
+
abstract importSheets(spreadsheetDetails: CONFIG, sheetIdsToImport: SHEET[]): Promise<CollectionProxy[] | LucidSpreadsheetIntegrationFailureType>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LucidSpreadsheetIntegration = exports.lucidSpreadsheetIntegrationFailureTypeValidator = exports.LucidSpreadsheetIntegrationFailureType = void 0;
|
|
4
|
+
const validators_1 = require("../validators/validators");
|
|
5
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
6
|
+
var LucidSpreadsheetIntegrationFailureType;
|
|
7
|
+
(function (LucidSpreadsheetIntegrationFailureType) {
|
|
8
|
+
LucidSpreadsheetIntegrationFailureType["AuthorizationFailure"] = "AuthorizationFailure";
|
|
9
|
+
LucidSpreadsheetIntegrationFailureType["GenericFailure"] = "GenericFailure";
|
|
10
|
+
LucidSpreadsheetIntegrationFailureType["UserCancelled"] = "UserCanceled";
|
|
11
|
+
})(LucidSpreadsheetIntegrationFailureType = exports.LucidSpreadsheetIntegrationFailureType || (exports.LucidSpreadsheetIntegrationFailureType = {}));
|
|
12
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
13
|
+
exports.lucidSpreadsheetIntegrationFailureTypeValidator = (0, validators_1.stringEnumValidator)(LucidSpreadsheetIntegrationFailureType);
|
|
14
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
15
|
+
class LucidSpreadsheetIntegration {
|
|
16
|
+
}
|
|
17
|
+
exports.LucidSpreadsheetIntegration = LucidSpreadsheetIntegration;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditorClient } from '../../editorclient';
|
|
2
|
+
import { LucidSpreadsheetIntegration } from './lucidspreadsheetintegration';
|
|
3
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
4
|
+
export declare class LucidSpreadsheetIntegrationRegistry {
|
|
5
|
+
private static nextHookId;
|
|
6
|
+
private static nextHookName;
|
|
7
|
+
/**
|
|
8
|
+
* Register a spreadsheet integration.
|
|
9
|
+
*/
|
|
10
|
+
static addSpreadsheetIntegration<CONFIG, SHEET>(client: EditorClient, spreadsheetIntegration: LucidSpreadsheetIntegration<CONFIG, SHEET>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LucidSpreadsheetIntegrationRegistry = void 0;
|
|
4
|
+
const lucidspreadsheetintegration_1 = require("./lucidspreadsheetintegration");
|
|
5
|
+
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
6
|
+
class LucidSpreadsheetIntegrationRegistry {
|
|
7
|
+
static nextHookName() {
|
|
8
|
+
return '__lucidspreadsheet__hook' + this.nextHookId++;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Register a spreadsheet integration.
|
|
12
|
+
*/
|
|
13
|
+
static addSpreadsheetIntegration(client, spreadsheetIntegration) {
|
|
14
|
+
const getSpreadsheetToImportDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
15
|
+
client.registerAction(getSpreadsheetToImportDetailsActionName, async () => {
|
|
16
|
+
const result = await spreadsheetIntegration.getSpreadsheetToImportDetails();
|
|
17
|
+
return result;
|
|
18
|
+
});
|
|
19
|
+
const getSpreadsheetSheetIdsAndNamesActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
20
|
+
client.registerAction(getSpreadsheetSheetIdsAndNamesActionName, async (message) => {
|
|
21
|
+
const result = await spreadsheetIntegration.getSpreadsheetSheetIdsAndNames(message['dataDetails']);
|
|
22
|
+
if ((0, lucidspreadsheetintegration_1.lucidSpreadsheetIntegrationFailureTypeValidator)(result)) {
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Serialize the Map
|
|
27
|
+
return Array.from(result);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const getPreviewDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
31
|
+
client.registerAction(getPreviewDataActionName, async (message) => {
|
|
32
|
+
const result = await spreadsheetIntegration.getPreviewData(message['dataDetails'], message['sheetIds']);
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
35
|
+
const importSheetsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
36
|
+
client.registerAction(importSheetsActionName, async (message) => {
|
|
37
|
+
const result = await spreadsheetIntegration.importSheets(message['dataDetails'], message['sheetIds']);
|
|
38
|
+
return result;
|
|
39
|
+
});
|
|
40
|
+
const serialized = {
|
|
41
|
+
'n': spreadsheetIntegration.name,
|
|
42
|
+
'l': spreadsheetIntegration.label,
|
|
43
|
+
'iu': spreadsheetIntegration.iconUrl,
|
|
44
|
+
'gd': getSpreadsheetToImportDetailsActionName,
|
|
45
|
+
'gs': getSpreadsheetSheetIdsAndNamesActionName,
|
|
46
|
+
'gp': getPreviewDataActionName,
|
|
47
|
+
'i': importSheetsActionName,
|
|
48
|
+
};
|
|
49
|
+
client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.LucidSpreadsheetIntegrationRegistry = LucidSpreadsheetIntegrationRegistry;
|
|
53
|
+
LucidSpreadsheetIntegrationRegistry.nextHookId = 0;
|
package/sdk/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export * from './core/properties/fillcolor';
|
|
|
43
43
|
export * from './core/properties/shadow';
|
|
44
44
|
export * from './core/serializeddataerror';
|
|
45
45
|
export * from './core/shapedatainheritance';
|
|
46
|
+
export * from './core/spreadsheetintegration/lucidspreadsheetintegration';
|
|
47
|
+
export * from './core/spreadsheetintegration/lucidspreadsheetintegrationregistry';
|
|
46
48
|
export * from './core/unfurl/unfurlcallbacks';
|
|
47
49
|
export * from './core/unfurl/unfurldetails';
|
|
48
50
|
export * from './core/unfurl/unfurliframe';
|
package/sdk/index.js
CHANGED
|
@@ -59,6 +59,8 @@ __exportStar(require("./core/properties/fillcolor"), exports);
|
|
|
59
59
|
__exportStar(require("./core/properties/shadow"), exports);
|
|
60
60
|
__exportStar(require("./core/serializeddataerror"), exports);
|
|
61
61
|
__exportStar(require("./core/shapedatainheritance"), exports);
|
|
62
|
+
__exportStar(require("./core/spreadsheetintegration/lucidspreadsheetintegration"), exports);
|
|
63
|
+
__exportStar(require("./core/spreadsheetintegration/lucidspreadsheetintegrationregistry"), exports);
|
|
62
64
|
__exportStar(require("./core/unfurl/unfurlcallbacks"), exports);
|
|
63
65
|
__exportStar(require("./core/unfurl/unfurldetails"), exports);
|
|
64
66
|
__exportStar(require("./core/unfurl/unfurliframe"), exports);
|