@ama-sdk/core 11.6.0-prerelease.2 → 11.6.0-prerelease.21

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 (316) hide show
  1. package/cjs/clients/api-angular-client.js +12 -4
  2. package/cjs/clients/api-beacon-client.js +1 -2
  3. package/cjs/clients/api-fetch-client.js +15 -24
  4. package/cjs/fwk/api.helper.spec.js +1 -1
  5. package/cjs/fwk/api.helpers.js +20 -24
  6. package/cjs/fwk/core/api-client.js +2 -1
  7. package/cjs/fwk/core/index.js +1 -1
  8. package/cjs/fwk/date.js +26 -27
  9. package/cjs/fwk/date.spec.js +4 -2
  10. package/cjs/fwk/ignore-enum.type.js +1 -2
  11. package/cjs/fwk/index.js +1 -1
  12. package/cjs/fwk/mocks/alf-mock-adapter.js +7 -6
  13. package/cjs/fwk/mocks/base-mock-adapter.js +3 -3
  14. package/cjs/fwk/mocks/helpers.js +15 -7
  15. package/cjs/fwk/mocks/index.js +3 -3
  16. package/cjs/fwk/{Reviver.js → reviver.js} +1 -2
  17. package/cjs/fwk/reviver.spec.js +9 -9
  18. package/cjs/plugins/additional-params/index.js +1 -1
  19. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
  20. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
  21. package/cjs/plugins/client-facts/client-facts.request.js +5 -5
  22. package/cjs/plugins/concurrent/concurrent.fetch.js +5 -9
  23. package/cjs/plugins/core/index.js +2 -2
  24. package/cjs/plugins/custom-info/custom-info.reply.js +2 -2
  25. package/cjs/plugins/exception/exception.spec.js +1 -1
  26. package/cjs/plugins/fetch-cache/fetch-cache.request.js +1 -1
  27. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
  28. package/cjs/plugins/json-token/json-token.reply.js +6 -6
  29. package/cjs/plugins/json-token/json-token.request.js +1 -1
  30. package/cjs/plugins/json-token/json-token.spec.js +7 -9
  31. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
  32. package/cjs/plugins/mock-intercept/index.js +1 -1
  33. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +4 -4
  34. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
  35. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +5 -4
  36. package/cjs/plugins/perf-metric/perf-metric.fetch.js +10 -2
  37. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
  38. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
  39. package/cjs/plugins/retry/retry.fetch.js +17 -32
  40. package/cjs/plugins/retry/retry.spec.js +4 -4
  41. package/cjs/plugins/session-id/session-id.request.js +4 -4
  42. package/cjs/plugins/session-id/session-id.spec.js +2 -2
  43. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
  44. package/cjs/plugins/timeout/timeout.fetch.js +14 -6
  45. package/cjs/plugins/wait-for/wait-for.fetch.js +3 -3
  46. package/cjs/plugins/wait-for/wait-for.spec.js +1 -1
  47. package/cjs/utils/crypto.js +7 -7
  48. package/cjs/utils/encoder.js +9 -17
  49. package/cjs/utils/generic-api.js +1 -2
  50. package/cjs/utils/ie11.js +1 -0
  51. package/cjs/utils/index.js +1 -1
  52. package/cjs/utils/json-token.js +7 -7
  53. package/cjs/utils/json-token.spec.js +14 -11
  54. package/cjs/utils/mime-types.js +1 -1
  55. package/esm2015/clients/api-angular-client.js +12 -4
  56. package/esm2015/clients/api-beacon-client.js +1 -2
  57. package/esm2015/clients/api-fetch-client.js +15 -24
  58. package/esm2015/fwk/api.helper.spec.js +1 -1
  59. package/esm2015/fwk/api.helpers.js +24 -30
  60. package/esm2015/fwk/core/api-client.js +2 -1
  61. package/esm2015/fwk/core/index.js +1 -1
  62. package/esm2015/fwk/date.js +30 -29
  63. package/esm2015/fwk/date.spec.js +4 -2
  64. package/esm2015/fwk/ignore-enum.type.js +1 -2
  65. package/esm2015/fwk/index.js +1 -1
  66. package/esm2015/fwk/mocks/alf-mock-adapter.js +7 -6
  67. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  68. package/esm2015/fwk/mocks/helpers.js +15 -7
  69. package/esm2015/fwk/mocks/index.js +3 -3
  70. package/esm2015/fwk/{Reviver.js → reviver.js} +2 -2
  71. package/esm2015/fwk/reviver.spec.js +1 -1
  72. package/esm2015/plugins/additional-params/index.js +1 -1
  73. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
  74. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
  75. package/esm2015/plugins/client-facts/client-facts.request.js +5 -5
  76. package/esm2015/plugins/concurrent/concurrent.fetch.js +5 -9
  77. package/esm2015/plugins/core/index.js +2 -2
  78. package/esm2015/plugins/custom-info/custom-info.reply.js +2 -2
  79. package/esm2015/plugins/exception/exception.spec.js +1 -1
  80. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +1 -1
  81. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
  82. package/esm2015/plugins/json-token/json-token.reply.js +6 -6
  83. package/esm2015/plugins/json-token/json-token.request.js +1 -1
  84. package/esm2015/plugins/json-token/json-token.spec.js +7 -9
  85. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
  86. package/esm2015/plugins/mock-intercept/index.js +1 -1
  87. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +4 -4
  88. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
  89. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +5 -4
  90. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +10 -2
  91. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
  92. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
  93. package/esm2015/plugins/retry/retry.fetch.js +17 -32
  94. package/esm2015/plugins/retry/retry.spec.js +4 -4
  95. package/esm2015/plugins/session-id/session-id.request.js +4 -4
  96. package/esm2015/plugins/session-id/session-id.spec.js +2 -2
  97. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
  98. package/esm2015/plugins/timeout/timeout.fetch.js +15 -8
  99. package/esm2015/plugins/wait-for/wait-for.fetch.js +3 -3
  100. package/esm2015/plugins/wait-for/wait-for.spec.js +1 -1
  101. package/esm2015/utils/crypto.js +7 -7
  102. package/esm2015/utils/encoder.js +9 -17
  103. package/esm2015/utils/generic-api.js +1 -2
  104. package/esm2015/utils/ie11.js +1 -0
  105. package/esm2015/utils/index.js +1 -1
  106. package/esm2015/utils/json-token.js +7 -7
  107. package/esm2015/utils/json-token.spec.js +8 -10
  108. package/esm2015/utils/mime-types.js +1 -1
  109. package/package.json +19 -13
  110. package/schematics/ng-add/index.d.ts.map +1 -1
  111. package/schematics/ng-add/index.js +24 -26
  112. package/schematics/ng-add/schema.d.ts.map +1 -1
  113. package/src/clients/api-angular-client.d.ts +2 -2
  114. package/src/clients/api-angular-client.d.ts.map +1 -1
  115. package/src/clients/api-angular-client.js +11 -9
  116. package/src/clients/api-angular-client.js.map +1 -1
  117. package/src/clients/api-beacon-client.d.ts +1 -1
  118. package/src/clients/api-beacon-client.d.ts.map +1 -1
  119. package/src/clients/api-beacon-client.js +2 -3
  120. package/src/clients/api-beacon-client.js.map +1 -1
  121. package/src/clients/api-fetch-client.d.ts +2 -2
  122. package/src/clients/api-fetch-client.d.ts.map +1 -1
  123. package/src/clients/api-fetch-client.js +14 -21
  124. package/src/clients/api-fetch-client.js.map +1 -1
  125. package/src/fwk/api.helpers.d.ts +6 -8
  126. package/src/fwk/api.helpers.d.ts.map +1 -1
  127. package/src/fwk/api.helpers.js +22 -31
  128. package/src/fwk/api.helpers.js.map +1 -1
  129. package/src/fwk/api.interface.d.ts.map +1 -1
  130. package/src/fwk/core/api-client.d.ts +3 -3
  131. package/src/fwk/core/api-client.d.ts.map +1 -1
  132. package/src/fwk/core/api-client.js +8 -7
  133. package/src/fwk/core/api-client.js.map +1 -1
  134. package/src/fwk/core/base-api-constructor.d.ts +1 -1
  135. package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
  136. package/src/fwk/core/base-api-constructor.js.map +1 -1
  137. package/src/fwk/core/index.d.ts +1 -1
  138. package/src/fwk/core/index.d.ts.map +1 -1
  139. package/src/fwk/core/index.js +1 -1
  140. package/src/fwk/core/index.js.map +1 -1
  141. package/src/fwk/date.d.ts +6 -18
  142. package/src/fwk/date.d.ts.map +1 -1
  143. package/src/fwk/date.js +25 -28
  144. package/src/fwk/date.js.map +1 -1
  145. package/src/fwk/errors.d.ts.map +1 -1
  146. package/src/fwk/errors.js.map +1 -1
  147. package/src/fwk/ignore-enum.type.d.ts.map +1 -1
  148. package/src/fwk/index.d.ts +1 -1
  149. package/src/fwk/index.js +1 -1
  150. package/src/fwk/mocks/alf-mock-adapter.d.ts.map +1 -1
  151. package/src/fwk/mocks/alf-mock-adapter.js +11 -10
  152. package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
  153. package/src/fwk/mocks/base-mock-adapter.d.ts.map +1 -1
  154. package/src/fwk/mocks/base-mock-adapter.js +4 -4
  155. package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
  156. package/src/fwk/mocks/encoded-api-request.d.ts +1 -1
  157. package/src/fwk/mocks/encoded-api-request.d.ts.map +1 -1
  158. package/src/fwk/mocks/helpers.d.ts.map +1 -1
  159. package/src/fwk/mocks/helpers.js +8 -7
  160. package/src/fwk/mocks/helpers.js.map +1 -1
  161. package/src/fwk/mocks/index.d.ts +3 -3
  162. package/src/fwk/mocks/index.d.ts.map +1 -1
  163. package/src/fwk/mocks/index.js +3 -3
  164. package/src/fwk/mocks/index.js.map +1 -1
  165. package/src/fwk/mocks/mock-adapter.d.ts +1 -1
  166. package/src/fwk/mocks/mock-adapter.d.ts.map +1 -1
  167. package/src/fwk/mocks/path-object.d.ts.map +1 -1
  168. package/src/fwk/mocks/random-mock-adapter.d.ts.map +1 -1
  169. package/src/fwk/mocks/random-mock-adapter.js +1 -1
  170. package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
  171. package/src/fwk/mocks/sequential-mock-adapter.d.ts.map +1 -1
  172. package/src/fwk/mocks/sequential-mock-adapter.js +1 -1
  173. package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
  174. package/src/fwk/{Reviver.d.ts → reviver.d.ts} +2 -1
  175. package/src/fwk/reviver.d.ts.map +1 -0
  176. package/src/fwk/{Reviver.js → reviver.js} +3 -3
  177. package/src/fwk/reviver.js.map +1 -0
  178. package/src/plugins/abort/abort.fetch.d.ts.map +1 -1
  179. package/src/plugins/abort/abort.fetch.js.map +1 -1
  180. package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
  181. package/src/plugins/additional-params/additional-params-sync.request.js +1 -1
  182. package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
  183. package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
  184. package/src/plugins/additional-params/additional-params.request.js.map +1 -1
  185. package/src/plugins/additional-params/index.d.ts +1 -1
  186. package/src/plugins/additional-params/index.d.ts.map +1 -1
  187. package/src/plugins/additional-params/index.js +1 -1
  188. package/src/plugins/additional-params/index.js.map +1 -1
  189. package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts.map +1 -1
  190. package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
  191. package/src/plugins/api-key/api-key.request.d.ts.map +1 -1
  192. package/src/plugins/api-key/api-key.request.js.map +1 -1
  193. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +10 -10
  194. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
  195. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
  196. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
  197. package/src/plugins/client-facts/client-facts.request.d.ts +1 -1
  198. package/src/plugins/client-facts/client-facts.request.d.ts.map +1 -1
  199. package/src/plugins/client-facts/client-facts.request.js +5 -5
  200. package/src/plugins/client-facts/client-facts.request.js.map +1 -1
  201. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  202. package/src/plugins/concurrent/concurrent.fetch.js +1 -6
  203. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  204. package/src/plugins/core/angular-plugin.d.ts +1 -1
  205. package/src/plugins/core/angular-plugin.d.ts.map +1 -1
  206. package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
  207. package/src/plugins/core/index.d.ts +2 -2
  208. package/src/plugins/core/index.d.ts.map +1 -1
  209. package/src/plugins/core/index.js +2 -2
  210. package/src/plugins/core/index.js.map +1 -1
  211. package/src/plugins/core/plugin.d.ts.map +1 -1
  212. package/src/plugins/core/reply-plugin.d.ts +1 -1
  213. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  214. package/src/plugins/core/request-plugin.d.ts.map +1 -1
  215. package/src/plugins/custom-info/custom-info.reply.d.ts.map +1 -1
  216. package/src/plugins/custom-info/custom-info.reply.js +1 -1
  217. package/src/plugins/custom-info/custom-info.reply.js.map +1 -1
  218. package/src/plugins/exception/exception.reply.d.ts +1 -0
  219. package/src/plugins/exception/exception.reply.d.ts.map +1 -1
  220. package/src/plugins/exception/exception.reply.js +6 -5
  221. package/src/plugins/exception/exception.reply.js.map +1 -1
  222. package/src/plugins/fetch-cache/fetch-cache.request.d.ts.map +1 -1
  223. package/src/plugins/fetch-cache/fetch-cache.request.js +3 -3
  224. package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
  225. package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts.map +1 -1
  226. package/src/plugins/fetch-credentials/fetch-credentials.request.js.map +1 -1
  227. package/src/plugins/json-token/json-token.reply.d.ts.map +1 -1
  228. package/src/plugins/json-token/json-token.reply.js +6 -6
  229. package/src/plugins/json-token/json-token.reply.js.map +1 -1
  230. package/src/plugins/json-token/json-token.request.d.ts.map +1 -1
  231. package/src/plugins/json-token/json-token.request.js +1 -1
  232. package/src/plugins/json-token/json-token.request.js.map +1 -1
  233. package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -1
  234. package/src/plugins/keepalive/keepalive.request.js +1 -1
  235. package/src/plugins/keepalive/keepalive.request.js.map +1 -1
  236. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
  237. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +3 -3
  238. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
  239. package/src/plugins/mock-intercept/index.d.ts +1 -1
  240. package/src/plugins/mock-intercept/index.d.ts.map +1 -1
  241. package/src/plugins/mock-intercept/index.js +1 -1
  242. package/src/plugins/mock-intercept/index.js.map +1 -1
  243. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +1 -1
  244. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -1
  245. package/src/plugins/mock-intercept/mock-intercept.angular.js +15 -11
  246. package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -1
  247. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
  248. package/src/plugins/mock-intercept/mock-intercept.fetch.js +4 -6
  249. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  250. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +1 -1
  251. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -1
  252. package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -1
  253. package/src/plugins/mock-intercept/mock-intercept.request.d.ts.map +1 -1
  254. package/src/plugins/mock-intercept/mock-intercept.request.js +4 -3
  255. package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
  256. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
  257. package/src/plugins/perf-metric/perf-metric.fetch.js +4 -3
  258. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  259. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
  260. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -10
  261. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
  262. package/src/plugins/raw-response-info/raw-response-info.reply.d.ts +0 -1
  263. package/src/plugins/raw-response-info/raw-response-info.reply.d.ts.map +1 -1
  264. package/src/plugins/raw-response-info/raw-response-info.reply.js +0 -1
  265. package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
  266. package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
  267. package/src/plugins/retry/retry.fetch.js +5 -4
  268. package/src/plugins/retry/retry.fetch.js.map +1 -1
  269. package/src/plugins/reviver/reviver.reply.d.ts +1 -1
  270. package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
  271. package/src/plugins/reviver/reviver.reply.js.map +1 -1
  272. package/src/plugins/session-id/session-id.request.d.ts +1 -1
  273. package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
  274. package/src/plugins/session-id/session-id.request.js +5 -3
  275. package/src/plugins/session-id/session-id.request.js.map +1 -1
  276. package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
  277. package/src/plugins/si-token/si-token.request.js +1 -1
  278. package/src/plugins/si-token/si-token.request.js.map +1 -1
  279. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.d.ts.map +1 -1
  280. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
  281. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
  282. package/src/plugins/timeout/timeout.fetch.d.ts +1 -2
  283. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  284. package/src/plugins/timeout/timeout.fetch.js +14 -12
  285. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  286. package/src/plugins/url-rewrite/url-rewrite.request.d.ts.map +1 -1
  287. package/src/plugins/url-rewrite/url-rewrite.request.js.map +1 -1
  288. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
  289. package/src/plugins/wait-for/wait-for.fetch.js +2 -2
  290. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
  291. package/src/utils/crypto.d.ts.map +1 -1
  292. package/src/utils/crypto.js +7 -7
  293. package/src/utils/crypto.js.map +1 -1
  294. package/src/utils/encoder.d.ts +1 -1
  295. package/src/utils/encoder.d.ts.map +1 -1
  296. package/src/utils/encoder.js +22 -28
  297. package/src/utils/encoder.js.map +1 -1
  298. package/src/utils/generic-api.d.ts +1 -2
  299. package/src/utils/generic-api.d.ts.map +1 -1
  300. package/src/utils/generic-api.js +3 -6
  301. package/src/utils/generic-api.js.map +1 -1
  302. package/src/utils/ie11.d.ts.map +1 -1
  303. package/src/utils/ie11.js +1 -0
  304. package/src/utils/ie11.js.map +1 -1
  305. package/src/utils/index.d.ts +1 -1
  306. package/src/utils/index.d.ts.map +1 -1
  307. package/src/utils/index.js +1 -1
  308. package/src/utils/index.js.map +1 -1
  309. package/src/utils/json-token.d.ts.map +1 -1
  310. package/src/utils/json-token.js +12 -12
  311. package/src/utils/json-token.js.map +1 -1
  312. package/src/utils/mime-types.d.ts.map +1 -1
  313. package/src/utils/mime-types.js +1 -1
  314. package/src/utils/mime-types.js.map +1 -1
  315. package/src/fwk/Reviver.d.ts.map +0 -1
  316. package/src/fwk/Reviver.js.map +0 -1
@@ -59,6 +59,13 @@ function _define_property(obj, key, value) {
59
59
  }
60
60
  return obj;
61
61
  }
62
+ function _instanceof(left, right) {
63
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
64
+ return !!right[Symbol.hasInstance](left);
65
+ } else {
66
+ return left instanceof right;
67
+ }
68
+ }
62
69
  function _type_of(obj) {
63
70
  "@swc/helpers - typeof";
64
71
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
@@ -163,22 +170,22 @@ import { ResponseTimeoutError } from '../../fwk/errors';
163
170
  * Check if a message can be cast as an {@link ImpervaCaptchaMessage}
164
171
  * @param message
165
172
  */ function isImpervaCaptchaMessage(message) {
166
- return !!message && Object.prototype.hasOwnProperty.call(message, 'impervaChallenge') && Object.prototype.hasOwnProperty.call(message.impervaChallenge, 'status') && Object.prototype.hasOwnProperty.call(message.impervaChallenge, 'type') && message.impervaChallenge.type === 'captcha';
173
+ var impervaCaptchaMessage = message;
174
+ return !!impervaCaptchaMessage && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage, 'impervaChallenge') && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage.impervaChallenge, 'status') && Object.prototype.hasOwnProperty.call(impervaCaptchaMessage.impervaChallenge, 'type') && impervaCaptchaMessage.impervaChallenge.type === 'captcha';
167
175
  }
168
176
  /**
169
177
  * Captures Imperva captcha events and calls the event callback
170
178
  * It can only be used for browser's integrating imperva captcha
171
- * @param config: list of host names that can trigger a captcha event
172
- * @param config
179
+ * @param config list of host names that can trigger a captcha event
173
180
  * @returns removeEventListener
174
181
  */ export var impervaCaptchaEventHandlerFactory = function(config) {
175
182
  return function(timeoutPauseCallback) {
176
183
  var onImpervaCaptcha = function(event) {
177
184
  var originHostname = new URL(event.origin).hostname;
178
- if (originHostname !== location.hostname && ((config === null || config === void 0 ? void 0 : config.whiteListedHostNames) || []).indexOf(originHostname) === -1) {
185
+ if (originHostname !== location.hostname && !((config === null || config === void 0 ? void 0 : config.whiteListedHostNames) || []).includes(originHostname)) {
179
186
  return;
180
187
  }
181
- var message = event.data;
188
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment -- type is checked below */ var message = event.data;
182
189
  if (typeof event.data === 'string') {
183
190
  try {
184
191
  message = JSON.parse(event.data);
@@ -189,7 +196,7 @@ import { ResponseTimeoutError } from '../../fwk/errors';
189
196
  if ((typeof message === "undefined" ? "undefined" : _type_of(message)) === 'object' && isImpervaCaptchaMessage(message)) {
190
197
  timeoutPauseCallback(message.impervaChallenge.status === 'started' ? 'timeoutStopped' : 'timeoutStarted');
191
198
  }
192
- };
199
+ /* eslint-enable @typescript-eslint/no-unsafe-assignment */ };
193
200
  addEventListener('message', onImpervaCaptcha);
194
201
  return function() {
195
202
  removeEventListener('message', onImpervaCaptcha);
@@ -228,7 +235,7 @@ import { ResponseTimeoutError } from '../../fwk/errors';
228
235
  var _this = this;
229
236
  return {
230
237
  transform: function(fetchCall) {
231
- return(// eslint-disable-next-line no-async-promise-executor
238
+ return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
232
239
  new Promise(/*#__PURE__*/ function() {
233
240
  var _ref = _async_to_generator(function(resolve, reject) {
234
241
  var timeoutCallback, timer, timerCallback, _context_controller, response, ex;
@@ -276,7 +283,7 @@ import { ResponseTimeoutError } from '../../fwk/errors';
276
283
  ];
277
284
  case 3:
278
285
  ex = _state.sent();
279
- reject(ex);
286
+ reject(_instanceof(ex, Error) ? ex : new Error(ex.toString()));
280
287
  return [
281
288
  3,
282
289
  5
@@ -251,11 +251,11 @@ function _ts_generator(thisArg, body) {
251
251
  var data;
252
252
  var _this = this;
253
253
  return {
254
- // eslint-disable-next-line no-async-promise-executor
254
+ // eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
255
255
  canStart: function() {
256
256
  return new Promise(/*#__PURE__*/ function() {
257
257
  var _ref = _async_to_generator(function(resolve) {
258
- var didTimeOut, timer, canStartCondition, canStart, ex;
258
+ var didTimeOut, timer, canStartCondition, canStart, e;
259
259
  return _ts_generator(this, function(_state) {
260
260
  switch(_state.label){
261
261
  case 0:
@@ -295,7 +295,7 @@ function _ts_generator(thisArg, body) {
295
295
  6
296
296
  ];
297
297
  case 4:
298
- ex = _state.sent();
298
+ e = _state.sent();
299
299
  if (!didTimeOut) {
300
300
  resolve(false);
301
301
  }
@@ -343,7 +343,7 @@ describe('Wait For Fetch Plugin', function() {
343
343
  response = {
344
344
  test: true
345
345
  };
346
- fetchCall = Promise.reject(response);
346
+ fetchCall = Promise.reject(new Error(JSON.stringify(response)));
347
347
  _state.label = 1;
348
348
  case 1:
349
349
  _state.trys.push([
@@ -233,18 +233,18 @@ function _encryptPayload() {
233
233
  if (additionalAuthenticatedData) {
234
234
  aesParams.additionalData = additionalAuthenticatedData;
235
235
  }
236
- if (!(typeof window.msCrypto !== 'undefined')) return [
236
+ if (!(typeof window.msCrypto === 'undefined')) return [
237
237
  3,
238
238
  2
239
239
  ];
240
240
  return [
241
241
  4,
242
- promisifyMsCrypto(window.msCrypto.subtle.encrypt(aesParams, key, payload))
242
+ window.crypto.subtle.encrypt(aesParams, key, payload)
243
243
  ];
244
244
  case 1:
245
245
  aesOutput = _state.sent();
246
- ciphertext = aesOutput.ciphertext;
247
- authenticationTag = aesOutput.tag;
246
+ ciphertext = aesOutput.slice(0, -authenticationTagLength / 8);
247
+ authenticationTag = aesOutput.slice(-authenticationTagLength / 8);
248
248
  return [
249
249
  3,
250
250
  4
@@ -252,12 +252,12 @@ function _encryptPayload() {
252
252
  case 2:
253
253
  return [
254
254
  4,
255
- window.crypto.subtle.encrypt(aesParams, key, payload)
255
+ promisifyMsCrypto(window.msCrypto.subtle.encrypt(aesParams, key, payload))
256
256
  ];
257
257
  case 3:
258
258
  aesOutput1 = _state.sent();
259
- ciphertext = aesOutput1.slice(0, -authenticationTagLength / 8);
260
- authenticationTag = aesOutput1.slice(-authenticationTagLength / 8);
259
+ ciphertext = aesOutput1.ciphertext;
260
+ authenticationTag = aesOutput1.tag;
261
261
  _state.label = 4;
262
262
  case 4:
263
263
  return [
@@ -1,4 +1,4 @@
1
- // The content of this file is inspired from https://github.com/inexorabletash/text-encoding/blob/master/lib/encoding.js
1
+ /* eslint-disable @stylistic/brace-style -- explication with inline comments */ /* eslint-disable no-bitwise -- working on bytes */ // The content of this file is inspired from https://github.com/inexorabletash/text-encoding/blob/master/lib/encoding.js
2
2
  // in order to support UTF8 strings encoding in case TextEncoder is not available
3
3
  /**
4
4
  * Represents a byte stream to be processed by and Encoder
@@ -64,7 +64,7 @@ var Stream = /*#__PURE__*/ function() {
64
64
  function Stream(tokens) {
65
65
  _class_call_check(this, Stream);
66
66
  _define_property(this, "tokens", void 0);
67
- this.tokens = [].slice.call(tokens);
67
+ this.tokens = _to_consumable_array(tokens);
68
68
  // Reversed as push/pop is more efficient than shift/unshift.
69
69
  this.tokens.reverse();
70
70
  }
@@ -72,9 +72,9 @@ var Stream = /*#__PURE__*/ function() {
72
72
  {
73
73
  key: "endOfStream",
74
74
  get: /**
75
- * @returns True if end-of-stream has been hit.
75
+ * True if end-of-stream has been hit.
76
76
  */ function get() {
77
- return !this.tokens.length;
77
+ return this.tokens.length === 0;
78
78
  }
79
79
  },
80
80
  {
@@ -86,7 +86,7 @@ var Stream = /*#__PURE__*/ function() {
86
86
  * @returns Get the next token from the stream, or
87
87
  * end_of_stream.
88
88
  */ function read() {
89
- if (!this.tokens.length) {
89
+ if (this.tokens.length === 0) {
90
90
  return Stream.END_OF_STREAM;
91
91
  }
92
92
  return this.tokens.pop();
@@ -102,7 +102,7 @@ var Stream = /*#__PURE__*/ function() {
102
102
  * stream.
103
103
  */ function prepend(token) {
104
104
  if (Array.isArray(token)) {
105
- while(token.length){
105
+ while(token.length > 0){
106
106
  this.tokens.push(token.pop());
107
107
  }
108
108
  } else {
@@ -120,7 +120,7 @@ var Stream = /*#__PURE__*/ function() {
120
120
  * stream.
121
121
  */ function push(token) {
122
122
  if (Array.isArray(token)) {
123
- while(token.length){
123
+ while(token.length > 0){
124
124
  this.tokens.unshift(token.shift());
125
125
  }
126
126
  } else {
@@ -134,8 +134,7 @@ var Stream = /*#__PURE__*/ function() {
134
134
  _define_property(Stream, "END_OF_STREAM", -1);
135
135
  /**
136
136
  * Returns the byte equivalent given a string
137
- * @param string Input string of UTF-16 code units.
138
- * @param s
137
+ * @param s Input string of UTF-16 code units.
139
138
  * @returns Code points.
140
139
  */ function stringToCodePoints(s) {
141
140
  // https://heycam.github.io/webidl/#dfn-obtain-unicode
@@ -169,14 +168,11 @@ _define_property(Stream, "END_OF_STREAM", -1);
169
168
  // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
170
169
  if (0xDC00 <= d && d <= 0xDFFF) {
171
170
  // 1. Let a be c & 0x3FF.
172
- // eslint-disable-next-line no-bitwise
173
171
  var a = c & 0x3FF;
174
172
  // 2. Let b be d & 0x3FF.
175
- // eslint-disable-next-line no-bitwise
176
173
  var b = d & 0x3FF;
177
174
  // 3. Append to U the Unicode character with code point
178
175
  // 2^16+2^10*a+b.
179
- // eslint-disable-next-line no-bitwise
180
176
  u.push(0x10000 + (a << 10) + b);
181
177
  // 4. Set i to i+1.
182
178
  i += 1;
@@ -212,10 +208,10 @@ _define_property(Stream, "END_OF_STREAM", -1);
212
208
  {
213
209
  key: "inRange",
214
210
  value: /**
211
+ * True if a >= min and a <= max.
215
212
  * @param a The number to test.
216
213
  * @param min The minimum value in the range, inclusive.
217
214
  * @param max The maximum value in the range, inclusive.
218
- * @returns {boolean} True if a >= min and a <= max.
219
215
  */ function inRange(a, min, max) {
220
216
  return min <= a && a <= max;
221
217
  }
@@ -248,17 +244,14 @@ _define_property(Stream, "END_OF_STREAM", -1);
248
244
  }
249
245
  // 4. Let bytes be a byte sequence whose first byte is (code
250
246
  // point >> (6 × count)) + offset.
251
- // eslint-disable-next-line @typescript-eslint/restrict-plus-operands,no-bitwise
252
247
  var bytes = [
253
248
  (codePoint >> 6 * count) + offset
254
249
  ];
255
250
  // 5. Run these substeps while count is greater than 0:
256
251
  while(count > 0){
257
252
  // 1. Set temp to code point >> (6 × (count − 1)).
258
- // eslint-disable-next-line no-bitwise
259
253
  var temp = codePoint >> 6 * (count - 1);
260
254
  // 2. Append to bytes 0x80 | (temp & 0x3F).
261
- // eslint-disable-next-line no-bitwise
262
255
  bytes.push(0x80 | temp & 0x3F);
263
256
  // 3. Decrease count by one.
264
257
  count -= 1;
@@ -276,7 +269,6 @@ _define_property(Stream, "END_OF_STREAM", -1);
276
269
  var output = [];
277
270
  var result;
278
271
  // 3. While true, run these substeps:
279
- // eslint-disable-next-line no-constant-condition
280
272
  while(true){
281
273
  // 1. Let token be the result of reading from input.
282
274
  var token = input.read();
@@ -195,10 +195,9 @@ import { ApiTypes } from '../fwk';
195
195
  case 0:
196
196
  metadataHeaderAccept = ((_requestOptions_metadata = requestOptions.metadata) === null || _requestOptions_metadata === void 0 ? void 0 : _requestOptions_metadata.headerAccept) || 'application/json';
197
197
  headers = _object_spread({
198
- // eslint-disable-next-line @typescript-eslint/naming-convention
199
198
  'Content-Type': ((_requestOptions_metadata1 = requestOptions.metadata) === null || _requestOptions_metadata1 === void 0 ? void 0 : _requestOptions_metadata1.headerContentType) || 'application/json'
200
199
  }, metadataHeaderAccept ? {
201
- 'Accept': metadataHeaderAccept
200
+ Accept: metadataHeaderAccept
202
201
  } : {});
203
202
  requestParameters = _object_spread({
204
203
  api: _this,
@@ -6,6 +6,7 @@
6
6
  cryptoOutput.oncomplete = function(e) {
7
7
  return resolve(e.target.result);
8
8
  };
9
+ // eslint-disable-next-line unicorn/prefer-add-event-listener -- false positive
9
10
  cryptoOutput.onerror = function(e) {
10
11
  return reject(e);
11
12
  };
@@ -1,6 +1,6 @@
1
1
  export * from './crypto';
2
2
  export * from './encoder';
3
+ export * from './generic-api';
3
4
  export * from './ie11';
4
5
  export * from './json-token';
5
6
  export * from './mime-types';
6
- export * from './generic-api';
@@ -132,12 +132,12 @@ import { Encoder } from './encoder';
132
132
  // then we convert the percent encodings into raw bytes, and finally feed it to btoa() function.
133
133
  // encodeURI escape all non-ASCII characters but we don't want to escape latin non-ascii characters
134
134
  // (charCode between 128 and 255).
135
- return window.btoa(encodeURI(str).replace(/%C2%([89AB][0-9A-F])/g, function(_match, p1) {
136
- return String.fromCharCode(parseInt('0x' + p1, 16));
137
- }).replace(/%C3%([89AB][0-9A-F])/g, function(_match, p1) {
138
- return String.fromCharCode(parseInt('0xc0', 16) + parseInt('0x' + p1, 16) - parseInt('0x80', 16));
139
- }).replace(/%([0-9A-F]{2})/g, function(_match, p1) {
140
- return String.fromCharCode(parseInt('0x' + p1, 16));
135
+ return window.btoa(encodeURI(str).replace(/%C2%([89AB][\dA-F])/g, function(_match, p1) {
136
+ return String.fromCharCode(Number.parseInt('0x' + p1, 16));
137
+ }).replace(/%C3%([89AB][\dA-F])/g, function(_match, p1) {
138
+ return String.fromCharCode(Number.parseInt('0xc0', 16) + Number.parseInt('0x' + p1, 16) - Number.parseInt('0x80', 16));
139
+ }).replace(/%([\dA-F]{2})/g, function(_match, p1) {
140
+ return String.fromCharCode(Number.parseInt('0x' + p1, 16));
141
141
  }));
142
142
  }
143
143
  /**
@@ -257,7 +257,7 @@ import { Encoder } from './encoder';
257
257
  */ export function createJweEncoder() {
258
258
  var aesTagLengthInBits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 128, useHeaderAsAAD = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
259
259
  var base64Encoder = createBase64UrlEncoder();
260
- var stringEncoder = typeof window.TextEncoder !== 'undefined' ? new TextEncoder() : new Encoder();
260
+ var stringEncoder = typeof window.TextEncoder === 'undefined' ? new Encoder() : new TextEncoder();
261
261
  return /*#__PURE__*/ function() {
262
262
  var _ref = _async_to_generator(function(param, jwePayload, publicProperties) {
263
263
  var publicKey, keyId, jweHeader, cek, wrappedCek, iv, serializedHeader, _ref, ciphertext, authenticationTag;
@@ -168,7 +168,7 @@ function _ts_generator(thisArg, body) {
168
168
  };
169
169
  }
170
170
  }
171
- var crypto = require('node:crypto');
171
+ import crypto from 'node:crypto';
172
172
  import { base64DecodeUrl, createBase64Decoder, createBase64Encoder, createBase64UrlDecoder, createBase64UrlEncoder, createJweEncoder } from './json-token';
173
173
  describe('JSON token utils', function() {
174
174
  it('should encode and decode in base64 properly a string that contains characters occupying more than 1 byte', function() {
@@ -194,7 +194,7 @@ describe('JSON Web Encryption Token', function() {
194
194
  return _ts_generator(this, function(_state) {
195
195
  switch(_state.label){
196
196
  case 0:
197
- /* eslint-disable @typescript-eslint/naming-convention */ expectedJwePayload = {
197
+ expectedJwePayload = {
198
198
  iat: 0,
199
199
  exp: 3600,
200
200
  iss: 'DEMO_JWE',
@@ -204,7 +204,7 @@ describe('JSON Web Encryption Token', function() {
204
204
  '{lastName}': 'Doe'
205
205
  }
206
206
  };
207
- /* eslint-enable @typescript-eslint/naming-convention */ expectedJweHeader = {
207
+ expectedJweHeader = {
208
208
  alg: 'RSA-OAEP-256',
209
209
  enc: 'A256GCM',
210
210
  typ: 'JWE',
@@ -260,8 +260,7 @@ describe('JSON Web Encryption Token', function() {
260
260
  167,
261
261
  206
262
262
  ]);
263
- // eslint-disable-next-line max-len
264
- expectedJweEncryptedKey = new Uint8Array([
263
+ /* eslint-disable @stylistic/max-len -- keep the buffer on the same line */ expectedJweEncryptedKey = new Uint8Array([
265
264
  37,
266
265
  70,
267
266
  170,
@@ -519,7 +518,6 @@ describe('JSON Web Encryption Token', function() {
519
518
  239,
520
519
  108
521
520
  ]);
522
- // eslint-disable-next-line max-len
523
521
  outputAesGcm = new Uint8Array([
524
522
  179,
525
523
  46,
@@ -638,7 +636,7 @@ describe('JSON Web Encryption Token', function() {
638
636
  126,
639
637
  8
640
638
  ]);
641
- global.window = {
639
+ /* eslint-enable @stylistic/max-len */ global.window = {
642
640
  btoa: function(data) {
643
641
  return Buffer.from(data, 'ascii').toString('base64');
644
642
  },
@@ -672,9 +670,9 @@ describe('JSON Web Encryption Token', function() {
672
670
  authTagLength: 12
673
671
  });
674
672
  decipher.setAuthTag(Buffer.from(base64DecodeUrl(authenticationTag), 'base64'));
675
- decrypted = decipher.update(Buffer.from(base64DecodeUrl(cipherContent), 'base64'));
676
- decrypted += decipher.final();
677
- expect(decrypted.toString()).toEqual(JSON.stringify(expectedJwePayload));
673
+ decrypted = decipher.update(Buffer.from(base64DecodeUrl(cipherContent), 'base64')).toString();
674
+ decrypted += decipher.final().toString();
675
+ expect(decrypted).toEqual(JSON.stringify(expectedJwePayload));
678
676
  return [
679
677
  2
680
678
  ];
@@ -1,4 +1,4 @@
1
- export var jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
1
+ export var jsonRegex = /^(:?application\/json|[^\t /;]+\/[^\t /;]+\+json)[\t ]*(:?;.*)?$/i;
2
2
  /**
3
3
  * Return true if the input corresponds to a JSON MIME type
4
4
  * @param mime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ama-sdk/core",
3
- "version": "11.6.0-prerelease.2",
3
+ "version": "11.6.0-prerelease.21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -90,7 +90,7 @@
90
90
  "@angular-devkit/schematics": "~18.2.0",
91
91
  "@angular/cli": "~18.2.0",
92
92
  "@angular/common": "~18.2.0",
93
- "@o3r/schematics": "^11.6.0-prerelease.2",
93
+ "@o3r/schematics": "^11.6.0-prerelease.21",
94
94
  "@schematics/angular": "~18.2.0",
95
95
  "isomorphic-fetch": "^3.0.0",
96
96
  "rxjs": "^7.8.1",
@@ -125,31 +125,36 @@
125
125
  "devDependencies": {
126
126
  "@angular-devkit/core": "~18.2.0",
127
127
  "@angular-devkit/schematics": "~18.2.0",
128
- "@angular-eslint/eslint-plugin": "~18.3.0",
129
128
  "@angular/common": "~18.2.0",
130
129
  "@angular/core": "~18.2.0",
130
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
131
131
  "@nx/eslint-plugin": "~19.5.0",
132
132
  "@nx/jest": "~19.5.0",
133
- "@o3r/build-helpers": "^11.6.0-prerelease.2",
134
- "@o3r/eslint-plugin": "^11.6.0-prerelease.2",
135
- "@o3r/test-helpers": "^11.6.0-prerelease.2",
133
+ "@o3r/build-helpers": "^11.6.0-prerelease.21",
134
+ "@o3r/eslint-plugin": "^11.6.0-prerelease.21",
135
+ "@o3r/schematics": "^11.6.0-prerelease.21",
136
+ "@o3r/test-helpers": "^11.6.0-prerelease.21",
136
137
  "@schematics/angular": "~18.2.0",
137
- "@stylistic/eslint-plugin-ts": "~2.4.0",
138
+ "@stylistic/eslint-plugin": "~2.7.0",
138
139
  "@swc/cli": "~0.5.0",
139
140
  "@swc/core": "~1.9.0",
140
141
  "@types/jest": "~29.5.2",
141
142
  "@types/node": "^20.0.0",
142
143
  "@types/uuid": "^9.0.0",
143
- "@typescript-eslint/eslint-plugin": "^7.14.1",
144
- "@typescript-eslint/parser": "^7.14.1",
145
- "@typescript-eslint/utils": "^7.14.1",
144
+ "@typescript-eslint/parser": "~8.16.0",
145
+ "angular-eslint": "~18.4.0",
146
146
  "cpy-cli": "^5.0.0",
147
- "eslint": "^8.57.0",
147
+ "eslint": "~9.14.0",
148
148
  "eslint-import-resolver-node": "^0.3.9",
149
+ "eslint-import-resolver-typescript": "^3.6.3",
150
+ "eslint-plugin-import": "^2.31.0",
151
+ "eslint-plugin-import-newlines": "^1.4.0",
149
152
  "eslint-plugin-jest": "~28.8.0",
150
- "eslint-plugin-jsdoc": "~48.11.0",
153
+ "eslint-plugin-jsdoc": "~50.2.0",
151
154
  "eslint-plugin-prefer-arrow": "~1.2.3",
152
- "eslint-plugin-unicorn": "^54.0.0",
155
+ "eslint-plugin-unicorn": "^56.0.0",
156
+ "eslint-plugin-unused-imports": "^4.1.4",
157
+ "globals": "^15.9.0",
153
158
  "isomorphic-fetch": "~3.0.0",
154
159
  "jest": "~29.7.0",
155
160
  "jest-junit": "~16.0.0",
@@ -163,6 +168,7 @@
163
168
  "ts-node": "~10.9.2",
164
169
  "type-fest": "^4.10.2",
165
170
  "typescript": "~5.5.4",
171
+ "typescript-eslint": "~8.16.0",
166
172
  "zone.js": "~0.14.2"
167
173
  },
168
174
  "engines": {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAI9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAuEtD;;;;GAIG;AACH,eAAO,MAAM,KAAK,YAAa,qBAAqB,KAAG,IAGtD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAoElB;;;;GAIG;AACH,eAAO,MAAM,KAAK,YAAa,qBAAqB,KAAG,IAGtD,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = void 0;
4
+ const path = require("node:path");
4
5
  const schematics_1 = require("@angular-devkit/schematics");
5
6
  const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const path = require("node:path");
7
7
  const ts = require("typescript");
8
8
  const reportMissingSchematicsDep = (logger) => (reason) => {
9
9
  logger.error(`[ERROR]: Adding @ama-sdk/core has failed.
@@ -11,43 +11,41 @@ const reportMissingSchematicsDep = (logger) => (reason) => {
11
11
  Otherwise, use the error message as guidance.`);
12
12
  throw reason;
13
13
  };
14
+ const removeImports = async () => {
15
+ const { removePackages } = await Promise.resolve().then(() => require('@o3r/schematics'));
16
+ return removePackages(['@dapi/sdk-core']);
17
+ };
18
+ const updateImports = async (tree) => {
19
+ const { getFilesInFolderFromWorkspaceProjectsInTree } = await Promise.resolve().then(() => require('@o3r/schematics'));
20
+ const files = getFilesInFolderFromWorkspaceProjectsInTree(tree, '', 'ts');
21
+ files.forEach((file) => {
22
+ const sourceFile = ts.createSourceFile(file, tree.readText(file), ts.ScriptTarget.ES2015, true);
23
+ const dapiSdkCodeImports = sourceFile.statements.filter((node) => ts.isImportDeclaration(node)
24
+ && !!/["']@dapi\/sdk-core["']/.test(node.moduleSpecifier.getText()));
25
+ if (dapiSdkCodeImports.length > 0) {
26
+ const recorder = tree.beginUpdate(file);
27
+ dapiSdkCodeImports.forEach((imp) => {
28
+ recorder.remove(imp.moduleSpecifier.getStart(), imp.moduleSpecifier.getWidth());
29
+ recorder.insertRight(imp.moduleSpecifier.getStart(), '\'@ama-sdk/core\'');
30
+ });
31
+ tree.commitUpdate(recorder);
32
+ }
33
+ return tree;
34
+ });
35
+ };
14
36
  /**
15
37
  * Rule to import all the necessary dependency to run an @ama-sdk based application
16
38
  * Helps to migrate from previous versions with an import replacement
17
39
  * @param options schema options
18
40
  */
19
41
  function ngAddFn(options) {
20
- const removeImports = async () => {
21
- const { removePackages } = await Promise.resolve().then(() => require('@o3r/schematics'));
22
- return removePackages(['@dapi/sdk-core']);
23
- };
24
- /* ng add rules */
25
- const updateImports = async (tree) => {
26
- const { getFilesInFolderFromWorkspaceProjectsInTree } = await Promise.resolve().then(() => require('@o3r/schematics'));
27
- const files = getFilesInFolderFromWorkspaceProjectsInTree(tree, '', 'ts');
28
- files.forEach((file) => {
29
- const sourceFile = ts.createSourceFile(file, tree.readText(file), ts.ScriptTarget.ES2015, true);
30
- const dapiSdkCodeImports = sourceFile.statements.filter((node) => ts.isImportDeclaration(node)
31
- && !!node.moduleSpecifier.getText().match(/['"]@dapi\/sdk-core['"]/));
32
- if (dapiSdkCodeImports.length) {
33
- const recorder = tree.beginUpdate(file);
34
- dapiSdkCodeImports.forEach((imp) => {
35
- recorder.remove(imp.moduleSpecifier.getStart(), imp.moduleSpecifier.getWidth());
36
- recorder.insertRight(imp.moduleSpecifier.getStart(), '\'@ama-sdk/core\'');
37
- });
38
- tree.commitUpdate(recorder);
39
- }
40
- return tree;
41
- });
42
- };
43
42
  const addMandatoryPeerDeps = async (tree, context) => {
44
43
  const { getPeerDepWithPattern, getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
45
- const workingDirectory = options?.projectName && getWorkspaceConfig(tree)?.projects[options.projectName]?.root || '.';
44
+ const workingDirectory = (options?.projectName && getWorkspaceConfig(tree)?.projects[options.projectName]?.root) || '.';
46
45
  const peerDepToInstall = getPeerDepWithPattern(path.resolve(__dirname, '..', '..', 'package.json'));
47
46
  context.addTask(new tasks_1.NodePackageInstallTask({
48
47
  workingDirectory,
49
48
  packageName: Object.entries(peerDepToInstall.matchingPackagesVersions)
50
- // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions
51
49
  .map(([dependency, version]) => `${dependency}@${version || 'latest'}`)
52
50
  .join(' '),
53
51
  hideOutput: false,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC"}
@@ -1,11 +1,11 @@
1
1
  import type { HttpClient } from '@angular/common/http';
2
- import type { RequestOptions, TokenizedOptions } from '../plugins/core/index';
3
2
  import { ApiTypes } from '../fwk/api';
4
3
  import type { PartialExcept } from '../fwk/api.interface';
5
4
  import type { ApiClient, RequestOptionsParameters } from '../fwk/core/api-client';
6
5
  import { BaseApiClientOptions } from '../fwk/core/base-api-constructor';
7
- import { ReviverType } from '../fwk/Reviver';
6
+ import { ReviverType } from '../fwk/reviver';
8
7
  import type { AngularPlugin } from '../plugins/core/angular-plugin';
8
+ import type { RequestOptions, TokenizedOptions } from '../plugins/core/index';
9
9
  /**
10
10
  * @see BaseApiClientOptions
11
11
  * @deprecated Use the one exposed by {@link @ama-sdk/client-angular}, will be removed in v13
@@ -1 +1 @@
1
- {"version":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AAE,GAAG,EAAE,IAAI,EAAE,MAAM;IAI9C,kBAAkB;IACX,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,cAAc,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,GAAG,GAAG,gBAAgB,GAAG,SAAS;IAI1K,kBAAkB;IACL,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACzJ,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;KAAE,EACnL,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CA4FpC"}
@@ -1,7 +1,7 @@
1
- import { ExceptionReply } from '../plugins/exception';
2
- import { ReviverReply } from '../plugins/reviver';
3
- import { extractQueryParams, filterUndefinedValues, getResponseReviver, prepareUrl, processFormData, tokenizeRequestOptions } from '../fwk/api.helpers';
4
- import { EmptyResponseError } from '../fwk/errors';
1
+ import { extractQueryParams, filterUndefinedValues, getResponseReviver, prepareUrl, processFormData, tokenizeRequestOptions, } from '../fwk/api.helpers';
2
+ import { EmptyResponseError, } from '../fwk/errors';
3
+ import { ExceptionReply, } from '../plugins/exception';
4
+ import { ReviverReply, } from '../plugins/reviver';
5
5
  const DEFAULT_OPTIONS = {
6
6
  replyPlugins: [new ReviverReply(), new ExceptionReply()],
7
7
  angularPlugins: [],
@@ -90,13 +90,14 @@ export class ApiAngularClient {
90
90
  }
91
91
  const subscription = httpRequest.subscribe({
92
92
  next: (res) => data = res,
93
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- subscription forwards the error from the httpRequest to asyncResponse promise
93
94
  error: (err) => reject(err),
94
95
  complete: () => resolve(data)
95
96
  });
96
97
  metadataSignal?.throwIfAborted();
97
98
  metadataSignal?.addEventListener('abort', () => {
98
99
  subscription.unsubscribe();
99
- reject(metadataSignal.reason);
100
+ reject(metadataSignal.reason instanceof Error ? metadataSignal.reason : new Error(metadataSignal.reason.toString()));
100
101
  });
101
102
  });
102
103
  response = await asyncResponse;
@@ -105,10 +106,10 @@ export class ApiAngularClient {
105
106
  catch (e) {
106
107
  exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, { apiName, operationId, url, origin });
107
108
  }
108
- // eslint-disable-next-line no-console
109
+ // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12.
109
110
  const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback, log: console.error });
110
- const replyPlugins = this.options.replyPlugins ?
111
- this.options.replyPlugins.map((plugin) => plugin.load({
111
+ const replyPlugins = this.options.replyPlugins
112
+ ? this.options.replyPlugins.map((plugin) => plugin.load({
112
113
  dictionaries: root && root.dictionaries,
113
114
  response: response && {
114
115
  ...response,
@@ -123,7 +124,8 @@ export class ApiAngularClient {
123
124
  url,
124
125
  origin,
125
126
  logger: this.options.logger
126
- })) : [];
127
+ }))
128
+ : [];
127
129
  let parsedData = root;
128
130
  for (const pluginRunner of replyPlugins) {
129
131
  parsedData = await pluginRunner.transform(parsedData);