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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.136",
3
+ "version": "0.0.138",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -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
- /** name */
606
- 'n': string;
607
- /** label */
608
- 'l': string;
609
- /** iconUrl */
610
- 'iu': string;
611
- /** getSpreadsheetToImportDetails */
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
- /** getPreviewData */
616
- 'gp': string;
617
- /** importSheets */
618
- 'i': string;
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 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, sheetsToPreview: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>;
19
- abstract importSheets(spreadsheetDetails: CONFIG, sheetsConfig: {
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 getSpreadsheetToImportDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
15
- client.registerAction(getSpreadsheetToImportDetailsActionName, async () => {
14
+ const getSpreadsheetDetailsToImportActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
15
+ client.registerAction(getSpreadsheetDetailsToImportActionName, async () => {
16
16
  try {
17
- return await spreadsheetIntegration.getSpreadsheetToImportDetails();
17
+ return await spreadsheetIntegration.getSpreadsheetDetailsToImport();
18
18
  }
19
19
  catch (error) { }
20
20
  return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
21
21
  });
22
- const getSpreadsheetSheetIdsAndNamesActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
23
- client.registerAction(getSpreadsheetSheetIdsAndNamesActionName, async (message) => {
22
+ const getMultipleSheetsForSpreadsheetDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
23
+ client.registerAction(getMultipleSheetsForSpreadsheetDetailsActionName, async (message) => {
24
24
  try {
25
- const result = await spreadsheetIntegration.getSpreadsheetSheetIdsAndNames(message['dataDetails']);
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 getPreviewDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
38
- client.registerAction(getPreviewDataActionName, async (message) => {
37
+ const getSpreadsheetDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
38
+ client.registerAction(getSpreadsheetDataActionName, async (message) => {
39
39
  try {
40
- return await spreadsheetIntegration.getPreviewData(message['dataDetails'], message['sheets']);
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 importSheetsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
46
- client.registerAction(importSheetsActionName, async (message) => {
47
- try {
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
- 'n': spreadsheetIntegration.name,
55
- 'l': spreadsheetIntegration.label,
56
- 'iu': spreadsheetIntegration.iconUrl,
57
- 'gd': getSpreadsheetToImportDetailsActionName,
58
- 'gs': getSpreadsheetSheetIdsAndNamesActionName,
59
- 'gp': getPreviewDataActionName,
60
- 'i': importSheetsActionName,
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 declare type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition;
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');