lucid-extension-sdk 1.1.2 → 1.2.0
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 +36 -8
- package/commandtypes.js +1 -1
- package/core/cardintegration/cardintegrationautosyncconfig.d.ts +20 -2
- package/core/cardintegration/cardintegrationparams.d.ts +4 -0
- package/core/cardintegration/lucidcardintegrationregistry.d.ts +4 -6
- package/core/cardintegration/lucidcardintegrationregistry.js +11 -219
- package/core/checks.d.ts +1 -0
- package/core/checks.js +14 -0
- package/core/lucidproduct.d.ts +1 -0
- package/core/lucidproduct.js +1 -0
- package/core/sharedcardintegration/sharedregistryutil.d.ts +58 -1
- package/core/sharedcardintegration/sharedregistryutil.js +237 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegration.d.ts +13 -0
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.d.ts +5 -1
- package/core/spreadsheetintegration/lucidspreadsheetintegrationregistry.js +21 -15
- package/core/validators/validators.d.ts +1 -0
- package/core/validators/validators.js +1 -0
- package/data/collectiondefinition.d.ts +2 -0
- package/data/collectiondefinition.js +1 -0
- package/data/collectionerrortypes.d.ts +4 -0
- package/data/collectionerrortypes.js +4 -0
- package/data/dataupdatefiltertype.d.ts +1 -0
- package/data/displayoptiondefinition.d.ts +5 -0
- package/data/displayoptiondefinition.js +2 -0
- package/data/fieldconstraintdefinition.d.ts +13 -0
- package/data/fieldconstraintdefinition.js +3 -0
- package/data/patchcollectionproxy.d.ts +2 -0
- package/data/patchcollectionproxy.js +2 -0
- package/data/patcherrortype.d.ts +1 -0
- package/data/referencekeydefinition.d.ts +6 -5
- package/data/referencekeyproxy.d.ts +1 -0
- package/data/referencekeyproxy.js +1 -0
- package/data/schemadefinition.d.ts +2 -2
- package/dataconnector/actions/action.d.ts +24 -1
- package/dataconnector/actions/action.js +7 -1
- package/dataconnector/actions/dataconnectoractionkeys.d.ts +1 -0
- package/dataconnector/actions/patch.d.ts +10 -0
- package/dataconnector/actions/patch.js +9 -0
- package/dataconnector/actions/patchresponsebody.d.ts +2 -0
- package/dataconnector/actions/serializedactions.d.ts +1 -0
- package/dataconnector/actions/serializedactions.js +8 -5
- package/dataconnector/actions/serializedpatchtypes.d.ts +10 -0
- package/dataconnector/actions/serializedpatchtypes.js +5 -0
- package/dataconnector/cryptodependencies.d.ts +3 -0
- package/dataconnector/dataconnector.d.ts +1 -0
- package/dataconnector/dataconnector.js +1 -0
- package/dataconnector/datasourcemetadatatypes.d.ts +4 -0
- package/dataconnector/datasourcemetadatatypes.js +1 -0
- package/dataconnector/datasourceupdatetypes.d.ts +19 -0
- package/dataconnector/datasourceupdatetypes.js +19 -1
- package/dataconnector/itemrekeyerandrelabeler.d.ts +2 -0
- package/dataconnector/itemrekeyerandrelabeler.js +2 -0
- package/dataconnector/querycollection/buildpatches.d.ts +38 -0
- package/dataconnector/querycollection/buildpatches.js +66 -0
- package/dataconnector/querycollection/derivequerycollectionschema.d.ts +15 -0
- package/dataconnector/querycollection/derivequerycollectionschema.js +36 -0
- package/dataconnector/querycollection/diffprimarykeys.d.ts +21 -0
- package/dataconnector/querycollection/diffprimarykeys.js +31 -0
- package/dataconnector/querycollection/getquerycollections.d.ts +21 -0
- package/dataconnector/querycollection/getquerycollections.js +44 -0
- package/dataconnector/querycollection/index.d.ts +5 -0
- package/dataconnector/querycollection/index.js +15 -0
- package/dataconnector/querycollection/sendquerycollectionpatch.d.ts +15 -0
- package/dataconnector/querycollection/sendquerycollectionpatch.js +21 -0
- package/document/blockclasses/cardblockproxy.d.ts +8 -1
- package/document/blockclasses/cardblockproxy.js +43 -30
- package/document/blockclasses/customblockproxy.d.ts +1 -0
- package/document/blockclasses/erdblockproxy.d.ts +2 -0
- package/document/blockclasses/erdblockproxy.js +2 -0
- package/document/blockclasses/legendblockproxy.d.ts +6 -0
- package/document/blockclasses/legendblockproxy.js +5 -0
- package/document/blockclasses/swimlaneblockproxy.d.ts +2 -0
- package/document/blockclasses/swimlaneblockproxy.js +2 -0
- package/document/blockclasses/tableblockproxy.d.ts +4 -1
- package/document/blockclasses/tableblockproxy.js +4 -1
- package/document/blockdefinition.d.ts +2 -2
- package/document/blockproxy.d.ts +2 -2
- package/document/blockproxy.js +2 -2
- package/document/documentaccesspermission.d.ts +1 -0
- package/document/documentelement/cardconfigproxy.d.ts +1 -0
- package/document/documentelement/cardconfigproxy.js +1 -0
- package/document/documentelement/documentelementproxy.d.ts +1 -0
- package/document/documentelement/documentelementproxy.js +1 -0
- package/document/documentelement/ruleproxy.d.ts +3 -0
- package/document/documentelement/ruleproxy.js +3 -0
- package/document/elementproxy.d.ts +6 -6
- package/document/elementproxy.js +6 -6
- package/document/graphdefinition.d.ts +2 -0
- package/document/graphdefinition.js +1 -0
- package/document/itemproxy.d.ts +4 -0
- package/document/itemproxy.js +4 -0
- package/document/linedefinition.d.ts +1 -0
- package/document/lineproxy.d.ts +2 -0
- package/document/lineproxy.js +1 -0
- package/document/linetextareapositioning.d.ts +14 -0
- package/document/linetextareapositioning.js +11 -2
- package/document/mapproxy.d.ts +2 -0
- package/document/mapproxy.js +1 -0
- package/document/propertystoreproxy.d.ts +7 -0
- package/document/propertystoreproxy.js +7 -0
- package/document/ruledefinition.d.ts +12 -0
- package/document/text/textstyle.d.ts +2 -0
- package/index.d.ts +190 -121
- package/index.js +583 -135
- package/package.json +1 -1
- package/ui/menu.d.ts +8 -4
- package/ui/menu.js +5 -4
- package/ui/modal.d.ts +1 -1
- package/ui/panel.d.ts +2 -0
- package/ui/viewport.d.ts +3 -2
- package/ui/viewport.js +2 -1
|
@@ -1,8 +1,215 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeSearchResult = serializeSearchResult;
|
|
4
|
+
exports.serializeImportResults = serializeImportResults;
|
|
5
|
+
exports.registerAutoSync = registerAutoSync;
|
|
3
6
|
exports.registerDependencyMapping = registerDependencyMapping;
|
|
7
|
+
exports.registerFieldSearchCallback = registerFieldSearchCallback;
|
|
8
|
+
exports.registerUserSearchCallback = registerUserSearchCallback;
|
|
9
|
+
exports.registerFieldTypeToCollectionItemsCallback = registerFieldTypeToCollectionItemsCallback;
|
|
10
|
+
const collectiondefinition_1 = require("../../data/collectiondefinition");
|
|
4
11
|
const collectionproxy_1 = require("../../data/collectionproxy");
|
|
5
12
|
const dataitemproxy_1 = require("../../data/dataitemproxy");
|
|
13
|
+
const datasourceproxy_1 = require("../../data/datasourceproxy");
|
|
14
|
+
const cardintegrationautosyncconfig_1 = require("../cardintegration/cardintegrationautosyncconfig");
|
|
15
|
+
const checks_1 = require("../checks");
|
|
16
|
+
const cardintegrationdefinitions_1 = require("./cardintegrationdefinitions");
|
|
17
|
+
/**
|
|
18
|
+
* Serializes a `SearchResult` into the wire-format object the editor expects. Shared between the
|
|
19
|
+
* import-modal `search` path and the auto-sync `searchQueryString` / `searchFields` paths.
|
|
20
|
+
*/
|
|
21
|
+
function serializeSearchResult(searchResult) {
|
|
22
|
+
var _a;
|
|
23
|
+
return {
|
|
24
|
+
'srs': searchResult.searchResults.map((resultPerCollection) => ({
|
|
25
|
+
'd': (0, collectiondefinition_1.serializeCollectionDefinition)(resultPerCollection.data),
|
|
26
|
+
'f': (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(resultPerCollection.fields),
|
|
27
|
+
'm': resultPerCollection.partialImportMetadata && {
|
|
28
|
+
'cid': resultPerCollection.partialImportMetadata.collectionId,
|
|
29
|
+
'sid': resultPerCollection.partialImportMetadata.syncDataSourceId,
|
|
30
|
+
},
|
|
31
|
+
})),
|
|
32
|
+
'ipsr': searchResult.itemsPerSearchResult,
|
|
33
|
+
'e': searchResult.error,
|
|
34
|
+
'bs': (_a = searchResult.banners) === null || _a === void 0 ? void 0 : _a.map((banner) => ({
|
|
35
|
+
'ty': banner.type,
|
|
36
|
+
'msg': banner.message,
|
|
37
|
+
'btyp': banner.bannerType,
|
|
38
|
+
'actbtn': banner.actionButton
|
|
39
|
+
? {
|
|
40
|
+
'lab': banner.actionButton.label,
|
|
41
|
+
'aid': banner.actionButton.actionId,
|
|
42
|
+
'href': banner.actionButton.href,
|
|
43
|
+
}
|
|
44
|
+
: undefined,
|
|
45
|
+
})),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Serializes import results (single or array) to the wire-format the editor expects. Shared
|
|
50
|
+
* between the import-modal `import` path, the dependency-mapping path, and the auto-sync `sync*`
|
|
51
|
+
* paths.
|
|
52
|
+
*/
|
|
53
|
+
function serializeImportResults(result) {
|
|
54
|
+
if ((0, checks_1.isArray)(result)) {
|
|
55
|
+
return result.map((importResult) => ({
|
|
56
|
+
'c': importResult.collection.id,
|
|
57
|
+
'pks': importResult.primaryKeys,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
'c': result.collection.id,
|
|
62
|
+
'pks': result.primaryKeys,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Registers the editor-side actions for a `CardIntegrationAutoSyncConfig` on the given client and
|
|
67
|
+
* returns the corresponding `AutoSyncSettings` wire-format payload. Used by both
|
|
68
|
+
* `LucidCardIntegrationRegistry` and `LucidSpreadsheetIntegrationRegistry`.
|
|
69
|
+
*/
|
|
70
|
+
function registerAutoSync(client, autoSync, getNextHookName) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const serialized = {
|
|
73
|
+
'gsf': getNextHookName(),
|
|
74
|
+
};
|
|
75
|
+
if (autoSync.phrases) {
|
|
76
|
+
serialized['p'] = {
|
|
77
|
+
'h': autoSync.phrases.header,
|
|
78
|
+
'l': autoSync.phrases.label,
|
|
79
|
+
'qph': autoSync.phrases.queryPlaceholder,
|
|
80
|
+
'rnml': getNextHookName(),
|
|
81
|
+
'nml': autoSync.phrases.noMatchedLabel,
|
|
82
|
+
'esl': autoSync.phrases.emptyStateLabel,
|
|
83
|
+
};
|
|
84
|
+
client.registerAction(serialized['p']['rnml'], ({ 'g': inputSoFar }) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (!(0, cardintegrationautosyncconfig_1.isSupportedAutoSyncGeneratorType)(inputSoFar)) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
return (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.removeNonMatchingLabel(inputSoFar);
|
|
90
|
+
});
|
|
91
|
+
if ((_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.syncingGrowlMessage) {
|
|
92
|
+
serialized['p']['sgm'] = getNextHookName();
|
|
93
|
+
client.registerAction(serialized['p']['sgm'], ({ 'c': count }) => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return (_b = (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.syncingGrowlMessage) === null || _b === void 0 ? void 0 : _b.call(_a, count);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if ((_b = autoSync.phrases) === null || _b === void 0 ? void 0 : _b.removingGrowlMessage) {
|
|
99
|
+
serialized['p']['rgm'] = getNextHookName();
|
|
100
|
+
client.registerAction(serialized['p']['rgm'], ({ 'c': count }) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return (_b = (_a = autoSync.phrases) === null || _a === void 0 ? void 0 : _a.removingGrowlMessage) === null || _b === void 0 ? void 0 : _b.call(_a, count);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
client.registerAction(serialized['gsf'], async ({ 'i': inputSoFar }) => {
|
|
107
|
+
const result = await autoSync.getSyncDataSourceIdField(new Map(inputSoFar));
|
|
108
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
109
|
+
});
|
|
110
|
+
if ('searchFields' in autoSync) {
|
|
111
|
+
const fieldOnlyAutoSync = autoSync;
|
|
112
|
+
serialized['gdff'] = getNextHookName();
|
|
113
|
+
client.registerAction(serialized['gdff'], async ({ 's': searchSoFar }) => {
|
|
114
|
+
const result = await fieldOnlyAutoSync.getDefaultFilterFields(new Map(searchSoFar));
|
|
115
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
116
|
+
});
|
|
117
|
+
if (fieldOnlyAutoSync.getMoreFilterFields) {
|
|
118
|
+
serialized['gmff'] = getNextHookName();
|
|
119
|
+
client.registerAction(serialized['gmff'], async ({ 's': searchSoFar }) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const result = await ((_a = fieldOnlyAutoSync.getMoreFilterFields) === null || _a === void 0 ? void 0 : _a.call(fieldOnlyAutoSync, new Map(searchSoFar)));
|
|
122
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result !== null && result !== void 0 ? result : []);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
serialized['sf'] = getNextHookName();
|
|
126
|
+
client.registerAction(serialized['sf'], async ({ 'f': fields, 'if': instanceFields, 'pn': pageNumber, 'npt': nextPageToken }) => {
|
|
127
|
+
const result = await fieldOnlyAutoSync.searchFields(new Map(fields), new Map(instanceFields), pageNumber, nextPageToken);
|
|
128
|
+
if (result) {
|
|
129
|
+
return serializeSearchResult(result);
|
|
130
|
+
}
|
|
131
|
+
return serializeSearchResult({ searchResults: [], error: 'Unknown Error Occurred' });
|
|
132
|
+
});
|
|
133
|
+
serialized['syf'] = getNextHookName();
|
|
134
|
+
client.registerAction(serialized['syf'], async ({ 'f': fields, 'if': instanceFields }) => {
|
|
135
|
+
var _a;
|
|
136
|
+
const result = (_a = (await fieldOnlyAutoSync.syncFields(new Map(fields), new Map(instanceFields)))) !== null && _a !== void 0 ? _a : [];
|
|
137
|
+
return serializeImportResults(result);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const queryStringAutoSync = autoSync;
|
|
142
|
+
if (queryStringAutoSync.searchQueryString) {
|
|
143
|
+
serialized['sqs'] = getNextHookName();
|
|
144
|
+
client.registerAction(serialized['sqs'], async ({ 'qs': queryString, 'of': otherFields, 'pn': pageNumber, 'npt': nextPageToken, }) => {
|
|
145
|
+
var _a;
|
|
146
|
+
const result = await ((_a = queryStringAutoSync.searchQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, queryString, new Map(otherFields), pageNumber, nextPageToken));
|
|
147
|
+
if (result) {
|
|
148
|
+
return serializeSearchResult(result);
|
|
149
|
+
}
|
|
150
|
+
return serializeSearchResult({ searchResults: [], error: 'Unknown Error Occurred' });
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (queryStringAutoSync.syncQueryString) {
|
|
154
|
+
serialized['syqs'] = getNextHookName();
|
|
155
|
+
client.registerAction(serialized['syqs'], async ({ 'qs': queryString, 'of': otherFields }) => {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
const result = (_b = (await ((_a = queryStringAutoSync.syncQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, queryString, new Map(otherFields))))) !== null && _b !== void 0 ? _b : [];
|
|
158
|
+
return serializeImportResults(result);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (queryStringAutoSync.convertFiltersToQueryString) {
|
|
162
|
+
serialized['cftqs'] = getNextHookName();
|
|
163
|
+
client.registerAction(serialized['cftqs'], async ({ 'ff': filterFields }) => {
|
|
164
|
+
var _a;
|
|
165
|
+
const result = await ((_a = queryStringAutoSync.convertFiltersToQueryString) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, new Map(filterFields)));
|
|
166
|
+
if ((0, cardintegrationautosyncconfig_1.isConvertFiltersToQueryStringResult)(result)) {
|
|
167
|
+
return {
|
|
168
|
+
'qs': result.queryString,
|
|
169
|
+
'e': result.error,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return result;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (queryStringAutoSync.getDefaultFilterFields) {
|
|
176
|
+
serialized['gdff'] = getNextHookName();
|
|
177
|
+
client.registerAction(serialized['gdff'], async ({ 's': searchSoFar }) => {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
const result = (_b = (await ((_a = queryStringAutoSync.getDefaultFilterFields) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, new Map(searchSoFar))))) !== null && _b !== void 0 ? _b : [];
|
|
180
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (queryStringAutoSync.getMoreFilterFields) {
|
|
184
|
+
serialized['gmff'] = getNextHookName();
|
|
185
|
+
client.registerAction(serialized['gmff'], async ({ 's': searchSoFar }) => {
|
|
186
|
+
var _a;
|
|
187
|
+
const result = await ((_a = queryStringAutoSync.getMoreFilterFields) === null || _a === void 0 ? void 0 : _a.call(queryStringAutoSync, new Map(searchSoFar)));
|
|
188
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result !== null && result !== void 0 ? result : []);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (autoSync.documentPresetSetupFields) {
|
|
193
|
+
const documentPresetSetupFields = autoSync.documentPresetSetupFields;
|
|
194
|
+
serialized['dpf'] = {
|
|
195
|
+
'gsf': getNextHookName(),
|
|
196
|
+
'gpv': getNextHookName(),
|
|
197
|
+
};
|
|
198
|
+
client.registerAction(serialized['dpf']['gsf'], async ({ 's': searchSoFar }) => {
|
|
199
|
+
const result = await documentPresetSetupFields.getSearchFields(new Map(searchSoFar));
|
|
200
|
+
return (0, cardintegrationdefinitions_1.serializeCardFieldArrayDefinition)(result);
|
|
201
|
+
});
|
|
202
|
+
client.registerAction(serialized['dpf']['gpv'], async ({ 'f': fields }) => {
|
|
203
|
+
const result = await documentPresetSetupFields.generatePresetValue(new Map(fields));
|
|
204
|
+
return {
|
|
205
|
+
'dcn': result.dataConnectorName,
|
|
206
|
+
'iid': result.instanceId,
|
|
207
|
+
'q': result.query,
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return serialized;
|
|
212
|
+
}
|
|
6
213
|
function registerDependencyMapping(client, dependencyMapping, serialized, getNextHookName) {
|
|
7
214
|
serialized['sdm'] = dependencyMapping.showDependencyMapping;
|
|
8
215
|
const dependencyMappingPhrases = dependencyMapping.dependencyMappingPhrases;
|
|
@@ -94,3 +301,33 @@ function registerDependencyMapping(client, dependencyMapping, serialized, getNex
|
|
|
94
301
|
});
|
|
95
302
|
}
|
|
96
303
|
}
|
|
304
|
+
function registerFieldSearchCallback(client, callback, getNextHookName) {
|
|
305
|
+
const name = getNextHookName();
|
|
306
|
+
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText, 'fd': serializedFieldData }) => {
|
|
307
|
+
const fieldData = serializedFieldData
|
|
308
|
+
? { name: serializedFieldData['n'], dataSourceId: serializedFieldData['ds'] }
|
|
309
|
+
: undefined;
|
|
310
|
+
const result = await callback(searchText, new Map(inputSoFar), fieldData);
|
|
311
|
+
return result.map((option) => (0, cardintegrationdefinitions_1.serializeCardFieldOption)(option));
|
|
312
|
+
});
|
|
313
|
+
return name;
|
|
314
|
+
}
|
|
315
|
+
function registerUserSearchCallback(client, callback, getNextHookName) {
|
|
316
|
+
const name = getNextHookName();
|
|
317
|
+
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText, 'fd': serializedFieldData }) => {
|
|
318
|
+
const fieldData = serializedFieldData
|
|
319
|
+
? { name: serializedFieldData['n'], dataSourceId: serializedFieldData['ds'] }
|
|
320
|
+
: undefined;
|
|
321
|
+
const result = await callback(searchText, new Map(inputSoFar), fieldData);
|
|
322
|
+
return result.map((userData) => (0, cardintegrationdefinitions_1.serializeCardUserData)(userData));
|
|
323
|
+
});
|
|
324
|
+
return name;
|
|
325
|
+
}
|
|
326
|
+
function registerFieldTypeToCollectionItemsCallback(client, callback, getNextHookName) {
|
|
327
|
+
const name = getNextHookName();
|
|
328
|
+
client.registerAction(name, async ({ 'd': dataSourceId, 'v': value, 'f': fieldName }) => {
|
|
329
|
+
const dataSourceProxy = dataSourceId ? new datasourceproxy_1.DataSourceProxy(dataSourceId, client) : undefined;
|
|
330
|
+
return await callback(fieldName, value, dataSourceProxy);
|
|
331
|
+
});
|
|
332
|
+
return name;
|
|
333
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CollectionProxy } from '../../data/collectionproxy';
|
|
2
|
+
import type { DataSourceProxy } from '../../data/datasourceproxy';
|
|
3
|
+
import type { CardIntegrationAutoSyncConfig } from '../cardintegration/cardintegrationautosyncconfig';
|
|
4
|
+
import type { CardIntegrationConfig } from '../cardintegration/cardintegrationconfig';
|
|
2
5
|
import { type SerializedUpstreamConfig } from '../data/datasource/serializedupstreamconfig';
|
|
3
6
|
import type { SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
4
7
|
import { type SerializedSchema } from '../data/serializedfield/serializedschema';
|
|
@@ -119,4 +122,14 @@ export declare abstract class LucidSpreadsheetIntegration {
|
|
|
119
122
|
};
|
|
120
123
|
fieldConfiguration?: Partial<ExtensionFieldConfiguration>;
|
|
121
124
|
dependencyMapping?: CardIntegrationDependencyMappingConfig;
|
|
125
|
+
/**
|
|
126
|
+
* If specified, called when initializing the default card config for a newly imported spreadsheet.
|
|
127
|
+
* Use this to customize which fields appear in the detail edit panel.
|
|
128
|
+
* If not specified, all schema fields are included by default.
|
|
129
|
+
*/
|
|
130
|
+
getDefaultConfig?: (dataSource: DataSourceProxy) => Promise<CardIntegrationConfig>;
|
|
131
|
+
/**
|
|
132
|
+
* If specified, allows the user to use auto-sync to keep generators populated from this spreadsheet integration.
|
|
133
|
+
*/
|
|
134
|
+
autoSync?: CardIntegrationAutoSyncConfig | undefined;
|
|
122
135
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
2
2
|
import { EditorClient } from '../../editorclient';
|
|
3
3
|
import { SerializedFieldType, SerializedFields } from '../data/serializedfield/serializedfields';
|
|
4
|
-
import { ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
4
|
+
import { ExtensionCardFieldOption, ExtensionCardUserData } from '../sharedcardintegration/cardintegrationdefinitions';
|
|
5
5
|
import { LucidSpreadsheetIntegration } from './lucidspreadsheetintegration';
|
|
6
6
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
7
7
|
export declare class LucidSpreadsheetIntegrationRegistry {
|
|
8
8
|
private static nextHookId;
|
|
9
9
|
private static nextHookName;
|
|
10
|
+
static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>, fieldData?: {
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
dataSourceId?: string | undefined;
|
|
13
|
+
}) => Promise<ExtensionCardFieldOption[]>): string;
|
|
10
14
|
static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>, fieldData?: {
|
|
11
15
|
name?: string | undefined;
|
|
12
16
|
dataSourceId?: string | undefined;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LucidSpreadsheetIntegrationRegistry = void 0;
|
|
4
4
|
const commandtypes_1 = require("../../commandtypes");
|
|
5
5
|
const datasourceproxy_1 = require("../../data/datasourceproxy");
|
|
6
|
+
const cardintegrationconfig_1 = require("../cardintegration/cardintegrationconfig");
|
|
6
7
|
const checks_1 = require("../checks");
|
|
7
8
|
const cardintegrationdefinitions_1 = require("../sharedcardintegration/cardintegrationdefinitions");
|
|
8
9
|
const sharedregistryutil_1 = require("../sharedcardintegration/sharedregistryutil");
|
|
@@ -12,24 +13,14 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
12
13
|
static nextHookName() {
|
|
13
14
|
return '__lucidspreadsheet__hook' + LucidSpreadsheetIntegrationRegistry.nextHookId++;
|
|
14
15
|
}
|
|
16
|
+
static registerFieldSearchCallback(client, callback) {
|
|
17
|
+
return (0, sharedregistryutil_1.registerFieldSearchCallback)(client, callback, () => LucidSpreadsheetIntegrationRegistry.nextHookName());
|
|
18
|
+
}
|
|
15
19
|
static registerUserSearchCallback(client, callback) {
|
|
16
|
-
|
|
17
|
-
client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText, 'fd': serializedFieldData }) => {
|
|
18
|
-
const fieldData = serializedFieldData
|
|
19
|
-
? { name: serializedFieldData['n'], dataSourceId: serializedFieldData['ds'] }
|
|
20
|
-
: undefined;
|
|
21
|
-
const result = await callback(searchText, new Map(inputSoFar), fieldData);
|
|
22
|
-
return result.map((userData) => (0, cardintegrationdefinitions_1.serializeCardUserData)(userData));
|
|
23
|
-
});
|
|
24
|
-
return name;
|
|
20
|
+
return (0, sharedregistryutil_1.registerUserSearchCallback)(client, callback, () => LucidSpreadsheetIntegrationRegistry.nextHookName());
|
|
25
21
|
}
|
|
26
22
|
static registerFieldTypeToCollectionItemsCallback(client, callback) {
|
|
27
|
-
|
|
28
|
-
client.registerAction(name, async ({ 'd': dataSourceId, 'v': value, 'f': fieldName }) => {
|
|
29
|
-
const dataSourceProxy = dataSourceId ? new datasourceproxy_1.DataSourceProxy(dataSourceId, client) : undefined;
|
|
30
|
-
return await callback(fieldName, value, dataSourceProxy);
|
|
31
|
-
});
|
|
32
|
-
return name;
|
|
23
|
+
return (0, sharedregistryutil_1.registerFieldTypeToCollectionItemsCallback)(client, callback, () => LucidSpreadsheetIntegrationRegistry.nextHookName());
|
|
33
24
|
}
|
|
34
25
|
/**
|
|
35
26
|
* Register a spreadsheet integration.
|
|
@@ -92,6 +83,15 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
92
83
|
return fields;
|
|
93
84
|
});
|
|
94
85
|
}
|
|
86
|
+
let getDefaultConfigActionName = undefined;
|
|
87
|
+
if (spreadsheetIntegration.getDefaultConfig) {
|
|
88
|
+
getDefaultConfigActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
89
|
+
const getDefaultConfig = spreadsheetIntegration.getDefaultConfig;
|
|
90
|
+
client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
91
|
+
const dataSource = new datasourceproxy_1.DataSourceProxy(param['d'], client);
|
|
92
|
+
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await getDefaultConfig(dataSource));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
95
|
const serialized = {
|
|
96
96
|
'il': spreadsheetIntegration.itemLabel,
|
|
97
97
|
'isl': spreadsheetIntegration.itemsLabel,
|
|
@@ -116,6 +116,9 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
};
|
|
119
|
+
if (getDefaultConfigActionName) {
|
|
120
|
+
serialized['gdc'] = getDefaultConfigActionName;
|
|
121
|
+
}
|
|
119
122
|
if (spreadsheetIntegration.iconConfiguration) {
|
|
120
123
|
serialized['icu'] = {
|
|
121
124
|
'pi': spreadsheetIntegration.iconConfiguration.primaryIconUrl,
|
|
@@ -145,6 +148,9 @@ class LucidSpreadsheetIntegrationRegistry {
|
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
150
|
this.registerDependencyMapping(client, spreadsheetIntegration, serialized);
|
|
151
|
+
if (spreadsheetIntegration.autoSync) {
|
|
152
|
+
serialized['as'] = (0, sharedregistryutil_1.registerAutoSync)(client, spreadsheetIntegration.autoSync, () => LucidSpreadsheetIntegrationRegistry.nextHookName());
|
|
153
|
+
}
|
|
148
154
|
if (spreadsheetIntegration.getUpstreamSourceUrl) {
|
|
149
155
|
const getUpstreamSourceUrl = LucidSpreadsheetIntegrationRegistry.nextHookName();
|
|
150
156
|
client.registerAction(getUpstreamSourceUrl, async (message) => {
|
|
@@ -198,6 +198,7 @@ export declare const isStringOrNegativeOne: (x: unknown) => x is string | -1;
|
|
|
198
198
|
export declare const isRestrictions: (subject: unknown) => subject is DestructureGuardedTypeObj<{
|
|
199
199
|
b: (x: unknown) => x is boolean | null | undefined;
|
|
200
200
|
p: (x: unknown) => x is boolean | null | undefined;
|
|
201
|
+
s: (x: unknown) => x is boolean | null | undefined;
|
|
201
202
|
c: (x: unknown) => x is boolean | null | undefined;
|
|
202
203
|
f: (x: unknown) => x is boolean | null | undefined;
|
|
203
204
|
o: (x: unknown) => x is boolean | null | undefined;
|
|
@@ -444,6 +444,7 @@ exports.isStringOrNegativeOne = either(checks_1.isString, (v) => v === -1);
|
|
|
444
444
|
exports.isRestrictions = strictObjectValidator({
|
|
445
445
|
'b': nullableOption(checks_1.isBoolean),
|
|
446
446
|
'p': nullableOption(checks_1.isBoolean),
|
|
447
|
+
's': nullableOption(checks_1.isBoolean),
|
|
447
448
|
'c': nullableOption(checks_1.isBoolean),
|
|
448
449
|
'f': nullableOption(checks_1.isBoolean),
|
|
449
450
|
'o': nullableOption(checks_1.isBoolean),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type SerializedFields } from '../core/data/serializedfield/serializedfields';
|
|
2
2
|
import { isSerializedSchema, type SerializedSchema } from '../core/data/serializedfield/serializedschema';
|
|
3
3
|
import { type SchemaDefinition } from './schemadefinition';
|
|
4
|
+
/** A complete description of a collection: its schema and the ordered set of items that conform to it. */
|
|
4
5
|
export interface CollectionDefinition {
|
|
5
6
|
schema: SchemaDefinition;
|
|
6
7
|
items: Map<string, SerializedFields>;
|
|
7
8
|
}
|
|
9
|
+
/** @ignore */
|
|
8
10
|
export declare const isSerializedCollectionDefinition: (subject: unknown) => subject is import("..").DestructureGuardedTypeObj<{
|
|
9
11
|
Schema: typeof isSerializedSchema;
|
|
10
12
|
Items: (val: unknown) => val is [string, Record<string | number, import("../core/data/serializedfield/serializedfields").SerializedFieldType>][];
|
|
@@ -8,6 +8,7 @@ const serializedfields_1 = require("../core/data/serializedfield/serializedfield
|
|
|
8
8
|
const serializedschema_1 = require("../core/data/serializedfield/serializedschema");
|
|
9
9
|
const validators_1 = require("../core/validators/validators");
|
|
10
10
|
const schemadefinition_1 = require("./schemadefinition");
|
|
11
|
+
/** @ignore */
|
|
11
12
|
exports.isSerializedCollectionDefinition = (0, validators_1.objectValidator)({
|
|
12
13
|
'Schema': serializedschema_1.isSerializedSchema,
|
|
13
14
|
'Items': (0, checks_1.isTypedArray)((0, checks_1.isPair)(checks_1.isString, serializedfields_1.isSerializedFields)),
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reserved key for entries in a collection's error map that report the status of the upstream schema sync.
|
|
3
|
+
* Use the `schemaOutOfSyncStatus` and `schemaOKStatus` helpers to construct the corresponding values.
|
|
4
|
+
*/
|
|
1
5
|
export declare const CollectionUpstreamSchemaStatus = "__CollectionUpstreamSchemaStatus__";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollectionUpstreamSchemaStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Reserved key for entries in a collection's error map that report the status of the upstream schema sync.
|
|
6
|
+
* Use the `schemaOutOfSyncStatus` and `schemaOKStatus` helpers to construct the corresponding values.
|
|
7
|
+
*/
|
|
4
8
|
exports.CollectionUpstreamSchemaStatus = '__CollectionUpstreamSchemaStatus__';
|
|
@@ -7,4 +7,5 @@ export declare const DataUpdateFilterType: {
|
|
|
7
7
|
/** All updates to items already present on the document will be sent to the document. New items created in the data source will not be created on the document. */
|
|
8
8
|
readonly CurrentItemUpdates: "CurrentItemUpdates";
|
|
9
9
|
};
|
|
10
|
+
/** One of the values in {@link DataUpdateFilterType}. */
|
|
10
11
|
export type DataUpdateFilterType = (typeof DataUpdateFilterType)[keyof typeof DataUpdateFilterType];
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { DisplayOptionType, type SerializedDisplayOption } from '../core/data/serializedfield/serializeddisplayoption';
|
|
2
|
+
/** Display option that renders a field as a multi-user select picker, allowing multiple users to be assigned. */
|
|
2
3
|
export interface DisplayMultiUserEditDisplayOptionDefinition {
|
|
3
4
|
type: typeof DisplayOptionType.DisplayMultiUserSelect;
|
|
4
5
|
value?: undefined;
|
|
5
6
|
}
|
|
7
|
+
/** Display option that shows helper text beneath a field to guide users on expected input. */
|
|
6
8
|
export interface HelperTextDisplayOptionDefinition {
|
|
7
9
|
type: typeof DisplayOptionType.HelperText;
|
|
8
10
|
value?: string | undefined;
|
|
9
11
|
}
|
|
12
|
+
/** Union of all supported display option types that control how a field is rendered in the UI. */
|
|
10
13
|
export type DisplayOptionDefinition = DisplayMultiUserEditDisplayOptionDefinition | HelperTextDisplayOptionDefinition;
|
|
14
|
+
/** Construct a {@link DisplayOptionDefinition} for the given type, validating that the value (if any) matches what the type expects. */
|
|
11
15
|
export declare function createDisplayOptionDefinition(type: DisplayOptionType, value?: number | string): DisplayOptionDefinition;
|
|
16
|
+
/** @ignore */
|
|
12
17
|
export declare const isDisplayOptionDefinition: (x: unknown) => x is DisplayOptionDefinition;
|
|
13
18
|
/** @ignore */
|
|
14
19
|
export declare function serializeDisplayOptionDefinition(option: DisplayOptionDefinition): SerializedDisplayOption;
|
|
@@ -7,6 +7,7 @@ const assertnever_1 = require("../core/assertnever");
|
|
|
7
7
|
const checks_1 = require("../core/checks");
|
|
8
8
|
const serializeddisplayoption_1 = require("../core/data/serializedfield/serializeddisplayoption");
|
|
9
9
|
const validators_1 = require("../core/validators/validators");
|
|
10
|
+
/** Construct a {@link DisplayOptionDefinition} for the given type, validating that the value (if any) matches what the type expects. */
|
|
10
11
|
function createDisplayOptionDefinition(type, value) {
|
|
11
12
|
switch (type) {
|
|
12
13
|
case serializeddisplayoption_1.DisplayOptionType.DisplayMultiUserSelect:
|
|
@@ -36,6 +37,7 @@ const isHelperTextDisplayOptionDefinition = (0, validators_1.objectValidator)({
|
|
|
36
37
|
const isDisplayMultiUserSelectDisplayOptionDefinition = (0, validators_1.objectValidator)({
|
|
37
38
|
type: isDisplayMultiUserSelectType,
|
|
38
39
|
});
|
|
40
|
+
/** @ignore */
|
|
39
41
|
exports.isDisplayOptionDefinition = (0, validators_1.either)(isHelperTextDisplayOptionDefinition, isDisplayMultiUserSelectDisplayOptionDefinition);
|
|
40
42
|
/** @ignore */
|
|
41
43
|
function serializeDisplayOptionDefinition(option) {
|
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
import { isNumber, isUndefined } from '../core/checks';
|
|
2
2
|
import { FieldConstraintType, type SerializedFieldConstraint } from '../core/data/serializedfield/serializedfielddefinition';
|
|
3
|
+
/** Constraint that marks a field as required, preventing empty values. */
|
|
3
4
|
export interface RequiredFieldConstraintDefinition {
|
|
4
5
|
type: typeof FieldConstraintType.REQUIRED;
|
|
5
6
|
value?: undefined;
|
|
6
7
|
reason?: string | undefined;
|
|
7
8
|
}
|
|
9
|
+
/** Constraint that locks a field, preventing users from editing its value. */
|
|
8
10
|
export interface LockedFieldConstraintDefinition {
|
|
9
11
|
type: typeof FieldConstraintType.LOCKED;
|
|
10
12
|
value?: undefined;
|
|
11
13
|
reason?: string | undefined;
|
|
12
14
|
}
|
|
15
|
+
/** Constraint that enforces a minimum numeric value for a field. */
|
|
13
16
|
export interface MinValueFieldConstraintDefinition {
|
|
14
17
|
type: typeof FieldConstraintType.MIN_VALUE;
|
|
15
18
|
value: number;
|
|
16
19
|
reason?: string | undefined;
|
|
17
20
|
}
|
|
21
|
+
/** Constraint that enforces a maximum numeric value for a field. */
|
|
18
22
|
export interface MaxValueFieldConstraintDefinition {
|
|
19
23
|
type: typeof FieldConstraintType.MAX_VALUE;
|
|
20
24
|
value: number;
|
|
21
25
|
reason?: string | undefined;
|
|
22
26
|
}
|
|
27
|
+
/** Constraint that restricts a text field to a single line, disallowing newline characters. */
|
|
23
28
|
export interface SingleLineFieldConstraintDefinition {
|
|
24
29
|
type: typeof FieldConstraintType.SINGLE_LINE_ONLY;
|
|
25
30
|
value?: undefined;
|
|
26
31
|
reason?: string | undefined;
|
|
27
32
|
}
|
|
33
|
+
/** Constraint that disallows whitespace characters in a field value. */
|
|
28
34
|
export interface NoWhitespaceFieldConstraintDefinition {
|
|
29
35
|
type: typeof FieldConstraintType.NO_WHITESPACE;
|
|
30
36
|
value?: undefined;
|
|
31
37
|
reason?: string | undefined;
|
|
32
38
|
}
|
|
39
|
+
/** Constraint that requires a field value to be unique across all items in the collection when edited. */
|
|
33
40
|
export interface UniqueEditFieldConstraintDefinition {
|
|
34
41
|
type: typeof FieldConstraintType.UNIQUE_EDIT;
|
|
35
42
|
value?: undefined;
|
|
36
43
|
reason?: string | undefined;
|
|
37
44
|
}
|
|
45
|
+
/** Constraint that enforces a maximum character length for a text field. */
|
|
38
46
|
export interface MaxLengthConstraintDefinition {
|
|
39
47
|
type: typeof FieldConstraintType.MAX_LENGTH;
|
|
40
48
|
value: number;
|
|
41
49
|
reason?: string | undefined;
|
|
42
50
|
}
|
|
51
|
+
/** Constraint that limits the number of decimal places allowed in a numeric field value. */
|
|
43
52
|
export interface MaxDecimalPlacesConstraintDefinition {
|
|
44
53
|
type: typeof FieldConstraintType.MAX_DECIMAL_PLACES;
|
|
45
54
|
value: number;
|
|
@@ -51,9 +60,13 @@ export interface MaxDecimalLengthConstraintDefinition {
|
|
|
51
60
|
value: number;
|
|
52
61
|
reason?: string | undefined;
|
|
53
62
|
}
|
|
63
|
+
/** Union of all supported field constraint types that can be applied to a collection schema field. */
|
|
54
64
|
export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition | MaxDecimalPlacesConstraintDefinition | MaxDecimalLengthConstraintDefinition;
|
|
65
|
+
/** Construct a {@link FieldConstraintDefinition} for the given type, validating that the value (if any) matches what the type expects. */
|
|
55
66
|
export declare function createFieldConstraintDefinition(type: FieldConstraintType, value?: number, reason?: string): FieldConstraintDefinition;
|
|
67
|
+
/** @ignore */
|
|
56
68
|
export declare function numericFieldConstraintValidator(val: unknown): val is typeof FieldConstraintType.MIN_VALUE | typeof FieldConstraintType.MAX_VALUE | typeof FieldConstraintType.MAX_LENGTH | typeof FieldConstraintType.MAX_DECIMAL_PLACES | typeof FieldConstraintType.MAX_DECIMAL_LENGTH;
|
|
69
|
+
/** @ignore */
|
|
57
70
|
export declare const isFieldConstraintDefinition: (x: unknown) => x is import("..").DestructureGuardedTypeObj<{
|
|
58
71
|
type: (x: unknown) => x is {} extends {
|
|
59
72
|
readonly REQUIRED: "required";
|
|
@@ -8,6 +8,7 @@ const assertnever_1 = require("../core/assertnever");
|
|
|
8
8
|
const checks_1 = require("../core/checks");
|
|
9
9
|
const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
|
|
10
10
|
const validators_1 = require("../core/validators/validators");
|
|
11
|
+
/** Construct a {@link FieldConstraintDefinition} for the given type, validating that the value (if any) matches what the type expects. */
|
|
11
12
|
function createFieldConstraintDefinition(type, value, reason) {
|
|
12
13
|
switch (type) {
|
|
13
14
|
case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
|
|
@@ -33,6 +34,7 @@ function createFieldConstraintDefinition(type, value, reason) {
|
|
|
33
34
|
(0, assertnever_1.assertNever)(type);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
/** @ignore */
|
|
36
38
|
function numericFieldConstraintValidator(val) {
|
|
37
39
|
return (val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE ||
|
|
38
40
|
val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE ||
|
|
@@ -40,6 +42,7 @@ function numericFieldConstraintValidator(val) {
|
|
|
40
42
|
val === serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_PLACES ||
|
|
41
43
|
val === serializedfielddefinition_1.FieldConstraintType.MAX_DECIMAL_LENGTH);
|
|
42
44
|
}
|
|
45
|
+
/** @ignore */
|
|
43
46
|
exports.isFieldConstraintDefinition = (0, validators_1.both)((0, validators_1.objectValidator)({
|
|
44
47
|
'type': serializedfielddefinition_1.isFieldConstraintType,
|
|
45
48
|
}), (0, validators_1.either)((0, validators_1.objectValidator)({ 'type': numericFieldConstraintValidator, 'value': checks_1.isNumber }), (0, validators_1.objectValidator)({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorClient } from '../editorclient';
|
|
2
2
|
import { CollectionProxy } from './collectionproxy';
|
|
3
3
|
import { DataItemProxy } from './dataitemproxy';
|
|
4
|
+
/** A data item that has been modified locally but not yet synced back to the external data source, exposing both the current and original values. */
|
|
4
5
|
export declare class PatchedDataItemProxy extends DataItemProxy {
|
|
5
6
|
/**
|
|
6
7
|
* The names of all fields that have been changed locally on this data item and
|
|
@@ -24,6 +25,7 @@ export declare class PatchedDataItemProxy extends DataItemProxy {
|
|
|
24
25
|
*/
|
|
25
26
|
original: DataItemProxy, client: EditorClient);
|
|
26
27
|
}
|
|
28
|
+
/** Provides access to locally added, deleted, and changed data items within a collection that have not yet been synced to the external data source. Obtained via CollectionProxy.getLocalChanges(). */
|
|
27
29
|
export declare class PatchCollectionProxy {
|
|
28
30
|
private readonly client;
|
|
29
31
|
private readonly branchedCollection;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PatchCollectionProxy = exports.PatchedDataItemProxy = void 0;
|
|
4
4
|
const dataitemproxy_1 = require("./dataitemproxy");
|
|
5
|
+
/** A data item that has been modified locally but not yet synced back to the external data source, exposing both the current and original values. */
|
|
5
6
|
class PatchedDataItemProxy extends dataitemproxy_1.DataItemProxy {
|
|
6
7
|
constructor(primaryKey, collection,
|
|
7
8
|
/**
|
|
@@ -20,6 +21,7 @@ class PatchedDataItemProxy extends dataitemproxy_1.DataItemProxy {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
exports.PatchedDataItemProxy = PatchedDataItemProxy;
|
|
24
|
+
/** Provides access to locally added, deleted, and changed data items within a collection that have not yet been synced to the external data source. Obtained via CollectionProxy.getLocalChanges(). */
|
|
23
25
|
class PatchCollectionProxy {
|
|
24
26
|
/**
|
|
25
27
|
* Use CollectionProxy.getLocalChanges() to get a PatchCollectionProxy rather
|
package/data/patcherrortype.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { type SerializedReferenceKeyType } from '../core/data/referencekeys/seri
|
|
|
2
2
|
import type { SerializedFieldType } from '../core/data/serializedfield/serializedfields';
|
|
3
3
|
import { type SchemaDefinition } from './schemadefinition';
|
|
4
4
|
/**
|
|
5
|
-
* A reference key that points to a
|
|
6
|
-
*
|
|
5
|
+
* A reference key that points to a {@link DataItemProxy | DataItem} in a
|
|
6
|
+
* {@link CollectionProxy | Collection}. This is the most common type of
|
|
7
7
|
* reference key to create.
|
|
8
8
|
*
|
|
9
|
-
* For more information, see the [Developer Guide](
|
|
9
|
+
* For more information, see the [Developer Guide](doc:editor-extension-data#how-to-associate-a-record-with-a-shape-on-canvas).
|
|
10
10
|
*/
|
|
11
11
|
export interface CollectionReferenceKeyDefinition {
|
|
12
12
|
/** The ID of the collection referenced */
|
|
13
13
|
collectionId: string;
|
|
14
|
-
/** The
|
|
14
|
+
/** The {@link DataItemProxy.primaryKey | primary key} of the data item referenced */
|
|
15
15
|
primaryKey: string;
|
|
16
16
|
/** If true, prevent the user from editing the field values of this reference key through the normal UI */
|
|
17
17
|
readonly?: boolean | undefined;
|
|
@@ -25,7 +25,7 @@ export interface CollectionReferenceKeyDefinition {
|
|
|
25
25
|
/**
|
|
26
26
|
* A reference key that has the field values embedded directly in the reference definition. This can be
|
|
27
27
|
* useful in cases when you want to have a standard schema of data associated with an element but do not
|
|
28
|
-
* for whatever reason want to construct an actual
|
|
28
|
+
* for whatever reason want to construct an actual {@link CollectionProxy | Collection}
|
|
29
29
|
* to house that data.
|
|
30
30
|
*/
|
|
31
31
|
export interface FlattenedReferenceDefinition {
|
|
@@ -36,6 +36,7 @@ export interface FlattenedReferenceDefinition {
|
|
|
36
36
|
/** Field values available at this reference key */
|
|
37
37
|
data: Record<string, SerializedFieldType>;
|
|
38
38
|
}
|
|
39
|
+
/** A reference key definition that links a canvas element to either a data item in a collection or a flattened set of inline field values. */
|
|
39
40
|
export type ReferenceKeyDefinition = CollectionReferenceKeyDefinition | FlattenedReferenceDefinition;
|
|
40
41
|
/** @ignore */
|
|
41
42
|
export declare function isCollectionReferenceKeyDefinition(def: ReferenceKeyDefinition): def is CollectionReferenceKeyDefinition;
|