@digitaldefiance/ecies-lib 4.12.8 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (399) hide show
  1. package/README.md +60 -12
  2. package/package.json +3 -3
  3. package/src/builders/ecies-builder.d.ts +24 -1
  4. package/src/builders/ecies-builder.d.ts.map +1 -1
  5. package/src/builders/ecies-builder.js +24 -1
  6. package/src/builders/ecies-builder.js.map +1 -1
  7. package/src/builders/member-builder.d.ts +57 -1
  8. package/src/builders/member-builder.d.ts.map +1 -1
  9. package/src/builders/member-builder.js +57 -1
  10. package/src/builders/member-builder.js.map +1 -1
  11. package/src/constants.d.ts +99 -10
  12. package/src/constants.d.ts.map +1 -1
  13. package/src/constants.js +162 -20
  14. package/src/constants.js.map +1 -1
  15. package/src/core/errors/crypto-error.d.ts +28 -1
  16. package/src/core/errors/crypto-error.d.ts.map +1 -1
  17. package/src/core/errors/crypto-error.js +28 -1
  18. package/src/core/errors/crypto-error.js.map +1 -1
  19. package/src/core/types/result.d.ts +21 -1
  20. package/src/core/types/result.d.ts.map +1 -1
  21. package/src/core/types/result.js +17 -1
  22. package/src/core/types/result.js.map +1 -1
  23. package/src/enumerations/ecies-cipher-suite.d.ts +11 -0
  24. package/src/enumerations/ecies-cipher-suite.d.ts.map +1 -1
  25. package/src/enumerations/ecies-cipher-suite.js +11 -1
  26. package/src/enumerations/ecies-cipher-suite.js.map +1 -1
  27. package/src/enumerations/ecies-encryption-type.d.ts +26 -3
  28. package/src/enumerations/ecies-encryption-type.d.ts.map +1 -1
  29. package/src/enumerations/ecies-encryption-type.js +29 -10
  30. package/src/enumerations/ecies-encryption-type.js.map +1 -1
  31. package/src/enumerations/ecies-error-type.d.ts +48 -3
  32. package/src/enumerations/ecies-error-type.d.ts.map +1 -1
  33. package/src/enumerations/ecies-error-type.js +45 -0
  34. package/src/enumerations/ecies-error-type.js.map +1 -1
  35. package/src/enumerations/ecies-string-key.d.ts +4 -0
  36. package/src/enumerations/ecies-string-key.d.ts.map +1 -1
  37. package/src/enumerations/ecies-string-key.js +4 -0
  38. package/src/enumerations/ecies-string-key.js.map +1 -1
  39. package/src/enumerations/ecies-version.d.ts +5 -0
  40. package/src/enumerations/ecies-version.d.ts.map +1 -1
  41. package/src/enumerations/ecies-version.js +5 -0
  42. package/src/enumerations/ecies-version.js.map +1 -1
  43. package/src/enumerations/guid-brand-type.d.ts +13 -8
  44. package/src/enumerations/guid-brand-type.d.ts.map +1 -1
  45. package/src/enumerations/guid-brand-type.js +13 -8
  46. package/src/enumerations/guid-brand-type.js.map +1 -1
  47. package/src/enumerations/guid-error-type.d.ts +8 -0
  48. package/src/enumerations/guid-error-type.d.ts.map +1 -1
  49. package/src/enumerations/guid-error-type.js +8 -0
  50. package/src/enumerations/guid-error-type.js.map +1 -1
  51. package/src/enumerations/index.d.ts +4 -0
  52. package/src/enumerations/index.d.ts.map +1 -1
  53. package/src/enumerations/index.js +4 -0
  54. package/src/enumerations/index.js.map +1 -1
  55. package/src/enumerations/invalid-email-type.d.ts +7 -0
  56. package/src/enumerations/invalid-email-type.d.ts.map +1 -1
  57. package/src/enumerations/invalid-email-type.js +7 -0
  58. package/src/enumerations/invalid-email-type.js.map +1 -1
  59. package/src/enumerations/length-encoding-type.d.ts +8 -0
  60. package/src/enumerations/length-encoding-type.d.ts.map +1 -1
  61. package/src/enumerations/length-encoding-type.js +8 -0
  62. package/src/enumerations/length-encoding-type.js.map +1 -1
  63. package/src/enumerations/length-error-type.d.ts +7 -0
  64. package/src/enumerations/length-error-type.d.ts.map +1 -1
  65. package/src/enumerations/length-error-type.js +7 -0
  66. package/src/enumerations/length-error-type.js.map +1 -1
  67. package/src/enumerations/password-login-error-type.d.ts +6 -0
  68. package/src/enumerations/password-login-error-type.d.ts.map +1 -1
  69. package/src/enumerations/password-login-error-type.js +6 -0
  70. package/src/enumerations/password-login-error-type.js.map +1 -1
  71. package/src/enumerations/pbkdf2-error-type.d.ts +7 -0
  72. package/src/enumerations/pbkdf2-error-type.d.ts.map +1 -1
  73. package/src/enumerations/pbkdf2-error-type.js +7 -0
  74. package/src/enumerations/pbkdf2-error-type.js.map +1 -1
  75. package/src/enumerations/pbkdf2-profile.d.ts +7 -0
  76. package/src/enumerations/pbkdf2-profile.d.ts.map +1 -1
  77. package/src/enumerations/pbkdf2-profile.js +7 -0
  78. package/src/enumerations/pbkdf2-profile.js.map +1 -1
  79. package/src/enumerations/secure-storage-error-type.d.ts +7 -0
  80. package/src/enumerations/secure-storage-error-type.d.ts.map +1 -1
  81. package/src/enumerations/secure-storage-error-type.js +7 -0
  82. package/src/enumerations/secure-storage-error-type.js.map +1 -1
  83. package/src/errors/index.d.ts +5 -0
  84. package/src/errors/index.d.ts.map +1 -1
  85. package/src/errors/index.js +5 -0
  86. package/src/errors/index.js.map +1 -1
  87. package/src/errors/invalid-email.d.ts +4 -0
  88. package/src/errors/invalid-email.d.ts.map +1 -1
  89. package/src/errors/invalid-email.js +4 -0
  90. package/src/errors/invalid-email.js.map +1 -1
  91. package/src/errors/length.d.ts +4 -0
  92. package/src/errors/length.d.ts.map +1 -1
  93. package/src/errors/length.js +4 -0
  94. package/src/errors/length.js.map +1 -1
  95. package/src/errors/member.d.ts +4 -0
  96. package/src/errors/member.d.ts.map +1 -1
  97. package/src/errors/member.js +4 -0
  98. package/src/errors/member.js.map +1 -1
  99. package/src/errors/pbkdf2.d.ts +4 -0
  100. package/src/errors/pbkdf2.d.ts.map +1 -1
  101. package/src/errors/pbkdf2.js +4 -0
  102. package/src/errors/pbkdf2.js.map +1 -1
  103. package/src/errors/secure-storage.d.ts +4 -0
  104. package/src/errors/secure-storage.d.ts.map +1 -1
  105. package/src/errors/secure-storage.js +4 -0
  106. package/src/errors/secure-storage.js.map +1 -1
  107. package/src/errors/simple-ecies.d.ts +4 -0
  108. package/src/errors/simple-ecies.d.ts.map +1 -1
  109. package/src/errors/simple-ecies.js +4 -0
  110. package/src/errors/simple-ecies.js.map +1 -1
  111. package/src/errors/simple-test-error.d.ts +3 -0
  112. package/src/errors/simple-test-error.d.ts.map +1 -1
  113. package/src/errors/simple-test-error.js +3 -0
  114. package/src/errors/simple-test-error.js.map +1 -1
  115. package/src/errors/translatable.d.ts +8 -0
  116. package/src/errors/translatable.d.ts.map +1 -0
  117. package/src/errors/translatable.js +20 -0
  118. package/src/errors/translatable.js.map +1 -0
  119. package/src/interfaces/checksum-config.d.ts +3 -0
  120. package/src/interfaces/checksum-config.d.ts.map +1 -1
  121. package/src/interfaces/checksum-consts.d.ts +4 -0
  122. package/src/interfaces/checksum-consts.d.ts.map +1 -1
  123. package/src/interfaces/constants.d.ts +21 -6
  124. package/src/interfaces/constants.d.ts.map +1 -1
  125. package/src/interfaces/constants.js +5 -0
  126. package/src/interfaces/constants.js.map +1 -1
  127. package/src/interfaces/ecies-config.d.ts +3 -0
  128. package/src/interfaces/ecies-config.d.ts.map +1 -1
  129. package/src/interfaces/ecies-consts.d.ts +42 -7
  130. package/src/interfaces/ecies-consts.d.ts.map +1 -1
  131. package/src/interfaces/ecies-file-service.d.ts +3 -0
  132. package/src/interfaces/ecies-file-service.d.ts.map +1 -1
  133. package/src/interfaces/guid.d.ts +4 -0
  134. package/src/interfaces/guid.d.ts.map +1 -1
  135. package/src/interfaces/index.d.ts +4 -0
  136. package/src/interfaces/index.d.ts.map +1 -1
  137. package/src/interfaces/index.js +4 -0
  138. package/src/interfaces/index.js.map +1 -1
  139. package/src/interfaces/pbkdf2-config.d.ts +8 -0
  140. package/src/interfaces/pbkdf2-config.d.ts.map +1 -1
  141. package/src/interfaces/pbkdf2-consts.d.ts +7 -3
  142. package/src/interfaces/pbkdf2-consts.d.ts.map +1 -1
  143. package/src/interfaces/pbkdf2-result.d.ts +7 -0
  144. package/src/interfaces/pbkdf2-result.d.ts.map +1 -1
  145. package/src/interfaces/platform-id.d.ts +10 -2
  146. package/src/interfaces/platform-id.d.ts.map +1 -1
  147. package/src/interfaces/platform-id.js +8 -0
  148. package/src/interfaces/platform-id.js.map +1 -1
  149. package/src/interfaces/voting-service.d.ts +5 -6
  150. package/src/interfaces/voting-service.d.ts.map +1 -1
  151. package/src/lib/configuration-provenance-utils.d.ts +5 -1
  152. package/src/lib/configuration-provenance-utils.d.ts.map +1 -1
  153. package/src/lib/configuration-provenance-utils.js +5 -1
  154. package/src/lib/configuration-provenance-utils.js.map +1 -1
  155. package/src/lib/guid.d.ts +47 -29
  156. package/src/lib/guid.d.ts.map +1 -1
  157. package/src/lib/guid.js +127 -104
  158. package/src/lib/guid.js.map +1 -1
  159. package/src/lib/id-providers/guidv4-provider.d.ts +8 -8
  160. package/src/lib/id-providers/guidv4-provider.d.ts.map +1 -1
  161. package/src/lib/id-providers/guidv4-provider.js +10 -10
  162. package/src/lib/id-providers/guidv4-provider.js.map +1 -1
  163. package/src/lib/invariants/index.d.ts +3 -0
  164. package/src/lib/invariants/index.d.ts.map +1 -1
  165. package/src/lib/invariants/index.js +3 -0
  166. package/src/lib/invariants/index.js.map +1 -1
  167. package/src/lib/voting/enumerations/audit-event-type.d.ts +3 -0
  168. package/src/lib/voting/enumerations/audit-event-type.d.ts.map +1 -1
  169. package/src/lib/voting/enumerations/audit-event-type.js +3 -0
  170. package/src/lib/voting/enumerations/audit-event-type.js.map +1 -1
  171. package/src/lib/voting/enumerations/event-type.d.ts +3 -0
  172. package/src/lib/voting/enumerations/event-type.d.ts.map +1 -1
  173. package/src/lib/voting/enumerations/event-type.js +3 -0
  174. package/src/lib/voting/enumerations/event-type.js.map +1 -1
  175. package/src/lib/voting/enumerations/index.d.ts +3 -0
  176. package/src/lib/voting/enumerations/index.d.ts.map +1 -1
  177. package/src/lib/voting/enumerations/index.js +3 -0
  178. package/src/lib/voting/enumerations/index.js.map +1 -1
  179. package/src/lib/voting/enumerations/jurisdictional-level.d.ts +3 -0
  180. package/src/lib/voting/enumerations/jurisdictional-level.d.ts.map +1 -1
  181. package/src/lib/voting/enumerations/jurisdictional-level.js +3 -0
  182. package/src/lib/voting/enumerations/jurisdictional-level.js.map +1 -1
  183. package/src/lib/voting/enumerations/security-level.d.ts +3 -0
  184. package/src/lib/voting/enumerations/security-level.d.ts.map +1 -1
  185. package/src/lib/voting/enumerations/security-level.js +3 -0
  186. package/src/lib/voting/enumerations/security-level.js.map +1 -1
  187. package/src/lib/voting/interfaces/aggregated-tally.d.ts +3 -0
  188. package/src/lib/voting/interfaces/aggregated-tally.d.ts.map +1 -1
  189. package/src/lib/voting/interfaces/audit-entry.d.ts +3 -0
  190. package/src/lib/voting/interfaces/audit-entry.d.ts.map +1 -1
  191. package/src/lib/voting/interfaces/audit-log.d.ts +3 -0
  192. package/src/lib/voting/interfaces/audit-log.d.ts.map +1 -1
  193. package/src/lib/voting/interfaces/bulletin-board-entry.d.ts +3 -0
  194. package/src/lib/voting/interfaces/bulletin-board-entry.d.ts.map +1 -1
  195. package/src/lib/voting/interfaces/bulletin-board.d.ts +3 -0
  196. package/src/lib/voting/interfaces/bulletin-board.d.ts.map +1 -1
  197. package/src/lib/voting/interfaces/checkpoint-manager.d.ts +3 -0
  198. package/src/lib/voting/interfaces/checkpoint-manager.d.ts.map +1 -1
  199. package/src/lib/voting/interfaces/checkpoint-metadata.d.ts +3 -0
  200. package/src/lib/voting/interfaces/checkpoint-metadata.d.ts.map +1 -1
  201. package/src/lib/voting/interfaces/event-log-entry.d.ts +3 -0
  202. package/src/lib/voting/interfaces/event-log-entry.d.ts.map +1 -1
  203. package/src/lib/voting/interfaces/event-logger.d.ts +3 -0
  204. package/src/lib/voting/interfaces/event-logger.d.ts.map +1 -1
  205. package/src/lib/voting/interfaces/index.d.ts +3 -0
  206. package/src/lib/voting/interfaces/index.d.ts.map +1 -1
  207. package/src/lib/voting/interfaces/index.js.map +1 -1
  208. package/src/lib/voting/interfaces/jurisdiction-config.d.ts +3 -0
  209. package/src/lib/voting/interfaces/jurisdiction-config.d.ts.map +1 -1
  210. package/src/lib/voting/interfaces/poll-configuration.d.ts +3 -0
  211. package/src/lib/voting/interfaces/poll-configuration.d.ts.map +1 -1
  212. package/src/lib/voting/interfaces/state-snapshot.d.ts +3 -0
  213. package/src/lib/voting/interfaces/state-snapshot.d.ts.map +1 -1
  214. package/src/lib/voting/interfaces/tally-proof.d.ts +3 -0
  215. package/src/lib/voting/interfaces/tally-proof.d.ts.map +1 -1
  216. package/src/lib/voting/interfaces/vote-logger.d.ts +3 -0
  217. package/src/lib/voting/interfaces/vote-logger.d.ts.map +1 -1
  218. package/src/lib/voting/test-voter-pool.d.ts.map +1 -1
  219. package/src/lib/voting/test-voter-pool.js +4 -0
  220. package/src/lib/voting/test-voter-pool.js.map +1 -1
  221. package/src/member.d.ts +198 -9
  222. package/src/member.d.ts.map +1 -1
  223. package/src/member.js +198 -15
  224. package/src/member.js.map +1 -1
  225. package/src/pbkdf2-profiles.d.ts +4 -0
  226. package/src/pbkdf2-profiles.d.ts.map +1 -1
  227. package/src/phone-number.d.ts +12 -0
  228. package/src/phone-number.d.ts.map +1 -1
  229. package/src/phone-number.js +12 -0
  230. package/src/phone-number.js.map +1 -1
  231. package/src/regexes.d.ts +15 -1
  232. package/src/regexes.d.ts.map +1 -1
  233. package/src/regexes.js +16 -2
  234. package/src/regexes.js.map +1 -1
  235. package/src/secure-buffer.d.ts +119 -8
  236. package/src/secure-buffer.d.ts.map +1 -1
  237. package/src/secure-buffer.js +119 -8
  238. package/src/secure-buffer.js.map +1 -1
  239. package/src/secure-string.d.ts +118 -1
  240. package/src/secure-string.d.ts.map +1 -1
  241. package/src/secure-string.js +118 -1
  242. package/src/secure-string.js.map +1 -1
  243. package/src/services/aes-gcm.d.ts.map +1 -1
  244. package/src/services/aes-gcm.js.map +1 -1
  245. package/src/services/chunk-processor.d.ts.map +1 -1
  246. package/src/services/chunk-processor.js +2 -2
  247. package/src/services/chunk-processor.js.map +1 -1
  248. package/src/services/crc.d.ts +80 -2
  249. package/src/services/crc.d.ts.map +1 -1
  250. package/src/services/crc.js +80 -2
  251. package/src/services/crc.js.map +1 -1
  252. package/src/services/ecies/crypto-core.d.ts +2 -1
  253. package/src/services/ecies/crypto-core.d.ts.map +1 -1
  254. package/src/services/ecies/crypto-core.js +4 -1
  255. package/src/services/ecies/crypto-core.js.map +1 -1
  256. package/src/services/ecies/example.d.ts.map +1 -1
  257. package/src/services/ecies/example.js +4 -4
  258. package/src/services/ecies/example.js.map +1 -1
  259. package/src/services/ecies/file.d.ts +4 -0
  260. package/src/services/ecies/file.d.ts.map +1 -1
  261. package/src/services/ecies/file.js +6 -6
  262. package/src/services/ecies/file.js.map +1 -1
  263. package/src/services/ecies/index.d.ts +4 -2
  264. package/src/services/ecies/index.d.ts.map +1 -1
  265. package/src/services/ecies/index.js +4 -2
  266. package/src/services/ecies/index.js.map +1 -1
  267. package/src/services/ecies/integration.d.ts.map +1 -1
  268. package/src/services/ecies/integration.js +10 -4
  269. package/src/services/ecies/integration.js.map +1 -1
  270. package/src/services/ecies/interfaces/decryption-result.d.ts +3 -0
  271. package/src/services/ecies/interfaces/decryption-result.d.ts.map +1 -1
  272. package/src/services/ecies/interfaces/encryption-result.d.ts +3 -0
  273. package/src/services/ecies/interfaces/encryption-result.d.ts.map +1 -1
  274. package/src/services/ecies/interfaces/index.d.ts +3 -0
  275. package/src/services/ecies/interfaces/index.d.ts.map +1 -1
  276. package/src/services/ecies/interfaces/multi-encrypted-message.d.ts +3 -0
  277. package/src/services/ecies/interfaces/multi-encrypted-message.d.ts.map +1 -1
  278. package/src/services/ecies/interfaces/multi-encrypted-parsed-header.d.ts +3 -0
  279. package/src/services/ecies/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -1
  280. package/src/services/ecies/interfaces/multi-recipient.d.ts +3 -0
  281. package/src/services/ecies/interfaces/multi-recipient.d.ts.map +1 -1
  282. package/src/services/ecies/interfaces/simple-keypair.d.ts +3 -0
  283. package/src/services/ecies/interfaces/simple-keypair.d.ts.map +1 -1
  284. package/src/services/ecies/interfaces/single-encrypted-parsed-header.d.ts +3 -0
  285. package/src/services/ecies/interfaces/single-encrypted-parsed-header.d.ts.map +1 -1
  286. package/src/services/ecies/interfaces/wallet-seed.d.ts +3 -0
  287. package/src/services/ecies/interfaces/wallet-seed.d.ts.map +1 -1
  288. package/src/services/ecies/manual-test.d.ts.map +1 -1
  289. package/src/services/ecies/manual-test.js +7 -7
  290. package/src/services/ecies/manual-test.js.map +1 -1
  291. package/src/services/ecies/multi-recipient.d.ts +1 -1
  292. package/src/services/ecies/multi-recipient.d.ts.map +1 -1
  293. package/src/services/ecies/multi-recipient.js +1 -1
  294. package/src/services/ecies/multi-recipient.js.map +1 -1
  295. package/src/services/ecies/service.d.ts +21 -5
  296. package/src/services/ecies/service.d.ts.map +1 -1
  297. package/src/services/ecies/service.js +33 -17
  298. package/src/services/ecies/service.js.map +1 -1
  299. package/src/services/ecies/single-recipient.d.ts +2 -2
  300. package/src/services/ecies/single-recipient.d.ts.map +1 -1
  301. package/src/services/ecies/single-recipient.js +28 -33
  302. package/src/services/ecies/single-recipient.js.map +1 -1
  303. package/src/services/encryption-stream.d.ts.map +1 -1
  304. package/src/services/encryption-stream.js +1 -1
  305. package/src/services/encryption-stream.js.map +1 -1
  306. package/src/services/index.d.ts +4 -0
  307. package/src/services/index.d.ts.map +1 -1
  308. package/src/services/index.js +4 -0
  309. package/src/services/index.js.map +1 -1
  310. package/src/services/multi-recipient-processor.d.ts +15 -9
  311. package/src/services/multi-recipient-processor.d.ts.map +1 -1
  312. package/src/services/multi-recipient-processor.js +51 -39
  313. package/src/services/multi-recipient-processor.js.map +1 -1
  314. package/src/services/password-login.d.ts +41 -5
  315. package/src/services/password-login.d.ts.map +1 -1
  316. package/src/services/password-login.js +43 -7
  317. package/src/services/password-login.js.map +1 -1
  318. package/src/services/resumable-encryption.d.ts.map +1 -1
  319. package/src/services/resumable-encryption.js +5 -1
  320. package/src/services/resumable-encryption.js.map +1 -1
  321. package/src/test-mocks/index.d.ts +4 -0
  322. package/src/test-mocks/index.d.ts.map +1 -1
  323. package/src/test-mocks/index.js +4 -0
  324. package/src/test-mocks/index.js.map +1 -1
  325. package/src/test-mocks/mock-frontend-member.d.ts +91 -0
  326. package/src/test-mocks/mock-frontend-member.d.ts.map +1 -1
  327. package/src/test-mocks/mock-frontend-member.js +91 -0
  328. package/src/test-mocks/mock-frontend-member.js.map +1 -1
  329. package/src/testing.d.ts +4 -0
  330. package/src/testing.d.ts.map +1 -1
  331. package/src/testing.js +4 -1
  332. package/src/testing.js.map +1 -1
  333. package/src/transforms/checksumTransform.d.ts +17 -0
  334. package/src/transforms/checksumTransform.d.ts.map +1 -1
  335. package/src/transforms/checksumTransform.js +17 -0
  336. package/src/transforms/checksumTransform.js.map +1 -1
  337. package/src/transforms/eciesDecryptTransform.d.ts +19 -0
  338. package/src/transforms/eciesDecryptTransform.d.ts.map +1 -1
  339. package/src/transforms/eciesDecryptTransform.js +21 -2
  340. package/src/transforms/eciesDecryptTransform.js.map +1 -1
  341. package/src/transforms/eciesEncryptTransform.d.ts +20 -0
  342. package/src/transforms/eciesEncryptTransform.d.ts.map +1 -1
  343. package/src/transforms/eciesEncryptTransform.js +23 -3
  344. package/src/transforms/eciesEncryptTransform.js.map +1 -1
  345. package/src/transforms/index.d.ts +4 -0
  346. package/src/transforms/index.d.ts.map +1 -1
  347. package/src/transforms/index.js +4 -0
  348. package/src/transforms/index.js.map +1 -1
  349. package/src/transforms/xorMultipleTransform.d.ts +21 -0
  350. package/src/transforms/xorMultipleTransform.d.ts.map +1 -1
  351. package/src/transforms/xorMultipleTransform.js +21 -0
  352. package/src/transforms/xorMultipleTransform.js.map +1 -1
  353. package/src/transforms/xorTransform.d.ts +13 -0
  354. package/src/transforms/xorTransform.d.ts.map +1 -1
  355. package/src/transforms/xorTransform.js +13 -0
  356. package/src/transforms/xorTransform.js.map +1 -1
  357. package/src/translations/de.d.ts +3 -0
  358. package/src/translations/de.d.ts.map +1 -1
  359. package/src/translations/de.js +3 -0
  360. package/src/translations/de.js.map +1 -1
  361. package/src/translations/en-US.d.ts +3 -0
  362. package/src/translations/en-US.d.ts.map +1 -1
  363. package/src/translations/en-US.js +3 -0
  364. package/src/translations/en-US.js.map +1 -1
  365. package/src/translations/es.d.ts +3 -0
  366. package/src/translations/es.d.ts.map +1 -1
  367. package/src/translations/es.js +3 -0
  368. package/src/translations/es.js.map +1 -1
  369. package/src/translations/fr.d.ts +3 -0
  370. package/src/translations/fr.d.ts.map +1 -1
  371. package/src/translations/fr.js +3 -0
  372. package/src/translations/fr.js.map +1 -1
  373. package/src/translations/ja.d.ts +3 -0
  374. package/src/translations/ja.d.ts.map +1 -1
  375. package/src/translations/ja.js +3 -0
  376. package/src/translations/ja.js.map +1 -1
  377. package/src/translations/uk.d.ts +3 -0
  378. package/src/translations/uk.d.ts.map +1 -1
  379. package/src/translations/uk.js +3 -0
  380. package/src/translations/uk.js.map +1 -1
  381. package/src/translations/zh-cn.d.ts +3 -0
  382. package/src/translations/zh-cn.d.ts.map +1 -1
  383. package/src/translations/zh-cn.js +3 -0
  384. package/src/translations/zh-cn.js.map +1 -1
  385. package/src/typed-configuration.d.ts +2 -2
  386. package/src/typed-configuration.d.ts.map +1 -1
  387. package/src/typed-configuration.js.map +1 -1
  388. package/src/types/deep-partial.d.ts +16 -0
  389. package/src/types/deep-partial.d.ts.map +1 -1
  390. package/src/types/guid-versions.d.ts +5 -9
  391. package/src/types/guid-versions.d.ts.map +1 -1
  392. package/src/types.d.ts +30 -1
  393. package/src/types.d.ts.map +1 -1
  394. package/src/types.js +4 -0
  395. package/src/types.js.map +1 -1
  396. package/src/utils.d.ts +69 -18
  397. package/src/utils.d.ts.map +1 -1
  398. package/src/utils.js +70 -19
  399. package/src/utils.js.map +1 -1
package/src/lib/guid.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Guid = void 0;
3
+ exports.GuidUint8Array = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const uuid = tslib_1.__importStar(require("uuid"));
6
6
  const guid_brand_type_1 = require("../enumerations/guid-brand-type");
@@ -17,7 +17,7 @@ const guid_1 = require("../errors/guid");
17
17
  * - RawGuidUint8Array: A 16-byte Uint8Array representation of the GUID
18
18
  * Guid instances can be converted to any of these representations using the appropriate method.
19
19
  */
20
- class Guid {
20
+ class GuidUint8Array {
21
21
  /**
22
22
  * GUID is stored internally as a raw 16-byte Uint8Array.
23
23
  */
@@ -47,6 +47,10 @@ class Guid {
47
47
  * Cached base64 representation for performance
48
48
  */
49
49
  _cachedBase64;
50
+ /**
51
+ * The RFC 4122 version of this GUID (1, 3, 4, 5, or undefined for boundary/invalid)
52
+ */
53
+ __version;
50
54
  /**
51
55
  * Regex for validating hex strings (case insensitive)
52
56
  */
@@ -69,13 +73,13 @@ class Guid {
69
73
  * Empty/nil GUID constant (all zeros)
70
74
  */
71
75
  static get Empty() {
72
- if (!Guid._empty) {
73
- Guid._empty = Object.freeze(new Guid('00000000-0000-0000-0000-000000000000'));
76
+ if (!GuidUint8Array._empty) {
77
+ GuidUint8Array._empty = Object.freeze(new GuidUint8Array('00000000-0000-0000-0000-000000000000'));
74
78
  }
75
- return Guid._empty;
79
+ return GuidUint8Array._empty;
76
80
  }
77
81
  constructor(value) {
78
- const array = Guid.validateAndConvert(value);
82
+ const array = GuidUint8Array.validateAndConvert(value);
79
83
  // Note: We cannot freeze a Buffer as it's an ArrayBuffer view
80
84
  // Instead, we ensure the array is never directly modified after construction
81
85
  this._value = array;
@@ -83,6 +87,7 @@ class Guid {
83
87
  this._cachedFullHex = undefined;
84
88
  this._cachedShortHex = undefined;
85
89
  this._cachedBase64 = undefined;
90
+ this.__version = undefined;
86
91
  // Seal the instance to prevent property addition/deletion
87
92
  // Cache properties can still be set once since they were initialized
88
93
  Object.seal(this);
@@ -113,32 +118,32 @@ class Guid {
113
118
  if (typeof value === 'string') {
114
119
  const isFullHex = value.length === 36 && value.includes('-');
115
120
  const isShortHex = value.length === 32 && !value.includes('-');
116
- if (isFullHex && !Guid.FULL_HEX_PATTERN.test(value)) {
121
+ if (isFullHex && !GuidUint8Array.FULL_HEX_PATTERN.test(value)) {
117
122
  const array = new TextEncoder().encode(value);
118
123
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidWithDetails, guid_brand_type_1.GuidBrandType.FullHexGuid, value.length, array);
119
124
  }
120
- else if (isShortHex && !Guid.HEX_PATTERN.test(value)) {
125
+ else if (isShortHex && !GuidUint8Array.HEX_PATTERN.test(value)) {
121
126
  const array = new TextEncoder().encode(value);
122
127
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidWithDetails, guid_brand_type_1.GuidBrandType.ShortHexGuid, value.length, array);
123
128
  }
124
129
  }
125
130
  // Determine and verify the brand/type
126
- const expectedBrand = Guid.whichBrand(value);
127
- const verifiedBrand = Guid.verifyGuid(expectedBrand, value);
131
+ const expectedBrand = GuidUint8Array.whichBrand(value);
132
+ const verifiedBrand = GuidUint8Array.verifyGuid(expectedBrand, value);
128
133
  if (!verifiedBrand) {
129
- const valueBuffer = Guid.isUint8Array(value)
134
+ const valueBuffer = GuidUint8Array.isUint8Array(value)
130
135
  ? value
131
136
  : new TextEncoder().encode(strValue);
132
137
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidWithDetails, expectedBrand, undefined, valueBuffer);
133
138
  }
134
139
  // Convert to raw array
135
- const array = Guid.toRawGuidPlatformBuffer(value);
140
+ const array = GuidUint8Array.toRawGuidPlatformBuffer(value);
136
141
  // Validate against UUID standard (skip for boundary values)
137
142
  const hexString = Array.from(array)
138
143
  .map((b) => b.toString(16).padStart(2, '0'))
139
144
  .join('');
140
- const fullHex = Guid.toFullHexGuid(hexString);
141
- const isBoundary = Guid.isBoundaryValue(fullHex);
145
+ const fullHex = GuidUint8Array.toFullHexGuid(hexString);
146
+ const isBoundary = GuidUint8Array.isBoundaryValue(fullHex);
142
147
  if (!isBoundary && !uuid.validate(fullHex)) {
143
148
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid, expectedBrand, undefined, array);
144
149
  }
@@ -153,7 +158,7 @@ class Guid {
153
158
  if (typeof value === 'bigint') {
154
159
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
155
160
  }
156
- const length = Guid.isUint8Array(value)
161
+ const length = GuidUint8Array.isUint8Array(value)
157
162
  ? value.length
158
163
  : String(value).length;
159
164
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownLength, undefined, length);
@@ -166,7 +171,7 @@ class Guid {
166
171
  return this.asBase64Guid;
167
172
  }
168
173
  static hydrate(value) {
169
- return new Guid(value);
174
+ return GuidUint8Array.withVersion(new GuidUint8Array(value));
170
175
  }
171
176
  static LengthMap = {
172
177
  [guid_brand_type_1.GuidBrandType.Unknown]: -1,
@@ -209,6 +214,16 @@ class Guid {
209
214
  get asRawGuidPlatformBufferUnsafe() {
210
215
  return this._value;
211
216
  }
217
+ /**
218
+ * Attaches the RFC 4122 version to a GuidUint8Array instance.
219
+ * @param guid The GuidUint8Array instance to attach version to
220
+ * @returns The same instance with __version property set
221
+ */
222
+ static withVersion(guid) {
223
+ const version = guid.getVersion();
224
+ guid.__version = version;
225
+ return guid;
226
+ }
212
227
  /**
213
228
  * Generates a new random v4 GUID.
214
229
  * @returns A new Guid instance with a randomly generated value
@@ -219,7 +234,7 @@ class Guid {
219
234
  if (!uuidStr) {
220
235
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
221
236
  }
222
- return new Guid(uuidStr);
237
+ return GuidUint8Array.withVersion(new GuidUint8Array(uuidStr));
223
238
  }
224
239
  catch (error) {
225
240
  if (error instanceof guid_1.GuidError) {
@@ -233,34 +248,34 @@ class Guid {
233
248
  * @returns A new Guid instance with a randomly generated v4 value
234
249
  */
235
250
  static v4() {
236
- return Guid.generate();
251
+ return GuidUint8Array.generate();
237
252
  }
238
253
  /**
239
254
  * Alias for generate() for backward compatibility.
240
255
  * @deprecated Use generate() instead for clearer intent
241
256
  */
242
257
  static new() {
243
- return Guid.generate();
258
+ return GuidUint8Array.generate();
244
259
  }
245
260
  /**
246
261
  * Parses a GUID from any valid format, throwing on invalid input.
247
262
  * This is the primary parsing method for when you expect valid input.
248
263
  * @param value The value to parse
249
- * @returns A new Guid instance
264
+ * @returns A new Guid instance with __version attached
250
265
  * @throws {GuidError} If the value is not a valid GUID
251
266
  */
252
267
  static parse(value) {
253
- return new Guid(value);
268
+ return GuidUint8Array.withVersion(new GuidUint8Array(value));
254
269
  }
255
270
  /**
256
271
  * Attempts to parse a GUID, returning null on failure instead of throwing.
257
272
  * Use this when you're uncertain if the input is valid.
258
273
  * @param value The value to parse
259
- * @returns A new Guid instance or null if parsing fails
274
+ * @returns A new Guid instance with __version attached, or null if parsing fails
260
275
  */
261
276
  static tryParse(value) {
262
277
  try {
263
- return new Guid(value);
278
+ return GuidUint8Array.withVersion(new GuidUint8Array(value));
264
279
  }
265
280
  catch {
266
281
  return null;
@@ -276,7 +291,7 @@ class Guid {
276
291
  if (!value)
277
292
  return false;
278
293
  try {
279
- const guid = new Guid(value);
294
+ const guid = new GuidUint8Array(value);
280
295
  return guid.isValidV4();
281
296
  }
282
297
  catch {
@@ -286,51 +301,51 @@ class Guid {
286
301
  /**
287
302
  * Factory method to create a GUID from a full hex string.
288
303
  * @param fullHex The full hex string (with dashes)
289
- * @returns A new Guid instance
304
+ * @returns A new Guid instance with __version attached
290
305
  */
291
306
  static fromFullHex(fullHex) {
292
- return new Guid(fullHex);
307
+ return GuidUint8Array.withVersion(new GuidUint8Array(fullHex));
293
308
  }
294
309
  /**
295
310
  * Factory method to create a GUID from a short hex string.
296
311
  * @param shortHex The short hex string (without dashes)
297
- * @returns A new Guid instance
312
+ * @returns A new Guid instance with __version attached
298
313
  */
299
314
  static fromShortHex(shortHex) {
300
- return new Guid(shortHex);
315
+ return GuidUint8Array.withVersion(new GuidUint8Array(shortHex));
301
316
  }
302
317
  /**
303
318
  * Factory method to create a GUID from a base64 string.
304
319
  * @param base64 The base64 encoded string
305
- * @returns A new Guid instance
320
+ * @returns A new Guid instance with __version attached
306
321
  */
307
322
  static fromBase64(base64) {
308
- return new Guid(base64);
323
+ return GuidUint8Array.withVersion(new GuidUint8Array(base64));
309
324
  }
310
325
  /**
311
326
  * Factory method to create a GUID from a bigint.
312
327
  * @param bigint The bigint value
313
- * @returns A new Guid instance
328
+ * @returns A new Guid instance with __version attached
314
329
  */
315
330
  static fromBigInt(bigint) {
316
- return new Guid(bigint);
331
+ return GuidUint8Array.withVersion(new GuidUint8Array(bigint));
317
332
  }
318
333
  /**
319
334
  * Factory method to create a GUID from a raw Uint8Array.
320
335
  * This is an explicit alias for fromBuffer(), provided for clarity when working
321
336
  * with browser environments where Uint8Array is the native binary type.
322
337
  * @param bytes The raw 16-byte Uint8Array
323
- * @returns A new Guid instance
338
+ * @returns A new Guid instance with __version attached
324
339
  */
325
340
  static fromPlatformBuffer(bytes) {
326
- return new Guid(bytes);
341
+ return GuidUint8Array.withVersion(new GuidUint8Array(bytes));
327
342
  }
328
343
  /**
329
344
  * Creates a namespace-based v3 GUID (MD5 hash).
330
345
  * Use this for deterministic GUIDs based on a namespace and name.
331
346
  * @param name The name to hash within the namespace
332
347
  * @param namespace The namespace GUID (e.g., Guid.Namespaces.DNS)
333
- * @returns A new Guid instance containing the v3 GUID
348
+ * @returns A new Guid instance containing the v3 GUID with __version attached
334
349
  * @example
335
350
  * const guid = Guid.v3('example.com', Guid.Namespaces.DNS);
336
351
  */
@@ -338,9 +353,9 @@ class Guid {
338
353
  try {
339
354
  const namespaceStr = typeof namespace === 'string'
340
355
  ? namespace
341
- : Guid.toFullHexGuid(namespace);
356
+ : GuidUint8Array.toFullHexGuid(namespace);
342
357
  const v3Guid = uuid.v3(name, namespaceStr);
343
- return new Guid(v3Guid);
358
+ return GuidUint8Array.withVersion(new GuidUint8Array(v3Guid));
344
359
  }
345
360
  catch (error) {
346
361
  if (error instanceof guid_1.GuidError) {
@@ -355,7 +370,7 @@ class Guid {
355
370
  * Preferred over v3 as SHA-1 is stronger than MD5.
356
371
  * @param name The name to hash within the namespace
357
372
  * @param namespace The namespace GUID (e.g., Guid.Namespaces.DNS)
358
- * @returns A new Guid instance containing the v5 GUID
373
+ * @returns A new Guid instance containing the v5 GUID with __version attached
359
374
  * @example
360
375
  * const guid = Guid.v5('example.com', Guid.Namespaces.DNS);
361
376
  */
@@ -363,9 +378,9 @@ class Guid {
363
378
  try {
364
379
  const namespaceStr = typeof namespace === 'string'
365
380
  ? namespace
366
- : Guid.toFullHexGuid(namespace);
381
+ : GuidUint8Array.toFullHexGuid(namespace);
367
382
  const v5Guid = uuid.v5(name, namespaceStr);
368
- return new Guid(v5Guid);
383
+ return GuidUint8Array.withVersion(new GuidUint8Array(v5Guid));
369
384
  }
370
385
  catch (error) {
371
386
  if (error instanceof guid_1.GuidError) {
@@ -394,7 +409,7 @@ class Guid {
394
409
  const hexString = Array.from(this._value)
395
410
  .map((b) => b.toString(16).padStart(2, '0'))
396
411
  .join('');
397
- this._cachedFullHex = Guid.toFullHexGuid(hexString);
412
+ this._cachedFullHex = GuidUint8Array.toFullHexGuid(hexString);
398
413
  }
399
414
  return this._cachedFullHex;
400
415
  }
@@ -410,7 +425,7 @@ class Guid {
410
425
  */
411
426
  get asShortHexGuid() {
412
427
  if (!this._cachedShortHex) {
413
- this._cachedShortHex = Guid.toShortHexGuid(this.asFullHexGuid);
428
+ this._cachedShortHex = GuidUint8Array.toShortHexGuid(this.asFullHexGuid);
414
429
  }
415
430
  return this._cachedShortHex;
416
431
  }
@@ -452,10 +467,10 @@ class Guid {
452
467
  * @returns True if the value is a boundary value.
453
468
  */
454
469
  static isBoundaryValue(value) {
455
- return (value === Guid.BOUNDARY_VALUES.ALL_ZEROS_FULL ||
456
- value === Guid.BOUNDARY_VALUES.ALL_ZEROS_SHORT ||
457
- value === Guid.BOUNDARY_VALUES.ALL_FS_FULL ||
458
- value === Guid.BOUNDARY_VALUES.ALL_FS_SHORT);
470
+ return (value === GuidUint8Array.BOUNDARY_VALUES.ALL_ZEROS_FULL ||
471
+ value === GuidUint8Array.BOUNDARY_VALUES.ALL_ZEROS_SHORT ||
472
+ value === GuidUint8Array.BOUNDARY_VALUES.ALL_FS_FULL ||
473
+ value === GuidUint8Array.BOUNDARY_VALUES.ALL_FS_SHORT);
459
474
  }
460
475
  /**
461
476
  * Verifies if a given GUID is valid for the given brand.
@@ -468,7 +483,7 @@ class Guid {
468
483
  return false;
469
484
  }
470
485
  try {
471
- const verifyFunc = Guid.VerifyFunctions[guidBrand];
486
+ const verifyFunc = GuidUint8Array.VerifyFunctions[guidBrand];
472
487
  return verifyFunc(guid);
473
488
  }
474
489
  catch {
@@ -481,7 +496,7 @@ class Guid {
481
496
  * @returns The length of the GUID for the given brand.
482
497
  */
483
498
  static guidBrandToLength(guidBrand) {
484
- const length = Guid.LengthMap[guidBrand];
499
+ const length = GuidUint8Array.LengthMap[guidBrand];
485
500
  if (length <= 0) {
486
501
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownBrand, guidBrand);
487
502
  }
@@ -497,7 +512,7 @@ class Guid {
497
512
  if (length <= 0) {
498
513
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownLength, undefined, length);
499
514
  }
500
- const brand = Guid.ReverseLengthMap[length];
515
+ const brand = GuidUint8Array.ReverseLengthMap[length];
501
516
  if (!brand || brand === guid_brand_type_1.GuidBrandType.Unknown) {
502
517
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownLength, undefined, length);
503
518
  }
@@ -518,16 +533,16 @@ class Guid {
518
533
  if (fullHexGuidValue === null || fullHexGuidValue === undefined) {
519
534
  return false;
520
535
  }
521
- const expectedLength = Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid);
536
+ const expectedLength = GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid);
522
537
  const strValue = String(fullHexGuidValue);
523
538
  if (strValue.length !== expectedLength) {
524
539
  return false;
525
540
  }
526
541
  // Boundary values are always valid
527
- if (Guid.isBoundaryValue(strValue)) {
542
+ if (GuidUint8Array.isBoundaryValue(strValue)) {
528
543
  return true;
529
544
  }
530
- return Guid.validateUuid(strValue);
545
+ return GuidUint8Array.validateUuid(strValue);
531
546
  }
532
547
  catch {
533
548
  return false;
@@ -543,15 +558,15 @@ class Guid {
543
558
  if (shortHexGuidValue === null || shortHexGuidValue === undefined) {
544
559
  return false;
545
560
  }
546
- const expectedLength = Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid);
561
+ const expectedLength = GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid);
547
562
  const strValue = String(shortHexGuidValue);
548
563
  if (strValue.length !== expectedLength) {
549
564
  return false;
550
565
  }
551
566
  try {
552
- const fullHexGuid = Guid.toFullHexGuid(strValue);
567
+ const fullHexGuid = GuidUint8Array.toFullHexGuid(strValue);
553
568
  // Boundary values are always valid
554
- if (Guid.isBoundaryValue(fullHexGuid)) {
569
+ if (GuidUint8Array.isBoundaryValue(fullHexGuid)) {
555
570
  return true;
556
571
  }
557
572
  return uuid.validate(fullHexGuid);
@@ -578,22 +593,23 @@ class Guid {
578
593
  if (typeof value === 'bigint') {
579
594
  valueLength = value.toString(16).length;
580
595
  }
581
- else if (Guid.isUint8Array(value)) {
596
+ else if (GuidUint8Array.isUint8Array(value)) {
582
597
  valueLength = value.length;
583
598
  }
584
599
  else {
585
600
  valueLength = String(value).length;
586
601
  }
587
- const result = valueLength === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid);
602
+ const result = valueLength ===
603
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid);
588
604
  if (result) {
589
605
  try {
590
- const fromBase64 = Guid.toRawGuidPlatformBuffer(value);
606
+ const fromBase64 = GuidUint8Array.toRawGuidPlatformBuffer(value);
591
607
  const hexString = Array.from(fromBase64)
592
608
  .map((b) => b.toString(16).padStart(2, '0'))
593
609
  .join('');
594
- const fullHexGuid = Guid.toFullHexGuid(hexString);
610
+ const fullHexGuid = GuidUint8Array.toFullHexGuid(hexString);
595
611
  // Boundary values are always valid
596
- if (Guid.isBoundaryValue(fullHexGuid)) {
612
+ if (GuidUint8Array.isBoundaryValue(fullHexGuid)) {
597
613
  return true;
598
614
  }
599
615
  return uuid.validate(fullHexGuid);
@@ -618,12 +634,12 @@ class Guid {
618
634
  if (value === null || value === undefined) {
619
635
  return false;
620
636
  }
621
- const expectedLength = Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer);
637
+ const expectedLength = GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer);
622
638
  let valueLength;
623
639
  if (typeof value === 'bigint') {
624
640
  valueLength = value.toString(16).length;
625
641
  }
626
- else if (Guid.isUint8Array(value)) {
642
+ else if (GuidUint8Array.isUint8Array(value)) {
627
643
  valueLength = value.length;
628
644
  }
629
645
  else {
@@ -633,18 +649,18 @@ class Guid {
633
649
  return false;
634
650
  }
635
651
  try {
636
- if (!Guid.isUint8Array(value)) {
652
+ if (!GuidUint8Array.isUint8Array(value)) {
637
653
  return false;
638
654
  }
639
655
  const hexString = Array.from(value)
640
656
  .map((b) => b.toString(16).padStart(2, '0'))
641
657
  .join('');
642
- const fullHexGuid = Guid.toFullHexGuid(hexString);
658
+ const fullHexGuid = GuidUint8Array.toFullHexGuid(hexString);
643
659
  // Boundary values are always valid
644
- if (Guid.isBoundaryValue(fullHexGuid)) {
660
+ if (GuidUint8Array.isBoundaryValue(fullHexGuid)) {
645
661
  return true;
646
662
  }
647
- return Guid.validateUuid(fullHexGuid);
663
+ return GuidUint8Array.validateUuid(fullHexGuid);
648
664
  }
649
665
  catch {
650
666
  return false;
@@ -667,13 +683,13 @@ class Guid {
667
683
  if (typeof value !== 'bigint') {
668
684
  return false;
669
685
  }
670
- if (value < 0n || value > Guid.MAX_BIGINT_VALUE) {
686
+ if (value < 0n || value > GuidUint8Array.MAX_BIGINT_VALUE) {
671
687
  return false;
672
688
  }
673
689
  try {
674
- const fromBigInt = Guid.toFullHexFromBigInt(value);
690
+ const fromBigInt = GuidUint8Array.toFullHexFromBigInt(value);
675
691
  // Boundary values are always valid
676
- if (Guid.isBoundaryValue(fromBigInt)) {
692
+ if (GuidUint8Array.isBoundaryValue(fromBigInt)) {
677
693
  return true;
678
694
  }
679
695
  return uuid.validate(fromBigInt);
@@ -698,11 +714,11 @@ class Guid {
698
714
  if (typeof value === 'bigint') {
699
715
  return guid_brand_type_1.GuidBrandType.BigIntGuid;
700
716
  }
701
- const isBuffer = Guid.isUint8Array(value);
717
+ const isBuffer = GuidUint8Array.isUint8Array(value);
702
718
  const expectedLength = isBuffer
703
719
  ? value.length
704
720
  : String(value).length;
705
- return Guid.lengthToGuidBrand(expectedLength, isBuffer);
721
+ return GuidUint8Array.lengthToGuidBrand(expectedLength, isBuffer);
706
722
  }
707
723
  /**
708
724
  * Converts a given short hex GUID to a full hex GUID.
@@ -724,31 +740,34 @@ class Guid {
724
740
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
725
741
  }
726
742
  if (typeof guid === 'bigint') {
727
- return Guid.toFullHexFromBigInt(guid);
743
+ return GuidUint8Array.toFullHexFromBigInt(guid);
728
744
  }
729
- else if (Guid.isUint8Array(guid) &&
745
+ else if (GuidUint8Array.isUint8Array(guid) &&
730
746
  guid.length ===
731
- Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
747
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
732
748
  const hexString = Array.from(guid)
733
749
  .map((b) => b.toString(16).padStart(2, '0'))
734
750
  .join('');
735
751
  const shortHex = hexString;
736
- return Guid.shortGuidToFullGuid(shortHex);
752
+ return GuidUint8Array.shortGuidToFullGuid(shortHex);
737
753
  }
738
- else if (Guid.isUint8Array(guid)) {
754
+ else if (GuidUint8Array.isUint8Array(guid)) {
739
755
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
740
756
  }
741
757
  // all remaining cases are string types
742
758
  const strValue = String(guid);
743
- if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid)) {
759
+ if (strValue.length ===
760
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid)) {
744
761
  // short hex guid
745
- return Guid.shortGuidToFullGuid(strValue);
762
+ return GuidUint8Array.shortGuidToFullGuid(strValue);
746
763
  }
747
- else if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid)) {
764
+ else if (strValue.length ===
765
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid)) {
748
766
  // already a full hex guid
749
767
  return strValue;
750
768
  }
751
- else if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid)) {
769
+ else if (strValue.length ===
770
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid)) {
752
771
  // base64 guid
753
772
  // base64 guid
754
773
  const binary = atob(strValue);
@@ -759,7 +778,7 @@ class Guid {
759
778
  const shortGuid = Array.from(bytes)
760
779
  .map((b) => b.toString(16).padStart(2, '0'))
761
780
  .join('');
762
- return Guid.shortGuidToFullGuid(shortGuid);
781
+ return GuidUint8Array.shortGuidToFullGuid(shortGuid);
763
782
  }
764
783
  else {
765
784
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
@@ -770,30 +789,33 @@ class Guid {
770
789
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
771
790
  }
772
791
  if (typeof guid === 'bigint') {
773
- const fullHex = Guid.toFullHexFromBigInt(guid);
792
+ const fullHex = GuidUint8Array.toFullHexFromBigInt(guid);
774
793
  return fullHex.replace(/-/g, '');
775
794
  }
776
- else if (Guid.isUint8Array(guid) &&
795
+ else if (GuidUint8Array.isUint8Array(guid) &&
777
796
  guid.length ===
778
- Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
797
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
779
798
  return Array.from(guid)
780
799
  .map((b) => b.toString(16).padStart(2, '0'))
781
800
  .join('');
782
801
  }
783
- else if (Guid.isUint8Array(guid)) {
802
+ else if (GuidUint8Array.isUint8Array(guid)) {
784
803
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
785
804
  }
786
805
  // all remaining cases are string types
787
806
  const strValue = String(guid);
788
- if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid)) {
807
+ if (strValue.length ===
808
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.ShortHexGuid)) {
789
809
  // already a short hex guid
790
810
  return strValue;
791
811
  }
792
- else if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid)) {
812
+ else if (strValue.length ===
813
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.FullHexGuid)) {
793
814
  // full hex guid
794
815
  return strValue.replace(/-/g, '');
795
816
  }
796
- else if (strValue.length === Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid)) {
817
+ else if (strValue.length ===
818
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.Base64Guid)) {
797
819
  // base64 guid
798
820
  const binary = atob(strValue);
799
821
  const bytes = new Uint8Array(binary.length);
@@ -814,7 +836,7 @@ class Guid {
814
836
  * @returns The bigint as a full hex GUID.
815
837
  */
816
838
  static toFullHexFromBigInt(bigInt) {
817
- if (bigInt < 0n || bigInt > Guid.MAX_BIGINT_VALUE) {
839
+ if (bigInt < 0n || bigInt > GuidUint8Array.MAX_BIGINT_VALUE) {
818
840
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuid);
819
841
  }
820
842
  const uuidBigInt = bigInt.toString(16).padStart(32, '0');
@@ -839,11 +861,11 @@ class Guid {
839
861
  * @returns The GUID value as a raw GUID array.
840
862
  */
841
863
  static toRawGuidPlatformBuffer(value) {
842
- const expectedBrand = Guid.whichBrand(value);
864
+ const expectedBrand = GuidUint8Array.whichBrand(value);
843
865
  let rawGuidBufferResult = new Uint8Array(0);
844
866
  switch (expectedBrand) {
845
867
  case guid_brand_type_1.GuidBrandType.FullHexGuid: {
846
- const hex1 = Guid.toShortHexGuid(value);
868
+ const hex1 = GuidUint8Array.toShortHexGuid(value);
847
869
  rawGuidBufferResult = new Uint8Array(hex1.length / 2);
848
870
  for (let i = 0; i < hex1.length; i += 2) {
849
871
  rawGuidBufferResult[i / 2] = parseInt(hex1.slice(i, i + 2), 16);
@@ -851,7 +873,7 @@ class Guid {
851
873
  break;
852
874
  }
853
875
  case guid_brand_type_1.GuidBrandType.ShortHexGuid: {
854
- const hex2 = Guid.toShortHexGuid(value);
876
+ const hex2 = GuidUint8Array.toShortHexGuid(value);
855
877
  rawGuidBufferResult = new Uint8Array(hex2.length / 2);
856
878
  for (let i = 0; i < hex2.length; i += 2) {
857
879
  rawGuidBufferResult[i / 2] = parseInt(hex2.slice(i, i + 2), 16);
@@ -859,7 +881,7 @@ class Guid {
859
881
  break;
860
882
  }
861
883
  case guid_brand_type_1.GuidBrandType.Base64Guid:
862
- if (typeof value === 'string' || Guid.isUint8Array(value)) {
884
+ if (typeof value === 'string' || GuidUint8Array.isUint8Array(value)) {
863
885
  const b64 = value.toString();
864
886
  const binary = atob(b64);
865
887
  rawGuidBufferResult = new Uint8Array(binary.length);
@@ -875,7 +897,7 @@ class Guid {
875
897
  rawGuidBufferResult = value;
876
898
  break;
877
899
  case guid_brand_type_1.GuidBrandType.BigIntGuid: {
878
- const hex3 = Guid.toShortHexGuid(Guid.toFullHexFromBigInt(value));
900
+ const hex3 = GuidUint8Array.toShortHexGuid(GuidUint8Array.toFullHexFromBigInt(value));
879
901
  rawGuidBufferResult = new Uint8Array(hex3.length / 2);
880
902
  for (let i = 0; i < hex3.length; i += 2) {
881
903
  rawGuidBufferResult[i / 2] = parseInt(hex3.slice(i, i + 2), 16);
@@ -886,7 +908,7 @@ class Guid {
886
908
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownBrand);
887
909
  }
888
910
  if (rawGuidBufferResult.length !==
889
- Guid.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
911
+ GuidUint8Array.guidBrandToLength(guid_brand_type_1.GuidBrandType.RawGuidPlatformBuffer)) {
890
912
  throw new guid_1.GuidError(guid_error_type_1.GuidErrorType.InvalidGuidUnknownLength, undefined, rawGuidBufferResult.length);
891
913
  }
892
914
  return rawGuidBufferResult;
@@ -937,14 +959,14 @@ class Guid {
937
959
  * @returns True if the GUID is null, undefined, or empty
938
960
  */
939
961
  static isNilOrEmpty(guid) {
940
- return !guid || (guid instanceof Guid && guid.isEmpty());
962
+ return !guid || (guid instanceof GuidUint8Array && guid.isEmpty());
941
963
  }
942
964
  /**
943
965
  * Creates a new Guid instance with the same value as this one.
944
- * @returns A new Guid instance with identical value
966
+ * @returns A new Guid instance with identical value and __version attached
945
967
  */
946
968
  clone() {
947
- return new Guid(Uint8Array.from(this._value));
969
+ return GuidUint8Array.withVersion(new GuidUint8Array(Uint8Array.from(this._value)));
948
970
  }
949
971
  /**
950
972
  * Returns the hash code for this GUID based on its array content.
@@ -966,7 +988,7 @@ class Guid {
966
988
  */
967
989
  getVersion() {
968
990
  // Skip boundary values
969
- if (Guid.isBoundaryValue(this.asFullHexGuid)) {
991
+ if (GuidUint8Array.isBoundaryValue(this.asFullHexGuid)) {
970
992
  return undefined;
971
993
  }
972
994
  // Version is in bits 48-51 (byte 6, high nibble)
@@ -989,7 +1011,7 @@ class Guid {
989
1011
  */
990
1012
  isValidV4() {
991
1013
  // Boundary values are considered valid
992
- if (Guid.isBoundaryValue(this.asFullHexGuid)) {
1014
+ if (GuidUint8Array.isBoundaryValue(this.asFullHexGuid)) {
993
1015
  return true;
994
1016
  }
995
1017
  const version = this.getVersion();
@@ -1060,12 +1082,12 @@ class Guid {
1060
1082
  }
1061
1083
  /**
1062
1084
  * Creates a v1 GUID (time-based).
1063
- * @returns A new Guid instance containing a v1 GUID
1085
+ * @returns A new Guid instance containing a v1 GUID with __version attached
1064
1086
  */
1065
1087
  static v1() {
1066
1088
  try {
1067
1089
  const v1Guid = uuid.v1();
1068
- return new Guid(v1Guid);
1090
+ return GuidUint8Array.withVersion(new GuidUint8Array(v1Guid));
1069
1091
  }
1070
1092
  catch (error) {
1071
1093
  if (error instanceof guid_1.GuidError)
@@ -1089,14 +1111,15 @@ class Guid {
1089
1111
  }
1090
1112
  /**
1091
1113
  * Creates a GUID from URL-safe base64.
1114
+ * @returns A new Guid instance with __version attached
1092
1115
  */
1093
1116
  static fromUrlSafeBase64(urlSafe) {
1094
1117
  const base64 = urlSafe
1095
1118
  .replace(/-/g, '+')
1096
1119
  .replace(/_/g, '/')
1097
1120
  .padEnd(24, '=');
1098
- return new Guid(base64);
1121
+ return GuidUint8Array.withVersion(new GuidUint8Array(base64));
1099
1122
  }
1100
1123
  }
1101
- exports.Guid = Guid;
1124
+ exports.GuidUint8Array = GuidUint8Array;
1102
1125
  //# sourceMappingURL=guid.js.map