lucid-extension-sdk 0.0.86 → 0.0.87

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -51,28 +51,39 @@ export declare abstract class TaskManagementCardIntegration {
51
51
  abstract getDefaultConfig: (collection: CollectionProxy) => Promise<CardIntegrationConfig>;
52
52
  /**
53
53
  * If specified, allow the user to import cards using the standard card-import modal.
54
+ *
55
+ * getSearchFields:
56
+ * Given the values entered by the user so far into search fields, return the list of all search fields
57
+ * to display in the search form.
58
+ *
59
+ * search:
60
+ * Given values entered by the user into the search fields so far, return a collection of data to
61
+ * display in the results table. If partialImportMetadata is also returned, it will be used to create the tasks cards before
62
+ * the import is completed—which allows users to interact with the cards while the
63
+ * data is fetched asynchronously. The collectionId needs to match the id that will be
64
+ * returned from the completed import. The syncDataSourceId needs to match the
65
+ * syncDataSourceId that is passed into performDataAction.
66
+ * The last requirement for the partial import to work is that the primary keys in the data also
67
+ * returned in this search need to match the primary keys that will be returned
68
+ * on import.
69
+ *
70
+ * import:
71
+ * The user checked the boxes beside the given list of items in the collection returned from search().
72
+ * Import them, and return the collection and primary keys in that final collection that were imported.
73
+ *
74
+ * The config provided here is only used on the first import from a given source; on subsequent imports,
75
+ * the existing config will remain unchanged to preserve any customizations by the user.
54
76
  */
55
77
  abstract importModal?: {
56
- /**
57
- * Given the values entered by the user so far into search fields, return the list of all search fields
58
- * to display in the search form.
59
- */
60
78
  getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
61
- /**
62
- * Given values entered by the user into the search fields so far, return a collection of data to
63
- * display in the results table.
64
- */
65
79
  search: (fields: Map<string, SerializedFieldType>) => Promise<{
80
+ partialImportMetadata?: {
81
+ collectionId: string;
82
+ syncDataSourceId?: string;
83
+ };
66
84
  data: CollectionDefinition;
67
85
  fields: ExtensionCardFieldDefinition[];
68
86
  }>;
69
- /**
70
- * The user checked the boxes beside the given list of items in the collection returned from search().
71
- * Import them, and return the collection and primary keys in that final collection that were imported.
72
- *
73
- * The config provided here is only used on the first import from a given source; on subsequent imports,
74
- * the existing config will remain unchanged to preserve any customizations by the user.
75
- */
76
87
  import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<{
77
88
  collection: CollectionProxy;
78
89
  primaryKeys: string[];
@@ -79,11 +79,15 @@ class TaskManagementCardRegistry {
79
79
  const result = await importModal.getSearchFields(new Map(searchSoFar));
80
80
  return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
81
81
  });
82
- client.registerAction(serialized['im']['s'], async ({ 's': search }) => {
83
- const result = await importModal.search(new Map(search));
82
+ client.registerAction(serialized['im']['s'], async ({ 's': param }) => {
83
+ const result = await importModal.search(new Map(param));
84
84
  return {
85
85
  'd': (0, collectiondefinition_1.serializeCollectionDefinition)(result.data),
86
86
  'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result.fields),
87
+ 'm': result.partialImportMetadata && {
88
+ 'cid': result.partialImportMetadata.collectionId,
89
+ 'sid': result.partialImportMetadata.syncDataSourceId,
90
+ },
87
91
  };
88
92
  });
89
93
  client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
@@ -1,4 +1,4 @@
1
- import { SerializedFieldType } from '../serializedfield/serializedfields';
1
+ import { SerializedFields, SerializedFieldType } from '../serializedfield/serializedfields';
2
2
  import { SerializedSchema } from '../serializedfield/serializedschema';
3
3
  export declare const FlattenedReferenceKeyId = "192d0e9f-2f5a-4032-9f03-59bbf1ea5891";
4
4
  export declare const FlattenedReferenceKeyName = "192d0e9f-2f5a-4032-9f03-59bbf1ea5891_n";
@@ -7,6 +7,12 @@ export interface SerializedReferenceKey {
7
7
  'pk': string;
8
8
  'wl'?: string[];
9
9
  'ro'?: boolean;
10
+ 'f'?: {
11
+ 'ts': number;
12
+ 'pd': TypedSerializedFlattenedReference;
13
+ 'md'?: SerializedFields;
14
+ 'e'?: string;
15
+ };
10
16
  }
11
17
  export declare type TypedSerializedFlattenedReference = {
12
18
  'sc': SerializedSchema;
@@ -6,7 +6,7 @@ export declare type SerializedFieldDefinition = {
6
6
  'Type': SerializedFieldTypeDefinition;
7
7
  'Constraints'?: SerializedFieldConstraint[];
8
8
  'SyncSchema'?: string;
9
- 'Mapping'?: SemanticKind[];
9
+ 'Mapping'?: readonly SemanticKind[];
10
10
  };
11
11
  export declare enum FieldConstraintType {
12
12
  REQUIRED = "required",
@@ -65,6 +65,7 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
65
65
  return this.client.sendCommand("lcf" /* CommandName.ListCollectionFields */, { 'id': this.id });
66
66
  }
67
67
  getSchema() {
68
+ // we wave to cast as unknown because of readonly being used in the type
68
69
  return (0, schemadefinition_1.parseSchemaDefinition)(this.properties.get('Schema'));
69
70
  }
70
71
  }
@@ -1,5 +1,6 @@
1
1
  import { isNumber, isUndefined } from '../core/checks';
2
2
  import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
3
+ import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
3
4
  import { FieldConstraintType, SerializedFieldConstraint, SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition';
4
5
  import { SerializedSchema } from '../core/data/serializedfield/serializedschema';
5
6
  export interface RequiredFieldConstraintDefinition {
@@ -46,6 +47,7 @@ export interface FieldDefinition {
46
47
  name: string;
47
48
  type: FieldTypeDefinition;
48
49
  constraints?: FieldConstraintDefinition[];
50
+ mapping?: readonly SemanticKind[];
49
51
  }
50
52
  /**
51
53
  * Definition of a schema for creating a [Collection](#classes_data_collectionproxy-CollectionProxy)
@@ -29,6 +29,9 @@ function serializeFieldDefinition(field) {
29
29
  if (field.constraints) {
30
30
  serialized['Constraints'] = field.constraints.map(serializeFieldConstraintDefinition);
31
31
  }
32
+ if (field.mapping) {
33
+ serialized['Mapping'] = field.mapping;
34
+ }
32
35
  return serialized;
33
36
  }
34
37
  exports.serializeFieldDefinition = serializeFieldDefinition;
@@ -64,6 +67,7 @@ function parseFieldDefinition(field) {
64
67
  throw new Error('Invalid constraint format');
65
68
  }
66
69
  }),
70
+ mapping: field['Mapping'],
67
71
  };
68
72
  }
69
73
  exports.parseFieldDefinition = parseFieldDefinition;