@attocash/cli 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 (400) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +707 -0
  3. package/dist/application/app.d.ts +138 -0
  4. package/dist/application/app.js +654 -0
  5. package/dist/application/operations.d.ts +9 -0
  6. package/dist/application/operations.js +96 -0
  7. package/dist/cli/cli.d.ts +1 -0
  8. package/dist/cli/cli.js +460 -0
  9. package/dist/cli/help.d.ts +4 -0
  10. package/dist/cli/help.js +49 -0
  11. package/dist/cli/main.d.ts +2 -0
  12. package/dist/cli/main.js +13 -0
  13. package/dist/cli/onboarding.d.ts +14 -0
  14. package/dist/cli/onboarding.js +144 -0
  15. package/dist/cli/output.d.ts +2 -0
  16. package/dist/cli/output.js +231 -0
  17. package/dist/cli/terminal.d.ts +6 -0
  18. package/dist/cli/terminal.js +92 -0
  19. package/dist/cli/update-check.d.ts +1 -0
  20. package/dist/cli/update-check.js +12 -0
  21. package/dist/cli/updates.d.ts +2 -0
  22. package/dist/cli/updates.js +98 -0
  23. package/dist/core.d.ts +14 -0
  24. package/dist/core.js +14 -0
  25. package/dist/doctor/credential-probe.d.ts +7 -0
  26. package/dist/doctor/credential-probe.js +49 -0
  27. package/dist/doctor/doctor.d.ts +4 -0
  28. package/dist/doctor/doctor.js +213 -0
  29. package/dist/doctor/keyring.d.ts +7 -0
  30. package/dist/doctor/keyring.js +150 -0
  31. package/dist/doctor/profile.d.ts +19 -0
  32. package/dist/doctor/profile.js +73 -0
  33. package/dist/doctor/types.d.ts +40 -0
  34. package/dist/doctor/types.js +1 -0
  35. package/dist/domain/amount.d.ts +6 -0
  36. package/dist/domain/amount.js +27 -0
  37. package/dist/domain/errors.d.ts +10 -0
  38. package/dist/domain/errors.js +16 -0
  39. package/dist/labels/directory.d.ts +87 -0
  40. package/dist/labels/directory.js +140 -0
  41. package/dist/labels/personal.d.ts +17 -0
  42. package/dist/labels/personal.js +56 -0
  43. package/dist/labels/presentation.d.ts +154 -0
  44. package/dist/labels/presentation.js +90 -0
  45. package/dist/network/reader.d.ts +31 -0
  46. package/dist/network/reader.js +370 -0
  47. package/dist/network/retry.d.ts +7 -0
  48. package/dist/network/retry.js +53 -0
  49. package/dist/network/work.d.ts +3 -0
  50. package/dist/network/work.js +66 -0
  51. package/dist/pricing/market.d.ts +29 -0
  52. package/dist/pricing/market.js +150 -0
  53. package/dist/pricing/terms.d.ts +6 -0
  54. package/dist/pricing/terms.js +12 -0
  55. package/dist/spending/destination.d.ts +16 -0
  56. package/dist/spending/destination.js +42 -0
  57. package/dist/spending/journal.d.ts +28 -0
  58. package/dist/spending/journal.js +69 -0
  59. package/dist/spending/ledger.d.ts +118 -0
  60. package/dist/spending/ledger.js +444 -0
  61. package/dist/spending/payments.d.ts +67 -0
  62. package/dist/spending/payments.js +424 -0
  63. package/dist/spending/pool.d.ts +13 -0
  64. package/dist/spending/pool.js +38 -0
  65. package/dist/spending/reconcile.d.ts +18 -0
  66. package/dist/spending/reconcile.js +64 -0
  67. package/dist/storage/profiles.d.ts +13 -0
  68. package/dist/storage/profiles.js +86 -0
  69. package/dist/storage/secrets.d.ts +16 -0
  70. package/dist/storage/secrets.js +104 -0
  71. package/dist/storage/state.d.ts +32 -0
  72. package/dist/storage/state.js +255 -0
  73. package/dist/wallet/auto-receive.d.ts +57 -0
  74. package/dist/wallet/auto-receive.js +140 -0
  75. package/dist/wallet/defaults.d.ts +3 -0
  76. package/dist/wallet/defaults.js +26 -0
  77. package/dist/wallet/signing.d.ts +17 -0
  78. package/dist/wallet/signing.js +128 -0
  79. package/dist/wallet/types.d.ts +65 -0
  80. package/dist/wallet/types.js +1 -0
  81. package/dist/wallet/work.d.ts +29 -0
  82. package/dist/wallet/work.js +154 -0
  83. package/dist/watches/manager.d.ts +75 -0
  84. package/dist/watches/manager.js +197 -0
  85. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +6678 -0
  86. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
  87. package/node_modules/@attocash/commons-core/LICENSE +28 -0
  88. package/node_modules/@attocash/commons-core/README.md +118 -0
  89. package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +1036 -0
  90. package/node_modules/@attocash/commons-core/commons-commons-core.mjs +7701 -0
  91. package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -0
  92. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +17681 -0
  93. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -0
  94. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
  95. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
  96. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +209 -0
  97. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
  98. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +2284 -0
  99. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
  100. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +6042 -0
  101. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
  102. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  103. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  104. package/node_modules/@attocash/commons-core/package.json +27 -0
  105. package/node_modules/@attocash/commons-node/LICENSE +28 -0
  106. package/node_modules/@attocash/commons-node/README.md +92 -0
  107. package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +255 -0
  108. package/node_modules/@attocash/commons-node/commons-commons-node.mjs +2977 -0
  109. package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -0
  110. package/node_modules/@attocash/commons-node/kotlin-logging.mjs +432 -0
  111. package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -0
  112. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  113. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  114. package/node_modules/@attocash/commons-node/package.json +29 -0
  115. package/node_modules/@attocash/commons-node-remote/LICENSE +28 -0
  116. package/node_modules/@attocash/commons-node-remote/README.md +61 -0
  117. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +122 -0
  118. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +1810 -0
  119. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -0
  120. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +432 -0
  121. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -0
  122. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs +8 -0
  123. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -0
  124. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  125. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  126. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  127. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  128. package/node_modules/@attocash/commons-node-remote/package.json +31 -0
  129. package/node_modules/@attocash/commons-transport/LICENSE +28 -0
  130. package/node_modules/@attocash/commons-transport/README.md +5 -0
  131. package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +64 -0
  132. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +249 -0
  133. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -0
  134. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +263 -0
  135. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -0
  136. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs +8 -0
  137. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -0
  138. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +11604 -0
  139. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -0
  140. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  141. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  142. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  143. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  144. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +499 -0
  145. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -0
  146. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +6456 -0
  147. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -0
  148. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +83 -0
  149. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -0
  150. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +1714 -0
  151. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -0
  152. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +3197 -0
  153. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -0
  154. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +2290 -0
  155. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -0
  156. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +46 -0
  157. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
  158. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +482 -0
  159. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
  160. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +165 -0
  161. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -0
  162. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs +4 -0
  163. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -0
  164. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +3222 -0
  165. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -0
  166. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs +4 -0
  167. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -0
  168. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +1485 -0
  169. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -0
  170. package/node_modules/@attocash/commons-transport/package.json +29 -0
  171. package/node_modules/@attocash/commons-worker/LICENSE +28 -0
  172. package/node_modules/@attocash/commons-worker/README.md +48 -0
  173. package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +73 -0
  174. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +702 -0
  175. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -0
  176. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +432 -0
  177. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -0
  178. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  179. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  180. package/node_modules/@attocash/commons-worker/package.json +29 -0
  181. package/node_modules/@attocash/commons-worker-remote/LICENSE +28 -0
  182. package/node_modules/@attocash/commons-worker-remote/README.md +60 -0
  183. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +93 -0
  184. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +289 -0
  185. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -0
  186. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +432 -0
  187. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -0
  188. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs +8 -0
  189. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -0
  190. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  191. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  192. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  193. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  194. package/node_modules/@attocash/commons-worker-remote/package.json +31 -0
  195. package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
  196. package/node_modules/@js-joda/core/CheatSheet.md +947 -0
  197. package/node_modules/@js-joda/core/LICENSE +34 -0
  198. package/node_modules/@js-joda/core/README.md +155 -0
  199. package/node_modules/@js-joda/core/bower.json +21 -0
  200. package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
  201. package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
  202. package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
  203. package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
  204. package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
  205. package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
  206. package/node_modules/@js-joda/core/package.json +76 -0
  207. package/node_modules/@js-joda/core/src/Clock.js +330 -0
  208. package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
  209. package/node_modules/@js-joda/core/src/Duration.js +1205 -0
  210. package/node_modules/@js-joda/core/src/Enum.js +30 -0
  211. package/node_modules/@js-joda/core/src/Instant.js +1012 -0
  212. package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
  213. package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
  214. package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
  215. package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
  216. package/node_modules/@js-joda/core/src/Month.js +600 -0
  217. package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
  218. package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
  219. package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
  220. package/node_modules/@js-joda/core/src/Period.js +933 -0
  221. package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
  222. package/node_modules/@js-joda/core/src/Year.js +1015 -0
  223. package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
  224. package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
  225. package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
  226. package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
  227. package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
  228. package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
  229. package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
  230. package/node_modules/@js-joda/core/src/_init.js +68 -0
  231. package/node_modules/@js-joda/core/src/assert.js +33 -0
  232. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
  233. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
  234. package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
  235. package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
  236. package/node_modules/@js-joda/core/src/convert.js +83 -0
  237. package/node_modules/@js-joda/core/src/errors.js +54 -0
  238. package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
  239. package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
  240. package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
  241. package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
  242. package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
  243. package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
  244. package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
  245. package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
  246. package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
  247. package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
  248. package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
  249. package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
  250. package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
  251. package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
  252. package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
  253. package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
  254. package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
  255. package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
  256. package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
  257. package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
  258. package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
  259. package/node_modules/@js-joda/core/src/js-joda.js +210 -0
  260. package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
  261. package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
  262. package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
  263. package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
  264. package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
  265. package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
  266. package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
  267. package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
  268. package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
  269. package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
  270. package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
  271. package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
  272. package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
  273. package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
  274. package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
  275. package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
  276. package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
  277. package/node_modules/@js-joda/core/src/use.js +20 -0
  278. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
  279. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
  280. package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
  281. package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
  282. package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
  283. package/node_modules/@noble/hashes/LICENSE +21 -0
  284. package/node_modules/@noble/hashes/README.md +563 -0
  285. package/node_modules/@noble/hashes/_blake.d.ts +21 -0
  286. package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
  287. package/node_modules/@noble/hashes/_blake.js +52 -0
  288. package/node_modules/@noble/hashes/_blake.js.map +1 -0
  289. package/node_modules/@noble/hashes/_md.d.ts +99 -0
  290. package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
  291. package/node_modules/@noble/hashes/_md.js +202 -0
  292. package/node_modules/@noble/hashes/_md.js.map +1 -0
  293. package/node_modules/@noble/hashes/_u64.d.ts +63 -0
  294. package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
  295. package/node_modules/@noble/hashes/_u64.js +84 -0
  296. package/node_modules/@noble/hashes/_u64.js.map +1 -0
  297. package/node_modules/@noble/hashes/argon2.d.ts +112 -0
  298. package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
  299. package/node_modules/@noble/hashes/argon2.js +517 -0
  300. package/node_modules/@noble/hashes/argon2.js.map +1 -0
  301. package/node_modules/@noble/hashes/blake1.d.ts +156 -0
  302. package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
  303. package/node_modules/@noble/hashes/blake1.js +560 -0
  304. package/node_modules/@noble/hashes/blake1.js.map +1 -0
  305. package/node_modules/@noble/hashes/blake2.d.ts +184 -0
  306. package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
  307. package/node_modules/@noble/hashes/blake2.js +501 -0
  308. package/node_modules/@noble/hashes/blake2.js.map +1 -0
  309. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  310. package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
  311. package/node_modules/@noble/hashes/blake3.js +284 -0
  312. package/node_modules/@noble/hashes/blake3.js.map +1 -0
  313. package/node_modules/@noble/hashes/eskdf.d.ts +92 -0
  314. package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
  315. package/node_modules/@noble/hashes/eskdf.js +218 -0
  316. package/node_modules/@noble/hashes/eskdf.js.map +1 -0
  317. package/node_modules/@noble/hashes/hkdf.d.ts +64 -0
  318. package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
  319. package/node_modules/@noble/hashes/hkdf.js +120 -0
  320. package/node_modules/@noble/hashes/hkdf.js.map +1 -0
  321. package/node_modules/@noble/hashes/hmac.d.ts +47 -0
  322. package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
  323. package/node_modules/@noble/hashes/hmac.js +93 -0
  324. package/node_modules/@noble/hashes/hmac.js.map +1 -0
  325. package/node_modules/@noble/hashes/index.d.ts +2 -0
  326. package/node_modules/@noble/hashes/index.d.ts.map +1 -0
  327. package/node_modules/@noble/hashes/index.js +35 -0
  328. package/node_modules/@noble/hashes/index.js.map +1 -0
  329. package/node_modules/@noble/hashes/legacy.d.ts +102 -0
  330. package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
  331. package/node_modules/@noble/hashes/legacy.js +327 -0
  332. package/node_modules/@noble/hashes/legacy.js.map +1 -0
  333. package/node_modules/@noble/hashes/package.json +97 -0
  334. package/node_modules/@noble/hashes/pbkdf2.d.ts +56 -0
  335. package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
  336. package/node_modules/@noble/hashes/pbkdf2.js +135 -0
  337. package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
  338. package/node_modules/@noble/hashes/scrypt.d.ts +65 -0
  339. package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
  340. package/node_modules/@noble/hashes/scrypt.js +257 -0
  341. package/node_modules/@noble/hashes/scrypt.js.map +1 -0
  342. package/node_modules/@noble/hashes/sha2.d.ts +249 -0
  343. package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
  344. package/node_modules/@noble/hashes/sha2.js +458 -0
  345. package/node_modules/@noble/hashes/sha2.js.map +1 -0
  346. package/node_modules/@noble/hashes/sha3-addons.d.ts +461 -0
  347. package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
  348. package/node_modules/@noble/hashes/sha3-addons.js +783 -0
  349. package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
  350. package/node_modules/@noble/hashes/sha3.d.ts +199 -0
  351. package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
  352. package/node_modules/@noble/hashes/sha3.js +431 -0
  353. package/node_modules/@noble/hashes/sha3.js.map +1 -0
  354. package/node_modules/@noble/hashes/src/_blake.ts +57 -0
  355. package/node_modules/@noble/hashes/src/_md.ts +222 -0
  356. package/node_modules/@noble/hashes/src/_u64.ts +117 -0
  357. package/node_modules/@noble/hashes/src/argon2.ts +667 -0
  358. package/node_modules/@noble/hashes/src/blake1.ts +614 -0
  359. package/node_modules/@noble/hashes/src/blake2.ts +582 -0
  360. package/node_modules/@noble/hashes/src/blake3.ts +317 -0
  361. package/node_modules/@noble/hashes/src/eskdf.ts +259 -0
  362. package/node_modules/@noble/hashes/src/hkdf.ts +133 -0
  363. package/node_modules/@noble/hashes/src/hmac.ts +126 -0
  364. package/node_modules/@noble/hashes/src/index.ts +33 -0
  365. package/node_modules/@noble/hashes/src/legacy.ts +339 -0
  366. package/node_modules/@noble/hashes/src/pbkdf2.ts +175 -0
  367. package/node_modules/@noble/hashes/src/scrypt.ts +315 -0
  368. package/node_modules/@noble/hashes/src/sha2.ts +530 -0
  369. package/node_modules/@noble/hashes/src/sha3-addons.ts +983 -0
  370. package/node_modules/@noble/hashes/src/sha3.ts +485 -0
  371. package/node_modules/@noble/hashes/src/utils.ts +848 -0
  372. package/node_modules/@noble/hashes/src/webcrypto.ts +239 -0
  373. package/node_modules/@noble/hashes/utils.d.ts +519 -0
  374. package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
  375. package/node_modules/@noble/hashes/utils.js +578 -0
  376. package/node_modules/@noble/hashes/utils.js.map +1 -0
  377. package/node_modules/@noble/hashes/webcrypto.d.ts +120 -0
  378. package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
  379. package/node_modules/@noble/hashes/webcrypto.js +165 -0
  380. package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
  381. package/node_modules/ws/LICENSE +20 -0
  382. package/node_modules/ws/README.md +548 -0
  383. package/node_modules/ws/browser.js +8 -0
  384. package/node_modules/ws/index.js +22 -0
  385. package/node_modules/ws/lib/buffer-util.js +131 -0
  386. package/node_modules/ws/lib/constants.js +19 -0
  387. package/node_modules/ws/lib/event-target.js +292 -0
  388. package/node_modules/ws/lib/extension.js +203 -0
  389. package/node_modules/ws/lib/limiter.js +55 -0
  390. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  391. package/node_modules/ws/lib/receiver.js +743 -0
  392. package/node_modules/ws/lib/sender.js +607 -0
  393. package/node_modules/ws/lib/stream.js +161 -0
  394. package/node_modules/ws/lib/subprotocol.js +62 -0
  395. package/node_modules/ws/lib/validation.js +152 -0
  396. package/node_modules/ws/lib/websocket-server.js +562 -0
  397. package/node_modules/ws/lib/websocket.js +1407 -0
  398. package/node_modules/ws/package.json +74 -0
  399. package/node_modules/ws/wrapper.mjs +21 -0
  400. package/package.json +53 -0
@@ -0,0 +1,105 @@
1
+ /*
2
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
4
+ */
5
+
6
+ import {assert, requireNonNull} from '../assert';
7
+ import {UnsupportedTemporalTypeException} from '../errors';
8
+
9
+ import {Instant} from '../Instant';
10
+ import {LocalDate} from '../LocalDate';
11
+ import {LocalTime} from '../LocalTime';
12
+ import {MathUtil} from '../MathUtil';
13
+ import {ZoneId} from '../ZoneId';
14
+
15
+ import {ChronoField} from './ChronoField';
16
+ import {TemporalQueries} from './TemporalQueries';
17
+ import {TemporalAccessor} from './TemporalAccessor';
18
+
19
+ /**
20
+ * A wrapper around a native javascript Date instance that
21
+ * implements TemporalAccessor functionality
22
+ */
23
+ class NativeJsTemporal extends TemporalAccessor {
24
+
25
+ /**
26
+ * @param {!(Date|moment)} date - a javascript Date or a moment instance
27
+ * @param {ZoneId} [zone=ZoneId.systemDefault()] - the zone of the temporal, defaults to ZoneId.systemDefault()
28
+ * @private
29
+ */
30
+ constructor(date, zone=ZoneId.systemDefault()){
31
+ super();
32
+ this._zone = zone;
33
+ if(date instanceof Date) {
34
+ this._epochMilli = date.getTime();
35
+ return;
36
+ } else if(typeof date.toDate === 'function' && date.toDate() instanceof Date) {
37
+ // it's a moment
38
+ this._epochMilli = date.toDate().getTime();
39
+ return;
40
+ }
41
+ assert(false, 'date must be either a javascript date or a moment');
42
+ }
43
+
44
+ /**
45
+ * @param {TemporalQuery} query the query to invoke, not null
46
+ * @return {*} the query result, null may be returned (defined by the query)
47
+ * @throws DateTimeException if unable to query
48
+ */
49
+ query(query) {
50
+ requireNonNull(query, 'query');
51
+ if (query === TemporalQueries.localDate()) {
52
+ return LocalDate.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
53
+ } else if(query === TemporalQueries.localTime()){
54
+ return LocalTime.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
55
+ } else if(query === TemporalQueries.zone()){
56
+ return this._zone;
57
+ }
58
+ return super.query(query);
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @param {TemporalField} field
64
+ * @returns {number}
65
+ */
66
+ get(field) {
67
+ return this.getLong(field);
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @param {!TemporalField} field
73
+ * @returns {number}
74
+ */
75
+ getLong(field) {
76
+ requireNonNull(field, 'field');
77
+ if (field instanceof ChronoField) {
78
+ switch (field) {
79
+ case ChronoField.NANO_OF_SECOND: return MathUtil.floorMod(this._epochMilli, 1000) * 1000000;
80
+ case ChronoField.INSTANT_SECONDS: return MathUtil.floorDiv(this._epochMilli, 1000);
81
+ }
82
+ throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
83
+ }
84
+ return field.getFrom(this);
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @param {TemporalField} field
90
+ * @returns {boolean}
91
+ */
92
+ isSupported(field){
93
+ return field === ChronoField.INSTANT_SECONDS || field === ChronoField.NANO_OF_SECOND;
94
+ }
95
+ }
96
+
97
+ /**
98
+ *
99
+ * @param {!(Date|moment)} date - a javascript Date or a moment instance
100
+ * @param {ZoneId} [zone=ZoneId.systemDefault()] - the zone of the temporal, defaults to ZoneId.systemDefault()
101
+ * @returns {NativeJsTemporal}
102
+ */
103
+ export function nativeJs(date, zone){
104
+ return new NativeJsTemporal(date, zone);
105
+ }
@@ -0,0 +1,346 @@
1
+ /*
2
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
7
+ import {TemporalAccessor} from './TemporalAccessor';
8
+ import { abstractMethodFail } from '../assert';
9
+
10
+ /**
11
+ * Framework-level interface defining read-write access to a temporal object,
12
+ * such as a date, time, offset or some combination of these.
13
+ *
14
+ * This is the base interface type for date, time and offset objects that
15
+ * are complete enough to be manipulated using plus and minus.
16
+ * It is implemented by those classes that can provide and manipulate information
17
+ * as fields (see {@link TemporalField}) or queries (see {@link TemporalQuery}).
18
+ * See {@link TemporalAccessor} for the read-only version of this interface.
19
+ *
20
+ * Most date and time information can be represented as a number.
21
+ * These are modeled using {@link TemporalField} with the number held using
22
+ * a `long` to handle large values. Year, month and day-of-month are
23
+ * simple examples of fields, but they also include instant and offsets.
24
+ * See {@link ChronoField} for the standard set of fields.
25
+ *
26
+ * Two pieces of date/time information cannot be represented by numbers,
27
+ * the {@link Chronology} and the {@link ZoneId}.
28
+ * These can be accessed using the static methods defined on {@link TemporalQueries}.
29
+ *
30
+ * This interface is a framework-level interface that should not be widely
31
+ * used in application code. Instead, applications should create and pass
32
+ * around instances of concrete types, such as {@link LocalDate}.
33
+ * There are many reasons for this, part of which is that implementations
34
+ * of this interface may be in calendar systems other than ISO.
35
+ * See {@link ChronoLocalDate} for a fuller discussion of the issues.
36
+ *
37
+ * ### When to implement
38
+ *
39
+ * A class should implement this interface if it meets three criteria:
40
+ *
41
+ * * it provides access to date/time/offset information, as per {@link TemporalAccessor}
42
+ * * the set of fields are contiguous from the largest to the smallest
43
+ * * the set of fields are complete, such that no other field is needed to define the
44
+ * valid range of values for the fields that are represented
45
+ *
46
+ * Four examples make this clear:
47
+ *
48
+ * * {@link LocalDate} implements this interface as it represents a set of fields
49
+ * that are contiguous from days to forever and require no external information to determine
50
+ * the validity of each date. It is therefore able to implement plus/minus correctly.
51
+ * * {@link LocalTime} implements this interface as it represents a set of fields
52
+ * that are contiguous from nanos to within days and require no external information to determine
53
+ * validity. It is able to implement plus/minus correctly, by wrapping around the day.
54
+ * * {@link MonthDay}, the combination of month-of-year and day-of-month, does not implement
55
+ * this interface. While the combination is contiguous, from days to months within years,
56
+ * the combination does not have sufficient information to define the valid range of values
57
+ * for day-of-month. As such, it is unable to implement plus/minus correctly.
58
+ * * The combination day-of-week and day-of-month ("Friday the 13th") should not implement
59
+ * this interface. It does not represent a contiguous set of fields, as days to weeks overlaps
60
+ * days to months.
61
+ *
62
+ * @interface
63
+ */
64
+ export class Temporal extends TemporalAccessor {
65
+ /**
66
+ * Checks if the specified unit is supported.
67
+ * This checks if the date-time can be queried for the specified unit. If false, then calling the plus and minus methods will throw an exception.
68
+
69
+ * ### Specification for implementors
70
+ * Implementations must check and handle all fields defined in {@link ChronoUnit}. If the field is supported, then true is returned, otherwise false
71
+ * If the field is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.isSupportedBy(Temporal)` passing this as the argument.
72
+
73
+ * Implementations must not alter this object.
74
+
75
+ * @param {TemporalUnit} unit - the unit to check, null returns false
76
+ * @return {boolean} true if this date-time can be queried for the unit, false if not
77
+ */
78
+ // eslint-disable-next-line no-unused-vars
79
+ isSupported(unit) {
80
+ abstractMethodFail('isSupported');
81
+ }
82
+
83
+ /**
84
+ * function overloading for {@link Temporal.plus}
85
+ *
86
+ * Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAmount} and {@link Temporal.minusAmount} is called.
87
+ *
88
+ * Otherwise {@link Temporal.minusAmountUnit} is called.
89
+ *
90
+ * @param {!(TemporalAmount|number)} p1
91
+ * @param {TemporalUnit} p2
92
+ * @return {Temporal}
93
+ */
94
+ // eslint-disable-next-line no-unused-vars
95
+ minus(p1, p2) {
96
+ if (arguments.length < 2) {
97
+ return this.minusAmount(p1);
98
+ } else {
99
+ return this.minusAmountUnit(p1, p2);
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Returns an object of the same type as this object with an amount subtracted.
105
+ * This adjusts this temporal, subtracting according to the rules of the specified amount. The
106
+ * amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as Duration.
107
+ *
108
+ * Some example code indicating how and why this method is used:
109
+ *
110
+ * <pre>
111
+ * date = date.minus(period); // subtract a Period instance
112
+ * date = date.minus(duration); // subtract a Duration instance
113
+ * date = date.minus(workingDays(6)); // example user-written workingDays method
114
+ * </pre>
115
+ *
116
+ * Note that calling plus followed by minus is not guaranteed to return the same date-time.
117
+ *
118
+ * ### Specification for implementors
119
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original
120
+ * must be returned. This provides equivalent, safe behavior for immutable and mutable
121
+ * implementations.
122
+ *
123
+ * @param {TemporalAmount} amount - the amount to subtract, not null
124
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
125
+ * @throws DateTimeException - if the subtraction cannot be made
126
+ * @throws ArithmeticException - if numeric overflow occurs
127
+ */
128
+ // eslint-disable-next-line no-unused-vars
129
+ minusAmount(amount) {
130
+ abstractMethodFail('minusAmount');
131
+ }
132
+
133
+ /**
134
+ * Returns an object of the same type as this object with the specified period subtracted.
135
+ * This method returns a new object based on this one with the specified period subtracted. For example, on a {@link LocalDate}, this could be used to subtract a number of years, months or days. The returned object will have the same observable type as this object.
136
+ *
137
+ * In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st March, then subtracting one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
138
+ *
139
+ * If the implementation represents a date-time that has boundaries, such {@link as} LocalTime, then the permitted units must include the boundary unit, but no multiples of the boundary unit. For example, {@link LocalTime} must accept `DAYS` but not `WEEKS` or `MONTHS`.
140
+ *
141
+ * ### Specification for implementors
142
+ * Implementations must behave in a manor equivalent to the default method behavior.
143
+ * Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
144
+ *
145
+ * @param {number} amountToSubtract - the amount of the specified unit to subtract, may be negative
146
+ * @param {TemporalUnit} unit - the unit of the period to subtract, not null
147
+ * @return {Temporal} an object of the same type with the specified period subtracted, not null
148
+ * @throws DateTimeException - if the unit cannot be subtracted
149
+ * @throws ArithmeticException - if numeric overflow occurs
150
+ */
151
+ // eslint-disable-next-line no-unused-vars
152
+ minusAmountUnit(amountToSubtract, unit) {
153
+ abstractMethodFail('minusAmountUnit');
154
+ }
155
+
156
+ /**
157
+ * function overloading for {@link Temporal.plus}
158
+ *
159
+ * Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAmount} and {@link Temporal.plusAmount} is called.
160
+ *
161
+ * Otherwise {@link Temporal.plusAmountUnit} is called.
162
+ *
163
+ * @param {!(TemporalAmount|number)} p1
164
+ * @param {TemporalUnit} p2
165
+ * @return {Temporal}
166
+ */
167
+ // eslint-disable-next-line no-unused-vars
168
+ plus(p1, p2) {
169
+ if (arguments.length < 2) {
170
+ return this.plusAmount(p1);
171
+ } else {
172
+ return this.plusAmountUnit(p1, p2);
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Returns an object of the same type as this object with an amount added.
178
+ * This adjusts this temporal, adding according to the rules of the specified amount. The amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as {@link Duration}.
179
+ *
180
+ * Some example code indicating how and why this method is used:
181
+ *
182
+ * <pre>
183
+ * date = date.plus(period); // add a Period instance
184
+ * date = date.plus(duration); // add a Duration instance
185
+ * date = date.plus(workingDays(6)); // example user-written workingDays method
186
+ * </pre>
187
+ *
188
+ * Note that calling plus followed by minus is not guaranteed to return the same date-time.
189
+ *
190
+ * ### Specification for implementors
191
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
192
+ *
193
+ * @param {TemporalAmount} amount - the amount to add, not null
194
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
195
+ * @throws DateTimeException - if the addition cannot be made
196
+ * @throws ArithmeticException - if numeric overflow occurs
197
+ */
198
+ // eslint-disable-next-line no-unused-vars
199
+ plusAmount(amount) {
200
+ abstractMethodFail('plusAmount');
201
+ }
202
+
203
+ /**
204
+ * Returns an object of the same type as this object with the specified period added.
205
+ * This method returns a new object based on this one with the specified period added. For example, on a {@link LocalDate}, this could be used to add a number of years, months or days. The returned object will have the same observable type as this object.
206
+ *
207
+ * In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then adding one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
208
+ *
209
+ * If the implementation represents a date-time that has boundaries, such as {@link LocalTime}, then the permitted units must include the boundary unit, but no multiples of the boundary unit. For example, {@link LocalTime} must accept `DAYS` but not `WEEKS` or `MONTHS`.
210
+ *
211
+ * ### Specification for implementors
212
+ * Implementations must check and handle all units defined in {@link ChronoUnit}. If the unit is supported, then the addition must be performed. If unsupported, then a {@link DateTimeException} must be thrown.
213
+ * If the unit is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.addTo(Temporal, long)` passing this as the first argument.
214
+ *
215
+ * Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
216
+ *
217
+ * @param {number} amountToAdd - the amount of the specified unit to add, may be negative
218
+ * @param {TemporalUnit} unit - the unit of the period to add, not null
219
+ * @return {Temporal} an object of the same type with the specified period added, not null
220
+ * @throws DateTimeException - if the unit cannot be added
221
+ * @throws ArithmeticException - if numeric overflow occurs
222
+ */
223
+ // eslint-disable-next-line no-unused-vars
224
+ plusAmountUnit(amountToAdd, unit) {
225
+ abstractMethodFail('plusAmountUnit');
226
+ }
227
+
228
+ /**
229
+ * Calculates the period between this temporal and another temporal in terms of the specified unit.
230
+ * This calculates the period between two temporals in terms of a single unit. The start and end points are this and the specified temporal. The result will be negative if the end is before the start. For example, the period in hours between two temporal objects can be calculated using `startTime.until(endTime, HOURS)`.
231
+ *
232
+ * The calculation returns a whole number, representing the number of complete units between the two temporals. For example, the period in hours between the times 11:30 and 13:29 will only be one hour as it is one minute short of two hours.
233
+ *
234
+ * There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use `TemporalUnit.between(Temporal, Temporal)`:
235
+ *
236
+ * <pre>
237
+ * // these two lines are equivalent
238
+ * between = thisUnit.between(start, end);
239
+ * between = start.until(end, thisUnit);
240
+ * </pre>
241
+ *
242
+ * The choice should be made based on which makes the code more readable.
243
+ * For example, this method allows the number of days between two dates to be calculated:
244
+ *
245
+ * <pre>
246
+ * long daysBetween = DAYS.between(start, end);
247
+ * // or alternatively
248
+ * long daysBetween = start.until(end, DAYS);
249
+ * </pre>
250
+ *
251
+ * ### Specification for implementors
252
+ * Implementations must begin by checking to ensure that the input temporal object is of the same observable type as the implementation. They must then perform the calculation for all instances of {@link ChronoUnit}. A {@link DateTimeException} must be thrown for {@link ChronoUnit} instances that are unsupported.
253
+ * If the unit is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.between(Temporal, Temporal)` passing this as the first argument and the input temporal as the second argument.
254
+ *
255
+ * In summary, implementations must behave in a manner equivalent to this code:
256
+ *
257
+ * <pre>
258
+ * // check input temporal is the same type as this class
259
+ * if (unit instanceof ChronoUnit) {
260
+ * // if unit is supported, then calculate and return result
261
+ * // else throw DateTimeException for unsupported units
262
+ * }
263
+ * return unit.between(this, endTemporal);
264
+ * </pre>
265
+ *
266
+ * The target object must not be altered by this method.
267
+ *
268
+ * @param {Temporal} endTemporal - the end temporal, of the same type as this object, not null
269
+ * @param {TemporalUnit} unit - the unit to measure the period in, not null
270
+ * @return {number} the amount of the period between this and the end
271
+ * @throws DateTimeException - if the period cannot be calculated
272
+ * @throws ArithmeticException - if numeric overflow occurs
273
+ */
274
+ // eslint-disable-next-line no-unused-vars
275
+ until(endTemporal, unit) {
276
+ abstractMethodFail('until');
277
+ }
278
+
279
+ /**
280
+ * function overloading for {@link Temporal.with}
281
+ *
282
+ * Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAdjuster} and {@link Temporal.withAdjuster} is called.
283
+ *
284
+ * Otherwise {@link Temporal.withFieldValue} is called.
285
+ *
286
+ * @param {!(TemporalAdjuster|TemporalField)} p1
287
+ * @param {number} p2
288
+ * @return {Temporal}
289
+ */
290
+ // eslint-disable-next-line no-unused-vars
291
+ with(p1, p2) {
292
+ if (arguments.length < 2) {
293
+ return this.withAdjuster(p1);
294
+ } else {
295
+ return this.withFieldValue(p1, p2);
296
+ }
297
+ }
298
+
299
+ /**
300
+ * Returns an adjusted object of the same type as this object with the adjustment made.
301
+ * This adjusts this date-time according to the rules of the specified adjuster. A simple adjuster might simply set the one of the fields, such as the year field. A more complex adjuster might set the date to the last day of the month. A selection of common adjustments is provided in {@link TemporalAdjusters}. These include finding the "last day of the month" and "next Wednesday". The adjuster is responsible for handling special cases, such as the varying lengths of month and leap years.
302
+ *
303
+ * Some example code indicating how and why this method is used:
304
+ *
305
+ * <pre>
306
+ * date = date.with(Month.JULY); // most key classes implement TemporalAdjuster
307
+ * date = date.with(lastDayOfMonth()); // static import from TemporalAdjusters
308
+ * date = date.with(next(WEDNESDAY)); // static import from TemporalAdjusters and DayOfWeek
309
+ * </pre>
310
+ *
311
+ * ### Specification for implementors
312
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
313
+ *
314
+ * @param {TemporalAdjuster} adjuster - the adjuster to use, not null
315
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
316
+ * @throws DateTimeException - if unable to make the adjustment
317
+ * @throws ArithmeticException - if numeric overflow occurs
318
+ */
319
+ // eslint-disable-next-line no-unused-vars
320
+ withAdjuster(adjuster) {
321
+ abstractMethodFail('withAdjuster');
322
+ }
323
+
324
+ /**
325
+ * Returns an object of the same type as this object with the specified field altered.
326
+ * This returns a new object based on this one with the value for the specified field changed. For example, on a {@link LocalDate}, this could be used to set the year, month or day-of-month. The returned object will have the same observable type as this object.
327
+ *
328
+ * In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
329
+ *
330
+ * ### Specification for implementors
331
+ * Implementations must check and handle all fields defined in {@link ChronoField}. If the field is supported, then the adjustment must be performed. If unsupported, then a {@link DateTimeException} must be thrown.
332
+ * If the field is not a {@link ChronoField}, then the result of this method is obtained by invoking `TemporalField.adjustInto(Temporal, long)` passing this as the first argument.
333
+ *
334
+ * Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
335
+ *
336
+ * @param {TemporalField} field - the field to set in the result, not null
337
+ * @param {number} newValue - the new value of the field in the result
338
+ * @return {Temporal} an object of the same type with the specified field set, not null
339
+ * @throws DateTimeException - if the field cannot be set
340
+ * @throws ArithmeticException - if numeric overflow occurs
341
+ */
342
+ // eslint-disable-next-line no-unused-vars
343
+ withFieldValue(field, newValue) {
344
+ abstractMethodFail('withFieldValue');
345
+ }
346
+ }
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
7
+ import {UnsupportedTemporalTypeException} from '../errors';
8
+
9
+ import {ChronoField} from './ChronoField';
10
+ import {TemporalQueries} from './TemporalQueries';
11
+
12
+ export class TemporalAccessor {
13
+ /**
14
+ * Queries this date-time.
15
+ *
16
+ * This queries this date-time using the specified query strategy object.
17
+ *
18
+ * Queries are a key tool for extracting information from date-times.
19
+ * They exists to externalize the process of querying, permitting different
20
+ * approaches, as per the strategy design pattern.
21
+ * Examples might be a query that checks if the date is the day before February 29th
22
+ * in a leap year, or calculates the number of days to your next birthday.
23
+ *
24
+ * The most common query implementations are method references, such as
25
+ * {@link LocalDate::from} and {@link ZoneId::from}.
26
+ * Further implementations are on {@link TemporalQueries}.
27
+ * Queries may also be defined by applications.
28
+ *
29
+ * @implSpec
30
+ * Implementations of this method must behave as follows:
31
+ * <pre>
32
+ if (query == TemporalQueries.zoneId()
33
+ || query == TemporalQueries.chronology()
34
+ || query == TemporalQueries.precision()) {
35
+ return null;
36
+ }
37
+ return query.queryFrom(this);
38
+ * </pre>
39
+ *
40
+ * @param {TemporalQuery} query the query to invoke, not null
41
+ * @return the query result, null may be returned (defined by the query)
42
+ * @throws DateTimeException if unable to query
43
+ * @throws ArithmeticException if numeric overflow occurs
44
+ */
45
+ query(query) {
46
+ if (query === TemporalQueries.zoneId()
47
+ || query === TemporalQueries.chronology()
48
+ || query === TemporalQueries.precision()) {
49
+ return null;
50
+ }
51
+ return query.queryFrom(this);
52
+ }
53
+
54
+ /**
55
+ * Gets the value of the specified field as an `int`.
56
+ *
57
+ * This queries the date-time for the value for the specified field.
58
+ * The returned value will always be within the valid range of values for the field.
59
+ * If the date-time cannot return the value, because the field is unsupported or for
60
+ * some other reason, an exception will be thrown.
61
+ *
62
+ * ### Specification for implementors
63
+ *
64
+ * Implementations must check and handle all fields defined in {@link ChronoField}.
65
+ * If the field is supported and has an `int` range, then the value of
66
+ * the field must be returned.
67
+ * If unsupported, then a {@link DateTimeException} must be thrown.
68
+ *
69
+ * If the field is not a {@link ChronoField}, then the result of this method
70
+ * is obtained by invoking {@link TemporalField.getFrom}
71
+ * passing `this` as the argument.
72
+ *
73
+ * Implementations must not alter either this object.
74
+ *
75
+ * @param {TemporalField} field - the field to get, not null
76
+ * @return {number} the value for the field, within the valid range of values
77
+ * @throws DateTimeException if a value for the field cannot be obtained
78
+ * @throws DateTimeException if the range of valid values for the field exceeds an `int`
79
+ * @throws DateTimeException if the value is outside the range of valid values for the field
80
+ * @throws ArithmeticException if numeric overflow occurs
81
+ */
82
+ get(field) {
83
+ return this.range(field).checkValidIntValue(this.getLong(field), field);
84
+ }
85
+
86
+ /**
87
+ * Gets the range of valid values for the specified field.
88
+ *
89
+ * All fields can be expressed as a `long` integer.
90
+ * This method returns an object that describes the valid range for that value.
91
+ * The value of this temporal object is used to enhance the accuracy of the returned range.
92
+ * If the date-time cannot return the range, because the field is unsupported or for
93
+ * some other reason, an exception will be thrown.
94
+ *
95
+ * Note that the result only describes the minimum and maximum valid values
96
+ * and it is important not to read too much into them. For example, there
97
+ * could be values within the range that are invalid for the field.
98
+ *
99
+ * ### Specification for implementors
100
+ *
101
+ * Implementations must check and handle all fields defined in {@link ChronoField}.
102
+ * If the field is supported, then the range of the field must be returned.
103
+ * If unsupported, then a {@link DateTimeException} must be thrown.
104
+ *
105
+ * If the field is not a {@link ChronoField}, then the result of this method
106
+ * is obtained by invoking {@link TemporalField.rangeRefinedBy}
107
+ * passing `this` as the argument.
108
+ *
109
+ * Implementations must not alter either this object.
110
+ *
111
+ * @param {TemporalField} field the field to query the range for, not null
112
+ * @return {ValueRange} the range of valid values for the field, not null
113
+ * @throws DateTimeException if the range for the field cannot be obtained
114
+ */
115
+ range(field) {
116
+ if (field instanceof ChronoField) {
117
+ if (this.isSupported(field)) {
118
+ return field.range();
119
+ }
120
+ throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
121
+ }
122
+ return field.rangeRefinedBy(this);
123
+ }
124
+
125
+ }
@@ -0,0 +1,92 @@
1
+ /*
2
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
7
+ import {abstractMethodFail} from '../assert';
8
+
9
+ /**
10
+ * Strategy for adjusting a temporal object.
11
+ *
12
+ * Adjusters are a key tool for modifying temporal objects.
13
+ * They exist to externalize the process of adjustment, permitting different
14
+ * approaches, as per the strategy design pattern.
15
+ * Examples might be an adjuster that sets the date avoiding weekends, or one that
16
+ * sets the date to the last day of the month.
17
+ *
18
+ * There are two equivalent ways of using a {@link TemporalAdjuster}.
19
+ * The first is to invoke the method on this interface directly.
20
+ * The second is to use {@link Temporal#with}:
21
+ * <pre>
22
+ * // these two lines are equivalent, but the second approach is recommended
23
+ * temporal = thisAdjuster.adjustInto(temporal);
24
+ * temporal = temporal.with(thisAdjuster);
25
+ * </pre>
26
+ * It is recommended to use the second approach, {@link with},
27
+ * as it is a lot clearer to read in code.
28
+ *
29
+ * See {@link TemporalAdjusters} for a standard set of adjusters, including finding the
30
+ * last day of the month.
31
+ * Adjusters may also be defined by applications.
32
+ *
33
+ * ### Specification for implementors
34
+ *
35
+ * This interface places no restrictions on the mutability of implementations,
36
+ * however immutability is strongly recommended.
37
+ *
38
+ * @interface
39
+ */
40
+ export class TemporalAdjuster {
41
+
42
+ /**
43
+ * Adjusts the specified temporal object.
44
+ *
45
+ * This adjusts the specified temporal object using the logic
46
+ * encapsulated in the implementing class.
47
+ * Examples might be an adjuster that sets the date avoiding weekends, or one that
48
+ * sets the date to the last day of the month.
49
+ *
50
+ * There are two equivalent ways of using this method.
51
+ * The first is to invoke this method directly.
52
+ * The second is to use {@link Temporal#with}:
53
+ * <pre>
54
+ * // these two lines are equivalent, but the second approach is recommended
55
+ * temporal = thisAdjuster.adjustInto(temporal);
56
+ * temporal = temporal.with(thisAdjuster);
57
+ * </pre>
58
+ * It is recommended to use the second approach, {@link with},
59
+ * as it is a lot clearer to read in code.
60
+ *
61
+ * ### Specification for implementors
62
+ *
63
+ * The implementation must take the input object and adjust it.
64
+ * The implementation defines the logic of the adjustment and is responsible for
65
+ * documenting that logic. It may use any method on {@link Temporal} to
66
+ * query the temporal object and perform the adjustment.
67
+ * The returned object must have the same observable type as the input object
68
+ *
69
+ * The input object must not be altered.
70
+ * Instead, an adjusted copy of the original must be returned.
71
+ * This provides equivalent, safe behavior for immutable and mutable temporal objects.
72
+ *
73
+ * The input temporal object may be in a calendar system other than ISO.
74
+ * Implementations may choose to document compatibility with other calendar systems,
75
+ * or reject non-ISO temporal objects by querying the chronology (see {@link TemporalQueries#chronology}).
76
+ *
77
+ * This method may be called from multiple threads in parallel.
78
+ * It must be thread-safe when invoked.
79
+ *
80
+ * @param {Temporal} temporal the temporal object to adjust, not null
81
+ * @return {Temporal} an object of the same observable type with the adjustment made, not null
82
+ * @throws DateTimeException if unable to make the adjustment
83
+ * @throws ArithmeticException if numeric overflow occurs
84
+ *
85
+ * @abstract
86
+ */
87
+ // eslint-disable-next-line no-unused-vars
88
+ adjustInto(temporal){
89
+ abstractMethodFail('adjustInto');
90
+ }
91
+
92
+ }