form0-core 0.1.23 → 0.1.24
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 +1 -1
- package/src/index.js +1 -0
- package/src/utilities/dataset-descriptors.js +34 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -237,6 +237,39 @@ const DISPLAY_ONLY_SEMANTICS = {
|
|
|
237
237
|
allowed_operators: [],
|
|
238
238
|
};
|
|
239
239
|
|
|
240
|
+
const MEDIA_FIELD_TYPES = new Set([
|
|
241
|
+
'PhotoField',
|
|
242
|
+
'VideoField',
|
|
243
|
+
'SignatureField',
|
|
244
|
+
'Photo',
|
|
245
|
+
'Video',
|
|
246
|
+
'Signature',
|
|
247
|
+
]);
|
|
248
|
+
const NON_DATA_FIELD_TYPES = new Set([
|
|
249
|
+
'LabelField',
|
|
250
|
+
'Section',
|
|
251
|
+
'RepeatableSection',
|
|
252
|
+
'BuildingPlanSection',
|
|
253
|
+
]);
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Exportability is intentionally independent from query semantics. Media fields are
|
|
257
|
+
* display-only in the query engine, but are first-class export columns whose values
|
|
258
|
+
* are resolved by an authorized media gateway.
|
|
259
|
+
*/
|
|
260
|
+
export function getFieldExportKind(field) {
|
|
261
|
+
const fieldType = toTrimmedString(field?.type ?? field?.field_type);
|
|
262
|
+
if (!fieldType || NON_DATA_FIELD_TYPES.has(fieldType)) {
|
|
263
|
+
return 'none';
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (MEDIA_FIELD_TYPES.has(fieldType)) {
|
|
267
|
+
return 'media';
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return 'value';
|
|
271
|
+
}
|
|
272
|
+
|
|
240
273
|
const getCalculatedFieldSemantics = (field) => {
|
|
241
274
|
const style = getCalculatedDisplayStyle(field);
|
|
242
275
|
|
|
@@ -402,6 +435,7 @@ const buildDatasetFieldDescriptor = (field, dataset) => {
|
|
|
402
435
|
data_name: toTrimmedString(field.data_name),
|
|
403
436
|
label: toFieldLabel(field),
|
|
404
437
|
field_type: toTrimmedString(field.type) ?? 'UnknownField',
|
|
438
|
+
export_kind: getFieldExportKind(field),
|
|
405
439
|
choices: Array.isArray(field.choices)
|
|
406
440
|
? field.choices.filter((choice) => isRecord(choice)).map((choice) => ({ ...choice }))
|
|
407
441
|
: undefined,
|