@ht-sdks/events-sdk-js-browser 1.0.4

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 (689) hide show
  1. package/LICENSE.MD +45 -0
  2. package/README.md +227 -0
  3. package/dist/cjs/browser/browser-umd.js +21 -0
  4. package/dist/cjs/browser/browser-umd.js.map +1 -0
  5. package/dist/cjs/browser/index.js +351 -0
  6. package/dist/cjs/browser/index.js.map +1 -0
  7. package/dist/cjs/browser/standalone-analytics.js +62 -0
  8. package/dist/cjs/browser/standalone-analytics.js.map +1 -0
  9. package/dist/cjs/browser/standalone-interface.js +3 -0
  10. package/dist/cjs/browser/standalone-interface.js.map +1 -0
  11. package/dist/cjs/browser/standalone.js +95 -0
  12. package/dist/cjs/browser/standalone.js.map +1 -0
  13. package/dist/cjs/core/analytics/index.js +589 -0
  14. package/dist/cjs/core/analytics/index.js.map +1 -0
  15. package/dist/cjs/core/analytics/interfaces.js +3 -0
  16. package/dist/cjs/core/analytics/interfaces.js.map +1 -0
  17. package/dist/cjs/core/arguments-resolver/index.js +134 -0
  18. package/dist/cjs/core/arguments-resolver/index.js.map +1 -0
  19. package/dist/cjs/core/auto-track.js +108 -0
  20. package/dist/cjs/core/auto-track.js.map +1 -0
  21. package/dist/cjs/core/buffer/index.js +303 -0
  22. package/dist/cjs/core/buffer/index.js.map +1 -0
  23. package/dist/cjs/core/callback/index.js +7 -0
  24. package/dist/cjs/core/callback/index.js.map +1 -0
  25. package/dist/cjs/core/connection/index.js +16 -0
  26. package/dist/cjs/core/connection/index.js.map +1 -0
  27. package/dist/cjs/core/constants/index.js +5 -0
  28. package/dist/cjs/core/constants/index.js.map +1 -0
  29. package/dist/cjs/core/context/index.js +19 -0
  30. package/dist/cjs/core/context/index.js.map +1 -0
  31. package/dist/cjs/core/environment/index.js +12 -0
  32. package/dist/cjs/core/environment/index.js.map +1 -0
  33. package/dist/cjs/core/events/index.js +138 -0
  34. package/dist/cjs/core/events/index.js.map +1 -0
  35. package/dist/cjs/core/events/interfaces.js +3 -0
  36. package/dist/cjs/core/events/interfaces.js.map +1 -0
  37. package/dist/cjs/core/inspector/index.js +14 -0
  38. package/dist/cjs/core/inspector/index.js.map +1 -0
  39. package/dist/cjs/core/page/add-page-context.js +25 -0
  40. package/dist/cjs/core/page/add-page-context.js.map +1 -0
  41. package/dist/cjs/core/page/get-page-context.js +92 -0
  42. package/dist/cjs/core/page/get-page-context.js.map +1 -0
  43. package/dist/cjs/core/page/index.js +6 -0
  44. package/dist/cjs/core/page/index.js.map +1 -0
  45. package/dist/cjs/core/plugin/index.js +3 -0
  46. package/dist/cjs/core/plugin/index.js.map +1 -0
  47. package/dist/cjs/core/query-string/gracefulDecodeURIComponent.js +20 -0
  48. package/dist/cjs/core/query-string/gracefulDecodeURIComponent.js.map +1 -0
  49. package/dist/cjs/core/query-string/index.js +48 -0
  50. package/dist/cjs/core/query-string/index.js.map +1 -0
  51. package/dist/cjs/core/query-string/pickPrefix.js +20 -0
  52. package/dist/cjs/core/query-string/pickPrefix.js.map +1 -0
  53. package/dist/cjs/core/queue/event-queue.js +27 -0
  54. package/dist/cjs/core/queue/event-queue.js.map +1 -0
  55. package/dist/cjs/core/session/index.js +71 -0
  56. package/dist/cjs/core/session/index.js.map +1 -0
  57. package/dist/cjs/core/stats/index.js +23 -0
  58. package/dist/cjs/core/stats/index.js.map +1 -0
  59. package/dist/cjs/core/stats/remote-metrics.js +111 -0
  60. package/dist/cjs/core/stats/remote-metrics.js.map +1 -0
  61. package/dist/cjs/core/storage/cookieStorage.js +72 -0
  62. package/dist/cjs/core/storage/cookieStorage.js.map +1 -0
  63. package/dist/cjs/core/storage/index.js +64 -0
  64. package/dist/cjs/core/storage/index.js.map +1 -0
  65. package/dist/cjs/core/storage/localStorage.js +51 -0
  66. package/dist/cjs/core/storage/localStorage.js.map +1 -0
  67. package/dist/cjs/core/storage/memoryStorage.js +24 -0
  68. package/dist/cjs/core/storage/memoryStorage.js.map +1 -0
  69. package/dist/cjs/core/storage/settings.js +16 -0
  70. package/dist/cjs/core/storage/settings.js.map +1 -0
  71. package/dist/cjs/core/storage/types.js +9 -0
  72. package/dist/cjs/core/storage/types.js.map +1 -0
  73. package/dist/cjs/core/storage/universalStorage.js +66 -0
  74. package/dist/cjs/core/storage/universalStorage.js.map +1 -0
  75. package/dist/cjs/core/user/index.js +273 -0
  76. package/dist/cjs/core/user/index.js.map +1 -0
  77. package/dist/cjs/core/user/migrate.js +114 -0
  78. package/dist/cjs/core/user/migrate.js.map +1 -0
  79. package/dist/cjs/core/user/tld.js +64 -0
  80. package/dist/cjs/core/user/tld.js.map +1 -0
  81. package/dist/cjs/core/user/vendor/crypto-es/lib/aes.js +248 -0
  82. package/dist/cjs/core/user/vendor/crypto-es/lib/aes.js.map +1 -0
  83. package/dist/cjs/core/user/vendor/crypto-es/lib/cipher-core.js +841 -0
  84. package/dist/cjs/core/user/vendor/crypto-es/lib/cipher-core.js.map +1 -0
  85. package/dist/cjs/core/user/vendor/crypto-es/lib/core.js +747 -0
  86. package/dist/cjs/core/user/vendor/crypto-es/lib/core.js.map +1 -0
  87. package/dist/cjs/core/user/vendor/crypto-es/lib/enc-base64.js +102 -0
  88. package/dist/cjs/core/user/vendor/crypto-es/lib/enc-base64.js.map +1 -0
  89. package/dist/cjs/core/user/vendor/crypto-es/lib/evpkdf.js +105 -0
  90. package/dist/cjs/core/user/vendor/crypto-es/lib/evpkdf.js.map +1 -0
  91. package/dist/cjs/core/user/vendor/crypto-es/lib/md5.js +217 -0
  92. package/dist/cjs/core/user/vendor/crypto-es/lib/md5.js.map +1 -0
  93. package/dist/cjs/generated/version.js +6 -0
  94. package/dist/cjs/generated/version.js.map +1 -0
  95. package/dist/cjs/index.js +16 -0
  96. package/dist/cjs/index.js.map +1 -0
  97. package/dist/cjs/lib/bind-all.js +17 -0
  98. package/dist/cjs/lib/bind-all.js.map +1 -0
  99. package/dist/cjs/lib/browser-polyfill.js +22 -0
  100. package/dist/cjs/lib/browser-polyfill.js.map +1 -0
  101. package/dist/cjs/lib/client-hints/index.js +21 -0
  102. package/dist/cjs/lib/client-hints/index.js.map +1 -0
  103. package/dist/cjs/lib/client-hints/interfaces.js +3 -0
  104. package/dist/cjs/lib/client-hints/interfaces.js.map +1 -0
  105. package/dist/cjs/lib/create-deferred.js +21 -0
  106. package/dist/cjs/lib/create-deferred.js.map +1 -0
  107. package/dist/cjs/lib/csp-detection.js +8 -0
  108. package/dist/cjs/lib/csp-detection.js.map +1 -0
  109. package/dist/cjs/lib/embedded-write-key.js +22 -0
  110. package/dist/cjs/lib/embedded-write-key.js.map +1 -0
  111. package/dist/cjs/lib/fetch.js +19 -0
  112. package/dist/cjs/lib/fetch.js.map +1 -0
  113. package/dist/cjs/lib/get-global.js +21 -0
  114. package/dist/cjs/lib/get-global.js.map +1 -0
  115. package/dist/cjs/lib/get-process-env.js +15 -0
  116. package/dist/cjs/lib/get-process-env.js.map +1 -0
  117. package/dist/cjs/lib/global-analytics-helper.js +34 -0
  118. package/dist/cjs/lib/global-analytics-helper.js.map +1 -0
  119. package/dist/cjs/lib/group-by.js +28 -0
  120. package/dist/cjs/lib/group-by.js.map +1 -0
  121. package/dist/cjs/lib/is-plan-event-enabled.js +20 -0
  122. package/dist/cjs/lib/is-plan-event-enabled.js.map +1 -0
  123. package/dist/cjs/lib/is-thenable.js +15 -0
  124. package/dist/cjs/lib/is-thenable.js.map +1 -0
  125. package/dist/cjs/lib/load-script.js +56 -0
  126. package/dist/cjs/lib/load-script.js.map +1 -0
  127. package/dist/cjs/lib/merged-options.js +31 -0
  128. package/dist/cjs/lib/merged-options.js.map +1 -0
  129. package/dist/cjs/lib/on-page-change.js +35 -0
  130. package/dist/cjs/lib/on-page-change.js.map +1 -0
  131. package/dist/cjs/lib/p-while.js +25 -0
  132. package/dist/cjs/lib/p-while.js.map +1 -0
  133. package/dist/cjs/lib/parse-cdn.js +55 -0
  134. package/dist/cjs/lib/parse-cdn.js.map +1 -0
  135. package/dist/cjs/lib/pick.js +19 -0
  136. package/dist/cjs/lib/pick.js.map +1 -0
  137. package/dist/cjs/lib/priority-queue/backoff.js +10 -0
  138. package/dist/cjs/lib/priority-queue/backoff.js.map +1 -0
  139. package/dist/cjs/lib/priority-queue/index.js +7 -0
  140. package/dist/cjs/lib/priority-queue/index.js.map +1 -0
  141. package/dist/cjs/lib/priority-queue/persisted.js +108 -0
  142. package/dist/cjs/lib/priority-queue/persisted.js.map +1 -0
  143. package/dist/cjs/lib/sleep.js +10 -0
  144. package/dist/cjs/lib/sleep.js.map +1 -0
  145. package/dist/cjs/lib/to-facade.js +32 -0
  146. package/dist/cjs/lib/to-facade.js.map +1 -0
  147. package/dist/cjs/lib/version-type.js +14 -0
  148. package/dist/cjs/lib/version-type.js.map +1 -0
  149. package/dist/cjs/node/index.js +43 -0
  150. package/dist/cjs/node/index.js.map +1 -0
  151. package/dist/cjs/node/node.browser.js +13 -0
  152. package/dist/cjs/node/node.browser.js.map +1 -0
  153. package/dist/cjs/plugins/ajs-destination/index.js +345 -0
  154. package/dist/cjs/plugins/ajs-destination/index.js.map +1 -0
  155. package/dist/cjs/plugins/ajs-destination/loader.js +110 -0
  156. package/dist/cjs/plugins/ajs-destination/loader.js.map +1 -0
  157. package/dist/cjs/plugins/ajs-destination/types.js +3 -0
  158. package/dist/cjs/plugins/ajs-destination/types.js.map +1 -0
  159. package/dist/cjs/plugins/ajs-destination/utils.js +23 -0
  160. package/dist/cjs/plugins/ajs-destination/utils.js.map +1 -0
  161. package/dist/cjs/plugins/analytics-node/index.js +65 -0
  162. package/dist/cjs/plugins/analytics-node/index.js.map +1 -0
  163. package/dist/cjs/plugins/env-enrichment/index.js +181 -0
  164. package/dist/cjs/plugins/env-enrichment/index.js.map +1 -0
  165. package/dist/cjs/plugins/hightouchio/batched-dispatcher.js +113 -0
  166. package/dist/cjs/plugins/hightouchio/batched-dispatcher.js.map +1 -0
  167. package/dist/cjs/plugins/hightouchio/fetch-dispatcher.js +21 -0
  168. package/dist/cjs/plugins/hightouchio/fetch-dispatcher.js.map +1 -0
  169. package/dist/cjs/plugins/hightouchio/index.js +100 -0
  170. package/dist/cjs/plugins/hightouchio/index.js.map +1 -0
  171. package/dist/cjs/plugins/hightouchio/normalize.js +54 -0
  172. package/dist/cjs/plugins/hightouchio/normalize.js.map +1 -0
  173. package/dist/cjs/plugins/hightouchio/schedule-flush.js +76 -0
  174. package/dist/cjs/plugins/hightouchio/schedule-flush.js.map +1 -0
  175. package/dist/cjs/plugins/legacy-video-plugins/index.js +25 -0
  176. package/dist/cjs/plugins/legacy-video-plugins/index.js.map +1 -0
  177. package/dist/cjs/plugins/middleware/index.js +124 -0
  178. package/dist/cjs/plugins/middleware/index.js.map +1 -0
  179. package/dist/cjs/plugins/remote-loader/index.js +236 -0
  180. package/dist/cjs/plugins/remote-loader/index.js.map +1 -0
  181. package/dist/cjs/plugins/remote-middleware/index.js +70 -0
  182. package/dist/cjs/plugins/remote-middleware/index.js.map +1 -0
  183. package/dist/cjs/plugins/routing-middleware/index.js +26 -0
  184. package/dist/cjs/plugins/routing-middleware/index.js.map +1 -0
  185. package/dist/cjs/plugins/schema-filter/index.js +67 -0
  186. package/dist/cjs/plugins/schema-filter/index.js.map +1 -0
  187. package/dist/cjs/plugins/validation/index.js +33 -0
  188. package/dist/cjs/plugins/validation/index.js.map +1 -0
  189. package/dist/pkg/browser/browser-umd.js +18 -0
  190. package/dist/pkg/browser/browser-umd.js.map +1 -0
  191. package/dist/pkg/browser/index.js +347 -0
  192. package/dist/pkg/browser/index.js.map +1 -0
  193. package/dist/pkg/browser/standalone-analytics.js +58 -0
  194. package/dist/pkg/browser/standalone-analytics.js.map +1 -0
  195. package/dist/pkg/browser/standalone-interface.js +2 -0
  196. package/dist/pkg/browser/standalone-interface.js.map +1 -0
  197. package/dist/pkg/browser/standalone.js +93 -0
  198. package/dist/pkg/browser/standalone.js.map +1 -0
  199. package/dist/pkg/core/analytics/index.js +586 -0
  200. package/dist/pkg/core/analytics/index.js.map +1 -0
  201. package/dist/pkg/core/analytics/interfaces.js +2 -0
  202. package/dist/pkg/core/analytics/interfaces.js.map +1 -0
  203. package/dist/pkg/core/arguments-resolver/index.js +127 -0
  204. package/dist/pkg/core/arguments-resolver/index.js.map +1 -0
  205. package/dist/pkg/core/auto-track.js +103 -0
  206. package/dist/pkg/core/auto-track.js.map +1 -0
  207. package/dist/pkg/core/buffer/index.js +295 -0
  208. package/dist/pkg/core/buffer/index.js.map +1 -0
  209. package/dist/pkg/core/callback/index.js +2 -0
  210. package/dist/pkg/core/callback/index.js.map +1 -0
  211. package/dist/pkg/core/connection/index.js +11 -0
  212. package/dist/pkg/core/connection/index.js.map +1 -0
  213. package/dist/pkg/core/constants/index.js +2 -0
  214. package/dist/pkg/core/constants/index.js.map +1 -0
  215. package/dist/pkg/core/context/index.js +16 -0
  216. package/dist/pkg/core/context/index.js.map +1 -0
  217. package/dist/pkg/core/environment/index.js +7 -0
  218. package/dist/pkg/core/environment/index.js.map +1 -0
  219. package/dist/pkg/core/events/index.js +135 -0
  220. package/dist/pkg/core/events/index.js.map +1 -0
  221. package/dist/pkg/core/events/interfaces.js +2 -0
  222. package/dist/pkg/core/events/interfaces.js.map +1 -0
  223. package/dist/pkg/core/inspector/index.js +10 -0
  224. package/dist/pkg/core/inspector/index.js.map +1 -0
  225. package/dist/pkg/core/page/add-page-context.js +21 -0
  226. package/dist/pkg/core/page/add-page-context.js.map +1 -0
  227. package/dist/pkg/core/page/get-page-context.js +84 -0
  228. package/dist/pkg/core/page/get-page-context.js.map +1 -0
  229. package/dist/pkg/core/page/index.js +3 -0
  230. package/dist/pkg/core/page/index.js.map +1 -0
  231. package/dist/pkg/core/plugin/index.js +2 -0
  232. package/dist/pkg/core/plugin/index.js.map +1 -0
  233. package/dist/pkg/core/query-string/gracefulDecodeURIComponent.js +16 -0
  234. package/dist/pkg/core/query-string/gracefulDecodeURIComponent.js.map +1 -0
  235. package/dist/pkg/core/query-string/index.js +44 -0
  236. package/dist/pkg/core/query-string/index.js.map +1 -0
  237. package/dist/pkg/core/query-string/pickPrefix.js +16 -0
  238. package/dist/pkg/core/query-string/pickPrefix.js.map +1 -0
  239. package/dist/pkg/core/queue/event-queue.js +24 -0
  240. package/dist/pkg/core/queue/event-queue.js.map +1 -0
  241. package/dist/pkg/core/session/index.js +63 -0
  242. package/dist/pkg/core/session/index.js.map +1 -0
  243. package/dist/pkg/core/stats/index.js +20 -0
  244. package/dist/pkg/core/stats/index.js.map +1 -0
  245. package/dist/pkg/core/stats/remote-metrics.js +108 -0
  246. package/dist/pkg/core/stats/remote-metrics.js.map +1 -0
  247. package/dist/pkg/core/storage/cookieStorage.js +69 -0
  248. package/dist/pkg/core/storage/cookieStorage.js.map +1 -0
  249. package/dist/pkg/core/storage/index.js +58 -0
  250. package/dist/pkg/core/storage/index.js.map +1 -0
  251. package/dist/pkg/core/storage/localStorage.js +48 -0
  252. package/dist/pkg/core/storage/localStorage.js.map +1 -0
  253. package/dist/pkg/core/storage/memoryStorage.js +21 -0
  254. package/dist/pkg/core/storage/memoryStorage.js.map +1 -0
  255. package/dist/pkg/core/storage/settings.js +11 -0
  256. package/dist/pkg/core/storage/settings.js.map +1 -0
  257. package/dist/pkg/core/storage/types.js +6 -0
  258. package/dist/pkg/core/storage/types.js.map +1 -0
  259. package/dist/pkg/core/storage/universalStorage.js +63 -0
  260. package/dist/pkg/core/storage/universalStorage.js.map +1 -0
  261. package/dist/pkg/core/user/index.js +270 -0
  262. package/dist/pkg/core/user/index.js.map +1 -0
  263. package/dist/pkg/core/user/migrate.js +109 -0
  264. package/dist/pkg/core/user/migrate.js.map +1 -0
  265. package/dist/pkg/core/user/tld.js +59 -0
  266. package/dist/pkg/core/user/tld.js.map +1 -0
  267. package/dist/pkg/core/user/vendor/crypto-es/lib/aes.js +245 -0
  268. package/dist/pkg/core/user/vendor/crypto-es/lib/aes.js.map +1 -0
  269. package/dist/pkg/core/user/vendor/crypto-es/lib/cipher-core.js +838 -0
  270. package/dist/pkg/core/user/vendor/crypto-es/lib/cipher-core.js.map +1 -0
  271. package/dist/pkg/core/user/vendor/crypto-es/lib/core.js +744 -0
  272. package/dist/pkg/core/user/vendor/crypto-es/lib/core.js.map +1 -0
  273. package/dist/pkg/core/user/vendor/crypto-es/lib/enc-base64.js +98 -0
  274. package/dist/pkg/core/user/vendor/crypto-es/lib/enc-base64.js.map +1 -0
  275. package/dist/pkg/core/user/vendor/crypto-es/lib/evpkdf.js +101 -0
  276. package/dist/pkg/core/user/vendor/crypto-es/lib/evpkdf.js.map +1 -0
  277. package/dist/pkg/core/user/vendor/crypto-es/lib/md5.js +214 -0
  278. package/dist/pkg/core/user/vendor/crypto-es/lib/md5.js.map +1 -0
  279. package/dist/pkg/generated/version.js +3 -0
  280. package/dist/pkg/generated/version.js.map +1 -0
  281. package/dist/pkg/index.js +10 -0
  282. package/dist/pkg/index.js.map +1 -0
  283. package/dist/pkg/lib/bind-all.js +14 -0
  284. package/dist/pkg/lib/bind-all.js.map +1 -0
  285. package/dist/pkg/lib/browser-polyfill.js +18 -0
  286. package/dist/pkg/lib/browser-polyfill.js.map +1 -0
  287. package/dist/pkg/lib/client-hints/index.js +17 -0
  288. package/dist/pkg/lib/client-hints/index.js.map +1 -0
  289. package/dist/pkg/lib/client-hints/interfaces.js +2 -0
  290. package/dist/pkg/lib/client-hints/interfaces.js.map +1 -0
  291. package/dist/pkg/lib/create-deferred.js +17 -0
  292. package/dist/pkg/lib/create-deferred.js.map +1 -0
  293. package/dist/pkg/lib/csp-detection.js +4 -0
  294. package/dist/pkg/lib/csp-detection.js.map +1 -0
  295. package/dist/pkg/lib/embedded-write-key.js +18 -0
  296. package/dist/pkg/lib/embedded-write-key.js.map +1 -0
  297. package/dist/pkg/lib/fetch.js +14 -0
  298. package/dist/pkg/lib/fetch.js.map +1 -0
  299. package/dist/pkg/lib/get-global.js +17 -0
  300. package/dist/pkg/lib/get-global.js.map +1 -0
  301. package/dist/pkg/lib/get-process-env.js +11 -0
  302. package/dist/pkg/lib/get-process-env.js.map +1 -0
  303. package/dist/pkg/lib/global-analytics-helper.js +28 -0
  304. package/dist/pkg/lib/global-analytics-helper.js.map +1 -0
  305. package/dist/pkg/lib/group-by.js +24 -0
  306. package/dist/pkg/lib/group-by.js.map +1 -0
  307. package/dist/pkg/lib/is-plan-event-enabled.js +16 -0
  308. package/dist/pkg/lib/is-plan-event-enabled.js.map +1 -0
  309. package/dist/pkg/lib/is-thenable.js +11 -0
  310. package/dist/pkg/lib/is-thenable.js.map +1 -0
  311. package/dist/pkg/lib/load-script.js +51 -0
  312. package/dist/pkg/lib/load-script.js.map +1 -0
  313. package/dist/pkg/lib/merged-options.js +27 -0
  314. package/dist/pkg/lib/merged-options.js.map +1 -0
  315. package/dist/pkg/lib/on-page-change.js +31 -0
  316. package/dist/pkg/lib/on-page-change.js.map +1 -0
  317. package/dist/pkg/lib/p-while.js +21 -0
  318. package/dist/pkg/lib/p-while.js.map +1 -0
  319. package/dist/pkg/lib/parse-cdn.js +49 -0
  320. package/dist/pkg/lib/parse-cdn.js.map +1 -0
  321. package/dist/pkg/lib/pick.js +15 -0
  322. package/dist/pkg/lib/pick.js.map +1 -0
  323. package/dist/pkg/lib/priority-queue/backoff.js +6 -0
  324. package/dist/pkg/lib/priority-queue/backoff.js.map +1 -0
  325. package/dist/pkg/lib/priority-queue/index.js +3 -0
  326. package/dist/pkg/lib/priority-queue/index.js.map +1 -0
  327. package/dist/pkg/lib/priority-queue/persisted.js +105 -0
  328. package/dist/pkg/lib/priority-queue/persisted.js.map +1 -0
  329. package/dist/pkg/lib/sleep.js +6 -0
  330. package/dist/pkg/lib/sleep.js.map +1 -0
  331. package/dist/pkg/lib/to-facade.js +28 -0
  332. package/dist/pkg/lib/to-facade.js.map +1 -0
  333. package/dist/pkg/lib/version-type.js +9 -0
  334. package/dist/pkg/lib/version-type.js.map +1 -0
  335. package/dist/pkg/node/index.js +40 -0
  336. package/dist/pkg/node/index.js.map +1 -0
  337. package/dist/pkg/node/node.browser.js +10 -0
  338. package/dist/pkg/node/node.browser.js.map +1 -0
  339. package/dist/pkg/plugins/ajs-destination/index.js +341 -0
  340. package/dist/pkg/plugins/ajs-destination/index.js.map +1 -0
  341. package/dist/pkg/plugins/ajs-destination/loader.js +102 -0
  342. package/dist/pkg/plugins/ajs-destination/loader.js.map +1 -0
  343. package/dist/pkg/plugins/ajs-destination/types.js +2 -0
  344. package/dist/pkg/plugins/ajs-destination/types.js.map +1 -0
  345. package/dist/pkg/plugins/ajs-destination/utils.js +18 -0
  346. package/dist/pkg/plugins/ajs-destination/utils.js.map +1 -0
  347. package/dist/pkg/plugins/analytics-node/index.js +60 -0
  348. package/dist/pkg/plugins/analytics-node/index.js.map +1 -0
  349. package/dist/pkg/plugins/env-enrichment/index.js +176 -0
  350. package/dist/pkg/plugins/env-enrichment/index.js.map +1 -0
  351. package/dist/pkg/plugins/hightouchio/batched-dispatcher.js +110 -0
  352. package/dist/pkg/plugins/hightouchio/batched-dispatcher.js.map +1 -0
  353. package/dist/pkg/plugins/hightouchio/fetch-dispatcher.js +18 -0
  354. package/dist/pkg/plugins/hightouchio/fetch-dispatcher.js.map +1 -0
  355. package/dist/pkg/plugins/hightouchio/index.js +96 -0
  356. package/dist/pkg/plugins/hightouchio/index.js.map +1 -0
  357. package/dist/pkg/plugins/hightouchio/normalize.js +50 -0
  358. package/dist/pkg/plugins/hightouchio/normalize.js.map +1 -0
  359. package/dist/pkg/plugins/hightouchio/schedule-flush.js +72 -0
  360. package/dist/pkg/plugins/hightouchio/schedule-flush.js.map +1 -0
  361. package/dist/pkg/plugins/legacy-video-plugins/index.js +25 -0
  362. package/dist/pkg/plugins/legacy-video-plugins/index.js.map +1 -0
  363. package/dist/pkg/plugins/middleware/index.js +119 -0
  364. package/dist/pkg/plugins/middleware/index.js.map +1 -0
  365. package/dist/pkg/plugins/remote-loader/index.js +232 -0
  366. package/dist/pkg/plugins/remote-loader/index.js.map +1 -0
  367. package/dist/pkg/plugins/remote-middleware/index.js +66 -0
  368. package/dist/pkg/plugins/remote-middleware/index.js.map +1 -0
  369. package/dist/pkg/plugins/routing-middleware/index.js +21 -0
  370. package/dist/pkg/plugins/routing-middleware/index.js.map +1 -0
  371. package/dist/pkg/plugins/schema-filter/index.js +63 -0
  372. package/dist/pkg/plugins/schema-filter/index.js.map +1 -0
  373. package/dist/pkg/plugins/validation/index.js +30 -0
  374. package/dist/pkg/plugins/validation/index.js.map +1 -0
  375. package/dist/types/browser/browser-umd.d.ts +2 -0
  376. package/dist/types/browser/browser-umd.d.ts.map +1 -0
  377. package/dist/types/browser/index.d.ts +109 -0
  378. package/dist/types/browser/index.d.ts.map +1 -0
  379. package/dist/types/browser/standalone-analytics.d.ts +2 -0
  380. package/dist/types/browser/standalone-analytics.d.ts.map +1 -0
  381. package/dist/types/browser/standalone-interface.d.ts +10 -0
  382. package/dist/types/browser/standalone-interface.d.ts.map +1 -0
  383. package/dist/types/browser/standalone.d.ts +2 -0
  384. package/dist/types/browser/standalone.d.ts.map +1 -0
  385. package/dist/types/core/analytics/index.d.ts +149 -0
  386. package/dist/types/core/analytics/index.d.ts.map +1 -0
  387. package/dist/types/core/analytics/interfaces.d.ts +77 -0
  388. package/dist/types/core/analytics/interfaces.d.ts.map +1 -0
  389. package/dist/types/core/arguments-resolver/index.d.ts +34 -0
  390. package/dist/types/core/arguments-resolver/index.d.ts.map +1 -0
  391. package/dist/types/core/auto-track.d.ts +10 -0
  392. package/dist/types/core/auto-track.d.ts.map +1 -0
  393. package/dist/types/core/buffer/index.d.ts +102 -0
  394. package/dist/types/core/buffer/index.d.ts.map +1 -0
  395. package/dist/types/core/callback/index.d.ts +2 -0
  396. package/dist/types/core/callback/index.d.ts.map +1 -0
  397. package/dist/types/core/connection/index.d.ts +3 -0
  398. package/dist/types/core/connection/index.d.ts.map +1 -0
  399. package/dist/types/core/constants/index.d.ts +2 -0
  400. package/dist/types/core/constants/index.d.ts.map +1 -0
  401. package/dist/types/core/context/index.d.ts +9 -0
  402. package/dist/types/core/context/index.d.ts.map +1 -0
  403. package/dist/types/core/environment/index.d.ts +3 -0
  404. package/dist/types/core/environment/index.d.ts.map +1 -0
  405. package/dist/types/core/events/index.d.ts +22 -0
  406. package/dist/types/core/events/index.d.ts.map +1 -0
  407. package/dist/types/core/events/interfaces.d.ts +9 -0
  408. package/dist/types/core/events/interfaces.d.ts.map +1 -0
  409. package/dist/types/core/inspector/index.d.ts +3 -0
  410. package/dist/types/core/inspector/index.d.ts.map +1 -0
  411. package/dist/types/core/page/add-page-context.d.ts +9 -0
  412. package/dist/types/core/page/add-page-context.d.ts.map +1 -0
  413. package/dist/types/core/page/get-page-context.d.ts +45 -0
  414. package/dist/types/core/page/get-page-context.d.ts.map +1 -0
  415. package/dist/types/core/page/index.d.ts +3 -0
  416. package/dist/types/core/page/index.d.ts.map +1 -0
  417. package/dist/types/core/plugin/index.d.ts +11 -0
  418. package/dist/types/core/plugin/index.d.ts.map +1 -0
  419. package/dist/types/core/query-string/gracefulDecodeURIComponent.d.ts +9 -0
  420. package/dist/types/core/query-string/gracefulDecodeURIComponent.d.ts.map +1 -0
  421. package/dist/types/core/query-string/index.d.ts +7 -0
  422. package/dist/types/core/query-string/index.d.ts.map +1 -0
  423. package/dist/types/core/query-string/pickPrefix.d.ts +9 -0
  424. package/dist/types/core/query-string/pickPrefix.d.ts.map +1 -0
  425. package/dist/types/core/queue/event-queue.d.ts +10 -0
  426. package/dist/types/core/queue/event-queue.d.ts.map +1 -0
  427. package/dist/types/core/session/index.d.ts +32 -0
  428. package/dist/types/core/session/index.d.ts.map +1 -0
  429. package/dist/types/core/stats/index.d.ts +7 -0
  430. package/dist/types/core/stats/index.d.ts.map +1 -0
  431. package/dist/types/core/stats/remote-metrics.d.ts +32 -0
  432. package/dist/types/core/stats/remote-metrics.d.ts.map +1 -0
  433. package/dist/types/core/storage/cookieStorage.d.ts +21 -0
  434. package/dist/types/core/storage/cookieStorage.d.ts.map +1 -0
  435. package/dist/types/core/storage/index.d.ts +22 -0
  436. package/dist/types/core/storage/index.d.ts.map +1 -0
  437. package/dist/types/core/storage/localStorage.d.ts +11 -0
  438. package/dist/types/core/storage/localStorage.d.ts.map +1 -0
  439. package/dist/types/core/storage/memoryStorage.d.ts +11 -0
  440. package/dist/types/core/storage/memoryStorage.d.ts.map +1 -0
  441. package/dist/types/core/storage/settings.d.ts +8 -0
  442. package/dist/types/core/storage/settings.d.ts.map +1 -0
  443. package/dist/types/core/storage/types.d.ts +43 -0
  444. package/dist/types/core/storage/types.d.ts.map +1 -0
  445. package/dist/types/core/storage/universalStorage.d.ts +13 -0
  446. package/dist/types/core/storage/universalStorage.d.ts.map +1 -0
  447. package/dist/types/core/user/index.d.ts +81 -0
  448. package/dist/types/core/user/index.d.ts.map +1 -0
  449. package/dist/types/core/user/migrate.d.ts +11 -0
  450. package/dist/types/core/user/migrate.d.ts.map +1 -0
  451. package/dist/types/core/user/tld.d.ts +2 -0
  452. package/dist/types/core/user/tld.d.ts.map +1 -0
  453. package/dist/types/core/user/vendor/crypto-es/lib/aes.d.ts +23 -0
  454. package/dist/types/core/user/vendor/crypto-es/lib/aes.d.ts.map +1 -0
  455. package/dist/types/core/user/vendor/crypto-es/lib/cipher-core.d.ts +436 -0
  456. package/dist/types/core/user/vendor/crypto-es/lib/cipher-core.d.ts.map +1 -0
  457. package/dist/types/core/user/vendor/crypto-es/lib/core.d.ts +432 -0
  458. package/dist/types/core/user/vendor/crypto-es/lib/core.d.ts.map +1 -0
  459. package/dist/types/core/user/vendor/crypto-es/lib/enc-base64.d.ts +36 -0
  460. package/dist/types/core/user/vendor/crypto-es/lib/enc-base64.d.ts.map +1 -0
  461. package/dist/types/core/user/vendor/crypto-es/lib/evpkdf.d.ts +51 -0
  462. package/dist/types/core/user/vendor/crypto-es/lib/evpkdf.d.ts.map +1 -0
  463. package/dist/types/core/user/vendor/crypto-es/lib/md5.d.ts +41 -0
  464. package/dist/types/core/user/vendor/crypto-es/lib/md5.d.ts.map +1 -0
  465. package/dist/types/generated/version.d.ts +2 -0
  466. package/dist/types/generated/version.d.ts.map +1 -0
  467. package/dist/types/index.d.ts +12 -0
  468. package/dist/types/index.d.ts.map +1 -0
  469. package/dist/types/lib/bind-all.d.ts +4 -0
  470. package/dist/types/lib/bind-all.d.ts.map +1 -0
  471. package/dist/types/lib/browser-polyfill.d.ts +2 -0
  472. package/dist/types/lib/browser-polyfill.d.ts.map +1 -0
  473. package/dist/types/lib/client-hints/index.d.ts +3 -0
  474. package/dist/types/lib/client-hints/index.d.ts.map +1 -0
  475. package/dist/types/lib/client-hints/interfaces.d.ts +28 -0
  476. package/dist/types/lib/client-hints/interfaces.d.ts.map +1 -0
  477. package/dist/types/lib/create-deferred.d.ts +9 -0
  478. package/dist/types/lib/create-deferred.d.ts.map +1 -0
  479. package/dist/types/lib/csp-detection.d.ts +6 -0
  480. package/dist/types/lib/csp-detection.d.ts.map +1 -0
  481. package/dist/types/lib/embedded-write-key.d.ts +7 -0
  482. package/dist/types/lib/embedded-write-key.d.ts.map +1 -0
  483. package/dist/types/lib/fetch.d.ts +5 -0
  484. package/dist/types/lib/fetch.d.ts.map +1 -0
  485. package/dist/types/lib/get-global.d.ts +2 -0
  486. package/dist/types/lib/get-global.d.ts.map +1 -0
  487. package/dist/types/lib/get-process-env.d.ts +8 -0
  488. package/dist/types/lib/get-process-env.d.ts.map +1 -0
  489. package/dist/types/lib/global-analytics-helper.d.ts +18 -0
  490. package/dist/types/lib/global-analytics-helper.d.ts.map +1 -0
  491. package/dist/types/lib/group-by.d.ts +4 -0
  492. package/dist/types/lib/group-by.d.ts.map +1 -0
  493. package/dist/types/lib/is-plan-event-enabled.d.ts +9 -0
  494. package/dist/types/lib/is-plan-event-enabled.d.ts.map +1 -0
  495. package/dist/types/lib/is-thenable.d.ts +6 -0
  496. package/dist/types/lib/is-thenable.d.ts.map +1 -0
  497. package/dist/types/lib/load-script.d.ts +3 -0
  498. package/dist/types/lib/load-script.d.ts.map +1 -0
  499. package/dist/types/lib/merged-options.d.ts +13 -0
  500. package/dist/types/lib/merged-options.d.ts.map +1 -0
  501. package/dist/types/lib/on-page-change.d.ts +11 -0
  502. package/dist/types/lib/on-page-change.d.ts.map +1 -0
  503. package/dist/types/lib/p-while.d.ts +2 -0
  504. package/dist/types/lib/p-while.d.ts.map +1 -0
  505. package/dist/types/lib/parse-cdn.d.ts +4 -0
  506. package/dist/types/lib/parse-cdn.d.ts.map +1 -0
  507. package/dist/types/lib/pick.d.ts +3 -0
  508. package/dist/types/lib/pick.d.ts.map +1 -0
  509. package/dist/types/lib/priority-queue/backoff.d.ts +13 -0
  510. package/dist/types/lib/priority-queue/backoff.d.ts.map +1 -0
  511. package/dist/types/lib/priority-queue/index.d.ts +3 -0
  512. package/dist/types/lib/priority-queue/index.d.ts.map +1 -0
  513. package/dist/types/lib/priority-queue/persisted.d.ts +6 -0
  514. package/dist/types/lib/priority-queue/persisted.d.ts.map +1 -0
  515. package/dist/types/lib/sleep.d.ts +2 -0
  516. package/dist/types/lib/sleep.d.ts.map +1 -0
  517. package/dist/types/lib/to-facade.d.ts +7 -0
  518. package/dist/types/lib/to-facade.d.ts.map +1 -0
  519. package/dist/types/lib/version-type.d.ts +5 -0
  520. package/dist/types/lib/version-type.d.ts.map +1 -0
  521. package/dist/types/node/index.d.ts +8 -0
  522. package/dist/types/node/index.d.ts.map +1 -0
  523. package/dist/types/node/node.browser.d.ts +4 -0
  524. package/dist/types/node/node.browser.d.ts.map +1 -0
  525. package/dist/types/plugins/ajs-destination/index.d.ts +42 -0
  526. package/dist/types/plugins/ajs-destination/index.d.ts.map +1 -0
  527. package/dist/types/plugins/ajs-destination/loader.d.ts +12 -0
  528. package/dist/types/plugins/ajs-destination/loader.d.ts.map +1 -0
  529. package/dist/types/plugins/ajs-destination/types.d.ts +36 -0
  530. package/dist/types/plugins/ajs-destination/types.d.ts.map +1 -0
  531. package/dist/types/plugins/ajs-destination/utils.d.ts +5 -0
  532. package/dist/types/plugins/ajs-destination/utils.d.ts.map +1 -0
  533. package/dist/types/plugins/analytics-node/index.d.ts +12 -0
  534. package/dist/types/plugins/analytics-node/index.d.ts.map +1 -0
  535. package/dist/types/plugins/env-enrichment/index.d.ts +25 -0
  536. package/dist/types/plugins/env-enrichment/index.d.ts.map +1 -0
  537. package/dist/types/plugins/hightouchio/batched-dispatcher.d.ts +8 -0
  538. package/dist/types/plugins/hightouchio/batched-dispatcher.d.ts.map +1 -0
  539. package/dist/types/plugins/hightouchio/fetch-dispatcher.d.ts +8 -0
  540. package/dist/types/plugins/hightouchio/fetch-dispatcher.d.ts.map +1 -0
  541. package/dist/types/plugins/hightouchio/index.d.ts +26 -0
  542. package/dist/types/plugins/hightouchio/index.d.ts.map +1 -0
  543. package/dist/types/plugins/hightouchio/normalize.d.ts +6 -0
  544. package/dist/types/plugins/hightouchio/normalize.d.ts.map +1 -0
  545. package/dist/types/plugins/hightouchio/schedule-flush.d.ts +5 -0
  546. package/dist/types/plugins/hightouchio/schedule-flush.d.ts.map +1 -0
  547. package/dist/types/plugins/legacy-video-plugins/index.d.ts +3 -0
  548. package/dist/types/plugins/legacy-video-plugins/index.d.ts.map +1 -0
  549. package/dist/types/plugins/middleware/index.d.ts +18 -0
  550. package/dist/types/plugins/middleware/index.d.ts.map +1 -0
  551. package/dist/types/plugins/remote-loader/index.d.ts +47 -0
  552. package/dist/types/plugins/remote-loader/index.d.ts.map +1 -0
  553. package/dist/types/plugins/remote-middleware/index.d.ts +5 -0
  554. package/dist/types/plugins/remote-middleware/index.d.ts.map +1 -0
  555. package/dist/types/plugins/routing-middleware/index.d.ts +13 -0
  556. package/dist/types/plugins/routing-middleware/index.d.ts.map +1 -0
  557. package/dist/types/plugins/schema-filter/index.d.ts +5 -0
  558. package/dist/types/plugins/schema-filter/index.d.ts.map +1 -0
  559. package/dist/types/plugins/validation/index.d.ts +3 -0
  560. package/dist/types/plugins/validation/index.d.ts.map +1 -0
  561. package/dist/umd/799.bundle.cf7e55682bfd23cde904.js +2 -0
  562. package/dist/umd/799.bundle.cf7e55682bfd23cde904.js.map +1 -0
  563. package/dist/umd/870.bundle.6d7307379da86a3bf277.js +2 -0
  564. package/dist/umd/870.bundle.6d7307379da86a3bf277.js.map +1 -0
  565. package/dist/umd/ajs-destination.bundle.5a985a542b0de08e3e49.js +2 -0
  566. package/dist/umd/ajs-destination.bundle.5a985a542b0de08e3e49.js.map +1 -0
  567. package/dist/umd/auto-track.bundle.08c0e0f63bb92f96f8b5.js +2 -0
  568. package/dist/umd/auto-track.bundle.08c0e0f63bb92f96f8b5.js.map +1 -0
  569. package/dist/umd/events.min.js +2 -0
  570. package/dist/umd/events.min.js.map +1 -0
  571. package/dist/umd/index.js +2 -0
  572. package/dist/umd/index.js.map +1 -0
  573. package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js +2 -0
  574. package/dist/umd/legacyVideos.bundle.6250709892bb05b68333.js.map +1 -0
  575. package/dist/umd/queryString.bundle.e47b8db88c102418c8c2.js +2 -0
  576. package/dist/umd/queryString.bundle.e47b8db88c102418c8c2.js.map +1 -0
  577. package/dist/umd/remoteMiddleware.bundle.4da71e934f9fcee73678.js +2 -0
  578. package/dist/umd/remoteMiddleware.bundle.4da71e934f9fcee73678.js.map +1 -0
  579. package/dist/umd/schemaFilter.bundle.a17fd62888b293279f4b.js +2 -0
  580. package/dist/umd/schemaFilter.bundle.a17fd62888b293279f4b.js.map +1 -0
  581. package/dist/umd/tsub-middleware.bundle.a9604b3195f6189e429b.js +2 -0
  582. package/dist/umd/tsub-middleware.bundle.a9604b3195f6189e429b.js.map +1 -0
  583. package/package.json +106 -0
  584. package/src/browser/browser-umd.ts +19 -0
  585. package/src/browser/index.ts +486 -0
  586. package/src/browser/standalone-analytics.ts +62 -0
  587. package/src/browser/standalone-interface.ts +11 -0
  588. package/src/browser/standalone.ts +92 -0
  589. package/src/core/analytics/index.ts +672 -0
  590. package/src/core/analytics/interfaces.ts +100 -0
  591. package/src/core/arguments-resolver/index.ts +200 -0
  592. package/src/core/auto-track.ts +152 -0
  593. package/src/core/buffer/index.ts +371 -0
  594. package/src/core/callback/index.ts +1 -0
  595. package/src/core/connection/index.ts +13 -0
  596. package/src/core/constants/index.ts +1 -0
  597. package/src/core/context/index.ts +21 -0
  598. package/src/core/environment/index.ts +7 -0
  599. package/src/core/events/index.ts +277 -0
  600. package/src/core/events/interfaces.ts +36 -0
  601. package/src/core/inspector/index.ts +14 -0
  602. package/src/core/page/add-page-context.ts +33 -0
  603. package/src/core/page/get-page-context.ts +140 -0
  604. package/src/core/page/index.ts +2 -0
  605. package/src/core/plugin/index.ts +12 -0
  606. package/src/core/query-string/gracefulDecodeURIComponent.ts +16 -0
  607. package/src/core/query-string/index.ts +64 -0
  608. package/src/core/query-string/pickPrefix.ts +20 -0
  609. package/src/core/queue/event-queue.ts +22 -0
  610. package/src/core/session/index.ts +107 -0
  611. package/src/core/stats/index.ts +15 -0
  612. package/src/core/stats/remote-metrics.ts +144 -0
  613. package/src/core/storage/cookieStorage.ts +80 -0
  614. package/src/core/storage/index.ts +64 -0
  615. package/src/core/storage/localStorage.ts +45 -0
  616. package/src/core/storage/memoryStorage.ts +22 -0
  617. package/src/core/storage/settings.ts +23 -0
  618. package/src/core/storage/types.ts +49 -0
  619. package/src/core/storage/universalStorage.ts +78 -0
  620. package/src/core/user/index.ts +399 -0
  621. package/src/core/user/migrate.ts +126 -0
  622. package/src/core/user/tld.ts +65 -0
  623. package/src/core/user/vendor/crypto-es/LICENSE +53 -0
  624. package/src/core/user/vendor/crypto-es/lib/aes.ts +302 -0
  625. package/src/core/user/vendor/crypto-es/lib/cipher-core.ts +922 -0
  626. package/src/core/user/vendor/crypto-es/lib/core.ts +806 -0
  627. package/src/core/user/vendor/crypto-es/lib/enc-base64.ts +110 -0
  628. package/src/core/user/vendor/crypto-es/lib/evpkdf.ts +110 -0
  629. package/src/core/user/vendor/crypto-es/lib/md5.ts +238 -0
  630. package/src/core/user/vendor/readme.md +7 -0
  631. package/src/generated/version.ts +2 -0
  632. package/src/index.ts +13 -0
  633. package/src/lib/bind-all.ts +19 -0
  634. package/src/lib/browser-polyfill.ts +23 -0
  635. package/src/lib/client-hints/index.ts +16 -0
  636. package/src/lib/client-hints/interfaces.ts +42 -0
  637. package/src/lib/create-deferred.ts +16 -0
  638. package/src/lib/csp-detection.ts +8 -0
  639. package/src/lib/embedded-write-key.ts +24 -0
  640. package/src/lib/fetch.ts +10 -0
  641. package/src/lib/get-global.ts +16 -0
  642. package/src/lib/get-process-env.ts +11 -0
  643. package/src/lib/global-analytics-helper.ts +31 -0
  644. package/src/lib/group-by.ts +30 -0
  645. package/src/lib/is-plan-event-enabled.ts +20 -0
  646. package/src/lib/is-thenable.ts +9 -0
  647. package/src/lib/load-script.ts +66 -0
  648. package/src/lib/merged-options.ts +46 -0
  649. package/src/lib/on-page-change.ts +29 -0
  650. package/src/lib/p-while.ts +12 -0
  651. package/src/lib/parse-cdn.ts +56 -0
  652. package/src/lib/pick.ts +28 -0
  653. package/src/lib/priority-queue/backoff.ts +24 -0
  654. package/src/lib/priority-queue/index.ts +6 -0
  655. package/src/lib/priority-queue/persisted.ts +127 -0
  656. package/src/lib/sleep.ts +4 -0
  657. package/src/lib/to-facade.ts +50 -0
  658. package/src/lib/version-type.ts +10 -0
  659. package/src/node/index.ts +36 -0
  660. package/src/node/node.browser.ts +7 -0
  661. package/src/plugins/ajs-destination/index.ts +392 -0
  662. package/src/plugins/ajs-destination/loader.ts +129 -0
  663. package/src/plugins/ajs-destination/types.ts +44 -0
  664. package/src/plugins/ajs-destination/utils.ts +32 -0
  665. package/src/plugins/analytics-node/index.ts +67 -0
  666. package/src/plugins/env-enrichment/index.ts +208 -0
  667. package/src/plugins/hightouchio/batched-dispatcher.ts +127 -0
  668. package/src/plugins/hightouchio/fetch-dispatcher.ts +27 -0
  669. package/src/plugins/hightouchio/index.ts +147 -0
  670. package/src/plugins/hightouchio/normalize.ts +71 -0
  671. package/src/plugins/hightouchio/schedule-flush.ts +58 -0
  672. package/src/plugins/legacy-video-plugins/index.ts +16 -0
  673. package/src/plugins/middleware/index.ts +131 -0
  674. package/src/plugins/remote-loader/index.ts +256 -0
  675. package/src/plugins/remote-middleware/index.ts +44 -0
  676. package/src/plugins/routing-middleware/index.ts +37 -0
  677. package/src/plugins/schema-filter/index.ts +90 -0
  678. package/src/plugins/validation/index.ts +44 -0
  679. package/src/test-helpers/browser-storage.ts +75 -0
  680. package/src/test-helpers/factories.ts +18 -0
  681. package/src/test-helpers/fetch-parse.ts +8 -0
  682. package/src/test-helpers/fixtures/cdn-settings.ts +301 -0
  683. package/src/test-helpers/fixtures/classic-destination.ts +25 -0
  684. package/src/test-helpers/fixtures/client-hints.ts +28 -0
  685. package/src/test-helpers/fixtures/create-fetch-method.ts +30 -0
  686. package/src/test-helpers/fixtures/index.ts +4 -0
  687. package/src/test-helpers/fixtures/page-context.ts +11 -0
  688. package/src/test-helpers/test-writekeys.ts +5 -0
  689. package/src/test-helpers/type-assertions.ts +11 -0
@@ -0,0 +1,841 @@
1
+ "use strict";
2
+ //@ts-nocheck
3
+ /* eslint-disable no-use-before-define */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PasswordBasedCipher = exports.OpenSSLKdf = exports.SerializableCipher = exports.OpenSSLFormatter = exports.CipherParams = exports.BlockCipher = exports.Pkcs7 = exports.CBC = exports.BlockCipherMode = exports.StreamCipher = exports.Cipher = void 0;
6
+ var tslib_1 = require("tslib");
7
+ var core_1 = require("./core");
8
+ var enc_base64_1 = require("./enc-base64");
9
+ var evpkdf_1 = require("./evpkdf");
10
+ /**
11
+ * Abstract base cipher template.
12
+ *
13
+ * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
14
+ * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
15
+ * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
16
+ * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
17
+ */
18
+ var Cipher = /** @class */ (function (_super) {
19
+ tslib_1.__extends(Cipher, _super);
20
+ /**
21
+ * Initializes a newly created cipher.
22
+ *
23
+ * @param {number} xformMode Either the encryption or decryption transormation mode constant.
24
+ * @param {WordArray} key The key.
25
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
26
+ *
27
+ * @example
28
+ *
29
+ * const cipher = CryptoJS.algo.AES.create(
30
+ * CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }
31
+ * );
32
+ */
33
+ function Cipher(xformMode, key, cfg) {
34
+ var _this = _super.call(this) || this;
35
+ /**
36
+ * Configuration options.
37
+ *
38
+ * @property {WordArray} iv The IV to use for this operation.
39
+ */
40
+ _this.cfg = Object.assign(new core_1.Base(), cfg);
41
+ // Store transform mode and key
42
+ _this._xformMode = xformMode;
43
+ _this._key = key;
44
+ // Set initial values
45
+ _this.reset();
46
+ return _this;
47
+ }
48
+ /**
49
+ * Creates this cipher in encryption mode.
50
+ *
51
+ * @param {WordArray} key The key.
52
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
53
+ *
54
+ * @return {Cipher} A cipher instance.
55
+ *
56
+ * @static
57
+ *
58
+ * @example
59
+ *
60
+ * const cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
61
+ */
62
+ Cipher.createEncryptor = function (key, cfg) {
63
+ return this.create(this._ENC_XFORM_MODE, key, cfg);
64
+ };
65
+ /**
66
+ * Creates this cipher in decryption mode.
67
+ *
68
+ * @param {WordArray} key The key.
69
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
70
+ *
71
+ * @return {Cipher} A cipher instance.
72
+ *
73
+ * @static
74
+ *
75
+ * @example
76
+ *
77
+ * const cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
78
+ */
79
+ Cipher.createDecryptor = function (key, cfg) {
80
+ return this.create(this._DEC_XFORM_MODE, key, cfg);
81
+ };
82
+ /**
83
+ * Creates shortcut functions to a cipher's object interface.
84
+ *
85
+ * @param {Cipher} cipher The cipher to create a helper for.
86
+ *
87
+ * @return {Object} An object with encrypt and decrypt shortcut functions.
88
+ *
89
+ * @static
90
+ *
91
+ * @example
92
+ *
93
+ * const AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
94
+ */
95
+ Cipher._createHelper = function (SubCipher) {
96
+ var selectCipherStrategy = function (key) {
97
+ if (typeof key === 'string') {
98
+ return PasswordBasedCipher;
99
+ }
100
+ return SerializableCipher;
101
+ };
102
+ return {
103
+ encrypt: function (message, key, cfg) {
104
+ return selectCipherStrategy(key).encrypt(SubCipher, message, key, cfg);
105
+ },
106
+ decrypt: function (ciphertext, key, cfg) {
107
+ return selectCipherStrategy(key).decrypt(SubCipher, ciphertext, key, cfg);
108
+ },
109
+ };
110
+ };
111
+ /**
112
+ * Resets this cipher to its initial state.
113
+ *
114
+ * @example
115
+ *
116
+ * cipher.reset();
117
+ */
118
+ Cipher.prototype.reset = function () {
119
+ // Reset data buffer
120
+ _super.prototype.reset.call(this);
121
+ // Perform concrete-cipher logic
122
+ this._doReset();
123
+ };
124
+ /**
125
+ * Adds data to be encrypted or decrypted.
126
+ *
127
+ * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
128
+ *
129
+ * @return {WordArray} The data after processing.
130
+ *
131
+ * @example
132
+ *
133
+ * const encrypted = cipher.process('data');
134
+ * const encrypted = cipher.process(wordArray);
135
+ */
136
+ Cipher.prototype.process = function (dataUpdate) {
137
+ // Append
138
+ this._append(dataUpdate);
139
+ // Process available blocks
140
+ return this._process();
141
+ };
142
+ /**
143
+ * Finalizes the encryption or decryption process.
144
+ * Note that the finalize operation is effectively a destructive, read-once operation.
145
+ *
146
+ * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
147
+ *
148
+ * @return {WordArray} The data after final processing.
149
+ *
150
+ * @example
151
+ *
152
+ * const encrypted = cipher.finalize();
153
+ * const encrypted = cipher.finalize('data');
154
+ * const encrypted = cipher.finalize(wordArray);
155
+ */
156
+ Cipher.prototype.finalize = function (dataUpdate) {
157
+ // Final data update
158
+ if (dataUpdate) {
159
+ this._append(dataUpdate);
160
+ }
161
+ // Perform concrete-cipher logic
162
+ var finalProcessedData = this._doFinalize();
163
+ return finalProcessedData;
164
+ };
165
+ return Cipher;
166
+ }(core_1.BufferedBlockAlgorithm));
167
+ exports.Cipher = Cipher;
168
+ Cipher._ENC_XFORM_MODE = 1;
169
+ Cipher._DEC_XFORM_MODE = 2;
170
+ Cipher.keySize = 128 / 32;
171
+ Cipher.ivSize = 128 / 32;
172
+ /**
173
+ * Abstract base stream cipher template.
174
+ *
175
+ * @property {number} blockSize
176
+ *
177
+ * The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
178
+ */
179
+ var StreamCipher = /** @class */ (function (_super) {
180
+ tslib_1.__extends(StreamCipher, _super);
181
+ function StreamCipher() {
182
+ var args = [];
183
+ for (var _i = 0; _i < arguments.length; _i++) {
184
+ args[_i] = arguments[_i];
185
+ }
186
+ var _this = _super.apply(this, args) || this;
187
+ _this.blockSize = 1;
188
+ return _this;
189
+ }
190
+ StreamCipher.prototype._doFinalize = function () {
191
+ // Process partial blocks
192
+ var finalProcessedBlocks = this._process(!!'flush');
193
+ return finalProcessedBlocks;
194
+ };
195
+ return StreamCipher;
196
+ }(Cipher));
197
+ exports.StreamCipher = StreamCipher;
198
+ /**
199
+ * Abstract base block cipher mode template.
200
+ */
201
+ var BlockCipherMode = /** @class */ (function (_super) {
202
+ tslib_1.__extends(BlockCipherMode, _super);
203
+ /**
204
+ * Initializes a newly created mode.
205
+ *
206
+ * @param {Cipher} cipher A block cipher instance.
207
+ * @param {Array} iv The IV words.
208
+ *
209
+ * @example
210
+ *
211
+ * const mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
212
+ */
213
+ function BlockCipherMode(cipher, iv) {
214
+ var _this = _super.call(this) || this;
215
+ _this._cipher = cipher;
216
+ _this._iv = iv;
217
+ return _this;
218
+ }
219
+ /**
220
+ * Creates this mode for encryption.
221
+ *
222
+ * @param {Cipher} cipher A block cipher instance.
223
+ * @param {Array} iv The IV words.
224
+ *
225
+ * @static
226
+ *
227
+ * @example
228
+ *
229
+ * const mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
230
+ */
231
+ BlockCipherMode.createEncryptor = function (cipher, iv) {
232
+ return this.Encryptor.create(cipher, iv);
233
+ };
234
+ /**
235
+ * Creates this mode for decryption.
236
+ *
237
+ * @param {Cipher} cipher A block cipher instance.
238
+ * @param {Array} iv The IV words.
239
+ *
240
+ * @static
241
+ *
242
+ * @example
243
+ *
244
+ * const mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
245
+ */
246
+ BlockCipherMode.createDecryptor = function (cipher, iv) {
247
+ return this.Decryptor.create(cipher, iv);
248
+ };
249
+ return BlockCipherMode;
250
+ }(core_1.Base));
251
+ exports.BlockCipherMode = BlockCipherMode;
252
+ function xorBlock(words, offset, blockSize) {
253
+ var _words = words;
254
+ var block;
255
+ // Shortcut
256
+ var iv = this._iv;
257
+ // Choose mixing block
258
+ if (iv) {
259
+ block = iv;
260
+ // Remove IV for subsequent blocks
261
+ this._iv = undefined;
262
+ }
263
+ else {
264
+ block = this._prevBlock;
265
+ }
266
+ // XOR blocks
267
+ for (var i = 0; i < blockSize; i += 1) {
268
+ _words[offset + i] ^= block[i];
269
+ }
270
+ }
271
+ /**
272
+ * Cipher Block Chaining mode.
273
+ */
274
+ /**
275
+ * Abstract base CBC mode.
276
+ */
277
+ var CBC = /** @class */ (function (_super) {
278
+ tslib_1.__extends(CBC, _super);
279
+ function CBC() {
280
+ return _super !== null && _super.apply(this, arguments) || this;
281
+ }
282
+ return CBC;
283
+ }(BlockCipherMode));
284
+ exports.CBC = CBC;
285
+ /**
286
+ * CBC encryptor.
287
+ */
288
+ CBC.Encryptor = /** @class */ (function (_super) {
289
+ tslib_1.__extends(Encryptor, _super);
290
+ function Encryptor() {
291
+ return _super !== null && _super.apply(this, arguments) || this;
292
+ }
293
+ /**
294
+ * Processes the data block at offset.
295
+ *
296
+ * @param {Array} words The data words to operate on.
297
+ * @param {number} offset The offset where the block starts.
298
+ *
299
+ * @example
300
+ *
301
+ * mode.processBlock(data.words, offset);
302
+ */
303
+ Encryptor.prototype.processBlock = function (words, offset) {
304
+ // Shortcuts
305
+ var cipher = this._cipher;
306
+ var blockSize = cipher.blockSize;
307
+ // XOR and encrypt
308
+ xorBlock.call(this, words, offset, blockSize);
309
+ cipher.encryptBlock(words, offset);
310
+ // Remember this block to use with next block
311
+ this._prevBlock = words.slice(offset, offset + blockSize);
312
+ };
313
+ return Encryptor;
314
+ }(CBC));
315
+ /**
316
+ * CBC decryptor.
317
+ */
318
+ CBC.Decryptor = /** @class */ (function (_super) {
319
+ tslib_1.__extends(Decryptor, _super);
320
+ function Decryptor() {
321
+ return _super !== null && _super.apply(this, arguments) || this;
322
+ }
323
+ /**
324
+ * Processes the data block at offset.
325
+ *
326
+ * @param {Array} words The data words to operate on.
327
+ * @param {number} offset The offset where the block starts.
328
+ *
329
+ * @example
330
+ *
331
+ * mode.processBlock(data.words, offset);
332
+ */
333
+ Decryptor.prototype.processBlock = function (words, offset) {
334
+ // Shortcuts
335
+ var cipher = this._cipher;
336
+ var blockSize = cipher.blockSize;
337
+ // Remember this block to use with next block
338
+ var thisBlock = words.slice(offset, offset + blockSize);
339
+ // Decrypt and XOR
340
+ cipher.decryptBlock(words, offset);
341
+ xorBlock.call(this, words, offset, blockSize);
342
+ // This block becomes the previous block
343
+ this._prevBlock = thisBlock;
344
+ };
345
+ return Decryptor;
346
+ }(CBC));
347
+ /**
348
+ * PKCS #5/7 padding strategy.
349
+ */
350
+ exports.Pkcs7 = {
351
+ /**
352
+ * Pads data using the algorithm defined in PKCS #5/7.
353
+ *
354
+ * @param {WordArray} data The data to pad.
355
+ * @param {number} blockSize The multiple that the data should be padded to.
356
+ *
357
+ * @static
358
+ *
359
+ * @example
360
+ *
361
+ * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
362
+ */
363
+ pad: function (data, blockSize) {
364
+ // Shortcut
365
+ var blockSizeBytes = blockSize * 4;
366
+ // Count padding bytes
367
+ var nPaddingBytes = blockSizeBytes - (data.sigBytes % blockSizeBytes);
368
+ // Create padding word
369
+ var paddingWord = (nPaddingBytes << 24) |
370
+ (nPaddingBytes << 16) |
371
+ (nPaddingBytes << 8) |
372
+ nPaddingBytes;
373
+ // Create padding
374
+ var paddingWords = [];
375
+ for (var i = 0; i < nPaddingBytes; i += 4) {
376
+ paddingWords.push(paddingWord);
377
+ }
378
+ var padding = core_1.WordArray.create(paddingWords, nPaddingBytes);
379
+ // Add padding
380
+ data.concat(padding);
381
+ },
382
+ /**
383
+ * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
384
+ *
385
+ * @param {WordArray} data The data to unpad.
386
+ *
387
+ * @static
388
+ *
389
+ * @example
390
+ *
391
+ * CryptoJS.pad.Pkcs7.unpad(wordArray);
392
+ */
393
+ unpad: function (data) {
394
+ var _data = data;
395
+ // Get number of padding bytes from last byte
396
+ var nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;
397
+ // Remove padding
398
+ _data.sigBytes -= nPaddingBytes;
399
+ },
400
+ };
401
+ /**
402
+ * Abstract base block cipher template.
403
+ *
404
+ * @property {number} blockSize
405
+ *
406
+ * The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
407
+ */
408
+ var BlockCipher = /** @class */ (function (_super) {
409
+ tslib_1.__extends(BlockCipher, _super);
410
+ function BlockCipher(xformMode, key, cfg) {
411
+ var _this =
412
+ /**
413
+ * Configuration options.
414
+ *
415
+ * @property {Mode} mode The block mode to use. Default: CBC
416
+ * @property {Padding} padding The padding strategy to use. Default: Pkcs7
417
+ */
418
+ _super.call(this, xformMode, key, Object.assign({
419
+ mode: CBC,
420
+ padding: exports.Pkcs7,
421
+ }, cfg)) || this;
422
+ _this.blockSize = 128 / 32;
423
+ return _this;
424
+ }
425
+ BlockCipher.prototype.reset = function () {
426
+ var modeCreator;
427
+ // Reset cipher
428
+ _super.prototype.reset.call(this);
429
+ // Shortcuts
430
+ var cfg = this.cfg;
431
+ var iv = cfg.iv, mode = cfg.mode;
432
+ // Reset block mode
433
+ if (this._xformMode === this.constructor._ENC_XFORM_MODE) {
434
+ modeCreator = mode.createEncryptor;
435
+ } /* if (this._xformMode == this._DEC_XFORM_MODE) */
436
+ else {
437
+ modeCreator = mode.createDecryptor;
438
+ // Keep at least one block in the buffer for unpadding
439
+ this._minBufferSize = 1;
440
+ }
441
+ this._mode = modeCreator.call(mode, this, iv && iv.words);
442
+ this._mode.__creator = modeCreator;
443
+ };
444
+ BlockCipher.prototype._doProcessBlock = function (words, offset) {
445
+ this._mode.processBlock(words, offset);
446
+ };
447
+ BlockCipher.prototype._doFinalize = function () {
448
+ var finalProcessedBlocks;
449
+ // Shortcut
450
+ var padding = this.cfg.padding;
451
+ // Finalize
452
+ if (this._xformMode === this.constructor._ENC_XFORM_MODE) {
453
+ // Pad data
454
+ padding.pad(this._data, this.blockSize);
455
+ // Process final blocks
456
+ finalProcessedBlocks = this._process(!!'flush');
457
+ } /* if (this._xformMode == this._DEC_XFORM_MODE) */
458
+ else {
459
+ // Process final blocks
460
+ finalProcessedBlocks = this._process(!!'flush');
461
+ // Unpad data
462
+ padding.unpad(finalProcessedBlocks);
463
+ }
464
+ return finalProcessedBlocks;
465
+ };
466
+ return BlockCipher;
467
+ }(Cipher));
468
+ exports.BlockCipher = BlockCipher;
469
+ /**
470
+ * A collection of cipher parameters.
471
+ *
472
+ * @property {WordArray} ciphertext The raw ciphertext.
473
+ * @property {WordArray} key The key to this ciphertext.
474
+ * @property {WordArray} iv The IV used in the ciphering operation.
475
+ * @property {WordArray} salt The salt used with a key derivation function.
476
+ * @property {Cipher} algorithm The cipher algorithm.
477
+ * @property {Mode} mode The block mode used in the ciphering operation.
478
+ * @property {Padding} padding The padding scheme used in the ciphering operation.
479
+ * @property {number} blockSize The block size of the cipher.
480
+ * @property {Format} formatter
481
+ * The default formatting strategy to convert this cipher params object to a string.
482
+ */
483
+ var CipherParams = /** @class */ (function (_super) {
484
+ tslib_1.__extends(CipherParams, _super);
485
+ /**
486
+ * Initializes a newly created cipher params object.
487
+ *
488
+ * @param {Object} cipherParams An object with any of the possible cipher parameters.
489
+ *
490
+ * @example
491
+ *
492
+ * var cipherParams = CryptoJS.lib.CipherParams.create({
493
+ * ciphertext: ciphertextWordArray,
494
+ * key: keyWordArray,
495
+ * iv: ivWordArray,
496
+ * salt: saltWordArray,
497
+ * algorithm: CryptoJS.algo.AES,
498
+ * mode: CryptoJS.mode.CBC,
499
+ * padding: CryptoJS.pad.PKCS7,
500
+ * blockSize: 4,
501
+ * formatter: CryptoJS.format.OpenSSL
502
+ * });
503
+ */
504
+ function CipherParams(cipherParams) {
505
+ var _this = _super.call(this) || this;
506
+ _this.mixIn(cipherParams);
507
+ return _this;
508
+ }
509
+ /**
510
+ * Converts this cipher params object to a string.
511
+ *
512
+ * @param {Format} formatter (Optional) The formatting strategy to use.
513
+ *
514
+ * @return {string} The stringified cipher params.
515
+ *
516
+ * @throws Error If neither the formatter nor the default formatter is set.
517
+ *
518
+ * @example
519
+ *
520
+ * var string = cipherParams + '';
521
+ * var string = cipherParams.toString();
522
+ * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
523
+ */
524
+ CipherParams.prototype.toString = function (formatter) {
525
+ return (formatter || this.formatter).stringify(this);
526
+ };
527
+ return CipherParams;
528
+ }(core_1.Base));
529
+ exports.CipherParams = CipherParams;
530
+ /**
531
+ * OpenSSL formatting strategy.
532
+ */
533
+ exports.OpenSSLFormatter = {
534
+ /**
535
+ * Converts a cipher params object to an OpenSSL-compatible string.
536
+ *
537
+ * @param {CipherParams} cipherParams The cipher params object.
538
+ *
539
+ * @return {string} The OpenSSL-compatible string.
540
+ *
541
+ * @static
542
+ *
543
+ * @example
544
+ *
545
+ * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
546
+ */
547
+ stringify: function (cipherParams) {
548
+ var wordArray;
549
+ // Shortcuts
550
+ var ciphertext = cipherParams.ciphertext, salt = cipherParams.salt;
551
+ // Format
552
+ if (salt) {
553
+ wordArray = core_1.WordArray.create([0x53616c74, 0x65645f5f])
554
+ .concat(salt)
555
+ .concat(ciphertext);
556
+ }
557
+ else {
558
+ wordArray = ciphertext;
559
+ }
560
+ return wordArray.toString(enc_base64_1.Base64);
561
+ },
562
+ /**
563
+ * Converts an OpenSSL-compatible string to a cipher params object.
564
+ *
565
+ * @param {string} openSSLStr The OpenSSL-compatible string.
566
+ *
567
+ * @return {CipherParams} The cipher params object.
568
+ *
569
+ * @static
570
+ *
571
+ * @example
572
+ *
573
+ * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
574
+ */
575
+ parse: function (openSSLStr) {
576
+ var salt;
577
+ // Parse base64
578
+ var ciphertext = enc_base64_1.Base64.parse(openSSLStr);
579
+ // Shortcut
580
+ var ciphertextWords = ciphertext.words;
581
+ // Test for salt
582
+ if (ciphertextWords[0] === 0x53616c74 &&
583
+ ciphertextWords[1] === 0x65645f5f) {
584
+ // Extract salt
585
+ salt = core_1.WordArray.create(ciphertextWords.slice(2, 4));
586
+ // Remove salt from ciphertext
587
+ ciphertextWords.splice(0, 4);
588
+ ciphertext.sigBytes -= 16;
589
+ }
590
+ return CipherParams.create({ ciphertext: ciphertext, salt: salt });
591
+ },
592
+ };
593
+ /**
594
+ * A cipher wrapper that returns ciphertext as a serializable cipher params object.
595
+ */
596
+ var SerializableCipher = /** @class */ (function (_super) {
597
+ tslib_1.__extends(SerializableCipher, _super);
598
+ function SerializableCipher() {
599
+ return _super !== null && _super.apply(this, arguments) || this;
600
+ }
601
+ /**
602
+ * Encrypts a message.
603
+ *
604
+ * @param {Cipher} cipher The cipher algorithm to use.
605
+ * @param {WordArray|string} message The message to encrypt.
606
+ * @param {WordArray} key The key.
607
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
608
+ *
609
+ * @return {CipherParams} A cipher params object.
610
+ *
611
+ * @static
612
+ *
613
+ * @example
614
+ *
615
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
616
+ * .encrypt(CryptoJS.algo.AES, message, key);
617
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
618
+ * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
619
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
620
+ * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
621
+ */
622
+ SerializableCipher.encrypt = function (cipher, message, key, cfg) {
623
+ // Apply config defaults
624
+ var _cfg = Object.assign(new core_1.Base(), this.cfg, cfg);
625
+ // Encrypt
626
+ var encryptor = cipher.createEncryptor(key, _cfg);
627
+ var ciphertext = encryptor.finalize(message);
628
+ // Shortcut
629
+ var cipherCfg = encryptor.cfg;
630
+ // Create and return serializable cipher params
631
+ return CipherParams.create({
632
+ ciphertext: ciphertext,
633
+ key: key,
634
+ iv: cipherCfg.iv,
635
+ algorithm: cipher,
636
+ mode: cipherCfg.mode,
637
+ padding: cipherCfg.padding,
638
+ blockSize: encryptor.blockSize,
639
+ formatter: _cfg.format,
640
+ });
641
+ };
642
+ /**
643
+ * Decrypts serialized ciphertext.
644
+ *
645
+ * @param {Cipher} cipher The cipher algorithm to use.
646
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
647
+ * @param {WordArray} key The key.
648
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
649
+ *
650
+ * @return {WordArray} The plaintext.
651
+ *
652
+ * @static
653
+ *
654
+ * @example
655
+ *
656
+ * var plaintext = CryptoJS.lib.SerializableCipher
657
+ * .decrypt(CryptoJS.algo.AES, formattedCiphertext, key,
658
+ * { iv: iv, format: CryptoJS.format.OpenSSL });
659
+ * var plaintext = CryptoJS.lib.SerializableCipher
660
+ * .decrypt(CryptoJS.algo.AES, ciphertextParams, key,
661
+ * { iv: iv, format: CryptoJS.format.OpenSSL });
662
+ */
663
+ SerializableCipher.decrypt = function (cipher, ciphertext, key, cfg) {
664
+ var _ciphertext = ciphertext;
665
+ // Apply config defaults
666
+ var _cfg = Object.assign(new core_1.Base(), this.cfg, cfg);
667
+ // Convert string to CipherParams
668
+ _ciphertext = this._parse(_ciphertext, _cfg.format);
669
+ // Decrypt
670
+ var plaintext = cipher
671
+ .createDecryptor(key, _cfg)
672
+ .finalize(_ciphertext.ciphertext);
673
+ return plaintext;
674
+ };
675
+ /**
676
+ * Converts serialized ciphertext to CipherParams,
677
+ * else assumed CipherParams already and returns ciphertext unchanged.
678
+ *
679
+ * @param {CipherParams|string} ciphertext The ciphertext.
680
+ * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
681
+ *
682
+ * @return {CipherParams} The unserialized ciphertext.
683
+ *
684
+ * @static
685
+ *
686
+ * @example
687
+ *
688
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher
689
+ * ._parse(ciphertextStringOrParams, format);
690
+ */
691
+ SerializableCipher._parse = function (ciphertext, format) {
692
+ if (typeof ciphertext === 'string') {
693
+ return format.parse(ciphertext, this);
694
+ }
695
+ return ciphertext;
696
+ };
697
+ return SerializableCipher;
698
+ }(core_1.Base));
699
+ exports.SerializableCipher = SerializableCipher;
700
+ /**
701
+ * Configuration options.
702
+ *
703
+ * @property {Formatter} format
704
+ *
705
+ * The formatting strategy to convert cipher param objects to and from a string.
706
+ * Default: OpenSSL
707
+ */
708
+ SerializableCipher.cfg = Object.assign(new core_1.Base(), { format: exports.OpenSSLFormatter });
709
+ /**
710
+ * OpenSSL key derivation function.
711
+ */
712
+ exports.OpenSSLKdf = {
713
+ /**
714
+ * Derives a key and IV from a password.
715
+ *
716
+ * @param {string} password The password to derive from.
717
+ * @param {number} keySize The size in words of the key to generate.
718
+ * @param {number} ivSize The size in words of the IV to generate.
719
+ * @param {WordArray|string} salt
720
+ * (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
721
+ *
722
+ * @return {CipherParams} A cipher params object with the key, IV, and salt.
723
+ *
724
+ * @static
725
+ *
726
+ * @example
727
+ *
728
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
729
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
730
+ */
731
+ execute: function (password, keySize, ivSize, salt, hasher) {
732
+ var _salt = salt;
733
+ // Generate random salt
734
+ if (!_salt) {
735
+ _salt = core_1.WordArray.random(64 / 8);
736
+ }
737
+ // Derive key and IV
738
+ var key;
739
+ if (!hasher) {
740
+ key = evpkdf_1.EvpKDFAlgo.create({ keySize: keySize + ivSize }).compute(password, _salt);
741
+ }
742
+ else {
743
+ key = evpkdf_1.EvpKDFAlgo.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, _salt);
744
+ }
745
+ // Separate key and IV
746
+ var iv = core_1.WordArray.create(key.words.slice(keySize), ivSize * 4);
747
+ key.sigBytes = keySize * 4;
748
+ // Return params
749
+ return CipherParams.create({ key: key, iv: iv, salt: _salt });
750
+ },
751
+ };
752
+ /**
753
+ * A serializable cipher wrapper that derives the key from a password,
754
+ * and returns ciphertext as a serializable cipher params object.
755
+ */
756
+ var PasswordBasedCipher = /** @class */ (function (_super) {
757
+ tslib_1.__extends(PasswordBasedCipher, _super);
758
+ function PasswordBasedCipher() {
759
+ return _super !== null && _super.apply(this, arguments) || this;
760
+ }
761
+ /**
762
+ * Encrypts a message using a password.
763
+ *
764
+ * @param {Cipher} cipher The cipher algorithm to use.
765
+ * @param {WordArray|string} message The message to encrypt.
766
+ * @param {string} password The password.
767
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
768
+ *
769
+ * @return {CipherParams} A cipher params object.
770
+ *
771
+ * @static
772
+ *
773
+ * @example
774
+ *
775
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
776
+ * .encrypt(CryptoJS.algo.AES, message, 'password');
777
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher
778
+ * .encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
779
+ */
780
+ PasswordBasedCipher.encrypt = function (cipher, message, password, cfg) {
781
+ // Apply config defaults
782
+ var _cfg = Object.assign(new core_1.Base(), this.cfg, cfg);
783
+ // Derive key and other params
784
+ var derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, _cfg.salt, _cfg.hasher);
785
+ // Add IV to config
786
+ _cfg.iv = derivedParams.iv;
787
+ // Encrypt
788
+ var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, _cfg);
789
+ // Mix in derived params
790
+ ciphertext.mixIn(derivedParams);
791
+ return ciphertext;
792
+ };
793
+ /**
794
+ * Decrypts serialized ciphertext using a password.
795
+ *
796
+ * @param {Cipher} cipher The cipher algorithm to use.
797
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
798
+ * @param {string} password The password.
799
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
800
+ *
801
+ * @return {WordArray} The plaintext.
802
+ *
803
+ * @static
804
+ *
805
+ * @example
806
+ *
807
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher
808
+ * .decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password',
809
+ * { format: CryptoJS.format.OpenSSL });
810
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher
811
+ * .decrypt(CryptoJS.algo.AES, ciphertextParams, 'password',
812
+ * { format: CryptoJS.format.OpenSSL });
813
+ */
814
+ PasswordBasedCipher.decrypt = function (cipher, ciphertext, password, cfg) {
815
+ var _ciphertext = ciphertext;
816
+ // Apply config defaults
817
+ var _cfg = Object.assign(new core_1.Base(), this.cfg, cfg);
818
+ // Convert string to CipherParams
819
+ _ciphertext = this._parse(_ciphertext, _cfg.format);
820
+ // Derive key and other params
821
+ var derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, _ciphertext.salt, _cfg.hasher);
822
+ // Add IV to config
823
+ _cfg.iv = derivedParams.iv;
824
+ // Decrypt
825
+ var plaintext = SerializableCipher.decrypt.call(this, cipher, _ciphertext, derivedParams.key, _cfg);
826
+ return plaintext;
827
+ };
828
+ return PasswordBasedCipher;
829
+ }(SerializableCipher));
830
+ exports.PasswordBasedCipher = PasswordBasedCipher;
831
+ /**
832
+ * Configuration options.
833
+ *
834
+ * @property {KDF} kdf
835
+ * The key derivation function to use to generate a key and IV from a password.
836
+ * Default: OpenSSL
837
+ */
838
+ PasswordBasedCipher.cfg = Object.assign(SerializableCipher.cfg, {
839
+ kdf: exports.OpenSSLKdf,
840
+ });
841
+ //# sourceMappingURL=cipher-core.js.map