@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.
- package/LICENSE +28 -0
- package/README.md +707 -0
- package/dist/application/app.d.ts +138 -0
- package/dist/application/app.js +654 -0
- package/dist/application/operations.d.ts +9 -0
- package/dist/application/operations.js +96 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +460 -0
- package/dist/cli/help.d.ts +4 -0
- package/dist/cli/help.js +49 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +13 -0
- package/dist/cli/onboarding.d.ts +14 -0
- package/dist/cli/onboarding.js +144 -0
- package/dist/cli/output.d.ts +2 -0
- package/dist/cli/output.js +231 -0
- package/dist/cli/terminal.d.ts +6 -0
- package/dist/cli/terminal.js +92 -0
- package/dist/cli/update-check.d.ts +1 -0
- package/dist/cli/update-check.js +12 -0
- package/dist/cli/updates.d.ts +2 -0
- package/dist/cli/updates.js +98 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +14 -0
- package/dist/doctor/credential-probe.d.ts +7 -0
- package/dist/doctor/credential-probe.js +49 -0
- package/dist/doctor/doctor.d.ts +4 -0
- package/dist/doctor/doctor.js +213 -0
- package/dist/doctor/keyring.d.ts +7 -0
- package/dist/doctor/keyring.js +150 -0
- package/dist/doctor/profile.d.ts +19 -0
- package/dist/doctor/profile.js +73 -0
- package/dist/doctor/types.d.ts +40 -0
- package/dist/doctor/types.js +1 -0
- package/dist/domain/amount.d.ts +6 -0
- package/dist/domain/amount.js +27 -0
- package/dist/domain/errors.d.ts +10 -0
- package/dist/domain/errors.js +16 -0
- package/dist/labels/directory.d.ts +87 -0
- package/dist/labels/directory.js +140 -0
- package/dist/labels/personal.d.ts +17 -0
- package/dist/labels/personal.js +56 -0
- package/dist/labels/presentation.d.ts +154 -0
- package/dist/labels/presentation.js +90 -0
- package/dist/network/reader.d.ts +31 -0
- package/dist/network/reader.js +370 -0
- package/dist/network/retry.d.ts +7 -0
- package/dist/network/retry.js +53 -0
- package/dist/network/work.d.ts +3 -0
- package/dist/network/work.js +66 -0
- package/dist/pricing/market.d.ts +29 -0
- package/dist/pricing/market.js +150 -0
- package/dist/pricing/terms.d.ts +6 -0
- package/dist/pricing/terms.js +12 -0
- package/dist/spending/destination.d.ts +16 -0
- package/dist/spending/destination.js +42 -0
- package/dist/spending/journal.d.ts +28 -0
- package/dist/spending/journal.js +69 -0
- package/dist/spending/ledger.d.ts +118 -0
- package/dist/spending/ledger.js +444 -0
- package/dist/spending/payments.d.ts +67 -0
- package/dist/spending/payments.js +424 -0
- package/dist/spending/pool.d.ts +13 -0
- package/dist/spending/pool.js +38 -0
- package/dist/spending/reconcile.d.ts +18 -0
- package/dist/spending/reconcile.js +64 -0
- package/dist/storage/profiles.d.ts +13 -0
- package/dist/storage/profiles.js +86 -0
- package/dist/storage/secrets.d.ts +16 -0
- package/dist/storage/secrets.js +104 -0
- package/dist/storage/state.d.ts +32 -0
- package/dist/storage/state.js +255 -0
- package/dist/wallet/auto-receive.d.ts +57 -0
- package/dist/wallet/auto-receive.js +140 -0
- package/dist/wallet/defaults.d.ts +3 -0
- package/dist/wallet/defaults.js +26 -0
- package/dist/wallet/signing.d.ts +17 -0
- package/dist/wallet/signing.js +128 -0
- package/dist/wallet/types.d.ts +65 -0
- package/dist/wallet/types.js +1 -0
- package/dist/wallet/work.d.ts +29 -0
- package/dist/wallet/work.js +154 -0
- package/dist/watches/manager.d.ts +75 -0
- package/dist/watches/manager.js +197 -0
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +6678 -0
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/LICENSE +28 -0
- package/node_modules/@attocash/commons-core/README.md +118 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +1036 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs +7701 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +17681 -0
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
- package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +209 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +2284 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +6042 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/package.json +27 -0
- package/node_modules/@attocash/commons-node/LICENSE +28 -0
- package/node_modules/@attocash/commons-node/README.md +92 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +255 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs +2977 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/package.json +29 -0
- package/node_modules/@attocash/commons-node-remote/LICENSE +28 -0
- package/node_modules/@attocash/commons-node-remote/README.md +61 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +122 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +1810 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/package.json +31 -0
- package/node_modules/@attocash/commons-transport/LICENSE +28 -0
- package/node_modules/@attocash/commons-transport/README.md +5 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +64 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +249 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +263 -0
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +11604 -0
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +499 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +6456 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +83 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +1714 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +3197 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +2290 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +46 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +482 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +165 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs +4 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +3222 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs +4 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +1485 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/package.json +29 -0
- package/node_modules/@attocash/commons-worker/LICENSE +28 -0
- package/node_modules/@attocash/commons-worker/README.md +48 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +73 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +702 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/package.json +29 -0
- package/node_modules/@attocash/commons-worker-remote/LICENSE +28 -0
- package/node_modules/@attocash/commons-worker-remote/README.md +60 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +93 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +289 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/package.json +31 -0
- package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
- package/node_modules/@js-joda/core/CheatSheet.md +947 -0
- package/node_modules/@js-joda/core/LICENSE +34 -0
- package/node_modules/@js-joda/core/README.md +155 -0
- package/node_modules/@js-joda/core/bower.json +21 -0
- package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
- package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
- package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
- package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
- package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
- package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
- package/node_modules/@js-joda/core/package.json +76 -0
- package/node_modules/@js-joda/core/src/Clock.js +330 -0
- package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
- package/node_modules/@js-joda/core/src/Duration.js +1205 -0
- package/node_modules/@js-joda/core/src/Enum.js +30 -0
- package/node_modules/@js-joda/core/src/Instant.js +1012 -0
- package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
- package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
- package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
- package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
- package/node_modules/@js-joda/core/src/Month.js +600 -0
- package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
- package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
- package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
- package/node_modules/@js-joda/core/src/Period.js +933 -0
- package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
- package/node_modules/@js-joda/core/src/Year.js +1015 -0
- package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
- package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
- package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
- package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
- package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
- package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
- package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
- package/node_modules/@js-joda/core/src/_init.js +68 -0
- package/node_modules/@js-joda/core/src/assert.js +33 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
- package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
- package/node_modules/@js-joda/core/src/convert.js +83 -0
- package/node_modules/@js-joda/core/src/errors.js +54 -0
- package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
- package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
- package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
- package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
- package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
- package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
- package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
- package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
- package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
- package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
- package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
- package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
- package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
- package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
- package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
- package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
- package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
- package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
- package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
- package/node_modules/@js-joda/core/src/js-joda.js +210 -0
- package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
- package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
- package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
- package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
- package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
- package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
- package/node_modules/@js-joda/core/src/use.js +20 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
- package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
- package/node_modules/@noble/hashes/LICENSE +21 -0
- package/node_modules/@noble/hashes/README.md +563 -0
- package/node_modules/@noble/hashes/_blake.d.ts +21 -0
- package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_blake.js +52 -0
- package/node_modules/@noble/hashes/_blake.js.map +1 -0
- package/node_modules/@noble/hashes/_md.d.ts +99 -0
- package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_md.js +202 -0
- package/node_modules/@noble/hashes/_md.js.map +1 -0
- package/node_modules/@noble/hashes/_u64.d.ts +63 -0
- package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_u64.js +84 -0
- package/node_modules/@noble/hashes/_u64.js.map +1 -0
- package/node_modules/@noble/hashes/argon2.d.ts +112 -0
- package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/argon2.js +517 -0
- package/node_modules/@noble/hashes/argon2.js.map +1 -0
- package/node_modules/@noble/hashes/blake1.d.ts +156 -0
- package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake1.js +560 -0
- package/node_modules/@noble/hashes/blake1.js.map +1 -0
- package/node_modules/@noble/hashes/blake2.d.ts +184 -0
- package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake2.js +501 -0
- package/node_modules/@noble/hashes/blake2.js.map +1 -0
- package/node_modules/@noble/hashes/blake3.d.ts +68 -0
- package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake3.js +284 -0
- package/node_modules/@noble/hashes/blake3.js.map +1 -0
- package/node_modules/@noble/hashes/eskdf.d.ts +92 -0
- package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/eskdf.js +218 -0
- package/node_modules/@noble/hashes/eskdf.js.map +1 -0
- package/node_modules/@noble/hashes/hkdf.d.ts +64 -0
- package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hkdf.js +120 -0
- package/node_modules/@noble/hashes/hkdf.js.map +1 -0
- package/node_modules/@noble/hashes/hmac.d.ts +47 -0
- package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hmac.js +93 -0
- package/node_modules/@noble/hashes/hmac.js.map +1 -0
- package/node_modules/@noble/hashes/index.d.ts +2 -0
- package/node_modules/@noble/hashes/index.d.ts.map +1 -0
- package/node_modules/@noble/hashes/index.js +35 -0
- package/node_modules/@noble/hashes/index.js.map +1 -0
- package/node_modules/@noble/hashes/legacy.d.ts +102 -0
- package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
- package/node_modules/@noble/hashes/legacy.js +327 -0
- package/node_modules/@noble/hashes/legacy.js.map +1 -0
- package/node_modules/@noble/hashes/package.json +97 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts +56 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/pbkdf2.js +135 -0
- package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
- package/node_modules/@noble/hashes/scrypt.d.ts +65 -0
- package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
- package/node_modules/@noble/hashes/scrypt.js +257 -0
- package/node_modules/@noble/hashes/scrypt.js.map +1 -0
- package/node_modules/@noble/hashes/sha2.d.ts +249 -0
- package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha2.js +458 -0
- package/node_modules/@noble/hashes/sha2.js.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts +461 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.js +783 -0
- package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
- package/node_modules/@noble/hashes/sha3.d.ts +199 -0
- package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3.js +431 -0
- package/node_modules/@noble/hashes/sha3.js.map +1 -0
- package/node_modules/@noble/hashes/src/_blake.ts +57 -0
- package/node_modules/@noble/hashes/src/_md.ts +222 -0
- package/node_modules/@noble/hashes/src/_u64.ts +117 -0
- package/node_modules/@noble/hashes/src/argon2.ts +667 -0
- package/node_modules/@noble/hashes/src/blake1.ts +614 -0
- package/node_modules/@noble/hashes/src/blake2.ts +582 -0
- package/node_modules/@noble/hashes/src/blake3.ts +317 -0
- package/node_modules/@noble/hashes/src/eskdf.ts +259 -0
- package/node_modules/@noble/hashes/src/hkdf.ts +133 -0
- package/node_modules/@noble/hashes/src/hmac.ts +126 -0
- package/node_modules/@noble/hashes/src/index.ts +33 -0
- package/node_modules/@noble/hashes/src/legacy.ts +339 -0
- package/node_modules/@noble/hashes/src/pbkdf2.ts +175 -0
- package/node_modules/@noble/hashes/src/scrypt.ts +315 -0
- package/node_modules/@noble/hashes/src/sha2.ts +530 -0
- package/node_modules/@noble/hashes/src/sha3-addons.ts +983 -0
- package/node_modules/@noble/hashes/src/sha3.ts +485 -0
- package/node_modules/@noble/hashes/src/utils.ts +848 -0
- package/node_modules/@noble/hashes/src/webcrypto.ts +239 -0
- package/node_modules/@noble/hashes/utils.d.ts +519 -0
- package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
- package/node_modules/@noble/hashes/utils.js +578 -0
- package/node_modules/@noble/hashes/utils.js.map +1 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts +120 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
- package/node_modules/@noble/hashes/webcrypto.js +165 -0
- package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +53 -0
|
@@ -0,0 +1,600 @@
|
|
|
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, requireInstance} from './assert';
|
|
8
|
+
import {MathUtil} from './MathUtil';
|
|
9
|
+
|
|
10
|
+
import {ChronoField} from './temporal/ChronoField';
|
|
11
|
+
import {ChronoUnit} from './temporal/ChronoUnit';
|
|
12
|
+
import {DateTimeException, IllegalArgumentException, UnsupportedTemporalTypeException} from './errors';
|
|
13
|
+
import {IsoChronology} from './chrono/IsoChronology';
|
|
14
|
+
import {TemporalAccessor} from './temporal/TemporalAccessor';
|
|
15
|
+
import {TemporalQueries} from './temporal/TemporalQueries';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A month-of-year, such as 'July'.
|
|
19
|
+
*
|
|
20
|
+
* {@link Month} is representing the 12 months of the year -
|
|
21
|
+
* January, February, March, April, May, June, July, August, September, October,
|
|
22
|
+
* November and December.
|
|
23
|
+
*
|
|
24
|
+
* In addition to the textual name, each month-of-year has an `int` value.
|
|
25
|
+
* The `int` value follows normal usage and the ISO-8601 standard,
|
|
26
|
+
* from 1 (January) to 12 (December). It is recommended that applications use the static values defined by this class
|
|
27
|
+
* rather than the `int` value to ensure code clarity.
|
|
28
|
+
*
|
|
29
|
+
* This class represents a common concept that is found in many calendar systems.
|
|
30
|
+
* As such, this class may be used by any calendar system that has the month-of-year
|
|
31
|
+
* concept defined exactly equivalent to the ISO-8601 calendar system.
|
|
32
|
+
*
|
|
33
|
+
* ### Static properties of Class {@link Month}
|
|
34
|
+
*
|
|
35
|
+
* Month.JANUARY, Month.FEBRUARY, Month.MARCH, Month.APRIL, Month.MAY, Month.JUNE,
|
|
36
|
+
* Month.JULY, Month.AUGUST, Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER, Month.DECEMBER
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export class Month extends TemporalAccessor {
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param {number} ordinal
|
|
44
|
+
* @param {string} name
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
constructor(value, name){
|
|
48
|
+
super();
|
|
49
|
+
this._value = MathUtil.safeToInt(value);
|
|
50
|
+
this._name = name;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @return {number} gets the value
|
|
56
|
+
*/
|
|
57
|
+
value() {
|
|
58
|
+
return this._value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @returns {number}
|
|
64
|
+
*/
|
|
65
|
+
ordinal(){
|
|
66
|
+
return this._value - 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @returns {string}
|
|
72
|
+
*/
|
|
73
|
+
name(){
|
|
74
|
+
return this._name;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the textual representation, such as 'Jan' or 'December'.
|
|
79
|
+
*
|
|
80
|
+
* This returns the textual name used to identify the month-of-year.
|
|
81
|
+
* The parameters control the length of the returned text and the locale.
|
|
82
|
+
*
|
|
83
|
+
* If no textual mapping is found then the numeric value (see {@link getValue}) is returned.
|
|
84
|
+
*
|
|
85
|
+
* @param {TextStyle} style - the length of the text required, not null
|
|
86
|
+
* @param {Locale} locale - the locale to use, not null
|
|
87
|
+
* @return {string} the text value of the day-of-week, not null
|
|
88
|
+
*/
|
|
89
|
+
// eslint-disable-next-line no-unused-vars
|
|
90
|
+
displayName(style, locale) {
|
|
91
|
+
// TODO:
|
|
92
|
+
throw new IllegalArgumentException('Pattern using (localized) text not implemented yet!');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Checks if the specified field is supported.
|
|
97
|
+
*
|
|
98
|
+
* This checks if this month-of-year can be queried for the specified field.
|
|
99
|
+
* If false, then calling the range (see {@link range}) and
|
|
100
|
+
* get (see {@link get}) methods will throw an exception.
|
|
101
|
+
*
|
|
102
|
+
* If the field is MONTH_OF_YEAR (see {@link ChronoField#MONTH_OF_YEAR}) then
|
|
103
|
+
* this method returns true.
|
|
104
|
+
* All other {@link ChronoField} instances will return false.
|
|
105
|
+
*
|
|
106
|
+
* If the field is not a {@link ChronoField}, then the result of this method
|
|
107
|
+
* is obtained by invoking {@link TemporalField.isSupportedBy}
|
|
108
|
+
* passing `this` as the argument.
|
|
109
|
+
* Whether the field is supported is determined by the field.
|
|
110
|
+
*
|
|
111
|
+
* @param {TemporalField} field - the field to check, null returns false
|
|
112
|
+
* @return {boolean} true if the field is supported on this month-of-year, false if not
|
|
113
|
+
*/
|
|
114
|
+
isSupported(field) {
|
|
115
|
+
if (null === field) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (field instanceof ChronoField) {
|
|
119
|
+
return field === ChronoField.MONTH_OF_YEAR;
|
|
120
|
+
}
|
|
121
|
+
return field != null && field.isSupportedBy(this);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Gets the value of the specified field from this month-of-year as an `int`.
|
|
126
|
+
*
|
|
127
|
+
* This queries this month for the value of the specified field.
|
|
128
|
+
* The returned value will always be within the valid range of values for the field.
|
|
129
|
+
* If it is not possible to return the value, because the field is not supported
|
|
130
|
+
* or for some other reason, an exception is thrown.
|
|
131
|
+
*
|
|
132
|
+
* If the field is MONTH_OF_YEAR (see {@link ChronoField#MONTH_OF_YEAR}) then the
|
|
133
|
+
* value of the month-of-year, from 1 to 12, will be returned.
|
|
134
|
+
* All other {@link ChronoField} instances will throw an {@link UnsupportedTemporalTypeException}.
|
|
135
|
+
*
|
|
136
|
+
* If the field is not a {@link ChronoField}, then the result of this method
|
|
137
|
+
* is obtained by invoking {@link TemporalField.getFrom}
|
|
138
|
+
* passing `this` as the argument. Whether the value can be obtained,
|
|
139
|
+
* and what the value represents, is determined by the field.
|
|
140
|
+
*
|
|
141
|
+
* @param {TemporalField} field - the field to get, not null
|
|
142
|
+
* @return {Number} the value for the field, within the valid range of values
|
|
143
|
+
* @throws DateTimeException if a value for the field cannot be obtained or
|
|
144
|
+
* the value is outside the range of valid values for the field
|
|
145
|
+
* @throws UnsupportedTemporalTypeException if the field is not supported or
|
|
146
|
+
* the range of values exceeds an `int`
|
|
147
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
148
|
+
*/
|
|
149
|
+
get(field) {
|
|
150
|
+
if (field === ChronoField.MONTH_OF_YEAR) {
|
|
151
|
+
return this.value();
|
|
152
|
+
}
|
|
153
|
+
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Gets the value of the specified field from this month-of-year as a `long`.
|
|
158
|
+
*
|
|
159
|
+
* This queries this month for the value of the specified field.
|
|
160
|
+
* If it is not possible to return the value, because the field is not supported
|
|
161
|
+
* or for some other reason, an exception is thrown.
|
|
162
|
+
*
|
|
163
|
+
* If the field is MONTH_OF_YEAR (see {@link ChronoField#MONTH_OF_YEAR}) then the
|
|
164
|
+
* value of the month-of-year, from 1 to 12, will be returned.
|
|
165
|
+
* All other {@link ChronoField} instances will throw an {@link UnsupportedTemporalTypeException}.
|
|
166
|
+
*
|
|
167
|
+
* If the field is not a {@link ChronoField}, then the result of this method
|
|
168
|
+
* is obtained by invoking {@link TemporalField.getFrom}
|
|
169
|
+
* passing `this` as the argument. Whether the value can be obtained,
|
|
170
|
+
* and what the value represents, is determined by the field.
|
|
171
|
+
*
|
|
172
|
+
* @param {TemporalField} field - the field to get, not null
|
|
173
|
+
* @return {Number} the value for the field
|
|
174
|
+
* @throws DateTimeException if a value for the field cannot be obtained
|
|
175
|
+
* @throws UnsupportedTemporalTypeException if the field is not supported
|
|
176
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
177
|
+
*/
|
|
178
|
+
getLong(field) {
|
|
179
|
+
if (field === ChronoField.MONTH_OF_YEAR) {
|
|
180
|
+
return this.value();
|
|
181
|
+
} else if (field instanceof ChronoField) {
|
|
182
|
+
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
|
|
183
|
+
}
|
|
184
|
+
return field.getFrom(this);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Returns the month-of-year that is the specified number of months after this one.
|
|
189
|
+
*
|
|
190
|
+
* The calculation rolls around the end of the year from December to January.
|
|
191
|
+
* The specified period may be negative.
|
|
192
|
+
*
|
|
193
|
+
* This instance is immutable and unaffected by this method call.
|
|
194
|
+
*
|
|
195
|
+
* @param {number} months - the months to add, positive or negative
|
|
196
|
+
* @return {Month} the resulting month, not null
|
|
197
|
+
*/
|
|
198
|
+
plus(months) {
|
|
199
|
+
const amount = MathUtil.intMod(months, 12) + 12; // + 12 to make sure negative arguments are positive, the total is "corrected" by the next % 12
|
|
200
|
+
let newMonthVal = MathUtil.intMod((this.value() + amount), 12);
|
|
201
|
+
/* December is 12, not 0, but 12 % 12 = 0 */
|
|
202
|
+
newMonthVal = newMonthVal === 0 ? 12 : newMonthVal;
|
|
203
|
+
return Month.of(newMonthVal);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Returns the month-of-year that is the specified number of months before this one.
|
|
208
|
+
*
|
|
209
|
+
* The calculation rolls around the start of the year from January to December.
|
|
210
|
+
* The specified period may be negative.
|
|
211
|
+
*
|
|
212
|
+
* This instance is immutable and unaffected by this method call.
|
|
213
|
+
*
|
|
214
|
+
* @param {number} months - the months to subtract, positive or negative
|
|
215
|
+
* @return {Month} the resulting month, not null
|
|
216
|
+
*/
|
|
217
|
+
minus(months) {
|
|
218
|
+
return this.plus(-1 * MathUtil.intMod(months, 12));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Gets the length of this month in days.
|
|
223
|
+
*
|
|
224
|
+
* This takes a flag to determine whether to return the length for a leap year or not.
|
|
225
|
+
*
|
|
226
|
+
* February has 28 days in a standard year and 29 days in a leap year.
|
|
227
|
+
* April, June, September and November have 30 days.
|
|
228
|
+
* All other months have 31 days.
|
|
229
|
+
*
|
|
230
|
+
* @param {boolean} leapYear - true if the length is required for a leap year
|
|
231
|
+
* @return {number} the length of this month in days, from 28 to 31
|
|
232
|
+
*/
|
|
233
|
+
length(leapYear) {
|
|
234
|
+
switch (this) {
|
|
235
|
+
case Month.FEBRUARY:
|
|
236
|
+
return (leapYear ? 29 : 28);
|
|
237
|
+
case Month.APRIL:
|
|
238
|
+
case Month.JUNE:
|
|
239
|
+
case Month.SEPTEMBER:
|
|
240
|
+
case Month.NOVEMBER:
|
|
241
|
+
return 30;
|
|
242
|
+
default:
|
|
243
|
+
return 31;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Gets the minimum length of this month in days.
|
|
249
|
+
*
|
|
250
|
+
* February has a minimum length of 28 days.
|
|
251
|
+
* April, June, September and November have 30 days.
|
|
252
|
+
* All other months have 31 days.
|
|
253
|
+
*
|
|
254
|
+
* @return {number} the minimum length of this month in days, from 28 to 31
|
|
255
|
+
*/
|
|
256
|
+
minLength() {
|
|
257
|
+
switch (this) {
|
|
258
|
+
case Month.FEBRUARY:
|
|
259
|
+
return 28;
|
|
260
|
+
case Month.APRIL:
|
|
261
|
+
case Month.JUNE:
|
|
262
|
+
case Month.SEPTEMBER:
|
|
263
|
+
case Month.NOVEMBER:
|
|
264
|
+
return 30;
|
|
265
|
+
default:
|
|
266
|
+
return 31;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Gets the maximum length of this month in days.
|
|
272
|
+
*
|
|
273
|
+
* February has a maximum length of 29 days.
|
|
274
|
+
* April, June, September and November have 30 days.
|
|
275
|
+
* All other months have 31 days.
|
|
276
|
+
*
|
|
277
|
+
* @return {number} the maximum length of this month in days, from 29 to 31
|
|
278
|
+
*/
|
|
279
|
+
maxLength() {
|
|
280
|
+
switch (this) {
|
|
281
|
+
case Month.FEBRUARY:
|
|
282
|
+
return 29;
|
|
283
|
+
case Month.APRIL:
|
|
284
|
+
case Month.JUNE:
|
|
285
|
+
case Month.SEPTEMBER:
|
|
286
|
+
case Month.NOVEMBER:
|
|
287
|
+
return 30;
|
|
288
|
+
default:
|
|
289
|
+
return 31;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Gets the day-of-year corresponding to the first day of this month.
|
|
295
|
+
*
|
|
296
|
+
* This returns the day-of-year that this month begins on, using the leap
|
|
297
|
+
* year flag to determine the length of February.
|
|
298
|
+
*
|
|
299
|
+
* @param {boolean} leapYear - true if the length is required for a leap year
|
|
300
|
+
* @return {number} the day of year corresponding to the first day of this month, from 1 to 336
|
|
301
|
+
*/
|
|
302
|
+
firstDayOfYear(leapYear) {
|
|
303
|
+
const leap = leapYear ? 1 : 0;
|
|
304
|
+
switch (this) {
|
|
305
|
+
case Month.JANUARY:
|
|
306
|
+
return 1;
|
|
307
|
+
case Month.FEBRUARY:
|
|
308
|
+
return 32;
|
|
309
|
+
case Month.MARCH:
|
|
310
|
+
return 60 + leap;
|
|
311
|
+
case Month.APRIL:
|
|
312
|
+
return 91 + leap;
|
|
313
|
+
case Month.MAY:
|
|
314
|
+
return 121 + leap;
|
|
315
|
+
case Month.JUNE:
|
|
316
|
+
return 152 + leap;
|
|
317
|
+
case Month.JULY:
|
|
318
|
+
return 182 + leap;
|
|
319
|
+
case Month.AUGUST:
|
|
320
|
+
return 213 + leap;
|
|
321
|
+
case Month.SEPTEMBER:
|
|
322
|
+
return 244 + leap;
|
|
323
|
+
case Month.OCTOBER:
|
|
324
|
+
return 274 + leap;
|
|
325
|
+
case Month.NOVEMBER:
|
|
326
|
+
return 305 + leap;
|
|
327
|
+
case Month.DECEMBER:
|
|
328
|
+
default:
|
|
329
|
+
return 335 + leap;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Gets the month corresponding to the first month of this quarter.
|
|
335
|
+
*
|
|
336
|
+
* The year can be divided into four quarters.
|
|
337
|
+
* This method returns the first month of the quarter for the base month.
|
|
338
|
+
* January, February and March return January.
|
|
339
|
+
* April, May and June return April.
|
|
340
|
+
* July, August and September return July.
|
|
341
|
+
* October, November and December return October.
|
|
342
|
+
*
|
|
343
|
+
* @return {Month} the first month of the quarter corresponding to this month, not null
|
|
344
|
+
*/
|
|
345
|
+
firstMonthOfQuarter() {
|
|
346
|
+
switch (this) {
|
|
347
|
+
case Month.JANUARY:
|
|
348
|
+
case Month.FEBRUARY:
|
|
349
|
+
case Month.MARCH:
|
|
350
|
+
return Month.JANUARY;
|
|
351
|
+
case Month.APRIL:
|
|
352
|
+
case Month.MAY:
|
|
353
|
+
case Month.JUNE:
|
|
354
|
+
return Month.APRIL;
|
|
355
|
+
case Month.JULY:
|
|
356
|
+
case Month.AUGUST:
|
|
357
|
+
case Month.SEPTEMBER:
|
|
358
|
+
return Month.JULY;
|
|
359
|
+
case Month.OCTOBER:
|
|
360
|
+
case Month.NOVEMBER:
|
|
361
|
+
case Month.DECEMBER:
|
|
362
|
+
default:
|
|
363
|
+
return Month.OCTOBER;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Queries this month-of-year using the specified query.
|
|
369
|
+
*
|
|
370
|
+
* This queries this month-of-year using the specified query strategy object.
|
|
371
|
+
* The {@link TemporalQuery} object defines the logic to be used to
|
|
372
|
+
* obtain the result. Read the documentation of the query to understand
|
|
373
|
+
* what the result of this method will be.
|
|
374
|
+
*
|
|
375
|
+
* The result of this method is obtained by invoking the
|
|
376
|
+
* {@link TemporalQuery#queryFrom} method on the
|
|
377
|
+
* specified query passing `this` as the argument.
|
|
378
|
+
*
|
|
379
|
+
* @param {TemporalQuery} query - the query to invoke, not null
|
|
380
|
+
* @return {*} the query result, null may be returned (defined by the query)
|
|
381
|
+
* @throws DateTimeException if unable to query (defined by the query)
|
|
382
|
+
* @throws ArithmeticException if numeric overflow occurs (defined by the query)
|
|
383
|
+
*/
|
|
384
|
+
query(query) {
|
|
385
|
+
assert(query != null, 'query() parameter must not be null', DateTimeException);
|
|
386
|
+
if (query === TemporalQueries.chronology()) {
|
|
387
|
+
return IsoChronology.INSTANCE;
|
|
388
|
+
} else if (query === TemporalQueries.precision()) {
|
|
389
|
+
return ChronoUnit.MONTHS;
|
|
390
|
+
}
|
|
391
|
+
return super.query(query);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* toString implementation... in JDK this is inherited from the Enum class
|
|
398
|
+
*
|
|
399
|
+
* @return {String}
|
|
400
|
+
*/
|
|
401
|
+
toString() {
|
|
402
|
+
switch (this) {
|
|
403
|
+
case Month.JANUARY:
|
|
404
|
+
return 'JANUARY';
|
|
405
|
+
case Month.FEBRUARY:
|
|
406
|
+
return 'FEBRUARY';
|
|
407
|
+
case Month.MARCH:
|
|
408
|
+
return 'MARCH';
|
|
409
|
+
case Month.APRIL:
|
|
410
|
+
return 'APRIL';
|
|
411
|
+
case Month.MAY:
|
|
412
|
+
return 'MAY';
|
|
413
|
+
case Month.JUNE:
|
|
414
|
+
return 'JUNE';
|
|
415
|
+
case Month.JULY:
|
|
416
|
+
return 'JULY';
|
|
417
|
+
case Month.AUGUST:
|
|
418
|
+
return 'AUGUST';
|
|
419
|
+
case Month.SEPTEMBER:
|
|
420
|
+
return 'SEPTEMBER';
|
|
421
|
+
case Month.OCTOBER:
|
|
422
|
+
return 'OCTOBER';
|
|
423
|
+
case Month.NOVEMBER:
|
|
424
|
+
return 'NOVEMBER';
|
|
425
|
+
case Month.DECEMBER:
|
|
426
|
+
return 'DECEMBER';
|
|
427
|
+
default:
|
|
428
|
+
return 'unknown Month, value: ' + this.value();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* toJSON() use by JSON.stringify
|
|
434
|
+
* delegates to toString()
|
|
435
|
+
*
|
|
436
|
+
* @return {string}
|
|
437
|
+
*/
|
|
438
|
+
toJSON() {
|
|
439
|
+
return this.toString();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Adjusts the specified temporal object to have this month-of-year.
|
|
444
|
+
*
|
|
445
|
+
* This returns a temporal object of the same observable type as the input
|
|
446
|
+
* with the month-of-year changed to be the same as this.
|
|
447
|
+
*
|
|
448
|
+
* The adjustment is equivalent to using {@link Temporal#with}
|
|
449
|
+
* passing {@link ChronoField#MONTH_OF_YEAR} as the field.
|
|
450
|
+
* If the specified temporal object does not use the ISO calendar system then
|
|
451
|
+
* a {@link DateTimeException} is thrown.
|
|
452
|
+
*
|
|
453
|
+
* In most cases, it is clearer to reverse the calling pattern by using
|
|
454
|
+
* {@link Temporal#with}:
|
|
455
|
+
* <pre>
|
|
456
|
+
* // these two lines are equivalent, but the second approach is recommended
|
|
457
|
+
* temporal = thisMonth.adjustInto(temporal);
|
|
458
|
+
* temporal = temporal.with(thisMonth);
|
|
459
|
+
* </pre>
|
|
460
|
+
*
|
|
461
|
+
* For example, given a date in May, the following are output:
|
|
462
|
+
* <pre>
|
|
463
|
+
* dateInMay.with(JANUARY); // four months earlier
|
|
464
|
+
* dateInMay.with(APRIL); // one months earlier
|
|
465
|
+
* dateInMay.with(MAY); // same date
|
|
466
|
+
* dateInMay.with(JUNE); // one month later
|
|
467
|
+
* dateInMay.with(DECEMBER); // seven months later
|
|
468
|
+
* </pre>
|
|
469
|
+
*
|
|
470
|
+
* This instance is immutable and unaffected by this method call.
|
|
471
|
+
*
|
|
472
|
+
* @param {Temporal} temporal - the target object to be adjusted, not null
|
|
473
|
+
* @return {Temporal} the adjusted object, not null
|
|
474
|
+
* @throws DateTimeException if unable to make the adjustment
|
|
475
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
476
|
+
*/
|
|
477
|
+
adjustInto(temporal) {
|
|
478
|
+
/* we support only ISO for now
|
|
479
|
+
if (Chronology.from(temporal).equals(IsoChronology.INSTANCE) === false) {
|
|
480
|
+
throw new DateTimeException('Adjustment only supported on ISO date-time');
|
|
481
|
+
}
|
|
482
|
+
*/
|
|
483
|
+
return temporal.with(ChronoField.MONTH_OF_YEAR, this.value());
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Compares this Month to another Month.
|
|
488
|
+
*
|
|
489
|
+
* The comparison is based on the value of the Month.
|
|
490
|
+
* It is "consistent with equals", as defined by {@link Comparable}.
|
|
491
|
+
*
|
|
492
|
+
* @param {Month} other the other year to compare to, not null
|
|
493
|
+
* @return {number} the comparator value, negative if less, positive if greater
|
|
494
|
+
*/
|
|
495
|
+
compareTo(other) {
|
|
496
|
+
requireNonNull(other, 'other');
|
|
497
|
+
requireInstance(other, Month, 'other');
|
|
498
|
+
return this._value - other._value;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
*
|
|
503
|
+
* @returns {boolean}
|
|
504
|
+
*/
|
|
505
|
+
equals(other){
|
|
506
|
+
return this === other;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
*
|
|
511
|
+
* @param {string} name
|
|
512
|
+
* @returns {Month}
|
|
513
|
+
*/
|
|
514
|
+
static valueOf(name) {
|
|
515
|
+
let ordinal = 0;
|
|
516
|
+
for(ordinal; ordinal < MONTHS.length; ordinal++){
|
|
517
|
+
if(MONTHS[ordinal].name() === name){
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return Month.of(ordinal+1);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* replacement for enum values
|
|
527
|
+
* @return {Month[]}
|
|
528
|
+
*/
|
|
529
|
+
static values(){
|
|
530
|
+
return MONTHS.slice();
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
*
|
|
535
|
+
* @param {number} month
|
|
536
|
+
* @return {Month} not null
|
|
537
|
+
**/
|
|
538
|
+
static of(month) {
|
|
539
|
+
if (month < 1 || month > 12) {
|
|
540
|
+
assert(false, 'Invalid value for MonthOfYear: ' + month, DateTimeException);
|
|
541
|
+
}
|
|
542
|
+
return MONTHS[month-1];
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Obtains an instance of {@link Month} from a temporal object.
|
|
547
|
+
*
|
|
548
|
+
* This obtains a month based on the specified temporal.
|
|
549
|
+
* A {@link TemporalAccessor} represents an arbitrary set of date and time information,
|
|
550
|
+
* which this factory converts to an instance of {@link Month}.
|
|
551
|
+
*
|
|
552
|
+
* The conversion extracts the MONTH_OF_YEAR (see {@link ChronoField#MONTH_OF_YEAR}) field.
|
|
553
|
+
* The extraction is only permitted if the temporal object has an ISO
|
|
554
|
+
* chronology, or can be converted to a {@link LocalDate}.
|
|
555
|
+
*
|
|
556
|
+
* This method matches the signature of the functional interface {@link TemporalQuery}
|
|
557
|
+
* allowing it to be used in queries via method reference, {@link Month::from}.
|
|
558
|
+
*
|
|
559
|
+
* @param {TemporalAccessor} temporal the temporal object to convert, not null
|
|
560
|
+
* @return {Month} the month-of-year, not null
|
|
561
|
+
* @throws DateTimeException if unable to convert to a {@link Month}
|
|
562
|
+
*/
|
|
563
|
+
static from(temporal) {
|
|
564
|
+
if (temporal instanceof Month) {
|
|
565
|
+
return temporal;
|
|
566
|
+
}
|
|
567
|
+
try {
|
|
568
|
+
/* only ISO for now
|
|
569
|
+
if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) {
|
|
570
|
+
temporal = LocalDate.from(temporal);
|
|
571
|
+
}*/
|
|
572
|
+
return Month.of(temporal.get(ChronoField.MONTH_OF_YEAR));
|
|
573
|
+
} catch (ex) {
|
|
574
|
+
throw new DateTimeException('Unable to obtain Month from TemporalAccessor: ' +
|
|
575
|
+
temporal + ' of type ' + (temporal && temporal.constructor != null ? temporal.constructor.name : ''), ex);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
let MONTHS;
|
|
581
|
+
|
|
582
|
+
export function _init() {
|
|
583
|
+
Month.JANUARY = new Month(1, 'JANUARY');
|
|
584
|
+
Month.FEBRUARY = new Month(2, 'FEBRUARY');
|
|
585
|
+
Month.MARCH = new Month(3, 'MARCH');
|
|
586
|
+
Month.APRIL = new Month(4, 'APRIL');
|
|
587
|
+
Month.MAY = new Month(5, 'MAY');
|
|
588
|
+
Month.JUNE = new Month(6, 'JUNE');
|
|
589
|
+
Month.JULY = new Month(7, 'JULY');
|
|
590
|
+
Month.AUGUST = new Month(8, 'AUGUST');
|
|
591
|
+
Month.SEPTEMBER = new Month(9, 'SEPTEMBER');
|
|
592
|
+
Month.OCTOBER = new Month(10, 'OCTOBER');
|
|
593
|
+
Month.NOVEMBER = new Month(11, 'NOVEMBER');
|
|
594
|
+
Month.DECEMBER = new Month(12, 'DECEMBER');
|
|
595
|
+
|
|
596
|
+
MONTHS = [
|
|
597
|
+
Month.JANUARY, Month.FEBRUARY, Month.MARCH, Month.APRIL, Month.MAY, Month.JUNE,
|
|
598
|
+
Month.JULY, Month.AUGUST, Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER, Month.DECEMBER
|
|
599
|
+
];
|
|
600
|
+
}
|