lucid-extension-sdk 0.0.336 → 0.0.338
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 +11 -0
- package/core/data/fieldtypedefinition/lucidfields.d.ts +2 -0
- package/core/data/fieldtypedefinition/lucidfields.js +2 -0
- package/core/data/serializedfield/lucidfielddefaults.d.ts +18 -0
- package/core/data/serializedfield/lucidfielddefaults.js +39 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +23 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +27 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -964,8 +964,19 @@ export type AddSpreadsheetIntegrationQuery = {
|
|
|
964
964
|
};
|
|
965
965
|
/** getMultipleSheetsForSpreadsheetDetails */
|
|
966
966
|
'gm': string;
|
|
967
|
+
/** IconConfiguration */
|
|
968
|
+
'icu'?: {
|
|
969
|
+
/** Primary Icon Url */
|
|
970
|
+
'pi': string;
|
|
971
|
+
/** Light Icon URl */
|
|
972
|
+
'li'?: string;
|
|
973
|
+
/** Dark Icon URl */
|
|
974
|
+
'di'?: string;
|
|
975
|
+
} | undefined;
|
|
967
976
|
/** addCardsIntegration */
|
|
968
977
|
'c'?: boolean;
|
|
978
|
+
/** getUpstreamSourceUrl */
|
|
979
|
+
'gu'?: string;
|
|
969
980
|
};
|
|
970
981
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
971
982
|
export type AddSpreadsheetIntegrationResult = undefined;
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Lucid Fields.
|
|
15
15
|
* Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
|
|
16
16
|
* Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
|
|
17
|
+
*
|
|
18
|
+
* Must be kept in sync with src/jvm/com/lucidchart/data/model/fielddefinition/LucidFields.scala
|
|
17
19
|
*/
|
|
18
20
|
export declare enum LucidFields {
|
|
19
21
|
/**
|
|
@@ -18,6 +18,8 @@ const validators_1 = require("../../validators/validators");
|
|
|
18
18
|
* Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Lucid Fields.
|
|
19
19
|
* Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
|
|
20
20
|
* Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
|
|
21
|
+
*
|
|
22
|
+
* Must be kept in sync with src/jvm/com/lucidchart/data/model/fielddefinition/LucidFields.scala
|
|
21
23
|
*/
|
|
22
24
|
var LucidFields;
|
|
23
25
|
(function (LucidFields) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LucidFields } from '../fieldtypedefinition/lucidfields';
|
|
2
|
+
export type SerializedLucidFieldDefaults = {
|
|
3
|
+
[key in LucidFields]?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const isSerializedLucidFieldDefaults: (defaults: any) => defaults is SerializedLucidFieldDefaults;
|
|
6
|
+
export declare function serializeLucidFieldDefaults(defaults: LucidFieldDefaults): SerializedLucidFieldDefaults;
|
|
7
|
+
export type LucidFieldDefaults = Map<LucidFields, string>;
|
|
8
|
+
export declare function isLucidFieldDefaults(data: any): data is LucidFieldDefaults;
|
|
9
|
+
export declare class LucidFieldDefaultsFactory {
|
|
10
|
+
static deserializeLucidFieldDefaults(serializeDefaults: SerializedLucidFieldDefaults): LucidFieldDefaults;
|
|
11
|
+
/**
|
|
12
|
+
* Merge two LucidFieldDefaults together, with `first` taking precedence over `second`.
|
|
13
|
+
* @param first prioritized defaults
|
|
14
|
+
* @param second secondary defaults to be merged
|
|
15
|
+
* @returns merged LucidFieldDefaults
|
|
16
|
+
*/
|
|
17
|
+
static merge(first: LucidFieldDefaults, second: LucidFieldDefaults): LucidFieldDefaults;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LucidFieldDefaultsFactory = exports.isLucidFieldDefaults = exports.serializeLucidFieldDefaults = exports.isSerializedLucidFieldDefaults = void 0;
|
|
4
|
+
const checks_1 = require("../../checks");
|
|
5
|
+
const lucidfields_1 = require("../fieldtypedefinition/lucidfields");
|
|
6
|
+
exports.isSerializedLucidFieldDefaults = (0, checks_1.isRecord)(checks_1.isString);
|
|
7
|
+
function serializeLucidFieldDefaults(defaults) {
|
|
8
|
+
const res = {};
|
|
9
|
+
for (const [key, value] of defaults.entries()) {
|
|
10
|
+
res[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
exports.serializeLucidFieldDefaults = serializeLucidFieldDefaults;
|
|
15
|
+
function isLucidFieldDefaults(data) {
|
|
16
|
+
return data instanceof Map && [...data.keys()].every((key) => key in lucidfields_1.LucidFields);
|
|
17
|
+
}
|
|
18
|
+
exports.isLucidFieldDefaults = isLucidFieldDefaults;
|
|
19
|
+
class LucidFieldDefaultsFactory {
|
|
20
|
+
static deserializeLucidFieldDefaults(serializeDefaults) {
|
|
21
|
+
const res = new Map();
|
|
22
|
+
for (const [key, value] of Object.entries(serializeDefaults)) {
|
|
23
|
+
if ((0, lucidfields_1.isLucidFields)(key)) {
|
|
24
|
+
res.set(key, value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Merge two LucidFieldDefaults together, with `first` taking precedence over `second`.
|
|
31
|
+
* @param first prioritized defaults
|
|
32
|
+
* @param second secondary defaults to be merged
|
|
33
|
+
* @returns merged LucidFieldDefaults
|
|
34
|
+
*/
|
|
35
|
+
static merge(first, second) {
|
|
36
|
+
return new Map([...second.entries(), ...first.entries()]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.LucidFieldDefaultsFactory = LucidFieldDefaultsFactory;
|
|
@@ -49,9 +49,32 @@ export declare class CustomDetailsChooser {
|
|
|
49
49
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
50
50
|
export declare abstract class LucidSpreadsheetIntegration {
|
|
51
51
|
abstract labelDescription: string;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use iconConfiguration.primaryIconUrl.
|
|
54
|
+
*/
|
|
52
55
|
abstract labelIconUrl: string;
|
|
56
|
+
iconConfiguration?: {
|
|
57
|
+
/**
|
|
58
|
+
* URL for the primary icon to display in most components, usually on a white background.
|
|
59
|
+
* Should be at least 24x24.
|
|
60
|
+
*/
|
|
61
|
+
primaryIconUrl: string;
|
|
62
|
+
/**
|
|
63
|
+
* Optional. URL for an alternate light icon to show in colored components where the primary icon may appear too dark.
|
|
64
|
+
* If not provided, the primaryIconUrl will be used. Should be at least 24x24.
|
|
65
|
+
*/
|
|
66
|
+
lightIconUrl?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Optional. URL for an alternate dark icon to show in colored components where the primary icon may appear too light.
|
|
69
|
+
* If not provided, the primaryIconUrl will be used. Should be at least 24x24.
|
|
70
|
+
*/
|
|
71
|
+
darkIconUrl?: string;
|
|
72
|
+
};
|
|
53
73
|
abstract dataConnectorName: string;
|
|
54
74
|
addCardsIntegration: boolean;
|
|
55
75
|
abstract configChooser: ListChooser | CustomDetailsChooser;
|
|
56
76
|
abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: string): Promise<Map<string, string> | LucidSpreadsheetIntegrationFailureType>;
|
|
77
|
+
getUpstreamSourceUrl?(spreadsheetDetails: string, sheetId: string): Promise<{
|
|
78
|
+
url: string;
|
|
79
|
+
} | LucidSpreadsheetIntegrationFailureType>;
|
|
57
80
|
}
|
|
@@ -66,6 +66,33 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
66
66
|
'gs': configChooserActions,
|
|
67
67
|
'gm': getMultipleSheetsForSpreadsheetDetailsActionName,
|
|
68
68
|
};
|
|
69
|
+
if (spreadsheetIntegration.iconConfiguration) {
|
|
70
|
+
serialized['icu'] = {
|
|
71
|
+
'pi': spreadsheetIntegration.iconConfiguration.primaryIconUrl,
|
|
72
|
+
'li': spreadsheetIntegration.iconConfiguration.lightIconUrl,
|
|
73
|
+
'di': spreadsheetIntegration.iconConfiguration.darkIconUrl,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (spreadsheetIntegration.getUpstreamSourceUrl) {
|
|
77
|
+
const getUpstreamSourceUrl = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
78
|
+
client.registerAction(getUpstreamSourceUrl, async (message) => {
|
|
79
|
+
try {
|
|
80
|
+
if (!spreadsheetIntegration.getUpstreamSourceUrl) {
|
|
81
|
+
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
82
|
+
}
|
|
83
|
+
const result = await spreadsheetIntegration.getUpstreamSourceUrl(message['spreadsheetDetails'], message['sheetId']);
|
|
84
|
+
if ((0, lucidspreadsheetintegration_1.lucidSpreadsheetIntegrationFailureTypeValidator)(result)) {
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return result.url;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) { }
|
|
92
|
+
return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
|
|
93
|
+
});
|
|
94
|
+
serialized['gu'] = getUpstreamSourceUrl;
|
|
95
|
+
}
|
|
69
96
|
client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized);
|
|
70
97
|
}
|
|
71
98
|
}
|