@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,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {assert, requireNonNull} from '../assert';
|
|
7
|
+
import {UnsupportedTemporalTypeException} from '../errors';
|
|
8
|
+
|
|
9
|
+
import {Instant} from '../Instant';
|
|
10
|
+
import {LocalDate} from '../LocalDate';
|
|
11
|
+
import {LocalTime} from '../LocalTime';
|
|
12
|
+
import {MathUtil} from '../MathUtil';
|
|
13
|
+
import {ZoneId} from '../ZoneId';
|
|
14
|
+
|
|
15
|
+
import {ChronoField} from './ChronoField';
|
|
16
|
+
import {TemporalQueries} from './TemporalQueries';
|
|
17
|
+
import {TemporalAccessor} from './TemporalAccessor';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A wrapper around a native javascript Date instance that
|
|
21
|
+
* implements TemporalAccessor functionality
|
|
22
|
+
*/
|
|
23
|
+
class NativeJsTemporal extends TemporalAccessor {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {!(Date|moment)} date - a javascript Date or a moment instance
|
|
27
|
+
* @param {ZoneId} [zone=ZoneId.systemDefault()] - the zone of the temporal, defaults to ZoneId.systemDefault()
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
constructor(date, zone=ZoneId.systemDefault()){
|
|
31
|
+
super();
|
|
32
|
+
this._zone = zone;
|
|
33
|
+
if(date instanceof Date) {
|
|
34
|
+
this._epochMilli = date.getTime();
|
|
35
|
+
return;
|
|
36
|
+
} else if(typeof date.toDate === 'function' && date.toDate() instanceof Date) {
|
|
37
|
+
// it's a moment
|
|
38
|
+
this._epochMilli = date.toDate().getTime();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
assert(false, 'date must be either a javascript date or a moment');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {TemporalQuery} query the query to invoke, not null
|
|
46
|
+
* @return {*} the query result, null may be returned (defined by the query)
|
|
47
|
+
* @throws DateTimeException if unable to query
|
|
48
|
+
*/
|
|
49
|
+
query(query) {
|
|
50
|
+
requireNonNull(query, 'query');
|
|
51
|
+
if (query === TemporalQueries.localDate()) {
|
|
52
|
+
return LocalDate.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
|
|
53
|
+
} else if(query === TemporalQueries.localTime()){
|
|
54
|
+
return LocalTime.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
|
|
55
|
+
} else if(query === TemporalQueries.zone()){
|
|
56
|
+
return this._zone;
|
|
57
|
+
}
|
|
58
|
+
return super.query(query);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {TemporalField} field
|
|
64
|
+
* @returns {number}
|
|
65
|
+
*/
|
|
66
|
+
get(field) {
|
|
67
|
+
return this.getLong(field);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param {!TemporalField} field
|
|
73
|
+
* @returns {number}
|
|
74
|
+
*/
|
|
75
|
+
getLong(field) {
|
|
76
|
+
requireNonNull(field, 'field');
|
|
77
|
+
if (field instanceof ChronoField) {
|
|
78
|
+
switch (field) {
|
|
79
|
+
case ChronoField.NANO_OF_SECOND: return MathUtil.floorMod(this._epochMilli, 1000) * 1000000;
|
|
80
|
+
case ChronoField.INSTANT_SECONDS: return MathUtil.floorDiv(this._epochMilli, 1000);
|
|
81
|
+
}
|
|
82
|
+
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
|
|
83
|
+
}
|
|
84
|
+
return field.getFrom(this);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {TemporalField} field
|
|
90
|
+
* @returns {boolean}
|
|
91
|
+
*/
|
|
92
|
+
isSupported(field){
|
|
93
|
+
return field === ChronoField.INSTANT_SECONDS || field === ChronoField.NANO_OF_SECOND;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @param {!(Date|moment)} date - a javascript Date or a moment instance
|
|
100
|
+
* @param {ZoneId} [zone=ZoneId.systemDefault()] - the zone of the temporal, defaults to ZoneId.systemDefault()
|
|
101
|
+
* @returns {NativeJsTemporal}
|
|
102
|
+
*/
|
|
103
|
+
export function nativeJs(date, zone){
|
|
104
|
+
return new NativeJsTemporal(date, zone);
|
|
105
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {TemporalAccessor} from './TemporalAccessor';
|
|
8
|
+
import { abstractMethodFail } from '../assert';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Framework-level interface defining read-write access to a temporal object,
|
|
12
|
+
* such as a date, time, offset or some combination of these.
|
|
13
|
+
*
|
|
14
|
+
* This is the base interface type for date, time and offset objects that
|
|
15
|
+
* are complete enough to be manipulated using plus and minus.
|
|
16
|
+
* It is implemented by those classes that can provide and manipulate information
|
|
17
|
+
* as fields (see {@link TemporalField}) or queries (see {@link TemporalQuery}).
|
|
18
|
+
* See {@link TemporalAccessor} for the read-only version of this interface.
|
|
19
|
+
*
|
|
20
|
+
* Most date and time information can be represented as a number.
|
|
21
|
+
* These are modeled using {@link TemporalField} with the number held using
|
|
22
|
+
* a `long` to handle large values. Year, month and day-of-month are
|
|
23
|
+
* simple examples of fields, but they also include instant and offsets.
|
|
24
|
+
* See {@link ChronoField} for the standard set of fields.
|
|
25
|
+
*
|
|
26
|
+
* Two pieces of date/time information cannot be represented by numbers,
|
|
27
|
+
* the {@link Chronology} and the {@link ZoneId}.
|
|
28
|
+
* These can be accessed using the static methods defined on {@link TemporalQueries}.
|
|
29
|
+
*
|
|
30
|
+
* This interface is a framework-level interface that should not be widely
|
|
31
|
+
* used in application code. Instead, applications should create and pass
|
|
32
|
+
* around instances of concrete types, such as {@link LocalDate}.
|
|
33
|
+
* There are many reasons for this, part of which is that implementations
|
|
34
|
+
* of this interface may be in calendar systems other than ISO.
|
|
35
|
+
* See {@link ChronoLocalDate} for a fuller discussion of the issues.
|
|
36
|
+
*
|
|
37
|
+
* ### When to implement
|
|
38
|
+
*
|
|
39
|
+
* A class should implement this interface if it meets three criteria:
|
|
40
|
+
*
|
|
41
|
+
* * it provides access to date/time/offset information, as per {@link TemporalAccessor}
|
|
42
|
+
* * the set of fields are contiguous from the largest to the smallest
|
|
43
|
+
* * the set of fields are complete, such that no other field is needed to define the
|
|
44
|
+
* valid range of values for the fields that are represented
|
|
45
|
+
*
|
|
46
|
+
* Four examples make this clear:
|
|
47
|
+
*
|
|
48
|
+
* * {@link LocalDate} implements this interface as it represents a set of fields
|
|
49
|
+
* that are contiguous from days to forever and require no external information to determine
|
|
50
|
+
* the validity of each date. It is therefore able to implement plus/minus correctly.
|
|
51
|
+
* * {@link LocalTime} implements this interface as it represents a set of fields
|
|
52
|
+
* that are contiguous from nanos to within days and require no external information to determine
|
|
53
|
+
* validity. It is able to implement plus/minus correctly, by wrapping around the day.
|
|
54
|
+
* * {@link MonthDay}, the combination of month-of-year and day-of-month, does not implement
|
|
55
|
+
* this interface. While the combination is contiguous, from days to months within years,
|
|
56
|
+
* the combination does not have sufficient information to define the valid range of values
|
|
57
|
+
* for day-of-month. As such, it is unable to implement plus/minus correctly.
|
|
58
|
+
* * The combination day-of-week and day-of-month ("Friday the 13th") should not implement
|
|
59
|
+
* this interface. It does not represent a contiguous set of fields, as days to weeks overlaps
|
|
60
|
+
* days to months.
|
|
61
|
+
*
|
|
62
|
+
* @interface
|
|
63
|
+
*/
|
|
64
|
+
export class Temporal extends TemporalAccessor {
|
|
65
|
+
/**
|
|
66
|
+
* Checks if the specified unit is supported.
|
|
67
|
+
* This checks if the date-time can be queried for the specified unit. If false, then calling the plus and minus methods will throw an exception.
|
|
68
|
+
|
|
69
|
+
* ### Specification for implementors
|
|
70
|
+
* Implementations must check and handle all fields defined in {@link ChronoUnit}. If the field is supported, then true is returned, otherwise false
|
|
71
|
+
* If the field is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.isSupportedBy(Temporal)` passing this as the argument.
|
|
72
|
+
|
|
73
|
+
* Implementations must not alter this object.
|
|
74
|
+
|
|
75
|
+
* @param {TemporalUnit} unit - the unit to check, null returns false
|
|
76
|
+
* @return {boolean} true if this date-time can be queried for the unit, false if not
|
|
77
|
+
*/
|
|
78
|
+
// eslint-disable-next-line no-unused-vars
|
|
79
|
+
isSupported(unit) {
|
|
80
|
+
abstractMethodFail('isSupported');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* function overloading for {@link Temporal.plus}
|
|
85
|
+
*
|
|
86
|
+
* Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAmount} and {@link Temporal.minusAmount} is called.
|
|
87
|
+
*
|
|
88
|
+
* Otherwise {@link Temporal.minusAmountUnit} is called.
|
|
89
|
+
*
|
|
90
|
+
* @param {!(TemporalAmount|number)} p1
|
|
91
|
+
* @param {TemporalUnit} p2
|
|
92
|
+
* @return {Temporal}
|
|
93
|
+
*/
|
|
94
|
+
// eslint-disable-next-line no-unused-vars
|
|
95
|
+
minus(p1, p2) {
|
|
96
|
+
if (arguments.length < 2) {
|
|
97
|
+
return this.minusAmount(p1);
|
|
98
|
+
} else {
|
|
99
|
+
return this.minusAmountUnit(p1, p2);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns an object of the same type as this object with an amount subtracted.
|
|
105
|
+
* This adjusts this temporal, subtracting according to the rules of the specified amount. The
|
|
106
|
+
* amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as Duration.
|
|
107
|
+
*
|
|
108
|
+
* Some example code indicating how and why this method is used:
|
|
109
|
+
*
|
|
110
|
+
* <pre>
|
|
111
|
+
* date = date.minus(period); // subtract a Period instance
|
|
112
|
+
* date = date.minus(duration); // subtract a Duration instance
|
|
113
|
+
* date = date.minus(workingDays(6)); // example user-written workingDays method
|
|
114
|
+
* </pre>
|
|
115
|
+
*
|
|
116
|
+
* Note that calling plus followed by minus is not guaranteed to return the same date-time.
|
|
117
|
+
*
|
|
118
|
+
* ### Specification for implementors
|
|
119
|
+
* Implementations must not alter either this object. Instead, an adjusted copy of the original
|
|
120
|
+
* must be returned. This provides equivalent, safe behavior for immutable and mutable
|
|
121
|
+
* implementations.
|
|
122
|
+
*
|
|
123
|
+
* @param {TemporalAmount} amount - the amount to subtract, not null
|
|
124
|
+
* @return {Temporal} an object of the same type with the specified adjustment made, not null
|
|
125
|
+
* @throws DateTimeException - if the subtraction cannot be made
|
|
126
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
127
|
+
*/
|
|
128
|
+
// eslint-disable-next-line no-unused-vars
|
|
129
|
+
minusAmount(amount) {
|
|
130
|
+
abstractMethodFail('minusAmount');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Returns an object of the same type as this object with the specified period subtracted.
|
|
135
|
+
* This method returns a new object based on this one with the specified period subtracted. For example, on a {@link LocalDate}, this could be used to subtract a number of years, months or days. The returned object will have the same observable type as this object.
|
|
136
|
+
*
|
|
137
|
+
* In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st March, then subtracting one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
|
|
138
|
+
*
|
|
139
|
+
* If the implementation represents a date-time that has boundaries, such {@link as} LocalTime, then the permitted units must include the boundary unit, but no multiples of the boundary unit. For example, {@link LocalTime} must accept `DAYS` but not `WEEKS` or `MONTHS`.
|
|
140
|
+
*
|
|
141
|
+
* ### Specification for implementors
|
|
142
|
+
* Implementations must behave in a manor equivalent to the default method behavior.
|
|
143
|
+
* Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
|
|
144
|
+
*
|
|
145
|
+
* @param {number} amountToSubtract - the amount of the specified unit to subtract, may be negative
|
|
146
|
+
* @param {TemporalUnit} unit - the unit of the period to subtract, not null
|
|
147
|
+
* @return {Temporal} an object of the same type with the specified period subtracted, not null
|
|
148
|
+
* @throws DateTimeException - if the unit cannot be subtracted
|
|
149
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
150
|
+
*/
|
|
151
|
+
// eslint-disable-next-line no-unused-vars
|
|
152
|
+
minusAmountUnit(amountToSubtract, unit) {
|
|
153
|
+
abstractMethodFail('minusAmountUnit');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* function overloading for {@link Temporal.plus}
|
|
158
|
+
*
|
|
159
|
+
* Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAmount} and {@link Temporal.plusAmount} is called.
|
|
160
|
+
*
|
|
161
|
+
* Otherwise {@link Temporal.plusAmountUnit} is called.
|
|
162
|
+
*
|
|
163
|
+
* @param {!(TemporalAmount|number)} p1
|
|
164
|
+
* @param {TemporalUnit} p2
|
|
165
|
+
* @return {Temporal}
|
|
166
|
+
*/
|
|
167
|
+
// eslint-disable-next-line no-unused-vars
|
|
168
|
+
plus(p1, p2) {
|
|
169
|
+
if (arguments.length < 2) {
|
|
170
|
+
return this.plusAmount(p1);
|
|
171
|
+
} else {
|
|
172
|
+
return this.plusAmountUnit(p1, p2);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns an object of the same type as this object with an amount added.
|
|
178
|
+
* This adjusts this temporal, adding according to the rules of the specified amount. The amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as {@link Duration}.
|
|
179
|
+
*
|
|
180
|
+
* Some example code indicating how and why this method is used:
|
|
181
|
+
*
|
|
182
|
+
* <pre>
|
|
183
|
+
* date = date.plus(period); // add a Period instance
|
|
184
|
+
* date = date.plus(duration); // add a Duration instance
|
|
185
|
+
* date = date.plus(workingDays(6)); // example user-written workingDays method
|
|
186
|
+
* </pre>
|
|
187
|
+
*
|
|
188
|
+
* Note that calling plus followed by minus is not guaranteed to return the same date-time.
|
|
189
|
+
*
|
|
190
|
+
* ### Specification for implementors
|
|
191
|
+
* Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
|
|
192
|
+
*
|
|
193
|
+
* @param {TemporalAmount} amount - the amount to add, not null
|
|
194
|
+
* @return {Temporal} an object of the same type with the specified adjustment made, not null
|
|
195
|
+
* @throws DateTimeException - if the addition cannot be made
|
|
196
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
197
|
+
*/
|
|
198
|
+
// eslint-disable-next-line no-unused-vars
|
|
199
|
+
plusAmount(amount) {
|
|
200
|
+
abstractMethodFail('plusAmount');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Returns an object of the same type as this object with the specified period added.
|
|
205
|
+
* This method returns a new object based on this one with the specified period added. For example, on a {@link LocalDate}, this could be used to add a number of years, months or days. The returned object will have the same observable type as this object.
|
|
206
|
+
*
|
|
207
|
+
* In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then adding one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
|
|
208
|
+
*
|
|
209
|
+
* If the implementation represents a date-time that has boundaries, such as {@link LocalTime}, then the permitted units must include the boundary unit, but no multiples of the boundary unit. For example, {@link LocalTime} must accept `DAYS` but not `WEEKS` or `MONTHS`.
|
|
210
|
+
*
|
|
211
|
+
* ### Specification for implementors
|
|
212
|
+
* Implementations must check and handle all units defined in {@link ChronoUnit}. If the unit is supported, then the addition must be performed. If unsupported, then a {@link DateTimeException} must be thrown.
|
|
213
|
+
* If the unit is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.addTo(Temporal, long)` passing this as the first argument.
|
|
214
|
+
*
|
|
215
|
+
* Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
|
|
216
|
+
*
|
|
217
|
+
* @param {number} amountToAdd - the amount of the specified unit to add, may be negative
|
|
218
|
+
* @param {TemporalUnit} unit - the unit of the period to add, not null
|
|
219
|
+
* @return {Temporal} an object of the same type with the specified period added, not null
|
|
220
|
+
* @throws DateTimeException - if the unit cannot be added
|
|
221
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
222
|
+
*/
|
|
223
|
+
// eslint-disable-next-line no-unused-vars
|
|
224
|
+
plusAmountUnit(amountToAdd, unit) {
|
|
225
|
+
abstractMethodFail('plusAmountUnit');
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Calculates the period between this temporal and another temporal in terms of the specified unit.
|
|
230
|
+
* This calculates the period between two temporals in terms of a single unit. The start and end points are this and the specified temporal. The result will be negative if the end is before the start. For example, the period in hours between two temporal objects can be calculated using `startTime.until(endTime, HOURS)`.
|
|
231
|
+
*
|
|
232
|
+
* The calculation returns a whole number, representing the number of complete units between the two temporals. For example, the period in hours between the times 11:30 and 13:29 will only be one hour as it is one minute short of two hours.
|
|
233
|
+
*
|
|
234
|
+
* There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use `TemporalUnit.between(Temporal, Temporal)`:
|
|
235
|
+
*
|
|
236
|
+
* <pre>
|
|
237
|
+
* // these two lines are equivalent
|
|
238
|
+
* between = thisUnit.between(start, end);
|
|
239
|
+
* between = start.until(end, thisUnit);
|
|
240
|
+
* </pre>
|
|
241
|
+
*
|
|
242
|
+
* The choice should be made based on which makes the code more readable.
|
|
243
|
+
* For example, this method allows the number of days between two dates to be calculated:
|
|
244
|
+
*
|
|
245
|
+
* <pre>
|
|
246
|
+
* long daysBetween = DAYS.between(start, end);
|
|
247
|
+
* // or alternatively
|
|
248
|
+
* long daysBetween = start.until(end, DAYS);
|
|
249
|
+
* </pre>
|
|
250
|
+
*
|
|
251
|
+
* ### Specification for implementors
|
|
252
|
+
* Implementations must begin by checking to ensure that the input temporal object is of the same observable type as the implementation. They must then perform the calculation for all instances of {@link ChronoUnit}. A {@link DateTimeException} must be thrown for {@link ChronoUnit} instances that are unsupported.
|
|
253
|
+
* If the unit is not a {@link ChronoUnit}, then the result of this method is obtained by invoking `TemporalUnit.between(Temporal, Temporal)` passing this as the first argument and the input temporal as the second argument.
|
|
254
|
+
*
|
|
255
|
+
* In summary, implementations must behave in a manner equivalent to this code:
|
|
256
|
+
*
|
|
257
|
+
* <pre>
|
|
258
|
+
* // check input temporal is the same type as this class
|
|
259
|
+
* if (unit instanceof ChronoUnit) {
|
|
260
|
+
* // if unit is supported, then calculate and return result
|
|
261
|
+
* // else throw DateTimeException for unsupported units
|
|
262
|
+
* }
|
|
263
|
+
* return unit.between(this, endTemporal);
|
|
264
|
+
* </pre>
|
|
265
|
+
*
|
|
266
|
+
* The target object must not be altered by this method.
|
|
267
|
+
*
|
|
268
|
+
* @param {Temporal} endTemporal - the end temporal, of the same type as this object, not null
|
|
269
|
+
* @param {TemporalUnit} unit - the unit to measure the period in, not null
|
|
270
|
+
* @return {number} the amount of the period between this and the end
|
|
271
|
+
* @throws DateTimeException - if the period cannot be calculated
|
|
272
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
273
|
+
*/
|
|
274
|
+
// eslint-disable-next-line no-unused-vars
|
|
275
|
+
until(endTemporal, unit) {
|
|
276
|
+
abstractMethodFail('until');
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* function overloading for {@link Temporal.with}
|
|
281
|
+
*
|
|
282
|
+
* Called with 1 (or less) arguments, p1 is expected to be a {@link TemporalAdjuster} and {@link Temporal.withAdjuster} is called.
|
|
283
|
+
*
|
|
284
|
+
* Otherwise {@link Temporal.withFieldValue} is called.
|
|
285
|
+
*
|
|
286
|
+
* @param {!(TemporalAdjuster|TemporalField)} p1
|
|
287
|
+
* @param {number} p2
|
|
288
|
+
* @return {Temporal}
|
|
289
|
+
*/
|
|
290
|
+
// eslint-disable-next-line no-unused-vars
|
|
291
|
+
with(p1, p2) {
|
|
292
|
+
if (arguments.length < 2) {
|
|
293
|
+
return this.withAdjuster(p1);
|
|
294
|
+
} else {
|
|
295
|
+
return this.withFieldValue(p1, p2);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Returns an adjusted object of the same type as this object with the adjustment made.
|
|
301
|
+
* This adjusts this date-time according to the rules of the specified adjuster. A simple adjuster might simply set the one of the fields, such as the year field. A more complex adjuster might set the date to the last day of the month. A selection of common adjustments is provided in {@link TemporalAdjusters}. These include finding the "last day of the month" and "next Wednesday". The adjuster is responsible for handling special cases, such as the varying lengths of month and leap years.
|
|
302
|
+
*
|
|
303
|
+
* Some example code indicating how and why this method is used:
|
|
304
|
+
*
|
|
305
|
+
* <pre>
|
|
306
|
+
* date = date.with(Month.JULY); // most key classes implement TemporalAdjuster
|
|
307
|
+
* date = date.with(lastDayOfMonth()); // static import from TemporalAdjusters
|
|
308
|
+
* date = date.with(next(WEDNESDAY)); // static import from TemporalAdjusters and DayOfWeek
|
|
309
|
+
* </pre>
|
|
310
|
+
*
|
|
311
|
+
* ### Specification for implementors
|
|
312
|
+
* Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
|
|
313
|
+
*
|
|
314
|
+
* @param {TemporalAdjuster} adjuster - the adjuster to use, not null
|
|
315
|
+
* @return {Temporal} an object of the same type with the specified adjustment made, not null
|
|
316
|
+
* @throws DateTimeException - if unable to make the adjustment
|
|
317
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
318
|
+
*/
|
|
319
|
+
// eslint-disable-next-line no-unused-vars
|
|
320
|
+
withAdjuster(adjuster) {
|
|
321
|
+
abstractMethodFail('withAdjuster');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Returns an object of the same type as this object with the specified field altered.
|
|
326
|
+
* This returns a new object based on this one with the value for the specified field changed. For example, on a {@link LocalDate}, this could be used to set the year, month or day-of-month. The returned object will have the same observable type as this object.
|
|
327
|
+
*
|
|
328
|
+
* In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
|
|
329
|
+
*
|
|
330
|
+
* ### Specification for implementors
|
|
331
|
+
* Implementations must check and handle all fields defined in {@link ChronoField}. If the field is supported, then the adjustment must be performed. If unsupported, then a {@link DateTimeException} must be thrown.
|
|
332
|
+
* If the field is not a {@link ChronoField}, then the result of this method is obtained by invoking `TemporalField.adjustInto(Temporal, long)` passing this as the first argument.
|
|
333
|
+
*
|
|
334
|
+
* Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
|
|
335
|
+
*
|
|
336
|
+
* @param {TemporalField} field - the field to set in the result, not null
|
|
337
|
+
* @param {number} newValue - the new value of the field in the result
|
|
338
|
+
* @return {Temporal} an object of the same type with the specified field set, not null
|
|
339
|
+
* @throws DateTimeException - if the field cannot be set
|
|
340
|
+
* @throws ArithmeticException - if numeric overflow occurs
|
|
341
|
+
*/
|
|
342
|
+
// eslint-disable-next-line no-unused-vars
|
|
343
|
+
withFieldValue(field, newValue) {
|
|
344
|
+
abstractMethodFail('withFieldValue');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {UnsupportedTemporalTypeException} from '../errors';
|
|
8
|
+
|
|
9
|
+
import {ChronoField} from './ChronoField';
|
|
10
|
+
import {TemporalQueries} from './TemporalQueries';
|
|
11
|
+
|
|
12
|
+
export class TemporalAccessor {
|
|
13
|
+
/**
|
|
14
|
+
* Queries this date-time.
|
|
15
|
+
*
|
|
16
|
+
* This queries this date-time using the specified query strategy object.
|
|
17
|
+
*
|
|
18
|
+
* Queries are a key tool for extracting information from date-times.
|
|
19
|
+
* They exists to externalize the process of querying, permitting different
|
|
20
|
+
* approaches, as per the strategy design pattern.
|
|
21
|
+
* Examples might be a query that checks if the date is the day before February 29th
|
|
22
|
+
* in a leap year, or calculates the number of days to your next birthday.
|
|
23
|
+
*
|
|
24
|
+
* The most common query implementations are method references, such as
|
|
25
|
+
* {@link LocalDate::from} and {@link ZoneId::from}.
|
|
26
|
+
* Further implementations are on {@link TemporalQueries}.
|
|
27
|
+
* Queries may also be defined by applications.
|
|
28
|
+
*
|
|
29
|
+
* @implSpec
|
|
30
|
+
* Implementations of this method must behave as follows:
|
|
31
|
+
* <pre>
|
|
32
|
+
if (query == TemporalQueries.zoneId()
|
|
33
|
+
|| query == TemporalQueries.chronology()
|
|
34
|
+
|| query == TemporalQueries.precision()) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return query.queryFrom(this);
|
|
38
|
+
* </pre>
|
|
39
|
+
*
|
|
40
|
+
* @param {TemporalQuery} query the query to invoke, not null
|
|
41
|
+
* @return the query result, null may be returned (defined by the query)
|
|
42
|
+
* @throws DateTimeException if unable to query
|
|
43
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
44
|
+
*/
|
|
45
|
+
query(query) {
|
|
46
|
+
if (query === TemporalQueries.zoneId()
|
|
47
|
+
|| query === TemporalQueries.chronology()
|
|
48
|
+
|| query === TemporalQueries.precision()) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return query.queryFrom(this);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Gets the value of the specified field as an `int`.
|
|
56
|
+
*
|
|
57
|
+
* This queries the date-time for the value for the specified field.
|
|
58
|
+
* The returned value will always be within the valid range of values for the field.
|
|
59
|
+
* If the date-time cannot return the value, because the field is unsupported or for
|
|
60
|
+
* some other reason, an exception will be thrown.
|
|
61
|
+
*
|
|
62
|
+
* ### Specification for implementors
|
|
63
|
+
*
|
|
64
|
+
* Implementations must check and handle all fields defined in {@link ChronoField}.
|
|
65
|
+
* If the field is supported and has an `int` range, then the value of
|
|
66
|
+
* the field must be returned.
|
|
67
|
+
* If unsupported, then a {@link DateTimeException} must be thrown.
|
|
68
|
+
*
|
|
69
|
+
* If the field is not a {@link ChronoField}, then the result of this method
|
|
70
|
+
* is obtained by invoking {@link TemporalField.getFrom}
|
|
71
|
+
* passing `this` as the argument.
|
|
72
|
+
*
|
|
73
|
+
* Implementations must not alter either this object.
|
|
74
|
+
*
|
|
75
|
+
* @param {TemporalField} field - the field to get, not null
|
|
76
|
+
* @return {number} the value for the field, within the valid range of values
|
|
77
|
+
* @throws DateTimeException if a value for the field cannot be obtained
|
|
78
|
+
* @throws DateTimeException if the range of valid values for the field exceeds an `int`
|
|
79
|
+
* @throws DateTimeException if the value is outside the range of valid values for the field
|
|
80
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
81
|
+
*/
|
|
82
|
+
get(field) {
|
|
83
|
+
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Gets the range of valid values for the specified field.
|
|
88
|
+
*
|
|
89
|
+
* All fields can be expressed as a `long` integer.
|
|
90
|
+
* This method returns an object that describes the valid range for that value.
|
|
91
|
+
* The value of this temporal object is used to enhance the accuracy of the returned range.
|
|
92
|
+
* If the date-time cannot return the range, because the field is unsupported or for
|
|
93
|
+
* some other reason, an exception will be thrown.
|
|
94
|
+
*
|
|
95
|
+
* Note that the result only describes the minimum and maximum valid values
|
|
96
|
+
* and it is important not to read too much into them. For example, there
|
|
97
|
+
* could be values within the range that are invalid for the field.
|
|
98
|
+
*
|
|
99
|
+
* ### Specification for implementors
|
|
100
|
+
*
|
|
101
|
+
* Implementations must check and handle all fields defined in {@link ChronoField}.
|
|
102
|
+
* If the field is supported, then the range of the field must be returned.
|
|
103
|
+
* If unsupported, then a {@link DateTimeException} must be thrown.
|
|
104
|
+
*
|
|
105
|
+
* If the field is not a {@link ChronoField}, then the result of this method
|
|
106
|
+
* is obtained by invoking {@link TemporalField.rangeRefinedBy}
|
|
107
|
+
* passing `this` as the argument.
|
|
108
|
+
*
|
|
109
|
+
* Implementations must not alter either this object.
|
|
110
|
+
*
|
|
111
|
+
* @param {TemporalField} field the field to query the range for, not null
|
|
112
|
+
* @return {ValueRange} the range of valid values for the field, not null
|
|
113
|
+
* @throws DateTimeException if the range for the field cannot be obtained
|
|
114
|
+
*/
|
|
115
|
+
range(field) {
|
|
116
|
+
if (field instanceof ChronoField) {
|
|
117
|
+
if (this.isSupported(field)) {
|
|
118
|
+
return field.range();
|
|
119
|
+
}
|
|
120
|
+
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
|
|
121
|
+
}
|
|
122
|
+
return field.rangeRefinedBy(this);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {abstractMethodFail} from '../assert';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Strategy for adjusting a temporal object.
|
|
11
|
+
*
|
|
12
|
+
* Adjusters are a key tool for modifying temporal objects.
|
|
13
|
+
* They exist to externalize the process of adjustment, permitting different
|
|
14
|
+
* approaches, as per the strategy design pattern.
|
|
15
|
+
* Examples might be an adjuster that sets the date avoiding weekends, or one that
|
|
16
|
+
* sets the date to the last day of the month.
|
|
17
|
+
*
|
|
18
|
+
* There are two equivalent ways of using a {@link TemporalAdjuster}.
|
|
19
|
+
* The first is to invoke the method on this interface directly.
|
|
20
|
+
* The second is to use {@link Temporal#with}:
|
|
21
|
+
* <pre>
|
|
22
|
+
* // these two lines are equivalent, but the second approach is recommended
|
|
23
|
+
* temporal = thisAdjuster.adjustInto(temporal);
|
|
24
|
+
* temporal = temporal.with(thisAdjuster);
|
|
25
|
+
* </pre>
|
|
26
|
+
* It is recommended to use the second approach, {@link with},
|
|
27
|
+
* as it is a lot clearer to read in code.
|
|
28
|
+
*
|
|
29
|
+
* See {@link TemporalAdjusters} for a standard set of adjusters, including finding the
|
|
30
|
+
* last day of the month.
|
|
31
|
+
* Adjusters may also be defined by applications.
|
|
32
|
+
*
|
|
33
|
+
* ### Specification for implementors
|
|
34
|
+
*
|
|
35
|
+
* This interface places no restrictions on the mutability of implementations,
|
|
36
|
+
* however immutability is strongly recommended.
|
|
37
|
+
*
|
|
38
|
+
* @interface
|
|
39
|
+
*/
|
|
40
|
+
export class TemporalAdjuster {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Adjusts the specified temporal object.
|
|
44
|
+
*
|
|
45
|
+
* This adjusts the specified temporal object using the logic
|
|
46
|
+
* encapsulated in the implementing class.
|
|
47
|
+
* Examples might be an adjuster that sets the date avoiding weekends, or one that
|
|
48
|
+
* sets the date to the last day of the month.
|
|
49
|
+
*
|
|
50
|
+
* There are two equivalent ways of using this method.
|
|
51
|
+
* The first is to invoke this method directly.
|
|
52
|
+
* The second is to use {@link Temporal#with}:
|
|
53
|
+
* <pre>
|
|
54
|
+
* // these two lines are equivalent, but the second approach is recommended
|
|
55
|
+
* temporal = thisAdjuster.adjustInto(temporal);
|
|
56
|
+
* temporal = temporal.with(thisAdjuster);
|
|
57
|
+
* </pre>
|
|
58
|
+
* It is recommended to use the second approach, {@link with},
|
|
59
|
+
* as it is a lot clearer to read in code.
|
|
60
|
+
*
|
|
61
|
+
* ### Specification for implementors
|
|
62
|
+
*
|
|
63
|
+
* The implementation must take the input object and adjust it.
|
|
64
|
+
* The implementation defines the logic of the adjustment and is responsible for
|
|
65
|
+
* documenting that logic. It may use any method on {@link Temporal} to
|
|
66
|
+
* query the temporal object and perform the adjustment.
|
|
67
|
+
* The returned object must have the same observable type as the input object
|
|
68
|
+
*
|
|
69
|
+
* The input object must not be altered.
|
|
70
|
+
* Instead, an adjusted copy of the original must be returned.
|
|
71
|
+
* This provides equivalent, safe behavior for immutable and mutable temporal objects.
|
|
72
|
+
*
|
|
73
|
+
* The input temporal object may be in a calendar system other than ISO.
|
|
74
|
+
* Implementations may choose to document compatibility with other calendar systems,
|
|
75
|
+
* or reject non-ISO temporal objects by querying the chronology (see {@link TemporalQueries#chronology}).
|
|
76
|
+
*
|
|
77
|
+
* This method may be called from multiple threads in parallel.
|
|
78
|
+
* It must be thread-safe when invoked.
|
|
79
|
+
*
|
|
80
|
+
* @param {Temporal} temporal the temporal object to adjust, not null
|
|
81
|
+
* @return {Temporal} an object of the same observable type with the adjustment made, not null
|
|
82
|
+
* @throws DateTimeException if unable to make the adjustment
|
|
83
|
+
* @throws ArithmeticException if numeric overflow occurs
|
|
84
|
+
*
|
|
85
|
+
* @abstract
|
|
86
|
+
*/
|
|
87
|
+
// eslint-disable-next-line no-unused-vars
|
|
88
|
+
adjustInto(temporal){
|
|
89
|
+
abstractMethodFail('adjustInto');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
}
|