@sealcode/sealgen 0.18.10 → 0.19.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/.eslintrc.cjs +7 -2
- package/.xunit +74 -69
- package/@types/add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts +1 -0
- package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +10 -0
- package/@types/builders/colors-builder.d.ts +1 -1
- package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +7 -0
- package/@types/builders/fonts-builder.d.ts +1 -1
- package/@types/controllers/table-add-button.d.ts +6 -0
- package/@types/controllers/table-add-button.stimulus.d.ts +6 -0
- package/@types/crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts +1 -0
- package/@types/crud-field-snippets.d.ts +1 -3
- package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +33 -0
- package/@types/forms/controls/array.d.ts +1 -3
- package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +22 -0
- package/@types/forms/controls/autocomplete.d.ts +1 -1
- package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkbox-group.d.ts +3 -3
- package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkboxed-list-input.d.ts +3 -3
- package/@types/forms/controls/controls.d.ts +2 -2
- package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +19 -0
- package/@types/forms/controls/derived-frame.d.ts +0 -2
- package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +30 -0
- package/@types/forms/controls/dropdown.d.ts +1 -1
- package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +13 -0
- package/@types/forms/controls/file.d.ts +1 -2
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.ts +7 -4
- package/@types/forms/controls/image.d.ts +19 -0
- package/@types/forms/controls/image.test.d.ts +1 -0
- package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +42 -0
- package/@types/forms/controls/multiple-files.d.ts +3 -1
- package/@types/forms/controls/multiple-images.d.ts +19 -0
- package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +13 -0
- package/@types/forms/controls/number.d.ts +1 -1
- package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +19 -0
- package/@types/forms/controls/photo.d.ts +3 -5
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.ts +5 -4
- package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/single-reference.d.ts +3 -2
- package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +39 -0
- package/@types/forms/controls/table.d.ts +8 -3
- package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +39 -0
- package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +25 -0
- package/@types/forms/controls/textarea.d.ts +3 -3
- package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +22 -0
- package/@types/forms/fields/boolean.d.ts +6 -1
- package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +22 -0
- package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +23 -0
- package/@types/forms/fields/checkboxed-list.d.ts +3 -1
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.ts +8 -1
- package/@types/forms/fields/color.d.ts +4 -0
- package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +14 -0
- package/@types/forms/fields/coordinates.d.ts +14 -0
- package/@types/forms/fields/date.d.ts +13 -0
- package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +4 -0
- package/@types/forms/fields/datetime.d.ts +14 -0
- package/@types/forms/fields/deep-reverse-single-reference-list.d.ts +24 -0
- package/@types/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
- package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +8 -0
- package/@types/forms/fields/email.d.ts +3 -0
- package/@types/forms/fields/enum-multiple-sealious.d.ts +16 -0
- package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +16 -0
- package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +70 -0
- package/@types/forms/fields/field.d.ts +37 -5
- package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +29 -0
- package/@types/forms/fields/fields.d.ts +23 -8
- package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.ts +11 -5
- package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +23 -0
- package/@types/forms/fields/float.d.ts +4 -0
- package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +29 -0
- package/@types/forms/fields/get-field-for-sealious.d.ts +31 -0
- package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/html.d.ts +6 -0
- package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +5 -0
- package/@types/forms/fields/image.d.ts +5 -0
- package/@types/forms/fields/int.d.ts +6 -0
- package/@types/forms/fields/json.d.ts +13 -0
- package/@types/forms/fields/markdown.d.ts +6 -0
- package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +16 -0
- package/@types/forms/fields/multiple-files.d.ts +3 -1
- package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.ts +3 -1
- package/@types/forms/fields/password.d.ts +6 -0
- package/@types/forms/fields/pick-from-list-sealious.d.ts +11 -0
- package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +15 -0
- package/@types/forms/fields/pick-from-list.d.ts +4 -3
- package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +15 -0
- package/@types/forms/fields/proxy-field.d.ts +3 -1
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.ts +6 -1
- package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +21 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.ts +23 -3
- package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/single-reference.d.ts +19 -0
- package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +10 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.ts +19 -10
- package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +27 -0
- package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +16 -0
- package/@types/forms/fields/table.d.ts +3 -0
- package/@types/forms/fields/text.d.ts +6 -0
- package/@types/forms/fields/url.d.ts +6 -0
- package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +26 -0
- package/@types/forms/form-types.d.ts +2 -0
- package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.ts +10 -8
- package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +33 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.ts +2 -2
- package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +23 -0
- package/@types/forms/multiform.d.ts +1 -2
- package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +23 -0
- package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +46 -0
- package/@types/index.d.ts +2 -2
- package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +6 -0
- package/@types/mount.d.ts +0 -1
- package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +48 -0
- package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +48 -0
- package/@types/page/list.d.ts +2 -2
- package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +48 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.ts +3 -3
- package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +42 -0
- package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +10 -0
- package/@types/page/mountable.d.ts +0 -1
- package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +18 -0
- package/@types/page/page.d.ts +0 -1
- package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +15 -0
- package/@types/page/props-parser.d.ts +0 -1
- package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +62 -0
- package/@types/page/stateful-page.d.ts +0 -1
- package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +1 -0
- package/@types/templates/shared/shared-crud-form-fields.d.ts +0 -67
- package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +26 -0
- package/@types/test_utils/test-on-real-app.d.ts +0 -1
- package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +18 -0
- package/@types/utils/extract-fields-from-collection.d.ts +5 -1
- package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +18 -0
- package/@types/utils/wrap-attributes.d.ts +3 -0
- package/README.md +5 -0
- package/assets/file-icon.svg +5 -0
- package/lib/add-crud.js +80 -89
- package/lib/add-list-route.test.js +1 -1
- package/lib/add-route.js +0 -7
- package/lib/build.js +3 -1
- package/lib/cli.js +2 -5
- package/lib/controllers/table-add-button.stimulus.js +35 -0
- package/lib/forms/controls/array.js +20 -16
- package/lib/forms/controls/big-radio-group.js +2 -2
- package/lib/forms/controls/checkbox-group.js +7 -7
- package/lib/forms/controls/checkboxed-list-input.js +9 -2
- package/lib/forms/controls/controls.js +2 -2
- package/lib/forms/controls/derived-frame.js +5 -1
- package/lib/forms/controls/derived.js +1 -1
- package/lib/forms/controls/dropdown.js +4 -1
- package/lib/forms/controls/editable-collection-subset.js +2 -2
- package/lib/forms/controls/file.js +26 -2
- package/lib/forms/controls/file.test.js +2 -2
- package/lib/forms/controls/hidden-input.js +4 -1
- package/lib/forms/controls/{photo.js → image.js} +6 -7
- package/lib/forms/controls/{photo.test.js → image.test.js} +6 -21
- package/lib/forms/controls/multiple-files.js +10 -1
- package/lib/forms/controls/{multiple-photos.js → multiple-images.js} +3 -3
- package/lib/forms/controls/simple-input.js +13 -12
- package/lib/forms/controls/single-reference.js +4 -0
- package/lib/forms/controls/table.js +66 -24
- package/lib/forms/controls/textarea.js +4 -2
- package/lib/forms/controls/tickable.js +13 -5
- package/lib/forms/fields/boolean.js +14 -0
- package/lib/forms/fields/checkboxed-list.js +4 -0
- package/lib/forms/fields/collection-field.js +9 -0
- package/lib/forms/fields/color.js +10 -0
- package/lib/forms/fields/coordinates.js +49 -0
- package/lib/forms/fields/date.js +34 -0
- package/lib/forms/fields/datetime.js +46 -0
- package/lib/forms/fields/deep-reverse-single-reference-list.js +81 -0
- package/lib/forms/fields/deep-reverse-single-reference-table.js +122 -0
- package/lib/forms/fields/email.js +7 -0
- package/lib/forms/fields/enum-multiple-sealious.js +32 -0
- package/lib/forms/fields/field.js +32 -4
- package/lib/forms/fields/field.test.js +5 -5
- package/lib/forms/fields/fields.js +23 -8
- package/lib/forms/fields/file.js +33 -9
- package/lib/forms/fields/file.test.js +4 -16
- package/lib/forms/fields/float.js +10 -0
- package/lib/forms/fields/get-field-for-sealious.js +213 -0
- package/lib/forms/fields/html.js +14 -0
- package/lib/forms/fields/image.js +13 -0
- package/lib/forms/fields/int.js +23 -0
- package/lib/forms/fields/json.js +31 -0
- package/lib/forms/fields/markdown.js +14 -0
- package/lib/forms/fields/multiple-files.js +4 -0
- package/lib/forms/fields/number.js +6 -0
- package/lib/forms/fields/password.js +13 -0
- package/lib/forms/fields/pick-from-list-sealious.js +17 -0
- package/lib/forms/fields/pick-from-list.js +6 -2
- package/lib/forms/fields/proxy-field.js +3 -0
- package/lib/forms/fields/regexp.js +14 -0
- package/lib/forms/fields/simple-form-field.js +60 -2
- package/lib/forms/fields/single-reference.js +44 -0
- package/lib/forms/fields/structured-array.js +63 -12
- package/lib/forms/fields/table.js +28 -1
- package/lib/forms/fields/text.js +17 -0
- package/lib/forms/fields/url.js +17 -0
- package/lib/forms/form.js +30 -13
- package/lib/forms/form.test.js +3 -4
- package/lib/forms/multiform.js +4 -2
- package/lib/forms/multiform.test.js +3 -3
- package/lib/generate-stimulus.js +1 -0
- package/lib/index.js +1 -0
- package/lib/make-hidden-inputs.js +1 -1
- package/lib/mount.js +11 -0
- package/lib/notifier.js +0 -1
- package/lib/page/list.js +15 -8
- package/lib/page/mountable-with-fields.js +14 -6
- package/lib/page/mountable-with-fields.test.js +1 -1
- package/lib/templates/form.js +8 -9
- package/lib/templates/multiform.js +4 -4
- package/lib/templates/page.js +0 -2
- package/lib/templates/shared/collection-create-form.js +28 -40
- package/lib/templates/shared/collection-edit-form.js +40 -77
- package/lib/templates/shared/collection-list.js +12 -20
- package/lib/templates/shared/shared-crud-form-fields.js +27 -95
- package/lib/test_utils/test-on-real-app.js +3 -3
- package/lib/utils/extract-fields-from-collection.js +60 -20
- package/lib/utils/make-slug.js +1 -1
- package/lib/utils/wrap-attributes.js +20 -0
- package/package.json +4 -3
- package/src/add-crud.ts +86 -97
- package/src/add-list-route.test.ts +1 -1
- package/src/add-route.ts +0 -7
- package/src/build.ts +3 -1
- package/src/cli.ts +3 -5
- package/src/controllers/table-add-button.stimulus.ts +35 -0
- package/src/forms/controls/array.ts +23 -20
- package/src/forms/controls/autocomplete.ts +1 -1
- package/src/forms/controls/big-radio-group.ts +2 -2
- package/src/forms/controls/checkbox-group.ts +9 -9
- package/src/forms/controls/checkboxed-list-input.ts +27 -15
- package/src/forms/controls/controls.ts +2 -2
- package/src/forms/controls/derived-frame.ts +5 -1
- package/src/forms/controls/derived.ts +1 -1
- package/src/forms/controls/dropdown.ts +5 -2
- package/src/forms/controls/editable-collection-subset.ts +2 -2
- package/src/forms/controls/file.test.ts +4 -2
- package/src/forms/controls/file.ts +31 -5
- package/src/forms/controls/form-control.ts +7 -2
- package/src/forms/controls/hidden-input.ts +4 -1
- package/src/forms/controls/{photo.test.ts → image.test.ts} +5 -22
- package/src/forms/controls/{photo.ts → image.ts} +3 -5
- package/src/forms/controls/multiple-files.ts +18 -1
- package/src/forms/controls/{multiple-photos.ts → multiple-images.ts} +1 -1
- package/src/forms/controls/number.ts +1 -1
- package/src/forms/controls/simple-input.ts +18 -34
- package/src/forms/controls/single-reference.ts +10 -2
- package/src/forms/controls/table.ts +90 -31
- package/src/forms/controls/textarea.ts +6 -4
- package/src/forms/controls/tickable.ts +13 -5
- package/src/forms/fields/boolean.ts +23 -1
- package/src/forms/fields/checkboxed-list.ts +11 -2
- package/src/forms/fields/collection-field.ts +16 -1
- package/src/forms/fields/color.ts +9 -0
- package/src/forms/fields/coordinates.ts +66 -0
- package/src/forms/fields/date.ts +50 -0
- package/src/forms/fields/datetime.ts +66 -0
- package/src/forms/fields/deep-reverse-single-reference-list.ts +136 -0
- package/src/forms/fields/deep-reverse-single-reference-table.ts +213 -0
- package/src/forms/fields/email.ts +9 -0
- package/src/forms/fields/enum-multiple-sealious.ts +48 -0
- package/src/forms/fields/field.test.ts +5 -5
- package/src/forms/fields/field.ts +94 -8
- package/src/forms/fields/fields.ts +23 -8
- package/src/forms/fields/file.test.ts +4 -16
- package/src/forms/fields/file.ts +43 -15
- package/src/forms/fields/float.ts +9 -0
- package/src/forms/fields/get-field-for-sealious.ts +304 -0
- package/src/forms/fields/html.ts +15 -0
- package/src/forms/fields/image.ts +12 -0
- package/src/forms/fields/int.ts +25 -0
- package/src/forms/fields/json.ts +48 -0
- package/src/forms/fields/markdown.ts +15 -0
- package/src/forms/fields/multiple-files.ts +10 -1
- package/src/forms/fields/number.ts +8 -1
- package/src/forms/fields/password.ts +17 -0
- package/src/forms/fields/pick-from-list-sealious.ts +22 -0
- package/src/forms/fields/pick-from-list.ts +7 -3
- package/src/forms/fields/proxy-field.ts +6 -1
- package/src/forms/fields/regexp.ts +27 -1
- package/src/forms/fields/simple-form-field.ts +95 -7
- package/src/forms/fields/single-reference.ts +62 -0
- package/src/forms/fields/structured-array.ts +115 -18
- package/src/forms/fields/table.ts +32 -1
- package/src/forms/fields/text.ts +18 -0
- package/src/forms/fields/url.ts +20 -0
- package/src/forms/form-types.ts +2 -0
- package/src/forms/form.test.ts +3 -4
- package/src/forms/form.ts +37 -16
- package/src/forms/forms.css +0 -85
- package/src/forms/multiform.test.ts +3 -3
- package/src/forms/multiform.ts +2 -0
- package/src/generate-stimulus.ts +1 -0
- package/src/index.ts +2 -1
- package/src/make-hidden-inputs.ts +1 -1
- package/src/mount.ts +14 -0
- package/src/notifier.ts +0 -1
- package/src/page/list.ts +15 -8
- package/src/page/mountable-with-fields.test.ts +1 -1
- package/src/page/mountable-with-fields.ts +18 -9
- package/src/register-external.ts +1 -1
- package/src/templates/form.ts +8 -9
- package/src/templates/multiform.ts +4 -4
- package/src/templates/page.ts +0 -2
- package/src/templates/shared/collection-create-form.ts +30 -66
- package/src/templates/shared/collection-edit-form.ts +41 -102
- package/src/templates/shared/collection-list.ts +12 -20
- package/src/templates/shared/item-delete.ts +0 -1
- package/src/templates/shared/shared-crud-form-fields.ts +37 -171
- package/src/test_utils/test-on-real-app.ts +4 -3
- package/src/utils/extract-fields-from-collection.ts +76 -25
- package/src/utils/make-slug.ts +1 -1
- package/src/utils/wrap-attributes.ts +17 -0
- package/lib/add-verbose-crud.js +0 -119
- package/lib/crud-field-snippets.js +0 -52
- package/lib/find-css-includes.js +0 -3
- package/lib/forms/controls/reverse-single-reference.js +0 -1
- package/lib/forms/fields/enum-multiple.js +0 -47
- package/lib/forms/fields/enum-multiple.test.js +0 -27
- package/lib/forms/fields/enum.js +0 -41
- package/lib/forms/fields/enum.test.js +0 -21
- package/lib/forms/fields/reverse-single-reference.js +0 -17
- package/lib/templates/shared/handlers/boolean.js +0 -14
- package/lib/templates/shared/handlers/date.js +0 -8
- package/lib/templates/shared/handlers/deep-reverse-single-reference.js +0 -209
- package/lib/templates/shared/handlers/default.js +0 -49
- package/lib/templates/shared/handlers/enum.js +0 -19
- package/lib/templates/shared/handlers/file.js +0 -23
- package/lib/templates/shared/handlers/image.js +0 -32
- package/lib/templates/shared/handlers/int.js +0 -11
- package/lib/templates/shared/handlers/jdd.js +0 -10
- package/lib/templates/shared/handlers/single-reference.js +0 -12
- package/lib/templates/shared/handlers/structured-array.js +0 -33
- package/src/add-verbose-crud.ts +0 -138
- package/src/crud-field-snippets.ts +0 -57
- package/src/find-css-includes.ts +0 -3
- package/src/forms/controls/reverse-single-reference.ts +0 -50
- package/src/forms/fields/enum-multiple.test.ts +0 -31
- package/src/forms/fields/enum-multiple.ts +0 -62
- package/src/forms/fields/enum.test.ts +0 -25
- package/src/forms/fields/enum.ts +0 -56
- package/src/forms/fields/reverse-single-reference.ts +0 -20
- package/src/templates/shared/handlers/boolean.ts +0 -18
- package/src/templates/shared/handlers/date.ts +0 -12
- package/src/templates/shared/handlers/deep-reverse-single-reference.ts +0 -244
- package/src/templates/shared/handlers/default.ts +0 -64
- package/src/templates/shared/handlers/enum.ts +0 -23
- package/src/templates/shared/handlers/file.ts +0 -27
- package/src/templates/shared/handlers/image.ts +0 -45
- package/src/templates/shared/handlers/int.ts +0 -15
- package/src/templates/shared/handlers/jdd.ts +0 -14
- package/src/templates/shared/handlers/single-reference.ts +0 -16
- package/src/templates/shared/handlers/structured-array.ts +0 -42
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { predicates } from "@sealcode/ts-predicates";
|
|
2
2
|
import { RegExpField } from "./regexp.js";
|
|
3
|
+
import { SimpleInput } from "../controls/controls.js";
|
|
3
4
|
|
|
4
5
|
export class EmailField<
|
|
5
6
|
Required extends boolean
|
|
@@ -17,4 +18,12 @@ export class EmailField<
|
|
|
17
18
|
default_value
|
|
18
19
|
);
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
setErrorMessage(message: string) {
|
|
23
|
+
this.error_message = message;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public getControl(): SimpleInput {
|
|
27
|
+
return new SimpleInput(this, { label: this.name, type: "email" });
|
|
28
|
+
}
|
|
20
29
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FieldTypes as SealiousFieldTypes } from "sealious";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { ExtractedFieldInfo } from "../../utils/extract-fields-from-collection.js";
|
|
4
|
+
import { CheckboxedListField } from "./checkboxed-list.js";
|
|
5
|
+
import { FormControlContext } from "../controls/form-control.js";
|
|
6
|
+
import { FormDataValue } from "../form-types.js";
|
|
7
|
+
|
|
8
|
+
export class EnumMultipleSealious<
|
|
9
|
+
Values extends string
|
|
10
|
+
> extends CheckboxedListField<boolean, Values> {
|
|
11
|
+
public sealious_field: SealiousFieldTypes.EnumMultiple<Values>;
|
|
12
|
+
|
|
13
|
+
constructor(sealious_field: SealiousFieldTypes.EnumMultiple<Values>) {
|
|
14
|
+
super(sealious_field.required, async (ctx: Context) =>
|
|
15
|
+
(await sealious_field.getAllowedValues(ctx.$context)).map(
|
|
16
|
+
(value: Values) => ({ value, label: value })
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
this.sealious_field = sealious_field;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
generateFieldDeclaration(
|
|
23
|
+
field_info: ExtractedFieldInfo,
|
|
24
|
+
vars: { form_field_types: string; sealious_field: string }
|
|
25
|
+
): string {
|
|
26
|
+
return `new ${vars.form_field_types}.${this.constructor.name}(${vars.sealious_field})`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getSealiousCreateValue(fctx: FormControlContext): Promise<Values[]> {
|
|
30
|
+
const { parsed } = await this.getParsedValue(
|
|
31
|
+
fctx.ctx,
|
|
32
|
+
fctx.data.raw_values
|
|
33
|
+
);
|
|
34
|
+
const result = Object.entries(parsed || {})
|
|
35
|
+
.filter(([, value]) => value == "on")
|
|
36
|
+
.map(([key]) => key as Values);
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async sealiousValueToForm(
|
|
41
|
+
ctx: Context,
|
|
42
|
+
sealious_value: Values[] | null
|
|
43
|
+
): Promise<FormDataValue> {
|
|
44
|
+
return Object.fromEntries(
|
|
45
|
+
(sealious_value || []).map((key) => [key, "on"])
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -7,7 +7,7 @@ import { mount } from "../../mount.js";
|
|
|
7
7
|
import { Form } from "../form.js";
|
|
8
8
|
import { getBrowser } from "../../utils/browser-creator.js";
|
|
9
9
|
import assert from "assert";
|
|
10
|
-
import {
|
|
10
|
+
import { TextBasedSimpleField } from "./simple-form-field.js";
|
|
11
11
|
import { SimpleInput } from "../controls/simple-input.js";
|
|
12
12
|
import { FormData } from "../form-types.js";
|
|
13
13
|
import { Boolean } from "./boolean.js";
|
|
@@ -30,7 +30,7 @@ describe("basic field", () => {
|
|
|
30
30
|
const router = new Router();
|
|
31
31
|
|
|
32
32
|
const fields = {
|
|
33
|
-
text: new
|
|
33
|
+
text: new TextBasedSimpleField(true),
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
let received_values: unknown;
|
|
@@ -44,7 +44,7 @@ describe("basic field", () => {
|
|
|
44
44
|
|
|
45
45
|
async onSubmit(ctx: Context, data: FormData) {
|
|
46
46
|
received_values = await this.getParsedValues(ctx);
|
|
47
|
-
const { parsed: email } = await this.fields.text.
|
|
47
|
+
const { parsed: email } = await this.fields.text.getParsedValue(
|
|
48
48
|
ctx,
|
|
49
49
|
data.raw_values
|
|
50
50
|
);
|
|
@@ -76,7 +76,7 @@ describe("basic field", () => {
|
|
|
76
76
|
let parse_called = false;
|
|
77
77
|
|
|
78
78
|
const fields = {
|
|
79
|
-
text: new (class MockField extends
|
|
79
|
+
text: new (class MockField extends TextBasedSimpleField<false> {
|
|
80
80
|
public async isValueValid() {
|
|
81
81
|
is_value_valid_called = true;
|
|
82
82
|
return true as any;
|
|
@@ -127,7 +127,7 @@ describe("basic field", () => {
|
|
|
127
127
|
let submit_called = false;
|
|
128
128
|
|
|
129
129
|
const fields = {
|
|
130
|
-
text: new
|
|
130
|
+
text: new TextBasedSimpleField(false),
|
|
131
131
|
checkbox: new Boolean(false),
|
|
132
132
|
};
|
|
133
133
|
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1
2
|
import { Predicate, predicates } from "@sealcode/ts-predicates";
|
|
2
3
|
import { Context } from "koa";
|
|
4
|
+
import { Collection, CollectionItem } from "sealious";
|
|
3
5
|
import { t } from "../../utils/translate.js";
|
|
4
|
-
import {
|
|
6
|
+
import { FormControl, FormControlContext } from "../controls/form-control.js";
|
|
7
|
+
import { FormDataValue, FormData } from "../form-types.js";
|
|
8
|
+
import { ExtractedFieldInfo } from "../../utils/extract-fields-from-collection.js";
|
|
9
|
+
import { wrapAttribute, wrapKeyName } from "../../utils/wrap-attributes.js";
|
|
5
10
|
|
|
6
11
|
export type FormFieldValidationResponse = { valid: boolean; message: string };
|
|
7
12
|
|
|
13
|
+
export type FormDisplayInfo<C extends Collection> = {
|
|
14
|
+
field: keyof C["fields"];
|
|
15
|
+
label: string;
|
|
16
|
+
format?: (value: unknown, item: CollectionItem<C>) => JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
|
|
8
19
|
export type FormFieldValidationFn<ValueType> = (
|
|
9
20
|
ctx: Context,
|
|
10
21
|
value: ValueType,
|
|
@@ -49,15 +60,20 @@ export type FieldParseResult<T> =
|
|
|
49
60
|
|
|
50
61
|
export abstract class FormField<
|
|
51
62
|
Required extends boolean = boolean,
|
|
52
|
-
ParsedValue = unknown
|
|
63
|
+
ParsedValue = unknown,
|
|
64
|
+
DefaultFormControl extends FormControl = FormControl,
|
|
65
|
+
SealiousValue = any
|
|
53
66
|
> {
|
|
54
67
|
name: string;
|
|
55
68
|
constructor(public readonly required: Required) {}
|
|
56
69
|
predicate: Predicate = predicates.unknown;
|
|
57
70
|
mapToFilter: (parsed: ParsedValue) => unknown = (value) => value;
|
|
58
71
|
|
|
59
|
-
async init(
|
|
60
|
-
|
|
72
|
+
async init(): Promise<void> {}
|
|
73
|
+
|
|
74
|
+
setName(name: string): this {
|
|
75
|
+
this.name = name;
|
|
76
|
+
return this;
|
|
61
77
|
}
|
|
62
78
|
|
|
63
79
|
public async _validate(
|
|
@@ -100,7 +116,7 @@ export abstract class FormField<
|
|
|
100
116
|
raw_value: FormDataValue
|
|
101
117
|
): Promise<FieldParseResult<ParsedValue>>;
|
|
102
118
|
|
|
103
|
-
async
|
|
119
|
+
async getParsedValue(
|
|
104
120
|
ctx: Context,
|
|
105
121
|
all_form_values: Record<string, FormDataValue>,
|
|
106
122
|
validate: true
|
|
@@ -110,7 +126,7 @@ export abstract class FormField<
|
|
|
110
126
|
parsed: ParsedValue | null;
|
|
111
127
|
raw: FormDataValue;
|
|
112
128
|
}>;
|
|
113
|
-
async
|
|
129
|
+
async getParsedValue(
|
|
114
130
|
ctx: Context,
|
|
115
131
|
all_form_values: Record<string, FormDataValue>,
|
|
116
132
|
validate?: false
|
|
@@ -119,7 +135,7 @@ export abstract class FormField<
|
|
|
119
135
|
parsed: ParsedValue | null;
|
|
120
136
|
raw: FormDataValue;
|
|
121
137
|
}>;
|
|
122
|
-
async
|
|
138
|
+
async getParsedValue(
|
|
123
139
|
ctx: Context,
|
|
124
140
|
all_form_values: Record<string, FormDataValue>,
|
|
125
141
|
validate = false
|
|
@@ -176,7 +192,77 @@ export abstract class FormField<
|
|
|
176
192
|
ctx: Context,
|
|
177
193
|
data: Record<string, FormDataValue>
|
|
178
194
|
): Promise<unknown> {
|
|
179
|
-
const { parsed } = await this.
|
|
195
|
+
const { parsed } = await this.getParsedValue(ctx, data);
|
|
180
196
|
return parsed;
|
|
181
197
|
}
|
|
198
|
+
|
|
199
|
+
abstract getControl(): DefaultFormControl;
|
|
200
|
+
|
|
201
|
+
getSealiousCreateValue(fctx: FormControlContext): Promise<SealiousValue> {
|
|
202
|
+
throw new Error("This field does not have a default sealious mapping");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
sealiousValueToForm(
|
|
206
|
+
ctx: Context,
|
|
207
|
+
sealiousValue: SealiousValue | null,
|
|
208
|
+
item: CollectionItem<any>
|
|
209
|
+
): Promise<FormDataValue> {
|
|
210
|
+
throw new Error("This field does not have a default sealious mapping");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async postSealiousCreate(
|
|
214
|
+
ctx: Context,
|
|
215
|
+
created_item: CollectionItem<any>,
|
|
216
|
+
form_data: FormData
|
|
217
|
+
): Promise<void> {}
|
|
218
|
+
|
|
219
|
+
async postSealiousEdit(
|
|
220
|
+
ctx: Context,
|
|
221
|
+
edited_item: CollectionItem<any>,
|
|
222
|
+
form_data: FormData
|
|
223
|
+
): Promise<void> {}
|
|
224
|
+
|
|
225
|
+
generateFieldDeclaration(
|
|
226
|
+
field_info: ExtractedFieldInfo,
|
|
227
|
+
vars: { form_field_types: string; sealious_field: string }
|
|
228
|
+
): string {
|
|
229
|
+
return `new ${vars.form_field_types}.${this.constructor.name}(${String(
|
|
230
|
+
field_info.is_required
|
|
231
|
+
)})`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
generateCreateValueGetter(
|
|
235
|
+
field_info: ExtractedFieldInfo,
|
|
236
|
+
vars: {
|
|
237
|
+
form_field_types: string;
|
|
238
|
+
sealious_field: string;
|
|
239
|
+
form_fields: string;
|
|
240
|
+
}
|
|
241
|
+
): string {
|
|
242
|
+
return `${wrapKeyName(field_info.name)}: await ${
|
|
243
|
+
vars.form_fields
|
|
244
|
+
}${wrapAttribute(field_info.name)}.getSealiousCreateValue(fctx)`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
generateInitialValue(
|
|
248
|
+
field_info: ExtractedFieldInfo,
|
|
249
|
+
vars: {
|
|
250
|
+
form_field_types: string;
|
|
251
|
+
form_fields: string;
|
|
252
|
+
}
|
|
253
|
+
): string {
|
|
254
|
+
return `${wrapKeyName(field_info.name)}: await ${
|
|
255
|
+
vars.form_fields
|
|
256
|
+
}${wrapAttribute(field_info.name)}.sealiousValueToForm(ctx, item.get("${
|
|
257
|
+
field_info.name
|
|
258
|
+
}"))`;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
generateImportsForFieldList(field_info: ExtractedFieldInfo): {
|
|
262
|
+
what: string;
|
|
263
|
+
from: string;
|
|
264
|
+
as?: string;
|
|
265
|
+
}[] {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
182
268
|
}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./boolean.js";
|
|
2
2
|
export * from "./checkboxed-list.js";
|
|
3
3
|
export * from "./collection-field.js";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
4
|
+
export * from "./color.js";
|
|
5
|
+
export * from "./coordinates.js";
|
|
6
|
+
export * from "./date.js";
|
|
7
|
+
export * from "./datetime.js";
|
|
8
|
+
export * from "./deep-reverse-single-reference-list.js";
|
|
9
|
+
export * from "./deep-reverse-single-reference-table.js";
|
|
7
10
|
export * from "./email.js";
|
|
8
|
-
export * from "./enum.js";
|
|
9
|
-
export * from "./boolean.js";
|
|
10
|
-
export * from "./enum-multiple.js";
|
|
11
|
+
export * from "./enum-multiple-sealious.js";
|
|
11
12
|
export * from "./existing-sealious-value.js";
|
|
12
13
|
export * from "./file.js";
|
|
14
|
+
export * from "./float.js";
|
|
15
|
+
export * from "./html.js";
|
|
16
|
+
export * from "./image.js";
|
|
17
|
+
export * from "./int.js";
|
|
18
|
+
export * from "./json.js";
|
|
19
|
+
export * from "./markdown.js";
|
|
13
20
|
export * from "./multiple-files.js";
|
|
14
|
-
export * from "./
|
|
21
|
+
export * from "./number.js";
|
|
22
|
+
export * from "./password.js";
|
|
23
|
+
export * from "./pick-from-list-sealious.js";
|
|
24
|
+
export * from "./pick-from-list.js";
|
|
25
|
+
export * from "./regexp.js";
|
|
26
|
+
export * from "./simple-form-field.js";
|
|
27
|
+
export * from "./single-reference.js";
|
|
15
28
|
export * from "./structured-array.js";
|
|
16
29
|
export * from "./table.js";
|
|
30
|
+
export * from "./text.js";
|
|
31
|
+
export * from "./url.js";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import Router from "@koa/router";
|
|
2
2
|
import { Context } from "koa";
|
|
3
|
-
import {
|
|
3
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
4
4
|
import getPort from "get-port";
|
|
5
5
|
import Koa from "koa";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
|
-
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
8
7
|
import { mount } from "../../mount.js";
|
|
9
|
-
import {
|
|
8
|
+
import { Image } from "../controls/image.js";
|
|
10
9
|
import { Form } from "../form.js";
|
|
11
10
|
import { File as FileField } from "./file.js";
|
|
12
11
|
import { getBrowser } from "../../utils/browser-creator.js";
|
|
@@ -33,7 +32,7 @@ describe("file field", () => {
|
|
|
33
32
|
const router = new Router();
|
|
34
33
|
|
|
35
34
|
const fields = {
|
|
36
|
-
file: new FileField(true
|
|
35
|
+
file: new FileField(true),
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
let received_values: any;
|
|
@@ -43,18 +42,7 @@ describe("file field", () => {
|
|
|
43
42
|
"/",
|
|
44
43
|
new (class extends Form<typeof fields, unknown> {
|
|
45
44
|
fields = fields;
|
|
46
|
-
controls = [
|
|
47
|
-
new Photo(
|
|
48
|
-
fields.file,
|
|
49
|
-
new KoaResponsiveImageRouter({
|
|
50
|
-
staticPath: "/tmp",
|
|
51
|
-
thumbnailSize: 10,
|
|
52
|
-
cacheManagerResolutionThreshold: 10,
|
|
53
|
-
imageStoragePath: "/tmp",
|
|
54
|
-
smartCropStoragePath: "/tmp",
|
|
55
|
-
})
|
|
56
|
-
),
|
|
57
|
-
];
|
|
45
|
+
controls = [new Image(fields.file)];
|
|
58
46
|
|
|
59
47
|
async onSubmit(ctx: Context) {
|
|
60
48
|
received_values = await this.getParsedValues(ctx);
|
package/src/forms/fields/file.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { hasFieldOfType, is, predicates } from "@sealcode/ts-predicates";
|
|
2
2
|
import { Context } from "koa";
|
|
3
|
-
import {
|
|
4
|
-
FileManager,
|
|
5
|
-
FilePointer,
|
|
6
|
-
PathFilePointer,
|
|
7
|
-
} from "@sealcode/file-manager";
|
|
3
|
+
import { FilePointer, PathFilePointer } from "@sealcode/file-manager";
|
|
8
4
|
import { FormDataValue } from "../form-types.js";
|
|
9
5
|
import { FieldParseResult, FormField } from "./field.js";
|
|
6
|
+
import { File as FileControl } from "../controls/file.js";
|
|
7
|
+
import { FormControl, FormControlContext } from "../controls/form-control.js";
|
|
10
8
|
|
|
11
9
|
export type FileContainer = {
|
|
12
10
|
old: FilePointer | null;
|
|
@@ -15,22 +13,20 @@ export type FileContainer = {
|
|
|
15
13
|
|
|
16
14
|
export class File<Required extends boolean> extends FormField<
|
|
17
15
|
Required,
|
|
18
|
-
FileContainer
|
|
16
|
+
FileContainer,
|
|
17
|
+
FormControl
|
|
19
18
|
> {
|
|
20
|
-
constructor(
|
|
21
|
-
public readonly required: Required,
|
|
22
|
-
public file_manager: FileManager
|
|
23
|
-
) {
|
|
19
|
+
constructor(public readonly required: Required) {
|
|
24
20
|
super(required);
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
async parse(
|
|
28
|
-
|
|
24
|
+
ctx: Context,
|
|
29
25
|
raw_value: FormDataValue
|
|
30
26
|
): Promise<FieldParseResult<FileContainer>> {
|
|
31
27
|
let result;
|
|
32
28
|
if (is(raw_value, predicates.string)) {
|
|
33
|
-
const file = await
|
|
29
|
+
const file = await ctx.$app.fileManager.fromToken(raw_value);
|
|
34
30
|
result = {
|
|
35
31
|
parsed_value: { old: file, new: null },
|
|
36
32
|
error: null,
|
|
@@ -48,7 +44,7 @@ export class File<Required extends boolean> extends FormField<
|
|
|
48
44
|
"old",
|
|
49
45
|
predicates.instanceOf(PathFilePointer)
|
|
50
46
|
)
|
|
51
|
-
? await
|
|
47
|
+
? await ctx.$app.fileManager.toPointer(
|
|
52
48
|
raw_value.old as string | FilePointer
|
|
53
49
|
)
|
|
54
50
|
: null;
|
|
@@ -70,16 +66,48 @@ export class File<Required extends boolean> extends FormField<
|
|
|
70
66
|
parsed_value: { old: old_file, new: new_file },
|
|
71
67
|
};
|
|
72
68
|
}
|
|
73
|
-
|
|
74
69
|
return result;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
async getDatabaseValue(ctx: Context, data: Record<string, FormDataValue>) {
|
|
78
|
-
const { parsed } = await this.
|
|
73
|
+
const { parsed } = await this.getParsedValue(ctx, data);
|
|
79
74
|
return parsed?.new || undefined;
|
|
80
75
|
}
|
|
81
76
|
|
|
82
77
|
getEmptyValue() {
|
|
83
78
|
return { old: null, new: null };
|
|
84
79
|
}
|
|
80
|
+
|
|
81
|
+
getControl(...args: any[]): FileControl {
|
|
82
|
+
return new FileControl(this, { label: this.name, autocomplete: false });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async getSealiousCreateValue(
|
|
86
|
+
fctx: FormControlContext
|
|
87
|
+
): Promise<FilePointer | undefined> {
|
|
88
|
+
const { parsed: value } = await this.getParsedValue(
|
|
89
|
+
fctx.ctx,
|
|
90
|
+
fctx.data.raw_values
|
|
91
|
+
);
|
|
92
|
+
const pointer = value?.new || value?.old || undefined;
|
|
93
|
+
if (this.required && !pointer) {
|
|
94
|
+
throw new Error("File is required, but no value is provided");
|
|
95
|
+
}
|
|
96
|
+
return pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async sealiousValueToForm(
|
|
100
|
+
ctx: Context,
|
|
101
|
+
sealiousValue: FilePointer | string | null
|
|
102
|
+
): Promise<{ old: FilePointer | undefined } | Record<string, never>> {
|
|
103
|
+
if (!sealiousValue) {
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
if (typeof sealiousValue == "string") {
|
|
107
|
+
sealiousValue = await ctx.$app.fileManager.fromToken(sealiousValue);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
old: sealiousValue, // FilePointer
|
|
111
|
+
};
|
|
112
|
+
}
|
|
85
113
|
}
|