@astrogate/sdk 0.0.0-stage → 0.1.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 (440) hide show
  1. package/README.md +6 -2
  2. package/THIRD_PARTY_NOTICES.md +17 -0
  3. package/dist/browser.d.ts +85 -0
  4. package/dist/browser.js +16 -0
  5. package/dist/database-binding.d.ts +7 -0
  6. package/dist/database-binding.js +11 -0
  7. package/dist/hosted-session.d.ts +1 -0
  8. package/dist/hosted-session.js +11 -0
  9. package/dist/http.d.ts +24 -0
  10. package/dist/http.js +92 -0
  11. package/dist/inventory.d.ts +7 -0
  12. package/dist/inventory.js +18 -0
  13. package/dist/management-read.d.ts +17 -0
  14. package/dist/management-read.js +104 -0
  15. package/dist/management.d.ts +347 -0
  16. package/dist/management.js +137 -0
  17. package/dist/operator.d.ts +136 -0
  18. package/dist/operator.js +53 -0
  19. package/dist/react.d.ts +16 -0
  20. package/dist/react.js +10 -0
  21. package/dist/server.d.ts +27 -0
  22. package/dist/server.js +30 -0
  23. package/dist/services.d.ts +7 -0
  24. package/dist/services.js +53 -0
  25. package/dist/storage.d.ts +68 -0
  26. package/dist/storage.js +30 -0
  27. package/dist/tasks.d.ts +42 -0
  28. package/dist/tasks.js +24 -0
  29. package/dist/wire.gen.d.ts +7107 -0
  30. package/dist/wire.gen.js +5 -0
  31. package/native-provenance.json +15 -0
  32. package/node_modules/@instantdb/admin/LICENSE +202 -0
  33. package/node_modules/@instantdb/admin/dist/esm/index.d.ts +607 -0
  34. package/node_modules/@instantdb/admin/dist/esm/index.js +1036 -0
  35. package/node_modules/@instantdb/admin/dist/esm/polyfill.d.ts +16 -0
  36. package/node_modules/@instantdb/admin/dist/esm/polyfill.js +21 -0
  37. package/node_modules/@instantdb/admin/dist/esm/subscribe.d.ts +38 -0
  38. package/node_modules/@instantdb/admin/dist/esm/subscribe.js +301 -0
  39. package/node_modules/@instantdb/admin/dist/esm/version.d.ts +2 -0
  40. package/node_modules/@instantdb/admin/dist/esm/version.js +2 -0
  41. package/node_modules/@instantdb/admin/package.json +23 -0
  42. package/node_modules/@instantdb/core/LICENSE +202 -0
  43. package/node_modules/@instantdb/core/dist/esm/Connection.d.ts +92 -0
  44. package/node_modules/@instantdb/core/dist/esm/Connection.js +188 -0
  45. package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.d.ts +10 -0
  46. package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.js +25 -0
  47. package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.d.ts +17 -0
  48. package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.js +309 -0
  49. package/node_modules/@instantdb/core/dist/esm/InstantError.d.ts +6 -0
  50. package/node_modules/@instantdb/core/dist/esm/InstantError.js +23 -0
  51. package/node_modules/@instantdb/core/dist/esm/Reactor.d.ts +430 -0
  52. package/node_modules/@instantdb/core/dist/esm/Reactor.js +2369 -0
  53. package/node_modules/@instantdb/core/dist/esm/StorageAPI.d.ts +39 -0
  54. package/node_modules/@instantdb/core/dist/esm/StorageAPI.js +65 -0
  55. package/node_modules/@instantdb/core/dist/esm/Stream.d.ts +120 -0
  56. package/node_modules/@instantdb/core/dist/esm/Stream.js +811 -0
  57. package/node_modules/@instantdb/core/dist/esm/SyncTable.d.ts +144 -0
  58. package/node_modules/@instantdb/core/dist/esm/SyncTable.js +523 -0
  59. package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.d.ts +4 -0
  60. package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.js +19 -0
  61. package/node_modules/@instantdb/core/dist/esm/attrTypes.d.ts +25 -0
  62. package/node_modules/@instantdb/core/dist/esm/attrTypes.js +1 -0
  63. package/node_modules/@instantdb/core/dist/esm/authAPI.d.ts +64 -0
  64. package/node_modules/@instantdb/core/dist/esm/authAPI.js +103 -0
  65. package/node_modules/@instantdb/core/dist/esm/clientTypes.d.ts +40 -0
  66. package/node_modules/@instantdb/core/dist/esm/clientTypes.js +1 -0
  67. package/node_modules/@instantdb/core/dist/esm/coreTypes.d.ts +33 -0
  68. package/node_modules/@instantdb/core/dist/esm/coreTypes.js +1 -0
  69. package/node_modules/@instantdb/core/dist/esm/createRouteHandler.d.ts +7 -0
  70. package/node_modules/@instantdb/core/dist/esm/createRouteHandler.js +51 -0
  71. package/node_modules/@instantdb/core/dist/esm/datalog.d.ts +7 -0
  72. package/node_modules/@instantdb/core/dist/esm/datalog.js +99 -0
  73. package/node_modules/@instantdb/core/dist/esm/devtool.d.ts +3 -0
  74. package/node_modules/@instantdb/core/dist/esm/devtool.js +144 -0
  75. package/node_modules/@instantdb/core/dist/esm/framework.d.ts +80 -0
  76. package/node_modules/@instantdb/core/dist/esm/framework.js +243 -0
  77. package/node_modules/@instantdb/core/dist/esm/helperTypes.d.ts +75 -0
  78. package/node_modules/@instantdb/core/dist/esm/helperTypes.js +1 -0
  79. package/node_modules/@instantdb/core/dist/esm/index.d.ts +597 -0
  80. package/node_modules/@instantdb/core/dist/esm/index.js +649 -0
  81. package/node_modules/@instantdb/core/dist/esm/infiniteQuery.d.ts +25 -0
  82. package/node_modules/@instantdb/core/dist/esm/infiniteQuery.js +430 -0
  83. package/node_modules/@instantdb/core/dist/esm/instaml.d.ts +17 -0
  84. package/node_modules/@instantdb/core/dist/esm/instaml.js +576 -0
  85. package/node_modules/@instantdb/core/dist/esm/instaql.d.ts +12 -0
  86. package/node_modules/@instantdb/core/dist/esm/instaql.js +632 -0
  87. package/node_modules/@instantdb/core/dist/esm/instatx.d.ts +127 -0
  88. package/node_modules/@instantdb/core/dist/esm/instatx.js +93 -0
  89. package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.d.ts +7 -0
  90. package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.js +24 -0
  91. package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.d.ts +2 -0
  92. package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.js +142 -0
  93. package/node_modules/@instantdb/core/dist/esm/presence.d.ts +50 -0
  94. package/node_modules/@instantdb/core/dist/esm/presence.js +50 -0
  95. package/node_modules/@instantdb/core/dist/esm/presenceTypes.d.ts +9 -0
  96. package/node_modules/@instantdb/core/dist/esm/presenceTypes.js +3 -0
  97. package/node_modules/@instantdb/core/dist/esm/queryTypes.d.ts +271 -0
  98. package/node_modules/@instantdb/core/dist/esm/queryTypes.js +3 -0
  99. package/node_modules/@instantdb/core/dist/esm/queryValidation.d.ts +5 -0
  100. package/node_modules/@instantdb/core/dist/esm/queryValidation.js +287 -0
  101. package/node_modules/@instantdb/core/dist/esm/reactorTypes.d.ts +29 -0
  102. package/node_modules/@instantdb/core/dist/esm/reactorTypes.js +1 -0
  103. package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.d.ts +19 -0
  104. package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.js +1 -0
  105. package/node_modules/@instantdb/core/dist/esm/rulesTypes.d.ts +85 -0
  106. package/node_modules/@instantdb/core/dist/esm/rulesTypes.js +1 -0
  107. package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.d.ts +18 -0
  108. package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.js +152 -0
  109. package/node_modules/@instantdb/core/dist/esm/schema.d.ts +72 -0
  110. package/node_modules/@instantdb/core/dist/esm/schema.js +128 -0
  111. package/node_modules/@instantdb/core/dist/esm/schemaTypes.d.ts +244 -0
  112. package/node_modules/@instantdb/core/dist/esm/schemaTypes.js +106 -0
  113. package/node_modules/@instantdb/core/dist/esm/store.d.ts +89 -0
  114. package/node_modules/@instantdb/core/dist/esm/store.js +722 -0
  115. package/node_modules/@instantdb/core/dist/esm/transactionValidation.d.ts +7 -0
  116. package/node_modules/@instantdb/core/dist/esm/transactionValidation.js +130 -0
  117. package/node_modules/@instantdb/core/dist/esm/utils/Deferred.d.ts +8 -0
  118. package/node_modules/@instantdb/core/dist/esm/utils/Deferred.js +17 -0
  119. package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.d.ts +80 -0
  120. package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.js +448 -0
  121. package/node_modules/@instantdb/core/dist/esm/utils/dates.d.ts +1 -0
  122. package/node_modules/@instantdb/core/dist/esm/utils/dates.js +211 -0
  123. package/node_modules/@instantdb/core/dist/esm/utils/error.d.ts +2 -0
  124. package/node_modules/@instantdb/core/dist/esm/utils/error.js +8 -0
  125. package/node_modules/@instantdb/core/dist/esm/utils/fetch.d.ts +125 -0
  126. package/node_modules/@instantdb/core/dist/esm/utils/fetch.js +31 -0
  127. package/node_modules/@instantdb/core/dist/esm/utils/flags.d.ts +4 -0
  128. package/node_modules/@instantdb/core/dist/esm/utils/flags.js +10 -0
  129. package/node_modules/@instantdb/core/dist/esm/utils/id.d.ts +3 -0
  130. package/node_modules/@instantdb/core/dist/esm/utils/id.js +25 -0
  131. package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.d.ts +7 -0
  132. package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.js +17 -0
  133. package/node_modules/@instantdb/core/dist/esm/utils/log.d.ts +6 -0
  134. package/node_modules/@instantdb/core/dist/esm/utils/log.js +13 -0
  135. package/node_modules/@instantdb/core/dist/esm/utils/object.d.ts +16 -0
  136. package/node_modules/@instantdb/core/dist/esm/utils/object.js +143 -0
  137. package/node_modules/@instantdb/core/dist/esm/utils/pgtime.d.ts +197 -0
  138. package/node_modules/@instantdb/core/dist/esm/utils/pgtime.js +197 -0
  139. package/node_modules/@instantdb/core/dist/esm/utils/pick.d.ts +1 -0
  140. package/node_modules/@instantdb/core/dist/esm/utils/pick.js +9 -0
  141. package/node_modules/@instantdb/core/dist/esm/utils/strings.d.ts +1 -0
  142. package/node_modules/@instantdb/core/dist/esm/utils/strings.js +15 -0
  143. package/node_modules/@instantdb/core/dist/esm/utils/weakHash.d.ts +15 -0
  144. package/node_modules/@instantdb/core/dist/esm/utils/weakHash.js +71 -0
  145. package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.d.ts +7 -0
  146. package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.js +72 -0
  147. package/node_modules/@instantdb/core/dist/esm/version.d.ts +2 -0
  148. package/node_modules/@instantdb/core/dist/esm/version.js +2 -0
  149. package/node_modules/@instantdb/core/dist/esm/warningToggle.d.ts +2 -0
  150. package/node_modules/@instantdb/core/dist/esm/warningToggle.js +4 -0
  151. package/node_modules/@instantdb/core/package.json +20 -0
  152. package/node_modules/@instantdb/eventsource/LICENSE +22 -0
  153. package/node_modules/@instantdb/eventsource/README.md +226 -0
  154. package/node_modules/@instantdb/eventsource/dist/index.cjs +279 -0
  155. package/node_modules/@instantdb/eventsource/dist/index.cjs.map +1 -0
  156. package/node_modules/@instantdb/eventsource/dist/index.d.cts +346 -0
  157. package/node_modules/@instantdb/eventsource/dist/index.d.ts +346 -0
  158. package/node_modules/@instantdb/eventsource/dist/index.js +279 -0
  159. package/node_modules/@instantdb/eventsource/dist/index.js.map +1 -0
  160. package/node_modules/@instantdb/eventsource/package.json +128 -0
  161. package/node_modules/@instantdb/eventsource/src/EventSource.ts +614 -0
  162. package/node_modules/@instantdb/eventsource/src/errors.ts +141 -0
  163. package/node_modules/@instantdb/eventsource/src/index.ts +3 -0
  164. package/node_modules/@instantdb/eventsource/src/types.ts +164 -0
  165. package/node_modules/@instantdb/react/LICENSE +202 -0
  166. package/node_modules/@instantdb/react/dist/esm/Cursors.d.ts +18 -0
  167. package/node_modules/@instantdb/react/dist/esm/Cursors.js +103 -0
  168. package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.d.ts +5 -0
  169. package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.js +5 -0
  170. package/node_modules/@instantdb/react/dist/esm/index.d.ts +6 -0
  171. package/node_modules/@instantdb/react/dist/esm/index.js +22 -0
  172. package/node_modules/@instantdb/react/dist/esm/init.d.ts +40 -0
  173. package/node_modules/@instantdb/react/dist/esm/init.js +49 -0
  174. package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.d.ts +65 -0
  175. package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.js +96 -0
  176. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.d.ts +11 -0
  177. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.js +31 -0
  178. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +24 -0
  179. package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.js +162 -0
  180. package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.d.ts +9 -0
  181. package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.js +16 -0
  182. package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.d.ts +2 -0
  183. package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.js +20 -0
  184. package/node_modules/@instantdb/react/dist/esm/next-ssr/index.d.ts +29 -0
  185. package/node_modules/@instantdb/react/dist/esm/next-ssr/index.js +34 -0
  186. package/node_modules/@instantdb/react/dist/esm/version.d.ts +2 -0
  187. package/node_modules/@instantdb/react/dist/esm/version.js +2 -0
  188. package/node_modules/@instantdb/react/package.json +24 -0
  189. package/node_modules/@instantdb/react-common/LICENSE +202 -0
  190. package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.d.ts +282 -0
  191. package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.js +386 -0
  192. package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.d.ts +182 -0
  193. package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.js +280 -0
  194. package/node_modules/@instantdb/react-common/dist/esm/index.d.ts +4 -0
  195. package/node_modules/@instantdb/react-common/dist/esm/index.js +3 -0
  196. package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.d.ts +27 -0
  197. package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.js +53 -0
  198. package/node_modules/@instantdb/react-common/dist/esm/useQuery.d.ts +6 -0
  199. package/node_modules/@instantdb/react-common/dist/esm/useQuery.js +75 -0
  200. package/node_modules/@instantdb/react-common/dist/esm/useTimeout.d.ts +4 -0
  201. package/node_modules/@instantdb/react-common/dist/esm/useTimeout.js +17 -0
  202. package/node_modules/@instantdb/react-common/dist/esm/version.d.ts +2 -0
  203. package/node_modules/@instantdb/react-common/dist/esm/version.js +2 -0
  204. package/node_modules/@instantdb/react-common/package.json +22 -0
  205. package/node_modules/@instantdb/version/LICENSE +202 -0
  206. package/node_modules/@instantdb/version/dist/esm/index.d.ts +2 -0
  207. package/node_modules/@instantdb/version/dist/esm/index.js +2 -0
  208. package/node_modules/@instantdb/version/dist/esm/version.d.ts +2 -0
  209. package/node_modules/@instantdb/version/dist/esm/version.js +5 -0
  210. package/node_modules/@instantdb/version/package.json +16 -0
  211. package/node_modules/@instantdb/webhooks/LICENSE +202 -0
  212. package/node_modules/@instantdb/webhooks/dist/esm/index.d.ts +587 -0
  213. package/node_modules/@instantdb/webhooks/dist/esm/index.js +748 -0
  214. package/node_modules/@instantdb/webhooks/package.json +18 -0
  215. package/node_modules/cookie/LICENSE +24 -0
  216. package/node_modules/cookie/README.md +295 -0
  217. package/node_modules/cookie/dist/index.d.ts +143 -0
  218. package/node_modules/cookie/dist/index.js +355 -0
  219. package/node_modules/cookie/dist/index.js.map +1 -0
  220. package/node_modules/cookie/package.json +57 -0
  221. package/node_modules/eventsource/LICENSE +22 -0
  222. package/node_modules/eventsource/README.md +252 -0
  223. package/node_modules/eventsource/dist/EventSource.d.ts +128 -0
  224. package/node_modules/eventsource/dist/EventSource.d.ts.map +1 -0
  225. package/node_modules/eventsource/dist/EventSource.js +556 -0
  226. package/node_modules/eventsource/dist/EventSource.js.map +1 -0
  227. package/node_modules/eventsource/dist/errors.d.ts +53 -0
  228. package/node_modules/eventsource/dist/errors.d.ts.map +1 -0
  229. package/node_modules/eventsource/dist/errors.js +120 -0
  230. package/node_modules/eventsource/dist/errors.js.map +1 -0
  231. package/node_modules/eventsource/dist/index.d.ts +4 -0
  232. package/node_modules/eventsource/dist/index.d.ts.map +1 -0
  233. package/node_modules/eventsource/dist/index.js +3 -0
  234. package/node_modules/eventsource/dist/index.js.map +1 -0
  235. package/node_modules/eventsource/dist/types.d.ts +156 -0
  236. package/node_modules/eventsource/dist/types.d.ts.map +1 -0
  237. package/node_modules/eventsource/dist/types.js +2 -0
  238. package/node_modules/eventsource/dist/types.js.map +1 -0
  239. package/node_modules/eventsource/node_modules/eventsource-parser/LICENSE +21 -0
  240. package/node_modules/eventsource/node_modules/eventsource-parser/README.md +177 -0
  241. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts +35 -0
  242. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts.map +1 -0
  243. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js +16 -0
  244. package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js.map +1 -0
  245. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts +4 -0
  246. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts.map +1 -0
  247. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js +3 -0
  248. package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js.map +1 -0
  249. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts +12 -0
  250. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts.map +1 -0
  251. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js +509 -0
  252. package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js.map +1 -0
  253. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts +76 -0
  254. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts.map +1 -0
  255. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js +59 -0
  256. package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  257. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts +130 -0
  258. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts.map +1 -0
  259. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js +1 -0
  260. package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js.map +1 -0
  261. package/node_modules/eventsource/node_modules/eventsource-parser/package.json +96 -0
  262. package/node_modules/eventsource/node_modules/eventsource-parser/src/errors.ts +44 -0
  263. package/node_modules/eventsource/node_modules/eventsource-parser/src/index.ts +3 -0
  264. package/node_modules/eventsource/node_modules/eventsource-parser/src/parse.ts +576 -0
  265. package/node_modules/eventsource/node_modules/eventsource-parser/src/stream.ts +118 -0
  266. package/node_modules/eventsource/node_modules/eventsource-parser/src/types.ts +138 -0
  267. package/node_modules/eventsource/package.json +103 -0
  268. package/node_modules/eventsource/src/EventSource.ts +844 -0
  269. package/node_modules/eventsource/src/errors.ts +141 -0
  270. package/node_modules/eventsource/src/index.ts +3 -0
  271. package/node_modules/eventsource/src/types.ts +166 -0
  272. package/node_modules/eventsource-parser/LICENSE +21 -0
  273. package/node_modules/eventsource-parser/README.md +157 -0
  274. package/node_modules/eventsource-parser/dist/index.cjs +177 -0
  275. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -0
  276. package/node_modules/eventsource-parser/dist/index.d.cts +169 -0
  277. package/node_modules/eventsource-parser/dist/index.d.ts +169 -0
  278. package/node_modules/eventsource-parser/dist/index.js +177 -0
  279. package/node_modules/eventsource-parser/dist/index.js.map +1 -0
  280. package/node_modules/eventsource-parser/dist/stream.cjs +29 -0
  281. package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -0
  282. package/node_modules/eventsource-parser/dist/stream.d.cts +134 -0
  283. package/node_modules/eventsource-parser/dist/stream.d.ts +134 -0
  284. package/node_modules/eventsource-parser/dist/stream.js +30 -0
  285. package/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  286. package/node_modules/eventsource-parser/package.json +92 -0
  287. package/node_modules/eventsource-parser/src/errors.ts +44 -0
  288. package/node_modules/eventsource-parser/src/index.ts +8 -0
  289. package/node_modules/eventsource-parser/src/parse.ts +439 -0
  290. package/node_modules/eventsource-parser/src/stream.ts +107 -0
  291. package/node_modules/eventsource-parser/src/types.ts +122 -0
  292. package/node_modules/eventsource-parser/stream.js +2 -0
  293. package/node_modules/mutative/LICENSE +21 -0
  294. package/node_modules/mutative/README.md +870 -0
  295. package/node_modules/mutative/dist/apply.d.ts +31 -0
  296. package/node_modules/mutative/dist/array.d.ts +45 -0
  297. package/node_modules/mutative/dist/constant.d.ts +8 -0
  298. package/node_modules/mutative/dist/create.d.ts +46 -0
  299. package/node_modules/mutative/dist/current.d.ts +23 -0
  300. package/node_modules/mutative/dist/draft.d.ts +3 -0
  301. package/node_modules/mutative/dist/draftify.d.ts +2 -0
  302. package/node_modules/mutative/dist/error.d.ts +54 -0
  303. package/node_modules/mutative/dist/index.d.mts +1 -0
  304. package/node_modules/mutative/dist/index.d.ts +12 -0
  305. package/node_modules/mutative/dist/index.js +8 -0
  306. package/node_modules/mutative/dist/index.mjs +3 -0
  307. package/node_modules/mutative/dist/interface.d.ts +200 -0
  308. package/node_modules/mutative/dist/internal.d.ts +4 -0
  309. package/node_modules/mutative/dist/makeCreator.d.ts +54 -0
  310. package/node_modules/mutative/dist/map.d.ts +15 -0
  311. package/node_modules/mutative/dist/mutative.cjs.development.js +2126 -0
  312. package/node_modules/mutative/dist/mutative.cjs.development.js.map +1 -0
  313. package/node_modules/mutative/dist/mutative.cjs.production.min.js +2 -0
  314. package/node_modules/mutative/dist/mutative.cjs.production.min.js.map +1 -0
  315. package/node_modules/mutative/dist/mutative.esm.js +2123 -0
  316. package/node_modules/mutative/dist/mutative.esm.js.map +1 -0
  317. package/node_modules/mutative/dist/mutative.esm.mjs +2123 -0
  318. package/node_modules/mutative/dist/mutative.esm.mjs.map +1 -0
  319. package/node_modules/mutative/dist/mutative.esm.production.min.mjs +2 -0
  320. package/node_modules/mutative/dist/mutative.esm.production.min.mjs.map +1 -0
  321. package/node_modules/mutative/dist/mutative.umd.development.js +2132 -0
  322. package/node_modules/mutative/dist/mutative.umd.development.js.map +1 -0
  323. package/node_modules/mutative/dist/mutative.umd.production.min.js +2 -0
  324. package/node_modules/mutative/dist/mutative.umd.production.min.js.map +1 -0
  325. package/node_modules/mutative/dist/original.d.ts +19 -0
  326. package/node_modules/mutative/dist/patch.d.ts +2 -0
  327. package/node_modules/mutative/dist/rawReturn.d.ts +19 -0
  328. package/node_modules/mutative/dist/set.d.ts +14 -0
  329. package/node_modules/mutative/dist/unsafe.d.ts +34 -0
  330. package/node_modules/mutative/dist/utils/cast.d.ts +13 -0
  331. package/node_modules/mutative/dist/utils/copy.d.ts +5 -0
  332. package/node_modules/mutative/dist/utils/deepFreeze.d.ts +1 -0
  333. package/node_modules/mutative/dist/utils/draft.d.ts +27 -0
  334. package/node_modules/mutative/dist/utils/finalize.d.ts +13 -0
  335. package/node_modules/mutative/dist/utils/forEach.d.ts +1 -0
  336. package/node_modules/mutative/dist/utils/index.d.ts +7 -0
  337. package/node_modules/mutative/dist/utils/mark.d.ts +2 -0
  338. package/node_modules/mutative/dist/utils/marker.d.ts +5 -0
  339. package/node_modules/mutative/dist/utils/proto.d.ts +10 -0
  340. package/node_modules/mutative/package.json +142 -0
  341. package/node_modules/mutative/src/apply.ts +239 -0
  342. package/node_modules/mutative/src/array.ts +679 -0
  343. package/node_modules/mutative/src/constant.ts +17 -0
  344. package/node_modules/mutative/src/create.ts +27 -0
  345. package/node_modules/mutative/src/current.ts +206 -0
  346. package/node_modules/mutative/src/draft.ts +489 -0
  347. package/node_modules/mutative/src/draftify.ts +57 -0
  348. package/node_modules/mutative/src/error.ts +129 -0
  349. package/node_modules/mutative/src/index.ts +21 -0
  350. package/node_modules/mutative/src/interface.ts +321 -0
  351. package/node_modules/mutative/src/internal.ts +5 -0
  352. package/node_modules/mutative/src/makeCreator.ts +382 -0
  353. package/node_modules/mutative/src/map.ts +160 -0
  354. package/node_modules/mutative/src/original.ts +28 -0
  355. package/node_modules/mutative/src/patch.ts +386 -0
  356. package/node_modules/mutative/src/rawReturn.ts +41 -0
  357. package/node_modules/mutative/src/set.ts +201 -0
  358. package/node_modules/mutative/src/unsafe.ts +66 -0
  359. package/node_modules/mutative/src/utils/cast.ts +22 -0
  360. package/node_modules/mutative/src/utils/copy.ts +224 -0
  361. package/node_modules/mutative/src/utils/deepFreeze.ts +103 -0
  362. package/node_modules/mutative/src/utils/draft.ts +189 -0
  363. package/node_modules/mutative/src/utils/finalize.ts +232 -0
  364. package/node_modules/mutative/src/utils/forEach.ts +24 -0
  365. package/node_modules/mutative/src/utils/index.ts +7 -0
  366. package/node_modules/mutative/src/utils/mark.ts +11 -0
  367. package/node_modules/mutative/src/utils/marker.ts +34 -0
  368. package/node_modules/mutative/src/utils/proto.ts +38 -0
  369. package/node_modules/uuid/LICENSE.md +9 -0
  370. package/node_modules/uuid/README.md +491 -0
  371. package/node_modules/uuid/dist/index.d.ts +15 -0
  372. package/node_modules/uuid/dist/index.js +14 -0
  373. package/node_modules/uuid/dist/max.d.ts +2 -0
  374. package/node_modules/uuid/dist/max.js +1 -0
  375. package/node_modules/uuid/dist/md5.d.ts +2 -0
  376. package/node_modules/uuid/dist/md5.js +135 -0
  377. package/node_modules/uuid/dist/nil.d.ts +2 -0
  378. package/node_modules/uuid/dist/nil.js +1 -0
  379. package/node_modules/uuid/dist/parse.d.ts +3 -0
  380. package/node_modules/uuid/dist/parse.js +9 -0
  381. package/node_modules/uuid/dist/regex.d.ts +2 -0
  382. package/node_modules/uuid/dist/regex.js +1 -0
  383. package/node_modules/uuid/dist/rng.d.ts +1 -0
  384. package/node_modules/uuid/dist/rng.js +4 -0
  385. package/node_modules/uuid/dist/sha1.d.ts +2 -0
  386. package/node_modules/uuid/dist/sha1.js +70 -0
  387. package/node_modules/uuid/dist/stringify.d.ts +3 -0
  388. package/node_modules/uuid/dist/stringify.js +35 -0
  389. package/node_modules/uuid/dist/types.d.ts +22 -0
  390. package/node_modules/uuid/dist/types.js +1 -0
  391. package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
  392. package/node_modules/uuid/dist/uuid-bin.js +70 -0
  393. package/node_modules/uuid/dist/v1.d.ts +11 -0
  394. package/node_modules/uuid/dist/v1.js +87 -0
  395. package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
  396. package/node_modules/uuid/dist/v1ToV6.js +10 -0
  397. package/node_modules/uuid/dist/v3.d.ts +9 -0
  398. package/node_modules/uuid/dist/v3.js +9 -0
  399. package/node_modules/uuid/dist/v35.d.ts +7 -0
  400. package/node_modules/uuid/dist/v35.js +39 -0
  401. package/node_modules/uuid/dist/v4.d.ts +4 -0
  402. package/node_modules/uuid/dist/v4.js +29 -0
  403. package/node_modules/uuid/dist/v5.d.ts +9 -0
  404. package/node_modules/uuid/dist/v5.js +9 -0
  405. package/node_modules/uuid/dist/v6.d.ts +4 -0
  406. package/node_modules/uuid/dist/v6.js +20 -0
  407. package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
  408. package/node_modules/uuid/dist/v6ToV1.js +10 -0
  409. package/node_modules/uuid/dist/v7.d.ts +9 -0
  410. package/node_modules/uuid/dist/v7.js +68 -0
  411. package/node_modules/uuid/dist/validate.d.ts +2 -0
  412. package/node_modules/uuid/dist/validate.js +5 -0
  413. package/node_modules/uuid/dist/version.d.ts +2 -0
  414. package/node_modules/uuid/dist/version.js +8 -0
  415. package/node_modules/uuid/dist-node/bin/uuid +2 -0
  416. package/node_modules/uuid/dist-node/index.js +14 -0
  417. package/node_modules/uuid/dist-node/max.js +1 -0
  418. package/node_modules/uuid/dist-node/md5.js +11 -0
  419. package/node_modules/uuid/dist-node/nil.js +1 -0
  420. package/node_modules/uuid/dist-node/parse.js +9 -0
  421. package/node_modules/uuid/dist-node/regex.js +1 -0
  422. package/node_modules/uuid/dist-node/rng.js +4 -0
  423. package/node_modules/uuid/dist-node/sha1.js +11 -0
  424. package/node_modules/uuid/dist-node/stringify.js +35 -0
  425. package/node_modules/uuid/dist-node/types.js +1 -0
  426. package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
  427. package/node_modules/uuid/dist-node/v1.js +87 -0
  428. package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
  429. package/node_modules/uuid/dist-node/v3.js +9 -0
  430. package/node_modules/uuid/dist-node/v35.js +39 -0
  431. package/node_modules/uuid/dist-node/v4.js +29 -0
  432. package/node_modules/uuid/dist-node/v5.js +9 -0
  433. package/node_modules/uuid/dist-node/v6.js +20 -0
  434. package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
  435. package/node_modules/uuid/dist-node/v7.js +68 -0
  436. package/node_modules/uuid/dist-node/validate.js +5 -0
  437. package/node_modules/uuid/dist-node/version.js +8 -0
  438. package/node_modules/uuid/package.json +115 -0
  439. package/package.json +80 -4
  440. package/release.json +78 -0
@@ -0,0 +1,2 @@
1
+ declare const _default: RegExp;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
@@ -0,0 +1 @@
1
+ export default function rng(): Uint8Array;
@@ -0,0 +1,4 @@
1
+ const rnds8 = new Uint8Array(16);
2
+ export default function rng() {
3
+ return crypto.getRandomValues(rnds8);
4
+ }
@@ -0,0 +1,2 @@
1
+ declare function sha1(bytes: Uint8Array): Uint8Array;
2
+ export default sha1;
@@ -0,0 +1,70 @@
1
+ function f(s, x, y, z) {
2
+ switch (s) {
3
+ case 0:
4
+ return (x & y) ^ (~x & z);
5
+ case 1:
6
+ return x ^ y ^ z;
7
+ case 2:
8
+ return (x & y) ^ (x & z) ^ (y & z);
9
+ case 3:
10
+ return x ^ y ^ z;
11
+ }
12
+ }
13
+ function ROTL(x, n) {
14
+ return (x << n) | (x >>> (32 - n));
15
+ }
16
+ function sha1(bytes) {
17
+ const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
18
+ const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
19
+ const newBytes = new Uint8Array(bytes.length + 1);
20
+ newBytes.set(bytes);
21
+ newBytes[bytes.length] = 0x80;
22
+ bytes = newBytes;
23
+ const l = bytes.length / 4 + 2;
24
+ const N = Math.ceil(l / 16);
25
+ const M = new Array(N);
26
+ for (let i = 0; i < N; ++i) {
27
+ const arr = new Uint32Array(16);
28
+ for (let j = 0; j < 16; ++j) {
29
+ arr[j] =
30
+ (bytes[i * 64 + j * 4] << 24) |
31
+ (bytes[i * 64 + j * 4 + 1] << 16) |
32
+ (bytes[i * 64 + j * 4 + 2] << 8) |
33
+ bytes[i * 64 + j * 4 + 3];
34
+ }
35
+ M[i] = arr;
36
+ }
37
+ M[N - 1][14] = ((bytes.length - 1) * 8) / 2 ** 32;
38
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
39
+ M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;
40
+ for (let i = 0; i < N; ++i) {
41
+ const W = new Uint32Array(80);
42
+ for (let t = 0; t < 16; ++t) {
43
+ W[t] = M[i][t];
44
+ }
45
+ for (let t = 16; t < 80; ++t) {
46
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
47
+ }
48
+ let a = H[0];
49
+ let b = H[1];
50
+ let c = H[2];
51
+ let d = H[3];
52
+ let e = H[4];
53
+ for (let t = 0; t < 80; ++t) {
54
+ const s = Math.floor(t / 20);
55
+ const T = (ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t]) >>> 0;
56
+ e = d;
57
+ d = c;
58
+ c = ROTL(b, 30) >>> 0;
59
+ b = a;
60
+ a = T;
61
+ }
62
+ H[0] = (H[0] + a) >>> 0;
63
+ H[1] = (H[1] + b) >>> 0;
64
+ H[2] = (H[2] + c) >>> 0;
65
+ H[3] = (H[3] + d) >>> 0;
66
+ H[4] = (H[4] + e) >>> 0;
67
+ }
68
+ return Uint8Array.of(H[0] >> 24, H[0] >> 16, H[0] >> 8, H[0], H[1] >> 24, H[1] >> 16, H[1] >> 8, H[1], H[2] >> 24, H[2] >> 16, H[2] >> 8, H[2], H[3] >> 24, H[3] >> 16, H[3] >> 8, H[3], H[4] >> 24, H[4] >> 16, H[4] >> 8, H[4]);
69
+ }
70
+ export default sha1;
@@ -0,0 +1,3 @@
1
+ export declare function unsafeStringify(arr: Uint8Array, offset?: number): string;
2
+ declare function stringify(arr: Uint8Array, offset?: number): string;
3
+ export default stringify;
@@ -0,0 +1,35 @@
1
+ import validate from './validate.js';
2
+ const byteToHex = [];
3
+ for (let i = 0; i < 256; ++i) {
4
+ byteToHex.push((i + 0x100).toString(16).slice(1));
5
+ }
6
+ export function unsafeStringify(arr, offset = 0) {
7
+ return (byteToHex[arr[offset + 0]] +
8
+ byteToHex[arr[offset + 1]] +
9
+ byteToHex[arr[offset + 2]] +
10
+ byteToHex[arr[offset + 3]] +
11
+ '-' +
12
+ byteToHex[arr[offset + 4]] +
13
+ byteToHex[arr[offset + 5]] +
14
+ '-' +
15
+ byteToHex[arr[offset + 6]] +
16
+ byteToHex[arr[offset + 7]] +
17
+ '-' +
18
+ byteToHex[arr[offset + 8]] +
19
+ byteToHex[arr[offset + 9]] +
20
+ '-' +
21
+ byteToHex[arr[offset + 10]] +
22
+ byteToHex[arr[offset + 11]] +
23
+ byteToHex[arr[offset + 12]] +
24
+ byteToHex[arr[offset + 13]] +
25
+ byteToHex[arr[offset + 14]] +
26
+ byteToHex[arr[offset + 15]]).toLowerCase();
27
+ }
28
+ function stringify(arr, offset = 0) {
29
+ const uuid = unsafeStringify(arr, offset);
30
+ if (!validate(uuid)) {
31
+ throw TypeError('Stringified UUID is invalid');
32
+ }
33
+ return uuid;
34
+ }
35
+ export default stringify;
@@ -0,0 +1,22 @@
1
+ export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
2
+ export type Version1Options = {
3
+ node?: Uint8Array;
4
+ clockseq?: number;
5
+ random?: Uint8Array;
6
+ rng?: () => Uint8Array;
7
+ msecs?: number;
8
+ nsecs?: number;
9
+ _v6?: boolean;
10
+ };
11
+ export type Version4Options = {
12
+ random?: Uint8Array;
13
+ rng?: () => Uint8Array;
14
+ };
15
+ export type Version6Options = Version1Options;
16
+ export type Version7Options = {
17
+ random?: Uint8Array;
18
+ msecs?: number;
19
+ seq?: number;
20
+ rng?: () => Uint8Array;
21
+ };
22
+ export type NonSharedArrayBuffer = ReturnType<typeof Uint8Array.of>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ import * as assert from 'node:assert/strict';
2
+ import v1 from './v1.js';
3
+ import v3 from './v3.js';
4
+ import v4 from './v4.js';
5
+ import v5 from './v5.js';
6
+ import v6 from './v6.js';
7
+ import v7 from './v7.js';
8
+ function usage() {
9
+ console.log('Usage:');
10
+ console.log(' uuid');
11
+ console.log(' uuid v1');
12
+ console.log(' uuid v3 <name> <namespace uuid>');
13
+ console.log(' uuid v4');
14
+ console.log(' uuid v5 <name> <namespace uuid>');
15
+ console.log(' uuid v6');
16
+ console.log(' uuid v7');
17
+ console.log(' uuid --help');
18
+ console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC9562');
19
+ }
20
+ const args = process.argv.slice(2);
21
+ if (args.indexOf('--help') >= 0) {
22
+ usage();
23
+ process.exit(0);
24
+ }
25
+ const version = args.shift() || 'v4';
26
+ switch (version) {
27
+ case 'v1':
28
+ console.log(v1());
29
+ break;
30
+ case 'v3': {
31
+ const name = args.shift();
32
+ let namespace = args.shift();
33
+ assert.ok(name != null, 'v3 name not specified');
34
+ assert.ok(namespace != null, 'v3 namespace not specified');
35
+ if (namespace === 'URL') {
36
+ namespace = v3.URL;
37
+ }
38
+ if (namespace === 'DNS') {
39
+ namespace = v3.DNS;
40
+ }
41
+ console.log(v3(name, namespace));
42
+ break;
43
+ }
44
+ case 'v4':
45
+ console.log(v4());
46
+ break;
47
+ case 'v5': {
48
+ const name = args.shift();
49
+ let namespace = args.shift();
50
+ assert.ok(name != null, 'v5 name not specified');
51
+ assert.ok(namespace != null, 'v5 namespace not specified');
52
+ if (namespace === 'URL') {
53
+ namespace = v5.URL;
54
+ }
55
+ if (namespace === 'DNS') {
56
+ namespace = v5.DNS;
57
+ }
58
+ console.log(v5(name, namespace));
59
+ break;
60
+ }
61
+ case 'v6':
62
+ console.log(v6());
63
+ break;
64
+ case 'v7':
65
+ console.log(v7());
66
+ break;
67
+ default:
68
+ usage();
69
+ process.exit(1);
70
+ }
@@ -0,0 +1,11 @@
1
+ import type { Version1Options } from './types.js';
2
+ type V1State = {
3
+ node?: Uint8Array;
4
+ clockseq?: number;
5
+ msecs?: number;
6
+ nsecs?: number;
7
+ };
8
+ declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
9
+ declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
10
+ export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
11
+ export default v1;
@@ -0,0 +1,87 @@
1
+ import rng from './rng.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ const _state = {};
4
+ function v1(options, buf, offset) {
5
+ let bytes;
6
+ const isV6 = options?._v6 ?? false;
7
+ if (options) {
8
+ const optionsKeys = Object.keys(options);
9
+ if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {
10
+ options = undefined;
11
+ }
12
+ }
13
+ if (options) {
14
+ bytes = v1Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
15
+ }
16
+ else {
17
+ const now = Date.now();
18
+ const rnds = rng();
19
+ updateV1State(_state, now, rnds);
20
+ bytes = v1Bytes(rnds, _state.msecs, _state.nsecs, isV6 ? undefined : _state.clockseq, isV6 ? undefined : _state.node, buf, offset);
21
+ }
22
+ return buf ?? unsafeStringify(bytes);
23
+ }
24
+ export function updateV1State(state, now, rnds) {
25
+ state.msecs ??= -Infinity;
26
+ state.nsecs ??= 0;
27
+ if (now === state.msecs) {
28
+ state.nsecs++;
29
+ if (state.nsecs >= 10000) {
30
+ state.node = undefined;
31
+ state.nsecs = 0;
32
+ }
33
+ }
34
+ else if (now > state.msecs) {
35
+ state.nsecs = 0;
36
+ }
37
+ else if (now < state.msecs) {
38
+ state.node = undefined;
39
+ }
40
+ if (!state.node) {
41
+ state.node = rnds.slice(10, 16);
42
+ state.node[0] |= 0x01;
43
+ state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;
44
+ }
45
+ state.msecs = now;
46
+ return state;
47
+ }
48
+ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
49
+ if (rnds.length < 16) {
50
+ throw new Error('Random bytes length must be >= 16');
51
+ }
52
+ if (!buf) {
53
+ buf = new Uint8Array(16);
54
+ offset = 0;
55
+ }
56
+ else {
57
+ if (offset < 0 || offset + 16 > buf.length) {
58
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59
+ }
60
+ }
61
+ msecs ??= Date.now();
62
+ nsecs ??= 0;
63
+ clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
64
+ if (node == null) {
65
+ node = rnds.slice(10, 16);
66
+ node[0] |= 0x01;
67
+ }
68
+ msecs += 12219292800000;
69
+ const t = (msecs & 0xfffffff) * 10000 + nsecs;
70
+ const tl = t >>> 0;
71
+ buf[offset++] = (tl >>> 24) & 0xff;
72
+ buf[offset++] = (tl >>> 16) & 0xff;
73
+ buf[offset++] = (tl >>> 8) & 0xff;
74
+ buf[offset++] = tl & 0xff;
75
+ const tmh = (((msecs / 0x10000000) | 0) * 625 + ((t / 0x100000000) | 0)) & 0xfffffff;
76
+ buf[offset++] = (tmh >>> 8) & 0xff;
77
+ buf[offset++] = tmh & 0xff;
78
+ buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
79
+ buf[offset++] = (tmh >>> 16) & 0xff;
80
+ buf[offset++] = (clockseq >>> 8) | 0x80;
81
+ buf[offset++] = clockseq & 0xff;
82
+ for (let n = 0; n < 6; ++n) {
83
+ buf[offset++] = node[n];
84
+ }
85
+ return buf;
86
+ }
87
+ export default v1;
@@ -0,0 +1,3 @@
1
+ import type { NonSharedArrayBuffer } from './types.js';
2
+ export default function v1ToV6(uuid: string): string;
3
+ export default function v1ToV6(uuid: Uint8Array): NonSharedArrayBuffer;
@@ -0,0 +1,10 @@
1
+ import parse from './parse.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ export default function v1ToV6(uuid) {
4
+ const v1Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;
5
+ const v6Bytes = _v1ToV6(v1Bytes);
6
+ return typeof uuid === 'string' ? unsafeStringify(v6Bytes) : v6Bytes;
7
+ }
8
+ function _v1ToV6(v1Bytes) {
9
+ return Uint8Array.of(((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f), ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4), ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4), ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4), ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4), ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4), 0x60 | (v1Bytes[2] & 0x0f), v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { UUIDTypes } from './types.js';
2
+ export { DNS, URL } from './v35.js';
3
+ declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
4
+ declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
5
+ declare namespace v3 {
6
+ var DNS: string;
7
+ var URL: string;
8
+ }
9
+ export default v3;
@@ -0,0 +1,9 @@
1
+ import md5 from './md5.js';
2
+ import v35, { DNS, URL } from './v35.js';
3
+ export { DNS, URL } from './v35.js';
4
+ function v3(value, namespace, buf, offset) {
5
+ return v35(0x30, md5, value, namespace, buf, offset);
6
+ }
7
+ v3.DNS = DNS;
8
+ v3.URL = URL;
9
+ export default v3;
@@ -0,0 +1,7 @@
1
+ import type { UUIDTypes } from './types.js';
2
+ export declare function stringToBytes(str: string): Uint8Array;
3
+ export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
4
+ export declare const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
5
+ type HashFunction = (bytes: Uint8Array) => Uint8Array;
6
+ export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
7
+ export {};
@@ -0,0 +1,39 @@
1
+ import parse from './parse.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ export function stringToBytes(str) {
4
+ str = unescape(encodeURIComponent(str));
5
+ const bytes = new Uint8Array(str.length);
6
+ for (let i = 0; i < str.length; ++i) {
7
+ bytes[i] = str.charCodeAt(i);
8
+ }
9
+ return bytes;
10
+ }
11
+ export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
12
+ export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
13
+ export default function v35(version, hash, value, namespace, buf, offset) {
14
+ const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;
15
+ const namespaceBytes = typeof namespace === 'string' ? parse(namespace) : namespace;
16
+ if (typeof namespace === 'string') {
17
+ namespace = parse(namespace);
18
+ }
19
+ if (namespace?.length !== 16) {
20
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
21
+ }
22
+ let bytes = new Uint8Array(16 + valueBytes.length);
23
+ bytes.set(namespaceBytes);
24
+ bytes.set(valueBytes, namespaceBytes.length);
25
+ bytes = hash(bytes);
26
+ bytes[6] = (bytes[6] & 0x0f) | version;
27
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
28
+ if (buf) {
29
+ offset ??= 0;
30
+ if (offset < 0 || offset + 16 > buf.length) {
31
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
32
+ }
33
+ for (let i = 0; i < 16; ++i) {
34
+ buf[offset + i] = bytes[i];
35
+ }
36
+ return buf;
37
+ }
38
+ return unsafeStringify(bytes);
39
+ }
@@ -0,0 +1,4 @@
1
+ import type { Version4Options } from './types.js';
2
+ declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
3
+ declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
4
+ export default v4;
@@ -0,0 +1,29 @@
1
+ import rng from './rng.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ function v4(options, buf, offset) {
4
+ if (!buf && !options && crypto.randomUUID) {
5
+ return crypto.randomUUID();
6
+ }
7
+ return _v4(options, buf, offset);
8
+ }
9
+ function _v4(options, buf, offset) {
10
+ options = options || {};
11
+ const rnds = options.random ?? options.rng?.() ?? rng();
12
+ if (rnds.length < 16) {
13
+ throw new Error('Random bytes length must be >= 16');
14
+ }
15
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
16
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
17
+ if (buf) {
18
+ offset = offset || 0;
19
+ if (offset < 0 || offset + 16 > buf.length) {
20
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
21
+ }
22
+ for (let i = 0; i < 16; ++i) {
23
+ buf[offset + i] = rnds[i];
24
+ }
25
+ return buf;
26
+ }
27
+ return unsafeStringify(rnds);
28
+ }
29
+ export default v4;
@@ -0,0 +1,9 @@
1
+ import type { UUIDTypes } from './types.js';
2
+ export { DNS, URL } from './v35.js';
3
+ declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
4
+ declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
5
+ declare namespace v5 {
6
+ var DNS: string;
7
+ var URL: string;
8
+ }
9
+ export default v5;
@@ -0,0 +1,9 @@
1
+ import sha1 from './sha1.js';
2
+ import v35, { DNS, URL } from './v35.js';
3
+ export { DNS, URL } from './v35.js';
4
+ function v5(value, namespace, buf, offset) {
5
+ return v35(0x50, sha1, value, namespace, buf, offset);
6
+ }
7
+ v5.DNS = DNS;
8
+ v5.URL = URL;
9
+ export default v5;
@@ -0,0 +1,4 @@
1
+ import type { Version6Options } from './types.js';
2
+ declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
3
+ declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
4
+ export default v6;
@@ -0,0 +1,20 @@
1
+ import { unsafeStringify } from './stringify.js';
2
+ import v1 from './v1.js';
3
+ import v1ToV6 from './v1ToV6.js';
4
+ function v6(options, buf, offset) {
5
+ options ??= {};
6
+ offset ??= 0;
7
+ let bytes = v1({ ...options, _v6: true }, new Uint8Array(16));
8
+ bytes = v1ToV6(bytes);
9
+ if (buf) {
10
+ if (offset < 0 || offset + 16 > buf.length) {
11
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
12
+ }
13
+ for (let i = 0; i < 16; i++) {
14
+ buf[offset + i] = bytes[i];
15
+ }
16
+ return buf;
17
+ }
18
+ return unsafeStringify(bytes);
19
+ }
20
+ export default v6;
@@ -0,0 +1,2 @@
1
+ export default function v6ToV1(uuid: string): string;
2
+ export default function v6ToV1(uuid: Uint8Array): Uint8Array;
@@ -0,0 +1,10 @@
1
+ import parse from './parse.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ export default function v6ToV1(uuid) {
4
+ const v6Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;
5
+ const v1Bytes = _v6ToV1(v6Bytes);
6
+ return typeof uuid === 'string' ? unsafeStringify(v1Bytes) : v1Bytes;
7
+ }
8
+ function _v6ToV1(v6Bytes) {
9
+ return Uint8Array.of(((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f), ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4), ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f), v6Bytes[7], ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4), ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4), 0x10 | ((v6Bytes[0] & 0xf0) >> 4), ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4), v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { Version7Options } from './types.js';
2
+ type V7State = {
3
+ msecs?: number;
4
+ seq?: number;
5
+ };
6
+ declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
7
+ declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
8
+ export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
9
+ export default v7;
@@ -0,0 +1,68 @@
1
+ import rng from './rng.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ const _state = {};
4
+ function v7(options, buf, offset) {
5
+ let bytes;
6
+ if (options) {
7
+ bytes = v7Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.seq, buf, offset);
8
+ }
9
+ else {
10
+ const now = Date.now();
11
+ const rnds = rng();
12
+ updateV7State(_state, now, rnds);
13
+ bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
14
+ }
15
+ return buf ?? unsafeStringify(bytes);
16
+ }
17
+ export function updateV7State(state, now, rnds) {
18
+ state.msecs ??= -Infinity;
19
+ state.seq ??= 0;
20
+ if (now > state.msecs) {
21
+ state.seq = v7Sequence(rnds);
22
+ state.msecs = now;
23
+ }
24
+ else {
25
+ state.seq = (state.seq + 1) | 0;
26
+ if (state.seq === 0) {
27
+ state.msecs++;
28
+ }
29
+ }
30
+ return state;
31
+ }
32
+ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
33
+ if (rnds.length < 16) {
34
+ throw new Error('Random bytes length must be >= 16');
35
+ }
36
+ if (!buf) {
37
+ buf = new Uint8Array(16);
38
+ offset = 0;
39
+ }
40
+ else {
41
+ if (offset < 0 || offset + 16 > buf.length) {
42
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
43
+ }
44
+ }
45
+ msecs ??= Date.now();
46
+ seq ??= v7Sequence(rnds);
47
+ buf[offset++] = (msecs / 0x10000000000) & 0xff;
48
+ buf[offset++] = (msecs / 0x100000000) & 0xff;
49
+ buf[offset++] = (msecs / 0x1000000) & 0xff;
50
+ buf[offset++] = (msecs / 0x10000) & 0xff;
51
+ buf[offset++] = (msecs / 0x100) & 0xff;
52
+ buf[offset++] = msecs & 0xff;
53
+ buf[offset++] = 0x70 | ((seq >>> 28) & 0x0f);
54
+ buf[offset++] = (seq >>> 20) & 0xff;
55
+ buf[offset++] = 0x80 | ((seq >>> 14) & 0x3f);
56
+ buf[offset++] = (seq >>> 6) & 0xff;
57
+ buf[offset++] = ((seq << 2) & 0xff) | (rnds[10] & 0x03);
58
+ buf[offset++] = rnds[11];
59
+ buf[offset++] = rnds[12];
60
+ buf[offset++] = rnds[13];
61
+ buf[offset++] = rnds[14];
62
+ buf[offset++] = rnds[15];
63
+ return buf;
64
+ }
65
+ function v7Sequence(rnds) {
66
+ return ((rnds[6] & 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
67
+ }
68
+ export default v7;
@@ -0,0 +1,2 @@
1
+ declare function validate(uuid: unknown): boolean;
2
+ export default validate;
@@ -0,0 +1,5 @@
1
+ import REGEX from './regex.js';
2
+ function validate(uuid) {
3
+ return typeof uuid === 'string' && REGEX.test(uuid);
4
+ }
5
+ export default validate;
@@ -0,0 +1,2 @@
1
+ declare function version(uuid: string): number;
2
+ export default version;
@@ -0,0 +1,8 @@
1
+ import validate from './validate.js';
2
+ function version(uuid) {
3
+ if (!validate(uuid)) {
4
+ throw TypeError('Invalid UUID');
5
+ }
6
+ return parseInt(uuid.slice(14, 15), 16);
7
+ }
8
+ export default version;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../uuid-bin.js';
@@ -0,0 +1,14 @@
1
+ export { default as MAX } from './max.js';
2
+ export { default as NIL } from './nil.js';
3
+ export { default as parse } from './parse.js';
4
+ export { default as stringify } from './stringify.js';
5
+ export { default as v1 } from './v1.js';
6
+ export { default as v1ToV6 } from './v1ToV6.js';
7
+ export { default as v3 } from './v3.js';
8
+ export { default as v4 } from './v4.js';
9
+ export { default as v5 } from './v5.js';
10
+ export { default as v6 } from './v6.js';
11
+ export { default as v6ToV1 } from './v6ToV1.js';
12
+ export { default as v7 } from './v7.js';
13
+ export { default as validate } from './validate.js';
14
+ export { default as version } from './version.js';
@@ -0,0 +1 @@
1
+ export default 'ffffffff-ffff-ffff-ffff-ffffffffffff';
@@ -0,0 +1,11 @@
1
+ import { createHash } from 'node:crypto';
2
+ function md5(bytes) {
3
+ if (Array.isArray(bytes)) {
4
+ bytes = Buffer.from(bytes);
5
+ }
6
+ else if (typeof bytes === 'string') {
7
+ bytes = Buffer.from(bytes, 'utf8');
8
+ }
9
+ return createHash('md5').update(bytes).digest();
10
+ }
11
+ export default md5;