lucid-extension-sdk 0.0.233 → 0.0.236

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
@@ -1540,7 +1540,7 @@ export type ShowModalQuery = {
1540
1540
  /** URL to display in the modal (this or c is required). Can be relative to /public directory in the package */
1541
1541
  'u'?: string | undefined;
1542
1542
  };
1543
- export type ShowModalResult = undefined;
1543
+ export type ShowModalResult = Promise<undefined>;
1544
1544
  export type ShowPackageSettingsModalQuery = undefined;
1545
1545
  export type ShowPackageSettingsModalResult = Promise<void>;
1546
1546
  export type ShowPanelQuery = {
@@ -3,6 +3,7 @@ import { CollectionEnumFieldType } from './fieldtypedefinition/collectionenumfie
3
3
  import { FieldTypeArray } from './fieldtypedefinition/fieldtypearray';
4
4
  import { FieldTypeDefinition } from './fieldtypedefinition/fieldtypedefinition';
5
5
  import { ScalarFieldTypeEnum } from './fieldtypedefinition/scalarfieldtype';
6
+ import { SemanticFields } from './fieldtypedefinition/semanticfields';
6
7
  import { SemanticKind } from './fieldtypedefinition/semantickind';
7
8
  import { SerializedColorObject, SerializedLucidCurrency, SerializedLucidDateObject, SerializedLucidDictionary } from './serializedfield/serializedfields';
8
9
  type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends ScalarFieldTypeEnum.NUMBER ? number : X extends ScalarFieldTypeEnum.BOOLEAN ? boolean : X extends ScalarFieldTypeEnum.STRING ? string : X extends ScalarFieldTypeEnum.COLOR ? SerializedColorObject : X extends ScalarFieldTypeEnum.DATE ? SerializedLucidDateObject : X extends ScalarFieldTypeEnum.NULL ? null : X extends ScalarFieldTypeEnum.DICTIONARY ? SerializedLucidDictionary : X extends FieldTypeArray<infer Inner> ? TsTypeOf<Inner>[] : X extends ScalarFieldTypeEnum.CURRENCY ? SerializedLucidCurrency : X extends ScalarFieldTypeEnum.DATEONLY ? SerializedLucidDateObject & {
@@ -17,11 +18,11 @@ type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends Scala
17
18
  * which allows all the fields not part of the primaryKey to be undefined. The former should
18
19
  * be used with initial imports, and the latter can be used for updates.
19
20
  */
20
- export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, SemanticFieldTypes extends SemanticKind, Fields extends {
21
+ export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, Fields extends {
21
22
  [Name in Names]: {
22
23
  type: Types;
23
24
  constraints?: readonly Constraint[];
24
- mapping?: readonly SemanticFieldTypes[] | undefined;
25
+ mapping?: readonly SemanticKind[] | readonly SemanticFields[] | undefined;
25
26
  };
26
27
  }, PrimaryKey extends keyof Fields>({ primaryKey, fields }: {
27
28
  primaryKey: PrimaryKey[];
@@ -32,7 +33,7 @@ export declare function declareSchema<Names extends string, Types extends Readon
32
33
  name: Exclude<keyof typeof fields, number>;
33
34
  type: FieldTypeDefinition;
34
35
  constraints: FieldConstraintDefinition[];
35
- mapping: SemanticFieldTypes[];
36
+ mapping: readonly SemanticKind[] | readonly SemanticFields[];
36
37
  }[];
37
38
  primaryKey: FormattedPrimaryKey<Fields, PrimaryKey>;
38
39
  fromItemsSparse: (items: PartialItemType<typeof fields, PrimaryKey>[]) => Map<string, PartialItemType<Fields, PrimaryKey>>;
@@ -78,7 +79,7 @@ export declare class FormattedPrimaryKey<Fields extends FieldsStructure, Primary
78
79
  type FieldsStructure = {
79
80
  [Name in string]: {
80
81
  type: Readonly<FieldTypeDefinition>;
81
- mapping?: undefined | readonly SemanticKind[];
82
+ mapping?: undefined | readonly SemanticKind[] | readonly SemanticFields[];
82
83
  };
83
84
  };
84
85
  /**
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Semantic Fields serve as standardized categories that transcend individual data source labels, facilitating
3
+ * a uniform way to access and manipulate data. For instance, regardless of the source, data that pertains to "titles"
4
+ * or "user information" often carries the same kind of information, though it may be labeled differently across systems.
5
+ * Lucid’s Semantic Fields ensure that such data is recognized and treated consistently within the platform,
6
+ * regardless of external labeling conventions.
7
+ *
8
+ * Semantic Mapping is the process through which Lucid aligns these disparate field names to a set of standardized
9
+ * Semantic Fields. By using Semantic Fields like Title, Description, User, and Project, Lucid simplifies the way
10
+ * users access and interact with data brought in from external sources.
11
+ *
12
+ * Benefits of Semantic Fields:
13
+ * Uniformity: Ensures that data from diverse sources is referenced consistently within Lucid.
14
+ * Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Semantic Fields.
15
+ * Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
16
+ * Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
17
+ */
18
+ export declare enum SemanticFields {
19
+ /**
20
+ * Represents the title or main descriptor of an item.
21
+ */
22
+ Title = "title",
23
+ /**
24
+ * Captures detailed information or a summary about an item.
25
+ */
26
+ Description = "description",
27
+ /**
28
+ * Refers to the user associated with or assigned to an item.
29
+ */
30
+ User = "user",
31
+ /**
32
+ * Specific to the reporting user, typically in the context of a ticketing system.
33
+ */
34
+ Reporter = "user.reporter",
35
+ /**
36
+ * Refers to the time associated with an item.
37
+ */
38
+ Time = "time",
39
+ /**
40
+ * Pertains to the ending or completion time of an item.
41
+ */
42
+ EndTime = "time.endtime",
43
+ /**
44
+ * Contains estimations related to items, like time or resource estimates.
45
+ */
46
+ Estimate = "estimate",
47
+ /**
48
+ * Reflects status of an item, typically in the context of a ticketing system.
49
+ */
50
+ Status = "status",
51
+ /**
52
+ * Classifies the type of issue or item, typically in the context of a ticketing system.
53
+ */
54
+ IssueType = "issuetype",
55
+ /**
56
+ * Indicates the importance or urgency level of an item.
57
+ */
58
+ Priority = "priority",
59
+ /**
60
+ * Relates to the project with which an item is associated.
61
+ */
62
+ Project = "project",
63
+ /**
64
+ * The unique URL or identifier linking back to the item’s source.
65
+ */
66
+ SourceItemUrl = "url",
67
+ /**
68
+ * Refers to the URL of the image associated with this item
69
+ */
70
+ ImageUrl = "url.image"
71
+ }
72
+ export declare const isSemanticFields: (x: unknown) => x is SemanticFields;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSemanticFields = exports.SemanticFields = void 0;
4
+ const validators_1 = require("../../validators/validators");
5
+ /**
6
+ * Semantic Fields serve as standardized categories that transcend individual data source labels, facilitating
7
+ * a uniform way to access and manipulate data. For instance, regardless of the source, data that pertains to "titles"
8
+ * or "user information" often carries the same kind of information, though it may be labeled differently across systems.
9
+ * Lucid’s Semantic Fields ensure that such data is recognized and treated consistently within the platform,
10
+ * regardless of external labeling conventions.
11
+ *
12
+ * Semantic Mapping is the process through which Lucid aligns these disparate field names to a set of standardized
13
+ * Semantic Fields. By using Semantic Fields like Title, Description, User, and Project, Lucid simplifies the way
14
+ * users access and interact with data brought in from external sources.
15
+ *
16
+ * Benefits of Semantic Fields:
17
+ * Uniformity: Ensures that data from diverse sources is referenced consistently within Lucid.
18
+ * Integration Simplicity: Simplifies the process of integrating new data sources into Lucid by mapping to an established set of Semantic Fields.
19
+ * Feature Compatibility: Allows for seamless use of Lucid’s intelligent features across all data, regardless of its origin.
20
+ * Data Organization: Provides a structured approach to organizing and grouping data within the Lucid ecosystem.
21
+ */
22
+ var SemanticFields;
23
+ (function (SemanticFields) {
24
+ /**
25
+ * Represents the title or main descriptor of an item.
26
+ */
27
+ SemanticFields["Title"] = "title";
28
+ /**
29
+ * Captures detailed information or a summary about an item.
30
+ */
31
+ SemanticFields["Description"] = "description";
32
+ /**
33
+ * Refers to the user associated with or assigned to an item.
34
+ */
35
+ SemanticFields["User"] = "user";
36
+ /**
37
+ * Specific to the reporting user, typically in the context of a ticketing system.
38
+ */
39
+ SemanticFields["Reporter"] = "user.reporter";
40
+ /**
41
+ * Refers to the time associated with an item.
42
+ */
43
+ SemanticFields["Time"] = "time";
44
+ /**
45
+ * Pertains to the ending or completion time of an item.
46
+ */
47
+ SemanticFields["EndTime"] = "time.endtime";
48
+ /**
49
+ * Contains estimations related to items, like time or resource estimates.
50
+ */
51
+ SemanticFields["Estimate"] = "estimate";
52
+ /**
53
+ * Reflects status of an item, typically in the context of a ticketing system.
54
+ */
55
+ SemanticFields["Status"] = "status";
56
+ /**
57
+ * Classifies the type of issue or item, typically in the context of a ticketing system.
58
+ */
59
+ SemanticFields["IssueType"] = "issuetype";
60
+ /**
61
+ * Indicates the importance or urgency level of an item.
62
+ */
63
+ SemanticFields["Priority"] = "priority";
64
+ /**
65
+ * Relates to the project with which an item is associated.
66
+ */
67
+ SemanticFields["Project"] = "project";
68
+ /**
69
+ * The unique URL or identifier linking back to the item’s source.
70
+ */
71
+ SemanticFields["SourceItemUrl"] = "url";
72
+ /**
73
+ * Refers to the URL of the image associated with this item
74
+ */
75
+ SemanticFields["ImageUrl"] = "url.image";
76
+ })(SemanticFields || (exports.SemanticFields = SemanticFields = {}));
77
+ exports.isSemanticFields = (0, validators_1.stringEnumValidator)(SemanticFields);
@@ -1,3 +1,7 @@
1
+ import { SemanticFields } from './semanticfields';
2
+ /**
3
+ * @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability.
4
+ */
1
5
  export declare enum SemanticKind {
2
6
  Id = "id",
3
7
  Title = "title",
@@ -18,3 +22,4 @@ export declare enum SemanticKind {
18
22
  URL = "url"
19
23
  }
20
24
  export declare const isSemanticKind: (x: unknown) => x is SemanticKind;
25
+ export declare function semanticKindToSemanticFields(semanticField: SemanticKind | SemanticFields): SemanticFields | undefined;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSemanticKind = exports.SemanticKind = void 0;
3
+ exports.semanticKindToSemanticFields = exports.isSemanticKind = exports.SemanticKind = void 0;
4
4
  const validators_1 = require("../../validators/validators");
5
+ const semanticfields_1 = require("./semanticfields");
6
+ /**
7
+ * @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability.
8
+ */
5
9
  var SemanticKind;
6
10
  (function (SemanticKind) {
7
11
  SemanticKind["Id"] = "id";
@@ -23,3 +27,49 @@ var SemanticKind;
23
27
  SemanticKind["URL"] = "url";
24
28
  })(SemanticKind || (exports.SemanticKind = SemanticKind = {}));
25
29
  exports.isSemanticKind = (0, validators_1.enumValidator)(SemanticKind);
30
+ function semanticKindToSemanticFields(semanticField) {
31
+ if ((0, semanticfields_1.isSemanticFields)(semanticField)) {
32
+ return semanticField;
33
+ }
34
+ else {
35
+ switch (semanticField) {
36
+ case SemanticKind.Id:
37
+ return undefined;
38
+ case SemanticKind.Title:
39
+ return semanticfields_1.SemanticFields.Title;
40
+ case SemanticKind.Name:
41
+ return semanticfields_1.SemanticFields.User;
42
+ case SemanticKind.Image:
43
+ return semanticfields_1.SemanticFields.ImageUrl;
44
+ case SemanticKind.Description:
45
+ return semanticfields_1.SemanticFields.Description;
46
+ case SemanticKind.Assignee:
47
+ return semanticfields_1.SemanticFields.User;
48
+ case SemanticKind.Estimate:
49
+ return semanticfields_1.SemanticFields.Estimate;
50
+ case SemanticKind.Status:
51
+ return semanticfields_1.SemanticFields.Status;
52
+ case SemanticKind.IssueType:
53
+ return semanticfields_1.SemanticFields.IssueType;
54
+ case SemanticKind.Priority:
55
+ return semanticfields_1.SemanticFields.Priority;
56
+ case SemanticKind.Project:
57
+ return semanticfields_1.SemanticFields.Project;
58
+ case SemanticKind.Reporter:
59
+ return semanticfields_1.SemanticFields.Reporter;
60
+ case SemanticKind.StartTime:
61
+ return semanticfields_1.SemanticFields.Time;
62
+ case SemanticKind.EndTime:
63
+ return semanticfields_1.SemanticFields.EndTime;
64
+ case SemanticKind.GroupByHint:
65
+ return undefined;
66
+ case SemanticKind.PrimaryKeyReference:
67
+ return undefined;
68
+ case SemanticKind.URL:
69
+ return semanticfields_1.SemanticFields.SourceItemUrl;
70
+ default:
71
+ return undefined;
72
+ }
73
+ }
74
+ }
75
+ exports.semanticKindToSemanticFields = semanticKindToSemanticFields;
@@ -1,6 +1,7 @@
1
1
  import { isString } from '../../checks';
2
2
  import { JsonSerializable } from '../../jsonserializable';
3
3
  import { SerializedFieldTypeDefinition, isSerializedFieldTypeDefinition } from '../fieldtypedefinition/fieldtypedefinition';
4
+ import { SemanticFields } from '../fieldtypedefinition/semanticfields';
4
5
  import { SemanticKind } from '../fieldtypedefinition/semantickind';
5
6
  export declare enum FieldConstraintType {
6
7
  REQUIRED = "required",
@@ -25,7 +26,7 @@ export type SerializedFieldDefinition = {
25
26
  'Type': SerializedFieldTypeDefinition;
26
27
  'Constraints'?: SerializedFieldConstraint[] | undefined;
27
28
  'SyncSchema'?: string | undefined;
28
- 'Mapping'?: readonly SemanticKind[] | undefined;
29
+ 'Mapping'?: readonly SemanticFields[] | readonly SemanticKind[] | undefined;
29
30
  };
30
31
  export declare const isSerializedFieldDefinition: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
31
32
  Name: typeof isString;
@@ -35,5 +36,5 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject
35
36
  Details: (x: unknown) => x is any;
36
37
  }>[] | undefined;
37
38
  SyncSchema: (x: unknown) => x is string | undefined;
38
- Mapping: (x: unknown) => x is SemanticKind[] | undefined;
39
+ Mapping: (x: unknown) => x is SemanticFields[] | SemanticKind[] | undefined;
39
40
  }>;
@@ -4,6 +4,7 @@ exports.isSerializedFieldDefinition = exports.isSerializedFieldConstraint = expo
4
4
  const checks_1 = require("../../checks");
5
5
  const validators_1 = require("../../validators/validators");
6
6
  const fieldtypedefinition_1 = require("../fieldtypedefinition/fieldtypedefinition");
7
+ const semanticfields_1 = require("../fieldtypedefinition/semanticfields");
7
8
  const semantickind_1 = require("../fieldtypedefinition/semantickind");
8
9
  // The options here must match com.lucidchart.data.model.fielddefinition.FieldConstraintType on the backend
9
10
  var FieldConstraintType;
@@ -26,5 +27,5 @@ exports.isSerializedFieldDefinition = (0, validators_1.strictObjectValidator)({
26
27
  'Type': fieldtypedefinition_1.isSerializedFieldTypeDefinition,
27
28
  'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
28
29
  'SyncSchema': (0, validators_1.option)(checks_1.isString),
29
- 'Mapping': (0, validators_1.option)((0, validators_1.arrayValidator)((0, validators_1.stringEnumValidator)(semantickind_1.SemanticKind))),
30
+ 'Mapping': (0, validators_1.option)((0, validators_1.either)((0, validators_1.arrayValidator)(semanticfields_1.isSemanticFields), (0, validators_1.arrayValidator)(semantickind_1.isSemanticKind))),
30
31
  });
@@ -1,5 +1,6 @@
1
1
  import { isNumber, isUndefined } from '../core/checks';
2
2
  import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
3
+ import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
3
4
  import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
4
5
  import { FieldConstraintType, SerializedFieldConstraint, SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition';
5
6
  import { SerializedSchema } from '../core/data/serializedfield/serializedschema';
@@ -51,7 +52,7 @@ export interface FieldDefinition {
51
52
  name: string;
52
53
  type: FieldTypeDefinition;
53
54
  constraints?: FieldConstraintDefinition[] | undefined;
54
- mapping?: readonly SemanticKind[] | undefined;
55
+ mapping?: readonly SemanticFields[] | readonly SemanticKind[] | undefined;
55
56
  }
56
57
  /**
57
58
  * Definition of a schema for creating a [Collection](#classes_data_collectionproxy-CollectionProxy)
@@ -1,5 +1,6 @@
1
1
  import { UpstreamPatchType } from '../core/data/datasource/upstreampatchtype';
2
2
  import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
3
+ import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
3
4
  import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
4
5
  import { FieldConstraintType } from '../core/data/serializedfield/serializedfielddefinition';
5
6
  import { SerializedFields, SerializedLucidDictionary } from '../core/data/serializedfield/serializedfields';
@@ -32,7 +33,7 @@ type SerializedFieldDefinitionForApi = {
32
33
  'type': SerializedFieldTypeDefinition;
33
34
  'constraints': SerializedFieldConstraintForApi[];
34
35
  'syncSchema'?: string;
35
- 'mapping'?: readonly SemanticKind[];
36
+ 'mapping'?: readonly SemanticKind[] | readonly SemanticFields[];
36
37
  };
37
38
  type SerializedSchemaForApi = {
38
39
  'fields': SerializedFieldDefinitionForApi[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.233",
3
+ "version": "0.0.236",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/ui/modal.d.ts CHANGED
@@ -57,7 +57,7 @@ export declare abstract class Modal extends IframeUI {
57
57
  private visible;
58
58
  constructor(client: EditorClient, config: ModalConfig);
59
59
  protected frameClosed(): void;
60
- show(): void;
60
+ show(): Promise<void>;
61
61
  /**
62
62
  * If this modal is currently visible, close it, destroying the iframe.
63
63
  */
package/ui/modal.js CHANGED
@@ -22,10 +22,10 @@ class Modal extends iframeui_1.IframeUI {
22
22
  this.visible = false;
23
23
  this.unhookMessages();
24
24
  }
25
- show() {
25
+ async show() {
26
26
  if (!this.visible) {
27
27
  this.hookMessages();
28
- this.client.sendCommand("sm" /* CommandName.ShowModal */, {
28
+ await this.client.sendCommand("sm" /* CommandName.ShowModal */, {
29
29
  'n': this.messageActionName,
30
30
  't': this.config.title,
31
31
  'w': this.config.width,