@webda/core 3.16.4 → 4.0.0-beta.2

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 (452) hide show
  1. package/lib/application.d.ts +29 -8
  2. package/lib/application.d.ts.map +1 -0
  3. package/lib/application.js +65 -38
  4. package/lib/application.js.map +1 -1
  5. package/lib/application.spec.d.ts +1 -0
  6. package/lib/application.spec.d.ts.map +1 -0
  7. package/lib/application.spec.js +57 -43
  8. package/lib/application.spec.js.map +1 -1
  9. package/lib/core.d.ts +16 -12
  10. package/lib/core.d.ts.map +1 -0
  11. package/lib/core.js +105 -80
  12. package/lib/core.js.map +1 -1
  13. package/lib/core.spec.d.ts +1 -0
  14. package/lib/core.spec.d.ts.map +1 -0
  15. package/lib/core.spec.js +96 -67
  16. package/lib/core.spec.js.map +1 -1
  17. package/lib/errors.d.ts +59 -60
  18. package/lib/errors.d.ts.map +1 -0
  19. package/lib/errors.js +92 -108
  20. package/lib/errors.js.map +1 -1
  21. package/lib/errors.spec.d.ts +1 -0
  22. package/lib/errors.spec.d.ts.map +1 -0
  23. package/lib/errors.spec.js +1 -1
  24. package/lib/errors.spec.js.map +1 -1
  25. package/lib/index.d.ts +6 -3
  26. package/lib/index.d.ts.map +1 -0
  27. package/lib/index.js +6 -3
  28. package/lib/index.js.map +1 -1
  29. package/lib/models/aclmodel.d.ts +2 -2
  30. package/lib/models/aclmodel.d.ts.map +1 -0
  31. package/lib/models/aclmodel.js +8 -9
  32. package/lib/models/aclmodel.js.map +1 -1
  33. package/lib/models/aclmodel.spec.d.ts +1 -0
  34. package/lib/models/aclmodel.spec.d.ts.map +1 -0
  35. package/lib/models/aclmodel.spec.js +3 -3
  36. package/lib/models/aclmodel.spec.js.map +1 -1
  37. package/lib/models/coremodel.d.ts +15 -0
  38. package/lib/models/coremodel.d.ts.map +1 -0
  39. package/lib/models/coremodel.js +35 -28
  40. package/lib/models/coremodel.js.map +1 -1
  41. package/lib/models/coremodel.spec.d.ts +1 -0
  42. package/lib/models/coremodel.spec.d.ts.map +1 -0
  43. package/lib/models/coremodel.spec.js +33 -31
  44. package/lib/models/coremodel.spec.js.map +1 -1
  45. package/lib/models/deployment.d.ts +1 -0
  46. package/lib/models/deployment.d.ts.map +1 -0
  47. package/lib/models/ident.d.ts +17 -2
  48. package/lib/models/ident.d.ts.map +1 -0
  49. package/lib/models/ident.js +0 -14
  50. package/lib/models/ident.js.map +1 -1
  51. package/lib/models/ident.spec.d.ts +1 -0
  52. package/lib/models/ident.spec.d.ts.map +1 -0
  53. package/lib/models/ident.spec.js +1 -20
  54. package/lib/models/ident.spec.js.map +1 -1
  55. package/lib/models/ownermodel.d.ts +1 -0
  56. package/lib/models/ownermodel.d.ts.map +1 -0
  57. package/lib/models/ownermodel.spec.d.ts +1 -0
  58. package/lib/models/ownermodel.spec.d.ts.map +1 -0
  59. package/lib/models/ownermodel.spec.js +57 -33
  60. package/lib/models/ownermodel.spec.js.map +1 -1
  61. package/lib/models/relations.d.ts +1 -0
  62. package/lib/models/relations.d.ts.map +1 -0
  63. package/lib/models/relations.js +3 -3
  64. package/lib/models/relations.js.map +1 -1
  65. package/lib/models/relations.spec.d.ts +2 -0
  66. package/lib/models/relations.spec.d.ts.map +1 -0
  67. package/lib/models/relations.spec.js +10 -17
  68. package/lib/models/relations.spec.js.map +1 -1
  69. package/lib/models/rolemodel.d.ts +1 -0
  70. package/lib/models/rolemodel.d.ts.map +1 -0
  71. package/lib/models/rolemodel.js +2 -2
  72. package/lib/models/rolemodel.js.map +1 -1
  73. package/lib/models/rolemodel.spec.d.ts +1 -0
  74. package/lib/models/rolemodel.spec.d.ts.map +1 -0
  75. package/lib/models/rolemodel.spec.js +5 -1
  76. package/lib/models/rolemodel.spec.js.map +1 -1
  77. package/lib/models/simpleuser.d.ts +47 -0
  78. package/lib/models/simpleuser.d.ts.map +1 -0
  79. package/lib/models/simpleuser.js +84 -0
  80. package/lib/models/simpleuser.js.map +1 -0
  81. package/lib/models/test.d.ts +11 -0
  82. package/lib/models/test.d.ts.map +1 -0
  83. package/lib/models/test.js +7 -0
  84. package/lib/models/test.js.map +1 -0
  85. package/lib/models/user.d.ts +2 -35
  86. package/lib/models/user.d.ts.map +1 -0
  87. package/lib/models/user.js +3 -74
  88. package/lib/models/user.js.map +1 -1
  89. package/lib/models/user.spec.d.ts +1 -0
  90. package/lib/models/user.spec.d.ts.map +1 -0
  91. package/lib/models/user.spec.js +7 -6
  92. package/lib/models/user.spec.js.map +1 -1
  93. package/lib/queues/filequeue.d.ts +1 -0
  94. package/lib/queues/filequeue.d.ts.map +1 -0
  95. package/lib/queues/filequeue.js +5 -5
  96. package/lib/queues/filequeue.js.map +1 -1
  97. package/lib/queues/filequeue.spec.d.ts +1 -0
  98. package/lib/queues/filequeue.spec.d.ts.map +1 -0
  99. package/lib/queues/filequeue.spec.js +11 -5
  100. package/lib/queues/filequeue.spec.js.map +1 -1
  101. package/lib/queues/memoryqueue.d.ts +14 -0
  102. package/lib/queues/memoryqueue.d.ts.map +1 -0
  103. package/lib/queues/memoryqueue.js +38 -7
  104. package/lib/queues/memoryqueue.js.map +1 -1
  105. package/lib/queues/memoryqueue.spec.d.ts +1 -0
  106. package/lib/queues/memoryqueue.spec.d.ts.map +1 -0
  107. package/lib/queues/memoryqueue.spec.js +18 -7
  108. package/lib/queues/memoryqueue.spec.js.map +1 -1
  109. package/lib/queues/pubsubservice.d.ts +1 -0
  110. package/lib/queues/pubsubservice.d.ts.map +1 -0
  111. package/lib/queues/queue.spec.d.ts +3 -2
  112. package/lib/queues/queue.spec.d.ts.map +1 -0
  113. package/lib/queues/queue.spec.js +5 -3
  114. package/lib/queues/queue.spec.js.map +1 -1
  115. package/lib/queues/queueservice.d.ts +1 -0
  116. package/lib/queues/queueservice.d.ts.map +1 -0
  117. package/lib/queues/queueservice.js +7 -7
  118. package/lib/queues/queueservice.js.map +1 -1
  119. package/lib/rest/restdomainservice.d.ts +63 -0
  120. package/lib/rest/restdomainservice.d.ts.map +1 -0
  121. package/lib/rest/restdomainservice.js +687 -0
  122. package/lib/rest/restdomainservice.js.map +1 -0
  123. package/lib/rest/restdomainservice.spec.d.ts +2 -0
  124. package/lib/rest/restdomainservice.spec.d.ts.map +1 -0
  125. package/lib/rest/restdomainservice.spec.js +124 -0
  126. package/lib/rest/restdomainservice.spec.js.map +1 -0
  127. package/lib/{router.d.ts → rest/router.d.ts} +6 -4
  128. package/lib/rest/router.d.ts.map +1 -0
  129. package/lib/{router.js → rest/router.js} +33 -23
  130. package/lib/rest/router.js.map +1 -0
  131. package/lib/rest/router.spec.d.ts +2 -0
  132. package/lib/rest/router.spec.d.ts.map +1 -0
  133. package/lib/{router.spec.js → rest/router.spec.js} +54 -28
  134. package/lib/rest/router.spec.js.map +1 -0
  135. package/lib/services/asyncevents.d.ts +1 -0
  136. package/lib/services/asyncevents.d.ts.map +1 -0
  137. package/lib/services/asyncevents.js +4 -4
  138. package/lib/services/asyncevents.js.map +1 -1
  139. package/lib/services/asyncevents.spec.d.ts +1 -0
  140. package/lib/services/asyncevents.spec.d.ts.map +1 -0
  141. package/lib/services/asyncevents.spec.js +10 -10
  142. package/lib/services/asyncevents.spec.js.map +1 -1
  143. package/lib/services/authentication.d.ts +2 -1
  144. package/lib/services/authentication.d.ts.map +1 -0
  145. package/lib/services/authentication.js +26 -25
  146. package/lib/services/authentication.js.map +1 -1
  147. package/lib/services/authentication.spec.d.ts +1 -0
  148. package/lib/services/authentication.spec.d.ts.map +1 -0
  149. package/lib/services/authentication.spec.js +24 -24
  150. package/lib/services/authentication.spec.js.map +1 -1
  151. package/lib/services/binary.d.ts +13 -87
  152. package/lib/services/binary.d.ts.map +1 -0
  153. package/lib/services/binary.js +39 -421
  154. package/lib/services/binary.js.map +1 -1
  155. package/lib/services/binary.spec.d.ts +19 -22
  156. package/lib/services/binary.spec.d.ts.map +1 -0
  157. package/lib/services/binary.spec.js +87 -374
  158. package/lib/services/binary.spec.js.map +1 -1
  159. package/lib/services/cloudbinary.d.ts +3 -2
  160. package/lib/services/cloudbinary.d.ts.map +1 -0
  161. package/lib/services/cloudbinary.js +1 -1
  162. package/lib/services/cloudbinary.js.map +1 -1
  163. package/lib/services/cloudbinary.spec.d.ts +1 -8
  164. package/lib/services/cloudbinary.spec.d.ts.map +1 -0
  165. package/lib/services/cloudbinary.spec.js +4 -130
  166. package/lib/services/cloudbinary.spec.js.map +1 -1
  167. package/lib/services/configuration.d.ts +10 -1
  168. package/lib/services/configuration.d.ts.map +1 -0
  169. package/lib/services/configuration.js +22 -7
  170. package/lib/services/configuration.js.map +1 -1
  171. package/lib/services/configuration.spec.d.ts +1 -0
  172. package/lib/services/configuration.spec.d.ts.map +1 -0
  173. package/lib/services/configuration.spec.js +60 -17
  174. package/lib/services/configuration.spec.js.map +1 -1
  175. package/lib/services/cron.d.ts +2 -1
  176. package/lib/services/cron.d.ts.map +1 -0
  177. package/lib/services/cron.js +10 -10
  178. package/lib/services/cron.js.map +1 -1
  179. package/lib/services/cron.spec.d.ts +1 -0
  180. package/lib/services/cron.spec.d.ts.map +1 -0
  181. package/lib/services/cron.spec.js +2 -2
  182. package/lib/services/cron.spec.js.map +1 -1
  183. package/lib/services/cryptoservice.d.ts +3 -2
  184. package/lib/services/cryptoservice.d.ts.map +1 -0
  185. package/lib/services/cryptoservice.js +29 -30
  186. package/lib/services/cryptoservice.js.map +1 -1
  187. package/lib/services/cryptoservice.spec.d.ts +1 -0
  188. package/lib/services/cryptoservice.spec.d.ts.map +1 -0
  189. package/lib/services/cryptoservice.spec.js +17 -17
  190. package/lib/services/cryptoservice.spec.js.map +1 -1
  191. package/lib/services/debugmailer.d.ts +2 -2
  192. package/lib/services/debugmailer.d.ts.map +1 -0
  193. package/lib/services/debugmailer.js +1 -2
  194. package/lib/services/debugmailer.js.map +1 -1
  195. package/lib/services/debugmailer.spec.d.ts +1 -0
  196. package/lib/services/debugmailer.spec.d.ts.map +1 -0
  197. package/lib/services/debugmailer.spec.js +6 -3
  198. package/lib/services/debugmailer.spec.js.map +1 -1
  199. package/lib/services/domainservice.d.ts +167 -47
  200. package/lib/services/domainservice.d.ts.map +1 -0
  201. package/lib/services/domainservice.js +520 -753
  202. package/lib/services/domainservice.js.map +1 -1
  203. package/lib/services/domainservice.spec.d.ts +1 -0
  204. package/lib/services/domainservice.spec.d.ts.map +1 -0
  205. package/lib/services/domainservice.spec.js +201 -31
  206. package/lib/services/domainservice.spec.js.map +1 -1
  207. package/lib/services/filebinary.d.ts +8 -5
  208. package/lib/services/filebinary.d.ts.map +1 -0
  209. package/lib/services/filebinary.js +34 -32
  210. package/lib/services/filebinary.js.map +1 -1
  211. package/lib/services/filebinary.spec.d.ts +12 -8
  212. package/lib/services/filebinary.spec.d.ts.map +1 -0
  213. package/lib/services/filebinary.spec.js +135 -122
  214. package/lib/services/filebinary.spec.js.map +1 -1
  215. package/lib/services/fileconfiguration.d.ts +2 -1
  216. package/lib/services/fileconfiguration.d.ts.map +1 -0
  217. package/lib/services/fileconfiguration.js +1 -1
  218. package/lib/services/fileconfiguration.js.map +1 -1
  219. package/lib/services/fileconfiguration.spec.d.ts +1 -0
  220. package/lib/services/fileconfiguration.spec.d.ts.map +1 -0
  221. package/lib/services/fileconfiguration.spec.js +65 -27
  222. package/lib/services/fileconfiguration.spec.js.map +1 -1
  223. package/lib/services/invitationservice.d.ts +2 -1
  224. package/lib/services/invitationservice.d.ts.map +1 -0
  225. package/lib/services/invitationservice.js +19 -16
  226. package/lib/services/invitationservice.js.map +1 -1
  227. package/lib/services/invitationservice.spec.d.ts +1 -0
  228. package/lib/services/invitationservice.spec.d.ts.map +1 -0
  229. package/lib/services/invitationservice.spec.js +73 -22
  230. package/lib/services/invitationservice.spec.js.map +1 -1
  231. package/lib/services/kubernetesconfiguration.d.ts +1 -0
  232. package/lib/services/kubernetesconfiguration.d.ts.map +1 -0
  233. package/lib/services/kubernetesconfiguration.js +0 -2
  234. package/lib/services/kubernetesconfiguration.js.map +1 -1
  235. package/lib/services/kubernetesconfiguration.spec.d.ts +1 -0
  236. package/lib/services/kubernetesconfiguration.spec.d.ts.map +1 -0
  237. package/lib/services/kubernetesconfiguration.spec.js +67 -8
  238. package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
  239. package/lib/services/mailer.d.ts +1 -0
  240. package/lib/services/mailer.d.ts.map +1 -0
  241. package/lib/services/mailer.js +3 -3
  242. package/lib/services/mailer.js.map +1 -1
  243. package/lib/services/mailer.spec.d.ts +1 -0
  244. package/lib/services/mailer.spec.d.ts.map +1 -0
  245. package/lib/services/mailer.spec.js +18 -4
  246. package/lib/services/mailer.spec.js.map +1 -1
  247. package/lib/services/notificationservice.d.ts +1 -0
  248. package/lib/services/notificationservice.d.ts.map +1 -0
  249. package/lib/services/notificationservice.js +1 -1
  250. package/lib/services/notificationservice.js.map +1 -1
  251. package/lib/services/notificationservice.spec.d.ts +1 -0
  252. package/lib/services/notificationservice.spec.d.ts.map +1 -0
  253. package/lib/services/notificationservice.spec.js +8 -3
  254. package/lib/services/notificationservice.spec.js.map +1 -1
  255. package/lib/services/oauth.d.ts +6 -3
  256. package/lib/services/oauth.d.ts.map +1 -0
  257. package/lib/services/oauth.js +11 -8
  258. package/lib/services/oauth.js.map +1 -1
  259. package/lib/services/oauth.spec.d.ts +1 -0
  260. package/lib/services/oauth.spec.d.ts.map +1 -0
  261. package/lib/services/oauth.spec.js +39 -15
  262. package/lib/services/oauth.spec.js.map +1 -1
  263. package/lib/services/prometheus.d.ts +1 -0
  264. package/lib/services/prometheus.d.ts.map +1 -0
  265. package/lib/services/prometheus.spec.d.ts +1 -0
  266. package/lib/services/prometheus.spec.d.ts.map +1 -0
  267. package/lib/services/prometheus.spec.js +38 -19
  268. package/lib/services/prometheus.spec.js.map +1 -1
  269. package/lib/services/resource.d.ts +21 -1
  270. package/lib/services/resource.d.ts.map +1 -0
  271. package/lib/services/resource.js +20 -3
  272. package/lib/services/resource.js.map +1 -1
  273. package/lib/services/resource.spec.d.ts +1 -0
  274. package/lib/services/resource.spec.d.ts.map +1 -0
  275. package/lib/services/resource.spec.js +38 -20
  276. package/lib/services/resource.spec.js.map +1 -1
  277. package/lib/services/service.d.ts +2 -2
  278. package/lib/services/service.d.ts.map +1 -0
  279. package/lib/services/service.js +13 -23
  280. package/lib/services/service.js.map +1 -1
  281. package/lib/services/service.spec.d.ts +1 -0
  282. package/lib/services/service.spec.d.ts.map +1 -0
  283. package/lib/services/service.spec.js +58 -40
  284. package/lib/services/service.spec.js.map +1 -1
  285. package/lib/stores/aggregator.d.ts +10 -3
  286. package/lib/stores/aggregator.d.ts.map +1 -0
  287. package/lib/stores/aggregator.js +6 -6
  288. package/lib/stores/aggregator.js.map +1 -1
  289. package/lib/stores/file.d.ts +3 -2
  290. package/lib/stores/file.d.ts.map +1 -0
  291. package/lib/stores/file.js +13 -13
  292. package/lib/stores/file.js.map +1 -1
  293. package/lib/stores/file.spec.d.ts +5 -11
  294. package/lib/stores/file.spec.d.ts.map +1 -0
  295. package/lib/stores/file.spec.js +20 -114
  296. package/lib/stores/file.spec.js.map +1 -1
  297. package/lib/stores/mapper.d.ts +2 -1
  298. package/lib/stores/mapper.d.ts.map +1 -0
  299. package/lib/stores/mapper.js +12 -12
  300. package/lib/stores/mapper.js.map +1 -1
  301. package/lib/stores/mapper.spec.d.ts +1 -0
  302. package/lib/stores/mapper.spec.d.ts.map +1 -0
  303. package/lib/stores/mapper.spec.js +24 -17
  304. package/lib/stores/mapper.spec.js.map +1 -1
  305. package/lib/stores/memory.d.ts +2 -1
  306. package/lib/stores/memory.d.ts.map +1 -0
  307. package/lib/stores/memory.js +15 -15
  308. package/lib/stores/memory.js.map +1 -1
  309. package/lib/stores/memory.spec.d.ts +7 -13
  310. package/lib/stores/memory.spec.d.ts.map +1 -0
  311. package/lib/stores/memory.spec.js +118 -183
  312. package/lib/stores/memory.spec.js.map +1 -1
  313. package/lib/stores/modelmapper.d.ts +1 -0
  314. package/lib/stores/modelmapper.d.ts.map +1 -0
  315. package/lib/stores/modelmapper.js +8 -10
  316. package/lib/stores/modelmapper.js.map +1 -1
  317. package/lib/stores/store.d.ts +4 -145
  318. package/lib/stores/store.d.ts.map +1 -0
  319. package/lib/stores/store.js +54 -654
  320. package/lib/stores/store.js.map +1 -1
  321. package/lib/stores/store.spec.d.ts +11 -19
  322. package/lib/stores/store.spec.d.ts.map +1 -0
  323. package/lib/stores/store.spec.js +99 -268
  324. package/lib/stores/store.spec.js.map +1 -1
  325. package/lib/test.d.ts +109 -6
  326. package/lib/test.d.ts.map +1 -0
  327. package/lib/test.js +245 -22
  328. package/lib/test.js.map +1 -1
  329. package/lib/unpackedapplication.d.ts +3 -2
  330. package/lib/unpackedapplication.d.ts.map +1 -0
  331. package/lib/unpackedapplication.js +29 -16
  332. package/lib/unpackedapplication.js.map +1 -1
  333. package/lib/utils/abstractdeployer.d.ts +1 -0
  334. package/lib/utils/abstractdeployer.d.ts.map +1 -0
  335. package/lib/utils/abstractdeployer.spec.d.ts +1 -0
  336. package/lib/utils/abstractdeployer.spec.d.ts.map +1 -0
  337. package/lib/utils/case.d.ts +1 -0
  338. package/lib/utils/case.d.ts.map +1 -0
  339. package/lib/utils/case.spec.d.ts +1 -0
  340. package/lib/utils/case.spec.d.ts.map +1 -0
  341. package/lib/utils/context.d.ts +37 -17
  342. package/lib/utils/context.d.ts.map +1 -0
  343. package/lib/utils/context.js +53 -42
  344. package/lib/utils/context.js.map +1 -1
  345. package/lib/utils/context.spec.d.ts +1 -0
  346. package/lib/utils/context.spec.d.ts.map +1 -0
  347. package/lib/utils/context.spec.js +21 -14
  348. package/lib/utils/context.spec.js.map +1 -1
  349. package/lib/utils/cookie.d.ts +1 -0
  350. package/lib/utils/cookie.d.ts.map +1 -0
  351. package/lib/utils/cookie.js +2 -2
  352. package/lib/utils/cookie.js.map +1 -1
  353. package/lib/utils/cookie.spec.d.ts +1 -0
  354. package/lib/utils/cookie.spec.d.ts.map +1 -0
  355. package/lib/utils/cookie.spec.js +20 -10
  356. package/lib/utils/cookie.spec.js.map +1 -1
  357. package/lib/utils/esm.d.ts +1 -0
  358. package/lib/utils/esm.d.ts.map +1 -0
  359. package/lib/utils/httpcontext.d.ts +1 -0
  360. package/lib/utils/httpcontext.d.ts.map +1 -0
  361. package/lib/utils/httpcontext.js +7 -7
  362. package/lib/utils/httpcontext.js.map +1 -1
  363. package/lib/utils/httpcontext.spec.d.ts +1 -0
  364. package/lib/utils/httpcontext.spec.d.ts.map +1 -0
  365. package/lib/utils/httpcontext.spec.js +7 -7
  366. package/lib/utils/httpcontext.spec.js.map +1 -1
  367. package/lib/utils/logger.d.ts +1 -0
  368. package/lib/utils/logger.d.ts.map +1 -0
  369. package/lib/utils/logger.spec.d.ts +1 -0
  370. package/lib/utils/logger.spec.d.ts.map +1 -0
  371. package/lib/utils/logger.spec.js +5 -5
  372. package/lib/utils/logger.spec.js.map +1 -1
  373. package/lib/utils/serializers.d.ts +6 -4
  374. package/lib/utils/serializers.d.ts.map +1 -0
  375. package/lib/utils/serializers.js +30 -27
  376. package/lib/utils/serializers.js.map +1 -1
  377. package/lib/utils/serializers.spec.d.ts +1 -0
  378. package/lib/utils/serializers.spec.d.ts.map +1 -0
  379. package/lib/utils/serializers.spec.js +12 -14
  380. package/lib/utils/serializers.spec.js.map +1 -1
  381. package/lib/utils/session.d.ts +2 -5
  382. package/lib/utils/session.d.ts.map +1 -0
  383. package/lib/utils/session.js +1 -11
  384. package/lib/utils/session.js.map +1 -1
  385. package/lib/utils/session.spec.d.ts +1 -0
  386. package/lib/utils/session.spec.d.ts.map +1 -0
  387. package/lib/utils/session.spec.js +22 -12
  388. package/lib/utils/session.spec.js.map +1 -1
  389. package/lib/utils/throttler.d.ts +1 -4
  390. package/lib/utils/throttler.d.ts.map +1 -0
  391. package/lib/utils/throttler.js +1 -9
  392. package/lib/utils/throttler.js.map +1 -1
  393. package/lib/utils/throttler.spec.d.ts +1 -0
  394. package/lib/utils/throttler.spec.d.ts.map +1 -0
  395. package/lib/utils/throttler.spec.js +4 -6
  396. package/lib/utils/throttler.spec.js.map +1 -1
  397. package/lib/utils/waiter.d.ts +1 -0
  398. package/lib/utils/waiter.d.ts.map +1 -0
  399. package/lib/utils/waiter.js +3 -3
  400. package/lib/utils/waiter.js.map +1 -1
  401. package/lib/utils/waiter.spec.d.ts +1 -0
  402. package/lib/utils/waiter.spec.d.ts.map +1 -0
  403. package/lib/utils/waiter.spec.js +6 -6
  404. package/lib/utils/waiter.spec.js.map +1 -1
  405. package/package.json +20 -16
  406. package/test/config.json +6 -90
  407. package/test/data/.env +1 -0
  408. package/webda.module.json +607 -377
  409. package/lib/router.js.map +0 -1
  410. package/lib/router.spec.d.ts +0 -1
  411. package/lib/router.spec.js.map +0 -1
  412. package/lib/stores/aliasstore.d.ts +0 -108
  413. package/lib/stores/aliasstore.js +0 -168
  414. package/lib/stores/aliasstore.js.map +0 -1
  415. package/lib/stores/aliasstore.spec.d.ts +0 -11
  416. package/lib/stores/aliasstore.spec.js +0 -89
  417. package/lib/stores/aliasstore.spec.js.map +0 -1
  418. package/lib/stores/webdaql/WebdaQLLexer.d.ts +0 -54
  419. package/lib/stores/webdaql/WebdaQLLexer.js +0 -295
  420. package/lib/stores/webdaql/WebdaQLLexer.js.map +0 -1
  421. package/lib/stores/webdaql/WebdaQLParserLexer.d.ts +0 -54
  422. package/lib/stores/webdaql/WebdaQLParserLexer.js +0 -295
  423. package/lib/stores/webdaql/WebdaQLParserLexer.js.map +0 -1
  424. package/lib/stores/webdaql/WebdaQLParserListener.d.ts +0 -296
  425. package/lib/stores/webdaql/WebdaQLParserListener.js +0 -3
  426. package/lib/stores/webdaql/WebdaQLParserListener.js.map +0 -1
  427. package/lib/stores/webdaql/WebdaQLParserParser.d.ts +0 -311
  428. package/lib/stores/webdaql/WebdaQLParserParser.js +0 -1807
  429. package/lib/stores/webdaql/WebdaQLParserParser.js.map +0 -1
  430. package/lib/stores/webdaql/WebdaQLParserVisitor.d.ts +0 -181
  431. package/lib/stores/webdaql/WebdaQLParserVisitor.js +0 -3
  432. package/lib/stores/webdaql/WebdaQLParserVisitor.js.map +0 -1
  433. package/lib/stores/webdaql/query.d.ts +0 -390
  434. package/lib/stores/webdaql/query.js +0 -702
  435. package/lib/stores/webdaql/query.js.map +0 -1
  436. package/lib/stores/webdaql/query.spec.d.ts +0 -1
  437. package/lib/stores/webdaql/query.spec.js +0 -206
  438. package/lib/stores/webdaql/query.spec.js.map +0 -1
  439. package/test/config-file-missing-file-no-default.json +0 -44
  440. package/test/config-file-missing-file.json +0 -55
  441. package/test/config-file-no-reload.json +0 -69
  442. package/test/config-file-reload.json +0 -68
  443. package/test/config-invitation.json +0 -63
  444. package/test/config-kube-reload.json +0 -68
  445. package/test/config-reload.json +0 -66
  446. package/test/config.old.json +0 -152
  447. package/test/moddas/annotatedservice.js +0 -23
  448. package/test/moddas/debugmailer.js +0 -13
  449. package/test/moddas/fakeservice.js +0 -4
  450. package/test/moddas/voidstore.js +0 -66
  451. package/test/models/ident.js +0 -36
  452. package/test/models/task.js +0 -42
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -12,7 +11,6 @@ import * as path from "path";
12
11
  import { Readable } from "stream";
13
12
  import { Core, Counter, WebdaError } from "../index.js";
14
13
  import { NotEnumerable } from "../models/coremodel.js";
15
- import { Store } from "../stores/store.js";
16
14
  import { Service, ServiceParameters } from "./service.js";
17
15
  /**
18
16
  * Emitted if binary does not exist
@@ -76,7 +74,7 @@ export class BinaryFile {
76
74
  resolve();
77
75
  });
78
76
  stream.on("data", chunk => {
79
- let buffer = Buffer.from(chunk);
77
+ const buffer = Buffer.from(chunk);
80
78
  hash.update(buffer);
81
79
  challenge.update(buffer);
82
80
  });
@@ -211,6 +209,7 @@ export class Binary extends BinaryMap {
211
209
  async delete() {
212
210
  await this.__store.delete(this.model, this.attribute);
213
211
  this.set({});
212
+ this.empty = true;
214
213
  }
215
214
  /**
216
215
  * Return undefined if no hash
@@ -267,7 +266,7 @@ export class BinariesImpl extends Array {
267
266
  assign(model, attribute) {
268
267
  this.model = model;
269
268
  this.attribute = attribute;
270
- for (let binary of model[attribute] || []) {
269
+ for (const binary of model[attribute] || []) {
271
270
  this.push(binary);
272
271
  }
273
272
  this.__service = Core.get().getBinaryStore(model, attribute);
@@ -330,14 +329,11 @@ __decorate([
330
329
  export class BinaryParameters extends ServiceParameters {
331
330
  constructor(params, _service) {
332
331
  super(params);
333
- if (this.expose) {
334
- this.expose.restrict = this.expose.restrict || {};
335
- }
336
- this.map ?? (this.map = {});
337
332
  // Store all models in it by default
338
333
  this.models ?? (this.models = {
339
334
  "*": ["*"]
340
335
  });
336
+ this.maxFileSize ?? (this.maxFileSize = 10 * 1024 * 1024);
341
337
  }
342
338
  }
343
339
  /**
@@ -386,65 +382,6 @@ export class BinaryService extends Service {
386
382
  help: "Number of binary metadata updated"
387
383
  });
388
384
  }
389
- /**
390
- * Redirect to the temporary link to S3 object
391
- * or return it if returnInfo=true
392
- *
393
- * @param ctx of the request
394
- * @param returnInfo
395
- */
396
- async httpGet(context) {
397
- const returnInfo = context.getHttpContext().getRelativeUri().endsWith("/url");
398
- const { uuid, index, property } = context.getParameters();
399
- let targetStore = this._verifyMapAndStore(context);
400
- let object = await targetStore.get(uuid);
401
- if (!object || (Array.isArray(object[property]) && object[property].length <= index)) {
402
- throw new WebdaError.NotFound("Object does not exist or attachment does not exist");
403
- }
404
- await object.checkAct(context, "get_binary");
405
- const file = Array.isArray(object[property]) ? object[property][index] : object[property];
406
- await this.emitSync("Binary.Get", {
407
- object: file,
408
- service: this,
409
- context: context
410
- });
411
- let url = await this.getRedirectUrlFromObject(file, context);
412
- // No url, we return the file
413
- if (url === null) {
414
- if (returnInfo) {
415
- // Redirect to same url without /url
416
- context.write({
417
- Location: context
418
- .getHttpContext()
419
- .getAbsoluteUrl()
420
- .replace(/\/url$/, ""),
421
- Map: file
422
- });
423
- }
424
- else {
425
- // Output
426
- context.writeHead(200, {
427
- "Content-Type": file.mimetype === undefined ? "application/octet-steam" : file.mimetype,
428
- "Content-Length": file.size
429
- });
430
- let readStream = await this.get(file);
431
- await new Promise((resolve, reject) => {
432
- // We replaced all the event handlers with a simple call to readStream.pipe()
433
- context._stream.on("finish", resolve);
434
- context._stream.on("error", reject);
435
- readStream.pipe(context._stream);
436
- });
437
- }
438
- }
439
- else if (returnInfo) {
440
- context.write({ Location: url, Map: file });
441
- }
442
- else {
443
- context.writeHead(302, {
444
- Location: url
445
- });
446
- }
447
- }
448
385
  /**
449
386
  * Get a UrlFromObject
450
387
  *
@@ -462,7 +399,7 @@ export class BinaryService extends Service {
462
399
  let key = Object.keys(this.parameters.models).find(k => k === modelName);
463
400
  if (key) {
464
401
  // Explicit model
465
- let attributes = this.parameters.models[key];
402
+ const attributes = this.parameters.models[key];
466
403
  if (attributes.includes(attribute)) {
467
404
  return 2;
468
405
  }
@@ -475,7 +412,7 @@ export class BinaryService extends Service {
475
412
  if (!key) {
476
413
  return -1;
477
414
  }
478
- let attributes = this.parameters.models[key];
415
+ const attributes = this.parameters.models[key];
479
416
  if (attributes.includes(attribute)) {
480
417
  return 1;
481
418
  }
@@ -510,8 +447,8 @@ export class BinaryService extends Service {
510
447
  service: this
511
448
  });
512
449
  this.metrics.download.inc();
513
- let readStream = await this._get(info);
514
- let writeStream = fs.createWriteStream(filename);
450
+ const readStream = await this._get(info);
451
+ const writeStream = fs.createWriteStream(filename);
515
452
  return new Promise((resolve, reject) => {
516
453
  writeStream.on("finish", _src => {
517
454
  return resolve();
@@ -530,45 +467,6 @@ export class BinaryService extends Service {
530
467
  readStream.pipe(writeStream);
531
468
  });
532
469
  }
533
- /**
534
- * @override
535
- */
536
- resolve() {
537
- super.resolve();
538
- this.initMap(this.parameters.map);
539
- return this;
540
- }
541
- /**
542
- * Init the declared maps, adding reverse maps
543
- *
544
- * @param map
545
- */
546
- initMap(map) {
547
- if (map == undefined || map._init) {
548
- return;
549
- }
550
- this._lowercaseMaps = {};
551
- Object.keys(map).forEach(prop => {
552
- this._lowercaseMaps[prop.toLowerCase()] = prop;
553
- let reverseStore = this._webda.getService(prop);
554
- if (reverseStore === undefined || !(reverseStore instanceof Store)) {
555
- this._webda.log("WARN", "Can't setup mapping as store ", prop, " doesn't exist");
556
- map[prop]["-onerror"] = "NoStore";
557
- return;
558
- }
559
- for (let i in map[prop]) {
560
- reverseStore.addReverseMap(map[prop][i], this);
561
- }
562
- // Cascade delete
563
- reverseStore.on("Store.Deleted", async (evt) => {
564
- let infos = [];
565
- if (evt.object[map[prop]]) {
566
- infos.push(...evt.object[map[prop]]);
567
- }
568
- await Promise.all(infos.map(info => this.cascadeDelete(info, evt.object.getUuid())));
569
- });
570
- });
571
- }
572
470
  /**
573
471
  * Based on the raw Map init a BinaryMap
574
472
  * @param obj
@@ -602,40 +500,13 @@ export class BinaryService extends Service {
602
500
  if (this.handleBinary(object.__type, property) !== -1) {
603
501
  return;
604
502
  }
605
- // DELETE_IN_4.0.0
606
- const name = object.getStore().getName();
607
- let map = this.parameters.map[this._lowercaseMaps[name.toLowerCase()]];
608
- if (map === undefined) {
609
- throw new Error("Unknown mapping");
610
- }
611
- if (Array.isArray(map) && map.indexOf(property) === -1) {
612
- throw new Error("Unknown mapping");
613
- }
614
- /*
615
- // END_DELETE_IN_4.0.0
616
503
  throw new Error("Unknown mapping");
617
- // DELETE_IN_4.0.0
618
- */
619
- // END_DELETE_IN_4.0.0
620
504
  }
621
505
  /**
622
506
  * Ensure events are sent correctly after an upload and update the BinaryFileInfo in targetted object
623
507
  */
624
- async uploadSuccess(object, property, fileInfo) {
625
- let file;
626
- // Ensure we do not have a full object
627
- if (fileInfo["toBinaryFileInfo"] && typeof fileInfo["toBinaryFileInfo"] === "function") {
628
- file = fileInfo["toBinaryFileInfo"]();
629
- }
630
- else {
631
- file = fileInfo;
632
- }
633
- let additionalAttrs = Object.keys(file).filter(k => !["name", "size", "mimetype", "hash", "challenge", "metadata"].includes(k));
634
- if (additionalAttrs.length > 0) {
635
- throw new Error("Invalid file object it should be a plain BinaryFileInfo found additional properties: " +
636
- additionalAttrs.join(","));
637
- }
638
- let object_uid = object.getUuid();
508
+ async uploadSuccess(object, property, file) {
509
+ const object_uid = object.getUuid();
639
510
  // Check if the file is already in the array then skip
640
511
  if (Array.isArray(object[property]) && object[property].find(i => i.hash === file.hash)) {
641
512
  return;
@@ -648,7 +519,9 @@ export class BinaryService extends Service {
648
519
  const relations = this.getWebda().getApplication().getRelations(object);
649
520
  const cardinality = (relations.binaries || []).find(p => p.attribute === property)?.cardinality || "MANY";
650
521
  if (cardinality === "MANY") {
651
- await object.getStore().upsertItemToCollection(object_uid, property, file);
522
+ await object
523
+ .getStore()
524
+ .upsertItemToCollection(object_uid, property, file);
652
525
  }
653
526
  else {
654
527
  await object.getStore().setAttribute(object_uid, property, file);
@@ -669,12 +542,14 @@ export class BinaryService extends Service {
669
542
  * @returns
670
543
  */
671
544
  async deleteSuccess(object, property, index) {
672
- let info = (index !== undefined ? object[property][index] : object[property]);
545
+ const info = (index !== undefined ? object[property][index] : object[property]);
673
546
  const relations = this.getWebda().getApplication().getRelations(object);
674
547
  const cardinality = (relations.binaries || []).find(p => p.attribute === property)?.cardinality || "MANY";
675
548
  let update;
676
549
  if (cardinality === "MANY") {
677
- update = object.getStore().deleteItemFromCollection(object.getUuid(), property, index, info.hash, "hash");
550
+ update = object
551
+ .getStore()
552
+ .deleteItemFromCollection(object.getUuid(), property, index, info.hash, "hash");
678
553
  }
679
554
  else {
680
555
  object.getStore().removeAttribute(object.getUuid(), property);
@@ -691,178 +566,26 @@ export class BinaryService extends Service {
691
566
  * @param req
692
567
  * @returns
693
568
  */
694
- async _getFile(req) {
695
- let file = await req.getHttpContext().getRawBody(10 * 1024 * 1024);
696
- // TODO Check if we have other type
569
+ async getFile(req) {
570
+ const { size } = req.getParameters();
571
+ let { mimetype, name } = req.getParameters();
572
+ if (size > this.parameters.maxFileSize) {
573
+ throw new WebdaError.BadRequest("File too big");
574
+ }
575
+ const file = await req.getRawInput(size ?? this.parameters.maxFileSize);
576
+ mimetype ?? (mimetype = "application/octet-stream");
577
+ name ?? (name = "data.bin");
697
578
  return new MemoryBinaryFile(Buffer.from(file), {
698
- mimetype: req.getHttpContext().getUniqueHeader("Content-Type", "application/octet-stream"),
699
- size: parseInt(req.getHttpContext().getUniqueHeader("Content-Length")) || file.length,
700
- name: req.getHttpContext().getUniqueHeader("X-Filename", "")
579
+ mimetype,
580
+ size,
581
+ name: name,
582
+ hash: crypto.createHash("md5").update(file).digest("hex"),
583
+ challenge: crypto
584
+ .createHash("md5")
585
+ .update("WEBDA" + file)
586
+ .digest("hex")
701
587
  });
702
588
  }
703
- /**
704
- * @override
705
- */
706
- initRoutes() {
707
- if (!this.parameters.expose) {
708
- return;
709
- }
710
- this._initRoutes();
711
- }
712
- /**
713
- * Init the Binary system routes
714
- *
715
- * Making sure parameters.expose exists prior
716
- */
717
- _initRoutes() {
718
- let url;
719
- let name = this.getOperationName();
720
- if (!this.parameters.expose.restrict.get) {
721
- url = this.parameters.expose.url + "/{store}/{uuid}/{property}/{index}";
722
- this.addRoute(url, ["GET"], this.httpGet, {
723
- get: {
724
- operationId: `get${name}Binary`,
725
- description: "Download a binary linked to an object",
726
- summary: "Download a binary",
727
- responses: {
728
- "200": {
729
- description: "Binary stream"
730
- },
731
- "403": {
732
- description: "You don't have permissions"
733
- },
734
- "404": {
735
- description: "Object does not exist or attachment does not exist"
736
- },
737
- "412": {
738
- description: "Provided hash does not match"
739
- }
740
- }
741
- }
742
- });
743
- this.addRoute(url + "/url", ["GET"], this.httpGet, {
744
- get: {
745
- operationId: `get${name}BinaryInfo`,
746
- description: "Return the url and information of a binary linked to an object",
747
- summary: "GetInfo of a binary",
748
- responses: {
749
- "200": {
750
- description: "Url and BinaryMap"
751
- },
752
- "403": {
753
- description: "You don't have permissions"
754
- },
755
- "404": {
756
- description: "Object does not exist or attachment does not exist"
757
- },
758
- "412": {
759
- description: "Provided hash does not match"
760
- }
761
- }
762
- }
763
- });
764
- }
765
- if (!this.parameters.expose.restrict.create) {
766
- // No need the index to add file
767
- url = this.parameters.expose.url + "/{store}/{uuid}/{property}";
768
- this.addRoute(url, ["POST"], this.httpRoute, {
769
- post: {
770
- operationId: `add${name}Binary`,
771
- description: "Add a binary linked to an object",
772
- summary: "Add a binary",
773
- responses: {
774
- "200": {
775
- description: ""
776
- },
777
- "403": {
778
- description: "You don't have permissions"
779
- },
780
- "404": {
781
- description: "Object does not exist or attachment does not exist"
782
- },
783
- "412": {
784
- description: "Provided hash does not match"
785
- }
786
- }
787
- }
788
- });
789
- }
790
- if (!this.parameters.expose.restrict.create) {
791
- // Add file with challenge
792
- url = this.parameters.expose.url + "/upload/{store}/{uuid}/{property}";
793
- this.addRoute(url, ["PUT"], this.httpChallenge, {
794
- put: {
795
- operationId: `put${name}Binary`,
796
- description: "Add a binary to an object after challenge",
797
- summary: "Add a binary",
798
- responses: {
799
- "204": {
800
- description: ""
801
- },
802
- "403": {
803
- description: "You don't have permissions"
804
- },
805
- "404": {
806
- description: "Object does not exist or attachment does not exist"
807
- },
808
- "412": {
809
- description: "Provided hash does not match"
810
- }
811
- }
812
- }
813
- });
814
- }
815
- if (!this.parameters.expose.restrict.delete) {
816
- // Need hash to avoid concurrent delete
817
- url = this.parameters.expose.url + "/{store}/{uuid}/{property}/{index}/{hash}";
818
- this.addRoute(url, ["DELETE"], this.httpRoute, {
819
- delete: {
820
- operationId: `delete${name}Binary`,
821
- description: "Delete a binary linked to an object",
822
- summary: "Delete a binary",
823
- responses: {
824
- "204": {
825
- description: ""
826
- },
827
- "403": {
828
- description: "You don't have permissions"
829
- },
830
- "404": {
831
- description: "Object does not exist or attachment does not exist"
832
- },
833
- "412": {
834
- description: "Provided hash does not match"
835
- }
836
- }
837
- }
838
- });
839
- }
840
- if (!this.parameters.expose.restrict.metadata) {
841
- // Need hash to avoid concurrent delete
842
- url = this.parameters.expose.url + "/{store}/{uuid}/{property}/{index}/{hash}";
843
- this.addRoute(url, ["PUT"], this.httpRoute, {
844
- put: {
845
- operationId: `update${name}BinaryMetadata`,
846
- description: "Update a binary metadata linked to an object",
847
- summary: "Update a binary metadata",
848
- responses: {
849
- "204": {
850
- description: ""
851
- },
852
- "403": {
853
- description: "You don't have permissions"
854
- },
855
- "404": {
856
- description: "Object does not exist or attachment does not exist"
857
- },
858
- "412": {
859
- description: "Provided hash does not match"
860
- }
861
- }
862
- }
863
- });
864
- }
865
- }
866
589
  /**
867
590
  * Return the name of the service for OpenAPI
868
591
  * @returns
@@ -875,125 +598,20 @@ export class BinaryService extends Service {
875
598
  * @param ctx
876
599
  * @returns
877
600
  */
878
- _verifyMapAndStore(ctx) {
601
+ verifyMapAndStore(ctx) {
879
602
  // Check for model
880
- if (ctx.parameter("model")) {
881
- if (this.handleBinary(ctx.parameter("model"), ctx.parameter("property")) === -1) {
882
- throw new WebdaError.NotFound("Model not managed by this store");
883
- }
884
- return this.getWebda().getModelStore(this.getWebda().getModel(ctx.parameter("model")));
885
- }
886
- let store = ctx.parameter("store").toLowerCase();
887
- // To avoid any problem lowercase everything
888
- let map = this.parameters.map[this._lowercaseMaps[store]];
889
- if (map === undefined) {
890
- throw new WebdaError.NotFound("Unknown map");
891
- }
892
- if (!map.includes(ctx.parameter("property"))) {
893
- throw new WebdaError.NotFound("Unknown property");
894
- }
895
- let targetStore = this.getService(this._lowercaseMaps[store]);
896
- if (targetStore === undefined) {
897
- throw new WebdaError.NotFound("Unknown store");
603
+ if (this.handleBinary(ctx.parameter("model"), ctx.parameter("property")) === -1) {
604
+ throw new WebdaError.NotFound("Model not managed by this store");
898
605
  }
899
- return targetStore;
606
+ return this.getWebda().getModelStore(this.getWebda().getModel(ctx.parameter("model")));
900
607
  }
901
608
  /**
902
609
  * By default no challenge is managed so throws 404
903
610
  *
904
- * @param ctx
905
611
  */
906
- async putRedirectUrl(_ctx) {
612
+ async putRedirectUrl(...args) {
907
613
  // Dont handle the redirect url
908
614
  throw new WebdaError.NotFound("No redirect url");
909
615
  }
910
- /**
911
- * Mechanism to add a data based on challenge
912
- */
913
- async httpChallenge(ctx) {
914
- let body = await ctx.getRequestBody();
915
- if (!body.hash || !body.challenge) {
916
- throw new WebdaError.BadRequest("Missing hash or challenge");
917
- }
918
- // First verify if map exist
919
- let targetStore = this._verifyMapAndStore(ctx);
920
- // Get the object
921
- let object = await targetStore.get(ctx.parameter("uuid"), ctx);
922
- if (object === undefined) {
923
- throw new WebdaError.NotFound("Object does not exist");
924
- }
925
- await object.checkAct(ctx, "attach_binary");
926
- let url = await this.putRedirectUrl(ctx);
927
- let base64String = Buffer.from(body.hash, "hex").toString("base64");
928
- ctx.write({
929
- ...url,
930
- done: url === undefined,
931
- md5: base64String
932
- });
933
- }
934
- /**
935
- * Manage the different routes
936
- * @param ctx
937
- */
938
- async httpRoute(ctx) {
939
- // First verify if map exist
940
- let targetStore = this._verifyMapAndStore(ctx);
941
- // Get the object
942
- let object = await targetStore.get(ctx.parameter("uuid"), ctx);
943
- if (object === undefined) {
944
- throw new WebdaError.NotFound("Object does not exist");
945
- }
946
- const { property, index } = ctx.getParameters();
947
- // Current file - would be empty on creation
948
- const file = Array.isArray(object[property]) ? object[property][index] : object[property];
949
- // Check permissions
950
- let action = "unknown";
951
- if (ctx.getHttpContext().getMethod() === "DELETE") {
952
- action = "detach_binary";
953
- }
954
- else if (ctx.getHttpContext().getMethod() === "POST") {
955
- action = "attach_binary";
956
- }
957
- else if (ctx.getHttpContext().getMethod() === "PUT") {
958
- action = "update_binary_metadata";
959
- }
960
- await object.checkAct(ctx, action);
961
- // Now do the action
962
- if (ctx.getHttpContext().getMethod() === "POST") {
963
- await this.store(object, property, await this._getFile(ctx));
964
- }
965
- else {
966
- if (file.hash !== ctx.parameter("hash")) {
967
- throw new WebdaError.BadRequest("Hash does not match");
968
- }
969
- if (ctx.getHttpContext().getMethod() === "DELETE") {
970
- await this.delete(object, property, index);
971
- }
972
- else if (ctx.getHttpContext().getMethod() === "PUT") {
973
- let metadata = await ctx.getRequestBody();
974
- // Limit metadata to 4kb
975
- if (JSON.stringify(metadata).length >= 4096) {
976
- throw new WebdaError.BadRequest("Metadata is too big: 4kb max");
977
- }
978
- let evt = {
979
- service: this,
980
- object: file,
981
- target: object
982
- };
983
- await this.emitSync("Binary.MetadataUpdate", {
984
- ...evt,
985
- metadata
986
- });
987
- file.metadata = metadata;
988
- // Update mapper on purpose
989
- await object.getStore().patch({
990
- [object.__class.getUuidField()]: object.getUuid(),
991
- [property]: object[property]
992
- }, false);
993
- this.metrics.metadataUpdate.inc();
994
- await this.emitSync("Binary.MetadataUpdated", evt);
995
- }
996
- }
997
- }
998
616
  }
999
617
  //# sourceMappingURL=binary.js.map