lucid-extension-sdk 0.0.305 → 0.0.307

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
@@ -25,6 +25,7 @@ import { PanelLocation } from './ui/panel';
25
25
  * Before you add a new command bring it up in #api-committee to get feedback.
26
26
  */
27
27
  export declare const enum CommandName {
28
+ AddAuthorizationFlowHandler = "aafh",
28
29
  AddCardIntegration = "aci",
29
30
  AddDiagramFromMermaid = "adfm",
30
31
  AddDiagramFromText = "adft",
@@ -166,6 +167,10 @@ export declare const commandTitles: Map<CommandName, string>;
166
167
  * IMPORTANT - Before you add a new command bring it up in #api-committee to get feedback
167
168
  */
168
169
  export type CommandArgs = {
170
+ [CommandName.AddAuthorizationFlowHandler]: {
171
+ query: AddAuthorizationFlowHandlerQuery;
172
+ result: AddAuthorizationFlowHandlerResult;
173
+ };
169
174
  [CommandName.AddCardIntegration]: {
170
175
  query: AddCardIntegrationQuery;
171
176
  result: AddCardIntegrationResult;
@@ -687,6 +692,22 @@ export type CommandArgs = {
687
692
  result: ZOrderResult;
688
693
  };
689
694
  };
695
+ export type AuthorizationFlowHandlerProvider = string;
696
+ export declare enum AuthorizationFlowHandlerStage {
697
+ OnFailure = "onFailure"
698
+ }
699
+ export type AddAuthorizationFlowHandlerQuery = {
700
+ /**
701
+ * Specifies the callback function to run when the handler is triggered.
702
+ * String, not a function itself; this is the name of the client's registered action hook
703
+ */
704
+ 'c': string;
705
+ /** The name of the auth provider (as specified in the package's manifest.json) that triggers this handler. */
706
+ 'p': AuthorizationFlowHandlerProvider;
707
+ /** The stage during the auth flow when this handler is triggered. */
708
+ 's': AuthorizationFlowHandlerStage;
709
+ };
710
+ export type AddAuthorizationFlowHandlerResult = undefined;
690
711
  export type AddCardIntegrationQuery = {
691
712
  /** Title/name */
692
713
  'n': string;
@@ -709,7 +730,9 @@ export type AddCardIntegrationQuery = {
709
730
  /** Field name -> callback name tuples for searching for legal field values in an enum */
710
731
  'fvsc'?: [string, string][] | undefined;
711
732
  };
712
- /** Show intro if user has not yet authorized this integration */
733
+ /** Show intro if user has not yet authorized this integration
734
+ * String, not function; this is the name of the client's registered action hook
735
+ */
713
736
  'i'?: string | undefined;
714
737
  /** Get default config action */
715
738
  'gdc': string;
package/commandtypes.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.GetDocumentChunksType = exports.HashAlgorithmEnum = exports.commandTitles = void 0;
3
+ exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.GetDocumentChunksType = exports.HashAlgorithmEnum = exports.AuthorizationFlowHandlerStage = exports.commandTitles = void 0;
4
4
  const checks_1 = require("./core/checks");
5
5
  /** @ignore */
6
6
  exports.commandTitles = new Map([
7
+ ["aafh" /* CommandName.AddAuthorizationFlowHandler */, 'AddAuthorizationFlowHandler'],
7
8
  ["aci" /* CommandName.AddCardIntegration */, 'AddCardIntegration'],
8
9
  ["adfm" /* CommandName.AddDiagramFromMermaid */, 'AddDiagramFromMermaid'],
9
10
  ["adft" /* CommandName.AddDiagramFromText */, 'AddDiagramFromText'],
@@ -129,6 +130,10 @@ exports.commandTitles = new Map([
129
130
  ["wsa" /* CommandName.WithSilentActions */, 'WithSilentActions'],
130
131
  ["z" /* CommandName.ZOrder */, 'ZOrder'],
131
132
  ]);
133
+ var AuthorizationFlowHandlerStage;
134
+ (function (AuthorizationFlowHandlerStage) {
135
+ AuthorizationFlowHandlerStage["OnFailure"] = "onFailure";
136
+ })(AuthorizationFlowHandlerStage || (exports.AuthorizationFlowHandlerStage = AuthorizationFlowHandlerStage = {}));
132
137
  var HashAlgorithmEnum;
133
138
  (function (HashAlgorithmEnum) {
134
139
  /** Use the SHA 256 hashing algorithm */
@@ -0,0 +1,16 @@
1
+ import { AuthorizationFlowHandlerProvider, AuthorizationFlowHandlerStage } from '../commandtypes';
2
+ import { EditorClient } from '../editorclient';
3
+ export declare class AuthorizationFlowHandlerRegistry {
4
+ private static nextHookId;
5
+ private static nextHookName;
6
+ /**
7
+ * Register a function to be run at a given stage of the authorization flow for a provider.
8
+ *
9
+ * @param client A reference to the editor client.
10
+ * @param callback The function to run when the handler is triggered.
11
+ * @param stage The stage during the auth flow when this handler is triggered.
12
+ * @param provider The name of the auth provider (as specified in the package's manifest.json)
13
+ * that triggers this handler.
14
+ */
15
+ static registerAuthorizationFlowHandler(client: EditorClient, callback: () => void, stage: AuthorizationFlowHandlerStage, provider: AuthorizationFlowHandlerProvider): void;
16
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthorizationFlowHandlerRegistry = void 0;
4
+ class AuthorizationFlowHandlerRegistry {
5
+ static nextHookName() {
6
+ return '__authorizationflow__hook' + AuthorizationFlowHandlerRegistry.nextHookId++;
7
+ }
8
+ /**
9
+ * Register a function to be run at a given stage of the authorization flow for a provider.
10
+ *
11
+ * @param client A reference to the editor client.
12
+ * @param callback The function to run when the handler is triggered.
13
+ * @param stage The stage during the auth flow when this handler is triggered.
14
+ * @param provider The name of the auth provider (as specified in the package's manifest.json)
15
+ * that triggers this handler.
16
+ */
17
+ static registerAuthorizationFlowHandler(client, callback, stage, provider) {
18
+ const actionHookName = AuthorizationFlowHandlerRegistry.nextHookName();
19
+ client.registerAction(actionHookName, callback);
20
+ const serialized = {
21
+ 'c': actionHookName,
22
+ 's': stage,
23
+ 'p': provider,
24
+ };
25
+ client.sendCommand("aafh" /* CommandName.AddAuthorizationFlowHandler */, serialized);
26
+ }
27
+ }
28
+ exports.AuthorizationFlowHandlerRegistry = AuthorizationFlowHandlerRegistry;
29
+ AuthorizationFlowHandlerRegistry.nextHookId = 0;
@@ -63,8 +63,8 @@ export declare abstract class LucidCardIntegration {
63
63
  fieldValueSearchCallbacks?: Map<string, string>;
64
64
  };
65
65
  /**
66
- * If specified, and the user hasn't yet authorized the data connector for this extension,
67
- * this should show the user an intro dialog or take some other action.
66
+ * @deprecated Use AuthorizationFlowHandlerRegistry.registerAuthorizationFlowHandler.
67
+ * WARNING: Currently unused and does nothing.
68
68
  */
69
69
  showIntro?: () => void;
70
70
  /**
@@ -2,6 +2,7 @@ import { FieldConstraintDefinition } from '../../data/schemadefinition';
2
2
  import { CollectionEnumFieldType } from './fieldtypedefinition/collectionenumfieldtype';
3
3
  import { FieldTypeArray } from './fieldtypedefinition/fieldtypearray';
4
4
  import { FieldTypeDefinition } from './fieldtypedefinition/fieldtypedefinition';
5
+ import { LucidFields } from './fieldtypedefinition/lucidfields';
5
6
  import { ScalarFieldTypeEnum } from './fieldtypedefinition/scalarfieldtype';
6
7
  import { SemanticFields } from './fieldtypedefinition/semanticfields';
7
8
  import { SemanticKind } from './fieldtypedefinition/semantickind';
@@ -22,7 +23,7 @@ export declare function declareSchema<Names extends string, Types extends Readon
22
23
  [Name in Names]: {
23
24
  type: Types;
24
25
  constraints?: readonly Constraint[];
25
- mapping?: readonly SemanticKind[] | readonly SemanticFields[] | undefined;
26
+ mapping?: readonly SemanticKind[] | readonly SemanticFields[] | readonly LucidFields[] | undefined;
26
27
  };
27
28
  }, PrimaryKey extends keyof Fields>({ primaryKey, fields }: {
28
29
  primaryKey: PrimaryKey[];
@@ -33,7 +34,7 @@ export declare function declareSchema<Names extends string, Types extends Readon
33
34
  name: Exclude<keyof typeof fields, number>;
34
35
  type: FieldTypeDefinition;
35
36
  constraints: FieldConstraintDefinition[];
36
- mapping: readonly SemanticKind[] | readonly SemanticFields[];
37
+ mapping: readonly SemanticKind[] | readonly SemanticFields[] | readonly LucidFields[];
37
38
  }[];
38
39
  primaryKey: FormattedPrimaryKey<Fields, PrimaryKey>;
39
40
  fromItemsSparse: (items: PartialItemType<typeof fields, PrimaryKey>[]) => Map<string, PartialItemType<Fields, PrimaryKey>>;
@@ -80,7 +81,7 @@ export declare class FormattedPrimaryKey<Fields extends FieldsStructure, Primary
80
81
  type FieldsStructure = {
81
82
  [Name in string]: {
82
83
  type: Readonly<FieldTypeDefinition>;
83
- mapping?: undefined | readonly SemanticKind[] | readonly SemanticFields[];
84
+ mapping?: undefined | readonly SemanticKind[] | readonly SemanticFields[] | readonly LucidFields[];
84
85
  };
85
86
  };
86
87
  /**
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Lucid 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 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
+ * Lucid Fields. By using Lucid 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 Lucid 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 Lucid 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 LucidFields {
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 isLucidFields: (x: unknown) => x is LucidFields;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLucidFields = exports.LucidFields = void 0;
4
+ const validators_1 = require("../../validators/validators");
5
+ /**
6
+ * Lucid 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 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
+ * Lucid Fields. By using Lucid 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 Lucid 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 Lucid 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 LucidFields;
23
+ (function (LucidFields) {
24
+ /**
25
+ * Represents the title or main descriptor of an item.
26
+ */
27
+ LucidFields["Title"] = "title";
28
+ /**
29
+ * Captures detailed information or a summary about an item.
30
+ */
31
+ LucidFields["Description"] = "description";
32
+ /**
33
+ * Refers to the user associated with or assigned to an item.
34
+ */
35
+ LucidFields["User"] = "user";
36
+ /**
37
+ * Specific to the reporting user, typically in the context of a ticketing system.
38
+ */
39
+ LucidFields["Reporter"] = "user.reporter";
40
+ /**
41
+ * Refers to the time associated with an item.
42
+ */
43
+ LucidFields["Time"] = "time";
44
+ /**
45
+ * Pertains to the ending or completion time of an item.
46
+ */
47
+ LucidFields["EndTime"] = "time.endtime";
48
+ /**
49
+ * Contains estimations related to items, like time or resource estimates.
50
+ */
51
+ LucidFields["Estimate"] = "estimate";
52
+ /**
53
+ * Reflects status of an item, typically in the context of a ticketing system.
54
+ */
55
+ LucidFields["Status"] = "status";
56
+ /**
57
+ * Classifies the type of issue or item, typically in the context of a ticketing system.
58
+ */
59
+ LucidFields["IssueType"] = "issuetype";
60
+ /**
61
+ * Indicates the importance or urgency level of an item.
62
+ */
63
+ LucidFields["Priority"] = "priority";
64
+ /**
65
+ * Relates to the project with which an item is associated.
66
+ */
67
+ LucidFields["Project"] = "project";
68
+ /**
69
+ * The unique URL or identifier linking back to the item’s source.
70
+ */
71
+ LucidFields["SourceItemUrl"] = "url";
72
+ /**
73
+ * Refers to the URL of the image associated with this item
74
+ */
75
+ LucidFields["ImageUrl"] = "url.image";
76
+ })(LucidFields || (exports.LucidFields = LucidFields = {}));
77
+ exports.isLucidFields = (0, validators_1.stringEnumValidator)(LucidFields);
@@ -1,72 +1,22 @@
1
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.
2
+ * @deprecated use LucidFields instead. SemanticFields has not been removed to ensure backwards compatability.
17
3
  */
18
4
  export declare enum SemanticFields {
19
- /**
20
- * Represents the title or main descriptor of an item.
21
- */
22
5
  Title = "title",
23
- /**
24
- * Captures detailed information or a summary about an item.
25
- */
26
6
  Description = "description",
27
- /**
28
- * Refers to the user associated with or assigned to an item.
29
- */
30
7
  User = "user",
31
- /**
32
- * Specific to the reporting user, typically in the context of a ticketing system.
33
- */
34
8
  Reporter = "user.reporter",
35
- /**
36
- * Refers to the time associated with an item.
37
- */
38
9
  Time = "time",
39
- /**
40
- * Pertains to the ending or completion time of an item.
41
- */
42
10
  EndTime = "time.endtime",
43
- /**
44
- * Contains estimations related to items, like time or resource estimates.
45
- */
46
11
  Estimate = "estimate",
47
- /**
48
- * Reflects status of an item, typically in the context of a ticketing system.
49
- */
50
12
  Status = "status",
51
- /**
52
- * Classifies the type of issue or item, typically in the context of a ticketing system.
53
- */
54
13
  IssueType = "issuetype",
55
- /**
56
- * Indicates the importance or urgency level of an item.
57
- */
58
14
  Priority = "priority",
59
- /**
60
- * Relates to the project with which an item is associated.
61
- */
62
15
  Project = "project",
63
- /**
64
- * The unique URL or identifier linking back to the item’s source.
65
- */
66
16
  SourceItemUrl = "url",
67
- /**
68
- * Refers to the URL of the image associated with this item
69
- */
70
17
  ImageUrl = "url.image"
71
18
  }
19
+ /**
20
+ * @deprecated use isLucidFields instead
21
+ */
72
22
  export declare const isSemanticFields: (x: unknown) => x is SemanticFields;
@@ -3,75 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSemanticFields = exports.SemanticFields = void 0;
4
4
  const validators_1 = require("../../validators/validators");
5
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.
6
+ * @deprecated use LucidFields instead. SemanticFields has not been removed to ensure backwards compatability.
21
7
  */
22
8
  var SemanticFields;
23
9
  (function (SemanticFields) {
24
- /**
25
- * Represents the title or main descriptor of an item.
26
- */
27
10
  SemanticFields["Title"] = "title";
28
- /**
29
- * Captures detailed information or a summary about an item.
30
- */
31
11
  SemanticFields["Description"] = "description";
32
- /**
33
- * Refers to the user associated with or assigned to an item.
34
- */
35
12
  SemanticFields["User"] = "user";
36
- /**
37
- * Specific to the reporting user, typically in the context of a ticketing system.
38
- */
39
13
  SemanticFields["Reporter"] = "user.reporter";
40
- /**
41
- * Refers to the time associated with an item.
42
- */
43
14
  SemanticFields["Time"] = "time";
44
- /**
45
- * Pertains to the ending or completion time of an item.
46
- */
47
15
  SemanticFields["EndTime"] = "time.endtime";
48
- /**
49
- * Contains estimations related to items, like time or resource estimates.
50
- */
51
16
  SemanticFields["Estimate"] = "estimate";
52
- /**
53
- * Reflects status of an item, typically in the context of a ticketing system.
54
- */
55
17
  SemanticFields["Status"] = "status";
56
- /**
57
- * Classifies the type of issue or item, typically in the context of a ticketing system.
58
- */
59
18
  SemanticFields["IssueType"] = "issuetype";
60
- /**
61
- * Indicates the importance or urgency level of an item.
62
- */
63
19
  SemanticFields["Priority"] = "priority";
64
- /**
65
- * Relates to the project with which an item is associated.
66
- */
67
20
  SemanticFields["Project"] = "project";
68
- /**
69
- * The unique URL or identifier linking back to the item’s source.
70
- */
71
21
  SemanticFields["SourceItemUrl"] = "url";
72
- /**
73
- * Refers to the URL of the image associated with this item
74
- */
75
22
  SemanticFields["ImageUrl"] = "url.image";
76
23
  })(SemanticFields || (exports.SemanticFields = SemanticFields = {}));
24
+ /**
25
+ * @deprecated use isLucidFields instead
26
+ */
77
27
  exports.isSemanticFields = (0, validators_1.stringEnumValidator)(SemanticFields);
@@ -1,6 +1,7 @@
1
+ import { LucidFields } from './lucidfields';
1
2
  import { SemanticFields } from './semanticfields';
2
3
  /**
3
- * @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability.
4
+ * @deprecated use LucidFields instead. SemanticKind has not been removed to ensure backwards compatability.
4
5
  */
5
6
  export declare enum SemanticKind {
6
7
  Id = "id",
@@ -22,4 +23,8 @@ export declare enum SemanticKind {
22
23
  URL = "url"
23
24
  }
24
25
  export declare const isSemanticKind: (x: unknown) => x is SemanticKind;
26
+ export declare function semanticKindToLucidFields(semanticField: SemanticKind | SemanticFields | LucidFields): LucidFields | undefined;
27
+ /**
28
+ * @deprecated use semanticKindToLucidFields instead
29
+ */
25
30
  export declare function semanticKindToSemanticFields(semanticField: SemanticKind | SemanticFields): SemanticFields | undefined;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.semanticKindToSemanticFields = exports.isSemanticKind = exports.SemanticKind = void 0;
3
+ exports.semanticKindToSemanticFields = exports.semanticKindToLucidFields = exports.isSemanticKind = exports.SemanticKind = void 0;
4
4
  const validators_1 = require("../../validators/validators");
5
+ const lucidfields_1 = require("./lucidfields");
5
6
  const semanticfields_1 = require("./semanticfields");
6
7
  /**
7
- * @deprecated use SemanticFields instead. SemanticKind has not been removed to ensure backwards compatability.
8
+ * @deprecated use LucidFields instead. SemanticKind has not been removed to ensure backwards compatability.
8
9
  */
9
10
  var SemanticKind;
10
11
  (function (SemanticKind) {
@@ -27,8 +28,90 @@ var SemanticKind;
27
28
  SemanticKind["URL"] = "url";
28
29
  })(SemanticKind || (exports.SemanticKind = SemanticKind = {}));
29
30
  exports.isSemanticKind = (0, validators_1.enumValidator)(SemanticKind);
31
+ function semanticKindToLucidFields(semanticField) {
32
+ if ((0, lucidfields_1.isLucidFields)(semanticField)) {
33
+ return semanticField;
34
+ }
35
+ else if ((0, semanticfields_1.isSemanticFields)(semanticField)) {
36
+ switch (semanticField) {
37
+ case semanticfields_1.SemanticFields.Title:
38
+ return lucidfields_1.LucidFields.Title;
39
+ case semanticfields_1.SemanticFields.Description:
40
+ return lucidfields_1.LucidFields.Description;
41
+ case semanticfields_1.SemanticFields.User:
42
+ return lucidfields_1.LucidFields.User;
43
+ case semanticfields_1.SemanticFields.Reporter:
44
+ return lucidfields_1.LucidFields.Reporter;
45
+ case semanticfields_1.SemanticFields.Time:
46
+ return lucidfields_1.LucidFields.Time;
47
+ case semanticfields_1.SemanticFields.EndTime:
48
+ return lucidfields_1.LucidFields.EndTime;
49
+ case semanticfields_1.SemanticFields.Estimate:
50
+ return lucidfields_1.LucidFields.Estimate;
51
+ case semanticfields_1.SemanticFields.Status:
52
+ return lucidfields_1.LucidFields.Status;
53
+ case semanticfields_1.SemanticFields.IssueType:
54
+ return lucidfields_1.LucidFields.IssueType;
55
+ case semanticfields_1.SemanticFields.Priority:
56
+ return lucidfields_1.LucidFields.Priority;
57
+ case semanticfields_1.SemanticFields.Project:
58
+ return lucidfields_1.LucidFields.Project;
59
+ case semanticfields_1.SemanticFields.SourceItemUrl:
60
+ return lucidfields_1.LucidFields.SourceItemUrl;
61
+ case semanticfields_1.SemanticFields.ImageUrl:
62
+ return lucidfields_1.LucidFields.ImageUrl;
63
+ default:
64
+ return undefined;
65
+ }
66
+ }
67
+ else {
68
+ switch (semanticField) {
69
+ case SemanticKind.Id:
70
+ return undefined;
71
+ case SemanticKind.Title:
72
+ return lucidfields_1.LucidFields.Title;
73
+ // Name could have been mapped to User or Title but all uses cases outside of the unified viz API use it as Title
74
+ case SemanticKind.Name:
75
+ return lucidfields_1.LucidFields.Title;
76
+ case SemanticKind.Image:
77
+ return lucidfields_1.LucidFields.ImageUrl;
78
+ case SemanticKind.Description:
79
+ return lucidfields_1.LucidFields.Description;
80
+ case SemanticKind.Assignee:
81
+ return lucidfields_1.LucidFields.User;
82
+ case SemanticKind.Estimate:
83
+ return lucidfields_1.LucidFields.Estimate;
84
+ case SemanticKind.Status:
85
+ return lucidfields_1.LucidFields.Status;
86
+ case SemanticKind.IssueType:
87
+ return lucidfields_1.LucidFields.IssueType;
88
+ case SemanticKind.Priority:
89
+ return lucidfields_1.LucidFields.Priority;
90
+ case SemanticKind.Project:
91
+ return lucidfields_1.LucidFields.Project;
92
+ case SemanticKind.Reporter:
93
+ return lucidfields_1.LucidFields.Reporter;
94
+ case SemanticKind.StartTime:
95
+ return lucidfields_1.LucidFields.Time;
96
+ case SemanticKind.EndTime:
97
+ return lucidfields_1.LucidFields.EndTime;
98
+ case SemanticKind.GroupByHint:
99
+ return undefined;
100
+ case SemanticKind.PrimaryKeyReference:
101
+ return undefined;
102
+ case SemanticKind.URL:
103
+ return lucidfields_1.LucidFields.SourceItemUrl;
104
+ default:
105
+ return undefined;
106
+ }
107
+ }
108
+ }
109
+ exports.semanticKindToLucidFields = semanticKindToLucidFields;
110
+ /**
111
+ * @deprecated use semanticKindToLucidFields instead
112
+ */
30
113
  function semanticKindToSemanticFields(semanticField) {
31
- if ((0, semanticfields_1.isSemanticFields)(semanticField)) {
114
+ if ((0, lucidfields_1.isLucidFields)(semanticField)) {
32
115
  return semanticField;
33
116
  }
34
117
  else {
@@ -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 { LucidFields } from '../fieldtypedefinition/lucidfields';
4
5
  import { SemanticFields } from '../fieldtypedefinition/semanticfields';
5
6
  import { SemanticKind } from '../fieldtypedefinition/semantickind';
6
7
  export declare enum FieldConstraintType {
@@ -27,7 +28,7 @@ export type SerializedFieldDefinition = {
27
28
  'Type': SerializedFieldTypeDefinition;
28
29
  'Constraints'?: SerializedFieldConstraint[] | undefined;
29
30
  'SyncSchema'?: string | undefined;
30
- 'Mapping'?: readonly SemanticFields[] | readonly SemanticKind[] | undefined;
31
+ 'Mapping'?: readonly LucidFields[] | readonly SemanticFields[] | readonly SemanticKind[] | undefined;
31
32
  };
32
33
  export declare const isSerializedFieldDefinition: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
33
34
  Name: typeof isString;
@@ -37,5 +38,5 @@ export declare const isSerializedFieldDefinition: (subject: unknown) => subject
37
38
  Details: (x: unknown) => x is any;
38
39
  }>[] | undefined;
39
40
  SyncSchema: (x: unknown) => x is string | undefined;
40
- Mapping: (x: unknown) => x is SemanticFields[] | SemanticKind[] | undefined;
41
+ Mapping: (x: unknown) => x is LucidFields[] | SemanticKind[] | undefined;
41
42
  }>;
@@ -4,7 +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
+ const lucidfields_1 = require("../fieldtypedefinition/lucidfields");
8
8
  const semantickind_1 = require("../fieldtypedefinition/semantickind");
9
9
  // The options here must match com.lucidchart.data.model.fielddefinition.FieldConstraintType on the backend
10
10
  var FieldConstraintType;
@@ -28,5 +28,5 @@ exports.isSerializedFieldDefinition = (0, validators_1.strictObjectValidator)({
28
28
  'Type': fieldtypedefinition_1.isSerializedFieldTypeDefinition,
29
29
  'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
30
30
  'SyncSchema': (0, validators_1.option)(checks_1.isString),
31
- 'Mapping': (0, validators_1.option)((0, validators_1.either)((0, validators_1.arrayValidator)(semanticfields_1.isSemanticFields), (0, validators_1.arrayValidator)(semantickind_1.isSemanticKind))),
31
+ 'Mapping': (0, validators_1.option)((0, validators_1.either)((0, validators_1.arrayValidator)(lucidfields_1.isLucidFields), (0, validators_1.arrayValidator)(semantickind_1.isSemanticKind))),
32
32
  });
@@ -1,5 +1,6 @@
1
1
  import { isNumber, isUndefined } from '../core/checks';
2
2
  import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
3
+ import { LucidFields } from '../core/data/fieldtypedefinition/lucidfields';
3
4
  import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
4
5
  import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
5
6
  import { FieldConstraintType, SerializedFieldConstraint, SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition';
@@ -56,7 +57,7 @@ export interface FieldDefinition {
56
57
  name: string;
57
58
  type: FieldTypeDefinition;
58
59
  constraints?: FieldConstraintDefinition[] | undefined;
59
- mapping?: readonly SemanticFields[] | readonly SemanticKind[] | undefined;
60
+ mapping?: readonly LucidFields[] | readonly SemanticFields[] | readonly SemanticKind[] | undefined;
60
61
  }
61
62
  /**
62
63
  * Definition of a schema for creating a [Collection](#classes_data_collectionproxy-CollectionProxy)
@@ -2,6 +2,7 @@ import { SemanticCollection } from '../core/data/datasource/semanticcollection';
2
2
  import { SourceForeignKey } from '../core/data/datasource/sourceforeignkeys';
3
3
  import { UpstreamPatchType } from '../core/data/datasource/upstreampatchtype';
4
4
  import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
5
+ import { LucidFields } from '../core/data/fieldtypedefinition/lucidfields';
5
6
  import { SemanticFields } from '../core/data/fieldtypedefinition/semanticfields';
6
7
  import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
7
8
  import { FieldConstraintType } from '../core/data/serializedfield/serializedfielddefinition';
@@ -37,7 +38,7 @@ type SerializedFieldDefinitionForApi = {
37
38
  'type': SerializedFieldTypeDefinition;
38
39
  'constraints': SerializedFieldConstraintForApi[];
39
40
  'syncSchema'?: string;
40
- 'mapping'?: readonly SemanticKind[] | readonly SemanticFields[];
41
+ 'mapping'?: readonly SemanticKind[] | readonly LucidFields[] | readonly SemanticFields[];
41
42
  };
42
43
  export type SerializedSchemaForApi = {
43
44
  'fields': SerializedFieldDefinitionForApi[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.305",
3
+ "version": "0.0.307",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",