lucid-extension-sdk 0.0.124 → 0.0.126

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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/sdk/commandtypes.d.ts +17 -0
  3. package/sdk/commandtypes.js +1 -0
  4. package/sdk/core/cardintegration/cardintegrationconfig.d.ts +8 -1
  5. package/sdk/core/cardintegration/cardintegrationconfig.js +2 -0
  6. package/sdk/core/cardintegration/cardintegrationdefinitions.d.ts +3 -7
  7. package/sdk/core/cardintegration/cardintegrationdefinitions.js +2 -6
  8. package/sdk/core/cardintegration/lucidcardintegration.d.ts +7 -0
  9. package/sdk/core/cardintegration/lucidcardintegrationregistry.js +1 -0
  10. package/sdk/core/data/datasource/serializeddatasourceproperties.d.ts +11 -0
  11. package/sdk/core/data/datasource/serializeddatasourceproperties.js +9 -0
  12. package/sdk/core/data/datasource/serializedimporteddatasource.d.ts +44 -2
  13. package/sdk/core/data/datasource/serializedimporteddatasource.js +25 -0
  14. package/sdk/core/data/datasource/serializedupstreamconfig.d.ts +8 -0
  15. package/sdk/core/data/datasource/serializedupstreamconfig.js +13 -0
  16. package/sdk/core/data/serializedfield/serializedfielddefinition.d.ts +23 -8
  17. package/sdk/core/data/serializedfield/serializedfielddefinition.js +15 -1
  18. package/sdk/core/data/serializedfield/serializedschema.d.ts +1 -0
  19. package/sdk/core/data/serializedfield/serializedschema.js +21 -0
  20. package/sdk/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +9 -5
  21. package/sdk/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.d.ts +2 -1
  22. package/sdk/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +26 -13
  23. package/sdk/editorclient.d.ts +2 -0
  24. package/sdk/editorclient.js +7 -0
  25. package/sdk/ui/panel.d.ts +2 -0
  26. package/sdk/ui/panel.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.124",
3
+ "version": "0.0.126",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -27,6 +27,7 @@ export declare const enum CommandName {
27
27
  AddSpreadsheetIntegration = "asi",
28
28
  Alert = "a",
29
29
  AnimateViewport = "av",
30
+ AwaitDataSourceImport = "adi",
30
31
  AwaitImport = "ai",
31
32
  Bootstrap = "b",
32
33
  CancelDragBlockToCanvas = "cdc",
@@ -149,6 +150,10 @@ export declare type CommandArgs = {
149
150
  query: AnimateViewportQuery;
150
151
  result: AnimateViewportResult;
151
152
  };
153
+ [CommandName.AwaitDataSourceImport]: {
154
+ query: AwaitDataSourceImportQuery;
155
+ result: AwaitDataSourceImportResult;
156
+ };
152
157
  [CommandName.AwaitImport]: {
153
158
  query: AwaitImportQuery;
154
159
  result: AwaitImportResult;
@@ -501,6 +506,8 @@ export declare type AddCardIntegrationQuery = {
501
506
  'isl': string;
502
507
  /** Icon url */
503
508
  'u': string;
509
+ /** Text style */
510
+ 'ts'?: Partial<TextStyle> | undefined;
504
511
  /** Field configuration */
505
512
  'fc': {
506
513
  /** Callback to get field definitions for all fields supported by the card integration */
@@ -610,6 +617,14 @@ export declare type AlertQuery = {
610
617
  };
611
618
  /** True if they click OK, false otherwise */
612
619
  export declare type AlertResult = Promise<boolean>;
620
+ export declare type AwaitDataSourceImportQuery = {
621
+ /** Data Connector Name */
622
+ 'n': string;
623
+ /** Sync data source ID Nonce */
624
+ 's': string;
625
+ };
626
+ /** Promise resolving to the data source ID where the data arrived */
627
+ export declare type AwaitDataSourceImportResult = Promise<string>;
613
628
  export declare type AwaitImportQuery = {
614
629
  /** Data Connector Name */
615
630
  'n': string;
@@ -991,6 +1006,8 @@ export declare type RegisterPanelQuery = {
991
1006
  'i': string;
992
1007
  /** tooltip */
993
1008
  'to'?: string;
1009
+ /** If true, we will persist the panel's iframe */
1010
+ 'p'?: boolean;
994
1011
  };
995
1012
  export declare type RegisterPanelResult = undefined;
996
1013
  export declare type RegisterUnfurlQuery = {
@@ -11,6 +11,7 @@ exports.commandTitles = new Map([
11
11
  ["asi" /* CommandName.AddSpreadsheetIntegration */, 'AddSpreadsheetIntegration'],
12
12
  ["a" /* CommandName.Alert */, 'Alert'],
13
13
  ["av" /* CommandName.AnimateViewport */, 'AnimateViewport'],
14
+ ["adi" /* CommandName.AwaitDataSourceImport */, 'AwaitDataSourceImport'],
14
15
  ["ai" /* CommandName.AwaitImport */, 'AwaitImport'],
15
16
  ["b" /* CommandName.Bootstrap */, 'Bootstrap'],
16
17
  ["ceps" /* CommandName.CanEditPackageSettings */, 'CanEditPackageSettings'],
@@ -1,3 +1,4 @@
1
+ import { TextStyle } from '../../document/text/textstyle';
1
2
  import { LucidCardFieldDisplaySettings, SerializedLucidCardFieldDisplaySettings } from './cardfielddisplaysettings';
2
3
  export interface CardIntegrationConfig {
3
4
  cardConfig: {
@@ -5,6 +6,11 @@ export interface CardIntegrationConfig {
5
6
  * The data fields to be displayed on cards, as data-linked text fields
6
7
  */
7
8
  fieldNames: string[];
9
+ /**
10
+ * The default text style to set on each of the above fields for new cards. Any style not specified
11
+ * will use a default value, and any field name not present will use all defaults.
12
+ */
13
+ fieldStyles?: Map<string, Partial<TextStyle>>;
8
14
  /**
9
15
  * The data fields to be displayed on cards as data graphics
10
16
  */
@@ -30,7 +36,8 @@ export interface CardIntegrationConfig {
30
36
  export declare type SerializedCardIntegrationConfig = {
31
37
  'cc': {
32
38
  'f': string[];
33
- 'fd'?: [string, SerializedLucidCardFieldDisplaySettings][];
39
+ 'fd'?: [string, SerializedLucidCardFieldDisplaySettings][] | undefined;
40
+ 'fs'?: [string, Partial<TextStyle>][] | undefined;
34
41
  'id'?: string | undefined;
35
42
  };
36
43
  'cdpc': {
@@ -13,6 +13,7 @@ function serializeCardIntegrationConfig(config) {
13
13
  (0, cardfielddisplaysettings_1.serializeLucidCardFieldDisplaySettings)(settings),
14
14
  ])
15
15
  : undefined,
16
+ 'fs': config.cardConfig.fieldStyles ? [...config.cardConfig.fieldStyles] : undefined,
16
17
  },
17
18
  'cdpc': {
18
19
  'f': config.cardDetailsPanelConfig.fields.map((field) => {
@@ -30,6 +31,7 @@ function deserializeCardIntegrationConfig(raw) {
30
31
  return {
31
32
  cardConfig: {
32
33
  fieldNames: raw['cc']['f'],
34
+ fieldStyles: raw['cc']['fs'] ? new Map(raw['cc']['fs']) : undefined,
33
35
  fieldDisplaySettings: raw['cc']['fd']
34
36
  ? new Map(raw['cc']['fd'].map(([key, settings]) => [
35
37
  key,
@@ -1,7 +1,7 @@
1
1
  import { FieldDefinition } from '../../data/schemadefinition';
2
2
  import { isString } from '../checks';
3
3
  import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
4
- import { FieldConstraintType, SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
4
+ import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
5
5
  import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfield/serializedfields';
6
6
  /** For fields with Option or ApiOption type, the label and value for each available option */
7
7
  export interface ExtensionCardFieldOption {
@@ -62,17 +62,13 @@ export declare const isSerializedFieldOptions: (p1: unknown) => p1 is import("..
62
62
  v: typeof isSerializedFieldType;
63
63
  i: (x: unknown) => x is string | undefined;
64
64
  }>[];
65
- export declare const isSerializedFieldConstraint: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
66
- Type: (x: unknown) => x is FieldConstraintType;
67
- Details: (x: unknown) => x is number | undefined;
68
- }>;
69
65
  /** @ignore */
70
66
  export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
71
67
  Name: typeof isString;
72
68
  Type: typeof isSerializedFieldTypeDefinition;
73
69
  Constraints: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
74
- Type: (x: unknown) => x is FieldConstraintType;
75
- Details: (x: unknown) => x is number | undefined;
70
+ Type: (x: unknown) => x is import("../data/serializedfield/serializedfielddefinition").FieldConstraintType;
71
+ Details: (x: unknown) => x is unknown;
76
72
  }>[] | undefined;
77
73
  l: typeof isString;
78
74
  d: (x: unknown) => x is string | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldConstraint = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0;
3
+ exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0;
4
4
  const schemadefinition_1 = require("../../data/schemadefinition");
5
5
  const checks_1 = require("../checks");
6
6
  const fieldtypedefinition_1 = require("../data/fieldtypedefinition/fieldtypedefinition");
@@ -42,15 +42,11 @@ exports.isSerializedFieldOption = (0, validators_1.objectValidator)({
42
42
  'i': (0, validators_1.option)(checks_1.isString),
43
43
  });
44
44
  exports.isSerializedFieldOptions = (0, validators_1.arrayValidator)(exports.isSerializedFieldOption);
45
- exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
46
- 'Type': (0, validators_1.enumValidator)(serializedfielddefinition_1.FieldConstraintType),
47
- 'Details': (0, validators_1.option)(checks_1.isNumber),
48
- });
49
45
  /** @ignore */
50
46
  exports.isSerializedExtensionCardFieldDefinition = (0, validators_1.objectValidator)({
51
47
  'Name': checks_1.isString,
52
48
  'Type': fieldtypedefinition_1.isSerializedFieldTypeDefinition,
53
- 'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
49
+ 'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(serializedfielddefinition_1.isSerializedFieldConstraint)),
54
50
  'l': checks_1.isString,
55
51
  'd': (0, validators_1.option)(checks_1.isString),
56
52
  'def': (0, validators_1.option)(serializedfields_1.isSerializedFieldType),
@@ -1,6 +1,7 @@
1
1
  import { CollectionDefinition } from '../../data/collectiondefinition';
2
2
  import { CollectionProxy } from '../../data/collectionproxy';
3
3
  import { DataSourceProxy } from '../../data/datasourceproxy';
4
+ import { TextStyle } from '../../document/text/textstyle';
4
5
  import { EditorClient } from '../../editorclient';
5
6
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
6
7
  import { CardIntegrationConfig } from './cardintegrationconfig';
@@ -29,6 +30,12 @@ export declare abstract class LucidCardIntegration {
29
30
  * The name of the data connector associated with the card integration.
30
31
  */
31
32
  abstract dataConnectorName: string;
33
+ /**
34
+ * The default text style to use on cards created as part of this integration.
35
+ * These can be overridden by values in getDefaultConfig().fieldStyles for
36
+ * individual fields that should have different styles.
37
+ */
38
+ textStyle?: Partial<TextStyle>;
32
39
  abstract fieldConfiguration: {
33
40
  /**
34
41
  * Callback to provide a list of all supported field names for the card integration.
@@ -60,6 +60,7 @@ class LucidCardIntegrationRegistry {
60
60
  'il': cardIntegration.itemLabel,
61
61
  'isl': cardIntegration.itemsLabel,
62
62
  'u': cardIntegration.iconUrl,
63
+ 'ts': cardIntegration.textStyle,
63
64
  'fc': {
64
65
  'gf': getFieldsActionName,
65
66
  'osfc': onSelectedFieldsChangeActionName,
@@ -1,6 +1,17 @@
1
+ import { isString } from '../../checks';
1
2
  import { SerializedUpstreamConfig } from './serializedupstreamconfig';
2
3
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
3
4
  export interface SerializedDataSourceProperties {
4
5
  'Name': string;
5
6
  'UpstreamConfig'?: SerializedUpstreamConfig | null | undefined;
6
7
  }
8
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
9
+ export declare const isSerializedDataSourceProperties: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
10
+ Name: typeof isString;
11
+ UpstreamConfig: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
12
+ SourceType: (x: unknown) => x is import("./datasourcetype").DataSourceType;
13
+ UpdateType: (x: unknown) => x is import("./upstreamupdatetype").UpstreamUpdateType;
14
+ PatchType: (x: unknown) => x is import("./upstreampatchtype").UpstreamPatchType | null | undefined;
15
+ SourceConfig: typeof import("../../checks").isObject;
16
+ }> | null | undefined;
17
+ }>;
@@ -1,2 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSerializedDataSourceProperties = void 0;
4
+ const checks_1 = require("../../checks");
5
+ const validators_1 = require("../../validators/validators");
6
+ const serializedupstreamconfig_1 = require("./serializedupstreamconfig");
7
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
8
+ exports.isSerializedDataSourceProperties = (0, validators_1.strictObjectValidator)({
9
+ 'Name': checks_1.isString,
10
+ 'UpstreamConfig': (0, validators_1.nullableOption)(serializedupstreamconfig_1.isSerializedUpstreamConfig),
11
+ });
@@ -1,5 +1,6 @@
1
- import { SerializedDataItems } from '../serializedfield/serializeddataitems';
2
- import { SerializedSchema } from '../serializedfield/serializedschema';
1
+ import { isObject, isString } from '../../checks';
2
+ import { isSerializedDataItems, SerializedDataItems } from '../serializedfield/serializeddataitems';
3
+ import { isSerializedSchema, SerializedSchema } from '../serializedfield/serializedschema';
3
4
  import { SerializedDataSourceProperties } from './serializeddatasourceproperties';
4
5
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
5
6
  export interface SerializedImportedMetadataCollection {
@@ -8,6 +9,12 @@ export interface SerializedImportedMetadataCollection {
8
9
  'Items': SerializedDataItems;
9
10
  }
10
11
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
12
+ export declare const isSerializedImportedMetadataCollection: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
13
+ Name: typeof isString;
14
+ Schema: typeof isSerializedSchema;
15
+ Items: typeof isSerializedDataItems;
16
+ }>;
17
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
11
18
  export interface SerializedImportedCollection {
12
19
  'Name': string;
13
20
  'Schema': SerializedSchema;
@@ -20,7 +27,42 @@ export interface SerializedImportedCollection {
20
27
  };
21
28
  }
22
29
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
30
+ export declare const isSerializedImportedCollection: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
31
+ Name: typeof isString;
32
+ Schema: typeof isSerializedSchema;
33
+ Items: typeof isSerializedDataItems;
34
+ UpstreamConfig: typeof isObject;
35
+ Metadata: (val: unknown) => val is Record<string, import("../../guards").DestructureGuardedTypeObj<{
36
+ Name: typeof isString;
37
+ Schema: typeof isSerializedSchema;
38
+ Items: typeof isSerializedDataItems;
39
+ }>>;
40
+ }>;
41
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
23
42
  export interface SerializedImportedDataSource {
24
43
  'Properties': SerializedDataSourceProperties;
25
44
  'Collections': SerializedImportedCollection[];
26
45
  }
46
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
47
+ export declare const isSerializedImportedDataSource: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
48
+ Properties: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
49
+ Name: typeof isString;
50
+ UpstreamConfig: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
51
+ SourceType: (x: unknown) => x is import("./datasourcetype").DataSourceType;
52
+ UpdateType: (x: unknown) => x is import("./upstreamupdatetype").UpstreamUpdateType;
53
+ PatchType: (x: unknown) => x is import("./upstreampatchtype").UpstreamPatchType | null | undefined;
54
+ SourceConfig: typeof isObject;
55
+ }> | null | undefined;
56
+ }>;
57
+ Collections: (val: unknown) => val is import("../../guards").DestructureGuardedTypeObj<{
58
+ Name: typeof isString;
59
+ Schema: typeof isSerializedSchema;
60
+ Items: typeof isSerializedDataItems;
61
+ UpstreamConfig: typeof isObject;
62
+ Metadata: (val: unknown) => val is Record<string, import("../../guards").DestructureGuardedTypeObj<{
63
+ Name: typeof isString;
64
+ Schema: typeof isSerializedSchema;
65
+ Items: typeof isSerializedDataItems;
66
+ }>>;
67
+ }>[];
68
+ }>;
@@ -1,2 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSerializedImportedDataSource = exports.isSerializedImportedCollection = exports.isSerializedImportedMetadataCollection = void 0;
4
+ const checks_1 = require("../../checks");
5
+ const validators_1 = require("../../validators/validators");
6
+ const serializeddataitems_1 = require("../serializedfield/serializeddataitems");
7
+ const serializedschema_1 = require("../serializedfield/serializedschema");
8
+ const serializeddatasourceproperties_1 = require("./serializeddatasourceproperties");
9
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
10
+ exports.isSerializedImportedMetadataCollection = (0, validators_1.strictObjectValidator)({
11
+ 'Name': checks_1.isString,
12
+ 'Schema': serializedschema_1.isSerializedSchema,
13
+ 'Items': serializeddataitems_1.isSerializedDataItems,
14
+ });
15
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
16
+ exports.isSerializedImportedCollection = (0, validators_1.strictObjectValidator)({
17
+ 'Name': checks_1.isString,
18
+ 'Schema': serializedschema_1.isSerializedSchema,
19
+ 'Items': serializeddataitems_1.isSerializedDataItems,
20
+ 'UpstreamConfig': checks_1.isObject,
21
+ 'Metadata': (0, checks_1.isRecord)(exports.isSerializedImportedMetadataCollection),
22
+ });
23
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
24
+ exports.isSerializedImportedDataSource = (0, validators_1.strictObjectValidator)({
25
+ 'Properties': serializeddatasourceproperties_1.isSerializedDataSourceProperties,
26
+ 'Collections': (0, checks_1.isTypedArray)(exports.isSerializedImportedCollection),
27
+ });
@@ -1,3 +1,4 @@
1
+ import { isObject } from '../../checks';
1
2
  import { DataSourceType } from './datasourcetype';
2
3
  import { UpstreamPatchType } from './upstreampatchtype';
3
4
  import { UpstreamUpdateType } from './upstreamupdatetype';
@@ -10,3 +11,10 @@ export interface SerializedUpstreamConfig {
10
11
  [index: string]: any;
11
12
  };
12
13
  }
14
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
15
+ export declare const isSerializedUpstreamConfig: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
16
+ SourceType: (x: unknown) => x is DataSourceType;
17
+ UpdateType: (x: unknown) => x is UpstreamUpdateType;
18
+ PatchType: (x: unknown) => x is UpstreamPatchType | null | undefined;
19
+ SourceConfig: typeof isObject;
20
+ }>;
@@ -1,2 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSerializedUpstreamConfig = void 0;
4
+ const checks_1 = require("../../checks");
5
+ const validators_1 = require("../../validators/validators");
6
+ const datasourcetype_1 = require("./datasourcetype");
7
+ const upstreampatchtype_1 = require("./upstreampatchtype");
8
+ const upstreamupdatetype_1 = require("./upstreamupdatetype");
9
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
10
+ exports.isSerializedUpstreamConfig = (0, validators_1.strictObjectValidator)({
11
+ 'SourceType': (0, validators_1.enumValidator)(datasourcetype_1.DataSourceType),
12
+ 'UpdateType': (0, validators_1.enumValidator)(upstreamupdatetype_1.UpstreamUpdateType),
13
+ 'PatchType': (0, validators_1.nullableOption)((0, validators_1.enumValidator)(upstreampatchtype_1.UpstreamPatchType)),
14
+ 'SourceConfig': checks_1.isObject,
15
+ });
@@ -1,13 +1,7 @@
1
+ import { isString } from '../../checks';
1
2
  import { JsonSerializable } from '../../jsonserializable';
2
- import { SerializedFieldTypeDefinition } from '../fieldtypedefinition/fieldtypedefinition';
3
+ import { isSerializedFieldTypeDefinition, SerializedFieldTypeDefinition } from '../fieldtypedefinition/fieldtypedefinition';
3
4
  import { SemanticKind } from '../fieldtypedefinition/semantickind';
4
- export declare type SerializedFieldDefinition = {
5
- 'Name': string;
6
- 'Type': SerializedFieldTypeDefinition;
7
- 'Constraints'?: SerializedFieldConstraint[] | undefined;
8
- 'SyncSchema'?: string | undefined;
9
- 'Mapping'?: readonly SemanticKind[] | undefined;
10
- };
11
5
  export declare enum FieldConstraintType {
12
6
  REQUIRED = "required",
13
7
  LOCKED = "locked",
@@ -21,3 +15,24 @@ export declare type SerializedFieldConstraint = {
21
15
  'Type': FieldConstraintType;
22
16
  'Details'?: JsonSerializable;
23
17
  };
18
+ export declare const isSerializedFieldConstraint: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
19
+ Type: (x: unknown) => x is FieldConstraintType;
20
+ Details: (x: unknown) => x is unknown;
21
+ }>;
22
+ export declare type SerializedFieldDefinition = {
23
+ 'Name': string;
24
+ 'Type': SerializedFieldTypeDefinition;
25
+ 'Constraints'?: SerializedFieldConstraint[] | undefined;
26
+ 'SyncSchema'?: string | undefined;
27
+ 'Mapping'?: readonly SemanticKind[] | undefined;
28
+ };
29
+ export declare const isSerializedFieldDefinition: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
30
+ Name: typeof isString;
31
+ Type: typeof isSerializedFieldTypeDefinition;
32
+ Constraints: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
33
+ Type: (x: unknown) => x is FieldConstraintType;
34
+ Details: (x: unknown) => x is unknown;
35
+ }>[] | undefined;
36
+ SyncSchema: (x: unknown) => x is string | undefined;
37
+ Mapping: (x: unknown) => x is SemanticKind[] | undefined;
38
+ }>;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFieldConstraintType = exports.FieldConstraintType = void 0;
3
+ exports.isSerializedFieldDefinition = exports.isSerializedFieldConstraint = exports.isFieldConstraintType = exports.FieldConstraintType = void 0;
4
+ const checks_1 = require("../../checks");
4
5
  const validators_1 = require("../../validators/validators");
6
+ const fieldtypedefinition_1 = require("../fieldtypedefinition/fieldtypedefinition");
7
+ const semantickind_1 = require("../fieldtypedefinition/semantickind");
5
8
  // The options here must match com.lucidchart.data.model.fielddefinition.FieldConstraintType on the backend
6
9
  var FieldConstraintType;
7
10
  (function (FieldConstraintType) {
@@ -13,3 +16,14 @@ var FieldConstraintType;
13
16
  FieldConstraintType["NO_WHITESPACE"] = "noWhitespace";
14
17
  })(FieldConstraintType = exports.FieldConstraintType || (exports.FieldConstraintType = {}));
15
18
  exports.isFieldConstraintType = (0, validators_1.enumValidator)(FieldConstraintType);
19
+ exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
20
+ 'Type': (0, validators_1.enumValidator)(FieldConstraintType),
21
+ 'Details': (0, validators_1.option)(checks_1.isUnknown),
22
+ });
23
+ exports.isSerializedFieldDefinition = (0, validators_1.strictObjectValidator)({
24
+ 'Name': checks_1.isString,
25
+ 'Type': fieldtypedefinition_1.isSerializedFieldTypeDefinition,
26
+ 'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
27
+ 'SyncSchema': (0, validators_1.option)(checks_1.isString),
28
+ 'Mapping': (0, validators_1.option)((0, validators_1.arrayValidator)((0, validators_1.stringEnumValidator)(semantickind_1.SemanticKind))),
29
+ });
@@ -7,3 +7,4 @@ export declare type SerializedSchema = {
7
7
  'PrimaryKey': string[];
8
8
  'FieldLabelOverrides'?: SerializedLabelOverrides | undefined;
9
9
  };
10
+ export declare function isSerializedSchema(schema: any): schema is SerializedSchema;
@@ -1,2 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSerializedSchema = void 0;
4
+ const checks_1 = require("../../checks");
5
+ const validators_1 = require("../../validators/validators");
6
+ const serializedfielddefinition_1 = require("./serializedfielddefinition");
7
+ function isSerializedSchema(schema) {
8
+ if (schema == null) {
9
+ return false;
10
+ }
11
+ const fields = schema['Fields'];
12
+ const primaryKey = schema['PrimaryKey'];
13
+ const fieldLabelOverrides = schema['FieldLabelOverrides'];
14
+ const validOverrides = (0, checks_1.isDefAndNotNull)(fieldLabelOverrides)
15
+ ? (0, checks_1.isRecord)(checks_1.isString)(fieldLabelOverrides) && !(0, checks_1.isArray)(fieldLabelOverrides)
16
+ : true; // Optional field
17
+ return ((0, checks_1.isTypedArray)(serializedfielddefinition_1.isSerializedFieldDefinition)(fields) &&
18
+ (0, validators_1.arrayValidator)(serializedfielddefinition_1.isSerializedFieldDefinition)(fields) &&
19
+ (0, checks_1.isArray)(primaryKey) &&
20
+ primaryKey.every(checks_1.isString) &&
21
+ validOverrides);
22
+ }
23
+ exports.isSerializedSchema = isSerializedSchema;
@@ -1,5 +1,5 @@
1
- import { CollectionProxy } from '../../data/collectionproxy';
2
1
  import { SerializedImportedDataSource } from '../data/datasource/serializedimporteddatasource';
2
+ import { JsonSerializable } from '../jsonserializable';
3
3
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
4
4
  export declare enum LucidSpreadsheetIntegrationFailureType {
5
5
  AuthorizationFailure = "AuthorizationFailure",
@@ -9,12 +9,16 @@ export declare enum LucidSpreadsheetIntegrationFailureType {
9
9
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
10
10
  export declare const lucidSpreadsheetIntegrationFailureTypeValidator: (x: unknown) => x is LucidSpreadsheetIntegrationFailureType;
11
11
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
12
- export declare abstract class LucidSpreadsheetIntegration<CONFIG, SHEET> {
12
+ export declare abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable> {
13
13
  abstract name: string;
14
14
  abstract label: string;
15
15
  abstract iconUrl: string;
16
- abstract getSpreadsheetToImportDetails: () => Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
16
+ abstract getSpreadsheetToImportDetails(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
17
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>;
18
+ abstract getPreviewData(spreadsheetDetails: CONFIG, sheetsToPreview: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>;
19
+ abstract importSheets(spreadsheetDetails: CONFIG, sheetsToImportConfig: {
20
+ 'sheet': SHEET;
21
+ 'headerRowIndex': number;
22
+ 'primaryKeys': string[];
23
+ }[]): Promise<string | LucidSpreadsheetIntegrationFailureType>;
20
24
  }
@@ -1,4 +1,5 @@
1
1
  import { EditorClient } from '../../editorclient';
2
+ import { JsonSerializable } from '../jsonserializable';
2
3
  import { LucidSpreadsheetIntegration } from './lucidspreadsheetintegration';
3
4
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
4
5
  export declare class LucidSpreadsheetIntegrationRegistry {
@@ -7,5 +8,5 @@ export declare class LucidSpreadsheetIntegrationRegistry {
7
8
  /**
8
9
  * Register a spreadsheet integration.
9
10
  */
10
- static addSpreadsheetIntegration<CONFIG, SHEET>(client: EditorClient, spreadsheetIntegration: LucidSpreadsheetIntegration<CONFIG, SHEET>): void;
11
+ static addSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable>(client: EditorClient, spreadsheetIntegration: LucidSpreadsheetIntegration<CONFIG, SHEET>): void;
11
12
  }
@@ -13,29 +13,42 @@ class LucidSpreadsheetIntegrationRegistry {
13
13
  static addSpreadsheetIntegration(client, spreadsheetIntegration) {
14
14
  const getSpreadsheetToImportDetailsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
15
15
  client.registerAction(getSpreadsheetToImportDetailsActionName, async () => {
16
- const result = await spreadsheetIntegration.getSpreadsheetToImportDetails();
17
- return result;
16
+ try {
17
+ return await spreadsheetIntegration.getSpreadsheetToImportDetails();
18
+ }
19
+ catch (error) { }
20
+ return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
18
21
  });
19
22
  const getSpreadsheetSheetIdsAndNamesActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
20
23
  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);
24
+ try {
25
+ const result = await spreadsheetIntegration.getSpreadsheetSheetIdsAndNames(message['dataDetails']);
26
+ if ((0, lucidspreadsheetintegration_1.lucidSpreadsheetIntegrationFailureTypeValidator)(result)) {
27
+ return result;
28
+ }
29
+ else {
30
+ // Serialize the Map
31
+ return Array.from(result);
32
+ }
28
33
  }
34
+ catch (error) { }
35
+ return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
29
36
  });
30
37
  const getPreviewDataActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
31
38
  client.registerAction(getPreviewDataActionName, async (message) => {
32
- const result = await spreadsheetIntegration.getPreviewData(message['dataDetails'], message['sheetIds']);
33
- return result;
39
+ try {
40
+ return await spreadsheetIntegration.getPreviewData(message['dataDetails'], message['sheets']);
41
+ }
42
+ catch (error) { }
43
+ return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
34
44
  });
35
45
  const importSheetsActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
36
46
  client.registerAction(importSheetsActionName, async (message) => {
37
- const result = await spreadsheetIntegration.importSheets(message['dataDetails'], message['sheetIds']);
38
- return result;
47
+ try {
48
+ return await spreadsheetIntegration.importSheets(message['dataDetails'], message['sheetsToImportConfig']);
49
+ }
50
+ catch (error) { }
51
+ return lucidspreadsheetintegration_1.LucidSpreadsheetIntegrationFailureType.GenericFailure;
39
52
  });
40
53
  const serialized = {
41
54
  'n': spreadsheetIntegration.name,
@@ -92,6 +92,8 @@ export declare class EditorClient {
92
92
  */
93
93
  canEditPackageSettings(): Promise<boolean>;
94
94
  awaitDataImport(dataConnectorName: string, syncDataSourceId: undefined | string, syncCollectionId: string, primaryKeys: string[], timeout?: number): Promise<CollectionProxy>;
95
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
96
+ awaitDataSourceImport(dataConnectorName: string, syncDataSourceIdNonce: string): Promise<string>;
95
97
  /**
96
98
  * Make a network request
97
99
  * @param request Settings for the network request
@@ -158,6 +158,13 @@ class EditorClient {
158
158
  't': timeout,
159
159
  }), this);
160
160
  }
161
+ /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
162
+ async awaitDataSourceImport(dataConnectorName, syncDataSourceIdNonce) {
163
+ return await this.sendCommand("adi" /* CommandName.AwaitDataSourceImport */, {
164
+ 'n': dataConnectorName,
165
+ 's': syncDataSourceIdNonce,
166
+ });
167
+ }
161
168
  xhr(request) {
162
169
  const responseFormat = request.responseFormat || 'utf8';
163
170
  return this.sendCommand("xhr" /* CommandName.SendXHR */, {
package/sdk/ui/panel.d.ts CHANGED
@@ -24,6 +24,8 @@ export interface PanelConfig {
24
24
  iconUrl: string;
25
25
  /** A tool tip to be displayed when hovering over the activation icon. */
26
26
  toolTip?: string;
27
+ /** If set true, we will persist the panel's iframe in the background if it's not currently active*/
28
+ persist?: boolean;
27
29
  }
28
30
  /**
29
31
  * Extend this class to show a custom panel to the user, whose contents are displayed in a sandboxed
package/sdk/ui/panel.js CHANGED
@@ -37,6 +37,7 @@ class Panel extends iframeui_1.IframeUI {
37
37
  'v': this.config.visibleAction,
38
38
  'i': this.config.iconUrl,
39
39
  'to': this.config.toolTip,
40
+ 'p': this.config.persist,
40
41
  });
41
42
  }
42
43
  /**