@kaspernj/api-maker 1.0.2053 → 1.0.2055

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.
Files changed (948) hide show
  1. package/build/api.d.ts +19 -0
  2. package/build/api.d.ts.map +1 -0
  3. package/build/api.js +77 -109
  4. package/build/api.js.map +1 -0
  5. package/build/attribute-not-loaded-error.d.ts +3 -0
  6. package/build/attribute-not-loaded-error.d.ts.map +1 -0
  7. package/build/attribute-not-loaded-error.js +3 -2
  8. package/build/attribute-not-loaded-error.js.map +1 -0
  9. package/build/base-component.d.ts +4 -0
  10. package/build/base-component.d.ts.map +1 -0
  11. package/build/base-component.js +2 -3
  12. package/build/base-component.js.map +1 -0
  13. package/build/base-error.d.ts +31 -0
  14. package/build/base-error.d.ts.map +1 -0
  15. package/build/base-error.js +44 -26
  16. package/build/base-error.js.map +1 -0
  17. package/build/base-model/attribute.d.ts +45 -0
  18. package/build/base-model/attribute.d.ts.map +1 -0
  19. package/build/base-model/attribute.js +49 -22
  20. package/build/base-model/attribute.js.map +1 -0
  21. package/build/base-model/column.d.ts +17 -0
  22. package/build/base-model/column.d.ts.map +1 -0
  23. package/build/base-model/column.js +15 -8
  24. package/build/base-model/column.js.map +1 -0
  25. package/build/base-model/reflection.d.ts +22 -0
  26. package/build/base-model/reflection.d.ts.map +1 -0
  27. package/build/base-model/reflection.js +22 -10
  28. package/build/base-model/reflection.js.map +1 -0
  29. package/build/base-model/scope.d.ts +9 -0
  30. package/build/base-model/scope.d.ts.map +1 -0
  31. package/build/base-model/scope.js +10 -7
  32. package/build/base-model/scope.js.map +1 -0
  33. package/build/base-model.js +1020 -812
  34. package/build/base-model.js.map +1 -0
  35. package/build/bootstrap/attribute-row.d.ts +3 -0
  36. package/build/bootstrap/attribute-row.d.ts.map +1 -0
  37. package/build/bootstrap/attribute-row.js +84 -123
  38. package/build/bootstrap/attribute-row.js.map +1 -0
  39. package/build/bootstrap/attribute-rows.d.ts +3 -0
  40. package/build/bootstrap/attribute-rows.d.ts.map +1 -0
  41. package/build/bootstrap/attribute-rows.js +17 -25
  42. package/build/bootstrap/attribute-rows.js.map +1 -0
  43. package/build/bootstrap/card.d.ts +3 -0
  44. package/build/bootstrap/card.d.ts.map +1 -0
  45. package/build/bootstrap/card.js +74 -129
  46. package/build/bootstrap/card.js.map +1 -0
  47. package/build/bootstrap/checkbox.d.ts +3 -0
  48. package/build/bootstrap/checkbox.d.ts.map +1 -0
  49. package/build/bootstrap/checkbox.js +49 -90
  50. package/build/bootstrap/checkbox.js.map +1 -0
  51. package/build/bootstrap/checkboxes.d.ts +3 -0
  52. package/build/bootstrap/checkboxes.d.ts.map +1 -0
  53. package/build/bootstrap/checkboxes.js +107 -167
  54. package/build/bootstrap/checkboxes.js.map +1 -0
  55. package/build/bootstrap/index.d.ts +1 -0
  56. package/build/bootstrap/index.d.ts.map +1 -0
  57. package/build/bootstrap/index.js +1 -2
  58. package/build/bootstrap/index.js.map +1 -0
  59. package/build/bootstrap/input.d.ts +3 -0
  60. package/build/bootstrap/input.d.ts.map +1 -0
  61. package/build/bootstrap/input.js +73 -118
  62. package/build/bootstrap/input.js.map +1 -0
  63. package/build/bootstrap/invalid-feedback.d.ts +6 -0
  64. package/build/bootstrap/invalid-feedback.d.ts.map +1 -0
  65. package/build/bootstrap/invalid-feedback.js +17 -20
  66. package/build/bootstrap/invalid-feedback.js.map +1 -0
  67. package/build/bootstrap/paginate.d.ts +3 -0
  68. package/build/bootstrap/paginate.d.ts.map +1 -0
  69. package/build/bootstrap/paginate.js +88 -136
  70. package/build/bootstrap/paginate.js.map +1 -0
  71. package/build/bootstrap/radio-buttons.d.ts +3 -0
  72. package/build/bootstrap/radio-buttons.d.ts.map +1 -0
  73. package/build/bootstrap/radio-buttons.js +44 -64
  74. package/build/bootstrap/radio-buttons.js.map +1 -0
  75. package/build/bootstrap/select.d.ts +3 -0
  76. package/build/bootstrap/select.d.ts.map +1 -0
  77. package/build/bootstrap/select.js +49 -81
  78. package/build/bootstrap/select.js.map +1 -0
  79. package/build/bootstrap/sort-link.d.ts +3 -0
  80. package/build/bootstrap/sort-link.d.ts.map +1 -0
  81. package/build/bootstrap/sort-link.js +62 -121
  82. package/build/bootstrap/sort-link.js.map +1 -0
  83. package/build/cable-connection-pool.d.ts +27 -0
  84. package/build/cable-connection-pool.d.ts.map +1 -0
  85. package/build/cable-connection-pool.js +90 -117
  86. package/build/cable-connection-pool.js.map +1 -0
  87. package/build/cable-subscription-pool.d.ts +16 -0
  88. package/build/cable-subscription-pool.d.ts.map +1 -0
  89. package/build/cable-subscription-pool.js +146 -191
  90. package/build/cable-subscription-pool.js.map +1 -0
  91. package/build/cable-subscription.d.ts +7 -0
  92. package/build/cable-subscription.d.ts.map +1 -0
  93. package/build/cable-subscription.js +15 -17
  94. package/build/cable-subscription.js.map +1 -0
  95. package/build/cache-key-generator.d.ts +15 -0
  96. package/build/cache-key-generator.d.ts.map +1 -0
  97. package/build/cache-key-generator.js +69 -70
  98. package/build/cache-key-generator.js.map +1 -0
  99. package/build/can-can.d.ts +19 -0
  100. package/build/can-can.d.ts.map +1 -0
  101. package/build/can-can.js +113 -119
  102. package/build/can-can.js.map +1 -0
  103. package/build/channels-consumer.d.ts +3 -0
  104. package/build/channels-consumer.d.ts.map +1 -0
  105. package/build/channels-consumer.js +6 -6
  106. package/build/channels-consumer.js.map +1 -0
  107. package/build/collection-loader.d.ts +3 -0
  108. package/build/collection-loader.d.ts.map +1 -0
  109. package/build/collection-loader.js +46 -40
  110. package/build/collection-loader.js.map +1 -0
  111. package/build/collection.d.ts +213 -0
  112. package/build/collection.d.ts.map +1 -0
  113. package/build/collection.js +442 -303
  114. package/build/collection.js.map +1 -0
  115. package/build/command-submit-data.d.ts +54 -0
  116. package/build/command-submit-data.d.ts.map +1 -0
  117. package/build/command-submit-data.js +108 -71
  118. package/build/command-submit-data.js.map +1 -0
  119. package/build/commands-pool.d.ts +63 -0
  120. package/build/commands-pool.d.ts.map +1 -0
  121. package/build/commands-pool.js +197 -181
  122. package/build/commands-pool.js.map +1 -0
  123. package/build/compose.d.ts +2 -0
  124. package/build/compose.d.ts.map +1 -0
  125. package/build/compose.js +8 -7
  126. package/build/compose.js.map +1 -0
  127. package/build/config.d.ts +9 -0
  128. package/build/config.d.ts.map +1 -0
  129. package/build/config.js +51 -63
  130. package/build/config.js.map +1 -0
  131. package/build/custom-error.d.ts +8 -0
  132. package/build/custom-error.d.ts.map +1 -0
  133. package/build/custom-error.js +4 -3
  134. package/build/custom-error.js.map +1 -0
  135. package/build/data-set-to-attributes.d.ts +2 -0
  136. package/build/data-set-to-attributes.d.ts.map +1 -0
  137. package/build/data-set-to-attributes.js +7 -7
  138. package/build/data-set-to-attributes.js.map +1 -0
  139. package/build/deserializer.d.ts +4 -0
  140. package/build/deserializer.d.ts.map +1 -0
  141. package/build/deserializer.js +51 -49
  142. package/build/deserializer.js.map +1 -0
  143. package/build/destroy-error.d.ts +8 -0
  144. package/build/destroy-error.d.ts.map +1 -0
  145. package/build/destroy-error.js +4 -3
  146. package/build/destroy-error.js.map +1 -0
  147. package/build/devise.d.ts +20 -0
  148. package/build/devise.d.ts.map +1 -0
  149. package/build/devise.js +104 -117
  150. package/build/devise.js.map +1 -0
  151. package/build/draggable-sort/controller.d.ts +41 -0
  152. package/build/draggable-sort/controller.d.ts.map +1 -0
  153. package/build/draggable-sort/controller.js +102 -128
  154. package/build/draggable-sort/controller.js.map +1 -0
  155. package/build/draggable-sort/index.d.ts +3 -0
  156. package/build/draggable-sort/index.d.ts.map +1 -0
  157. package/build/draggable-sort/index.js +61 -102
  158. package/build/draggable-sort/index.js.map +1 -0
  159. package/build/draggable-sort/item.d.ts +3 -0
  160. package/build/draggable-sort/item.d.ts.map +1 -0
  161. package/build/draggable-sort/item.js +122 -172
  162. package/build/draggable-sort/item.js.map +1 -0
  163. package/build/error-logger.d.ts +20 -0
  164. package/build/error-logger.d.ts.map +1 -0
  165. package/build/error-logger.js +95 -88
  166. package/build/error-logger.js.map +1 -0
  167. package/build/error-messages.d.ts +18 -0
  168. package/build/error-messages.d.ts.map +1 -0
  169. package/build/error-messages.js +22 -12
  170. package/build/error-messages.js.map +1 -0
  171. package/build/event-connection.d.ts +12 -0
  172. package/build/event-connection.d.ts.map +1 -0
  173. package/build/event-connection.js +25 -25
  174. package/build/event-connection.js.map +1 -0
  175. package/build/event-emitter-listener.d.ts +8 -0
  176. package/build/event-emitter-listener.d.ts.map +1 -0
  177. package/build/event-emitter-listener.js +8 -13
  178. package/build/event-emitter-listener.js.map +1 -0
  179. package/build/event-model-class.d.ts +9 -0
  180. package/build/event-model-class.d.ts.map +1 -0
  181. package/build/event-model-class.js +18 -18
  182. package/build/event-model-class.js.map +1 -0
  183. package/build/events.d.ts +4 -0
  184. package/build/events.d.ts.map +1 -0
  185. package/build/events.js +1 -1
  186. package/build/events.js.map +1 -0
  187. package/build/form.d.ts +14 -0
  188. package/build/form.d.ts.map +1 -0
  189. package/build/form.js +70 -86
  190. package/build/form.js.map +1 -0
  191. package/build/history-expo.d.ts +6 -0
  192. package/build/history-expo.d.ts.map +1 -0
  193. package/build/history-expo.js +10 -13
  194. package/build/history-expo.js.map +1 -0
  195. package/build/history-react-native.d.ts +6 -0
  196. package/build/history-react-native.d.ts.map +1 -0
  197. package/build/history-react-native.js +11 -13
  198. package/build/history-react-native.js.map +1 -0
  199. package/build/history.d.ts +3 -0
  200. package/build/history.d.ts.map +1 -0
  201. package/build/history.js +1 -1
  202. package/build/history.js.map +1 -0
  203. package/build/index.d.ts +2 -0
  204. package/build/index.d.ts.map +1 -0
  205. package/build/index.js +1 -1
  206. package/build/index.js.map +1 -0
  207. package/build/inputs/attachment.d.ts +3 -0
  208. package/build/inputs/attachment.d.ts.map +1 -0
  209. package/build/inputs/attachment.js +67 -126
  210. package/build/inputs/attachment.js.map +1 -0
  211. package/build/inputs/auto-submit.d.ts +9 -0
  212. package/build/inputs/auto-submit.d.ts.map +1 -0
  213. package/build/inputs/auto-submit.js +27 -30
  214. package/build/inputs/auto-submit.js.map +1 -0
  215. package/build/inputs/checkbox.d.ts +3 -0
  216. package/build/inputs/checkbox.d.ts.map +1 -0
  217. package/build/inputs/checkbox.js +76 -130
  218. package/build/inputs/checkbox.js.map +1 -0
  219. package/build/inputs/checkboxes.d.ts +3 -0
  220. package/build/inputs/checkboxes.d.ts.map +1 -0
  221. package/build/inputs/checkboxes.js +67 -99
  222. package/build/inputs/checkboxes.js.map +1 -0
  223. package/build/inputs/id-for-component.d.ts +2 -0
  224. package/build/inputs/id-for-component.d.ts.map +1 -0
  225. package/build/inputs/id-for-component.js +15 -12
  226. package/build/inputs/id-for-component.js.map +1 -0
  227. package/build/inputs/input-wrapper.d.ts +3 -0
  228. package/build/inputs/input-wrapper.d.ts.map +1 -0
  229. package/build/inputs/input-wrapper.js +6 -16
  230. package/build/inputs/input-wrapper.js.map +1 -0
  231. package/build/inputs/input.d.ts +5 -0
  232. package/build/inputs/input.d.ts.map +1 -0
  233. package/build/inputs/input.js +147 -223
  234. package/build/inputs/input.js.map +1 -0
  235. package/build/inputs/money.d.ts +3 -0
  236. package/build/inputs/money.d.ts.map +1 -0
  237. package/build/inputs/money.js +116 -160
  238. package/build/inputs/money.js.map +1 -0
  239. package/build/inputs/name-for-component.d.ts +2 -0
  240. package/build/inputs/name-for-component.d.ts.map +1 -0
  241. package/build/inputs/name-for-component.js +10 -9
  242. package/build/inputs/name-for-component.js.map +1 -0
  243. package/build/inputs/select.d.ts +5 -0
  244. package/build/inputs/select.d.ts.map +1 -0
  245. package/build/inputs/select.js +62 -81
  246. package/build/inputs/select.js.map +1 -0
  247. package/build/instance-of-class-name.d.ts +3 -0
  248. package/build/instance-of-class-name.d.ts.map +1 -0
  249. package/build/instance-of-class-name.js +15 -17
  250. package/build/instance-of-class-name.js.map +1 -0
  251. package/build/is-expo.d.ts +3 -0
  252. package/build/is-expo.d.ts.map +1 -0
  253. package/build/is-expo.js +11 -17
  254. package/build/is-expo.js.map +1 -0
  255. package/build/key-value-store.d.ts +11 -0
  256. package/build/key-value-store.d.ts.map +1 -0
  257. package/build/key-value-store.js +56 -50
  258. package/build/key-value-store.js.map +1 -0
  259. package/build/link.d.ts +3 -0
  260. package/build/link.d.ts.map +1 -0
  261. package/build/link.js +49 -74
  262. package/build/link.js.map +1 -0
  263. package/build/logger.d.ts +13 -0
  264. package/build/logger.d.ts.map +1 -0
  265. package/build/logger.js +30 -26
  266. package/build/logger.js.map +1 -0
  267. package/build/merge-styles.d.ts +2 -0
  268. package/build/merge-styles.d.ts.map +1 -0
  269. package/build/merge-styles.js +10 -9
  270. package/build/merge-styles.js.map +1 -0
  271. package/build/modal.d.ts +3 -0
  272. package/build/modal.d.ts.map +1 -0
  273. package/build/modal.js +20 -34
  274. package/build/modal.js.map +1 -0
  275. package/build/model-class-require.d.ts +3 -0
  276. package/build/model-class-require.d.ts.map +1 -0
  277. package/build/model-class-require.js +10 -10
  278. package/build/model-class-require.js.map +1 -0
  279. package/build/model-events.d.ts +8 -0
  280. package/build/model-events.d.ts.map +1 -0
  281. package/build/model-events.js +27 -27
  282. package/build/model-events.js.map +1 -0
  283. package/build/model-name.d.ts +8 -0
  284. package/build/model-name.d.ts.map +1 -0
  285. package/build/model-name.js +23 -24
  286. package/build/model-name.js.map +1 -0
  287. package/build/model-prop-type.d.ts +21 -0
  288. package/build/model-prop-type.d.ts.map +1 -0
  289. package/build/model-prop-type.js +89 -91
  290. package/build/model-prop-type.js.map +1 -0
  291. package/build/model-recipes-loader.d.ts +10 -0
  292. package/build/model-recipes-loader.d.ts.map +1 -0
  293. package/build/model-recipes-loader.js +19 -28
  294. package/build/model-recipes-loader.js.map +1 -0
  295. package/build/model-recipes-model-loader.d.ts +202 -0
  296. package/build/model-recipes-model-loader.d.ts.map +1 -0
  297. package/build/model-recipes-model-loader.js +226 -344
  298. package/build/model-recipes-model-loader.js.map +1 -0
  299. package/build/models-response-reader.d.ts +9 -0
  300. package/build/models-response-reader.d.ts.map +1 -0
  301. package/build/models-response-reader.js +35 -36
  302. package/build/models-response-reader.js.map +1 -0
  303. package/build/models.d.ts +3 -0
  304. package/build/models.d.ts.map +1 -0
  305. package/build/models.js +3 -5
  306. package/build/models.js.map +1 -0
  307. package/build/money-formatter.d.ts +17 -0
  308. package/build/money-formatter.d.ts.map +1 -0
  309. package/build/money-formatter.js +74 -67
  310. package/build/money-formatter.js.map +1 -0
  311. package/build/not-loaded-error.d.ts +3 -0
  312. package/build/not-loaded-error.d.ts.map +1 -0
  313. package/build/not-loaded-error.js +3 -2
  314. package/build/not-loaded-error.js.map +1 -0
  315. package/build/params.d.ts +16 -0
  316. package/build/params.d.ts.map +1 -0
  317. package/build/params.js +58 -55
  318. package/build/params.js.map +1 -0
  319. package/build/preloaded.d.ts +8 -0
  320. package/build/preloaded.d.ts.map +1 -0
  321. package/build/preloaded.js +29 -32
  322. package/build/preloaded.js.map +1 -0
  323. package/build/resize-observer.d.ts +3 -0
  324. package/build/resize-observer.d.ts.map +1 -0
  325. package/build/resize-observer.js +6 -9
  326. package/build/resize-observer.js.map +1 -0
  327. package/build/rest-props-validator.d.ts +3 -0
  328. package/build/rest-props-validator.d.ts.map +1 -0
  329. package/build/rest-props-validator.js +6 -6
  330. package/build/rest-props-validator.js.map +1 -0
  331. package/build/result.d.ts +38 -0
  332. package/build/result.d.ts.map +1 -0
  333. package/build/result.js +37 -11
  334. package/build/result.js.map +1 -0
  335. package/build/router/route.d.ts +8 -0
  336. package/build/router/route.d.ts.map +1 -0
  337. package/build/router/route.js +174 -251
  338. package/build/router/route.js.map +1 -0
  339. package/build/router/switch.d.ts +4 -0
  340. package/build/router/switch.d.ts.map +1 -0
  341. package/build/router/switch.js +50 -62
  342. package/build/router/switch.js.map +1 -0
  343. package/build/router.d.ts +3 -0
  344. package/build/router.d.ts.map +1 -0
  345. package/build/router.js +30 -53
  346. package/build/router.js.map +1 -0
  347. package/build/routes-native.d.ts +24 -0
  348. package/build/routes-native.d.ts.map +1 -0
  349. package/build/routes-native.js +140 -189
  350. package/build/routes-native.js.map +1 -0
  351. package/build/routes.d.ts +10 -0
  352. package/build/routes.d.ts.map +1 -0
  353. package/build/routes.js +44 -44
  354. package/build/routes.js.map +1 -0
  355. package/build/run-last.d.ts +12 -0
  356. package/build/run-last.d.ts.map +1 -0
  357. package/build/run-last.js +32 -31
  358. package/build/run-last.js.map +1 -0
  359. package/build/serializer.d.ts +10 -0
  360. package/build/serializer.d.ts.map +1 -0
  361. package/build/serializer.js +64 -58
  362. package/build/serializer.js.map +1 -0
  363. package/build/services.d.ts +5 -0
  364. package/build/services.d.ts.map +1 -0
  365. package/build/services.js +18 -17
  366. package/build/services.js.map +1 -0
  367. package/build/session-status-updater.d.ts +21 -0
  368. package/build/session-status-updater.d.ts.map +1 -0
  369. package/build/session-status-updater.js +116 -118
  370. package/build/session-status-updater.js.map +1 -0
  371. package/build/source-maps-loader.d.ts +37 -0
  372. package/build/source-maps-loader.d.ts.map +1 -0
  373. package/build/source-maps-loader.js +146 -165
  374. package/build/source-maps-loader.js.map +1 -0
  375. package/build/super-admin/config-reader.d.ts +23 -0
  376. package/build/super-admin/config-reader.d.ts.map +1 -0
  377. package/build/super-admin/config-reader.js +68 -75
  378. package/build/super-admin/config-reader.js.map +1 -0
  379. package/build/super-admin/edit-page/edit-attribute-checkbox.d.ts +3 -0
  380. package/build/super-admin/edit-page/edit-attribute-checkbox.d.ts.map +1 -0
  381. package/build/super-admin/edit-page/edit-attribute-checkbox.js +45 -72
  382. package/build/super-admin/edit-page/edit-attribute-checkbox.js.map +1 -0
  383. package/build/super-admin/edit-page/edit-attribute-content.d.ts +3 -0
  384. package/build/super-admin/edit-page/edit-attribute-content.d.ts.map +1 -0
  385. package/build/super-admin/edit-page/edit-attribute-content.js +40 -46
  386. package/build/super-admin/edit-page/edit-attribute-content.js.map +1 -0
  387. package/build/super-admin/edit-page/edit-attribute-input.d.ts +3 -0
  388. package/build/super-admin/edit-page/edit-attribute-input.d.ts.map +1 -0
  389. package/build/super-admin/edit-page/edit-attribute-input.js +48 -68
  390. package/build/super-admin/edit-page/edit-attribute-input.js.map +1 -0
  391. package/build/super-admin/edit-page/edit-attribute.d.ts +3 -0
  392. package/build/super-admin/edit-page/edit-attribute.d.ts.map +1 -0
  393. package/build/super-admin/edit-page/edit-attribute.js +30 -65
  394. package/build/super-admin/edit-page/edit-attribute.js.map +1 -0
  395. package/build/super-admin/edit-page.d.ts +3 -0
  396. package/build/super-admin/edit-page.d.ts.map +1 -0
  397. package/build/super-admin/edit-page.js +75 -106
  398. package/build/super-admin/edit-page.js.map +1 -0
  399. package/build/super-admin/has-edit-config.d.ts +3 -0
  400. package/build/super-admin/has-edit-config.d.ts.map +1 -0
  401. package/build/super-admin/has-edit-config.js +10 -10
  402. package/build/super-admin/has-edit-config.js.map +1 -0
  403. package/build/super-admin/index-page.d.ts +3 -0
  404. package/build/super-admin/index-page.d.ts.map +1 -0
  405. package/build/super-admin/index-page.js +12 -19
  406. package/build/super-admin/index-page.js.map +1 -0
  407. package/build/super-admin/index.d.ts +3 -0
  408. package/build/super-admin/index.d.ts.map +1 -0
  409. package/build/super-admin/index.js +120 -173
  410. package/build/super-admin/index.js.map +1 -0
  411. package/build/super-admin/layout/header/index.d.ts +3 -0
  412. package/build/super-admin/layout/header/index.d.ts.map +1 -0
  413. package/build/super-admin/layout/header/index.js +84 -146
  414. package/build/super-admin/layout/header/index.js.map +1 -0
  415. package/build/super-admin/layout/index.d.ts +3 -0
  416. package/build/super-admin/layout/index.d.ts.map +1 -0
  417. package/build/super-admin/layout/index.js +87 -147
  418. package/build/super-admin/layout/index.js.map +1 -0
  419. package/build/super-admin/layout/menu/index.d.ts +3 -0
  420. package/build/super-admin/layout/menu/index.d.ts.map +1 -0
  421. package/build/super-admin/layout/menu/index.js +98 -186
  422. package/build/super-admin/layout/menu/index.js.map +1 -0
  423. package/build/super-admin/layout/menu/menu-content.d.ts +3 -0
  424. package/build/super-admin/layout/menu/menu-content.d.ts.map +1 -0
  425. package/build/super-admin/layout/menu/menu-content.js +19 -38
  426. package/build/super-admin/layout/menu/menu-content.js.map +1 -0
  427. package/build/super-admin/layout/menu/menu-item.d.ts +3 -0
  428. package/build/super-admin/layout/menu/menu-item.d.ts.map +1 -0
  429. package/build/super-admin/layout/menu/menu-item.js +46 -75
  430. package/build/super-admin/layout/menu/menu-item.js.map +1 -0
  431. package/build/super-admin/layout/no-access.d.ts +3 -0
  432. package/build/super-admin/layout/no-access.d.ts.map +1 -0
  433. package/build/super-admin/layout/no-access.js +15 -22
  434. package/build/super-admin/layout/no-access.js.map +1 -0
  435. package/build/super-admin/model-class-table.d.ts +3 -0
  436. package/build/super-admin/model-class-table.d.ts.map +1 -0
  437. package/build/super-admin/model-class-table.js +42 -54
  438. package/build/super-admin/model-class-table.js.map +1 -0
  439. package/build/super-admin/models.d.ts +3 -0
  440. package/build/super-admin/models.d.ts.map +1 -0
  441. package/build/super-admin/models.js +4 -4
  442. package/build/super-admin/models.js.map +1 -0
  443. package/build/super-admin/show-nav.d.ts +3 -0
  444. package/build/super-admin/show-nav.d.ts.map +1 -0
  445. package/build/super-admin/show-nav.js +19 -42
  446. package/build/super-admin/show-nav.js.map +1 -0
  447. package/build/super-admin/show-page/belongs-to-attribute-row.d.ts +3 -0
  448. package/build/super-admin/show-page/belongs-to-attribute-row.d.ts.map +1 -0
  449. package/build/super-admin/show-page/belongs-to-attribute-row.js +13 -22
  450. package/build/super-admin/show-page/belongs-to-attribute-row.js.map +1 -0
  451. package/build/super-admin/show-page/index.d.ts +3 -0
  452. package/build/super-admin/show-page/index.d.ts.map +1 -0
  453. package/build/super-admin/show-page/index.js +105 -126
  454. package/build/super-admin/show-page/index.js.map +1 -0
  455. package/build/super-admin/show-reflection-actions.d.ts +3 -0
  456. package/build/super-admin/show-reflection-actions.d.ts.map +1 -0
  457. package/build/super-admin/show-reflection-actions.js +33 -44
  458. package/build/super-admin/show-reflection-actions.js.map +1 -0
  459. package/build/super-admin/show-reflection-link.d.ts +3 -0
  460. package/build/super-admin/show-reflection-link.d.ts.map +1 -0
  461. package/build/super-admin/show-reflection-link.js +23 -41
  462. package/build/super-admin/show-reflection-link.js.map +1 -0
  463. package/build/super-admin/show-reflection-page.d.ts +3 -0
  464. package/build/super-admin/show-reflection-page.d.ts.map +1 -0
  465. package/build/super-admin/show-reflection-page.js +26 -40
  466. package/build/super-admin/show-reflection-page.js.map +1 -0
  467. package/build/table/column-content.d.ts +25 -0
  468. package/build/table/column-content.d.ts.map +1 -0
  469. package/build/table/column-content.js +101 -107
  470. package/build/table/column-content.js.map +1 -0
  471. package/build/table/column-identifier.d.ts +2 -0
  472. package/build/table/column-identifier.d.ts.map +1 -0
  473. package/build/table/column-identifier.js +17 -15
  474. package/build/table/column-identifier.js.map +1 -0
  475. package/build/table/column-visible.d.ts +2 -0
  476. package/build/table/column-visible.d.ts.map +1 -0
  477. package/build/table/column-visible.js +8 -5
  478. package/build/table/column-visible.js.map +1 -0
  479. package/build/table/components/column.d.ts +3 -0
  480. package/build/table/components/column.d.ts.map +1 -0
  481. package/build/table/components/column.js +11 -18
  482. package/build/table/components/column.js.map +1 -0
  483. package/build/table/components/flat-list.d.ts +3 -0
  484. package/build/table/components/flat-list.d.ts.map +1 -0
  485. package/build/table/components/flat-list.js +10 -17
  486. package/build/table/components/flat-list.js.map +1 -0
  487. package/build/table/components/header.d.ts +3 -0
  488. package/build/table/components/header.d.ts.map +1 -0
  489. package/build/table/components/header.js +11 -21
  490. package/build/table/components/header.js.map +1 -0
  491. package/build/table/components/row.d.ts +3 -0
  492. package/build/table/components/row.d.ts.map +1 -0
  493. package/build/table/components/row.js +14 -22
  494. package/build/table/components/row.js.map +1 -0
  495. package/build/table/filters/attribute-element.d.ts +3 -0
  496. package/build/table/filters/attribute-element.d.ts.map +1 -0
  497. package/build/table/filters/attribute-element.js +26 -35
  498. package/build/table/filters/attribute-element.js.map +1 -0
  499. package/build/table/filters/filter-form.d.ts +3 -0
  500. package/build/table/filters/filter-form.d.ts.map +1 -0
  501. package/build/table/filters/filter-form.js +261 -428
  502. package/build/table/filters/filter-form.js.map +1 -0
  503. package/build/table/filters/filter.d.ts +3 -0
  504. package/build/table/filters/filter.d.ts.map +1 -0
  505. package/build/table/filters/filter.js +38 -81
  506. package/build/table/filters/filter.js.map +1 -0
  507. package/build/table/filters/index.d.ts +3 -0
  508. package/build/table/filters/index.d.ts.map +1 -0
  509. package/build/table/filters/index.js +87 -176
  510. package/build/table/filters/index.js.map +1 -0
  511. package/build/table/filters/load-search-modal.d.ts +3 -0
  512. package/build/table/filters/load-search-modal.d.ts.map +1 -0
  513. package/build/table/filters/load-search-modal.js +79 -162
  514. package/build/table/filters/load-search-modal.js.map +1 -0
  515. package/build/table/filters/reflection-element.d.ts +3 -0
  516. package/build/table/filters/reflection-element.d.ts.map +1 -0
  517. package/build/table/filters/reflection-element.js +20 -30
  518. package/build/table/filters/reflection-element.js.map +1 -0
  519. package/build/table/filters/save-search-modal.d.ts +3 -0
  520. package/build/table/filters/save-search-modal.d.ts.map +1 -0
  521. package/build/table/filters/save-search-modal.js +36 -77
  522. package/build/table/filters/save-search-modal.js.map +1 -0
  523. package/build/table/filters/scope-element.d.ts +3 -0
  524. package/build/table/filters/scope-element.d.ts.map +1 -0
  525. package/build/table/filters/scope-element.js +24 -36
  526. package/build/table/filters/scope-element.js.map +1 -0
  527. package/build/table/header-column-content.d.ts +3 -0
  528. package/build/table/header-column-content.d.ts.map +1 -0
  529. package/build/table/header-column-content.js +24 -59
  530. package/build/table/header-column-content.js.map +1 -0
  531. package/build/table/header-column.d.ts +3 -0
  532. package/build/table/header-column.d.ts.map +1 -0
  533. package/build/table/header-column.js +80 -132
  534. package/build/table/header-column.js.map +1 -0
  535. package/build/table/header-select.d.ts +3 -0
  536. package/build/table/header-select.d.ts.map +1 -0
  537. package/build/table/header-select.js +35 -95
  538. package/build/table/header-select.js.map +1 -0
  539. package/build/table/model-callback-args.d.ts +4 -0
  540. package/build/table/model-callback-args.d.ts.map +1 -0
  541. package/build/table/model-callback-args.js +5 -7
  542. package/build/table/model-callback-args.js.map +1 -0
  543. package/build/table/model-column.d.ts +3 -0
  544. package/build/table/model-column.d.ts.map +1 -0
  545. package/build/table/model-column.js +49 -88
  546. package/build/table/model-column.js.map +1 -0
  547. package/build/table/model-row.d.ts +3 -0
  548. package/build/table/model-row.d.ts.map +1 -0
  549. package/build/table/model-row.js +60 -174
  550. package/build/table/model-row.js.map +1 -0
  551. package/build/table/select-calculator.d.ts +2 -0
  552. package/build/table/select-calculator.d.ts.map +1 -0
  553. package/build/table/select-calculator.js +46 -54
  554. package/build/table/select-calculator.js.map +1 -0
  555. package/build/table/settings/column-row.d.ts +3 -0
  556. package/build/table/settings/column-row.d.ts.map +1 -0
  557. package/build/table/settings/column-row.js +60 -87
  558. package/build/table/settings/column-row.js.map +1 -0
  559. package/build/table/settings/download-action.d.ts +3 -0
  560. package/build/table/settings/download-action.d.ts.map +1 -0
  561. package/build/table/settings/download-action.js +27 -73
  562. package/build/table/settings/download-action.js.map +1 -0
  563. package/build/table/settings/index.d.ts +3 -0
  564. package/build/table/settings/index.d.ts.map +1 -0
  565. package/build/table/settings/index.js +29 -85
  566. package/build/table/settings/index.js.map +1 -0
  567. package/build/table/table-settings.d.ts +35 -0
  568. package/build/table/table-settings.d.ts.map +1 -0
  569. package/build/table/table-settings.js +187 -195
  570. package/build/table/table-settings.js.map +1 -0
  571. package/build/table/table.d.ts +3 -0
  572. package/build/table/table.d.ts.map +1 -0
  573. package/build/table/table.js +557 -918
  574. package/build/table/table.js.map +1 -0
  575. package/build/table/use-sorting.d.ts +21 -0
  576. package/build/table/use-sorting.d.ts.map +1 -0
  577. package/build/table/use-sorting.js +40 -31
  578. package/build/table/use-sorting.js.map +1 -0
  579. package/build/table/widths.d.ts +18 -0
  580. package/build/table/widths.d.ts.map +1 -0
  581. package/build/table/widths.js +63 -68
  582. package/build/table/widths.js.map +1 -0
  583. package/build/table/worker-plugins-check-all-checkbox.d.ts +3 -0
  584. package/build/table/worker-plugins-check-all-checkbox.d.ts.map +1 -0
  585. package/build/table/worker-plugins-check-all-checkbox.js +73 -112
  586. package/build/table/worker-plugins-check-all-checkbox.js.map +1 -0
  587. package/build/table/worker-plugins-checkbox.d.ts +3 -0
  588. package/build/table/worker-plugins-checkbox.d.ts.map +1 -0
  589. package/build/table/worker-plugins-checkbox.js +66 -103
  590. package/build/table/worker-plugins-checkbox.js.map +1 -0
  591. package/build/translated-attributes.d.ts +2 -0
  592. package/build/translated-attributes.d.ts.map +1 -0
  593. package/build/translated-attributes.js +7 -7
  594. package/build/translated-attributes.js.map +1 -0
  595. package/build/translated-collections.d.ts +4 -0
  596. package/build/translated-collections.d.ts.map +1 -0
  597. package/build/translated-collections.js +8 -7
  598. package/build/translated-collections.js.map +1 -0
  599. package/build/updated-attribute.d.ts +15 -0
  600. package/build/updated-attribute.d.ts.map +1 -0
  601. package/build/updated-attribute.js +66 -67
  602. package/build/updated-attribute.js.map +1 -0
  603. package/build/url-encode.d.ts +6 -0
  604. package/build/url-encode.d.ts.map +1 -0
  605. package/build/url-encode.js +14 -11
  606. package/build/url-encode.js.map +1 -0
  607. package/build/use-breakpoint.d.ts +3 -0
  608. package/build/use-breakpoint.d.ts.map +1 -0
  609. package/build/use-breakpoint.js +71 -72
  610. package/build/use-breakpoint.js.map +1 -0
  611. package/build/use-can-can.d.ts +8 -0
  612. package/build/use-can-can.d.ts.map +1 -0
  613. package/build/use-can-can.js +45 -52
  614. package/build/use-can-can.js.map +1 -0
  615. package/build/use-collection.d.ts +73 -0
  616. package/build/use-collection.d.ts.map +1 -0
  617. package/build/use-collection.js +253 -212
  618. package/build/use-collection.js.map +1 -0
  619. package/build/use-created-event.d.ts +19 -0
  620. package/build/use-created-event.d.ts.map +1 -0
  621. package/build/use-created-event.js +50 -44
  622. package/build/use-created-event.js.map +1 -0
  623. package/build/use-current-user-context.d.ts +12 -0
  624. package/build/use-current-user-context.d.ts.map +1 -0
  625. package/build/use-current-user-context.js +94 -0
  626. package/build/use-current-user-context.js.map +1 -0
  627. package/build/use-current-user.d.ts +14 -0
  628. package/build/use-current-user.d.ts.map +1 -0
  629. package/build/use-current-user.js +21 -115
  630. package/build/use-current-user.js.map +1 -0
  631. package/build/use-destroyed-event.d.ts +16 -0
  632. package/build/use-destroyed-event.d.ts.map +1 -0
  633. package/build/use-destroyed-event.js +53 -54
  634. package/build/use-destroyed-event.js.map +1 -0
  635. package/build/use-event-emitter.d.ts +9 -0
  636. package/build/use-event-emitter.d.ts.map +1 -0
  637. package/build/use-event-emitter.js +24 -22
  638. package/build/use-event-emitter.js.map +1 -0
  639. package/build/use-event-listener.d.ts +9 -0
  640. package/build/use-event-listener.d.ts.map +1 -0
  641. package/build/use-event-listener.js +24 -18
  642. package/build/use-event-listener.js.map +1 -0
  643. package/build/use-input.d.ts +31 -0
  644. package/build/use-input.d.ts.map +1 -0
  645. package/build/use-input.js +142 -130
  646. package/build/use-input.js.map +1 -0
  647. package/build/use-model-event.d.ts +17 -0
  648. package/build/use-model-event.d.ts.map +1 -0
  649. package/build/use-model-event.js +54 -54
  650. package/build/use-model-event.js.map +1 -0
  651. package/build/use-model.d.ts +30 -0
  652. package/build/use-model.d.ts.map +1 -0
  653. package/build/use-model.js +153 -156
  654. package/build/use-model.js.map +1 -0
  655. package/build/use-resize-observer.d.ts +8 -0
  656. package/build/use-resize-observer.d.ts.map +1 -0
  657. package/build/use-resize-observer.js +22 -19
  658. package/build/use-resize-observer.js.map +1 -0
  659. package/build/use-router.d.ts +8 -0
  660. package/build/use-router.d.ts.map +1 -0
  661. package/build/use-router.js +84 -93
  662. package/build/use-router.js.map +1 -0
  663. package/build/use-screen-layout.d.ts +3 -0
  664. package/build/use-screen-layout.d.ts.map +1 -0
  665. package/build/use-screen-layout.js +41 -34
  666. package/build/use-screen-layout.js.map +1 -0
  667. package/build/use-styles.d.ts +2 -0
  668. package/build/use-styles.d.ts.map +1 -0
  669. package/build/use-styles.js +48 -47
  670. package/build/use-styles.js.map +1 -0
  671. package/build/use-updated-event.d.ts +16 -0
  672. package/build/use-updated-event.d.ts.map +1 -0
  673. package/build/use-updated-event.js +53 -54
  674. package/build/use-updated-event.js.map +1 -0
  675. package/build/use-validation-errors.d.ts +7 -0
  676. package/build/use-validation-errors.d.ts.map +1 -0
  677. package/build/use-validation-errors.js +27 -27
  678. package/build/use-validation-errors.js.map +1 -0
  679. package/build/utils/button.d.ts +3 -0
  680. package/build/utils/button.d.ts.map +1 -0
  681. package/build/utils/button.js +83 -113
  682. package/build/utils/button.js.map +1 -0
  683. package/build/utils/card.d.ts +3 -0
  684. package/build/utils/card.d.ts.map +1 -0
  685. package/build/utils/card.js +25 -48
  686. package/build/utils/card.js.map +1 -0
  687. package/build/utils/checkbox.d.ts +3 -0
  688. package/build/utils/checkbox.d.ts.map +1 -0
  689. package/build/utils/checkbox.js +44 -69
  690. package/build/utils/checkbox.js.map +1 -0
  691. package/build/utils/checkboxes.d.ts +3 -0
  692. package/build/utils/checkboxes.d.ts.map +1 -0
  693. package/build/utils/checkboxes.js +95 -143
  694. package/build/utils/checkboxes.js.map +1 -0
  695. package/build/utils/default-style.d.ts +7 -0
  696. package/build/utils/default-style.d.ts.map +1 -0
  697. package/build/utils/default-style.js +51 -58
  698. package/build/utils/default-style.js.map +1 -0
  699. package/build/utils/header.d.ts +3 -0
  700. package/build/utils/header.d.ts.map +1 -0
  701. package/build/utils/header.js +8 -17
  702. package/build/utils/header.js.map +1 -0
  703. package/build/utils/icon.d.ts +3 -0
  704. package/build/utils/icon.d.ts.map +1 -0
  705. package/build/utils/icon.js +68 -87
  706. package/build/utils/icon.js.map +1 -0
  707. package/build/utils/invalid-feedback.d.ts +3 -0
  708. package/build/utils/invalid-feedback.d.ts.map +1 -0
  709. package/build/utils/invalid-feedback.js +10 -13
  710. package/build/utils/invalid-feedback.js.map +1 -0
  711. package/build/utils/modal.d.ts +3 -0
  712. package/build/utils/modal.d.ts.map +1 -0
  713. package/build/utils/modal.js +30 -56
  714. package/build/utils/modal.js.map +1 -0
  715. package/build/utils/text.d.ts +3 -0
  716. package/build/utils/text.d.ts.map +1 -0
  717. package/build/utils/text.js +7 -17
  718. package/build/utils/text.js.map +1 -0
  719. package/build/validation-error.d.ts +18 -0
  720. package/build/validation-error.d.ts.map +1 -0
  721. package/build/validation-error.js +34 -25
  722. package/build/validation-error.js.map +1 -0
  723. package/build/validation-errors.d.ts +58 -0
  724. package/build/validation-errors.d.ts.map +1 -0
  725. package/build/validation-errors.js +107 -87
  726. package/build/validation-errors.js.map +1 -0
  727. package/build/with-api-maker.d.ts +3 -0
  728. package/build/with-api-maker.d.ts.map +1 -0
  729. package/build/with-api-maker.js +18 -24
  730. package/build/with-api-maker.js.map +1 -0
  731. package/build/with-collection.d.ts +3 -0
  732. package/build/with-collection.d.ts.map +1 -0
  733. package/build/with-collection.js +11 -10
  734. package/build/with-collection.js.map +1 -0
  735. package/build/with-current-user.d.ts +3 -0
  736. package/build/with-current-user.d.ts.map +1 -0
  737. package/build/with-current-user.js +6 -8
  738. package/build/with-current-user.js.map +1 -0
  739. package/build/with-model.d.ts +3 -0
  740. package/build/with-model.d.ts.map +1 -0
  741. package/build/with-model.js +10 -12
  742. package/build/with-model.js.map +1 -0
  743. package/build/with-router.d.ts +3 -0
  744. package/build/with-router.d.ts.map +1 -0
  745. package/build/with-router.js +7 -20
  746. package/build/with-router.js.map +1 -0
  747. package/package.json +14 -8
  748. package/.eslintrc.js +0 -357
  749. package/android/build.gradle +0 -43
  750. package/android/src/main/AndroidManifest.xml +0 -2
  751. package/android/src/main/java/expo/modules/api_maker/ApiMakerModule.kt +0 -50
  752. package/android/src/main/java/expo/modules/api_maker/ApiMakerView.kt +0 -30
  753. package/expo-module.config.json +0 -17
  754. package/ios/ApiMaker.podspec +0 -29
  755. package/ios/ApiMakerModule.swift +0 -48
  756. package/ios/ApiMakerView.swift +0 -38
  757. package/src/api.js +0 -109
  758. package/src/attribute-not-loaded-error.js +0 -1
  759. package/src/base-component.jsx +0 -5
  760. package/src/base-error.js +0 -38
  761. package/src/base-model/attribute.js +0 -33
  762. package/src/base-model/column.js +0 -13
  763. package/src/base-model/reflection.js +0 -15
  764. package/src/base-model/scope.js +0 -12
  765. package/src/base-model.js +0 -1001
  766. package/src/bootstrap/attribute-row.jsx +0 -134
  767. package/src/bootstrap/attribute-rows.jsx +0 -27
  768. package/src/bootstrap/card.jsx +0 -149
  769. package/src/bootstrap/checkbox.jsx +0 -86
  770. package/src/bootstrap/checkboxes.jsx +0 -185
  771. package/src/bootstrap/index.js +0 -0
  772. package/src/bootstrap/input.jsx +0 -173
  773. package/src/bootstrap/invalid-feedback.jsx +0 -31
  774. package/src/bootstrap/paginate.jsx +0 -187
  775. package/src/bootstrap/radio-buttons.jsx +0 -87
  776. package/src/bootstrap/select.jsx +0 -110
  777. package/src/bootstrap/sort-link.jsx +0 -106
  778. package/src/cable-connection-pool.js +0 -127
  779. package/src/cable-subscription-pool.js +0 -189
  780. package/src/cable-subscription.js +0 -23
  781. package/src/cache-key-generator.js +0 -100
  782. package/src/can-can.js +0 -158
  783. package/src/channels-consumer.js +0 -10
  784. package/src/collection-loader.jsx +0 -60
  785. package/src/collection.js +0 -346
  786. package/src/command-submit-data.js +0 -103
  787. package/src/commands-pool.js +0 -212
  788. package/src/compose.js +0 -11
  789. package/src/config.js +0 -71
  790. package/src/custom-error.js +0 -7
  791. package/src/data-set-to-attributes.js +0 -13
  792. package/src/deserializer.js +0 -60
  793. package/src/destroy-error.js +0 -7
  794. package/src/devise.js +0 -151
  795. package/src/draggable-sort/controller.js +0 -137
  796. package/src/draggable-sort/index.jsx +0 -107
  797. package/src/draggable-sort/item.jsx +0 -171
  798. package/src/error-logger.js +0 -111
  799. package/src/error-messages.js +0 -15
  800. package/src/event-connection.jsx +0 -37
  801. package/src/event-emitter-listener.jsx +0 -13
  802. package/src/event-model-class.jsx +0 -28
  803. package/src/events.js +0 -7
  804. package/src/form.jsx +0 -110
  805. package/src/history-expo.js +0 -23
  806. package/src/history-react-native.js +0 -25
  807. package/src/history.js +0 -3
  808. package/src/index.js +0 -3
  809. package/src/inputs/attachment.jsx +0 -108
  810. package/src/inputs/auto-submit.js +0 -37
  811. package/src/inputs/checkbox.jsx +0 -125
  812. package/src/inputs/checkboxes.jsx +0 -116
  813. package/src/inputs/id-for-component.js +0 -15
  814. package/src/inputs/input-wrapper.jsx +0 -16
  815. package/src/inputs/input.jsx +0 -260
  816. package/src/inputs/money.jsx +0 -179
  817. package/src/inputs/name-for-component.js +0 -15
  818. package/src/inputs/select.jsx +0 -104
  819. package/src/instance-of-class-name.js +0 -29
  820. package/src/is-expo.js +0 -18
  821. package/src/key-value-store.js +0 -68
  822. package/src/link.jsx +0 -77
  823. package/src/logger.js +0 -38
  824. package/src/merge-styles.js +0 -15
  825. package/src/modal.jsx +0 -37
  826. package/src/model-class-require.js +0 -17
  827. package/src/model-events.js +0 -39
  828. package/src/model-name.js +0 -33
  829. package/src/model-prop-type.js +0 -124
  830. package/src/model-recipes-loader.js +0 -28
  831. package/src/model-recipes-model-loader.js +0 -350
  832. package/src/models-response-reader.js +0 -48
  833. package/src/models.js +0 -7
  834. package/src/models.js.erb +0 -19
  835. package/src/money-formatter.js +0 -100
  836. package/src/not-loaded-error.js +0 -1
  837. package/src/params.js +0 -66
  838. package/src/preloaded.js +0 -43
  839. package/src/resize-observer.jsx +0 -10
  840. package/src/rest-props-validator.js +0 -9
  841. package/src/result.js +0 -13
  842. package/src/router/route.jsx +0 -246
  843. package/src/router/switch.jsx +0 -76
  844. package/src/router.jsx +0 -47
  845. package/src/routes-native.js +0 -173
  846. package/src/routes.js +0 -58
  847. package/src/run-last.js +0 -39
  848. package/src/serializer.js +0 -76
  849. package/src/services.js +0 -23
  850. package/src/session-status-updater.js +0 -172
  851. package/src/source-maps-loader.js +0 -203
  852. package/src/super-admin/config-reader.jsx +0 -93
  853. package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +0 -84
  854. package/src/super-admin/edit-page/edit-attribute-content.jsx +0 -57
  855. package/src/super-admin/edit-page/edit-attribute-input.jsx +0 -79
  856. package/src/super-admin/edit-page/edit-attribute.jsx +0 -84
  857. package/src/super-admin/edit-page.jsx +0 -117
  858. package/src/super-admin/has-edit-config.js +0 -15
  859. package/src/super-admin/index-page.jsx +0 -23
  860. package/src/super-admin/index.jsx +0 -219
  861. package/src/super-admin/layout/header/index.jsx +0 -144
  862. package/src/super-admin/layout/header/style.scss +0 -45
  863. package/src/super-admin/layout/index.jsx +0 -154
  864. package/src/super-admin/layout/menu/index.jsx +0 -173
  865. package/src/super-admin/layout/menu/menu-content.jsx +0 -43
  866. package/src/super-admin/layout/menu/menu-item.jsx +0 -70
  867. package/src/super-admin/layout/menu/style.scss +0 -11
  868. package/src/super-admin/layout/no-access.jsx +0 -26
  869. package/src/super-admin/model-class-table.jsx +0 -66
  870. package/src/super-admin/models.js +0 -11
  871. package/src/super-admin/show-nav.jsx +0 -45
  872. package/src/super-admin/show-page/belongs-to-attribute-row.jsx +0 -30
  873. package/src/super-admin/show-page/index.jsx +0 -141
  874. package/src/super-admin/show-reflection-actions.jsx +0 -55
  875. package/src/super-admin/show-reflection-link.jsx +0 -40
  876. package/src/super-admin/show-reflection-page.jsx +0 -50
  877. package/src/super-admin/stylesheets/variables.scss +0 -11
  878. package/src/table/column-content.jsx +0 -122
  879. package/src/table/column-identifier.js +0 -23
  880. package/src/table/column-visible.js +0 -7
  881. package/src/table/components/column.jsx +0 -19
  882. package/src/table/components/flat-list.jsx +0 -19
  883. package/src/table/components/header.jsx +0 -21
  884. package/src/table/components/row.jsx +0 -23
  885. package/src/table/filters/attribute-element.jsx +0 -47
  886. package/src/table/filters/filter-form.jsx +0 -448
  887. package/src/table/filters/filter.jsx +0 -74
  888. package/src/table/filters/index.jsx +0 -171
  889. package/src/table/filters/load-search-modal.jsx +0 -157
  890. package/src/table/filters/reflection-element.jsx +0 -38
  891. package/src/table/filters/save-search-modal.jsx +0 -74
  892. package/src/table/filters/scope-element.jsx +0 -44
  893. package/src/table/header-column-content.jsx +0 -55
  894. package/src/table/header-column.jsx +0 -129
  895. package/src/table/header-select.jsx +0 -78
  896. package/src/table/model-callback-args.js +0 -10
  897. package/src/table/model-column.jsx +0 -86
  898. package/src/table/model-row.jsx +0 -140
  899. package/src/table/select-calculator.js +0 -65
  900. package/src/table/settings/column-row.jsx +0 -93
  901. package/src/table/settings/download-action.jsx +0 -73
  902. package/src/table/settings/index.jsx +0 -66
  903. package/src/table/table-settings.js +0 -262
  904. package/src/table/table.jsx +0 -957
  905. package/src/table/use-sorting.js +0 -35
  906. package/src/table/variables.scss +0 -11
  907. package/src/table/widths.jsx +0 -87
  908. package/src/table/worker-plugins-check-all-checkbox.jsx +0 -112
  909. package/src/table/worker-plugins-checkbox.jsx +0 -104
  910. package/src/translated-attributes.js +0 -11
  911. package/src/translated-collections-data.js.erb +0 -5
  912. package/src/translated-collections.js +0 -13
  913. package/src/updated-attribute.jsx +0 -93
  914. package/src/url-encode.js +0 -18
  915. package/src/use-breakpoint.js +0 -100
  916. package/src/use-can-can.js +0 -55
  917. package/src/use-collection.js +0 -280
  918. package/src/use-created-event.js +0 -55
  919. package/src/use-current-user.js +0 -133
  920. package/src/use-destroyed-event.js +0 -60
  921. package/src/use-event-emitter.js +0 -25
  922. package/src/use-event-listener.js +0 -23
  923. package/src/use-input.js +0 -159
  924. package/src/use-model-event.js +0 -60
  925. package/src/use-model.js +0 -189
  926. package/src/use-resize-observer.js +0 -24
  927. package/src/use-router.jsx +0 -128
  928. package/src/use-screen-layout.js +0 -49
  929. package/src/use-styles.js +0 -66
  930. package/src/use-updated-event.js +0 -60
  931. package/src/use-validation-errors.js +0 -33
  932. package/src/utils/button.jsx +0 -127
  933. package/src/utils/card.jsx +0 -58
  934. package/src/utils/checkbox.jsx +0 -73
  935. package/src/utils/checkboxes.jsx +0 -157
  936. package/src/utils/default-style.jsx +0 -80
  937. package/src/utils/header.jsx +0 -14
  938. package/src/utils/icon.jsx +0 -81
  939. package/src/utils/invalid-feedback.jsx +0 -20
  940. package/src/utils/modal.jsx +0 -64
  941. package/src/utils/text.jsx +0 -15
  942. package/src/validation-error.js +0 -35
  943. package/src/validation-errors.js +0 -121
  944. package/src/with-api-maker.jsx +0 -31
  945. package/src/with-collection.jsx +0 -17
  946. package/src/with-current-user.jsx +0 -10
  947. package/src/with-model.jsx +0 -16
  948. 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
- }