@kaspernj/api-maker 1.0.2052 → 1.0.2054
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/build/api.d.ts +19 -0
- package/build/api.d.ts.map +1 -0
- package/build/api.js +232 -116
- package/build/api.js.map +1 -0
- package/build/attribute-not-loaded-error.d.ts +3 -0
- package/build/attribute-not-loaded-error.d.ts.map +1 -0
- package/build/attribute-not-loaded-error.js +26 -2
- package/build/attribute-not-loaded-error.js.map +1 -0
- package/build/base-component.d.ts +4 -0
- package/build/base-component.d.ts.map +1 -0
- package/build/base-component.js +27 -5
- package/build/base-component.js.map +1 -0
- package/build/base-error.d.ts +31 -0
- package/build/base-error.d.ts.map +1 -0
- package/build/base-error.js +74 -31
- package/build/base-error.js.map +1 -0
- package/build/base-model/attribute.d.ts +45 -0
- package/build/base-model/attribute.d.ts.map +1 -0
- package/build/base-model/attribute.js +58 -24
- package/build/base-model/attribute.js.map +1 -0
- package/build/base-model/column.d.ts +17 -0
- package/build/base-model/column.d.ts.map +1 -0
- package/build/base-model/column.js +21 -10
- package/build/base-model/column.js.map +1 -0
- package/build/base-model/reflection.d.ts +22 -0
- package/build/base-model/reflection.d.ts.map +1 -0
- package/build/base-model/reflection.js +66 -14
- package/build/base-model/reflection.js.map +1 -0
- package/build/base-model/scope.d.ts +9 -0
- package/build/base-model/scope.d.ts.map +1 -0
- package/build/base-model/scope.js +51 -11
- package/build/base-model/scope.js.map +1 -0
- package/build/base-model.js +1282 -821
- package/build/base-model.js.map +1 -0
- package/build/bootstrap/attribute-row.d.ts +3 -0
- package/build/bootstrap/attribute-row.d.ts.map +1 -0
- package/build/bootstrap/attribute-row.js +178 -133
- package/build/bootstrap/attribute-row.js.map +1 -0
- package/build/bootstrap/attribute-rows.d.ts +3 -0
- package/build/bootstrap/attribute-rows.d.ts.map +1 -0
- package/build/bootstrap/attribute-rows.js +52 -31
- package/build/bootstrap/attribute-rows.js.map +1 -0
- package/build/bootstrap/card.d.ts +3 -0
- package/build/bootstrap/card.d.ts.map +1 -0
- package/build/bootstrap/card.js +163 -135
- package/build/bootstrap/card.js.map +1 -0
- package/build/bootstrap/checkbox.d.ts +3 -0
- package/build/bootstrap/checkbox.d.ts.map +1 -0
- package/build/bootstrap/checkbox.js +105 -97
- package/build/bootstrap/checkbox.js.map +1 -0
- package/build/bootstrap/checkboxes.d.ts +3 -0
- package/build/bootstrap/checkboxes.d.ts.map +1 -0
- package/build/bootstrap/checkboxes.js +206 -180
- package/build/bootstrap/checkboxes.js.map +1 -0
- package/build/bootstrap/index.d.ts +1 -0
- package/build/bootstrap/index.d.ts.map +1 -0
- package/build/bootstrap/index.js +1 -2
- package/build/bootstrap/index.js.map +1 -0
- package/build/bootstrap/input.d.ts +3 -0
- package/build/bootstrap/input.d.ts.map +1 -0
- package/build/bootstrap/input.js +135 -129
- package/build/bootstrap/input.js.map +1 -0
- package/build/bootstrap/invalid-feedback.d.ts +6 -0
- package/build/bootstrap/invalid-feedback.d.ts.map +1 -0
- package/build/bootstrap/invalid-feedback.js +51 -26
- package/build/bootstrap/invalid-feedback.js.map +1 -0
- package/build/bootstrap/paginate.d.ts +3 -0
- package/build/bootstrap/paginate.d.ts.map +1 -0
- package/build/bootstrap/paginate.js +165 -148
- package/build/bootstrap/paginate.js.map +1 -0
- package/build/bootstrap/radio-buttons.d.ts +3 -0
- package/build/bootstrap/radio-buttons.d.ts.map +1 -0
- package/build/bootstrap/radio-buttons.js +89 -72
- package/build/bootstrap/radio-buttons.js.map +1 -0
- package/build/bootstrap/select.d.ts +3 -0
- package/build/bootstrap/select.d.ts.map +1 -0
- package/build/bootstrap/select.js +103 -88
- package/build/bootstrap/select.js.map +1 -0
- package/build/bootstrap/sort-link.d.ts +3 -0
- package/build/bootstrap/sort-link.d.ts.map +1 -0
- package/build/bootstrap/sort-link.js +153 -129
- package/build/bootstrap/sort-link.js.map +1 -0
- package/build/cable-connection-pool.d.ts +27 -0
- package/build/cable-connection-pool.d.ts.map +1 -0
- package/build/cable-connection-pool.js +118 -123
- package/build/cable-connection-pool.js.map +1 -0
- package/build/cable-subscription-pool.d.ts +16 -0
- package/build/cable-subscription-pool.d.ts.map +1 -0
- package/build/cable-subscription-pool.js +211 -199
- package/build/cable-subscription-pool.js.map +1 -0
- package/build/cable-subscription.d.ts +7 -0
- package/build/cable-subscription.d.ts.map +1 -0
- package/build/cable-subscription.js +25 -20
- package/build/cable-subscription.js.map +1 -0
- package/build/cache-key-generator.d.ts +15 -0
- package/build/cache-key-generator.d.ts.map +1 -0
- package/build/cache-key-generator.js +86 -78
- package/build/cache-key-generator.js.map +1 -0
- package/build/can-can.d.ts +19 -0
- package/build/can-can.d.ts.map +1 -0
- package/build/can-can.js +243 -128
- package/build/can-can.js.map +1 -0
- package/build/channels-consumer.d.ts +3 -0
- package/build/channels-consumer.d.ts.map +1 -0
- package/build/channels-consumer.js +13 -8
- package/build/channels-consumer.js.map +1 -0
- package/build/collection-loader.d.ts +3 -0
- package/build/collection-loader.d.ts.map +1 -0
- package/build/collection-loader.js +70 -46
- package/build/collection-loader.js.map +1 -0
- package/build/collection.d.ts +213 -0
- package/build/collection.d.ts.map +1 -0
- package/build/collection.js +592 -306
- package/build/collection.js.map +1 -0
- package/build/command-submit-data.d.ts +54 -0
- package/build/command-submit-data.d.ts.map +1 -0
- package/build/command-submit-data.js +126 -80
- package/build/command-submit-data.js.map +1 -0
- package/build/commands-pool.d.ts +63 -0
- package/build/commands-pool.d.ts.map +1 -0
- package/build/commands-pool.js +281 -189
- package/build/commands-pool.js.map +1 -0
- package/build/compose.d.ts +2 -0
- package/build/compose.d.ts.map +1 -0
- package/build/compose.js +17 -8
- package/build/compose.js.map +1 -0
- package/build/config.d.ts +9 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +105 -70
- package/build/config.js.map +1 -0
- package/build/custom-error.d.ts +8 -0
- package/build/custom-error.d.ts.map +1 -0
- package/build/custom-error.js +30 -4
- package/build/custom-error.js.map +1 -0
- package/build/data-set-to-attributes.d.ts +2 -0
- package/build/data-set-to-attributes.d.ts.map +1 -0
- package/build/data-set-to-attributes.js +45 -9
- package/build/data-set-to-attributes.js.map +1 -0
- package/build/deserializer.d.ts +4 -0
- package/build/deserializer.d.ts.map +1 -0
- package/build/deserializer.js +109 -54
- package/build/deserializer.js.map +1 -0
- package/build/destroy-error.d.ts +8 -0
- package/build/destroy-error.d.ts.map +1 -0
- package/build/destroy-error.js +30 -4
- package/build/destroy-error.js.map +1 -0
- package/build/devise.d.ts +20 -0
- package/build/devise.d.ts.map +1 -0
- package/build/devise.js +214 -123
- package/build/devise.js.map +1 -0
- package/build/draggable-sort/controller.d.ts +41 -0
- package/build/draggable-sort/controller.d.ts.map +1 -0
- package/build/draggable-sort/controller.js +130 -133
- package/build/draggable-sort/controller.js.map +1 -0
- package/build/draggable-sort/index.d.ts +3 -0
- package/build/draggable-sort/index.d.ts.map +1 -0
- package/build/draggable-sort/index.js +147 -111
- package/build/draggable-sort/index.js.map +1 -0
- package/build/draggable-sort/item.d.ts +3 -0
- package/build/draggable-sort/item.d.ts.map +1 -0
- package/build/draggable-sort/item.js +199 -183
- package/build/draggable-sort/item.js.map +1 -0
- package/build/error-logger.d.ts +20 -0
- package/build/error-logger.d.ts.map +1 -0
- package/build/error-logger.js +184 -92
- package/build/error-logger.js.map +1 -0
- package/build/error-messages.d.ts +18 -0
- package/build/error-messages.d.ts.map +1 -0
- package/build/error-messages.js +26 -13
- package/build/error-messages.js.map +1 -0
- package/build/event-connection.d.ts +12 -0
- package/build/event-connection.d.ts.map +1 -0
- package/build/event-connection.js +69 -31
- package/build/event-connection.js.map +1 -0
- package/build/event-emitter-listener.d.ts +8 -0
- package/build/event-emitter-listener.d.ts.map +1 -0
- package/build/event-emitter-listener.js +26 -14
- package/build/event-emitter-listener.js.map +1 -0
- package/build/event-model-class.d.ts +9 -0
- package/build/event-model-class.d.ts.map +1 -0
- package/build/event-model-class.js +50 -23
- package/build/event-model-class.js.map +1 -0
- package/build/events.d.ts +4 -0
- package/build/events.d.ts.map +1 -0
- package/build/events.js +9 -4
- package/build/events.js.map +1 -0
- package/build/form.d.ts +14 -0
- package/build/form.d.ts.map +1 -0
- package/build/form.js +169 -96
- package/build/form.js.map +1 -0
- package/build/history-expo.d.ts +6 -0
- package/build/history-expo.d.ts.map +1 -0
- package/build/history-expo.js +28 -19
- package/build/history-expo.js.map +1 -0
- package/build/history-react-native.d.ts +6 -0
- package/build/history-react-native.d.ts.map +1 -0
- package/build/history-react-native.js +29 -19
- package/build/history-react-native.js.map +1 -0
- package/build/history.d.ts +3 -0
- package/build/history.d.ts.map +1 -0
- package/build/history.js +5 -3
- package/build/history.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +6 -3
- package/build/index.js.map +1 -0
- package/build/inputs/attachment.d.ts +3 -0
- package/build/inputs/attachment.d.ts.map +1 -0
- package/build/inputs/attachment.js +125 -133
- package/build/inputs/attachment.js.map +1 -0
- package/build/inputs/auto-submit.d.ts +9 -0
- package/build/inputs/auto-submit.d.ts.map +1 -0
- package/build/inputs/auto-submit.js +71 -35
- package/build/inputs/auto-submit.js.map +1 -0
- package/build/inputs/checkbox.d.ts +3 -0
- package/build/inputs/checkbox.d.ts.map +1 -0
- package/build/inputs/checkbox.js +171 -136
- package/build/inputs/checkbox.js.map +1 -0
- package/build/inputs/checkboxes.d.ts +3 -0
- package/build/inputs/checkboxes.d.ts.map +1 -0
- package/build/inputs/checkboxes.js +161 -110
- package/build/inputs/checkboxes.js.map +1 -0
- package/build/inputs/id-for-component.d.ts +2 -0
- package/build/inputs/id-for-component.d.ts.map +1 -0
- package/build/inputs/id-for-component.js +53 -14
- package/build/inputs/id-for-component.js.map +1 -0
- package/build/inputs/input-wrapper.d.ts +3 -0
- package/build/inputs/input-wrapper.d.ts.map +1 -0
- package/build/inputs/input-wrapper.js +27 -18
- package/build/inputs/input-wrapper.js.map +1 -0
- package/build/inputs/input.d.ts +5 -0
- package/build/inputs/input.d.ts.map +1 -0
- package/build/inputs/input.js +250 -240
- package/build/inputs/input.js.map +1 -0
- package/build/inputs/money.d.ts +3 -0
- package/build/inputs/money.d.ts.map +1 -0
- package/build/inputs/money.js +189 -171
- package/build/inputs/money.js.map +1 -0
- package/build/inputs/name-for-component.d.ts +2 -0
- package/build/inputs/name-for-component.d.ts.map +1 -0
- package/build/inputs/name-for-component.js +48 -11
- package/build/inputs/name-for-component.js.map +1 -0
- package/build/inputs/select.d.ts +5 -0
- package/build/inputs/select.d.ts.map +1 -0
- package/build/inputs/select.js +128 -93
- package/build/inputs/select.js.map +1 -0
- package/build/instance-of-class-name.d.ts +3 -0
- package/build/instance-of-class-name.d.ts.map +1 -0
- package/build/instance-of-class-name.js +24 -21
- package/build/instance-of-class-name.js.map +1 -0
- package/build/is-expo.d.ts +3 -0
- package/build/is-expo.d.ts.map +1 -0
- package/build/is-expo.js +16 -20
- package/build/is-expo.js.map +1 -0
- package/build/key-value-store.d.ts +11 -0
- package/build/key-value-store.d.ts.map +1 -0
- package/build/key-value-store.js +133 -51
- package/build/key-value-store.js.map +1 -0
- package/build/link.d.ts +3 -0
- package/build/link.d.ts.map +1 -0
- package/build/link.js +120 -82
- package/build/link.js.map +1 -0
- package/build/logger.d.ts +13 -0
- package/build/logger.d.ts.map +1 -0
- package/build/logger.js +39 -29
- package/build/logger.js.map +1 -0
- package/build/merge-styles.d.ts +2 -0
- package/build/merge-styles.d.ts.map +1 -0
- package/build/merge-styles.js +16 -11
- package/build/merge-styles.js.map +1 -0
- package/build/modal.d.ts +3 -0
- package/build/modal.d.ts.map +1 -0
- package/build/modal.js +71 -38
- package/build/modal.js.map +1 -0
- package/build/model-class-require.d.ts +3 -0
- package/build/model-class-require.d.ts.map +1 -0
- package/build/model-class-require.js +47 -12
- package/build/model-class-require.js.map +1 -0
- package/build/model-events.d.ts +8 -0
- package/build/model-events.d.ts.map +1 -0
- package/build/model-events.js +39 -30
- package/build/model-events.js.map +1 -0
- package/build/model-name.d.ts +8 -0
- package/build/model-name.d.ts.map +1 -0
- package/build/model-name.js +66 -26
- package/build/model-name.js.map +1 -0
- package/build/model-prop-type.d.ts +21 -0
- package/build/model-prop-type.d.ts.map +1 -0
- package/build/model-prop-type.js +107 -98
- package/build/model-prop-type.js.map +1 -0
- package/build/model-recipes-loader.d.ts +10 -0
- package/build/model-recipes-loader.d.ts.map +1 -0
- package/build/model-recipes-loader.js +30 -31
- package/build/model-recipes-loader.js.map +1 -0
- package/build/model-recipes-model-loader.d.ts +202 -0
- package/build/model-recipes-model-loader.d.ts.map +1 -0
- package/build/model-recipes-model-loader.js +304 -344
- package/build/model-recipes-model-loader.js.map +1 -0
- package/build/models-response-reader.d.ts +9 -0
- package/build/models-response-reader.d.ts.map +1 -0
- package/build/models-response-reader.js +79 -39
- package/build/models-response-reader.js.map +1 -0
- package/build/models.d.ts +3 -0
- package/build/models.d.ts.map +1 -0
- package/build/models.js +11 -8
- package/build/models.js.map +1 -0
- package/build/money-formatter.d.ts +17 -0
- package/build/money-formatter.d.ts.map +1 -0
- package/build/money-formatter.js +93 -76
- package/build/money-formatter.js.map +1 -0
- package/build/not-loaded-error.d.ts +3 -0
- package/build/not-loaded-error.d.ts.map +1 -0
- package/build/not-loaded-error.js +26 -2
- package/build/not-loaded-error.js.map +1 -0
- package/build/params.d.ts +16 -0
- package/build/params.d.ts.map +1 -0
- package/build/params.js +73 -60
- package/build/params.js.map +1 -0
- package/build/preloaded.d.ts +8 -0
- package/build/preloaded.d.ts.map +1 -0
- package/build/preloaded.js +73 -36
- package/build/preloaded.js.map +1 -0
- package/build/resize-observer.d.ts +3 -0
- package/build/resize-observer.d.ts.map +1 -0
- package/build/resize-observer.js +13 -10
- package/build/resize-observer.js.map +1 -0
- package/build/rest-props-validator.d.ts +3 -0
- package/build/rest-props-validator.d.ts.map +1 -0
- package/build/rest-props-validator.js +9 -7
- package/build/rest-props-validator.js.map +1 -0
- package/build/result.d.ts +38 -0
- package/build/result.d.ts.map +1 -0
- package/build/result.js +43 -13
- package/build/result.js.map +1 -0
- package/build/router/route.d.ts +8 -0
- package/build/router/route.d.ts.map +1 -0
- package/build/router/route.js +322 -266
- package/build/router/route.js.map +1 -0
- package/build/router/switch.d.ts +4 -0
- package/build/router/switch.d.ts.map +1 -0
- package/build/router/switch.js +132 -70
- package/build/router/switch.js.map +1 -0
- package/build/router.d.ts +3 -0
- package/build/router.d.ts.map +1 -0
- package/build/router.js +94 -57
- package/build/router.js.map +1 -0
- package/build/routes-native.d.ts +24 -0
- package/build/routes-native.d.ts.map +1 -0
- package/build/routes-native.js +233 -198
- package/build/routes-native.js.map +1 -0
- package/build/routes.d.ts +10 -0
- package/build/routes.d.ts.map +1 -0
- package/build/routes.js +102 -48
- package/build/routes.js.map +1 -0
- package/build/run-last.d.ts +12 -0
- package/build/run-last.d.ts.map +1 -0
- package/build/run-last.js +40 -34
- package/build/run-last.js.map +1 -0
- package/build/serializer.d.ts +10 -0
- package/build/serializer.d.ts.map +1 -0
- package/build/serializer.js +73 -62
- package/build/serializer.js.map +1 -0
- package/build/services.d.ts +5 -0
- package/build/services.d.ts.map +1 -0
- package/build/services.js +30 -20
- package/build/services.js.map +1 -0
- package/build/session-status-updater.d.ts +21 -0
- package/build/session-status-updater.d.ts.map +1 -0
- package/build/session-status-updater.js +227 -130
- package/build/session-status-updater.js.map +1 -0
- package/build/source-maps-loader.js +279 -176
- package/build/source-maps-loader.js.map +1 -0
- package/build/super-admin/config-reader.d.ts +23 -0
- package/build/super-admin/config-reader.d.ts.map +1 -0
- package/build/super-admin/config-reader.js +116 -82
- package/build/super-admin/config-reader.js.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.d.ts +3 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.d.ts.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.js +118 -83
- package/build/super-admin/edit-page/edit-attribute-checkbox.js.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-content.d.ts +3 -0
- package/build/super-admin/edit-page/edit-attribute-content.d.ts.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-content.js +79 -55
- package/build/super-admin/edit-page/edit-attribute-content.js.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-input.d.ts +3 -0
- package/build/super-admin/edit-page/edit-attribute-input.d.ts.map +1 -0
- package/build/super-admin/edit-page/edit-attribute-input.js +119 -77
- package/build/super-admin/edit-page/edit-attribute-input.js.map +1 -0
- package/build/super-admin/edit-page/edit-attribute.d.ts +3 -0
- package/build/super-admin/edit-page/edit-attribute.d.ts.map +1 -0
- package/build/super-admin/edit-page/edit-attribute.js +105 -76
- package/build/super-admin/edit-page/edit-attribute.js.map +1 -0
- package/build/super-admin/edit-page.d.ts +3 -0
- package/build/super-admin/edit-page.d.ts.map +1 -0
- package/build/super-admin/edit-page.js +202 -120
- package/build/super-admin/edit-page.js.map +1 -0
- package/build/super-admin/has-edit-config.d.ts +3 -0
- package/build/super-admin/has-edit-config.d.ts.map +1 -0
- package/build/super-admin/has-edit-config.js +17 -11
- package/build/super-admin/has-edit-config.js.map +1 -0
- package/build/super-admin/index-page.d.ts +3 -0
- package/build/super-admin/index-page.d.ts.map +1 -0
- package/build/super-admin/index-page.js +45 -25
- package/build/super-admin/index-page.js.map +1 -0
- package/build/super-admin/index.d.ts +3 -0
- package/build/super-admin/index.d.ts.map +1 -0
- package/build/super-admin/index.js +254 -184
- package/build/super-admin/index.js.map +1 -0
- package/build/super-admin/layout/header/index.d.ts +3 -0
- package/build/super-admin/layout/header/index.d.ts.map +1 -0
- package/build/super-admin/layout/header/index.js +154 -155
- package/build/super-admin/layout/header/index.js.map +1 -0
- package/build/super-admin/layout/index.d.ts +3 -0
- package/build/super-admin/layout/index.d.ts.map +1 -0
- package/build/super-admin/layout/index.js +183 -160
- package/build/super-admin/layout/index.js.map +1 -0
- package/build/super-admin/layout/menu/index.d.ts +3 -0
- package/build/super-admin/layout/menu/index.d.ts.map +1 -0
- package/build/super-admin/layout/menu/index.js +191 -203
- package/build/super-admin/layout/menu/index.js.map +1 -0
- package/build/super-admin/layout/menu/menu-content.d.ts +3 -0
- package/build/super-admin/layout/menu/menu-content.d.ts.map +1 -0
- package/build/super-admin/layout/menu/menu-content.js +86 -45
- package/build/super-admin/layout/menu/menu-content.js.map +1 -0
- package/build/super-admin/layout/menu/menu-item.d.ts +3 -0
- package/build/super-admin/layout/menu/menu-item.d.ts.map +1 -0
- package/build/super-admin/layout/menu/menu-item.js +104 -83
- package/build/super-admin/layout/menu/menu-item.js.map +1 -0
- package/build/super-admin/layout/no-access.d.ts +3 -0
- package/build/super-admin/layout/no-access.d.ts.map +1 -0
- package/build/super-admin/layout/no-access.js +46 -27
- package/build/super-admin/layout/no-access.js.map +1 -0
- package/build/super-admin/model-class-table.d.ts +3 -0
- package/build/super-admin/model-class-table.d.ts.map +1 -0
- package/build/super-admin/model-class-table.js +132 -60
- package/build/super-admin/model-class-table.js.map +1 -0
- package/build/super-admin/models.d.ts +3 -0
- package/build/super-admin/models.d.ts.map +1 -0
- package/build/super-admin/models.js +43 -7
- package/build/super-admin/models.js.map +1 -0
- package/build/super-admin/show-nav.d.ts +3 -0
- package/build/super-admin/show-nav.d.ts.map +1 -0
- package/build/super-admin/show-nav.js +90 -51
- package/build/super-admin/show-nav.js.map +1 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.d.ts +3 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.d.ts.map +1 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.js +77 -28
- package/build/super-admin/show-page/belongs-to-attribute-row.js.map +1 -0
- package/build/super-admin/show-page/index.d.ts +3 -0
- package/build/super-admin/show-page/index.d.ts.map +1 -0
- package/build/super-admin/show-page/index.js +202 -137
- package/build/super-admin/show-page/index.js.map +1 -0
- package/build/super-admin/show-reflection-actions.d.ts +3 -0
- package/build/super-admin/show-reflection-actions.d.ts.map +1 -0
- package/build/super-admin/show-reflection-actions.js +100 -46
- package/build/super-admin/show-reflection-actions.js.map +1 -0
- package/build/super-admin/show-reflection-link.d.ts +3 -0
- package/build/super-admin/show-reflection-link.d.ts.map +1 -0
- package/build/super-admin/show-reflection-link.js +101 -47
- package/build/super-admin/show-reflection-link.js.map +1 -0
- package/build/super-admin/show-reflection-page.d.ts +3 -0
- package/build/super-admin/show-reflection-page.d.ts.map +1 -0
- package/build/super-admin/show-reflection-page.js +98 -48
- package/build/super-admin/show-reflection-page.js.map +1 -0
- package/build/table/column-content.d.ts +25 -0
- package/build/table/column-content.d.ts.map +1 -0
- package/build/table/column-content.js +153 -115
- package/build/table/column-content.js.map +1 -0
- package/build/table/column-identifier.d.ts +2 -0
- package/build/table/column-identifier.d.ts.map +1 -0
- package/build/table/column-identifier.js +22 -16
- package/build/table/column-identifier.js.map +1 -0
- package/build/table/column-visible.d.ts +2 -0
- package/build/table/column-visible.d.ts.map +1 -0
- package/build/table/column-visible.js +12 -6
- package/build/table/column-visible.js.map +1 -0
- package/build/table/components/column.d.ts +3 -0
- package/build/table/components/column.d.ts.map +1 -0
- package/build/table/components/column.js +61 -21
- package/build/table/components/column.js.map +1 -0
- package/build/table/components/flat-list.d.ts +3 -0
- package/build/table/components/flat-list.d.ts.map +1 -0
- package/build/table/components/flat-list.js +61 -21
- package/build/table/components/flat-list.js.map +1 -0
- package/build/table/components/header.d.ts +3 -0
- package/build/table/components/header.d.ts.map +1 -0
- package/build/table/components/header.js +63 -26
- package/build/table/components/header.js.map +1 -0
- package/build/table/components/row.d.ts +3 -0
- package/build/table/components/row.d.ts.map +1 -0
- package/build/table/components/row.js +65 -26
- package/build/table/components/row.js.map +1 -0
- package/build/table/filters/attribute-element.d.ts +3 -0
- package/build/table/filters/attribute-element.d.ts.map +1 -0
- package/build/table/filters/attribute-element.js +63 -44
- package/build/table/filters/attribute-element.js.map +1 -0
- package/build/table/filters/filter-form.d.ts +3 -0
- package/build/table/filters/filter-form.d.ts.map +1 -0
- package/build/table/filters/filter-form.js +489 -453
- package/build/table/filters/filter-form.js.map +1 -0
- package/build/table/filters/filter.d.ts +3 -0
- package/build/table/filters/filter.d.ts.map +1 -0
- package/build/table/filters/filter.js +75 -90
- package/build/table/filters/filter.js.map +1 -0
- package/build/table/filters/index.d.ts +3 -0
- package/build/table/filters/index.d.ts.map +1 -0
- package/build/table/filters/index.js +143 -188
- package/build/table/filters/index.js.map +1 -0
- package/build/table/filters/load-search-modal.d.ts +3 -0
- package/build/table/filters/load-search-modal.d.ts.map +1 -0
- package/build/table/filters/load-search-modal.js +234 -169
- package/build/table/filters/load-search-modal.js.map +1 -0
- package/build/table/filters/reflection-element.d.ts +3 -0
- package/build/table/filters/reflection-element.d.ts.map +1 -0
- package/build/table/filters/reflection-element.js +55 -37
- package/build/table/filters/reflection-element.js.map +1 -0
- package/build/table/filters/save-search-modal.d.ts +3 -0
- package/build/table/filters/save-search-modal.d.ts.map +1 -0
- package/build/table/filters/save-search-modal.js +140 -85
- package/build/table/filters/save-search-modal.js.map +1 -0
- package/build/table/filters/scope-element.d.ts +3 -0
- package/build/table/filters/scope-element.d.ts.map +1 -0
- package/build/table/filters/scope-element.js +58 -42
- package/build/table/filters/scope-element.js.map +1 -0
- package/build/table/header-column-content.d.ts +3 -0
- package/build/table/header-column-content.d.ts.map +1 -0
- package/build/table/header-column-content.js +71 -68
- package/build/table/header-column-content.js.map +1 -0
- package/build/table/header-column.d.ts +3 -0
- package/build/table/header-column.d.ts.map +1 -0
- package/build/table/header-column.js +220 -143
- package/build/table/header-column.js.map +1 -0
- package/build/table/header-select.d.ts +3 -0
- package/build/table/header-select.d.ts.map +1 -0
- package/build/table/header-select.js +77 -105
- package/build/table/header-select.js.map +1 -0
- package/build/table/model-callback-args.d.ts +4 -0
- package/build/table/model-callback-args.d.ts.map +1 -0
- package/build/table/model-callback-args.js +43 -9
- package/build/table/model-callback-args.js.map +1 -0
- package/build/table/model-column.d.ts +3 -0
- package/build/table/model-column.d.ts.map +1 -0
- package/build/table/model-column.js +145 -99
- package/build/table/model-column.js.map +1 -0
- package/build/table/model-row.d.ts +3 -0
- package/build/table/model-row.d.ts.map +1 -0
- package/build/table/model-row.js +188 -190
- package/build/table/model-row.js.map +1 -0
- package/build/table/select-calculator.d.ts +2 -0
- package/build/table/select-calculator.d.ts.map +1 -0
- package/build/table/select-calculator.js +110 -59
- package/build/table/select-calculator.js.map +1 -0
- package/build/table/settings/column-row.d.ts +3 -0
- package/build/table/settings/column-row.d.ts.map +1 -0
- package/build/table/settings/column-row.js +188 -95
- package/build/table/settings/column-row.js.map +1 -0
- package/build/table/settings/download-action.d.ts +3 -0
- package/build/table/settings/download-action.d.ts.map +1 -0
- package/build/table/settings/download-action.js +75 -85
- package/build/table/settings/download-action.js.map +1 -0
- package/build/table/settings/index.d.ts +3 -0
- package/build/table/settings/index.d.ts.map +1 -0
- package/build/table/settings/index.js +103 -95
- package/build/table/settings/index.js.map +1 -0
- package/build/table/table-settings.d.ts +35 -0
- package/build/table/table-settings.d.ts.map +1 -0
- package/build/table/table-settings.js +336 -206
- package/build/table/table-settings.js.map +1 -0
- package/build/table/table.d.ts +3 -0
- package/build/table/table.d.ts.map +1 -0
- package/build/table/table.js +801 -964
- package/build/table/table.js.map +1 -0
- package/build/table/use-sorting.d.ts +21 -0
- package/build/table/use-sorting.d.ts.map +1 -0
- package/build/table/use-sorting.js +59 -31
- package/build/table/use-sorting.js.map +1 -0
- package/build/table/widths.d.ts +18 -0
- package/build/table/widths.d.ts.map +1 -0
- package/build/table/widths.js +75 -74
- package/build/table/widths.js.map +1 -0
- package/build/table/worker-plugins-check-all-checkbox.d.ts +3 -0
- package/build/table/worker-plugins-check-all-checkbox.d.ts.map +1 -0
- package/build/table/worker-plugins-check-all-checkbox.js +230 -121
- package/build/table/worker-plugins-check-all-checkbox.js.map +1 -0
- package/build/table/worker-plugins-checkbox.d.ts +3 -0
- package/build/table/worker-plugins-checkbox.d.ts.map +1 -0
- package/build/table/worker-plugins-checkbox.js +186 -112
- package/build/table/worker-plugins-checkbox.js.map +1 -0
- package/build/translated-attributes.d.ts +2 -0
- package/build/translated-attributes.d.ts.map +1 -0
- package/build/translated-attributes.js +13 -8
- package/build/translated-attributes.js.map +1 -0
- package/build/translated-collections.d.ts +4 -0
- package/build/translated-collections.d.ts.map +1 -0
- package/build/translated-collections.js +22 -12
- package/build/translated-collections.js.map +1 -0
- package/build/updated-attribute.d.ts +15 -0
- package/build/updated-attribute.d.ts.map +1 -0
- package/build/updated-attribute.js +144 -72
- package/build/updated-attribute.js.map +1 -0
- package/build/url-encode.d.ts +6 -0
- package/build/url-encode.d.ts.map +1 -0
- package/build/url-encode.js +22 -13
- package/build/url-encode.js.map +1 -0
- package/build/use-breakpoint.d.ts +3 -0
- package/build/use-breakpoint.d.ts.map +1 -0
- package/build/use-breakpoint.js +126 -75
- package/build/use-breakpoint.js.map +1 -0
- package/build/use-can-can.d.ts +8 -0
- package/build/use-can-can.d.ts.map +1 -0
- package/build/use-can-can.js +107 -52
- package/build/use-can-can.js.map +1 -0
- package/build/use-collection.d.ts +73 -0
- package/build/use-collection.d.ts.map +1 -0
- package/build/use-collection.js +366 -215
- package/build/use-collection.js.map +1 -0
- package/build/use-created-event.d.ts +19 -0
- package/build/use-created-event.d.ts.map +1 -0
- package/build/use-created-event.js +73 -50
- package/build/use-created-event.js.map +1 -0
- package/build/use-current-user-context.d.ts +12 -0
- package/build/use-current-user-context.d.ts.map +1 -0
- package/build/use-current-user-context.js +188 -0
- package/build/use-current-user-context.js.map +1 -0
- package/build/use-current-user.d.ts +14 -0
- package/build/use-current-user.d.ts.map +1 -0
- package/build/use-current-user.js +43 -119
- package/build/use-current-user.js.map +1 -0
- package/build/use-destroyed-event.d.ts +16 -0
- package/build/use-destroyed-event.d.ts.map +1 -0
- package/build/use-destroyed-event.js +78 -58
- package/build/use-destroyed-event.js.map +1 -0
- package/build/use-event-emitter.d.ts +9 -0
- package/build/use-event-emitter.d.ts.map +1 -0
- package/build/use-event-emitter.js +32 -25
- package/build/use-event-emitter.js.map +1 -0
- package/build/use-event-listener.d.ts +9 -0
- package/build/use-event-listener.d.ts.map +1 -0
- package/build/use-event-listener.js +36 -21
- package/build/use-event-listener.js.map +1 -0
- package/build/use-input.d.ts +31 -0
- package/build/use-input.d.ts.map +1 -0
- package/build/use-input.js +166 -134
- package/build/use-input.js.map +1 -0
- package/build/use-model-event.d.ts +17 -0
- package/build/use-model-event.d.ts.map +1 -0
- package/build/use-model-event.js +79 -58
- package/build/use-model-event.js.map +1 -0
- package/build/use-model.d.ts +30 -0
- package/build/use-model.d.ts.map +1 -0
- package/build/use-model.js +259 -159
- package/build/use-model.js.map +1 -0
- package/build/use-resize-observer.d.ts +8 -0
- package/build/use-resize-observer.d.ts.map +1 -0
- package/build/use-resize-observer.js +35 -22
- package/build/use-resize-observer.js.map +1 -0
- package/build/use-router.d.ts +8 -0
- package/build/use-router.d.ts.map +1 -0
- package/build/use-router.js +133 -100
- package/build/use-router.js.map +1 -0
- package/build/use-screen-layout.d.ts +3 -0
- package/build/use-screen-layout.d.ts.map +1 -0
- package/build/use-screen-layout.js +46 -37
- package/build/use-screen-layout.js.map +1 -0
- package/build/use-styles.d.ts +2 -0
- package/build/use-styles.d.ts.map +1 -0
- package/build/use-styles.js +99 -47
- package/build/use-styles.js.map +1 -0
- package/build/use-updated-event.d.ts +16 -0
- package/build/use-updated-event.d.ts.map +1 -0
- package/build/use-updated-event.js +79 -58
- package/build/use-updated-event.js.map +1 -0
- package/build/use-validation-errors.d.ts +7 -0
- package/build/use-validation-errors.d.ts.map +1 -0
- package/build/use-validation-errors.js +35 -29
- package/build/use-validation-errors.js.map +1 -0
- package/build/utils/button.d.ts +3 -0
- package/build/utils/button.d.ts.map +1 -0
- package/build/utils/button.js +143 -123
- package/build/utils/button.js.map +1 -0
- package/build/utils/card.d.ts +3 -0
- package/build/utils/card.d.ts.map +1 -0
- package/build/utils/card.js +107 -55
- package/build/utils/card.js.map +1 -0
- package/build/utils/checkbox.d.ts +3 -0
- package/build/utils/checkbox.d.ts.map +1 -0
- package/build/utils/checkbox.js +113 -77
- package/build/utils/checkbox.js.map +1 -0
- package/build/utils/checkboxes.d.ts +3 -0
- package/build/utils/checkboxes.d.ts.map +1 -0
- package/build/utils/checkboxes.js +184 -159
- package/build/utils/checkboxes.js.map +1 -0
- package/build/utils/default-style.d.ts +7 -0
- package/build/utils/default-style.d.ts.map +1 -0
- package/build/utils/default-style.js +129 -62
- package/build/utils/default-style.js.map +1 -0
- package/build/utils/header.d.ts +3 -0
- package/build/utils/header.d.ts.map +1 -0
- package/build/utils/header.js +37 -19
- package/build/utils/header.js.map +1 -0
- package/build/utils/icon.d.ts +3 -0
- package/build/utils/icon.d.ts.map +1 -0
- package/build/utils/icon.js +158 -96
- package/build/utils/icon.js.map +1 -0
- package/build/utils/invalid-feedback.d.ts +3 -0
- package/build/utils/invalid-feedback.d.ts.map +1 -0
- package/build/utils/invalid-feedback.js +43 -19
- package/build/utils/invalid-feedback.js.map +1 -0
- package/build/utils/modal.d.ts +3 -0
- package/build/utils/modal.d.ts.map +1 -0
- package/build/utils/modal.js +118 -61
- package/build/utils/modal.js.map +1 -0
- package/build/utils/text.d.ts +3 -0
- package/build/utils/text.d.ts.map +1 -0
- package/build/utils/text.js +37 -20
- package/build/utils/text.js.map +1 -0
- package/build/validation-error.d.ts +18 -0
- package/build/validation-error.d.ts.map +1 -0
- package/build/validation-error.js +94 -27
- package/build/validation-error.js.map +1 -0
- package/build/validation-errors.d.ts +58 -0
- package/build/validation-errors.d.ts.map +1 -0
- package/build/validation-errors.js +164 -94
- package/build/validation-errors.js.map +1 -0
- package/build/with-api-maker.d.ts +3 -0
- package/build/with-api-maker.d.ts.map +1 -0
- package/build/with-api-maker.js +73 -27
- package/build/with-api-maker.js.map +1 -0
- package/build/with-collection.d.ts +3 -0
- package/build/with-collection.d.ts.map +1 -0
- package/build/with-collection.js +64 -13
- package/build/with-collection.js.map +1 -0
- package/build/with-current-user.d.ts +3 -0
- package/build/with-current-user.d.ts.map +1 -0
- package/build/with-current-user.js +23 -9
- package/build/with-current-user.js.map +1 -0
- package/build/with-model.d.ts +3 -0
- package/build/with-model.d.ts.map +1 -0
- package/build/with-model.js +28 -14
- package/build/with-model.js.map +1 -0
- package/build/with-router.d.ts +3 -0
- package/build/with-router.d.ts.map +1 -0
- package/build/with-router.js +35 -21
- package/build/with-router.js.map +1 -0
- package/package.json +14 -8
- package/.eslintrc.js +0 -357
- package/android/build.gradle +0 -43
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/expo/modules/api_maker/ApiMakerModule.kt +0 -50
- package/android/src/main/java/expo/modules/api_maker/ApiMakerView.kt +0 -30
- package/expo-module.config.json +0 -17
- package/ios/ApiMaker.podspec +0 -29
- package/ios/ApiMakerModule.swift +0 -48
- package/ios/ApiMakerView.swift +0 -38
- package/src/api.js +0 -109
- package/src/attribute-not-loaded-error.js +0 -1
- package/src/base-component.jsx +0 -5
- package/src/base-error.js +0 -38
- package/src/base-model/attribute.js +0 -33
- package/src/base-model/column.js +0 -13
- package/src/base-model/reflection.js +0 -15
- package/src/base-model/scope.js +0 -12
- package/src/base-model.js +0 -1001
- package/src/bootstrap/attribute-row.jsx +0 -135
- package/src/bootstrap/attribute-rows.jsx +0 -27
- package/src/bootstrap/card.jsx +0 -149
- package/src/bootstrap/checkbox.jsx +0 -86
- package/src/bootstrap/checkboxes.jsx +0 -185
- package/src/bootstrap/index.js +0 -0
- package/src/bootstrap/input.jsx +0 -173
- package/src/bootstrap/invalid-feedback.jsx +0 -31
- package/src/bootstrap/paginate.jsx +0 -187
- package/src/bootstrap/radio-buttons.jsx +0 -87
- package/src/bootstrap/select.jsx +0 -110
- package/src/bootstrap/sort-link.jsx +0 -106
- package/src/cable-connection-pool.js +0 -127
- package/src/cable-subscription-pool.js +0 -189
- package/src/cable-subscription.js +0 -23
- package/src/cache-key-generator.js +0 -100
- package/src/can-can.js +0 -158
- package/src/channels-consumer.js +0 -10
- package/src/collection-loader.jsx +0 -60
- package/src/collection.js +0 -346
- package/src/command-submit-data.js +0 -103
- package/src/commands-pool.js +0 -212
- package/src/compose.js +0 -11
- package/src/config.js +0 -71
- package/src/custom-error.js +0 -7
- package/src/data-set-to-attributes.js +0 -13
- package/src/deserializer.js +0 -60
- package/src/destroy-error.js +0 -7
- package/src/devise.js +0 -151
- package/src/draggable-sort/controller.js +0 -137
- package/src/draggable-sort/index.jsx +0 -107
- package/src/draggable-sort/item.jsx +0 -171
- package/src/error-logger.js +0 -111
- package/src/error-messages.js +0 -15
- package/src/event-connection.jsx +0 -37
- package/src/event-emitter-listener.jsx +0 -13
- package/src/event-model-class.jsx +0 -28
- package/src/events.js +0 -7
- package/src/form.jsx +0 -109
- package/src/history-expo.js +0 -23
- package/src/history-react-native.js +0 -25
- package/src/history.js +0 -3
- package/src/index.js +0 -3
- package/src/inputs/attachment.jsx +0 -108
- package/src/inputs/auto-submit.js +0 -37
- package/src/inputs/checkbox.jsx +0 -125
- package/src/inputs/checkboxes.jsx +0 -116
- package/src/inputs/id-for-component.js +0 -15
- package/src/inputs/input-wrapper.jsx +0 -16
- package/src/inputs/input.jsx +0 -260
- package/src/inputs/money.jsx +0 -179
- package/src/inputs/name-for-component.js +0 -15
- package/src/inputs/select.jsx +0 -104
- package/src/instance-of-class-name.js +0 -29
- package/src/is-expo.js +0 -18
- package/src/key-value-store.js +0 -68
- package/src/link.jsx +0 -77
- package/src/logger.js +0 -38
- package/src/merge-styles.js +0 -15
- package/src/modal.jsx +0 -37
- package/src/model-class-require.js +0 -17
- package/src/model-events.js +0 -39
- package/src/model-name.js +0 -33
- package/src/model-prop-type.js +0 -124
- package/src/model-recipes-loader.js +0 -28
- package/src/model-recipes-model-loader.js +0 -350
- package/src/models-response-reader.js +0 -48
- package/src/models.js +0 -7
- package/src/models.js.erb +0 -19
- package/src/money-formatter.js +0 -100
- package/src/not-loaded-error.js +0 -1
- package/src/params.js +0 -66
- package/src/preloaded.js +0 -43
- package/src/resize-observer.jsx +0 -10
- package/src/rest-props-validator.js +0 -9
- package/src/result.js +0 -13
- package/src/router/route.jsx +0 -246
- package/src/router/switch.jsx +0 -76
- package/src/router.jsx +0 -47
- package/src/routes-native.js +0 -173
- package/src/routes.js +0 -58
- package/src/run-last.js +0 -39
- package/src/serializer.js +0 -76
- package/src/services.js +0 -23
- package/src/session-status-updater.js +0 -172
- package/src/source-maps-loader.js +0 -203
- package/src/super-admin/config-reader.jsx +0 -93
- package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +0 -84
- package/src/super-admin/edit-page/edit-attribute-content.jsx +0 -57
- package/src/super-admin/edit-page/edit-attribute-input.jsx +0 -79
- package/src/super-admin/edit-page/edit-attribute.jsx +0 -84
- package/src/super-admin/edit-page.jsx +0 -117
- package/src/super-admin/has-edit-config.js +0 -15
- package/src/super-admin/index-page.jsx +0 -23
- package/src/super-admin/index.jsx +0 -219
- package/src/super-admin/layout/header/index.jsx +0 -144
- package/src/super-admin/layout/header/style.scss +0 -45
- package/src/super-admin/layout/index.jsx +0 -154
- package/src/super-admin/layout/menu/index.jsx +0 -173
- package/src/super-admin/layout/menu/menu-content.jsx +0 -43
- package/src/super-admin/layout/menu/menu-item.jsx +0 -70
- package/src/super-admin/layout/menu/style.scss +0 -11
- package/src/super-admin/layout/no-access.jsx +0 -26
- package/src/super-admin/model-class-table.jsx +0 -66
- package/src/super-admin/models.js +0 -11
- package/src/super-admin/show-nav.jsx +0 -45
- package/src/super-admin/show-page/belongs-to-attribute-row.jsx +0 -30
- package/src/super-admin/show-page/index.jsx +0 -141
- package/src/super-admin/show-reflection-actions.jsx +0 -51
- package/src/super-admin/show-reflection-link.jsx +0 -40
- package/src/super-admin/show-reflection-page.jsx +0 -49
- package/src/super-admin/stylesheets/variables.scss +0 -11
- package/src/table/column-content.jsx +0 -122
- package/src/table/column-identifier.js +0 -23
- package/src/table/column-visible.js +0 -7
- package/src/table/components/column.jsx +0 -19
- package/src/table/components/flat-list.jsx +0 -19
- package/src/table/components/header.jsx +0 -21
- package/src/table/components/row.jsx +0 -23
- package/src/table/filters/attribute-element.jsx +0 -47
- package/src/table/filters/filter-form.jsx +0 -448
- package/src/table/filters/filter.jsx +0 -74
- package/src/table/filters/index.jsx +0 -171
- package/src/table/filters/load-search-modal.jsx +0 -157
- package/src/table/filters/reflection-element.jsx +0 -38
- package/src/table/filters/save-search-modal.jsx +0 -74
- package/src/table/filters/scope-element.jsx +0 -44
- package/src/table/header-column-content.jsx +0 -55
- package/src/table/header-column.jsx +0 -129
- package/src/table/header-select.jsx +0 -78
- package/src/table/model-callback-args.js +0 -10
- package/src/table/model-column.jsx +0 -86
- package/src/table/model-row.jsx +0 -140
- package/src/table/select-calculator.js +0 -65
- package/src/table/settings/column-row.jsx +0 -93
- package/src/table/settings/download-action.jsx +0 -73
- package/src/table/settings/index.jsx +0 -66
- package/src/table/table-settings.js +0 -262
- package/src/table/table.jsx +0 -957
- package/src/table/use-sorting.js +0 -35
- package/src/table/variables.scss +0 -11
- package/src/table/widths.jsx +0 -87
- package/src/table/worker-plugins-check-all-checkbox.jsx +0 -112
- package/src/table/worker-plugins-checkbox.jsx +0 -104
- package/src/translated-attributes.js +0 -11
- package/src/translated-collections-data.js.erb +0 -5
- package/src/translated-collections.js +0 -13
- package/src/updated-attribute.jsx +0 -93
- package/src/url-encode.js +0 -18
- package/src/use-breakpoint.js +0 -100
- package/src/use-can-can.js +0 -55
- package/src/use-collection.js +0 -280
- package/src/use-created-event.js +0 -55
- package/src/use-current-user.js +0 -133
- package/src/use-destroyed-event.js +0 -60
- package/src/use-event-emitter.js +0 -25
- package/src/use-event-listener.js +0 -23
- package/src/use-input.js +0 -159
- package/src/use-model-event.js +0 -60
- package/src/use-model.js +0 -189
- package/src/use-resize-observer.js +0 -24
- package/src/use-router.jsx +0 -128
- package/src/use-screen-layout.js +0 -49
- package/src/use-styles.js +0 -66
- package/src/use-updated-event.js +0 -60
- package/src/use-validation-errors.js +0 -33
- package/src/utils/button.jsx +0 -127
- package/src/utils/card.jsx +0 -58
- package/src/utils/checkbox.jsx +0 -73
- package/src/utils/checkboxes.jsx +0 -157
- package/src/utils/default-style.jsx +0 -80
- package/src/utils/header.jsx +0 -14
- package/src/utils/icon.jsx +0 -81
- package/src/utils/invalid-feedback.jsx +0 -20
- package/src/utils/modal.jsx +0 -64
- package/src/utils/text.jsx +0 -15
- package/src/validation-error.js +0 -35
- package/src/validation-errors.js +0 -121
- package/src/with-api-maker.jsx +0 -31
- package/src/with-collection.jsx +0 -17
- package/src/with-current-user.jsx +0 -10
- package/src/with-model.jsx +0 -16
- package/src/with-router.jsx +0 -11
package/src/base-model.js
DELETED
|
@@ -1,1001 +0,0 @@
|
|
|
1
|
-
import Attribute from "./base-model/attribute"
|
|
2
|
-
import AttributeNotLoadedError from "./attribute-not-loaded-error"
|
|
3
|
-
import CacheKeyGenerator from "./cache-key-generator"
|
|
4
|
-
import Collection from "./collection"
|
|
5
|
-
import CommandsPool from "./commands-pool"
|
|
6
|
-
import Config from "./config"
|
|
7
|
-
import CustomError from "./custom-error"
|
|
8
|
-
import {digg} from "diggerize"
|
|
9
|
-
import FormDataObjectizer from "form-data-objectizer"
|
|
10
|
-
import * as inflection from "inflection"
|
|
11
|
-
import ModelName from "./model-name"
|
|
12
|
-
import NotLoadedError from "./not-loaded-error"
|
|
13
|
-
import objectToFormData from "object-to-formdata"
|
|
14
|
-
import Reflection from "./base-model/reflection"
|
|
15
|
-
import Scope from "./base-model/scope"
|
|
16
|
-
import Services from "./services"
|
|
17
|
-
import ValidationError from "./validation-error"
|
|
18
|
-
import {ValidationErrors} from "./validation-errors"
|
|
19
|
-
|
|
20
|
-
const objectToUnderscore = (object) => {
|
|
21
|
-
const newObject = {}
|
|
22
|
-
|
|
23
|
-
for (const key in object) {
|
|
24
|
-
const underscoreKey = inflection.underscore(key)
|
|
25
|
-
|
|
26
|
-
newObject[underscoreKey] = object[key]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return newObject
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default class BaseModel {
|
|
33
|
-
static apiMakerType = "BaseModel"
|
|
34
|
-
|
|
35
|
-
static attributes() {
|
|
36
|
-
const attributes = digg(this.modelClassData(), "attributes")
|
|
37
|
-
const result = []
|
|
38
|
-
|
|
39
|
-
for (const attributeKey in attributes) {
|
|
40
|
-
const attributeData = attributes[attributeKey]
|
|
41
|
-
const attribute = new Attribute(attributeData)
|
|
42
|
-
|
|
43
|
-
result.push(attribute)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return result
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static hasAttribute(attributeName) {
|
|
50
|
-
const attributes = digg(this.modelClassData(), "attributes")
|
|
51
|
-
const lowerCaseAttributeName = inflection.underscore(attributeName)
|
|
52
|
-
|
|
53
|
-
if (lowerCaseAttributeName in attributes) return true
|
|
54
|
-
|
|
55
|
-
return false
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static modelClassData() {
|
|
59
|
-
throw new Error("modelClassData should be overriden by child")
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static newCustomEvent = (validationErrors) => {
|
|
63
|
-
return new CustomEvent("validation-errors", {detail: validationErrors})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
static sendValidationErrorsEvent = (validationErrors, options) => {
|
|
67
|
-
if (options && options.form) {
|
|
68
|
-
const event = BaseModel.newCustomEvent(validationErrors)
|
|
69
|
-
options.form.dispatchEvent(event)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
static async find(id) {
|
|
74
|
-
const query = {}
|
|
75
|
-
|
|
76
|
-
query[`${this.primaryKey()}_eq`] = id
|
|
77
|
-
|
|
78
|
-
const model = await this.ransack(query).first()
|
|
79
|
-
|
|
80
|
-
if (model) {
|
|
81
|
-
return model
|
|
82
|
-
} else {
|
|
83
|
-
throw new CustomError("Record not found")
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
static async findOrCreateBy(findOrCreateByArgs, args = {}) {
|
|
88
|
-
const result = await Services.current().sendRequest("Models::FindOrCreateBy", {
|
|
89
|
-
additional_data: args.additionalData,
|
|
90
|
-
find_or_create_by_args: findOrCreateByArgs,
|
|
91
|
-
resource_name: digg(this.modelClassData(), "name")
|
|
92
|
-
})
|
|
93
|
-
const model = digg(result, "model")
|
|
94
|
-
|
|
95
|
-
return model
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
static modelName() {
|
|
99
|
-
return new ModelName({modelClassData: this.modelClassData()})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
static primaryKey() {
|
|
103
|
-
return digg(this.modelClassData(), "primaryKey")
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
static ransack(query = {}) {
|
|
107
|
-
return new Collection({modelClass: this}, {ransack: query})
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
static select(select) {
|
|
111
|
-
return this.ransack().select(select)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static ransackableAssociations() {
|
|
115
|
-
const relationships = digg(this.modelClassData(), "ransackable_associations")
|
|
116
|
-
const reflections = []
|
|
117
|
-
|
|
118
|
-
for (const relationshipData of relationships) {
|
|
119
|
-
reflections.push(new Reflection(relationshipData))
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return reflections
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
static ransackableAttributes() {
|
|
126
|
-
const attributes = digg(this.modelClassData(), "ransackable_attributes")
|
|
127
|
-
const result = []
|
|
128
|
-
|
|
129
|
-
for (const attributeData of attributes) {
|
|
130
|
-
result.push(new Attribute(attributeData))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return result
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
static ransackableScopes() {
|
|
137
|
-
const ransackableScopes = digg(this.modelClassData(), "ransackable_scopes")
|
|
138
|
-
const result = []
|
|
139
|
-
|
|
140
|
-
for (const scopeData of ransackableScopes) {
|
|
141
|
-
const scope = new Scope(scopeData)
|
|
142
|
-
|
|
143
|
-
result.push(scope)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return result
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
static reflections() {
|
|
150
|
-
const relationships = digg(this.modelClassData(), "relationships")
|
|
151
|
-
const reflections = []
|
|
152
|
-
|
|
153
|
-
for (const relationshipData of relationships) {
|
|
154
|
-
const reflection = new Reflection(relationshipData)
|
|
155
|
-
|
|
156
|
-
reflections.push(reflection)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return reflections
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
static reflection(name) {
|
|
163
|
-
const foundReflection = this.reflections().find((reflection) => reflection.name() == name)
|
|
164
|
-
|
|
165
|
-
if (!foundReflection) {
|
|
166
|
-
throw new Error(`No such reflection: ${name} in ${this.reflections().map((reflection) => reflection.name()).join(", ")}`)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return foundReflection
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
static _token() {
|
|
173
|
-
const csrfTokenElement = document.querySelector("meta[name='csrf-token']")
|
|
174
|
-
|
|
175
|
-
if (csrfTokenElement) {
|
|
176
|
-
return csrfTokenElement.getAttribute("content")
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
constructor(args = {}) {
|
|
181
|
-
this.changes = {}
|
|
182
|
-
this.newRecord = args.isNewRecord
|
|
183
|
-
this.relationshipsCache = {}
|
|
184
|
-
this.relationships = {}
|
|
185
|
-
|
|
186
|
-
if (args && args.data && args.data.a) {
|
|
187
|
-
this._readModelDataFromArgs(args)
|
|
188
|
-
} else if (args.a) {
|
|
189
|
-
this.abilities = args.b || {}
|
|
190
|
-
this.modelData = objectToUnderscore(args.a)
|
|
191
|
-
} else if (args) {
|
|
192
|
-
this.abilities = {}
|
|
193
|
-
this.modelData = objectToUnderscore(args)
|
|
194
|
-
} else {
|
|
195
|
-
this.abilities = {}
|
|
196
|
-
this.modelData = {}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
assignAttributes(newAttributes) {
|
|
201
|
-
for (const key in newAttributes) {
|
|
202
|
-
const newValue = newAttributes[key]
|
|
203
|
-
const attributeUnderscore = inflection.underscore(key)
|
|
204
|
-
|
|
205
|
-
let applyChange = true
|
|
206
|
-
let deleteChange = false
|
|
207
|
-
|
|
208
|
-
if (this.isAttributeLoaded(key)) {
|
|
209
|
-
const oldValue = this.readAttribute(key)
|
|
210
|
-
const originalValue = this.modelData[attributeUnderscore]
|
|
211
|
-
|
|
212
|
-
if (newValue == oldValue) {
|
|
213
|
-
applyChange = false
|
|
214
|
-
} else if (newValue == originalValue) {
|
|
215
|
-
applyChange = false
|
|
216
|
-
deleteChange = true
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (applyChange) {
|
|
221
|
-
this.changes[attributeUnderscore] = newValue
|
|
222
|
-
} else if (deleteChange) {
|
|
223
|
-
delete this.changes[attributeUnderscore]
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
attributes() {
|
|
229
|
-
const result = {}
|
|
230
|
-
|
|
231
|
-
for (const key in this.modelData) {
|
|
232
|
-
result[key] = this.modelData[key]
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
for (const key in this.changes) {
|
|
236
|
-
result[key] = this.changes[key]
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return result
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
can(givenAbilityName) {
|
|
243
|
-
const abilityName = inflection.underscore(givenAbilityName)
|
|
244
|
-
|
|
245
|
-
if (!(abilityName in this.abilities)) {
|
|
246
|
-
throw new Error(`Ability ${abilityName} hasn't been loaded for ${digg(this.modelClassData(), "name")}`)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return this.abilities[abilityName]
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
clone() {
|
|
253
|
-
const clone = new this.constructor()
|
|
254
|
-
|
|
255
|
-
clone.abilities = {...this.abilities}
|
|
256
|
-
clone.modelData = {...this.modelData}
|
|
257
|
-
clone.relationships = {...this.relationships}
|
|
258
|
-
clone.relationshipsCache = {...this.relationshipsCache}
|
|
259
|
-
|
|
260
|
-
return clone
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
cacheKey() {
|
|
264
|
-
if (this.isPersisted()) {
|
|
265
|
-
const keyParts = [
|
|
266
|
-
this.modelClassData().paramKey,
|
|
267
|
-
this.primaryKey()
|
|
268
|
-
]
|
|
269
|
-
|
|
270
|
-
if ("updated_at" in this.modelData) {
|
|
271
|
-
const updatedAt = this.updatedAt()
|
|
272
|
-
|
|
273
|
-
if (typeof updatedAt != "object") {
|
|
274
|
-
throw new Error(`updatedAt wasn't an object: ${typeof updatedAt}`)
|
|
275
|
-
} else if (!("getTime" in updatedAt)) {
|
|
276
|
-
throw new Error(`updatedAt didn't support getTime with class: ${updatedAt.constructor && updatedAt.constructor.name}`)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
keyParts.push(`updatedAt-${this.updatedAt().getTime()}`)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return keyParts.join("-")
|
|
283
|
-
} else {
|
|
284
|
-
return this.uniqueKey()
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
localCacheKey() {
|
|
289
|
-
const cacheKeyGenerator = new CacheKeyGenerator(this)
|
|
290
|
-
|
|
291
|
-
return cacheKeyGenerator.local()
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
fullCacheKey() {
|
|
295
|
-
const cacheKeyGenerator = new CacheKeyGenerator(this)
|
|
296
|
-
|
|
297
|
-
return cacheKeyGenerator.cacheKey()
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
static all() {
|
|
301
|
-
return this.ransack()
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
async create(attributes, options) {
|
|
305
|
-
if (attributes) this.assignAttributes(attributes)
|
|
306
|
-
const paramKey = this.modelClassData().paramKey
|
|
307
|
-
const modelData = this.getAttributes()
|
|
308
|
-
const dataToUse = {}
|
|
309
|
-
dataToUse[paramKey] = modelData
|
|
310
|
-
let response
|
|
311
|
-
|
|
312
|
-
try {
|
|
313
|
-
response = await CommandsPool.addCommand(
|
|
314
|
-
{
|
|
315
|
-
args: {
|
|
316
|
-
save: dataToUse
|
|
317
|
-
},
|
|
318
|
-
command: `${this.modelClassData().collectionName}-create`,
|
|
319
|
-
collectionName: this.modelClassData().collectionName,
|
|
320
|
-
primaryKey: this.primaryKey(),
|
|
321
|
-
type: "create"
|
|
322
|
-
},
|
|
323
|
-
{}
|
|
324
|
-
)
|
|
325
|
-
} catch (error) {
|
|
326
|
-
BaseModel.parseValidationErrors({error, model: this, options})
|
|
327
|
-
throw error
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (response.model) {
|
|
331
|
-
this._refreshModelFromResponse(response)
|
|
332
|
-
this.changes = {}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return {model: this, response}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
async createRaw(rawData, options = {}) {
|
|
339
|
-
const objectData = BaseModel._objectDataFromGivenRawData(rawData, options)
|
|
340
|
-
|
|
341
|
-
let response
|
|
342
|
-
|
|
343
|
-
try {
|
|
344
|
-
response = await CommandsPool.addCommand(
|
|
345
|
-
{
|
|
346
|
-
args: {
|
|
347
|
-
save: objectData
|
|
348
|
-
},
|
|
349
|
-
command: `${this.modelClassData().collectionName}-create`,
|
|
350
|
-
collectionName: this.modelClassData().collectionName,
|
|
351
|
-
primaryKey: this.primaryKey(),
|
|
352
|
-
type: "create"
|
|
353
|
-
},
|
|
354
|
-
{}
|
|
355
|
-
)
|
|
356
|
-
} catch (error) {
|
|
357
|
-
BaseModel.parseValidationErrors({error, model: this, options})
|
|
358
|
-
throw error
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (response.model) {
|
|
362
|
-
this._refreshModelDataFromResponse(response)
|
|
363
|
-
this.changes = {}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return {model: this, response}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
async destroy() {
|
|
370
|
-
const response = await CommandsPool.addCommand(
|
|
371
|
-
{
|
|
372
|
-
args: {query_params: this.collection && this.collection.params()},
|
|
373
|
-
command: `${this.modelClassData().collectionName}-destroy`,
|
|
374
|
-
collectionName: this.modelClassData().collectionName,
|
|
375
|
-
primaryKey: this.primaryKey(),
|
|
376
|
-
type: "destroy"
|
|
377
|
-
},
|
|
378
|
-
{}
|
|
379
|
-
)
|
|
380
|
-
|
|
381
|
-
if (response.success) {
|
|
382
|
-
if (response.model) {
|
|
383
|
-
this._refreshModelDataFromResponse(response)
|
|
384
|
-
this.changes = {}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
return {model: this, response}
|
|
388
|
-
} else {
|
|
389
|
-
this.handleResponseError(response)
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
async ensureAbilities(listOfAbilities) {
|
|
394
|
-
// Populate an array with a list of abilities currently not loaded
|
|
395
|
-
const abilitiesToLoad = []
|
|
396
|
-
|
|
397
|
-
for (const abilityInList of listOfAbilities) {
|
|
398
|
-
if (!(abilityInList in this.abilities)) {
|
|
399
|
-
abilitiesToLoad.push(abilityInList)
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// Load the missing abilities if any
|
|
404
|
-
if (abilitiesToLoad.length > 0) {
|
|
405
|
-
const primaryKeyName = this.constructor.primaryKey()
|
|
406
|
-
const ransackParams = {}
|
|
407
|
-
ransackParams[`${primaryKeyName}_eq`] = this.primaryKey()
|
|
408
|
-
|
|
409
|
-
const abilitiesParams = {}
|
|
410
|
-
abilitiesParams[digg(this.modelClassData(), "name")] = abilitiesToLoad
|
|
411
|
-
|
|
412
|
-
const anotherModel = await this.constructor
|
|
413
|
-
.ransack(ransackParams)
|
|
414
|
-
.abilities(abilitiesParams)
|
|
415
|
-
.first()
|
|
416
|
-
|
|
417
|
-
if (!anotherModel) {
|
|
418
|
-
throw new Error(`Could not look up the same model ${this.primaryKey()} with abilities: ${abilitiesToLoad.join(", ")}`)
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
const newAbilities = anotherModel.abilities
|
|
422
|
-
for (const newAbility in newAbilities) {
|
|
423
|
-
this.abilities[newAbility] = newAbilities[newAbility]
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
getAttributes = () => Object.assign(this.modelData, this.changes)
|
|
429
|
-
|
|
430
|
-
handleResponseError(response) {
|
|
431
|
-
BaseModel.parseValidationErrors({model: this, response})
|
|
432
|
-
throw new new CustomError("Response wasn't successful", {model: this, response})
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
identifierKey() {
|
|
436
|
-
if (!this._identifierKey) this._identifierKey = this.isPersisted() ? this.primaryKey() : this.uniqueKey()
|
|
437
|
-
|
|
438
|
-
return this._identifierKey
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
isAssociationLoaded = (associationName) => this.isAssociationLoadedUnderscore(inflection.underscore(associationName))
|
|
442
|
-
isAssociationLoadedUnderscore (associationNameUnderscore) {
|
|
443
|
-
if (associationNameUnderscore in this.relationshipsCache) return true
|
|
444
|
-
return false
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
isAssociationPresent(associationName) {
|
|
448
|
-
if (this.isAssociationLoaded(associationName)) return true
|
|
449
|
-
if (associationName in this.relationships) return true
|
|
450
|
-
return false
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
static parseValidationErrors({error, model, options}) {
|
|
454
|
-
if (!(error instanceof ValidationError)) return
|
|
455
|
-
if (!error.args.response.validation_errors) return
|
|
456
|
-
|
|
457
|
-
const validationErrors = new ValidationErrors({
|
|
458
|
-
model,
|
|
459
|
-
validationErrors: digg(error, "args", "response", "validation_errors")
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
BaseModel.sendValidationErrorsEvent(validationErrors, options)
|
|
463
|
-
|
|
464
|
-
if (!options || options.throwValidationError != false) {
|
|
465
|
-
throw error
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
static humanAttributeName(attributeName) {
|
|
470
|
-
const keyName = digg(this.modelClassData(), "i18nKey")
|
|
471
|
-
const i18n = Config.getI18n()
|
|
472
|
-
|
|
473
|
-
if (i18n) return i18n.t(`activerecord.attributes.${keyName}.${BaseModel.snakeCase(attributeName)}`, {defaultValue: attributeName})
|
|
474
|
-
|
|
475
|
-
return inflection.humanize(attributeName)
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
isAttributeChanged(attributeName) {
|
|
479
|
-
const attributeNameUnderscore = inflection.underscore(attributeName)
|
|
480
|
-
const attributeData = this.modelClassData().attributes.find((attribute) => digg(attribute, "name") == attributeNameUnderscore)
|
|
481
|
-
|
|
482
|
-
if (!attributeData) {
|
|
483
|
-
const attributeNames = this.modelClassData().attributes.map((attribute) => digg(attribute, "name"))
|
|
484
|
-
|
|
485
|
-
throw new Error(`Couldn't find an attribute by that name: "${attributeName}" in: ${attributeNames.join(", ")}`)
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (!(attributeNameUnderscore in this.changes))
|
|
489
|
-
return false
|
|
490
|
-
|
|
491
|
-
const oldValue = this.modelData[attributeNameUnderscore]
|
|
492
|
-
const newValue = this.changes[attributeNameUnderscore]
|
|
493
|
-
const changedMethod = this[`_is${inflection.camelize(attributeData.type, true)}Changed`]
|
|
494
|
-
|
|
495
|
-
if (!changedMethod)
|
|
496
|
-
throw new Error(`Don't know how to handle type: ${attributeData.type}`)
|
|
497
|
-
|
|
498
|
-
return changedMethod(oldValue, newValue)
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
isChanged() {
|
|
502
|
-
const keys = Object.keys(this.changes)
|
|
503
|
-
|
|
504
|
-
if (keys.length > 0) {
|
|
505
|
-
return true
|
|
506
|
-
} else {
|
|
507
|
-
return false
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
isNewRecord() {
|
|
512
|
-
if (this.newRecord !== undefined) {
|
|
513
|
-
return this.newRecord
|
|
514
|
-
} else if ("id" in this.modelData && this.modelData.id) {
|
|
515
|
-
return false
|
|
516
|
-
} else {
|
|
517
|
-
return true
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
isPersisted = () => !this.isNewRecord()
|
|
522
|
-
|
|
523
|
-
static snakeCase = (string) => inflection.underscore(string)
|
|
524
|
-
|
|
525
|
-
savedChangeToAttribute(attributeName) {
|
|
526
|
-
if (!this.previousModelData)
|
|
527
|
-
return false
|
|
528
|
-
|
|
529
|
-
const attributeNameUnderscore = inflection.underscore(attributeName)
|
|
530
|
-
const attributeData = this.modelClassData().attributes.find((attribute) => attribute.name == attributeNameUnderscore)
|
|
531
|
-
|
|
532
|
-
if (!attributeData) {
|
|
533
|
-
const attributeNames = this.modelClassData().attributes.map((attribute) => attribute.name)
|
|
534
|
-
throw new Error(`Couldn't find an attribute by that name: "${attributeName}" in: ${attributeNames.join(", ")}`)
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (!(attributeNameUnderscore in this.previousModelData))
|
|
538
|
-
return true
|
|
539
|
-
|
|
540
|
-
const oldValue = this.previousModelData[attributeNameUnderscore]
|
|
541
|
-
const newValue = this.modelData[attributeNameUnderscore]
|
|
542
|
-
const changedMethodName = `_is${inflection.camelize(attributeData.type)}Changed`
|
|
543
|
-
const changedMethod = this[changedMethodName]
|
|
544
|
-
|
|
545
|
-
if (!changedMethod)
|
|
546
|
-
throw new Error(`Don't know how to handle type: ${attributeData.type}`)
|
|
547
|
-
|
|
548
|
-
return changedMethod(oldValue, newValue)
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
setNewModel(model) {
|
|
552
|
-
this.setNewModelData(model)
|
|
553
|
-
|
|
554
|
-
for(const relationshipName in model.relationships) {
|
|
555
|
-
this.relationships[relationshipName] = model.relationships[relationshipName]
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
for(const relationshipCacheName in model.relationshipsCache) {
|
|
559
|
-
this.relationshipsCache[relationshipCacheName] = model.relationshipsCache[name]
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
setNewModelData(model) {
|
|
564
|
-
if (!("modelData" in model)) throw new Error(`No modelData in model: ${JSON.stringify(model)}`)
|
|
565
|
-
|
|
566
|
-
this.previousModelData = Object.assign({}, digg(this, "modelData"))
|
|
567
|
-
|
|
568
|
-
for(const attributeName in model.modelData) {
|
|
569
|
-
this.modelData[attributeName] = model.modelData[attributeName]
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
_isDateChanged(oldValue, newValue) {
|
|
574
|
-
if (Date.parse(oldValue) != Date.parse(newValue))
|
|
575
|
-
return true
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
_isIntegerChanged(oldValue, newValue) {
|
|
579
|
-
if (parseInt(oldValue, 10) != parseInt(newValue, 10))
|
|
580
|
-
return true
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
_isStringChanged (oldValue, newValue) {
|
|
584
|
-
const oldConvertedValue = `${oldValue}`
|
|
585
|
-
const newConvertedValue = `${newValue}`
|
|
586
|
-
|
|
587
|
-
if (oldConvertedValue != newConvertedValue)
|
|
588
|
-
return true
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
modelClassData = () => this.constructor.modelClassData()
|
|
592
|
-
|
|
593
|
-
async reload() {
|
|
594
|
-
const params = this.collection && this.collection.params()
|
|
595
|
-
const ransackParams = {}
|
|
596
|
-
ransackParams[`${this.constructor.primaryKey()}_eq`] = this.primaryKey()
|
|
597
|
-
|
|
598
|
-
let query = this.constructor.ransack(ransackParams)
|
|
599
|
-
|
|
600
|
-
if (params) {
|
|
601
|
-
if (params.preload) {
|
|
602
|
-
query.queryArgs.preload = params.preload
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
if (params.select) {
|
|
606
|
-
query.queryArgs.select = params.select
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
if (params.select_columns) {
|
|
610
|
-
query.queryArgs.selectColumns = params.select_columns
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
const model = await query.first()
|
|
615
|
-
this.setNewModel(model)
|
|
616
|
-
this.changes = {}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
save() {
|
|
620
|
-
if (this.isNewRecord()) {
|
|
621
|
-
return this.create()
|
|
622
|
-
} else {
|
|
623
|
-
return this.update()
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
saveRaw(rawData, options = {}) {
|
|
628
|
-
if (this.isNewRecord()) {
|
|
629
|
-
return this.createRaw(rawData, options)
|
|
630
|
-
} else {
|
|
631
|
-
return this.updateRaw(rawData, options)
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
async update(newAttributes, options) {
|
|
636
|
-
if (newAttributes) {
|
|
637
|
-
this.assignAttributes(newAttributes)
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
if (Object.keys(this.changes).length == 0) {
|
|
641
|
-
return {model: this}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
const paramKey = this.modelClassData().paramKey
|
|
645
|
-
const modelData = this.changes
|
|
646
|
-
const dataToUse = {}
|
|
647
|
-
dataToUse[paramKey] = modelData
|
|
648
|
-
let response
|
|
649
|
-
|
|
650
|
-
try {
|
|
651
|
-
response = await CommandsPool.addCommand(
|
|
652
|
-
{
|
|
653
|
-
args: {
|
|
654
|
-
query_params: this.collection && this.collection.params(),
|
|
655
|
-
save: dataToUse
|
|
656
|
-
},
|
|
657
|
-
command: `${this.modelClassData().collectionName}-update`,
|
|
658
|
-
collectionName: this.modelClassData().collectionName,
|
|
659
|
-
primaryKey: this.primaryKey(),
|
|
660
|
-
type: "update"
|
|
661
|
-
},
|
|
662
|
-
{}
|
|
663
|
-
)
|
|
664
|
-
} catch (error) {
|
|
665
|
-
BaseModel.parseValidationErrors({error, model: this, options})
|
|
666
|
-
throw error
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
if (response.success) {
|
|
670
|
-
if (response.model) {
|
|
671
|
-
this._refreshModelFromResponse(response)
|
|
672
|
-
this.changes = {}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
return {response, model: this}
|
|
676
|
-
} else {
|
|
677
|
-
this.handleResponseError(response)
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
_refreshModelFromResponse(response) {
|
|
682
|
-
let newModel = digg(response, "model")
|
|
683
|
-
|
|
684
|
-
if (Array.isArray(newModel)) newModel = newModel[0]
|
|
685
|
-
|
|
686
|
-
this.setNewModel(newModel)
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
_refreshModelDataFromResponse(response) {
|
|
690
|
-
let newModel = digg(response, "model")
|
|
691
|
-
|
|
692
|
-
if (Array.isArray(newModel)) newModel = newModel[0]
|
|
693
|
-
|
|
694
|
-
this.setNewModelData(newModel)
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
static _objectDataFromGivenRawData(rawData, options) {
|
|
698
|
-
if (rawData instanceof FormData || rawData.nodeName == "FORM") {
|
|
699
|
-
const formData = FormDataObjectizer.formDataFromObject(rawData, options)
|
|
700
|
-
|
|
701
|
-
return FormDataObjectizer.toObject(formData)
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
return rawData
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
async updateRaw(rawData, options = {}) {
|
|
708
|
-
const objectData = BaseModel._objectDataFromGivenRawData(rawData, options)
|
|
709
|
-
let response
|
|
710
|
-
|
|
711
|
-
try {
|
|
712
|
-
response = await CommandsPool.addCommand(
|
|
713
|
-
{
|
|
714
|
-
args: {
|
|
715
|
-
query_params: this.collection && this.collection.params(),
|
|
716
|
-
save: objectData,
|
|
717
|
-
simple_model_errors: options?.simpleModelErrors
|
|
718
|
-
},
|
|
719
|
-
command: `${this.modelClassData().collectionName}-update`,
|
|
720
|
-
collectionName: this.modelClassData().collectionName,
|
|
721
|
-
primaryKey: this.primaryKey(),
|
|
722
|
-
type: "update"
|
|
723
|
-
},
|
|
724
|
-
{}
|
|
725
|
-
)
|
|
726
|
-
} catch (error) {
|
|
727
|
-
BaseModel.parseValidationErrors({error, model: this, options})
|
|
728
|
-
throw error
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
if (response.model) {
|
|
732
|
-
this._refreshModelFromResponse(response)
|
|
733
|
-
this.changes = {}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
return {response, model: this}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
isValid() {
|
|
740
|
-
throw new Error("Not implemented yet")
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
async isValidOnServer() {
|
|
744
|
-
const modelData = this.getAttributes()
|
|
745
|
-
const paramKey = this.modelClassData().paramKey
|
|
746
|
-
const dataToUse = {}
|
|
747
|
-
dataToUse[paramKey] = modelData
|
|
748
|
-
|
|
749
|
-
const response = await CommandsPool.addCommand(
|
|
750
|
-
{
|
|
751
|
-
args: {
|
|
752
|
-
save: dataToUse
|
|
753
|
-
},
|
|
754
|
-
command: `${this.modelClassData().collectionName}-valid`,
|
|
755
|
-
collectionName: this.modelClassData().collectionName,
|
|
756
|
-
primaryKey: this.primaryKey(),
|
|
757
|
-
type: "valid"
|
|
758
|
-
},
|
|
759
|
-
{}
|
|
760
|
-
)
|
|
761
|
-
|
|
762
|
-
return {valid: response.valid, errors: response.errors}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
modelClass = () => this.constructor
|
|
766
|
-
|
|
767
|
-
preloadRelationship(relationshipName, model) {
|
|
768
|
-
this.relationshipsCache[BaseModel.snakeCase(relationshipName)] = model
|
|
769
|
-
this.relationships[BaseModel.snakeCase(relationshipName)] = model
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
markForDestruction() {
|
|
773
|
-
this._markedForDestruction = true
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
markedForDestruction = () => this._markedForDestruction
|
|
777
|
-
|
|
778
|
-
uniqueKey() {
|
|
779
|
-
if (!this.uniqueKeyValue) {
|
|
780
|
-
const min = 5000000000000000
|
|
781
|
-
const max = 9007199254740991
|
|
782
|
-
const randomBetween = Math.floor(Math.random() * (max - min + 1) + min)
|
|
783
|
-
this.uniqueKeyValue = randomBetween
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
return this.uniqueKeyValue
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
static async _callCollectionCommand(args, commandArgs) {
|
|
790
|
-
const formOrDataObject = args.args
|
|
791
|
-
|
|
792
|
-
try {
|
|
793
|
-
return await CommandsPool.addCommand(args, commandArgs)
|
|
794
|
-
} catch (error) {
|
|
795
|
-
let form
|
|
796
|
-
|
|
797
|
-
if (commandArgs.form) {
|
|
798
|
-
form = commandArgs.form
|
|
799
|
-
} else if (formOrDataObject?.nodeName == "FORM") {
|
|
800
|
-
form = formOrDataObject
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if (form) BaseModel.parseValidationErrors({error, options: {form}})
|
|
804
|
-
|
|
805
|
-
throw error
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
_callMemberCommand = (args, commandArgs) => CommandsPool.addCommand(args, commandArgs)
|
|
810
|
-
|
|
811
|
-
static _postDataFromArgs(args) {
|
|
812
|
-
let postData
|
|
813
|
-
|
|
814
|
-
if (args) {
|
|
815
|
-
if (args instanceof FormData) {
|
|
816
|
-
postData = args
|
|
817
|
-
} else {
|
|
818
|
-
postData = objectToFormData.serialize(args, {}, null, "args")
|
|
819
|
-
}
|
|
820
|
-
} else {
|
|
821
|
-
postData = new FormData()
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
return postData
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
readAttribute(attributeName) {
|
|
828
|
-
const attributeNameUnderscore = inflection.underscore(attributeName)
|
|
829
|
-
|
|
830
|
-
return this.readAttributeUnderscore(attributeNameUnderscore)
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
readAttributeUnderscore(attributeName) {
|
|
834
|
-
if (attributeName in this.changes) {
|
|
835
|
-
return this.changes[attributeName]
|
|
836
|
-
} else if (attributeName in this.modelData) {
|
|
837
|
-
return this.modelData[attributeName]
|
|
838
|
-
} else if (this.isNewRecord()) {
|
|
839
|
-
// Return null if this is a new record and the attribute name is a recognized attribute
|
|
840
|
-
const attributes = digg(this.modelClassData(), "attributes")
|
|
841
|
-
|
|
842
|
-
if (attributeName in attributes) return null
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
if (this.isPersisted()) {
|
|
846
|
-
throw new AttributeNotLoadedError(`No such attribute: ${digg(this.modelClassData(), "name")}#${attributeName}: ${JSON.stringify(this.modelData)}`)
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
isAttributeLoaded(attributeName) {
|
|
851
|
-
const attributeNameUnderscore = inflection.underscore(attributeName)
|
|
852
|
-
|
|
853
|
-
if (attributeNameUnderscore in this.changes) return true
|
|
854
|
-
if (attributeNameUnderscore in this.modelData) return true
|
|
855
|
-
return false
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
_isPresent(value) {
|
|
859
|
-
if (!value) {
|
|
860
|
-
return false
|
|
861
|
-
} else if (typeof value == "string" && value.match(/^\s*$/)) {
|
|
862
|
-
return false
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
return true
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
async _loadBelongsToReflection(args, queryArgs = {}) {
|
|
869
|
-
if (args.reflectionName in this.relationships) {
|
|
870
|
-
return this.relationships[args.reflectionName]
|
|
871
|
-
} else if (args.reflectionName in this.relationshipsCache) {
|
|
872
|
-
return this.relationshipsCache[args.reflectionName]
|
|
873
|
-
} else {
|
|
874
|
-
const collection = new Collection(args, queryArgs)
|
|
875
|
-
const model = await collection.first()
|
|
876
|
-
this.relationshipsCache[args.reflectionName] = model
|
|
877
|
-
return model
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
_readBelongsToReflection({reflectionName}) {
|
|
882
|
-
if (reflectionName in this.relationships) {
|
|
883
|
-
return this.relationships[reflectionName]
|
|
884
|
-
} else if (reflectionName in this.relationshipsCache) {
|
|
885
|
-
return this.relationshipsCache[reflectionName]
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (this.isNewRecord()) return null
|
|
889
|
-
|
|
890
|
-
const loadedRelationships = Object.keys(this.relationshipsCache)
|
|
891
|
-
const modelClassName = digg(this.modelClassData(), "name")
|
|
892
|
-
|
|
893
|
-
throw new NotLoadedError(`${modelClassName}#${reflectionName} hasn't been loaded yet. Only these were loaded: ${loadedRelationships.join(", ")}`)
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
async _loadHasManyReflection(args, queryArgs = {}) {
|
|
897
|
-
if (args.reflectionName in this.relationships) {
|
|
898
|
-
return this.relationships[args.reflectionName]
|
|
899
|
-
} else if (args.reflectionName in this.relationshipsCache) {
|
|
900
|
-
return this.relationshipsCache[args.reflectionName]
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
const collection = new Collection(args, queryArgs)
|
|
904
|
-
const models = await collection.toArray()
|
|
905
|
-
|
|
906
|
-
this.relationshipsCache[args.reflectionName] = models
|
|
907
|
-
|
|
908
|
-
return models
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
async _loadHasOneReflection(args, queryArgs = {}) {
|
|
912
|
-
if (args.reflectionName in this.relationships) {
|
|
913
|
-
return this.relationships[args.reflectionName]
|
|
914
|
-
} else if (args.reflectionName in this.relationshipsCache) {
|
|
915
|
-
return this.relationshipsCache[args.reflectionName]
|
|
916
|
-
} else {
|
|
917
|
-
const collection = new Collection(args, queryArgs)
|
|
918
|
-
const model = await collection.first()
|
|
919
|
-
|
|
920
|
-
this.relationshipsCache[args.reflectionName] = model
|
|
921
|
-
|
|
922
|
-
return model
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
_readHasOneReflection({reflectionName}) {
|
|
927
|
-
if (reflectionName in this.relationships) {
|
|
928
|
-
return this.relationships[reflectionName]
|
|
929
|
-
} else if (reflectionName in this.relationshipsCache) {
|
|
930
|
-
return this.relationshipsCache[reflectionName]
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
if (this.isNewRecord()) {
|
|
934
|
-
return null
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
const loadedRelationships = Object.keys(this.relationshipsCache)
|
|
938
|
-
const modelClassName = digg(this.modelClassData(), "name")
|
|
939
|
-
|
|
940
|
-
throw new NotLoadedError(`${modelClassName}#${reflectionName} hasn't been loaded yet. Only these were loaded: ${loadedRelationships.join(", ")}`)
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
_readModelDataFromArgs(args) {
|
|
944
|
-
this.abilities = args.data.b || {}
|
|
945
|
-
this.collection = args.collection
|
|
946
|
-
this.modelData = objectToUnderscore(args.data.a)
|
|
947
|
-
this.preloadedRelationships = args.data.r
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
_readPreloadedRelationships(preloaded) {
|
|
951
|
-
if (!this.preloadedRelationships) {
|
|
952
|
-
return
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
const relationships = digg(this.modelClassData(), "relationships")
|
|
956
|
-
|
|
957
|
-
for (const relationshipName in this.preloadedRelationships) {
|
|
958
|
-
const relationshipData = this.preloadedRelationships[relationshipName]
|
|
959
|
-
const relationshipClassData = relationships.find((relationship) => digg(relationship, "name") == relationshipName)
|
|
960
|
-
|
|
961
|
-
if (!relationshipClassData) {
|
|
962
|
-
const modelName = digg(this.modelClassData(), "name")
|
|
963
|
-
const relationshipsList = relationships.map((relationship) => relationship.name).join(", ")
|
|
964
|
-
|
|
965
|
-
throw new Error(`Could not find the relation ${relationshipName} on the ${modelName} model: ${relationshipsList}`)
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
const relationshipType = digg(relationshipClassData, "collectionName")
|
|
969
|
-
|
|
970
|
-
if (relationshipName in this.relationshipsCache) {
|
|
971
|
-
throw new Error(`${relationshipName} has already been loaded`)
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
if (!relationshipClassData) {
|
|
975
|
-
throw new Error(`No relationship on ${digg(this.modelClassData(), "name")} by that name: ${relationshipName}`)
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
if (!relationshipData) {
|
|
979
|
-
this.relationshipsCache[relationshipName] = null
|
|
980
|
-
this.relationships[relationshipName] = null
|
|
981
|
-
} else if (Array.isArray(relationshipData)) {
|
|
982
|
-
this.relationshipsCache[relationshipName] = []
|
|
983
|
-
this.relationships[relationshipName] = []
|
|
984
|
-
|
|
985
|
-
for (const relationshipId of relationshipData) {
|
|
986
|
-
const model = preloaded.getModel(relationshipType, relationshipId)
|
|
987
|
-
|
|
988
|
-
this.relationshipsCache[relationshipName].push(model)
|
|
989
|
-
this.relationships[relationshipName].push(model)
|
|
990
|
-
}
|
|
991
|
-
} else {
|
|
992
|
-
const model = preloaded.getModel(relationshipType, relationshipData)
|
|
993
|
-
|
|
994
|
-
this.relationshipsCache[relationshipName] = model
|
|
995
|
-
this.relationships[relationshipName] = model
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
primaryKey = () => this.readAttributeUnderscore(this.constructor.primaryKey())
|
|
1001
|
-
}
|