@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,728 @@
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 {assert, requireNonNull} from '../assert';
8
+
9
+ import {DateTimeParseException, NullPointerException} from '../errors';
10
+
11
+ import {Period} from '../Period';
12
+
13
+ import {ParsePosition} from './ParsePosition';
14
+ import {DateTimeBuilder} from './DateTimeBuilder';
15
+ import {DateTimeParseContext} from './DateTimeParseContext';
16
+ import {DateTimePrintContext} from './DateTimePrintContext';
17
+ import {DateTimeFormatterBuilder} from './DateTimeFormatterBuilder';
18
+ import {SignStyle} from './SignStyle';
19
+ import {StringBuilder} from './StringBuilder';
20
+ import {ResolverStyle} from './ResolverStyle';
21
+
22
+ import {IsoChronology} from '../chrono/IsoChronology';
23
+ import {ChronoField} from '../temporal/ChronoField';
24
+ import {createTemporalQuery} from '../temporal/TemporalQuery';
25
+
26
+ /**
27
+ *
28
+ * ### Static properties of Class {@link DateTimeFormatter}
29
+ *
30
+ * DateTimeFormatter.ISO_LOCAL_DATE
31
+ *
32
+ * DateTimeFormatter.ISO_LOCAL_TIME
33
+ *
34
+ * DateTimeFormatter.ISO_LOCAL_DATE_TIME
35
+ *
36
+ */
37
+ export class DateTimeFormatter {
38
+
39
+ //-----------------------------------------------------------------------
40
+ /**
41
+ * A query that provides access to the excess days that were parsed.
42
+ *
43
+ * This returns a singleton {@link TemporalQuery} that provides
44
+ * access to additional information from the parse. The query always returns
45
+ * a non-null period, with a zero period returned instead of null.
46
+ *
47
+ * There are two situations where this query may return a non-zero period.
48
+ *
49
+ * * If the {@link ResolverStyle} is {@link LENIENT} and a time is parsed
50
+ * without a date, then the complete result of the parse consists of a
51
+ * {@link LocalTime} and an excess {@link Period} in days.
52
+ * * If the {@link ResolverStyle} is {@link SMART} and a time is parsed
53
+ * without a date where the time is 24:00:00, then the complete result of
54
+ * the parse consists of a {@link LocalTime} of 00:00:00 and an excess
55
+ * {@link Period} of one day.
56
+ *
57
+ * In both cases, if a complete {@link ChronoLocalDateTime} or {@link Instant}
58
+ * is parsed, then the excess days are added to the date part.
59
+ * As a result, this query will return a zero period.
60
+ *
61
+ * The {@link SMART} behaviour handles the common "end of day" 24:00 value.
62
+ * Processing in {@link LENIENT} mode also produces the same result:
63
+ * <pre>
64
+ * Text to parse Parsed object Excess days
65
+ * "2012-12-03T00:00" LocalDateTime.of(2012, 12, 3, 0, 0) ZERO
66
+ * "2012-12-03T24:00" LocalDateTime.of(2012, 12, 4, 0, 0) ZERO
67
+ * "00:00" LocalTime.of(0, 0) ZERO
68
+ * "24:00" LocalTime.of(0, 0) Period.ofDays(1)
69
+ * </pre>
70
+ * The query can be used as follows:
71
+ * <pre>
72
+ * TemporalAccessor parsed = formatter.parse(str);
73
+ * LocalTime time = parsed.query(LocalTime.FROM);
74
+ * Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays());
75
+ * </pre>
76
+ * @return {TemporalQuery} a query that provides access to the excess days that were parsed
77
+ */
78
+ static parsedExcessDays() {
79
+ return DateTimeFormatter.PARSED_EXCESS_DAYS;
80
+ }
81
+
82
+ /**
83
+ * A query that provides access to whether a leap-second was parsed.
84
+ *
85
+ * This returns a singleton {@link TemporalQuery} that provides
86
+ * access to additional information from the parse. The query always returns
87
+ * a non-null boolean, true if parsing saw a leap-second, false if not.
88
+ *
89
+ * Instant parsing handles the special "leap second" time of '23:59:60'.
90
+ * Leap seconds occur at '23:59:60' in the UTC time-zone, but at other
91
+ * local times in different time-zones. To avoid this potential ambiguity,
92
+ * the handling of leap-seconds is limited to
93
+ * {@link DateTimeFormatterBuilder#appendInstant}, as that method
94
+ * always parses the instant with the UTC zone offset.
95
+ *
96
+ * If the time '23:59:60' is received, then a simple conversion is applied,
97
+ * replacing the second-of-minute of 60 with 59. This query can be used
98
+ * on the parse result to determine if the leap-second adjustment was made.
99
+ * The query will return one second of excess if it did adjust to remove
100
+ * the leap-second, and zero if not. Note that applying a leap-second
101
+ * smoothing mechanism, such as UTC-SLS, is the responsibility of the
102
+ * application, as follows:
103
+ * <pre>
104
+ * TemporalAccessor parsed = formatter.parse(str);
105
+ * Instant instant = parsed.query(Instant::from);
106
+ * if (parsed.query(DateTimeFormatter.parsedLeapSecond())) {
107
+ * // validate leap-second is correct and apply correct smoothing
108
+ * }
109
+ * </pre>
110
+ * @return a query that provides access to whether a leap-second was parsed
111
+ */
112
+ static parsedLeapSecond() {
113
+ return DateTimeFormatter.PARSED_LEAP_SECOND;
114
+ }
115
+
116
+ /**
117
+ * Creates a formatter using the specified pattern.
118
+ *
119
+ * This method will create a formatter based on a simple pattern of letters and symbols.
120
+ *
121
+ * The returned formatter will use the default locale, but this can be changed
122
+ * using {@link DateTimeFormatter.withLocale}.
123
+ *
124
+ * All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters.
125
+ * The following pattern letters are defined:
126
+ * <pre>
127
+ * |Symbol |Meaning |Presentation |Examples
128
+ * |--------|----------------------------|------------------|----------------------------------------------------
129
+ * | G | era | number/text | 1; 01; AD; Anno Domini
130
+ * | u | year | year | 2004; 04
131
+ * | y | year-of-era | year | 2004; 04
132
+ * | D | day-of-year | number | 189
133
+ * | M | month-of-year | number/text | 7; 07; Jul; July; J
134
+ * | d | day-of-month | number | 10
135
+ * | | | |
136
+ * | Q | quarter-of-year | number/text | 3; 03; Q3
137
+ * | Y | week-based-year | year | 1996; 96
138
+ * | w | week-of-year | number | 27
139
+ * | W | week-of-month | number | 27
140
+ * | e | localized day-of-week | number | 2; Tue; Tuesday; T
141
+ * | E | day-of-week | number/text | 2; Tue; Tuesday; T
142
+ * | F | week-of-month | number | 3
143
+ * | | | |
144
+ * | a | am-pm-of-day | text | PM
145
+ * | h | clock-hour-of-am-pm (1-12) | number | 12
146
+ * | K | hour-of-am-pm (0-11) | number | 0
147
+ * | k | clock-hour-of-am-pm (1-24) | number | 0
148
+ * | | | |
149
+ * | H | hour-of-day (0-23) | number | 0
150
+ * | m | minute-of-hour | number | 30
151
+ * | s | second-of-minute | number | 55
152
+ * | S | fraction-of-second | fraction | 978
153
+ * | A | milli-of-day | number | 1234
154
+ * | n | nano-of-second | number | 987654321
155
+ * | N | nano-of-day | number | 1234000000
156
+ * | | | |
157
+ * | V | time-zone ID | zone-id | America/Los_Angeles; Z; -08:30
158
+ * | z | time-zone name | zone-name | Pacific Standard Time; PST
159
+ * | X | zone-offset 'Z' for zero | offset-X | Z; -08; -0830; -08:30; -083015; -08:30:15;
160
+ * | x | zone-offset | offset-x | +0000; -08; -0830; -08:30; -083015; -08:30:15;
161
+ * | Z | zone-offset | offset-Z | +0000; -0800; -08:00;
162
+ * | | | |
163
+ * | p | pad next | pad modifier | 1
164
+ * | | | |
165
+ * | ' | escape for text | delimiter |
166
+ * | '' | single quote | literal | '
167
+ * | [ | optional section start | |
168
+ * | ] | optional section end | |
169
+ * | {} | reserved for future use | |
170
+ * </pre>
171
+ *
172
+ * The count of pattern letters determine the format.
173
+ *
174
+ * **Text**: The text style is determined based on the number of pattern letters used.
175
+ * Less than 4 pattern letters will use the short form `TextStyle.SHORT`.
176
+ * Exactly 4 pattern letters will use the full form `TextStyle.FULL`.
177
+ * Exactly 5 pattern letters will use the narrow form `TextStyle.NARROW`.
178
+ *
179
+ * **NOTE**: since text styles require locale support, they are currently not supported in js-joda!
180
+ *
181
+ * **Number**: If the count of letters is one, then the value is printed using the minimum number
182
+ * of digits and without padding as per {@link DateTimeFormatterBuilder.appendValue}.
183
+ * Otherwise, the count of digits is used as the width of the output field as per
184
+ * {@link DateTimeFormatterBuilder.appendValue}.
185
+ *
186
+ * **Number/Text**: If the count of pattern letters is 3 or greater, use the Text rules above.
187
+ * Otherwise use the Number rules above.
188
+ *
189
+ * **Fraction**: Outputs the nano-of-second field as a fraction-of-second.
190
+ * The nano-of-second value has nine digits, thus the count of pattern letters is from 1 to 9.
191
+ * If it is less than 9, then the nano-of-second value is truncated, with only the most
192
+ * significant digits being output.
193
+ * When parsing in strict mode, the number of parsed digits must match the count of pattern letters.
194
+ * When parsing in lenient mode, the number of parsed digits must be at least the count of pattern
195
+ * letters, up to 9 digits.
196
+ *
197
+ * **Year**: The count of letters determines the minimum field width below which padding is used.
198
+ * If the count of letters is two, then a {@link DateTimeFormatterBuilder.appendValueReduced}
199
+ * two digit form is used.
200
+ * For printing, this outputs the rightmost two digits. For parsing, this will parse using the
201
+ * base value of 2000, resulting in a year within the range 2000 to 2099 inclusive.
202
+ * If the count of letters is less than four (but not two), then the sign is only output for negative
203
+ * years as per `SignStyle.NORMAL`.
204
+ * Otherwise, the sign is output if the pad width is exceeded, as per `SignStyle.EXCEEDS_PAD`
205
+ *
206
+ * **ZoneId**: This outputs the time-zone ID, such as 'Europe/Paris'.
207
+ * If the count of letters is two, then the time-zone ID is output.
208
+ * Any other count of letters throws `IllegalArgumentException`.
209
+ *
210
+ * **Zone names**: This outputs the display name of the time-zone ID.
211
+ * If the count of letters is one, two or three, then the short name is output.
212
+ * If the count of letters is four, then the full name is output.
213
+ * Five or more letters throws `IllegalArgumentException`.
214
+ *
215
+ * **NOTE**: since zone ids and name require the iana tzdb, they are currently not supported in js-joda!
216
+ *
217
+ * **Offset X and x**: This formats the offset based on the number of pattern letters.
218
+ * One letter outputs just the hour', such as '+01', unless the minute is non-zero
219
+ * in which case the minute is also output, such as '+0130'.
220
+ * Two letters outputs the hour and minute, without a colon, such as '+0130'.
221
+ * Three letters outputs the hour and minute, with a colon, such as '+01:30'.
222
+ * Four letters outputs the hour and minute and optional second, without a colon, such as '+013015'.
223
+ * Five letters outputs the hour and minute and optional second, with a colon, such as '+01:30:15'.
224
+ * Six or more letters throws `IllegalArgumentException`.
225
+ * Pattern letter 'X' (upper case) will output 'Z' when the offset to be output would be zero,
226
+ * whereas pattern letter 'x' (lower case) will output '+00', '+0000', or '+00:00'.
227
+ *
228
+ * **Offset Z**: This formats the offset based on the number of pattern letters.
229
+ * One, two or three letters outputs the hour and minute, without a colon, such as '+0130'.
230
+ * Four or more letters throws `IllegalArgumentException`.
231
+ * The output will be '+0000' when the offset is zero.
232
+ *
233
+ * **Optional section**: The optional section markers work exactly like calling
234
+ * {@link DateTimeFormatterBuilder.optionalStart} and {@link DateTimeFormatterBuilder.optionalEnd}.
235
+ *
236
+ * **Pad modifier**: Modifies the pattern that immediately follows to be padded with spaces.
237
+ * The pad width is determined by the number of pattern letters.
238
+ * This is the same as calling {@link DateTimeFormatterBuilder.padNext}.
239
+ *
240
+ * For example, 'ppH' outputs the hour-of-day padded on the left with spaces to a width of 2.
241
+ *
242
+ * Any unrecognized letter is an error.
243
+ * Any non-letter character, other than '[', ']', '{', '}' and the single quote will be output directly.
244
+ * Despite this, it is recommended to use single quotes around all characters that you want to
245
+ * output directly to ensure that future changes do not break your application.
246
+ *
247
+ * @param {String} pattern the pattern to use, not null
248
+ * @return {DateTimeFormatter} the formatter based on the pattern, not null
249
+ * @throws IllegalArgumentException if the pattern is invalid
250
+ * @see DateTimeFormatterBuilder#appendPattern(String)
251
+ * @example
252
+ * var s = LocalDate.parse('2016-04-01').format(DateTimeFormatter.ofPattern('d MM yyyy'));
253
+ * console.log(s); // '1 04 2016'
254
+ *
255
+ */
256
+ static ofPattern(pattern) {
257
+ return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
258
+ }
259
+
260
+
261
+ //-----------------------------------------------------------------------
262
+ /**
263
+ * Constructor.
264
+ *
265
+ * @param printerParser the printer/parser to use, not null
266
+ * @param locale the locale to use, not null
267
+ * @param decimalStyle the decimal style to use, not null
268
+ * @param resolverStyle the resolver style to use, not null
269
+ * @param resolverFields the fields to use during resolving, null for all fields
270
+ * @param chrono the chronology to use, null for no override
271
+ * @param zone the zone to use, null for no override
272
+ * @private
273
+ */
274
+ constructor(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono=IsoChronology.INSTANCE, zone) {
275
+ assert(printerParser != null);
276
+ assert(decimalStyle != null);
277
+ assert(resolverStyle != null);
278
+ /**
279
+ * The printer and/or parser to use, not null.
280
+ */
281
+ this._printerParser = printerParser;
282
+ /**
283
+ * The locale to use for formatting. // nyi
284
+ */
285
+ this._locale = locale;
286
+ /**
287
+ * The symbols to use for formatting, not null.
288
+ */
289
+ this._decimalStyle = decimalStyle;
290
+ /**
291
+ * The resolver style to use, not null.
292
+ */
293
+ this._resolverStyle = resolverStyle;
294
+ /**
295
+ * The fields to use in resolving, null for all fields.
296
+ */
297
+ this._resolverFields = resolverFields;
298
+ /**
299
+ * The chronology to use for formatting, null for no override.
300
+ */
301
+ this._chrono = chrono;
302
+ /**
303
+ * The zone to use for formatting, null for no override. // nyi
304
+ */
305
+ this._zone = zone;
306
+ }
307
+
308
+ locale() {
309
+ return this._locale;
310
+ }
311
+
312
+ decimalStyle() {
313
+ return this._decimalStyle;
314
+ }
315
+
316
+ chronology() {
317
+ return this._chrono;
318
+ }
319
+
320
+ /**
321
+ * Returns a copy of this formatter with a new override chronology.
322
+ *
323
+ * This returns a formatter with similar state to this formatter but
324
+ * with the override chronology set.
325
+ * By default, a formatter has no override chronology, returning null.
326
+ *
327
+ * If an override is added, then any date that is printed or parsed will be affected.
328
+ *
329
+ * When printing, if the {@link Temporal} object contains a date then it will
330
+ * be converted to a date in the override chronology.
331
+ * Any time or zone will be retained unless overridden.
332
+ * The converted result will behave in a manner equivalent to an implementation
333
+ * of {@link ChronoLocalDate},{@link ChronoLocalDateTime} or {@link ChronoZonedDateTime}.
334
+ *
335
+ * When parsing, the override chronology will be used to interpret the
336
+ * {@link ChronoField} into a date unless the
337
+ * formatter directly parses a valid chronology.
338
+ *
339
+ * This instance is immutable and unaffected by this method call.
340
+ *
341
+ * @param chrono the new chronology, not null
342
+ * @return a formatter based on this formatter with the requested override chronology, not null
343
+ */
344
+ withChronology(chrono) {
345
+ if (this._chrono != null && this._chrono.equals(chrono)) {
346
+ return this;
347
+ }
348
+ return new DateTimeFormatter(this._printerParser, this._locale, this._decimalStyle,
349
+ this._resolverStyle, this._resolverFields, chrono, this._zone);
350
+ }
351
+
352
+ /**
353
+ * not yet supported
354
+ * @returns {DateTimeFormatter}
355
+ */
356
+ withLocale(){
357
+ return this;
358
+ }
359
+
360
+ /**
361
+ * Returns a copy of this formatter with a new resolver style.
362
+ * <p>
363
+ * This returns a formatter with similar state to this formatter but
364
+ * with the resolver style set. By default, a formatter has the
365
+ * {@link ResolverStyle#SMART SMART} resolver style.
366
+ * <p>
367
+ * Changing the resolver style only has an effect during parsing.
368
+ * Parsing a text string occurs in two phases.
369
+ * Phase 1 is a basic text parse according to the fields added to the builder.
370
+ * Phase 2 resolves the parsed field-value pairs into date and/or time objects.
371
+ * The resolver style is used to control how phase 2, resolving, happens.
372
+ * See {@link ResolverStyle} for more information on the options available.
373
+ * <p>
374
+ * This instance is immutable and unaffected by this method call.
375
+ *
376
+ * @param {ResolverStyle} resolverStyle the new resolver style, not null
377
+ * @return {DateTimeFormatter} a formatter based on this formatter with the requested resolver style, not null
378
+ */
379
+ withResolverStyle(resolverStyle) {
380
+ requireNonNull(resolverStyle, 'resolverStyle');
381
+ if (resolverStyle.equals(this._resolverStyle)) {
382
+ return this;
383
+ }
384
+ return new DateTimeFormatter(this._printerParser, this._locale, this._decimalStyle, resolverStyle, this._resolverFields, this._chrono, this._zone);
385
+ }
386
+ //-----------------------------------------------------------------------
387
+ /**
388
+ * Formats a date-time object using this formatter.
389
+ *
390
+ * This formats the date-time to a String using the rules of the formatter.
391
+ *
392
+ * @param {TemporalAccessor} temporal the temporal object to print, not null
393
+ * @return {String} the printed string, not null
394
+ * @throws DateTimeException if an error occurs during formatting
395
+ */
396
+ format(temporal) {
397
+ const buf = new StringBuilder(32);
398
+ this._formatTo(temporal, buf);
399
+ return buf.toString();
400
+ }
401
+
402
+ //-----------------------------------------------------------------------
403
+ /**
404
+ * Formats a date-time object to an {@link Appendable} using this formatter.
405
+ *
406
+ * This formats the date-time to the specified destination.
407
+ * {@link Appendable} is a general purpose interface that is implemented by all
408
+ * key character output classes including {@link StringBuffer}, {@link StringBuilder},
409
+ * {@link PrintStream} and {@link Writer}.
410
+ *
411
+ * Although {@link Appendable} methods throw an {@link IOException}, this method does not.
412
+ * Instead, any {@link IOException} is wrapped in a runtime exception.
413
+ *
414
+ * @param {TemporalAccessor} temporal - the temporal object to print, not null
415
+ * @param {StringBuilder} appendable - the appendable to print to, not null
416
+ * @throws DateTimeException if an error occurs during formatting
417
+ */
418
+ _formatTo(temporal, appendable) {
419
+ requireNonNull(temporal, 'temporal');
420
+ requireNonNull(appendable, 'appendable');
421
+ const context = new DateTimePrintContext(temporal, this);
422
+ this._printerParser.print(context, appendable);
423
+ }
424
+
425
+ /**
426
+ * function overloading for {@link DateTimeFormatter.parse}
427
+ *
428
+ * if called with one arg {@link DateTimeFormatter.parse1} is called
429
+ * otherwise {@link DateTimeFormatter.parse2}
430
+ *
431
+ * @param {string} text
432
+ * @param {TemporalQuery} type
433
+ * @return {TemporalAccessor}
434
+ */
435
+ parse(text, type){
436
+ if(arguments.length === 1){
437
+ return this.parse1(text);
438
+ } else {
439
+ return this.parse2(text, type);
440
+ }
441
+ }
442
+
443
+ /**
444
+ * Fully parses the text producing a temporal object.
445
+ *
446
+ * This parses the entire text producing a temporal object.
447
+ * It is typically more useful to use {@link parse}.
448
+ * The result of this method is {@link TemporalAccessor} which has been resolved,
449
+ * applying basic validation checks to help ensure a valid date-time.
450
+ *
451
+ * If the parse completes without reading the entire length of the text,
452
+ * or a problem occurs during parsing or merging, then an exception is thrown.
453
+ *
454
+ * @param {String} text the text to parse, not null
455
+ * @return {TemporalAccessor} the parsed temporal object, not null
456
+ * @throws DateTimeParseException if unable to parse the requested result
457
+ */
458
+ parse1(text) {
459
+ requireNonNull(text, 'text');
460
+ try {
461
+ return this._parseToBuilder(text, null).resolve(this._resolverStyle, this._resolverFields);
462
+ } catch (ex) {
463
+ if(ex instanceof DateTimeParseException){
464
+ throw ex;
465
+ } else {
466
+ throw this._createError(text, ex);
467
+ }
468
+ }
469
+ }
470
+
471
+ /**
472
+ * Fully parses the text producing a temporal object.
473
+ *
474
+ * This parses the entire text producing a temporal object.
475
+ * It is typically more useful to use {@link parse}.
476
+ * The result of this method is {@link TemporalAccessor} which has been resolved,
477
+ * applying basic validation checks to help ensure a valid date-time.
478
+ *
479
+ * If the parse completes without reading the entire length of the text,
480
+ * or a problem occurs during parsing or merging, then an exception is thrown.
481
+ *
482
+ * @param text the text to parse, not null
483
+ * @param type the type to extract, not null
484
+ * @return the parsed temporal object, not null
485
+ * @throws DateTimeParseException if unable to parse the requested result
486
+ */
487
+ parse2(text, type) {
488
+ requireNonNull(text, 'text');
489
+ requireNonNull(type, 'type');
490
+ try {
491
+ const builder = this._parseToBuilder(text, null).resolve(this._resolverStyle, this._resolverFields);
492
+ return builder.build(type);
493
+ } catch (ex) {
494
+ if(ex instanceof DateTimeParseException){
495
+ throw ex;
496
+ } else {
497
+ throw this._createError(text, ex);
498
+ }
499
+ }
500
+ }
501
+
502
+ _createError(text, ex) {
503
+ let abbr = '';
504
+ if (text.length > 64) {
505
+ abbr = text.substring(0, 64) + '...';
506
+ } else {
507
+ abbr = text;
508
+ }
509
+ return new DateTimeParseException('Text \'' + abbr + '\' could not be parsed: ' + ex.message, text, 0, ex);
510
+ }
511
+
512
+
513
+ /**
514
+ * Parses the text to a builder.
515
+ *
516
+ * This parses to a {@link DateTimeBuilder} ensuring that the text is fully parsed.
517
+ * This method throws {@link DateTimeParseException} if unable to parse, or
518
+ * some other {@link DateTimeException} if another date/time problem occurs.
519
+ *
520
+ * @param text the text to parse, not null
521
+ * @param position the position to parse from, updated with length parsed
522
+ * and the index of any error, null if parsing whole string
523
+ * @return the engine representing the result of the parse, not null
524
+ * @throws DateTimeParseException if the parse fails
525
+ */
526
+ _parseToBuilder(text, position) {
527
+ const pos = (position != null ? position : new ParsePosition(0));
528
+ const result = this._parseUnresolved0(text, pos);
529
+ if (result == null || pos.getErrorIndex() >= 0 || (position == null && pos.getIndex() < text.length)) {
530
+ let abbr = '';
531
+ if (text.length > 64) {
532
+ abbr = text.substr(0, 64).toString() + '...';
533
+ } else {
534
+ abbr = text;
535
+ }
536
+ if (pos.getErrorIndex() >= 0) {
537
+ throw new DateTimeParseException('Text \'' + abbr + '\' could not be parsed at index ' +
538
+ pos.getErrorIndex(), text, pos.getErrorIndex());
539
+ } else {
540
+ throw new DateTimeParseException('Text \'' + abbr + '\' could not be parsed, unparsed text found at index ' +
541
+ pos.getIndex(), text, pos.getIndex());
542
+ }
543
+ }
544
+ return result.toBuilder();
545
+ }
546
+
547
+ /**
548
+ * Parses the text using this formatter, without resolving the result, intended
549
+ * for advanced use cases.
550
+ *
551
+ * Parsing is implemented as a two-phase operation.
552
+ * First, the text is parsed using the layout defined by the formatter, producing
553
+ * a {@link Map} of field to value, a {@link ZoneId} and a {@link Chronology}.
554
+ * Second, the parsed data is *resolved*, by validating, combining and
555
+ * simplifying the various fields into more useful ones.
556
+ * This method performs the parsing stage but not the resolving stage.
557
+ *
558
+ * The result of this method is {@link TemporalAccessor} which represents the
559
+ * data as seen in the input. Values are not validated, thus parsing a date string
560
+ * of '2012-00-65' would result in a temporal with three fields - year of '2012',
561
+ * month of '0' and day-of-month of '65'.
562
+ *
563
+ * The text will be parsed from the specified start {@link ParsePosition}.
564
+ * The entire length of the text does not have to be parsed, the {@link ParsePosition}
565
+ * will be updated with the index at the end of parsing.
566
+ *
567
+ * Errors are returned using the error index field of the {@link ParsePosition}
568
+ * instead of {@link DateTimeParseException}.
569
+ * The returned error index will be set to an index indicative of the error.
570
+ * Callers must check for errors before using the context.
571
+ *
572
+ * If the formatter parses the same field more than once with different values,
573
+ * the result will be an error.
574
+ *
575
+ * This method is intended for advanced use cases that need access to the
576
+ * internal state during parsing. Typical application code should use
577
+ * {@link parse} or the parse method on the target type.
578
+ *
579
+ * @param text the text to parse, not null
580
+ * @param position the position to parse from, updated with length parsed
581
+ * and the index of any error, not null
582
+ * @return the parsed text, null if the parse results in an error
583
+ * @throws DateTimeException if some problem occurs during parsing
584
+ * @throws IndexOutOfBoundsException if the position is invalid
585
+ */
586
+ parseUnresolved(text, position) {
587
+ return this._parseUnresolved0(text, position);
588
+ }
589
+
590
+ _parseUnresolved0(text, position) {
591
+ assert(text != null, 'text', NullPointerException);
592
+ assert(position != null, 'position', NullPointerException);
593
+ const context = new DateTimeParseContext(this);
594
+ let pos = position.getIndex();
595
+ pos = this._printerParser.parse(context, text, pos);
596
+ if (pos < 0) {
597
+ position.setErrorIndex(~pos); // index not updated from input
598
+ return null;
599
+ }
600
+ position.setIndex(pos); // errorIndex not updated from input
601
+ return context.toParsed();
602
+ }
603
+
604
+ /**
605
+ * Returns the formatter as a composite printer parser.
606
+ *
607
+ * @param {boolean} optional whether the printer/parser should be optional
608
+ * @return {CompositePrinterParser} the printer/parser, not null
609
+ */
610
+ _toPrinterParser(optional) {
611
+ return this._printerParser.withOptional(optional);
612
+ }
613
+
614
+ /**
615
+ *
616
+ * @returns {string}
617
+ */
618
+ toString() {
619
+ const pattern = this._printerParser.toString();
620
+ return pattern.indexOf('[') === 0 ? pattern : pattern.substring(1, pattern.length - 1);
621
+ }
622
+
623
+ }
624
+
625
+ export function _init() {
626
+
627
+ DateTimeFormatter.ISO_LOCAL_DATE = new DateTimeFormatterBuilder()
628
+ .appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
629
+ .appendLiteral('-')
630
+ .appendValue(ChronoField.MONTH_OF_YEAR, 2)
631
+ .appendLiteral('-')
632
+ .appendValue(ChronoField.DAY_OF_MONTH, 2)
633
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
634
+
635
+ DateTimeFormatter.ISO_LOCAL_TIME = new DateTimeFormatterBuilder()
636
+ .appendValue(ChronoField.HOUR_OF_DAY, 2)
637
+ .appendLiteral(':')
638
+ .appendValue(ChronoField.MINUTE_OF_HOUR, 2)
639
+ .optionalStart()
640
+ .appendLiteral(':')
641
+ .appendValue(ChronoField.SECOND_OF_MINUTE, 2)
642
+ .optionalStart()
643
+ .appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true)
644
+ .toFormatter(ResolverStyle.STRICT);
645
+
646
+ DateTimeFormatter.ISO_LOCAL_DATE_TIME = new DateTimeFormatterBuilder()
647
+ .parseCaseInsensitive()
648
+ .append(DateTimeFormatter.ISO_LOCAL_DATE)
649
+ .appendLiteral('T')
650
+ .append(DateTimeFormatter.ISO_LOCAL_TIME)
651
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
652
+
653
+ DateTimeFormatter.ISO_INSTANT = new DateTimeFormatterBuilder()
654
+ .parseCaseInsensitive()
655
+ .appendInstant()
656
+ .toFormatter(ResolverStyle.STRICT);
657
+
658
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder()
659
+ .parseCaseInsensitive()
660
+ .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
661
+ .appendOffsetId()
662
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
663
+
664
+ DateTimeFormatter.ISO_ZONED_DATE_TIME = new DateTimeFormatterBuilder()
665
+ .append(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
666
+ .optionalStart()
667
+ .appendLiteral('[')
668
+ .parseCaseSensitive()
669
+ .appendZoneId()
670
+ // .appendZoneRegionId()
671
+ .appendLiteral(']')
672
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
673
+
674
+ DateTimeFormatter.BASIC_ISO_DATE = new DateTimeFormatterBuilder()
675
+ .appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
676
+ .appendValue(ChronoField.MONTH_OF_YEAR, 2)
677
+ .appendValue(ChronoField.DAY_OF_MONTH, 2)
678
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
679
+
680
+ DateTimeFormatter.ISO_OFFSET_DATE = new DateTimeFormatterBuilder()
681
+ .parseCaseInsensitive()
682
+ .append(DateTimeFormatter.ISO_LOCAL_DATE)
683
+ .appendOffsetId()
684
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
685
+
686
+ DateTimeFormatter.ISO_OFFSET_TIME = new DateTimeFormatterBuilder()
687
+ .parseCaseInsensitive()
688
+ .append(DateTimeFormatter.ISO_LOCAL_TIME)
689
+ .appendOffsetId()
690
+ .toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
691
+
692
+ DateTimeFormatter.ISO_ORDINAL_DATE = new DateTimeFormatterBuilder()
693
+ .appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
694
+ .appendLiteral('-')
695
+ .appendValue(ChronoField.DAY_OF_YEAR)
696
+ .toFormatter(ResolverStyle.STRICT);
697
+
698
+ DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder()
699
+ .appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
700
+ .appendLiteral('-W')
701
+ .appendValue(ChronoField.ALIGNED_WEEK_OF_YEAR)
702
+ .appendLiteral('-')
703
+ .appendValue(ChronoField.DAY_OF_WEEK)
704
+ .toFormatter(ResolverStyle.STRICT);
705
+
706
+ // TODO:
707
+ // ISO_DATE - https://www.threeten.org/threetenbp/apidocs/org/threeten/bp/format/DateTimeFormatter.html#ISO_DATE
708
+ // ISO_TIME - https://www.threeten.org/threetenbp/apidocs/org/threeten/bp/format/DateTimeFormatter.html#ISO_TIME
709
+ // ISO_DATE_TIME - https://www.threeten.org/threetenbp/apidocs/org/threeten/bp/format/DateTimeFormatter.html#ISO_DATE_TIME
710
+
711
+ DateTimeFormatter.PARSED_EXCESS_DAYS = createTemporalQuery('PARSED_EXCESS_DAYS', (temporal) => {
712
+ if (temporal instanceof DateTimeBuilder) {
713
+ return temporal.excessDays;
714
+ } else {
715
+ return Period.ZERO;
716
+ }
717
+ });
718
+
719
+ DateTimeFormatter.PARSED_LEAP_SECOND = createTemporalQuery('PARSED_LEAP_SECOND', (temporal) => {
720
+ if (temporal instanceof DateTimeBuilder) {
721
+ return temporal.leapSecond;
722
+ } else {
723
+ return false;
724
+ }
725
+ });
726
+
727
+
728
+ }