lucid-extension-sdk 0.0.435 → 0.0.437

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
@@ -46,6 +46,7 @@ export declare const enum CommandName {
46
46
  CalculateHash = "hsh",
47
47
  CanEditPackageSettings = "ceps",
48
48
  CancelDragBlockToCanvas = "cdc",
49
+ CheckUserFlagAssignment = "cufa",
49
50
  Confirm = "c",
50
51
  CreateBlock = "cb",
51
52
  CreateCards = "ca",
@@ -77,6 +78,7 @@ export declare const enum CommandName {
77
78
  GetCurrentPage = "gcp",
78
79
  GetCustomShape = "gcs",
79
80
  GetDataItemField = "gdif",
81
+ GetDeveloperModeStatus = "gdms",
80
82
  GetDocumentAccessPermission = "gdap",
81
83
  GetDocumentChunks = "gdc",
82
84
  GetDocumentId = "gdid",
@@ -252,6 +254,10 @@ export type CommandArgs = {
252
254
  query: CancelDragBlockToCanvasQuery;
253
255
  result: CancelDragBlockToCanvasResult;
254
256
  };
257
+ [CommandName.CheckUserFlagAssignment]: {
258
+ query: CheckUserFlagAssignmentQuery;
259
+ result: CheckUserFlagAssignmentResult;
260
+ };
255
261
  [CommandName.Confirm]: {
256
262
  query: ConfirmQuery;
257
263
  result: ConfirmResult;
@@ -376,6 +382,10 @@ export type CommandArgs = {
376
382
  query: GetDataItemFieldQuery;
377
383
  result: GetDataItemFieldResult;
378
384
  };
385
+ [CommandName.GetDeveloperModeStatus]: {
386
+ query: GetDeveloperModeStatusQuery;
387
+ result: GetDeveloperModeStatusResult;
388
+ };
379
389
  [CommandName.GetDocumentAccessPermission]: {
380
390
  query: GetDocumentAccessPermissionQuery;
381
391
  result: GetDocumentAccessPermissionResult;
@@ -735,6 +745,12 @@ export type AddCardsActions = {
735
745
  /** Create card action */
736
746
  'cc': string;
737
747
  };
748
+ export type AutoSyncSettings = {
749
+ 'h': string;
750
+ 'gsf': string;
751
+ 'sqs'?: string | undefined;
752
+ 'syqs'?: string | undefined;
753
+ };
738
754
  export type SerializedFieldConfiguration = {
739
755
  /** Callback to get field definitions for all fields supported by the card integration */
740
756
  'gf': string;
@@ -799,6 +815,8 @@ export type AddCardIntegrationQuery = {
799
815
  } | undefined;
800
816
  /** If specified, add-card settings */
801
817
  'ac'?: AddCardsActions | undefined;
818
+ /** If specified, auto sync settings */
819
+ 'as'?: AutoSyncSettings | undefined;
802
820
  /** Whether to enable dependency mapping for this integration */
803
821
  'sdm'?: boolean;
804
822
  /**
@@ -815,6 +833,11 @@ export type AddCardIntegrationQuery = {
815
833
  /** Callback to fetch icons that show next to the field labels in the card details panel */
816
834
  'flic'?: string | undefined;
817
835
  } | undefined;
836
+ /**
837
+ * @experimental
838
+ * Tag callback, to display tag information for any card
839
+ */
840
+ 'tc'?: string | undefined;
818
841
  /**
819
842
  * If specified, the text phrases to show in the dependency mapping UI.
820
843
  * If not specified, dependency mapping for this integration uses the default fallback phrases.
@@ -884,6 +907,10 @@ export type AddCardIntegrationQuery = {
884
907
  'd': string;
885
908
  'cb': string;
886
909
  } | undefined;
910
+ /**
911
+ * whether the user has access to items
912
+ */
913
+ 'hait'?: string | undefined;
887
914
  };
888
915
  export type AddCardIntegrationResult = undefined;
889
916
  /** @ignore */
@@ -1375,6 +1402,8 @@ export type GetDataItemFieldQuery = {
1375
1402
  'f': string;
1376
1403
  };
1377
1404
  export type GetDataItemFieldResult = SerializedFieldType;
1405
+ export type GetDeveloperModeStatusQuery = void;
1406
+ export type GetDeveloperModeStatusResult = boolean;
1378
1407
  export type GetDocumentAccessPermissionQuery = void;
1379
1408
  export type GetDocumentAccessPermissionResult = DocumentAccessPermission;
1380
1409
  export declare enum GetDocumentChunksType {
@@ -1990,4 +2019,9 @@ export type ZOrderQuery = {
1990
2019
  'o': ZOrderOperation;
1991
2020
  };
1992
2021
  export type ZOrderResult = undefined;
2022
+ export type CheckUserFlagAssignmentQuery = {
2023
+ /** The name of the flag that will be checked */
2024
+ 'f': string;
2025
+ };
2026
+ export type CheckUserFlagAssignmentResult = boolean;
1993
2027
  export {};
package/commandtypes.js CHANGED
@@ -23,6 +23,7 @@ exports.commandTitles = new Map([
23
23
  ["b" /* CommandName.Bootstrap */, 'Bootstrap'],
24
24
  ["ceps" /* CommandName.CanEditPackageSettings */, 'CanEditPackageSettings'],
25
25
  ["cdc" /* CommandName.CancelDragBlockToCanvas */, 'CancelDragBlockToCanvas'],
26
+ ["cufa" /* CommandName.CheckUserFlagAssignment */, 'CheckUserFlagAssignment'],
26
27
  ["c" /* CommandName.Confirm */, 'Confirm'],
27
28
  ["cb" /* CommandName.CreateBlock */, 'CreateBlock'],
28
29
  ["cc" /* CommandName.CreateCollection */, 'CreateCollection'],
@@ -50,6 +51,7 @@ exports.commandTitles = new Map([
50
51
  ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
51
52
  ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
52
53
  ["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
54
+ ["gdms" /* CommandName.GetDeveloperModeStatus */, 'GetDeveloperModeStatus'],
53
55
  ["gdap" /* CommandName.GetDocumentAccessPermission */, 'GetDocumentAccessPermission'],
54
56
  ["gdc" /* CommandName.GetDocumentChunks */, 'GetDocumentChunks'],
55
57
  ["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
@@ -0,0 +1,27 @@
1
+ import { SerializedFieldType } from '../data/serializedfield/serializedfields';
2
+ import { ExtensionCardFieldDefinition, ImportResult, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
3
+ export interface CardIntegrationAutoSyncConfig {
4
+ /**
5
+ * The header to display for the integration. For example, the Jira integration displays "JQL query sync"
6
+ */
7
+ header: string;
8
+ /**
9
+ * Callback that should return a single field that users can use to determine which instance, workspace,
10
+ * organization (or any equivalent field for an extension) so that the data source id can be caluclated
11
+ *
12
+ * The value is the syncDataSourceIdNonce. If this is the same no matter what, return a single ExtensionCardField
13
+ * with a single ExtensionCardFieldOption in ExtensionCardField.options
14
+ */
15
+ getSyncDataSourceIdField: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
16
+ /**
17
+ * Perform a search on the query string. This should support pagination.
18
+ *
19
+ * The syncDataSourceIdNonce is provided in otherFields
20
+ * @returns either an error AutoSyncError or an array of issues / tasks / cards represented as an AutoSyncRow
21
+ */
22
+ searchQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>, pageNumber: number, nextPageToken: string | undefined) => Promise<SearchResult>;
23
+ /**
24
+ * @returns the ImportResult for the query string.
25
+ */
26
+ syncQueryString?: (queryString: string, otherFields: Map<string, SerializedFieldType>) => Promise<ImportResult | ImportResult[]>;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -23,6 +23,16 @@ export interface SearchParam {
23
23
  'o': number;
24
24
  'l': number;
25
25
  }
26
+ export interface QuerySearchParam {
27
+ 'qs': string;
28
+ 'of': [string, SerializedFieldType][];
29
+ 'pn': number;
30
+ 'npt': string | undefined;
31
+ }
32
+ export interface QuerySyncParam {
33
+ 'qs': string;
34
+ 'of': [string, SerializedFieldType][];
35
+ }
26
36
  /** @ignore */
27
37
  export interface ImportParam {
28
38
  'pks': string[];
@@ -81,7 +91,7 @@ export interface DependencyMappingSelectedIssueHeadingParam {
81
91
  'k': string;
82
92
  }
83
93
  /** @ignore */
84
- export interface FieldLabelIconsCallbackParam {
94
+ export interface DataItemCallbackParam {
85
95
  'd': string;
86
96
  'c': string;
87
97
  'p': string;
@@ -90,4 +100,9 @@ export interface FieldLabelIconsCallbackParam {
90
100
  export interface ImportFromSerializedFieldsCallbackParam {
91
101
  'sf': SerializedFields[];
92
102
  }
103
+ /** @ignore */
104
+ export interface HasAccessToItemsParam {
105
+ 'ek': string;
106
+ 'dk'?: string;
107
+ }
93
108
  export {};
@@ -0,0 +1,18 @@
1
+ import { SerializedFieldConstraint } from '../data/serializedfield/serializedfielddefinition';
2
+ /**
3
+ * Defines whether the current user has access to an item.
4
+ */
5
+ export interface CardUserAccessResult {
6
+ hasPermission: boolean;
7
+ constraints: {
8
+ fieldName: string;
9
+ constraints?: SerializedFieldConstraint[];
10
+ }[];
11
+ }
12
+ export declare function serializeCardUserAccessResult(result: CardUserAccessResult): {
13
+ hp: boolean;
14
+ c: {
15
+ fn: string;
16
+ cs: SerializedFieldConstraint[] | undefined;
17
+ }[];
18
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeCardUserAccessResult = void 0;
4
+ function serializeCardUserAccessResult(result) {
5
+ return {
6
+ 'hp': result.hasPermission,
7
+ 'c': result.constraints.map((c) => ({
8
+ 'fn': c.fieldName,
9
+ 'cs': c.constraints,
10
+ })),
11
+ };
12
+ }
13
+ exports.serializeCardUserAccessResult = serializeCardUserAccessResult;
@@ -7,7 +7,9 @@ import { SerializedFieldType, SerializedFields } from '../data/serializedfield/s
7
7
  import { ImportCardFromDetails } from '../importcardfromdetails/importcardfromdetails';
8
8
  import { ImportCardFromPastedLinkCallback } from '../importcardfrompastedlink/importcardfrompastedlinkcallback';
9
9
  import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
10
+ import { CardIntegrationAutoSyncConfig } from './cardintegrationautosyncconfig';
10
11
  import { CardIntegrationConfig } from './cardintegrationconfig';
12
+ import { CardUserAccessResult } from './carduseraccessresult';
11
13
  import { DependencyMappingPhrasesType } from './dependencymappingphrases';
12
14
  import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
13
15
  import { LucidCardIntegrationStandardImportModal } from './lucidcardintegrationstandardimportmodal';
@@ -79,6 +81,12 @@ export declare abstract class LucidCardIntegration {
79
81
  */
80
82
  fieldLabelIconsCallback?: string;
81
83
  };
84
+ /**
85
+ * @experimental Optional. Callback function to derive a tag for any given card.
86
+ * A tag is a combination of a text label (preferably short, less than two words) and an icon,
87
+ * which can provide extra user-facing information in the card details panel.
88
+ */
89
+ tagCallback?: string;
82
90
  /** If we are only able to search by name and not email in the card integration (ex: for JDC) */
83
91
  searchUserByName?: boolean;
84
92
  /** This is used to search for users in the card integration. It returns an additional email field of the user if available.*/
@@ -115,6 +123,10 @@ export declare abstract class LucidCardIntegration {
115
123
  primaryKey: string;
116
124
  }>;
117
125
  };
126
+ /**
127
+ * If specified, allows the user to use query to sync with timelines.
128
+ */
129
+ autoSync?: CardIntegrationAutoSyncConfig;
118
130
  showCardImport(name: string): import("../../commandtypes").ImportCardsResult;
119
131
  showDependencyMapping?: boolean;
120
132
  /**
@@ -143,4 +155,8 @@ export declare abstract class LucidCardIntegration {
143
155
  * the import.
144
156
  */
145
157
  importFromSerializedFields?: (data: SerializedFields[]) => Promise<ImportCardFromDetails>;
158
+ /**
159
+ * @experimental When defined, allows the extension to make cards that the user doesn't have access to view-only.
160
+ */
161
+ hasAccessToItems?: (editedKey: string, dependencyKey: string | undefined) => Promise<CardUserAccessResult>;
146
162
  }
@@ -2,7 +2,7 @@ import { DataItemProxy } from '../../data/dataitemproxy';
2
2
  import { DataSourceProxy } from '../../data/datasourceproxy';
3
3
  import { EditorClient } from '../../editorclient';
4
4
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
5
- import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
5
+ import { ExtensionCardFieldLabelIcons, ExtensionCardFieldOption, ExtensionCardUserData, TagCallback } from '../sharedcardintegration/cardintegrationdefinitions';
6
6
  import { LucidCardIntegration } from './lucidcardintegration';
7
7
  export declare class LucidCardIntegrationRegistry {
8
8
  private static nextHookId;
@@ -14,8 +14,13 @@ export declare class LucidCardIntegrationRegistry {
14
14
  }) => Promise<ExtensionCardFieldOption[]>): string;
15
15
  static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
16
16
  static registerFieldLabelIconsCallback(client: EditorClient, callback: (dataSourceProxy: DataSourceProxy, dataItemProxy: DataItemProxy) => Promise<ExtensionCardFieldLabelIcons>): string;
17
+ static registerTagCallback(client: EditorClient, callback: TagCallback): string;
17
18
  private static registerDependencyMapping;
18
19
  private static serializeSearchResult;
20
+ /**
21
+ * Helper to serialize import results (single or array) to the expected format.
22
+ */
23
+ private static serializeImportResults;
19
24
  private static registerImportCardFromPastedLinkHandler;
20
25
  /**
21
26
  * Register a card integration.
@@ -10,6 +10,7 @@ const checks_1 = require("../checks");
10
10
  const importcardfromdetails_1 = require("../importcardfromdetails/importcardfromdetails");
11
11
  const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
12
12
  const cardintegrationconfig_1 = require("./cardintegrationconfig");
13
+ const carduseraccessresult_1 = require("./carduseraccessresult");
13
14
  const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
14
15
  class LucidCardIntegrationRegistry {
15
16
  static nextHookName() {
@@ -59,6 +60,21 @@ class LucidCardIntegrationRegistry {
59
60
  });
60
61
  return name;
61
62
  }
63
+ static registerTagCallback(client, callback) {
64
+ const name = LucidCardIntegrationRegistry.nextHookName();
65
+ client.registerAction(name, async ({ 'd': dataSourceId, 'c': collectionId, 'p': primaryKey, }) => {
66
+ const dataSourceProxy = new datasourceproxy_1.DataSourceProxy(dataSourceId, client);
67
+ const collectionProxy = new collectionproxy_1.CollectionProxy(collectionId, client);
68
+ const dataItemProxy = new dataitemproxy_1.DataItemProxy(primaryKey, collectionProxy, client);
69
+ const result = await callback(dataSourceProxy, collectionProxy, dataItemProxy);
70
+ if (result === undefined) {
71
+ return undefined;
72
+ }
73
+ const serializedResult = (0, cardintegrationdefinitions_1.serializeTagCallbackResult)(result);
74
+ return serializedResult;
75
+ });
76
+ return name;
77
+ }
62
78
  static registerDependencyMapping(client, cardIntegration, serialized) {
63
79
  if (cardIntegration.showDependencyMapping) {
64
80
  serialized['sdm'] = true;
@@ -172,6 +188,24 @@ class LucidCardIntegrationRegistry {
172
188
  },
173
189
  })),
174
190
  'ipsr': searchResult.itemsPerSearchResult,
191
+ 'e': searchResult.error,
192
+ };
193
+ }
194
+ /**
195
+ * Helper to serialize import results (single or array) to the expected format.
196
+ */
197
+ static serializeImportResults(result) {
198
+ if ((0, checks_1.isArray)(result)) {
199
+ return result.map((importResult) => {
200
+ return {
201
+ 'c': importResult.collection.id,
202
+ 'pks': importResult.primaryKeys,
203
+ };
204
+ });
205
+ }
206
+ return {
207
+ 'c': result.collection.id,
208
+ 'pks': result.primaryKeys,
175
209
  };
176
210
  }
177
211
  static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
@@ -256,6 +290,9 @@ class LucidCardIntegrationRegistry {
256
290
  'flic': cardIntegration.iconConfiguration.fieldLabelIconsCallback,
257
291
  };
258
292
  }
293
+ if (cardIntegration.tagCallback) {
294
+ serialized['tc'] = cardIntegration.tagCallback;
295
+ }
259
296
  if (cardIntegration.importModal) {
260
297
  const importModal = cardIntegration.importModal;
261
298
  if (importModal instanceof lucidcardintegrationcustomimportmodal_1.LucidCardIntegrationCustomImportModal) {
@@ -341,6 +378,41 @@ class LucidCardIntegrationRegistry {
341
378
  };
342
379
  });
343
380
  }
381
+ if (cardIntegration.autoSync) {
382
+ const autoSync = cardIntegration.autoSync;
383
+ serialized['as'] = {
384
+ 'h': autoSync.header,
385
+ 'gsf': LucidCardIntegrationRegistry.nextHookName(),
386
+ };
387
+ client.registerAction(serialized['as']['gsf'], async ({ 'i': inputSoFar }) => {
388
+ const result = await autoSync.getSyncDataSourceIdField(new Map(inputSoFar));
389
+ return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
390
+ });
391
+ if (autoSync.searchQueryString) {
392
+ serialized['as']['sqs'] = LucidCardIntegrationRegistry.nextHookName();
393
+ client.registerAction(serialized['as']['sqs'], async ({ 'qs': queryString, 'of': otherFields, 'pn': pageNumber, 'npt': nextPageToken, }) => {
394
+ var _a;
395
+ const result = await ((_a = autoSync.searchQueryString) === null || _a === void 0 ? void 0 : _a.call(autoSync, queryString, new Map(otherFields), pageNumber, nextPageToken));
396
+ if (result) {
397
+ return this.serializeSearchResult(result);
398
+ }
399
+ else {
400
+ return this.serializeSearchResult({
401
+ searchResults: [],
402
+ error: 'Unknown Error Occurred',
403
+ });
404
+ }
405
+ });
406
+ }
407
+ if (autoSync.syncQueryString) {
408
+ serialized['as']['syqs'] = LucidCardIntegrationRegistry.nextHookName();
409
+ client.registerAction(serialized['as']['syqs'], async ({ 'qs': queryString, 'of': otherFields }) => {
410
+ var _a, _b;
411
+ const result = (_b = (await ((_a = autoSync.syncQueryString) === null || _a === void 0 ? void 0 : _a.call(autoSync, queryString, new Map(otherFields))))) !== null && _b !== void 0 ? _b : [];
412
+ return LucidCardIntegrationRegistry.serializeImportResults(result);
413
+ });
414
+ }
415
+ }
344
416
  if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
345
417
  serialized['fc']['cfds'] = {
346
418
  'd': cardIntegration.fieldConfiguration.customFieldDisplaySettings.defaultToMultilineText,
@@ -358,6 +430,14 @@ class LucidCardIntegrationRegistry {
358
430
  return (0, importcardfromdetails_1.serializeImportCardFromDetails)(result);
359
431
  });
360
432
  }
433
+ if (cardIntegration.hasAccessToItems) {
434
+ const hasAccessToItemsActionName = LucidCardIntegrationRegistry.nextHookName();
435
+ serialized['hait'] = hasAccessToItemsActionName;
436
+ client.registerAction(hasAccessToItemsActionName, async ({ 'ek': editedKey, 'dk': dependencyKey }) => {
437
+ const result = await cardIntegration.hasAccessToItems(editedKey, dependencyKey);
438
+ return (0, carduseraccessresult_1.serializeCardUserAccessResult)(result);
439
+ });
440
+ }
361
441
  client.sendCommand("aci" /* CommandName.AddCardIntegration */, serialized);
362
442
  }
363
443
  }
@@ -1,10 +1,10 @@
1
- import { SerializedLucidDictionary } from './serializedfield/serializedfields';
1
+ import { SerializedLucidIconData } from './serializedfield/serializedfields';
2
2
  /**
3
- * Creates icon data as a SerializedLucidDictionary.
3
+ * Creates icon data as a SerializedLucidIconData.
4
4
  * Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
5
5
  * @param icon - The URL or SVG data for the icon
6
6
  * @param ariaLabel - The accessible label for the icon
7
7
  * @param tooltipLabel - Optional tooltip text
8
- * @returns A SerializedLucidDictionary with the keys: icon, ariaLabel, and tooltipLabel (if provided)
8
+ * @returns A SerializedLucidIconData with the keys: icon, ariaLabel, and tooltipLabel (if provided)
9
9
  */
10
- export declare function createLucidIconData(icon: string, ariaLabel: string, tooltipLabel?: string): SerializedLucidDictionary;
10
+ export declare function createLucidIconData(icon: string, ariaLabel: string, tooltipLabel?: string): SerializedLucidIconData;
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLucidIconData = void 0;
4
4
  /**
5
- * Creates icon data as a SerializedLucidDictionary.
5
+ * Creates icon data as a SerializedLucidIconData.
6
6
  * Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
7
7
  * @param icon - The URL or SVG data for the icon
8
8
  * @param ariaLabel - The accessible label for the icon
9
9
  * @param tooltipLabel - Optional tooltip text
10
- * @returns A SerializedLucidDictionary with the keys: icon, ariaLabel, and tooltipLabel (if provided)
10
+ * @returns A SerializedLucidIconData with the keys: icon, ariaLabel, and tooltipLabel (if provided)
11
11
  */
12
12
  function createLucidIconData(icon, ariaLabel, tooltipLabel) {
13
13
  return {
@@ -139,7 +139,15 @@ export declare const isSerializedTimeObject: (subject: unknown) => subject is im
139
139
  minutes: (x: unknown) => x is number | undefined;
140
140
  seconds: (x: unknown) => x is number | undefined;
141
141
  }>;
142
- export declare const isSerializedLucidIconDataDictionary: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
142
+ export type SerializedLucidIconData = {
143
+ 'dict': {
144
+ 'icon': string;
145
+ 'ariaLabel': string;
146
+ 'tooltipLabel'?: string | undefined;
147
+ 'roundedIcon'?: boolean | undefined;
148
+ };
149
+ };
150
+ export declare const isSerializedLucidIconData: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
143
151
  dict: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
144
152
  icon: typeof isString;
145
153
  ariaLabel: typeof isString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconDataDictionary = exports.isSerializedTimeObject = exports.isSerializedLucidDateRangeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidAvatarDataDictionary = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
3
+ exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconData = exports.isSerializedTimeObject = exports.isSerializedLucidDateRangeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidAvatarDataDictionary = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
4
4
  const checks_1 = require("../../checks");
5
5
  const validators_1 = require("../../validators/validators");
6
6
  function isSerializedColorObjectFieldType(value) {
@@ -44,7 +44,7 @@ exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
44
44
  'minutes': (0, validators_1.option)(checks_1.isNumber),
45
45
  'seconds': (0, validators_1.option)(checks_1.isNumber),
46
46
  });
47
- exports.isSerializedLucidIconDataDictionary = (0, validators_1.objectValidator)({
47
+ exports.isSerializedLucidIconData = (0, validators_1.objectValidator)({
48
48
  'dict': (0, validators_1.objectValidator)({
49
49
  'icon': checks_1.isString,
50
50
  'ariaLabel': checks_1.isString,
@@ -64,7 +64,7 @@ function isSerializedFieldType(value) {
64
64
  (0, exports.isSerializedLucidDateRangeObject)(value) ||
65
65
  (0, exports.isSerializedTimeObject)(value) ||
66
66
  isSerializedColorObjectFieldType(value) ||
67
- (0, exports.isSerializedLucidIconDataDictionary)(value) ||
67
+ (0, exports.isSerializedLucidIconData)(value) ||
68
68
  (0, exports.isSerializedLucidAvatarDataDictionary)(value));
69
69
  }
70
70
  exports.isSerializedFieldType = isSerializedFieldType;
@@ -7,7 +7,7 @@ import { FieldDescriptor } from '../cardintegration/lucidcardintegration';
7
7
  import { isArray, isString } from '../checks';
8
8
  import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
9
9
  import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
10
- import { SerializedFieldType, SerializedLucidDictionary, isSerializedFieldType } from '../data/serializedfield/serializedfields';
10
+ import { SerializedFieldType, SerializedLucidIconData, isSerializedFieldType } from '../data/serializedfield/serializedfields';
11
11
  /** For fields with Option or ApiOption type, the label and value for each available option */
12
12
  export interface ExtensionCardFieldOption {
13
13
  label: string;
@@ -161,6 +161,7 @@ export interface SearchResultPerCollection {
161
161
  export interface SearchResult {
162
162
  searchResults: SearchResultPerCollection[];
163
163
  itemsPerSearchResult?: number | undefined;
164
+ error?: string | undefined;
164
165
  }
165
166
  export declare const isSearchResult: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
166
167
  searchResults: typeof isArray;
@@ -275,4 +276,34 @@ export type ExtensionFieldConfiguration = {
275
276
  * Maps item field names to icons that show next to the field labels in the card details panel.
276
277
  * Use the `createLucidIconData()` helper to format the icon data in this map.
277
278
  */
278
- export type ExtensionCardFieldLabelIcons = Map<string, SerializedLucidDictionary>;
279
+ export type ExtensionCardFieldLabelIcons = Map<string, SerializedLucidIconData>;
280
+ /**
281
+ * @experimental Callback function to derive a tag for any given card's data item.
282
+ * A tag is a combination of a text label (preferably short, less than two words) and an icon,
283
+ * which can provide extra user-facing information in the card details panel.
284
+ */
285
+ export type TagCallback = (dataSourceProxy: DataSourceProxy, collectionProxy: CollectionProxy, dataItemProxy: DataItemProxy) => Promise<TagCallbackResult | undefined>;
286
+ /** @ignore */
287
+ export type TagCallbackResult = {
288
+ label: string;
289
+ icon?: SerializedLucidIconData | undefined;
290
+ };
291
+ /** @ignore */
292
+ export interface SerializedTagCallbackResult {
293
+ 'l': string;
294
+ 'i'?: SerializedLucidIconData | undefined;
295
+ }
296
+ /** @ignore */
297
+ export declare const isSerializedTagCallbackResult: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
298
+ l: typeof isString;
299
+ i: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
300
+ dict: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
301
+ icon: typeof isString;
302
+ ariaLabel: typeof isString;
303
+ tooltipLabel: (x: unknown) => x is string | undefined;
304
+ roundedIcon: (x: unknown) => x is boolean | undefined;
305
+ }>;
306
+ }> | undefined;
307
+ }>;
308
+ /** @ignore */
309
+ export declare function serializeTagCallbackResult(tag: TagCallbackResult): SerializedTagCallbackResult;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.deserializeCardUserData = exports.serializeCardUserData = void 0;
3
+ exports.serializeTagCallbackResult = exports.isSerializedTagCallbackResult = exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = exports.isSearchResult = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = exports.isSerializedCardUserDataArray = exports.isSerializedCardUserData = exports.deserializeCardUserData = exports.serializeCardUserData = void 0;
4
4
  const collectiondefinition_1 = require("../../data/collectiondefinition");
5
5
  const schemadefinition_1 = require("../../data/schemadefinition");
6
6
  const checks_1 = require("../checks");
@@ -104,3 +104,16 @@ function deserializePlaceholderImportMetadata(serializedPlaceholderImportMetadat
104
104
  };
105
105
  }
106
106
  exports.deserializePlaceholderImportMetadata = deserializePlaceholderImportMetadata;
107
+ /** @ignore */
108
+ exports.isSerializedTagCallbackResult = (0, validators_1.objectValidator)({
109
+ 'l': checks_1.isString,
110
+ 'i': (0, validators_1.option)(serializedfields_1.isSerializedLucidIconData),
111
+ });
112
+ /** @ignore */
113
+ function serializeTagCallbackResult(tag) {
114
+ return {
115
+ 'l': tag.label,
116
+ 'i': tag === null || tag === void 0 ? void 0 : tag.icon,
117
+ };
118
+ }
119
+ exports.serializeTagCallbackResult = serializeTagCallbackResult;
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchCollectionIdFromPossibleBranchedCollectionId = exports.branchedCollectionId = void 0;
4
- // LAL-1631: make sure references to this method are correct
5
4
  /** @ignore */
6
5
  function branchedCollectionId(upstreamId) {
7
6
  return upstreamId + '_b';
8
7
  }
9
8
  exports.branchedCollectionId = branchedCollectionId;
10
- // LAL-1631: make sure references to this method are correct
11
9
  /** @ignore */
12
10
  function patchCollectionIdFromPossibleBranchedCollectionId(branchId) {
13
11
  if (branchId && branchId.endsWith('_b')) {
@@ -35,6 +35,13 @@ export declare class DataSourceClient {
35
35
  getMetadata(keys: string[], prefixes?: string[]): Promise<MetadataRecord[]>;
36
36
  /** @ignore until metadata endpoints are made part of the public API */
37
37
  patchMetadata(patches: MetadataPatch[]): Promise<MetadataPatchResponse>;
38
+ /**
39
+ * @ignore as this is primarily an internal-use method.
40
+ * Checks the current value of the given feature flag. This cannot take into account any local overrides, and can
41
+ * only be used for feature flags (not other forms of AB test). This method reads feature flag values from our
42
+ * "frontend" selection of feature flags.
43
+ */
44
+ getFeatureFlagValue(flagName: string): Promise<boolean>;
38
45
  }
39
46
  /**
40
47
  * A version of the DataSourceClient that you can use for any automated tests of your data connector.
@@ -204,6 +204,32 @@ class DataSourceClient {
204
204
  await (0, throwunsuccessful_1.throwUnsuccessful)(response, 'patching data source`s metadata');
205
205
  return { status: 'NoContent' };
206
206
  }
207
+ /**
208
+ * @ignore as this is primarily an internal-use method.
209
+ * Checks the current value of the given feature flag. This cannot take into account any local overrides, and can
210
+ * only be used for feature flags (not other forms of AB test). This method reads feature flag values from our
211
+ * "frontend" selection of feature flags.
212
+ */
213
+ async getFeatureFlagValue(flagName) {
214
+ const flagRequest = await this.fetchMethod(`${this.urls.main}features/frontend`, {
215
+ 'method': 'GET',
216
+ 'headers': {
217
+ 'Content-Type': 'application/json',
218
+ },
219
+ });
220
+ if (!flagRequest.ok) {
221
+ return false;
222
+ }
223
+ const response = await flagRequest.json();
224
+ const featureFlagResponseObjectValidator = (0, validators_1.objectValidator)({
225
+ featureFlags: (0, validators_1.objectOfValidator)(checks_1.isBoolean, checks_1.isString),
226
+ });
227
+ if (!featureFlagResponseObjectValidator(response)) {
228
+ return false;
229
+ }
230
+ const flagValue = response.featureFlags[flagName];
231
+ return !!flagValue;
232
+ }
207
233
  }
208
234
  exports.DataSourceClient = DataSourceClient;
209
235
  /**
package/editorclient.d.ts CHANGED
@@ -361,6 +361,12 @@ export declare class EditorClient {
361
361
  * @hidden
362
362
  */
363
363
  protected listenToEditor(): void;
364
+ /**
365
+ * @ignore Until releasing developer mode
366
+ * Check to know if the editor is currently in developer mode
367
+ * @returns true if the editor is in developer mode, false otherwise
368
+ */
369
+ getDeveloperModeStatus(): boolean;
364
370
  /**
365
371
  * Display an alert modal to the user
366
372
  * @param text Body text to display in the alert modal
@@ -431,5 +437,12 @@ export declare class EditorClient {
431
437
  */
432
438
  /** @ignore because our documentation gets generated incorrectly for an as-yet unknown reason. It seems to refer to the HashAlgorithmEnum with an incorrect link. */
433
439
  hash(algorithm: HashAlgorithmEnum, string: string): string;
440
+ /**
441
+ * @ignore as this is primarily an internal-use method.
442
+ *
443
+ * Checks the current value of the given feature flag for the current user. This takes into
444
+ * account any local overrides, and can only be used for feature flags (not other forms of AB test).
445
+ */
446
+ checkUserFlagAssignment(flagName: string): boolean;
434
447
  constructor();
435
448
  }
package/editorclient.js CHANGED
@@ -615,6 +615,14 @@ class EditorClient {
615
615
  return (_a = this.callbacks.get(msg['id'])) === null || _a === void 0 ? void 0 : _a(msg);
616
616
  });
617
617
  }
618
+ /**
619
+ * @ignore Until releasing developer mode
620
+ * Check to know if the editor is currently in developer mode
621
+ * @returns true if the editor is in developer mode, false otherwise
622
+ */
623
+ getDeveloperModeStatus() {
624
+ return this.sendCommand("gdms" /* CommandName.GetDeveloperModeStatus */, undefined);
625
+ }
618
626
  /**
619
627
  * Display an alert modal to the user
620
628
  * @param text Body text to display in the alert modal
@@ -723,6 +731,15 @@ class EditorClient {
723
731
  hash(algorithm, string) {
724
732
  return this.sendCommand("hsh" /* CommandName.CalculateHash */, { 'a': algorithm, 's': string });
725
733
  }
734
+ /**
735
+ * @ignore as this is primarily an internal-use method.
736
+ *
737
+ * Checks the current value of the given feature flag for the current user. This takes into
738
+ * account any local overrides, and can only be used for feature flags (not other forms of AB test).
739
+ */
740
+ checkUserFlagAssignment(flagName) {
741
+ return this.sendCommand("cufa" /* CommandName.CheckUserFlagAssignment */, { 'f': flagName });
742
+ }
726
743
  constructor() {
727
744
  this.nextId = 0;
728
745
  this.callbacks = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.435",
3
+ "version": "0.0.437",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",