lucid-extension-sdk 0.0.354 → 0.0.356

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.
@@ -5,6 +5,7 @@ const collectiondefinition_1 = require("../../data/collectiondefinition");
5
5
  const collectionproxy_1 = require("../../data/collectionproxy");
6
6
  const dataitemproxy_1 = require("../../data/dataitemproxy");
7
7
  const datasourceproxy_1 = require("../../data/datasourceproxy");
8
+ const checks_1 = require("../checks");
8
9
  const cardintegrationconfig_1 = require("./cardintegrationconfig");
9
10
  const cardintegrationdefinitions_1 = require("./cardintegrationdefinitions");
10
11
  const lucidcardintegrationcustomimportmodal_1 = require("./lucidcardintegrationcustomimportmodal");
@@ -219,6 +220,14 @@ class LucidCardIntegrationRegistry {
219
220
  });
220
221
  client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
221
222
  const result = await importModal.import(primaryKeys, new Map(searchFields));
223
+ if ((0, checks_1.isArray)(result)) {
224
+ return result.map((importResult) => {
225
+ return {
226
+ 'c': importResult.collection.id,
227
+ 'pks': importResult.primaryKeys,
228
+ };
229
+ });
230
+ }
222
231
  return {
223
232
  'c': result.collection.id,
224
233
  'pks': result.primaryKeys,
@@ -38,6 +38,6 @@ export interface LucidCardIntegrationStandardImportModal {
38
38
  useIsolatedSearchBarUI?: boolean;
39
39
  getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
40
40
  search: (fields: Map<string, SerializedFieldType>) => Promise<SearchResult>;
41
- import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult>;
41
+ import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult | ImportResult[]>;
42
42
  onSetup?: () => Promise<void>;
43
43
  }
@@ -18,6 +18,11 @@ type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends Scala
18
18
  * There is fromItems which does the above will full type information, and fromItems sparse
19
19
  * which allows all the fields not part of the primaryKey to be undefined. The former should
20
20
  * be used with initial imports, and the latter can be used for updates.
21
+ *
22
+ * If you declare your schema using PrimaryKey values that *exactly* match (case sensitive) the enum values of
23
+ * `collectionenumfieldtype.ts` (e.g. using a key with the value "id" for your ID field) you will be opting in to some
24
+ * additional (and valuable) user functionality. This includes better support in the edit panel, and better user facing
25
+ * descriptions of your fields.
21
26
  */
22
27
  export declare function declareSchema<Names extends string, Types extends Readonly<FieldTypeDefinition>, Constraint extends FieldConstraintDefinition, Fields extends {
23
28
  [Name in Names]: {
@@ -12,6 +12,11 @@ function isArrayAndAssertReadonly(val) {
12
12
  * There is fromItems which does the above will full type information, and fromItems sparse
13
13
  * which allows all the fields not part of the primaryKey to be undefined. The former should
14
14
  * be used with initial imports, and the latter can be used for updates.
15
+ *
16
+ * If you declare your schema using PrimaryKey values that *exactly* match (case sensitive) the enum values of
17
+ * `collectionenumfieldtype.ts` (e.g. using a key with the value "id" for your ID field) you will be opting in to some
18
+ * additional (and valuable) user functionality. This includes better support in the edit panel, and better user facing
19
+ * descriptions of your fields.
15
20
  */
16
21
  function declareSchema({ primaryKey, fields }) {
17
22
  const primaryKeyObj = new FormattedPrimaryKey(...primaryKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.354",
3
+ "version": "0.0.356",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",