remult 0.22.6 → 0.22.7-exp.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (492) hide show
  1. package/SseSubscriptionServer.d.ts +3 -3
  2. package/ably.d.ts +1 -1
  3. package/esm/SseSubscriptionServer.d.ts +3 -3
  4. package/esm/ably.d.ts +1 -1
  5. package/esm/graphql.d.ts +1 -1
  6. package/esm/graphql.js +32 -31
  7. package/esm/index.d.ts +6 -2
  8. package/esm/index.js +5 -5
  9. package/esm/live-query/data-provider-live-query-storage.d.ts +4 -3
  10. package/esm/live-query/data-provider-live-query-storage.js +2 -1
  11. package/esm/postgres/postgres-data-provider.d.ts +3 -3
  12. package/esm/postgres/postgres-data-provider.js +1 -1
  13. package/esm/postgres/schema-builder.d.ts +8 -5
  14. package/esm/postgres/schema-builder.js +52 -15
  15. package/esm/remult-fastify.d.ts +1 -1
  16. package/esm/remult-fresh.d.ts +1 -1
  17. package/esm/remult-fresh.js +1 -1
  18. package/esm/remult-knex/index.d.ts +5 -4
  19. package/esm/remult-knex/index.js +13 -9
  20. package/esm/remult-mongo.d.ts +3 -3
  21. package/esm/remult-mongo.js +5 -4
  22. package/esm/remult-next.d.ts +2 -2
  23. package/esm/remult-next.js +1 -1
  24. package/esm/remult-sveltekit.d.ts +2 -2
  25. package/esm/remult-sveltekit.js +1 -1
  26. package/esm/server/JsonEntityFileStorage.d.ts +2 -1
  27. package/esm/server/JsonEntityFileStorage.js +1 -1
  28. package/esm/server/expressBridge.d.ts +7 -5
  29. package/esm/server/expressBridge.js +11 -8
  30. package/esm/server/index.d.ts +4 -4
  31. package/esm/server/index.js +3 -3
  32. package/esm/server/initDataProvider.d.ts +1 -1
  33. package/esm/src/CompoundIdField.d.ts +27 -0
  34. package/esm/src/CompoundIdField.js +41 -0
  35. package/esm/src/buildRestDataProvider.d.ts +1 -1
  36. package/esm/src/column-interfaces.d.ts +10 -4
  37. package/esm/src/column.d.ts +2 -29
  38. package/esm/src/column.js +2 -58
  39. package/esm/src/context.d.ts +5 -5
  40. package/esm/src/context.js +3 -3
  41. package/esm/src/data-api.d.ts +2 -2
  42. package/esm/src/data-api.js +5 -4
  43. package/esm/src/data-interfaces.d.ts +2 -2
  44. package/esm/src/data-providers/array-entity-data-provider.d.ts +2 -2
  45. package/esm/src/data-providers/array-entity-data-provider.js +2 -2
  46. package/esm/src/data-providers/in-memory-database.d.ts +3 -3
  47. package/esm/src/data-providers/json-data-provider.d.ts +2 -2
  48. package/esm/src/data-providers/rest-data-provider.d.ts +3 -3
  49. package/esm/src/data-providers/rest-data-provider.js +2 -2
  50. package/esm/src/data-providers/sql-database.d.ts +6 -5
  51. package/esm/src/data-providers/sql-database.js +5 -5
  52. package/esm/src/data-providers/web-sql-data-provider.d.ts +4 -4
  53. package/esm/src/data-providers/web-sql-data-provider.js +2 -2
  54. package/esm/src/entity.d.ts +7 -3
  55. package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +5 -5
  56. package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +1 -1
  57. package/esm/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
  58. package/esm/src/filter/filter-consumer-bridge-to-url-builder.js +0 -1
  59. package/esm/src/filter/filter-interfaces.d.ts +4 -3
  60. package/esm/src/filter/filter-interfaces.js +24 -1
  61. package/esm/src/live-query/LiveQueryClient.js +3 -3
  62. package/esm/src/live-query/SseSubscriptionClient.d.ts +1 -1
  63. package/esm/src/live-query/SseSubscriptionClient.js +2 -2
  64. package/esm/src/live-query/SubscriptionChannel.d.ts +1 -1
  65. package/esm/src/live-query/SubscriptionChannel.js +2 -1
  66. package/esm/src/remult-proxy.js +9 -2
  67. package/esm/src/remult3/DecoratorReplacer.d.ts +1 -1
  68. package/esm/src/remult3/RepositoryImplementation.d.ts +9 -40
  69. package/esm/src/remult3/RepositoryImplementation.js +20 -132
  70. package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -0
  71. package/esm/src/remult3/__updateEntityBasedOnWhere.js +24 -0
  72. package/esm/src/remult3/entity.d.ts +28 -0
  73. package/esm/src/remult3/entity.js +70 -0
  74. package/esm/src/remult3/getEntityRef.d.ts +9 -0
  75. package/esm/src/remult3/getEntityRef.js +27 -0
  76. package/esm/src/remult3/remult3.d.ts +7 -7
  77. package/esm/src/resultCompoundIdFilter.d.ts +3 -0
  78. package/esm/src/resultCompoundIdFilter.js +16 -0
  79. package/esm/src/server-action-info.d.ts +10 -0
  80. package/esm/src/server-action-info.js +12 -0
  81. package/esm/src/server-action.d.ts +4 -13
  82. package/esm/src/server-action.js +4 -14
  83. package/esm/src/sort.d.ts +2 -2
  84. package/esm/src/sort.js +1 -1
  85. package/esm/src/sql-command.d.ts +1 -1
  86. package/esm/src/validators.d.ts +1 -1
  87. package/esm/src/valueConverters.d.ts +1 -1
  88. package/graphql.d.ts +1 -1
  89. package/graphql.js +5 -4
  90. package/index.d.ts +6 -2
  91. package/index.js +19 -19
  92. package/live-query/data-provider-live-query-storage.d.ts +4 -3
  93. package/live-query/data-provider-live-query-storage.js +8 -7
  94. package/package.json +1 -1
  95. package/postgres/postgres-data-provider.d.ts +3 -3
  96. package/postgres/postgres-data-provider.js +1 -1
  97. package/postgres/schema-builder.d.ts +8 -5
  98. package/postgres/schema-builder.js +54 -13
  99. package/remult-fastify.d.ts +1 -1
  100. package/remult-fresh.d.ts +1 -1
  101. package/remult-knex/index.d.ts +5 -4
  102. package/remult-knex/index.js +15 -13
  103. package/remult-mongo.d.ts +3 -3
  104. package/remult-mongo.js +4 -3
  105. package/remult-next.d.ts +2 -2
  106. package/remult-sveltekit.d.ts +2 -2
  107. package/server/JsonEntityFileStorage.d.ts +2 -1
  108. package/server/JsonEntityFileStorage.js +1 -1
  109. package/server/expressBridge.d.ts +7 -5
  110. package/server/expressBridge.js +25 -22
  111. package/server/index.d.ts +4 -4
  112. package/server/index.js +5 -5
  113. package/server/initDataProvider.d.ts +1 -1
  114. package/src/CompoundIdField.d.ts +27 -0
  115. package/src/CompoundIdField.js +54 -0
  116. package/src/buildRestDataProvider.d.ts +1 -1
  117. package/src/column-interfaces.d.ts +10 -4
  118. package/src/column.d.ts +2 -29
  119. package/src/column.js +5 -72
  120. package/src/context.d.ts +5 -5
  121. package/src/context.js +5 -5
  122. package/src/data-api.d.ts +2 -2
  123. package/src/data-api.js +7 -6
  124. package/src/data-interfaces.d.ts +2 -2
  125. package/src/data-providers/array-entity-data-provider.d.ts +2 -2
  126. package/src/data-providers/array-entity-data-provider.js +2 -2
  127. package/src/data-providers/in-memory-database.d.ts +3 -3
  128. package/src/data-providers/json-data-provider.d.ts +2 -2
  129. package/src/data-providers/rest-data-provider.d.ts +3 -3
  130. package/src/data-providers/rest-data-provider.js +3 -3
  131. package/src/data-providers/sql-database.d.ts +6 -5
  132. package/src/data-providers/sql-database.js +6 -6
  133. package/src/data-providers/web-sql-data-provider.d.ts +4 -4
  134. package/src/data-providers/web-sql-data-provider.js +4 -4
  135. package/src/entity.d.ts +7 -3
  136. package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +5 -5
  137. package/src/filter/filter-consumer-bridge-to-sql-request.js +2 -2
  138. package/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
  139. package/src/filter/filter-consumer-bridge-to-url-builder.js +0 -2
  140. package/src/filter/filter-interfaces.d.ts +4 -3
  141. package/src/filter/filter-interfaces.js +28 -4
  142. package/src/live-query/LiveQueryClient.js +2 -2
  143. package/src/live-query/SseSubscriptionClient.d.ts +1 -1
  144. package/src/live-query/SseSubscriptionClient.js +3 -3
  145. package/src/live-query/SubscriptionChannel.d.ts +1 -1
  146. package/src/live-query/SubscriptionChannel.js +5 -4
  147. package/src/remult-proxy.js +9 -2
  148. package/src/remult3/DecoratorReplacer.d.ts +1 -1
  149. package/src/remult3/RepositoryImplementation.d.ts +9 -40
  150. package/src/remult3/RepositoryImplementation.js +57 -188
  151. package/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -0
  152. package/src/remult3/__updateEntityBasedOnWhere.js +28 -0
  153. package/src/remult3/entity.d.ts +28 -0
  154. package/src/remult3/entity.js +88 -0
  155. package/src/remult3/getEntityRef.d.ts +9 -0
  156. package/src/remult3/getEntityRef.js +35 -0
  157. package/src/remult3/remult3.d.ts +7 -7
  158. package/src/resultCompoundIdFilter.d.ts +3 -0
  159. package/src/resultCompoundIdFilter.js +20 -0
  160. package/src/server-action-info.d.ts +10 -0
  161. package/src/server-action-info.js +15 -0
  162. package/src/server-action.d.ts +4 -13
  163. package/src/server-action.js +21 -31
  164. package/src/sort.d.ts +2 -2
  165. package/src/sort.js +3 -3
  166. package/src/sql-command.d.ts +1 -1
  167. package/src/validators.d.ts +1 -1
  168. package/src/valueConverters.d.ts +1 -1
  169. package/esm/angular/interfaces/index.d.ts +0 -1
  170. package/esm/angular/interfaces/index.js +0 -1
  171. package/esm/angular/interfaces/src/column-collection.d.ts +0 -70
  172. package/esm/angular/interfaces/src/column-collection.js +0 -341
  173. package/esm/angular/interfaces/src/data-area-settings.d.ts +0 -15
  174. package/esm/angular/interfaces/src/data-area-settings.js +0 -35
  175. package/esm/angular/interfaces/src/data-control-interfaces.d.ts +0 -36
  176. package/esm/angular/interfaces/src/data-control-interfaces.js +0 -57
  177. package/esm/angular/interfaces/src/dataList.d.ts +0 -13
  178. package/esm/angular/interfaces/src/dataList.js +0 -42
  179. package/esm/angular/interfaces/src/filter-helper.d.ts +0 -13
  180. package/esm/angular/interfaces/src/filter-helper.js +0 -59
  181. package/esm/angular/interfaces/src/grid-settings.d.ts +0 -145
  182. package/esm/angular/interfaces/src/grid-settings.js +0 -387
  183. package/esm/angular/interfaces/src/public_api.d.ts +0 -4
  184. package/esm/angular/interfaces/src/public_api.js +0 -4
  185. package/esm/angular/src/angular/RemultAngularPluginsService.d.ts +0 -4
  186. package/esm/angular/src/angular/RemultAngularPluginsService.js +0 -3
  187. package/esm/angular/src/angular/data-control/data-control2.component.d.ts +0 -49
  188. package/esm/angular/src/angular/data-control/data-control2.component.js +0 -138
  189. package/esm/core/SseSubscriptionServer.d.ts +0 -33
  190. package/esm/core/SseSubscriptionServer.js +0 -107
  191. package/esm/core/assign.d.ts +0 -1
  192. package/esm/core/assign.js +0 -5
  193. package/esm/core/classType.d.ts +0 -3
  194. package/esm/core/classType.js +0 -1
  195. package/esm/core/index.d.ts +0 -27
  196. package/esm/core/index.js +0 -25
  197. package/esm/core/inputTypes.d.ts +0 -9
  198. package/esm/core/inputTypes.js +0 -9
  199. package/esm/core/live-query/data-provider-live-query-storage.d.ts +0 -22
  200. package/esm/core/live-query/data-provider-live-query-storage.js +0 -71
  201. package/esm/core/postgres/index.d.ts +0 -2
  202. package/esm/core/postgres/index.js +0 -2
  203. package/esm/core/postgres/postgres-data-provider.d.ts +0 -36
  204. package/esm/core/postgres/postgres-data-provider.js +0 -120
  205. package/esm/core/postgres/schema-builder.d.ts +0 -17
  206. package/esm/core/postgres/schema-builder.js +0 -153
  207. package/esm/core/remult-fresh.d.ts +0 -17
  208. package/esm/core/remult-fresh.js +0 -29
  209. package/esm/core/remult-knex/index.d.ts +0 -30
  210. package/esm/core/remult-knex/index.js +0 -446
  211. package/esm/core/remult-mongo.d.ts +0 -24
  212. package/esm/core/remult-mongo.js +0 -254
  213. package/esm/core/server/JsonEntityFileStorage.d.ts +0 -10
  214. package/esm/core/server/JsonEntityFileStorage.js +0 -25
  215. package/esm/core/server/core.d.ts +0 -4
  216. package/esm/core/server/core.js +0 -4
  217. package/esm/core/server/expressBridge.d.ts +0 -182
  218. package/esm/core/server/expressBridge.js +0 -938
  219. package/esm/core/server/index.d.ts +0 -6
  220. package/esm/core/server/index.js +0 -9
  221. package/esm/core/server/initAsyncHooks.d.ts +0 -1
  222. package/esm/core/server/initAsyncHooks.js +0 -9
  223. package/esm/core/server/initDataProvider.d.ts +0 -2
  224. package/esm/core/server/initDataProvider.js +0 -14
  225. package/esm/core/src/__EntityValueProvider.d.ts +0 -11
  226. package/esm/core/src/__EntityValueProvider.js +0 -1
  227. package/esm/core/src/__RowsOfDataForTesting.d.ts +0 -3
  228. package/esm/core/src/__RowsOfDataForTesting.js +0 -1
  229. package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -6
  230. package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -147
  231. package/esm/core/src/backend-tests/my-test.backend-spec.d.ts +0 -1
  232. package/esm/core/src/backend-tests/my-test.backend-spec.js +0 -197
  233. package/esm/core/src/backend-tests/test-http-server.backend-spec.d.ts +0 -1
  234. package/esm/core/src/backend-tests/test-http-server.backend-spec.js +0 -167
  235. package/esm/core/src/buildRestDataProvider.d.ts +0 -31
  236. package/esm/core/src/buildRestDataProvider.js +0 -113
  237. package/esm/core/src/column-interfaces.d.ts +0 -154
  238. package/esm/core/src/column-interfaces.js +0 -7
  239. package/esm/core/src/column.d.ts +0 -58
  240. package/esm/core/src/column.js +0 -174
  241. package/esm/core/src/context.d.ts +0 -134
  242. package/esm/core/src/context.js +0 -286
  243. package/esm/core/src/data-api.d.ts +0 -39
  244. package/esm/core/src/data-api.js +0 -279
  245. package/esm/core/src/data-interfaces.d.ts +0 -41
  246. package/esm/core/src/data-interfaces.js +0 -12
  247. package/esm/core/src/data-providers/array-entity-data-provider.d.ts +0 -22
  248. package/esm/core/src/data-providers/array-entity-data-provider.js +0 -252
  249. package/esm/core/src/data-providers/in-memory-database.d.ts +0 -9
  250. package/esm/core/src/data-providers/in-memory-database.js +0 -14
  251. package/esm/core/src/data-providers/json-data-provider.d.ts +0 -12
  252. package/esm/core/src/data-providers/json-data-provider.js +0 -55
  253. package/esm/core/src/data-providers/rest-data-provider.d.ts +0 -49
  254. package/esm/core/src/data-providers/rest-data-provider.js +0 -256
  255. package/esm/core/src/data-providers/sql-database.d.ts +0 -33
  256. package/esm/core/src/data-providers/sql-database.js +0 -384
  257. package/esm/core/src/data-providers/web-sql-data-provider.d.ts +0 -24
  258. package/esm/core/src/data-providers/web-sql-data-provider.js +0 -143
  259. package/esm/core/src/entity.d.ts +0 -91
  260. package/esm/core/src/entity.js +0 -1
  261. package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.d.ts +0 -50
  262. package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.js +0 -150
  263. package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
  264. package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.js +0 -1
  265. package/esm/core/src/filter/filter-interfaces.d.ts +0 -85
  266. package/esm/core/src/filter/filter-interfaces.js +0 -477
  267. package/esm/core/src/live-query/LiveQueryClient.d.ts +0 -20
  268. package/esm/core/src/live-query/LiveQueryClient.js +0 -188
  269. package/esm/core/src/live-query/SseSubscriptionClient.d.ts +0 -5
  270. package/esm/core/src/live-query/SseSubscriptionClient.js +0 -86
  271. package/esm/core/src/live-query/SubscriptionChannel.d.ts +0 -72
  272. package/esm/core/src/live-query/SubscriptionChannel.js +0 -123
  273. package/esm/core/src/live-query/SubscriptionServer.d.ts +0 -53
  274. package/esm/core/src/live-query/SubscriptionServer.js +0 -111
  275. package/esm/core/src/live-query/live-query-tests.spec.d.ts +0 -6
  276. package/esm/core/src/live-query/live-query-tests.spec.js +0 -952
  277. package/esm/core/src/remult-proxy.d.ts +0 -35
  278. package/esm/core/src/remult-proxy.js +0 -113
  279. package/esm/core/src/remult3/DecoratorReplacer.d.ts +0 -10
  280. package/esm/core/src/remult3/DecoratorReplacer.js +0 -20
  281. package/esm/core/src/remult3/RepositoryImplementation.d.ts +0 -355
  282. package/esm/core/src/remult3/RepositoryImplementation.js +0 -2109
  283. package/esm/core/src/remult3/index.d.ts +0 -2
  284. package/esm/core/src/remult3/index.js +0 -2
  285. package/esm/core/src/remult3/remult3.d.ts +0 -395
  286. package/esm/core/src/remult3/remult3.js +0 -2
  287. package/esm/core/src/server-action.d.ts +0 -81
  288. package/esm/core/src/server-action.js +0 -394
  289. package/esm/core/src/shared-tests/db-tests-setup.d.ts +0 -32
  290. package/esm/core/src/shared-tests/db-tests-setup.js +0 -78
  291. package/esm/core/src/shared-tests/db-tests.db-tests.d.ts +0 -25
  292. package/esm/core/src/shared-tests/db-tests.db-tests.js +0 -810
  293. package/esm/core/src/shared-tests/deleteAll.d.ts +0 -2
  294. package/esm/core/src/shared-tests/deleteAll.js +0 -4
  295. package/esm/core/src/shared-tests/entityWithValidations.d.ts +0 -14
  296. package/esm/core/src/shared-tests/entityWithValidations.js +0 -43
  297. package/esm/core/src/shared-tests/index.d.ts +0 -4
  298. package/esm/core/src/shared-tests/index.js +0 -4
  299. package/esm/core/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
  300. package/esm/core/src/shared-tests/test-custom-id-column.spec.js +0 -67
  301. package/esm/core/src/shared-tests/test-special-value.spec.d.ts +0 -10
  302. package/esm/core/src/shared-tests/test-special-value.spec.js +0 -73
  303. package/esm/core/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
  304. package/esm/core/src/shared-tests/test-update-with-null.spec.js +0 -31
  305. package/esm/core/src/sort.d.ts +0 -16
  306. package/esm/core/src/sort.js +0 -103
  307. package/esm/core/src/sql-command.d.ts +0 -19
  308. package/esm/core/src/sql-command.js +0 -1
  309. package/esm/core/src/test.d.ts +0 -3
  310. package/esm/core/src/test.js +0 -12
  311. package/esm/core/src/tests/Done.d.ts +0 -5
  312. package/esm/core/src/tests/Done.js +0 -9
  313. package/esm/core/src/tests/RowProvider.spec.d.ts +0 -16
  314. package/esm/core/src/tests/RowProvider.spec.js +0 -631
  315. package/esm/core/src/tests/TestDataApiResponse.d.ts +0 -10
  316. package/esm/core/src/tests/TestDataApiResponse.js +0 -22
  317. package/esm/core/src/tests/basicRowFunctionality.spec.d.ts +0 -8
  318. package/esm/core/src/tests/basicRowFunctionality.spec.js +0 -2103
  319. package/esm/core/src/tests/c.d.ts +0 -8
  320. package/esm/core/src/tests/c.js +0 -13
  321. package/esm/core/src/tests/createData.d.ts +0 -7
  322. package/esm/core/src/tests/createData.js +0 -22
  323. package/esm/core/src/tests/d.d.ts +0 -6
  324. package/esm/core/src/tests/d.js +0 -11
  325. package/esm/core/src/tests/dWithPrefilter.d.ts +0 -7
  326. package/esm/core/src/tests/dWithPrefilter.js +0 -18
  327. package/esm/core/src/tests/entityForCustomFilter.d.ts +0 -16
  328. package/esm/core/src/tests/entityForCustomFilter.js +0 -33
  329. package/esm/core/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
  330. package/esm/core/src/tests/entityWithValidationsOnColumn.js +0 -13
  331. package/esm/core/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
  332. package/esm/core/src/tests/frontend-database-tests-setup.spec.js +0 -37
  333. package/esm/core/src/tests/h.d.ts +0 -6
  334. package/esm/core/src/tests/h.js +0 -24
  335. package/esm/core/src/tests/remult-3-basic-tests.spec.d.ts +0 -1
  336. package/esm/core/src/tests/remult-3-basic-tests.spec.js +0 -236
  337. package/esm/core/src/tests/remult-3-entities.d.ts +0 -23
  338. package/esm/core/src/tests/remult-3-entities.js +0 -39
  339. package/esm/core/src/tests/tasks.d.ts +0 -6
  340. package/esm/core/src/tests/tasks.js +0 -10
  341. package/esm/core/src/tests/test-context-as-storage.spec.d.ts +0 -0
  342. package/esm/core/src/tests/test-context-as-storage.spec.js +0 -1
  343. package/esm/core/src/tests/test-data-api/predefined-filter.spec.d.ts +0 -1
  344. package/esm/core/src/tests/test-data-api/predefined-filter.spec.js +0 -389
  345. package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.d.ts +0 -5
  346. package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.js +0 -152
  347. package/esm/core/src/tests/test-decorator-precedence.spec.d.ts +0 -1
  348. package/esm/core/src/tests/test-decorator-precedence.spec.js +0 -38
  349. package/esm/core/src/tests/test-default-value.spec.d.ts +0 -1
  350. package/esm/core/src/tests/test-default-value.spec.js +0 -33
  351. package/esm/core/src/tests/test-entity-inheritance.spec.d.ts +0 -14
  352. package/esm/core/src/tests/test-entity-inheritance.spec.js +0 -82
  353. package/esm/core/src/tests/test-exceptions.spec.d.ts +0 -1
  354. package/esm/core/src/tests/test-exceptions.spec.js +0 -375
  355. package/esm/core/src/tests/test-json.spec.d.ts +0 -1
  356. package/esm/core/src/tests/test-json.spec.js +0 -115
  357. package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.d.ts +0 -9
  358. package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.js +0 -809
  359. package/esm/core/src/tests/test-non-active-record.spec.d.ts +0 -1
  360. package/esm/core/src/tests/test-non-active-record.spec.js +0 -66
  361. package/esm/core/src/tests/test-object-column.spec.d.ts +0 -1
  362. package/esm/core/src/tests/test-object-column.spec.js +0 -189
  363. package/esm/core/src/tests/test-paged-foreach.spec.d.ts +0 -1
  364. package/esm/core/src/tests/test-paged-foreach.spec.js +0 -328
  365. package/esm/core/src/tests/test-remult-angular.spec.d.ts +0 -1
  366. package/esm/core/src/tests/test-remult-angular.spec.js +0 -23
  367. package/esm/core/src/tests/test-server-controller.spec.d.ts +0 -7
  368. package/esm/core/src/tests/test-server-controller.spec.js +0 -489
  369. package/esm/core/src/tests/test-server-expressions.spec.d.ts +0 -1
  370. package/esm/core/src/tests/test-server-expressions.spec.js +0 -178
  371. package/esm/core/src/tests/test-server-method-on-entity.spec.d.ts +0 -1
  372. package/esm/core/src/tests/test-server-method-on-entity.spec.js +0 -306
  373. package/esm/core/src/tests/test-sql-expression.spec.d.ts +0 -5
  374. package/esm/core/src/tests/test-sql-expression.spec.js +0 -205
  375. package/esm/core/src/tests/test-sql.spec.d.ts +0 -1
  376. package/esm/core/src/tests/test-sql.spec.js +0 -170
  377. package/esm/core/src/tests/test-subscribe.spec.d.ts +0 -1
  378. package/esm/core/src/tests/test-subscribe.spec.js +0 -135
  379. package/esm/core/src/tests/test-type-recovery.spec.d.ts +0 -1
  380. package/esm/core/src/tests/test-type-recovery.spec.js +0 -49
  381. package/esm/core/src/tests/test-where-api.spec.d.ts +0 -1
  382. package/esm/core/src/tests/test-where-api.spec.js +0 -434
  383. package/esm/core/src/tests/testHelper.spec.d.ts +0 -36
  384. package/esm/core/src/tests/testHelper.spec.js +0 -226
  385. package/esm/core/src/tests/testModel/models.d.ts +0 -16
  386. package/esm/core/src/tests/testModel/models.js +0 -25
  387. package/esm/core/src/validators.d.ts +0 -14
  388. package/esm/core/src/validators.js +0 -33
  389. package/esm/core/src/valueConverters.d.ts +0 -13
  390. package/esm/core/src/valueConverters.js +0 -197
  391. package/esm/core/urlBuilder.d.ts +0 -6
  392. package/esm/core/urlBuilder.js +0 -20
  393. package/esm/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -7
  394. package/esm/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -233
  395. package/esm/src/remult3/index.d.ts +0 -2
  396. package/esm/src/remult3/index.js +0 -2
  397. package/esm/src/shared-tests/db-tests-setup.d.ts +0 -34
  398. package/esm/src/shared-tests/db-tests-setup.js +0 -80
  399. package/esm/src/shared-tests/db-tests.db-tests.d.ts +0 -25
  400. package/esm/src/shared-tests/db-tests.db-tests.js +0 -1176
  401. package/esm/src/shared-tests/deleteAll.d.ts +0 -2
  402. package/esm/src/shared-tests/deleteAll.js +0 -4
  403. package/esm/src/shared-tests/entityWithValidations.d.ts +0 -14
  404. package/esm/src/shared-tests/entityWithValidations.js +0 -53
  405. package/esm/src/shared-tests/index.d.ts +0 -4
  406. package/esm/src/shared-tests/index.js +0 -4
  407. package/esm/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
  408. package/esm/src/shared-tests/test-custom-id-column.spec.js +0 -63
  409. package/esm/src/shared-tests/test-special-value.spec.d.ts +0 -10
  410. package/esm/src/shared-tests/test-special-value.spec.js +0 -88
  411. package/esm/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
  412. package/esm/src/shared-tests/test-update-with-null.spec.js +0 -49
  413. package/esm/src/tests/Done.d.ts +0 -5
  414. package/esm/src/tests/Done.js +0 -11
  415. package/esm/src/tests/TestDataApiResponse.d.ts +0 -10
  416. package/esm/src/tests/TestDataApiResponse.js +0 -21
  417. package/esm/src/tests/c.d.ts +0 -8
  418. package/esm/src/tests/c.js +0 -22
  419. package/esm/src/tests/createData.d.ts +0 -7
  420. package/esm/src/tests/createData.js +0 -22
  421. package/esm/src/tests/d.d.ts +0 -6
  422. package/esm/src/tests/d.js +0 -19
  423. package/esm/src/tests/dWithPrefilter.d.ts +0 -7
  424. package/esm/src/tests/dWithPrefilter.js +0 -32
  425. package/esm/src/tests/entityForCustomFilter.d.ts +0 -16
  426. package/esm/src/tests/entityForCustomFilter.js +0 -51
  427. package/esm/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
  428. package/esm/src/tests/entityWithValidationsOnColumn.js +0 -21
  429. package/esm/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
  430. package/esm/src/tests/frontend-database-tests-setup.spec.js +0 -37
  431. package/esm/src/tests/h.d.ts +0 -6
  432. package/esm/src/tests/h.js +0 -35
  433. package/esm/src/tests/remult-3-entities.d.ts +0 -23
  434. package/esm/src/tests/remult-3-entities.js +0 -72
  435. package/esm/src/tests/tasks.d.ts +0 -6
  436. package/esm/src/tests/tasks.js +0 -24
  437. package/esm/src/tests/testHelper.spec.d.ts +0 -36
  438. package/esm/src/tests/testHelper.spec.js +0 -236
  439. package/esm/src/tests/testModel/models.d.ts +0 -16
  440. package/esm/src/tests/testModel/models.js +0 -31
  441. package/esm/test-servers/shared/Task.d.ts +0 -9
  442. package/esm/test-servers/shared/Task.js +0 -32
  443. package/esm/test.d.ts +0 -5
  444. package/esm/test.js +0 -6
  445. package/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -7
  446. package/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -454
  447. package/src/remult3/index.d.ts +0 -2
  448. package/src/remult3/index.js +0 -5
  449. package/src/shared-tests/db-tests-setup.d.ts +0 -34
  450. package/src/shared-tests/db-tests-setup.js +0 -185
  451. package/src/shared-tests/db-tests.db-tests.d.ts +0 -25
  452. package/src/shared-tests/db-tests.db-tests.js +0 -2540
  453. package/src/shared-tests/deleteAll.d.ts +0 -2
  454. package/src/shared-tests/deleteAll.js +0 -21
  455. package/src/shared-tests/entityWithValidations.d.ts +0 -14
  456. package/src/shared-tests/entityWithValidations.js +0 -80
  457. package/src/shared-tests/index.d.ts +0 -4
  458. package/src/shared-tests/index.js +0 -6
  459. package/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
  460. package/src/shared-tests/test-custom-id-column.spec.js +0 -111
  461. package/src/shared-tests/test-special-value.spec.d.ts +0 -10
  462. package/src/shared-tests/test-special-value.spec.js +0 -128
  463. package/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
  464. package/src/shared-tests/test-update-with-null.spec.js +0 -91
  465. package/src/tests/Done.d.ts +0 -5
  466. package/src/tests/Done.js +0 -17
  467. package/src/tests/TestDataApiResponse.d.ts +0 -10
  468. package/src/tests/TestDataApiResponse.js +0 -28
  469. package/src/tests/c.d.ts +0 -8
  470. package/src/tests/c.js +0 -28
  471. package/src/tests/createData.d.ts +0 -7
  472. package/src/tests/createData.js +0 -50
  473. package/src/tests/d.d.ts +0 -6
  474. package/src/tests/d.js +0 -27
  475. package/src/tests/dWithPrefilter.d.ts +0 -7
  476. package/src/tests/dWithPrefilter.js +0 -45
  477. package/src/tests/entityForCustomFilter.d.ts +0 -16
  478. package/src/tests/entityForCustomFilter.js +0 -77
  479. package/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
  480. package/src/tests/entityWithValidationsOnColumn.js +0 -29
  481. package/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
  482. package/src/tests/frontend-database-tests-setup.spec.js +0 -100
  483. package/src/tests/h.d.ts +0 -6
  484. package/src/tests/h.js +0 -44
  485. package/src/tests/remult-3-entities.d.ts +0 -23
  486. package/src/tests/remult-3-entities.js +0 -85
  487. package/src/tests/tasks.d.ts +0 -6
  488. package/src/tests/tasks.js +0 -30
  489. package/src/tests/testHelper.spec.d.ts +0 -36
  490. package/src/tests/testHelper.spec.js +0 -395
  491. package/src/tests/testModel/models.d.ts +0 -16
  492. package/src/tests/testModel/models.js +0 -39
@@ -1,5 +1,6 @@
1
- import { remult as defaultRemult, Sort } from '../../index';
2
1
  import { v4 as uuid } from 'uuid';
2
+ import { Sort } from '../sort';
3
+ import { remult as defaultRemult } from '../remult-proxy';
3
4
  export const streamUrl = 'stream';
4
5
  //@internal
5
6
  export class LiveQuerySubscriber {
@@ -1,8 +1,15 @@
1
+ let defaultRemult;
2
+ function defaultFactory() {
3
+ if (!defaultRemult) {
4
+ defaultRemult = RemultProxy.defaultRemultFactory();
5
+ }
6
+ return defaultRemult;
7
+ }
1
8
  /*@internal*/
2
9
  export class RemultProxy {
3
10
  constructor() {
4
11
  /*@internal*/
5
- this.remultFactory = () => RemultProxy.defaultRemult;
12
+ this.remultFactory = () => defaultFactory();
6
13
  this.repoCache = new Map();
7
14
  //@ts-ignore
8
15
  this.repo = (...args) => {
@@ -147,7 +154,7 @@ export class RemultProxy {
147
154
  }
148
155
  /*@internal*/
149
156
  resetFactory() {
150
- this.remultFactory = () => RemultProxy.defaultRemult;
157
+ this.remultFactory = () => defaultFactory();
151
158
  }
152
159
  get user() {
153
160
  return this.remultFactory().user;
@@ -1,4 +1,4 @@
1
- import { OmitEB } from './remult3';
1
+ import type { OmitEB } from './remult3';
2
2
  declare type Decorator<T = any> = (a: T, b: string, c?: any) => void;
3
3
  declare type Decorators<T> = T extends new (...args: any[]) => infer R ? {
4
4
  [K in keyof OmitEB<R>]?: Decorator;
@@ -1,13 +1,13 @@
1
- import { FieldMetadata, FieldOptions, ValueConverter, ValueListItem } from '../column-interfaces';
2
- import { EntityOptions } from '../entity';
1
+ import type { ClassType } from '../../classType';
3
2
  import { LookupColumn } from '../column';
4
- import { EntityMetadata, FieldRef, FieldsRef, EntityFilter, FindOptions, Repository, EntityRef, QueryOptions, QueryResult, EntityOrderBy, FieldsMetadata, IdMetadata, FindFirstOptionsBase, FindFirstOptions, OmitEB, Subscribable, ControllerRef, LiveQuery } from './remult3';
5
- import { ClassType } from '../../classType';
3
+ import type { FieldMetadata, FieldOptions, ValueConverter, ValueListItem } from '../column-interfaces';
6
4
  import { Remult } from '../context';
7
- import { entityEventListener } from '../__EntityValueProvider';
8
- import { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo } from '../data-interfaces';
9
- import { RefSubscriber } from '.';
10
- import { Unsubscribe } from '../live-query/SubscriptionChannel';
5
+ import type { EntityOptions } from '../entity';
6
+ import type { ControllerRef, EntityFilter, EntityMetadata, EntityOrderBy, EntityRef, FieldRef, FieldsMetadata, FieldsRef, FindFirstOptions, FindFirstOptionsBase, FindOptions, IdMetadata, OmitEB, QueryOptions, QueryResult, Repository, Subscribable } from './remult3';
7
+ import type { RefSubscriber } from './remult3';
8
+ import type { entityEventListener } from '../__EntityValueProvider';
9
+ import type { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo } from '../data-interfaces';
10
+ import type { Unsubscribe } from '../live-query/SubscriptionChannel';
11
11
  export declare class RepositoryImplementation<entityType> implements Repository<entityType> {
12
12
  private entity;
13
13
  remult: Remult;
@@ -45,7 +45,7 @@ export declare class RepositoryImplementation<entityType> implements Repository<
45
45
  private getRefForExistingRow;
46
46
  save(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
47
47
  save(item: Partial<OmitEB<entityType>>): Promise<entityType>;
48
- liveQuery(options?: FindOptions<entityType>): LiveQuery<entityType>;
48
+ liveQuery(options?: FindOptions<entityType>): any;
49
49
  find(options: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
50
50
  buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
51
51
  fromJsonArray(jsonItems: any[], load?: (entity: FieldsMetadata<entityType>) => FieldMetadata[]): Promise<entityType[]>;
@@ -61,12 +61,7 @@ export declare class RepositoryImplementation<entityType> implements Repository<
61
61
  fixTypes(item: any): Promise<any>;
62
62
  findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
63
63
  }
64
- export declare function __updateEntityBasedOnWhere<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>, r: T): void;
65
64
  export declare type EntityOptionsFactory = (remult: Remult) => EntityOptions;
66
- export declare const entityInfo: unique symbol;
67
- export declare const entityInfo_key: unique symbol;
68
- export declare function getEntitySettings<T>(entity: ClassType<T>, throwError?: boolean): EntityOptionsFactory;
69
- export declare function getEntityKey(entity: ClassType<any>): string;
70
65
  export declare const columnsOfType: Map<any, columnInfo[]>;
71
66
  export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
72
67
  declare abstract class rowHelperBase<T> {
@@ -174,7 +169,6 @@ export declare class FieldRefImplementation<entityType, valueType> implements Fi
174
169
  __performValidation(): Promise<void>;
175
170
  validate(): Promise<boolean>;
176
171
  }
177
- export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;
178
172
  export declare const CaptionTransformer: {
179
173
  transformCaption: (remult: Remult, key: string, caption: string) => string;
180
174
  };
@@ -303,31 +297,6 @@ interface columnInfo {
303
297
  key: string;
304
298
  settings: (remult: Remult) => FieldOptions;
305
299
  }
306
- /**Decorates classes that should be used as entities.
307
- * Receives a key and an array of EntityOptions.
308
- * @example
309
- * import { Entity, Fields } from "remult";
310
- * @Entity("tasks", {
311
- * allowApiCrud: true
312
- * })
313
- * export class Task {
314
- * @Fields.uuid()
315
- * id!: string;
316
- * @Fields.string()
317
- * title = '';
318
- * @Fields.boolean()
319
- * completed = false;
320
- * }
321
- * @note
322
- * EntityOptions can be set in two ways:
323
- * @example
324
- * // as an object
325
- * @Entity("tasks",{ allowApiCrud:true })
326
- * @example
327
- * // as an arrow function that receives `remult` as a parameter
328
- * @Entity("tasks", (options,remult) => options.allowApiCrud = true)
329
- */
330
- export declare function Entity<entityType>(key: string, ...options: (EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType> | ((options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>, remult: Remult) => void))[]): (target: any, info?: ClassDecoratorContextStub<entityType extends new (...args: any) => any ? entityType : never>) => any;
331
300
  export declare class EntityBase {
332
301
  get _(): EntityRef<this>;
333
302
  save(): Promise<this>;
@@ -1,18 +1,21 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { CompoundIdField, LookupColumn, makeTitle } from '../column';
3
- import { allEntities, Remult, isBackend, queryConfig as queryConfig, setControllerSettings, } from '../context';
4
- import { Filter, } from '../filter/filter-interfaces';
5
- import { Sort } from '../sort';
6
- import { v4 as uuid } from 'uuid';
7
2
  import { createId } from '@paralleldrive/cuid2';
8
- import { ValueConverters } from '../valueConverters';
9
- import { filterHelper } from '../filter/filter-interfaces';
3
+ import { v4 as uuid } from 'uuid';
4
+ import { LookupColumn, makeTitle } from '../column';
5
+ import { CompoundIdField } from '../CompoundIdField';
6
+ import { Remult, isBackend, queryConfig } from '../context';
7
+ import { Filter } from '../filter/filter-interfaces';
8
+ import { Sort } from '../sort';
10
9
  import { assign } from '../../assign';
11
- import { remult as defaultRemult } from '../remult-proxy';
10
+ import { filterHelper } from '../filter/filter-interfaces';
11
+ import { ValueConverters } from '../valueConverters';
12
12
  import { findOptionsToJson } from '../data-providers/rest-data-provider';
13
- //import { remult } from "../remult-proxy";
13
+ import { remult as defaultRemult } from '../remult-proxy';
14
+ import { entityMember, getEntityKey, getEntityRef, getEntitySettings, } from './getEntityRef';
15
+ import { __updateEntityBasedOnWhere } from './__updateEntityBasedOnWhere';
16
+ //import { remult } from "../remult-proxy";
14
17
  let classValidatorValidate = undefined;
15
- // import("class-validator".toString())
18
+ // import ("class-validator".toString())
16
19
  // .then((v) => {
17
20
  // classValidatorValidate = (item, ref) => {
18
21
  // return v.validate(item).then(errors => {
@@ -507,7 +510,7 @@ export class RepositoryImplementation {
507
510
  }
508
511
  /* @internal*/
509
512
  async translateWhereToFilter(where) {
510
- if (this.metadata.options.backendPrefilter && isBackend()) {
513
+ if (this.metadata.options.backendPrefilter && !this.dataProvider.isProxy) {
511
514
  let z = where;
512
515
  where = {
513
516
  $and: [z, await Filter.resolve(this.metadata.options.backendPrefilter)],
@@ -520,48 +523,6 @@ export class RepositoryImplementation {
520
523
  return r;
521
524
  }
522
525
  }
523
- export function __updateEntityBasedOnWhere(entityDefs, where, r) {
524
- let w = Filter.fromEntityFilter(entityDefs, where);
525
- const emptyFunction = () => { };
526
- if (w) {
527
- w.__applyToConsumer({
528
- custom: emptyFunction,
529
- databaseCustom: emptyFunction,
530
- containsCaseInsensitive: emptyFunction,
531
- isDifferentFrom: emptyFunction,
532
- isEqualTo: (col, val) => {
533
- r[col.key] = val;
534
- },
535
- isGreaterOrEqualTo: emptyFunction,
536
- isGreaterThan: emptyFunction,
537
- isIn: emptyFunction,
538
- isLessOrEqualTo: emptyFunction,
539
- isLessThan: emptyFunction,
540
- isNotNull: emptyFunction,
541
- isNull: emptyFunction,
542
- or: emptyFunction,
543
- });
544
- }
545
- }
546
- export const entityInfo = Symbol('entityInfo');
547
- export const entityInfo_key = Symbol('entityInfo_key');
548
- const entityMember = Symbol('entityMember');
549
- export function getEntitySettings(entity, throwError = true) {
550
- if (entity === undefined)
551
- if (throwError) {
552
- throw new Error('Undefined is not an entity :)');
553
- }
554
- else
555
- return undefined;
556
- let info = Reflect.getMetadata(entityInfo, entity);
557
- if (!info && throwError)
558
- throw new Error(entity.prototype.constructor.name +
559
- " is not a known entity, did you forget to set @Entity() or did you forget to add the '@' before the call to Entity?");
560
- return info;
561
- }
562
- export function getEntityKey(entity) {
563
- return Reflect.getMetadata(entityInfo_key, entity);
564
- }
565
526
  export const columnsOfType = new Map();
566
527
  export function createOldEntity(entity, remult) {
567
528
  let r = columnsOfType.get(entity);
@@ -937,7 +898,9 @@ export class rowHelperImplementation extends rowHelperBase {
937
898
  if (this.wasDeleted())
938
899
  throw new Error('cannot save a deleted row');
939
900
  this.isLoading = true;
940
- if (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject === undefined) // no need
901
+ if (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject ===
902
+ undefined)
903
+ // no need
941
904
  await this.__validateEntity();
942
905
  let doNotSave = false;
943
906
  for (const col of this.fields) {
@@ -952,7 +915,8 @@ export class rowHelperImplementation extends rowHelperBase {
952
915
  let ignoreKeys = [];
953
916
  for (const field of this.metadata.fields) {
954
917
  if (field.dbReadOnly ||
955
- (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject !== undefined &&
918
+ (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject !==
919
+ undefined &&
956
920
  !onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject.includes(field.key))) {
957
921
  d[field.key] = undefined;
958
922
  ignoreKeys.push(field.key);
@@ -1287,14 +1251,6 @@ export class FieldRefImplementation {
1287
1251
  return !!!this.error;
1288
1252
  }
1289
1253
  }
1290
- export function getEntityRef(entity, throwException = true) {
1291
- let x = entity[entityMember];
1292
- if (!x && throwException)
1293
- throw new Error('item ' +
1294
- entity.constructor.name +
1295
- ' was not initialized using a context');
1296
- return x;
1297
- }
1298
1254
  export const CaptionTransformer = {
1299
1255
  transformCaption: (remult, key, caption) => caption,
1300
1256
  };
@@ -1754,7 +1710,7 @@ export function getValueList(type) {
1754
1710
  * title='';
1755
1711
  */
1756
1712
  export function Field(valueType, ...options) {
1757
- // IMPORTANT!!!! if you call this in another decorator, make sure to set It's return type correctly with the | undefined
1713
+ // import ANT!!!! if you call this in another decorator, make sure to set It's return type correctly with the | undefined
1758
1714
  return (target, context, c) => {
1759
1715
  const key = typeof context === 'string' ? context : context.name.toString();
1760
1716
  let factory = (remult) => {
@@ -1898,74 +1854,6 @@ export function decorateColumnSettings(settings, remult) {
1898
1854
  }
1899
1855
  return settings;
1900
1856
  }
1901
- //[ ] YONI - in Typescript 5 I do get the name of the class, what would we like to change because of that?
1902
- /**Decorates classes that should be used as entities.
1903
- * Receives a key and an array of EntityOptions.
1904
- * @example
1905
- * import { Entity, Fields } from "remult";
1906
- * @Entity("tasks", {
1907
- * allowApiCrud: true
1908
- * })
1909
- * export class Task {
1910
- * @Fields.uuid()
1911
- * id!: string;
1912
- * @Fields.string()
1913
- * title = '';
1914
- * @Fields.boolean()
1915
- * completed = false;
1916
- * }
1917
- * @note
1918
- * EntityOptions can be set in two ways:
1919
- * @example
1920
- * // as an object
1921
- * @Entity("tasks",{ allowApiCrud:true })
1922
- * @example
1923
- * // as an arrow function that receives `remult` as a parameter
1924
- * @Entity("tasks", (options,remult) => options.allowApiCrud = true)
1925
- */
1926
- export function Entity(key, ...options) {
1927
- return (target, info) => {
1928
- for (const rawFilterMember in target) {
1929
- if (Object.prototype.hasOwnProperty.call(target, rawFilterMember)) {
1930
- const element = target[rawFilterMember];
1931
- if (element?.rawFilterInfo?.rawFilterTranslator) {
1932
- if (!element.rawFilterInfo.key)
1933
- element.rawFilterInfo.key = rawFilterMember;
1934
- }
1935
- }
1936
- }
1937
- let factory = (remult) => {
1938
- let r = {};
1939
- for (const o of options) {
1940
- if (o) {
1941
- if (typeof o === 'function')
1942
- o(r, remult);
1943
- else
1944
- Object.assign(r, o);
1945
- }
1946
- }
1947
- let base = Object.getPrototypeOf(target);
1948
- if (base) {
1949
- let baseFactory = getEntitySettings(base, false);
1950
- if (baseFactory) {
1951
- let opt = baseFactory(remult);
1952
- if (opt) {
1953
- r = {
1954
- ...opt,
1955
- ...r,
1956
- };
1957
- }
1958
- }
1959
- }
1960
- return r;
1961
- };
1962
- allEntities.push(target);
1963
- setControllerSettings(target, { key });
1964
- Reflect.defineMetadata(entityInfo, factory, target);
1965
- Reflect.defineMetadata(entityInfo_key, key, target);
1966
- return target;
1967
- };
1968
- }
1969
1857
  export class EntityBase {
1970
1858
  get _() {
1971
1859
  return getEntityRef(this);
@@ -0,0 +1,2 @@
1
+ import type { EntityFilter, EntityMetadata } from './remult3';
2
+ export declare function __updateEntityBasedOnWhere<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>, r: T): void;
@@ -0,0 +1,24 @@
1
+ import { Filter } from '../filter/filter-interfaces';
2
+ export function __updateEntityBasedOnWhere(entityDefs, where, r) {
3
+ let w = Filter.fromEntityFilter(entityDefs, where);
4
+ const emptyFunction = () => { };
5
+ if (w) {
6
+ w.__applyToConsumer({
7
+ custom: emptyFunction,
8
+ databaseCustom: emptyFunction,
9
+ containsCaseInsensitive: emptyFunction,
10
+ isDifferentFrom: emptyFunction,
11
+ isEqualTo: (col, val) => {
12
+ r[col.key] = val;
13
+ },
14
+ isGreaterOrEqualTo: emptyFunction,
15
+ isGreaterThan: emptyFunction,
16
+ isIn: emptyFunction,
17
+ isLessOrEqualTo: emptyFunction,
18
+ isLessThan: emptyFunction,
19
+ isNotNull: emptyFunction,
20
+ isNull: emptyFunction,
21
+ or: emptyFunction,
22
+ });
23
+ }
24
+ }
@@ -0,0 +1,28 @@
1
+ import type { Remult } from '../context';
2
+ import type { EntityOptions } from '../entity';
3
+ import type { ClassDecoratorContextStub } from './RepositoryImplementation';
4
+ /**Decorates classes that should be used as entities.
5
+ * Receives a key and an array of EntityOptions.
6
+ * @example
7
+ * import { Entity, Fields } from "remult";
8
+ * @Entity("tasks", {
9
+ * allowApiCrud: true
10
+ * })
11
+ * export class Task {
12
+ * @Fields.uuid()
13
+ * id!: string;
14
+ * @Fields.string()
15
+ * title = '';
16
+ * @Fields.boolean()
17
+ * completed = false;
18
+ * }
19
+ * @note
20
+ * EntityOptions can be set in two ways:
21
+ * @example
22
+ * // as an object
23
+ * @Entity("tasks",{ allowApiCrud:true })
24
+ * @example
25
+ * // as an arrow function that receives `remult` as a parameter
26
+ * @Entity("tasks", (options,remult) => options.allowApiCrud = true)
27
+ */
28
+ export declare function Entity<entityType>(key: string, ...options: (EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType> | ((options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>, remult: Remult) => void))[]): (target: any, info?: ClassDecoratorContextStub<entityType extends new (...args: any) => any ? entityType : never>) => any;
@@ -0,0 +1,70 @@
1
+ import { allEntities, setControllerSettings } from '../context';
2
+ import { entityInfo, entityInfo_key, getEntitySettings } from './getEntityRef';
3
+ //[ ] YONI - in Typescript 5 I do get the name of the class, what would we like to change because of that?
4
+ /**Decorates classes that should be used as entities.
5
+ * Receives a key and an array of EntityOptions.
6
+ * @example
7
+ * import { Entity, Fields } from "remult";
8
+ * @Entity("tasks", {
9
+ * allowApiCrud: true
10
+ * })
11
+ * export class Task {
12
+ * @Fields.uuid()
13
+ * id!: string;
14
+ * @Fields.string()
15
+ * title = '';
16
+ * @Fields.boolean()
17
+ * completed = false;
18
+ * }
19
+ * @note
20
+ * EntityOptions can be set in two ways:
21
+ * @example
22
+ * // as an object
23
+ * @Entity("tasks",{ allowApiCrud:true })
24
+ * @example
25
+ * // as an arrow function that receives `remult` as a parameter
26
+ * @Entity("tasks", (options,remult) => options.allowApiCrud = true)
27
+ */
28
+ export function Entity(key, ...options) {
29
+ return (target, info) => {
30
+ for (const rawFilterMember in target) {
31
+ if (Object.prototype.hasOwnProperty.call(target, rawFilterMember)) {
32
+ const element = target[rawFilterMember];
33
+ if (element?.rawFilterInfo?.rawFilterTranslator) {
34
+ if (!element.rawFilterInfo.key)
35
+ element.rawFilterInfo.key = rawFilterMember;
36
+ }
37
+ }
38
+ }
39
+ let factory = (remult) => {
40
+ let r = {};
41
+ for (const o of options) {
42
+ if (o) {
43
+ if (typeof o === 'function')
44
+ o(r, remult);
45
+ else
46
+ Object.assign(r, o);
47
+ }
48
+ }
49
+ let base = Object.getPrototypeOf(target);
50
+ if (base) {
51
+ let baseFactory = getEntitySettings(base, false);
52
+ if (baseFactory) {
53
+ let opt = baseFactory(remult);
54
+ if (opt) {
55
+ r = {
56
+ ...opt,
57
+ ...r,
58
+ };
59
+ }
60
+ }
61
+ }
62
+ return r;
63
+ };
64
+ allEntities.push(target);
65
+ setControllerSettings(target, { key });
66
+ Reflect.defineMetadata(entityInfo, factory, target);
67
+ Reflect.defineMetadata(entityInfo_key, key, target);
68
+ return target;
69
+ };
70
+ }
@@ -0,0 +1,9 @@
1
+ import type { ClassType } from '../../classType';
2
+ import type { EntityOptionsFactory } from './RepositoryImplementation';
3
+ import type { EntityRef } from './remult3';
4
+ export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;
5
+ export declare const entityMember: unique symbol;
6
+ export declare const entityInfo: unique symbol;
7
+ export declare const entityInfo_key: unique symbol;
8
+ export declare function getEntitySettings<T>(entity: ClassType<T>, throwError?: boolean): EntityOptionsFactory;
9
+ export declare function getEntityKey(entity: ClassType<any>): string;
@@ -0,0 +1,27 @@
1
+ export function getEntityRef(entity, throwException = true) {
2
+ let x = entity[entityMember];
3
+ if (!x && throwException)
4
+ throw new Error('item ' +
5
+ entity.constructor.name +
6
+ ' was not initialized using a context');
7
+ return x;
8
+ }
9
+ export const entityMember = Symbol('entityMember');
10
+ export const entityInfo = Symbol('entityInfo');
11
+ export const entityInfo_key = Symbol('entityInfo_key');
12
+ export function getEntitySettings(entity, throwError = true) {
13
+ if (entity === undefined)
14
+ if (throwError) {
15
+ throw new Error('Undefined is not an entity :)');
16
+ }
17
+ else
18
+ return undefined;
19
+ let info = Reflect.getMetadata(entityInfo, entity);
20
+ if (!info && throwError)
21
+ throw new Error(entity.prototype.constructor.name +
22
+ " is not a known entity, did you forget to set @Entity() or did you forget to add the '@' before the call to Entity?");
23
+ return info;
24
+ }
25
+ export function getEntityKey(entity) {
26
+ return Reflect.getMetadata(entityInfo_key, entity);
27
+ }
@@ -1,10 +1,10 @@
1
- import { ClassType } from '../../classType';
2
- import { FieldMetadata } from '../column-interfaces';
3
- import { LiveQueryChange, SubscriptionListener, Unsubscribe } from '../live-query/SubscriptionChannel';
4
- import { EntityOptions } from '../entity';
5
- import { SortSegment } from '../sort';
6
- import { entityEventListener } from '../__EntityValueProvider';
7
- import { ErrorInfo } from '../..';
1
+ import type { ErrorInfo } from '../..';
2
+ import type { ClassType } from '../../classType';
3
+ import type { entityEventListener } from '../__EntityValueProvider';
4
+ import type { FieldMetadata } from '../column-interfaces';
5
+ import type { EntityOptions } from '../entity';
6
+ import type { LiveQueryChange, SubscriptionListener, Unsubscribe } from '../live-query/SubscriptionChannel';
7
+ import type { SortSegment } from '../sort';
8
8
  export interface EntityRef<entityType> extends Subscribable {
9
9
  hasErrors(): boolean;
10
10
  undoChanges(): any;
@@ -0,0 +1,3 @@
1
+ import type { CompoundIdField } from './CompoundIdField';
2
+ import { Filter } from './filter/filter-interfaces';
3
+ export declare function resultCompoundIdFilter(idField: CompoundIdField, id: string, data: any): Filter;
@@ -0,0 +1,16 @@
1
+ import { Filter } from './filter/filter-interfaces';
2
+ export function resultCompoundIdFilter(idField, id, data) {
3
+ return new Filter((add) => {
4
+ let idParts = [];
5
+ if (id != undefined)
6
+ idParts = id.split(',');
7
+ idField.fields.forEach((c, i) => {
8
+ let val = undefined;
9
+ if (i < idParts.length)
10
+ val = idParts[i];
11
+ if (data[c.key] != undefined)
12
+ val = data[c.key];
13
+ add.isEqualTo(c, val);
14
+ });
15
+ });
16
+ }
@@ -0,0 +1,10 @@
1
+ export declare const actionInfo: {
2
+ allActions: any[];
3
+ runningOnServer: boolean;
4
+ runActionWithoutBlockingUI: <T>(what: () => Promise<T>) => Promise<T>;
5
+ startBusyWithProgress: () => {
6
+ progress: (percent: number) => void;
7
+ close: () => void;
8
+ };
9
+ };
10
+ export declare const serverActionField: unique symbol;
@@ -0,0 +1,12 @@
1
+ export const actionInfo = {
2
+ allActions: [],
3
+ runningOnServer: false,
4
+ runActionWithoutBlockingUI: (what) => {
5
+ return what();
6
+ },
7
+ startBusyWithProgress: () => ({
8
+ progress: (percent) => { },
9
+ close: () => { },
10
+ }),
11
+ };
12
+ export const serverActionField = Symbol('serverActionField');
@@ -1,7 +1,8 @@
1
1
  import 'reflect-metadata';
2
- import { Remult, AllowedForInstance } from './context';
3
- import { DataApiResponse } from './data-api';
4
- import { DataProvider, RestDataProviderHttpProvider } from './data-interfaces';
2
+ import type { AllowedForInstance } from './context';
3
+ import { Remult } from './context';
4
+ import type { DataApiResponse } from './data-api';
5
+ import type { DataProvider, RestDataProviderHttpProvider } from './data-interfaces';
5
6
  interface inArgs {
6
7
  args: any[];
7
8
  }
@@ -44,16 +45,6 @@ export interface BackendMethodOptions<type> {
44
45
  blockUser?: boolean;
45
46
  paramTypes?: any[];
46
47
  }
47
- export declare const actionInfo: {
48
- allActions: any[];
49
- runningOnServer: boolean;
50
- runActionWithoutBlockingUI: <T>(what: () => Promise<T>) => Promise<T>;
51
- startBusyWithProgress: () => {
52
- progress: (percent: number) => void;
53
- close: () => void;
54
- };
55
- };
56
- export declare const serverActionField: unique symbol;
57
48
  export declare function Controller(key: string): (target: any, context?: any) => any;
58
49
  export interface ClassMethodDecoratorContextStub<This = unknown, Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any> {
59
50
  readonly kind: 'method';
@@ -1,9 +1,11 @@
1
1
  import 'reflect-metadata';
2
- import { Remult, allEntities, classHelpers, ClassHelper, setControllerSettings, doTransaction, isBackend, } from './context';
3
2
  import { buildRestDataProvider } from './buildRestDataProvider';
3
+ import { ClassHelper, Remult, allEntities, classHelpers, doTransaction, isBackend, setControllerSettings, } from './context';
4
4
  import { SqlDatabase } from './data-providers/sql-database';
5
- import { getEntityRef, decorateColumnSettings, getEntitySettings, getControllerRef, checkTarget, } from './remult3';
6
5
  import { remult } from './remult-proxy';
6
+ import { checkTarget, decorateColumnSettings, getControllerRef, } from './remult3/RepositoryImplementation';
7
+ import { getEntityRef, getEntitySettings } from './remult3/getEntityRef';
8
+ import { actionInfo, serverActionField } from './server-action-info';
7
9
  export class Action {
8
10
  constructor(actionUrl, queue, allowed) {
9
11
  this.actionUrl = actionUrl;
@@ -92,18 +94,6 @@ export class myServerAction extends Action {
92
94
  return result;
93
95
  }
94
96
  }
95
- export const actionInfo = {
96
- allActions: [],
97
- runningOnServer: false,
98
- runActionWithoutBlockingUI: (what) => {
99
- return what();
100
- },
101
- startBusyWithProgress: () => ({
102
- progress: (percent) => { },
103
- close: () => { },
104
- }),
105
- };
106
- export const serverActionField = Symbol('serverActionField');
107
97
  const classOptions = new Map();
108
98
  export function Controller(key) {
109
99
  return function (target, context) {
package/esm/src/sort.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { FieldMetadata } from './column-interfaces';
2
- import { EntityMetadata, EntityOrderBy } from './remult3';
1
+ import type { FieldMetadata } from './column-interfaces';
2
+ import type { EntityMetadata, EntityOrderBy } from './remult3/remult3';
3
3
  export declare class Sort {
4
4
  toEntityOrderBy(): EntityOrderBy<any>;
5
5
  constructor(...segments: SortSegment[]);
package/esm/src/sort.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CompoundIdField } from './column';
1
+ import { CompoundIdField } from './CompoundIdField';
2
2
  export class Sort {
3
3
  constructor(...segments) {
4
4
  this.Segments = segments;
@@ -1,4 +1,4 @@
1
- import { EntityMetadata } from './remult3';
1
+ import type { EntityMetadata } from './remult3/remult3';
2
2
  export interface SqlImplementation {
3
3
  getLimitSqlSyntax(limit: number, offset: number): any;
4
4
  createCommand(): SqlCommand;