@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,464 @@
|
|
|
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 {requireNonNull} from '../assert';
|
|
8
|
+
import {IllegalStateException} from '../errors';
|
|
9
|
+
|
|
10
|
+
import {TemporalAdjuster} from './TemporalAdjuster';
|
|
11
|
+
import {ChronoField} from '../temporal/ChronoField';
|
|
12
|
+
import {ChronoUnit} from '../temporal/ChronoUnit';
|
|
13
|
+
import {MathUtil} from '../MathUtil';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Common implementations of {@link TemporalAdjuster}.
|
|
17
|
+
*
|
|
18
|
+
* This class provides common implementations of {@link TemporalAdjuster}.
|
|
19
|
+
* They are especially useful to document the intent of business logic and
|
|
20
|
+
* often link well to requirements.
|
|
21
|
+
* For example, these two pieces of code do the same thing, but the second
|
|
22
|
+
* one is clearer (assuming that there is a static import of this class):
|
|
23
|
+
* <pre>
|
|
24
|
+
* // direct manipulation
|
|
25
|
+
* date.withDayOfMonth(1).plusMonths(1).minusDays(1);
|
|
26
|
+
* // use of an adjuster from this class
|
|
27
|
+
* date.with(lastDayOfMonth());
|
|
28
|
+
* </pre>
|
|
29
|
+
* There are two equivalent ways of using a {@link TemporalAdjuster}.
|
|
30
|
+
* The first is to invoke the method on the interface directly.
|
|
31
|
+
* The second is to use {@link Temporal#with}:
|
|
32
|
+
* <pre>
|
|
33
|
+
* // these two lines are equivalent, but the second approach is recommended
|
|
34
|
+
* dateTime = adjuster.adjustInto(dateTime);
|
|
35
|
+
* dateTime = dateTime.with(adjuster);
|
|
36
|
+
* </pre>
|
|
37
|
+
* It is recommended to use the second approach, {@link with},
|
|
38
|
+
* as it is a lot clearer to read in code.
|
|
39
|
+
*
|
|
40
|
+
* ### Specification for implementors
|
|
41
|
+
*
|
|
42
|
+
* This is a thread-safe utility class.
|
|
43
|
+
* All returned adjusters are immutable and thread-safe.
|
|
44
|
+
*
|
|
45
|
+
* The JDK 8 ofDateAdjuster(UnaryOperator) method is not backported.
|
|
46
|
+
*/
|
|
47
|
+
export class TemporalAdjusters {
|
|
48
|
+
|
|
49
|
+
//-----------------------------------------------------------------------
|
|
50
|
+
/**
|
|
51
|
+
* Returns the 'first day of month' adjuster, which returns a new date set to
|
|
52
|
+
* the first day of the current month.
|
|
53
|
+
*
|
|
54
|
+
* The ISO calendar system behaves as follows:
|
|
55
|
+
*
|
|
56
|
+
* * The input 2011-01-15 will return 2011-01-01.
|
|
57
|
+
* * The input 2011-02-15 will return 2011-02-01.
|
|
58
|
+
*
|
|
59
|
+
* The behavior is suitable for use with most calendar systems.
|
|
60
|
+
* It is equivalent to:
|
|
61
|
+
* <pre>
|
|
62
|
+
* temporal.with(DAY_OF_MONTH, 1);
|
|
63
|
+
* </pre>
|
|
64
|
+
*
|
|
65
|
+
* @return {TemporalAdjuster} the first day-of-month adjuster, not null
|
|
66
|
+
*/
|
|
67
|
+
static firstDayOfMonth() {
|
|
68
|
+
return Impl.FIRST_DAY_OF_MONTH;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Returns the 'last day of month' adjuster, which returns a new date set to
|
|
73
|
+
* the last day of the current month.
|
|
74
|
+
*
|
|
75
|
+
* The ISO calendar system behaves as follows:
|
|
76
|
+
*
|
|
77
|
+
* * The input 2011-01-15 will return 2011-01-31.
|
|
78
|
+
* * The input 2011-02-15 will return 2011-02-28.
|
|
79
|
+
* * The input 2012-02-15 will return 2012-02-29 (leap year).
|
|
80
|
+
* * The input 2011-04-15 will return 2011-04-30.
|
|
81
|
+
*
|
|
82
|
+
* The behavior is suitable for use with most calendar systems.
|
|
83
|
+
* It is equivalent to:
|
|
84
|
+
* <pre>
|
|
85
|
+
* long lastDay = temporal.range(DAY_OF_MONTH).getMaximum();
|
|
86
|
+
* temporal.with(DAY_OF_MONTH, lastDay);
|
|
87
|
+
* </pre>
|
|
88
|
+
*
|
|
89
|
+
* @return {TemporalAdjuster} the last day-of-month adjuster, not null
|
|
90
|
+
*/
|
|
91
|
+
static lastDayOfMonth() {
|
|
92
|
+
return Impl.LAST_DAY_OF_MONTH;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns the 'first day of next month' adjuster, which returns a new date set to
|
|
97
|
+
* the first day of the next month.
|
|
98
|
+
*
|
|
99
|
+
* The ISO calendar system behaves as follows:
|
|
100
|
+
*
|
|
101
|
+
* * The input 2011-01-15 will return 2011-02-01.
|
|
102
|
+
* * The input 2011-02-15 will return 2011-03-01.
|
|
103
|
+
*
|
|
104
|
+
* The behavior is suitable for use with most calendar systems.
|
|
105
|
+
* It is equivalent to:
|
|
106
|
+
* <pre>
|
|
107
|
+
* temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS);
|
|
108
|
+
* </pre>
|
|
109
|
+
*
|
|
110
|
+
* @return {TemporalAdjuster} the first day of next month adjuster, not null
|
|
111
|
+
*/
|
|
112
|
+
static firstDayOfNextMonth() {
|
|
113
|
+
return Impl.FIRST_DAY_OF_NEXT_MONTH;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//-----------------------------------------------------------------------
|
|
117
|
+
/**
|
|
118
|
+
* Returns the 'first day of year' adjuster, which returns a new date set to
|
|
119
|
+
* the first day of the current year.
|
|
120
|
+
*
|
|
121
|
+
* The ISO calendar system behaves as follows:
|
|
122
|
+
*
|
|
123
|
+
* * The input 2011-01-15 will return 2011-01-01.
|
|
124
|
+
* * The input 2011-02-15 will return 2011-01-01.
|
|
125
|
+
*
|
|
126
|
+
* The behavior is suitable for use with most calendar systems.
|
|
127
|
+
* It is equivalent to:
|
|
128
|
+
* <pre>
|
|
129
|
+
* temporal.with(DAY_OF_YEAR, 1);
|
|
130
|
+
* </pre>
|
|
131
|
+
*
|
|
132
|
+
* @return {TemporalAdjuster} the first day-of-year adjuster, not null
|
|
133
|
+
*/
|
|
134
|
+
static firstDayOfYear() {
|
|
135
|
+
return Impl.FIRST_DAY_OF_YEAR;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Returns the 'last day of year' adjuster, which returns a new date set to
|
|
140
|
+
* the last day of the current year.
|
|
141
|
+
*
|
|
142
|
+
* The ISO calendar system behaves as follows:
|
|
143
|
+
*
|
|
144
|
+
* * The input 2011-01-15 will return 2011-12-31.
|
|
145
|
+
* * The input 2011-02-15 will return 2011-12-31.
|
|
146
|
+
*
|
|
147
|
+
* The behavior is suitable for use with most calendar systems.
|
|
148
|
+
* It is equivalent to:
|
|
149
|
+
* <pre>
|
|
150
|
+
* long lastDay = temporal.range(DAY_OF_YEAR).getMaximum();
|
|
151
|
+
* temporal.with(DAY_OF_YEAR, lastDay);
|
|
152
|
+
* </pre>
|
|
153
|
+
*
|
|
154
|
+
* @return {TemporalAdjuster} the last day-of-year adjuster, not null
|
|
155
|
+
*/
|
|
156
|
+
static lastDayOfYear() {
|
|
157
|
+
return Impl.LAST_DAY_OF_YEAR;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Returns the 'first day of next year' adjuster, which returns a new date set to
|
|
162
|
+
* the first day of the next year.
|
|
163
|
+
*
|
|
164
|
+
* The ISO calendar system behaves as follows:
|
|
165
|
+
*
|
|
166
|
+
* * The input 2011-01-15 will return 2012-01-01.
|
|
167
|
+
*
|
|
168
|
+
* The behavior is suitable for use with most calendar systems.
|
|
169
|
+
* It is equivalent to:
|
|
170
|
+
* <pre>
|
|
171
|
+
* temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS);
|
|
172
|
+
* </pre>
|
|
173
|
+
*
|
|
174
|
+
* @return {TemporalAdjuster} the first day of next month adjuster, not null
|
|
175
|
+
*/
|
|
176
|
+
static firstDayOfNextYear() {
|
|
177
|
+
return Impl.FIRST_DAY_OF_NEXT_YEAR;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//-----------------------------------------------------------------------
|
|
181
|
+
/**
|
|
182
|
+
* Returns the first in month adjuster, which returns a new date
|
|
183
|
+
* in the same month with the first matching day-of-week.
|
|
184
|
+
* This is used for expressions like 'first Tuesday in March'.
|
|
185
|
+
*
|
|
186
|
+
* The ISO calendar system behaves as follows:
|
|
187
|
+
*
|
|
188
|
+
* * The input 2011-12-15 for (MONDAY) will return 2011-12-05.
|
|
189
|
+
* * The input 2011-12-15 for (FRIDAY) will return 2011-12-02.
|
|
190
|
+
*
|
|
191
|
+
* The behavior is suitable for use with most calendar systems.
|
|
192
|
+
* It uses the {@link DAY_OF_WEEK} and {@link DAY_OF_MONTH} fields
|
|
193
|
+
* and the {@link DAYS} unit, and assumes a seven day week.
|
|
194
|
+
*
|
|
195
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week, not null
|
|
196
|
+
* @return {TemporalAdjuster} the first in month adjuster, not null
|
|
197
|
+
*/
|
|
198
|
+
static firstInMonth(dayOfWeek) {
|
|
199
|
+
requireNonNull(dayOfWeek, 'dayOfWeek');
|
|
200
|
+
return new DayOfWeekInMonth(1, dayOfWeek);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Returns the last in month adjuster, which returns a new date
|
|
205
|
+
* in the same month with the last matching day-of-week.
|
|
206
|
+
* This is used for expressions like 'last Tuesday in March'.
|
|
207
|
+
*
|
|
208
|
+
* The ISO calendar system behaves as follows:
|
|
209
|
+
*
|
|
210
|
+
* * The input 2011-12-15 for (MONDAY) will return 2011-12-26.
|
|
211
|
+
* * The input 2011-12-15 for (FRIDAY) will return 2011-12-30.
|
|
212
|
+
*
|
|
213
|
+
* The behavior is suitable for use with most calendar systems.
|
|
214
|
+
* It uses the {@link DAY_OF_WEEK} and {@link DAY_OF_MONTH} fields
|
|
215
|
+
* and the {@link DAYS} unit, and assumes a seven day week.
|
|
216
|
+
*
|
|
217
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week, not null
|
|
218
|
+
* @return {TemporalAdjuster} the first in month adjuster, not null
|
|
219
|
+
*/
|
|
220
|
+
static lastInMonth(dayOfWeek) {
|
|
221
|
+
requireNonNull(dayOfWeek, 'dayOfWeek');
|
|
222
|
+
return new DayOfWeekInMonth(-1, dayOfWeek);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Returns the day-of-week in month adjuster, which returns a new date
|
|
227
|
+
* in the same month with the ordinal day-of-week.
|
|
228
|
+
* This is used for expressions like the 'second Tuesday in March'.
|
|
229
|
+
*
|
|
230
|
+
* The ISO calendar system behaves as follows:
|
|
231
|
+
*
|
|
232
|
+
* * The input 2011-12-15 for (1,TUESDAY) will return 2011-12-06.
|
|
233
|
+
* * The input 2011-12-15 for (2,TUESDAY) will return 2011-12-13.
|
|
234
|
+
* * The input 2011-12-15 for (3,TUESDAY) will return 2011-12-20.
|
|
235
|
+
* * The input 2011-12-15 for (4,TUESDAY) will return 2011-12-27.
|
|
236
|
+
* * The input 2011-12-15 for (5,TUESDAY) will return 2012-01-03.
|
|
237
|
+
* * The input 2011-12-15 for (-1,TUESDAY) will return 2011-12-27 (last in month).
|
|
238
|
+
* * The input 2011-12-15 for (-4,TUESDAY) will return 2011-12-06 (3 weeks before last in month).
|
|
239
|
+
* * The input 2011-12-15 for (-5,TUESDAY) will return 2011-11-29 (4 weeks before last in month).
|
|
240
|
+
* * The input 2011-12-15 for (0,TUESDAY) will return 2011-11-29 (last in previous month).
|
|
241
|
+
*
|
|
242
|
+
* For a positive or zero ordinal, the algorithm is equivalent to finding the first
|
|
243
|
+
* day-of-week that matches within the month and then adding a number of weeks to it.
|
|
244
|
+
* For a negative ordinal, the algorithm is equivalent to finding the last
|
|
245
|
+
* day-of-week that matches within the month and then subtracting a number of weeks to it.
|
|
246
|
+
* The ordinal number of weeks is not validated and is interpreted leniently
|
|
247
|
+
* according to this algorithm. This definition means that an ordinal of zero finds
|
|
248
|
+
* the last matching day-of-week in the previous month.
|
|
249
|
+
*
|
|
250
|
+
* The behavior is suitable for use with most calendar systems.
|
|
251
|
+
* It uses the {@link DAY_OF_WEEK} and {@link DAY_OF_MONTH} fields
|
|
252
|
+
* and the {@link DAYS} unit, and assumes a seven day week.
|
|
253
|
+
*
|
|
254
|
+
* @param {Number} ordinal the week within the month, unbounded but typically from -5 to 5
|
|
255
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week, not null
|
|
256
|
+
* @return {TemporalAdjuster} the day-of-week in month adjuster, not null
|
|
257
|
+
*/
|
|
258
|
+
static dayOfWeekInMonth(ordinal, dayOfWeek) {
|
|
259
|
+
requireNonNull(dayOfWeek, 'dayOfWeek');
|
|
260
|
+
return new DayOfWeekInMonth(ordinal, dayOfWeek);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
//-----------------------------------------------------------------------
|
|
264
|
+
/**
|
|
265
|
+
* Returns the next day-of-week adjuster, which adjusts the date to the
|
|
266
|
+
* first occurrence of the specified day-of-week after the date being adjusted.
|
|
267
|
+
*
|
|
268
|
+
* The ISO calendar system behaves as follows:
|
|
269
|
+
*
|
|
270
|
+
* * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
|
|
271
|
+
* * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
|
|
272
|
+
* * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-22 (seven days later).
|
|
273
|
+
*
|
|
274
|
+
* The behavior is suitable for use with most calendar systems.
|
|
275
|
+
* It uses the {@link DAY_OF_WEEK} field and the {@link DAYS} unit,
|
|
276
|
+
* and assumes a seven day week.
|
|
277
|
+
*
|
|
278
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week to move the date to, not null
|
|
279
|
+
* @return {TemporalAdjuster} the next day-of-week adjuster, not null
|
|
280
|
+
*/
|
|
281
|
+
static next(dayOfWeek) {
|
|
282
|
+
return new RelativeDayOfWeek(2, dayOfWeek);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Returns the next-or-same day-of-week adjuster, which adjusts the date to the
|
|
287
|
+
* first occurrence of the specified day-of-week after the date being adjusted
|
|
288
|
+
* unless it is already on that day in which case the same object is returned.
|
|
289
|
+
*
|
|
290
|
+
* The ISO calendar system behaves as follows:
|
|
291
|
+
*
|
|
292
|
+
* * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).
|
|
293
|
+
* * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).
|
|
294
|
+
* * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input).
|
|
295
|
+
*
|
|
296
|
+
* The behavior is suitable for use with most calendar systems.
|
|
297
|
+
* It uses the {@link DAY_OF_WEEK} field and the {@link DAYS} unit,
|
|
298
|
+
* and assumes a seven day week.
|
|
299
|
+
*
|
|
300
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week to check for or move the date to, not null
|
|
301
|
+
* @return {TemporalAdjuster} the next-or-same day-of-week adjuster, not null
|
|
302
|
+
*/
|
|
303
|
+
static nextOrSame(dayOfWeek) {
|
|
304
|
+
return new RelativeDayOfWeek(0, dayOfWeek);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Returns the previous day-of-week adjuster, which adjusts the date to the
|
|
309
|
+
* first occurrence of the specified day-of-week before the date being adjusted.
|
|
310
|
+
*
|
|
311
|
+
* The ISO calendar system behaves as follows:
|
|
312
|
+
*
|
|
313
|
+
* * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
|
|
314
|
+
* * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
|
|
315
|
+
* * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-08 (seven days earlier).
|
|
316
|
+
*
|
|
317
|
+
* The behavior is suitable for use with most calendar systems.
|
|
318
|
+
* It uses the {@link DAY_OF_WEEK} field and the {@link DAYS} unit,
|
|
319
|
+
* and assumes a seven day week.
|
|
320
|
+
*
|
|
321
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week to move the date to, not null
|
|
322
|
+
* @return {TemporalAdjuster} the previous day-of-week adjuster, not null
|
|
323
|
+
*/
|
|
324
|
+
static previous(dayOfWeek) {
|
|
325
|
+
return new RelativeDayOfWeek(3, dayOfWeek);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Returns the previous-or-same day-of-week adjuster, which adjusts the date to the
|
|
330
|
+
* first occurrence of the specified day-of-week before the date being adjusted
|
|
331
|
+
* unless it is already on that day in which case the same object is returned.
|
|
332
|
+
*
|
|
333
|
+
* The ISO calendar system behaves as follows:
|
|
334
|
+
*
|
|
335
|
+
* * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).
|
|
336
|
+
* * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).
|
|
337
|
+
* * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input).
|
|
338
|
+
*
|
|
339
|
+
* The behavior is suitable for use with most calendar systems.
|
|
340
|
+
* It uses the {@link DAY_OF_WEEK} field and the {@link DAYS} unit,
|
|
341
|
+
* and assumes a seven day week.
|
|
342
|
+
*
|
|
343
|
+
* @param {DayOfWeek} dayOfWeek the day-of-week to check for or move the date to, not null
|
|
344
|
+
* @return {TemporalAdjuster} the previous-or-same day-of-week adjuster, not null
|
|
345
|
+
*/
|
|
346
|
+
static previousOrSame(dayOfWeek) {
|
|
347
|
+
return new RelativeDayOfWeek(1, dayOfWeek);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
//-----------------------------------------------------------------------
|
|
353
|
+
/**
|
|
354
|
+
* Enum implementing the adjusters.
|
|
355
|
+
*/
|
|
356
|
+
class Impl extends TemporalAdjuster {
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
*
|
|
360
|
+
* @param ordinal
|
|
361
|
+
* @private
|
|
362
|
+
*/
|
|
363
|
+
constructor(ordinal) {
|
|
364
|
+
super();
|
|
365
|
+
this._ordinal = ordinal;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
adjustInto(temporal) {
|
|
369
|
+
switch (this._ordinal) {
|
|
370
|
+
case 0: return temporal.with(ChronoField.DAY_OF_MONTH, 1);
|
|
371
|
+
case 1: return temporal.with(ChronoField.DAY_OF_MONTH, temporal.range(ChronoField.DAY_OF_MONTH).maximum());
|
|
372
|
+
case 2: return temporal.with(ChronoField.DAY_OF_MONTH, 1).plus(1, ChronoUnit.MONTHS);
|
|
373
|
+
case 3: return temporal.with(ChronoField.DAY_OF_YEAR, 1);
|
|
374
|
+
case 4: return temporal.with(ChronoField.DAY_OF_YEAR, temporal.range(ChronoField.DAY_OF_YEAR).maximum());
|
|
375
|
+
case 5: return temporal.with(ChronoField.DAY_OF_YEAR, 1).plus(1, ChronoUnit.YEARS);
|
|
376
|
+
}
|
|
377
|
+
throw new IllegalStateException('Unreachable');
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** First day of month adjuster. */
|
|
383
|
+
Impl.FIRST_DAY_OF_MONTH = new Impl(0);
|
|
384
|
+
/** Last day of month adjuster. */
|
|
385
|
+
Impl.LAST_DAY_OF_MONTH = new Impl(1);
|
|
386
|
+
/** First day of next month adjuster. */
|
|
387
|
+
Impl.FIRST_DAY_OF_NEXT_MONTH = new Impl(2);
|
|
388
|
+
/** First day of year adjuster. */
|
|
389
|
+
Impl.FIRST_DAY_OF_YEAR = new Impl(3);
|
|
390
|
+
/** Last day of year adjuster. */
|
|
391
|
+
Impl.LAST_DAY_OF_YEAR = new Impl(4);
|
|
392
|
+
/** First day of next month adjuster. */
|
|
393
|
+
Impl.FIRST_DAY_OF_NEXT_YEAR = new Impl(5);
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Class implementing day-of-week in month adjuster.
|
|
398
|
+
*/
|
|
399
|
+
class DayOfWeekInMonth extends TemporalAdjuster {
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
* @param ordinal
|
|
404
|
+
* @param dow
|
|
405
|
+
* @private
|
|
406
|
+
*/
|
|
407
|
+
constructor(ordinal, dow) {
|
|
408
|
+
super();
|
|
409
|
+
this._ordinal = ordinal;
|
|
410
|
+
this._dowValue = dow.value();
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
adjustInto(temporal) {
|
|
414
|
+
if (this._ordinal >= 0) {
|
|
415
|
+
const temp = temporal.with(ChronoField.DAY_OF_MONTH, 1);
|
|
416
|
+
const curDow = temp.get(ChronoField.DAY_OF_WEEK);
|
|
417
|
+
let dowDiff = MathUtil.intMod((this._dowValue - curDow + 7), 7);
|
|
418
|
+
dowDiff += (this._ordinal - 1) * 7; // safe from overflow
|
|
419
|
+
return temp.plus(dowDiff, ChronoUnit.DAYS);
|
|
420
|
+
} else {
|
|
421
|
+
const temp = temporal.with(ChronoField.DAY_OF_MONTH, temporal.range(ChronoField.DAY_OF_MONTH).maximum());
|
|
422
|
+
const curDow = temp.get(ChronoField.DAY_OF_WEEK);
|
|
423
|
+
let daysDiff = this._dowValue - curDow;
|
|
424
|
+
daysDiff = (daysDiff === 0 ? 0 : (daysDiff > 0 ? daysDiff - 7 : daysDiff));
|
|
425
|
+
daysDiff -= (-this._ordinal - 1) * 7; // safe from overflow
|
|
426
|
+
return temp.plus(daysDiff, ChronoUnit.DAYS);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Implementation of next, previous or current day-of-week.
|
|
433
|
+
*/
|
|
434
|
+
class RelativeDayOfWeek extends TemporalAdjuster {
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
*
|
|
438
|
+
* @param relative
|
|
439
|
+
* @param dayOfWeek
|
|
440
|
+
* @private
|
|
441
|
+
*/
|
|
442
|
+
constructor(relative, dayOfWeek) {
|
|
443
|
+
super();
|
|
444
|
+
requireNonNull(dayOfWeek, 'dayOfWeek');
|
|
445
|
+
/** Whether the current date is a valid answer. */
|
|
446
|
+
this._relative = relative;
|
|
447
|
+
/** The day-of-week value, from 1 to 7. */
|
|
448
|
+
this._dowValue = dayOfWeek.value();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
adjustInto(temporal) {
|
|
452
|
+
const calDow = temporal.get(ChronoField.DAY_OF_WEEK);
|
|
453
|
+
if (this._relative < 2 && calDow === this._dowValue) {
|
|
454
|
+
return temporal;
|
|
455
|
+
}
|
|
456
|
+
if ((this._relative & 1) === 0) {
|
|
457
|
+
const daysDiff = calDow - this._dowValue;
|
|
458
|
+
return temporal.plus(daysDiff >= 0 ? 7 - daysDiff : -daysDiff, ChronoUnit.DAYS);
|
|
459
|
+
} else {
|
|
460
|
+
const daysDiff = this._dowValue - calDow;
|
|
461
|
+
return temporal.minus(daysDiff >= 0 ? 7 - daysDiff : -daysDiff, ChronoUnit.DAYS);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {abstractMethodFail} from '../assert';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Framework-level interface defining an amount of time, such as
|
|
11
|
+
* "6 hours", "8 days" or "2 years and 3 months".
|
|
12
|
+
*
|
|
13
|
+
* This is the base interface type for amounts of time.
|
|
14
|
+
* An amount is distinct from a date or time-of-day in that it is not tied
|
|
15
|
+
* to any specific point on the time-line.
|
|
16
|
+
*
|
|
17
|
+
* The amount can be thought of as a {@link Map} of {@link TemporalUnit} to
|
|
18
|
+
* `long`, exposed via {@link getUnits} and {@link get}.
|
|
19
|
+
* A simple case might have a single unit-value pair, such as "6 hours".
|
|
20
|
+
* A more complex case may have multiple unit-value pairs, such as
|
|
21
|
+
* "7 years, 3 months and 5 days".
|
|
22
|
+
*
|
|
23
|
+
* There are two common implementations.
|
|
24
|
+
* {@link Period} is a date-based implementation, storing years, months and days.
|
|
25
|
+
* {@link Duration} is a time-based implementation, storing seconds and nanoseconds,
|
|
26
|
+
* but providing some access using other duration based units such as minutes,
|
|
27
|
+
* hours and fixed 24-hour days.
|
|
28
|
+
*
|
|
29
|
+
* This interface is a framework-level interface that should not be widely
|
|
30
|
+
* used in application code. Instead, applications should create and pass
|
|
31
|
+
* around instances of concrete types, such as {@link Period} and {@link Duration}.
|
|
32
|
+
*
|
|
33
|
+
* @interface
|
|
34
|
+
*/
|
|
35
|
+
export class TemporalAmount {
|
|
36
|
+
/**
|
|
37
|
+
* Returns the value of the requested unit.
|
|
38
|
+
* The units returned from {@link getUnits} uniquely define the
|
|
39
|
+
* value of the {@link TemporalAmount}. A value must be returned
|
|
40
|
+
* for each unit listed in {@link getUnits}.
|
|
41
|
+
*
|
|
42
|
+
* @implSpec
|
|
43
|
+
* Implementations may declare support for units not listed by {@link getUnits}.
|
|
44
|
+
* Typically, the implementation would define additional units
|
|
45
|
+
* as conversions for the convenience of developers.
|
|
46
|
+
*
|
|
47
|
+
* @param {TemporalUnit} unit - the {@link TemporalUnit} for which to return the value
|
|
48
|
+
* @return {number} the long value of the unit
|
|
49
|
+
* @throws DateTimeException if a value for the unit cannot be obtained
|
|
50
|
+
* @throws UnsupportedTemporalTypeException if the {@link unit} is not supported
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line no-unused-vars
|
|
53
|
+
get(unit) {
|
|
54
|
+
abstractMethodFail('get');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns the list of units uniquely defining the value of this TemporalAmount.
|
|
59
|
+
* The list of {@link TemporalUnits} is defined by the implementation class.
|
|
60
|
+
* The list is a snapshot of the units at the time {@link getUnits}
|
|
61
|
+
* is called and is not mutable.
|
|
62
|
+
* The units are ordered from longest duration to the shortest duration
|
|
63
|
+
* of the unit.
|
|
64
|
+
*
|
|
65
|
+
* @implSpec
|
|
66
|
+
* The list of units completely and uniquely represents the
|
|
67
|
+
* state of the object without omissions, overlaps or duplication.
|
|
68
|
+
* The units are in order from longest duration to shortest.
|
|
69
|
+
*
|
|
70
|
+
* @return {TemporalUnit[]} the List of {@link TemporalUnits}; not null
|
|
71
|
+
*/
|
|
72
|
+
units() {
|
|
73
|
+
abstractMethodFail('units');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Adds to the specified temporal object.
|
|
78
|
+
*
|
|
79
|
+
* Adds the amount to the specified temporal object using the logic
|
|
80
|
+
* encapsulated in the implementing class.
|
|
81
|
+
*
|
|
82
|
+
* There are two equivalent ways of using this method.
|
|
83
|
+
* The first is to invoke this method directly.
|
|
84
|
+
* The second is to use {@link Temporal#plus}:
|
|
85
|
+
* <pre>
|
|
86
|
+
* // These two lines are equivalent, but the second approach is recommended
|
|
87
|
+
* dateTime = amount.addTo(dateTime);
|
|
88
|
+
* dateTime = dateTime.plus(adder);
|
|
89
|
+
* </pre>
|
|
90
|
+
* It is recommended to use the second approach, {@link plus},
|
|
91
|
+
* as it is a lot clearer to read in code.
|
|
92
|
+
*
|
|
93
|
+
* @implSpec
|
|
94
|
+
* The implementation must take the input object and add to it.
|
|
95
|
+
* The implementation defines the logic of the addition and is responsible for
|
|
96
|
+
* documenting that logic. It may use any method on {@link Temporal} to
|
|
97
|
+
* query the temporal object and perform the addition.
|
|
98
|
+
* The returned object must have the same observable type as the input object
|
|
99
|
+
*
|
|
100
|
+
* The input object must not be altered.
|
|
101
|
+
* Instead, an adjusted copy of the original must be returned.
|
|
102
|
+
* This provides equivalent, safe behavior for immutable and mutable temporal objects.
|
|
103
|
+
*
|
|
104
|
+
* The input temporal object may be in a calendar system other than ISO.
|
|
105
|
+
* Implementations may choose to document compatibility with other calendar systems,
|
|
106
|
+
* or reject non-ISO temporal objects by querying the chronology (see {@link TemporalQueries#chronology}).
|
|
107
|
+
*
|
|
108
|
+
* This method may be called from multiple threads in parallel.
|
|
109
|
+
* It must be thread-safe when invoked.
|
|
110
|
+
*
|
|
111
|
+
* @param {Temporal} temporal - the temporal object to add the amount to, not null
|
|
112
|
+
* @return {Temporal} an object of the same observable type with the addition made, not null
|
|
113
|
+
* @throws DateTimeException if unable to add
|
|
114
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
115
|
+
*/
|
|
116
|
+
// eslint-disable-next-line no-unused-vars
|
|
117
|
+
addTo(temporal) {
|
|
118
|
+
abstractMethodFail('addTo');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Subtracts this object from the specified temporal object.
|
|
123
|
+
*
|
|
124
|
+
* Subtracts the amount from the specified temporal object using the logic
|
|
125
|
+
* encapsulated in the implementing class.
|
|
126
|
+
*
|
|
127
|
+
* There are two equivalent ways of using this method.
|
|
128
|
+
* The first is to invoke this method directly.
|
|
129
|
+
* The second is to use {@link Temporal#minus}:
|
|
130
|
+
* <pre>
|
|
131
|
+
* // these two lines are equivalent, but the second approach is recommended
|
|
132
|
+
* dateTime = amount.subtractFrom(dateTime);
|
|
133
|
+
* dateTime = dateTime.minus(amount);
|
|
134
|
+
* </pre>
|
|
135
|
+
* It is recommended to use the second approach, {@link minus},
|
|
136
|
+
* as it is a lot clearer to read in code.
|
|
137
|
+
*
|
|
138
|
+
* @implSpec
|
|
139
|
+
* The implementation must take the input object and subtract from it.
|
|
140
|
+
* The implementation defines the logic of the subtraction and is responsible for
|
|
141
|
+
* documenting that logic. It may use any method on {@link Temporal} to
|
|
142
|
+
* query the temporal object and perform the subtraction.
|
|
143
|
+
* The returned object must have the same observable type as the input object
|
|
144
|
+
*
|
|
145
|
+
* The input object must not be altered.
|
|
146
|
+
* Instead, an adjusted copy of the original must be returned.
|
|
147
|
+
* This provides equivalent, safe behavior for immutable and mutable temporal objects.
|
|
148
|
+
*
|
|
149
|
+
* The input temporal object may be in a calendar system other than ISO.
|
|
150
|
+
* Implementations may choose to document compatibility with other calendar systems,
|
|
151
|
+
* or reject non-ISO temporal objects by querying the chronology (see {@link TemporalQueries#chronology}).
|
|
152
|
+
*
|
|
153
|
+
* This method may be called from multiple threads in parallel.
|
|
154
|
+
* It must be thread-safe when invoked.
|
|
155
|
+
*
|
|
156
|
+
* @param {Temporal} temporal - the temporal object to subtract the amount from, not null
|
|
157
|
+
* @return {Temporal} an object of the same observable type with the subtraction made, not null
|
|
158
|
+
* @throws DateTimeException if unable to subtract
|
|
159
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
160
|
+
*/
|
|
161
|
+
// eslint-disable-next-line no-unused-vars
|
|
162
|
+
subtractFrom(temporal) {
|
|
163
|
+
abstractMethodFail('subtractFrom');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}
|