lucid-extension-sdk 0.0.410 → 0.0.412
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/core/cardintegration/cardintegrationparams.d.ts +2 -0
- package/core/cardintegration/lucidcardintegrationregistry.js +23 -15
- package/core/cardintegration/lucidcardintegrationstandardimportmodal.d.ts +10 -2
- package/core/data/datasource/semanticrelationships.d.ts +2 -1
- package/core/data/datasource/semanticrelationships.js +1 -0
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +26 -2
- package/core/sharedcardintegration/cardintegrationdefinitions.js +5 -1
- package/package.json +1 -1
|
@@ -163,12 +163,15 @@ class LucidCardIntegrationRegistry {
|
|
|
163
163
|
}
|
|
164
164
|
static serializeSearchResult(searchResult) {
|
|
165
165
|
return {
|
|
166
|
-
'
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
'
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
'srs': searchResult.searchResults.map((resultPerCollection) => ({
|
|
167
|
+
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(resultPerCollection.data),
|
|
168
|
+
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(resultPerCollection.fields),
|
|
169
|
+
'm': resultPerCollection.partialImportMetadata && {
|
|
170
|
+
'cid': resultPerCollection.partialImportMetadata.collectionId,
|
|
171
|
+
'sid': resultPerCollection.partialImportMetadata.syncDataSourceId,
|
|
172
|
+
},
|
|
173
|
+
})),
|
|
174
|
+
'ipsr': searchResult.itemsPerSearchResult,
|
|
172
175
|
};
|
|
173
176
|
}
|
|
174
177
|
static registerImportCardFromPastedLinkHandler(client, cardIntegration, serialized) {
|
|
@@ -281,16 +284,21 @@ class LucidCardIntegrationRegistry {
|
|
|
281
284
|
const result = await importModal.getSearchFields(new Map(searchSoFar));
|
|
282
285
|
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
283
286
|
});
|
|
284
|
-
client.registerAction(serialized['im']['s'], async ({ 's': param }) => {
|
|
285
|
-
const result = await importModal.search(new Map(param));
|
|
286
|
-
if ((0,
|
|
287
|
-
|
|
288
|
-
return this.serializeSearchResult(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
287
|
+
client.registerAction(serialized['im']['s'], async ({ 's': param, 'o': offset, 'l': limit }) => {
|
|
288
|
+
const result = await importModal.search(new Map(param), offset, limit);
|
|
289
|
+
if (!(0, cardintegrationdefinitions_1.isSearchResult)(result)) {
|
|
290
|
+
if ((0, checks_1.isArray)(result)) {
|
|
291
|
+
return this.serializeSearchResult({
|
|
292
|
+
searchResults: result,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
return this.serializeSearchResult({
|
|
297
|
+
searchResults: [result],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
293
300
|
}
|
|
301
|
+
return this.serializeSearchResult(result);
|
|
294
302
|
});
|
|
295
303
|
client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
|
|
296
304
|
const result = await importModal.import(primaryKeys, new Map(searchFields));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
2
|
-
import { ExtensionCardFieldDefinition, ImportResult, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
2
|
+
import { DeprecatedSearchResult, ExtensionCardFieldDefinition, ImportResult, SearchResult } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
3
3
|
import { ExtensionImportModalWidthBreakpoint } from './extensionimportmodalwidthbreakpoint';
|
|
4
4
|
/**
|
|
5
5
|
* You can use the standard import modal can be used by providing the following data:
|
|
@@ -18,6 +18,14 @@ import { ExtensionImportModalWidthBreakpoint } from './extensionimportmodalwidth
|
|
|
18
18
|
* The last requirement for the partial import to work is that the primary keys in the data also
|
|
19
19
|
* returned in this search need to match the primary keys that will be returned
|
|
20
20
|
* on import.
|
|
21
|
+
* Offset and limit are used for pagination. The offset is the number of items to skip and the limit
|
|
22
|
+
* is the maximum number of items to return. To use pagination, you have to return `totalNumberOfItems` field in
|
|
23
|
+
* the `SearchResult`.
|
|
24
|
+
* Note: When using pagination and returning a `SearchResult` array:
|
|
25
|
+
* - The `totalNumberOfItems` in each `SearchResult` represents the total number of items
|
|
26
|
+
* for the specific workspace associated with that `SearchResult`.
|
|
27
|
+
* - The length of the `SearchResult` array must remain consistent across all pages of the search.
|
|
28
|
+
*
|
|
21
29
|
*
|
|
22
30
|
* import:
|
|
23
31
|
* The user checked the boxes beside the given list of items in the collection returned from search().
|
|
@@ -39,7 +47,7 @@ export interface LucidCardIntegrationStandardImportModal {
|
|
|
39
47
|
useIsolatedSearchBarUI?: boolean;
|
|
40
48
|
maxModalWidth?: ExtensionImportModalWidthBreakpoint;
|
|
41
49
|
getSearchFields: (searchSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
42
|
-
search: (fields: Map<string, SerializedFieldType
|
|
50
|
+
search: (fields: Map<string, SerializedFieldType>, offset?: number, limit?: number) => Promise<SearchResult | DeprecatedSearchResult | DeprecatedSearchResult[]>;
|
|
43
51
|
import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult | ImportResult[]>;
|
|
44
52
|
onSetup?: () => Promise<void>;
|
|
45
53
|
}
|
|
@@ -17,7 +17,8 @@ export declare enum SemanticRelationships {
|
|
|
17
17
|
Clones = "Clones",
|
|
18
18
|
IsClonedBy = "Is Cloned By",
|
|
19
19
|
IsParentOf = "Is Parent Of",
|
|
20
|
-
IsChildOf = "Is Child Of"
|
|
20
|
+
IsChildOf = "Is Child Of",
|
|
21
|
+
Unknown = "Unknown"
|
|
21
22
|
}
|
|
22
23
|
export declare function getInverseSemanticRelationship(relationship: SemanticRelationships): SemanticRelationships;
|
|
23
24
|
export declare const isSemanticRelationship: (x: unknown) => x is SemanticRelationships;
|
|
@@ -23,6 +23,7 @@ var SemanticRelationships;
|
|
|
23
23
|
SemanticRelationships["IsClonedBy"] = "Is Cloned By";
|
|
24
24
|
SemanticRelationships["IsParentOf"] = "Is Parent Of";
|
|
25
25
|
SemanticRelationships["IsChildOf"] = "Is Child Of";
|
|
26
|
+
SemanticRelationships["Unknown"] = "Unknown";
|
|
26
27
|
})(SemanticRelationships || (exports.SemanticRelationships = SemanticRelationships = {}));
|
|
27
28
|
function getInverseSemanticRelationship(relationship) {
|
|
28
29
|
switch (relationship) {
|
|
@@ -4,7 +4,7 @@ import { DataItemProxy } from '../../data/dataitemproxy';
|
|
|
4
4
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
5
5
|
import { FieldDefinition } from '../../data/schemadefinition';
|
|
6
6
|
import { FieldDescriptor } from '../cardintegration/lucidcardintegration';
|
|
7
|
-
import { isString } from '../checks';
|
|
7
|
+
import { isArray, isString } from '../checks';
|
|
8
8
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
9
9
|
import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
10
10
|
import { SerializedFieldType, SerializedLucidDictionary, isSerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
@@ -105,7 +105,6 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
105
105
|
Type: typeof isSerializedFieldTypeDefinition;
|
|
106
106
|
Constraints: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
107
107
|
Type: (x: unknown) => x is import("../data/serializedfield/serializedfielddefinition").FieldConstraintType;
|
|
108
|
-
/** If defined, the default value for this field */
|
|
109
108
|
Details: (x: unknown) => x is any;
|
|
110
109
|
Reason: (x: unknown) => x is string | null | undefined;
|
|
111
110
|
}>[] | undefined;
|
|
@@ -124,14 +123,39 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
124
123
|
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
125
124
|
/** @ignore */
|
|
126
125
|
export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[];
|
|
126
|
+
export interface SearchResultPerCollection {
|
|
127
|
+
partialImportMetadata?: {
|
|
128
|
+
collectionId: string;
|
|
129
|
+
syncDataSourceId?: string;
|
|
130
|
+
};
|
|
131
|
+
data: CollectionDefinition;
|
|
132
|
+
fields: ExtensionCardFieldDefinition[];
|
|
133
|
+
}
|
|
127
134
|
/**
|
|
128
135
|
* Result of searching for data in the import modal
|
|
129
136
|
*
|
|
130
137
|
* If you change this interface, check if your changes need to be synced with
|
|
131
138
|
* editorextensioncardintegrationregistry.ts.
|
|
132
139
|
*
|
|
140
|
+
* By specifying the itemsPerSearchResult, you can enable pagination for results in the import modal. The offset and limit
|
|
141
|
+
* parameters in the search function will tell you which page of results to return.
|
|
142
|
+
*
|
|
133
143
|
*/
|
|
134
144
|
export interface SearchResult {
|
|
145
|
+
searchResults: SearchResultPerCollection[];
|
|
146
|
+
itemsPerSearchResult?: number | undefined;
|
|
147
|
+
}
|
|
148
|
+
export declare const isSearchResult: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
149
|
+
searchResults: typeof isArray;
|
|
150
|
+
itemsPerSearchResult: (x: unknown) => x is number | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated
|
|
154
|
+
* Deprecated version of SearchResult for backwards compatibility. Please use
|
|
155
|
+
* SearchResult instead.
|
|
156
|
+
* This will be removed in a future update.
|
|
157
|
+
*/
|
|
158
|
+
export interface DeprecatedSearchResult {
|
|
135
159
|
partialImportMetadata?: {
|
|
136
160
|
collectionId: string;
|
|
137
161
|
syncDataSourceId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedExtensionCardFieldLabelIcons = exports.deserializePlaceholderImportMetadata = exports.serializePlaceholderImportMetadata = exports.isSerializedPlaceholderImportMetadata = 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.isSerializedExtensionCardFieldLabelIcons = 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");
|
|
@@ -83,6 +83,10 @@ function deserializeCardFieldArrayDefinition(fields) {
|
|
|
83
83
|
return fields.map(deserializeCardFieldDefinition);
|
|
84
84
|
}
|
|
85
85
|
exports.deserializeCardFieldArrayDefinition = deserializeCardFieldArrayDefinition;
|
|
86
|
+
exports.isSearchResult = (0, validators_1.objectValidator)({
|
|
87
|
+
searchResults: checks_1.isArray,
|
|
88
|
+
itemsPerSearchResult: (0, validators_1.option)(checks_1.isNumber),
|
|
89
|
+
});
|
|
86
90
|
/** @ignore */
|
|
87
91
|
exports.isSerializedPlaceholderImportMetadata = (0, validators_1.objectValidator)({
|
|
88
92
|
'cid': checks_1.isString,
|