lucid-extension-sdk 0.0.292 → 0.0.294

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 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 */
@@ -97,6 +97,10 @@ export declare const isSerializedMillisecondsDateObject: (subject: unknown) => s
97
97
  ms: typeof isNumber;
98
98
  isDateOnly: (x: unknown) => x is boolean | undefined;
99
99
  }>;
100
+ export declare const isSerializedIsoDateObject: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
101
+ isoDate: typeof isString;
102
+ displayTimezone: (x: unknown) => x is string | null | undefined;
103
+ }>;
100
104
  export declare const isSerializedLucidDateObject: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
101
105
  ms: typeof isNumber;
102
106
  isDateOnly: (x: unknown) => x is boolean | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedTimeObject = exports.isSerializedLucidDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
3
+ exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedTimeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
4
4
  const checks_1 = require("../../checks");
5
5
  const validators_1 = require("../../validators/validators");
6
6
  function isSerializedColorObjectFieldType(value) {
@@ -24,11 +24,11 @@ exports.isSerializedMillisecondsDateObject = (0, validators_1.objectValidator)({
24
24
  'ms': checks_1.isNumber,
25
25
  'isDateOnly': (0, validators_1.option)(checks_1.isBoolean),
26
26
  });
27
- const isSerializedIsoDateObject = (0, validators_1.objectValidator)({
27
+ exports.isSerializedIsoDateObject = (0, validators_1.objectValidator)({
28
28
  'isoDate': checks_1.isString,
29
29
  'displayTimezone': (0, validators_1.nullableOption)(checks_1.isString),
30
30
  });
31
- exports.isSerializedLucidDateObject = (0, validators_1.either)(exports.isSerializedMillisecondsDateObject, isSerializedIsoDateObject);
31
+ exports.isSerializedLucidDateObject = (0, validators_1.either)(exports.isSerializedMillisecondsDateObject, exports.isSerializedIsoDateObject);
32
32
  exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
33
33
  'hours': checks_1.isNumber,
34
34
  'minutes': (0, validators_1.option)(checks_1.isNumber),
@@ -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 abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable> {
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 getSpreadsheetDetailsToImport(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
30
- abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>;
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<CONFIG extends JsonSerializable, SHEET extends JsonSerializable>(client: EditorClient, spreadsheetIntegration: LucidSpreadsheetIntegration<CONFIG, SHEET>): void;
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
- const getSpreadsheetDetailsToImportActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
15
- client.registerAction(getSpreadsheetDetailsToImportActionName, async () => {
16
- try {
17
- return await spreadsheetIntegration.getSpreadsheetDetailsToImport();
18
- }
19
- catch (error) { }
20
- return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
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': getSpreadsheetDetailsToImportActionName,
66
+ 'gs': configChooserActions,
43
67
  'gm': getMultipleSheetsForSpreadsheetDetailsActionName,
44
68
  };
45
69
  client.sendCommand("asi" /* CommandName.AddSpreadsheetIntegration */, serialized);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.292",
3
+ "version": "0.0.294",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",