lucid-extension-sdk 0.0.344 → 0.0.346

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
@@ -778,6 +778,11 @@ export type AddCardIntegrationQuery = {
778
778
  } | undefined;
779
779
  /** Whether to enable dependency mapping for this integration */
780
780
  'sdm'?: boolean;
781
+ /**
782
+ * Import dependencies action
783
+ * Inconsistent naming convention, to avoid calling this "ID"
784
+ */
785
+ 'idep'?: string | undefined;
781
786
  /** Icons to display throughout the card integration */
782
787
  'icu'?: {
783
788
  /** Primary Icon Url */
@@ -35,6 +35,10 @@ export declare enum FieldDisplayType {
35
35
  DateBadge = "DateBadge",
36
36
  /** Given an object containing iconUrl (optional) and name (optional), determine whether
37
37
  * to display as an ImageBadge or InitializedString (or nothing, if neither is present).
38
+ *
39
+ * If FF LucidCardUIRefresh ON:
40
+ * Given or string of name or an object containing iconUrl and name, display as
41
+ * an as a full name or an ImageBadge with full name (if name is present).
38
42
  */
39
43
  UserProfile = "UserProfile"
40
44
  }
@@ -39,6 +39,10 @@ var FieldDisplayType;
39
39
  FieldDisplayType["DateBadge"] = "DateBadge";
40
40
  /** Given an object containing iconUrl (optional) and name (optional), determine whether
41
41
  * to display as an ImageBadge or InitializedString (or nothing, if neither is present).
42
+ *
43
+ * If FF LucidCardUIRefresh ON:
44
+ * Given or string of name or an object containing iconUrl and name, display as
45
+ * an as a full name or an ImageBadge with full name (if name is present).
42
46
  */
43
47
  FieldDisplayType["UserProfile"] = "UserProfile";
44
48
  })(FieldDisplayType || (exports.FieldDisplayType = FieldDisplayType = {}));
@@ -1,3 +1,6 @@
1
+ import { CollectionDefinition } from '../../data/collectiondefinition';
2
+ import { CollectionProxy } from '../../data/collectionproxy';
3
+ import { DataItemProxy } from '../../data/dataitemproxy';
1
4
  import { FieldDefinition } from '../../data/schemadefinition';
2
5
  import { isString } from '../checks';
3
6
  import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
@@ -117,3 +120,26 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
117
120
  export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
118
121
  /** @ignore */
119
122
  export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[];
123
+ /**
124
+ * Result of searching for data in the import modal
125
+ */
126
+ export interface SearchResult {
127
+ partialImportMetadata?: {
128
+ collectionId: string;
129
+ syncDataSourceId?: string;
130
+ };
131
+ data: CollectionDefinition;
132
+ fields: ExtensionCardFieldDefinition[];
133
+ }
134
+ /**
135
+ * Result of importing data from the import modal or dependency mapping
136
+ */
137
+ export interface ImportResult {
138
+ collection: CollectionProxy;
139
+ primaryKeys: string[];
140
+ }
141
+ /**
142
+ * Maps a DataItemProxy of an item that was already imported
143
+ * to a list of primary keys for items that the original item has a relationship with.
144
+ */
145
+ export type DependenciesForItems = Map<DataItemProxy, string[]>;
@@ -4,11 +4,11 @@ import { TextStyle } from '../../document/text/textstyle';
4
4
  import { EditorClient } from '../../editorclient';
5
5
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
6
6
  import { CardIntegrationConfig } from './cardintegrationconfig';
7
- import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
7
+ import { DependenciesForItems, ExtensionCardFieldDefinition, ImportResult } from './cardintegrationdefinitions';
8
8
  import { DependencyMappingPhrasesType } from './dependencymappingphrases';
9
9
  import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
10
10
  import { LucidCardIntegrationStandardImportModal } from './lucidcardintegrationstandardimportmodal';
11
- export { ImportResult, SearchResult } from './lucidcardintegrationstandardimportmodal';
11
+ export { ImportResult, SearchResult } from './cardintegrationdefinitions';
12
12
  export declare abstract class LucidCardIntegration {
13
13
  protected readonly client: EditorClient;
14
14
  constructor(client: EditorClient);
@@ -114,6 +114,10 @@ export declare abstract class LucidCardIntegration {
114
114
  };
115
115
  showCardImport(name: string): import("../../commandtypes").ImportCardsResult;
116
116
  showDependencyMapping?: boolean;
117
+ /**
118
+ * This allows the user to import cards, by selecting dependencies of a linked item on the canvas.
119
+ */
120
+ importDependencies?: (dependenciesForItems: DependenciesForItems) => Promise<ImportResult[]>;
117
121
  /**
118
122
  * If specified, the text phrases to show in the dependency mapping UI.
119
123
  * If not specified, dependency mapping for this integration uses the default fallback phrases.
@@ -27,6 +27,16 @@ export interface ImportParam {
27
27
  's': [string, SerializedFieldType][];
28
28
  }
29
29
  /** @ignore */
30
+ interface DependenciesForItemParam {
31
+ 'oci': string;
32
+ 'opk': string;
33
+ 'pks': string[];
34
+ }
35
+ /** @ignore */
36
+ export interface DependenciesForItemsParam {
37
+ 'dfi': DependenciesForItemParam[];
38
+ }
39
+ /** @ignore */
30
40
  export interface CustomImportParam {
31
41
  'd': JsonSerializable;
32
42
  }
@@ -60,3 +70,4 @@ export interface DependencyMappingNoDependencyHeadingParam {
60
70
  export interface DependencyMappingSelectedIssueHeadingParam {
61
71
  'k': string;
62
72
  }
73
+ export {};
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LucidCardIntegrationRegistry = void 0;
4
4
  const collectiondefinition_1 = require("../../data/collectiondefinition");
5
+ const collectionproxy_1 = require("../../data/collectionproxy");
6
+ const dataitemproxy_1 = require("../../data/dataitemproxy");
5
7
  const datasourceproxy_1 = require("../../data/datasourceproxy");
6
8
  const cardintegrationconfig_1 = require("./cardintegrationconfig");
7
9
  const cardintegrationdefinitions_1 = require("./cardintegrationdefinitions");
@@ -103,6 +105,26 @@ class LucidCardIntegrationRegistry {
103
105
  : undefined,
104
106
  };
105
107
  }
108
+ if (cardIntegration.importDependencies) {
109
+ const importDependencies = cardIntegration.importDependencies;
110
+ const importDependenciesActionName = LucidCardIntegrationRegistry.nextHookName();
111
+ serialized['idep'] = importDependenciesActionName;
112
+ client.registerAction(importDependenciesActionName, async ({ 'dfi': serializedDependenciesForItems }) => {
113
+ const proxiedDependenciesForItems = new Map(serializedDependenciesForItems.map((_) => {
114
+ const collectionProxy = new collectionproxy_1.CollectionProxy(_.oci, client);
115
+ const originalItemProxy = new dataitemproxy_1.DataItemProxy(_.opk, collectionProxy, client);
116
+ return [originalItemProxy, _.pks];
117
+ }));
118
+ const proxiedResults = await importDependencies(proxiedDependenciesForItems);
119
+ const results = proxiedResults.map((result) => {
120
+ return {
121
+ 'c': result.collection.id,
122
+ 'pks': result.primaryKeys,
123
+ };
124
+ });
125
+ return results;
126
+ });
127
+ }
106
128
  return serialized;
107
129
  }
108
130
  /**
@@ -1,7 +1,5 @@
1
- import { CollectionDefinition } from '../../data/collectiondefinition';
2
- import { CollectionProxy } from '../../data/collectionproxy';
3
1
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
4
- import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
2
+ import { ExtensionCardFieldDefinition, ImportResult, SearchResult } from './cardintegrationdefinitions';
5
3
  /**
6
4
  * You can use the standard import modal can be used by providing the following data:
7
5
  *
@@ -43,21 +41,3 @@ export interface LucidCardIntegrationStandardImportModal {
43
41
  import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult>;
44
42
  onSetup?: () => Promise<void>;
45
43
  }
46
- /**
47
- * Result of searching for data in the import modal
48
- */
49
- export interface SearchResult {
50
- partialImportMetadata?: {
51
- collectionId: string;
52
- syncDataSourceId?: string;
53
- };
54
- data: CollectionDefinition;
55
- fields: ExtensionCardFieldDefinition[];
56
- }
57
- /**
58
- * Result of importing data from the import modal
59
- */
60
- export interface ImportResult {
61
- collection: CollectionProxy;
62
- primaryKeys: string[];
63
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.344",
3
+ "version": "0.0.346",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",