@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,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {assert} from '../../assert';
|
|
8
|
+
import {ArithmeticException, DateTimeException, IllegalArgumentException} from '../../errors';
|
|
9
|
+
import {MathUtil} from '../../MathUtil';
|
|
10
|
+
|
|
11
|
+
import {IsoChronology} from '../../chrono/IsoChronology';
|
|
12
|
+
|
|
13
|
+
import {SignStyle} from '../SignStyle';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const MAX_WIDTH = 15; // can't parse all numbers with more then 15 digits in javascript
|
|
17
|
+
|
|
18
|
+
const EXCEED_POINTS = [
|
|
19
|
+
0,
|
|
20
|
+
10,
|
|
21
|
+
100,
|
|
22
|
+
1000,
|
|
23
|
+
10000,
|
|
24
|
+
100000,
|
|
25
|
+
1000000,
|
|
26
|
+
10000000,
|
|
27
|
+
100000000,
|
|
28
|
+
1000000000
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
export class NumberPrinterParser {
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Constructor.
|
|
38
|
+
*
|
|
39
|
+
* @param field the field to print, not null
|
|
40
|
+
* @param minWidth the minimum field width, from 1 to 19
|
|
41
|
+
* @param maxWidth the maximum field width, from minWidth to 19
|
|
42
|
+
* @param signStyle the positive/negative sign style, not null
|
|
43
|
+
* @param subsequentWidth the width of subsequent non-negative numbers, 0 or greater,
|
|
44
|
+
* -1 if fixed width due to active adjacent parsing
|
|
45
|
+
*/
|
|
46
|
+
constructor(field, minWidth, maxWidth, signStyle, subsequentWidth=0){
|
|
47
|
+
this._field = field;
|
|
48
|
+
this._minWidth = minWidth;
|
|
49
|
+
this._maxWidth = maxWidth;
|
|
50
|
+
this._signStyle = signStyle;
|
|
51
|
+
this._subsequentWidth = subsequentWidth;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
field(){ return this._field;}
|
|
55
|
+
minWidth(){ return this._minWidth;}
|
|
56
|
+
maxWidth(){ return this._maxWidth;}
|
|
57
|
+
signStyle(){ return this._signStyle;}
|
|
58
|
+
|
|
59
|
+
withFixedWidth() {
|
|
60
|
+
if (this._subsequentWidth === -1) {
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
return new NumberPrinterParser(this._field, this._minWidth, this._maxWidth, this._signStyle, -1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
withSubsequentWidth(subsequentWidth) {
|
|
67
|
+
return new NumberPrinterParser(this._field, this._minWidth, this._maxWidth, this._signStyle, this._subsequentWidth + subsequentWidth);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_isFixedWidth() {
|
|
71
|
+
return this._subsequentWidth === -1 ||
|
|
72
|
+
(this._subsequentWidth > 0 && this._minWidth === this._maxWidth && this._signStyle === SignStyle.NOT_NEGATIVE);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
print(context, buf) {
|
|
76
|
+
const contextValue = context.getValue(this._field);
|
|
77
|
+
if (contextValue == null) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const value = this._getValue(context, contextValue);
|
|
81
|
+
const symbols = context.symbols();
|
|
82
|
+
let str = '' + Math.abs(value);
|
|
83
|
+
if (str.length > this._maxWidth) {
|
|
84
|
+
throw new DateTimeException('Field ' + this._field +
|
|
85
|
+
' cannot be printed as the value ' + value +
|
|
86
|
+
' exceeds the maximum print width of ' + this._maxWidth);
|
|
87
|
+
}
|
|
88
|
+
str = symbols.convertNumberToI18N(str);
|
|
89
|
+
|
|
90
|
+
if (value >= 0) {
|
|
91
|
+
switch (this._signStyle) {
|
|
92
|
+
case SignStyle.EXCEEDS_PAD:
|
|
93
|
+
if (this._minWidth < MAX_WIDTH && value >= EXCEED_POINTS[this._minWidth]) {
|
|
94
|
+
buf.append(symbols.positiveSign());
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
case SignStyle.ALWAYS:
|
|
98
|
+
buf.append(symbols.positiveSign());
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
switch (this._signStyle) {
|
|
103
|
+
case SignStyle.NORMAL:
|
|
104
|
+
case SignStyle.EXCEEDS_PAD:
|
|
105
|
+
case SignStyle.ALWAYS:
|
|
106
|
+
buf.append(symbols.negativeSign());
|
|
107
|
+
break;
|
|
108
|
+
case SignStyle.NOT_NEGATIVE:
|
|
109
|
+
throw new DateTimeException('Field ' + this._field +
|
|
110
|
+
' cannot be printed as the value ' + value +
|
|
111
|
+
' cannot be negative according to the SignStyle');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (let i = 0; i < this._minWidth - str.length; i++) {
|
|
115
|
+
buf.append(symbols.zeroDigit());
|
|
116
|
+
}
|
|
117
|
+
buf.append(str);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
parse(context, text, position){
|
|
122
|
+
const length = text.length;
|
|
123
|
+
if (position === length) {
|
|
124
|
+
return ~position;
|
|
125
|
+
}
|
|
126
|
+
assert(position>=0 && position<length);
|
|
127
|
+
const sign = text.charAt(position); // IOOBE if invalid position
|
|
128
|
+
let negative = false;
|
|
129
|
+
let positive = false;
|
|
130
|
+
if (sign === context.symbols().positiveSign()) {
|
|
131
|
+
if (this._signStyle.parse(true, context.isStrict(), this._minWidth === this._maxWidth) === false) {
|
|
132
|
+
return ~position;
|
|
133
|
+
}
|
|
134
|
+
positive = true;
|
|
135
|
+
position++;
|
|
136
|
+
} else if (sign === context.symbols().negativeSign()) {
|
|
137
|
+
if (this._signStyle.parse(false, context.isStrict(), this._minWidth === this._maxWidth) === false) {
|
|
138
|
+
return ~position;
|
|
139
|
+
}
|
|
140
|
+
negative = true;
|
|
141
|
+
position++;
|
|
142
|
+
} else {
|
|
143
|
+
if (this._signStyle === SignStyle.ALWAYS && context.isStrict()) {
|
|
144
|
+
return ~position;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const effMinWidth = (context.isStrict() || this._isFixedWidth() ? this._minWidth : 1);
|
|
148
|
+
const minEndPos = position + effMinWidth;
|
|
149
|
+
if (minEndPos > length) {
|
|
150
|
+
return ~position;
|
|
151
|
+
}
|
|
152
|
+
let effMaxWidth = (context.isStrict() || this._isFixedWidth() ? this._maxWidth : 9) + Math.max(this._subsequentWidth, 0);
|
|
153
|
+
let total = 0;
|
|
154
|
+
let pos = position;
|
|
155
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
156
|
+
const maxEndPos = Math.min(pos + effMaxWidth, length);
|
|
157
|
+
while (pos < maxEndPos) {
|
|
158
|
+
const ch = text.charAt(pos++);
|
|
159
|
+
const digit = context.symbols().convertToDigit(ch);
|
|
160
|
+
if (digit < 0) {
|
|
161
|
+
pos--;
|
|
162
|
+
if (pos < minEndPos) {
|
|
163
|
+
return ~position; // need at least min width digits
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if ((pos - position) > MAX_WIDTH) {
|
|
168
|
+
throw new ArithmeticException('number text exceeds length');
|
|
169
|
+
} else {
|
|
170
|
+
total = total * 10 + digit;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (this._subsequentWidth > 0 && pass === 0) {
|
|
174
|
+
// re-parse now we know the correct width
|
|
175
|
+
const parseLen = pos - position;
|
|
176
|
+
effMaxWidth = Math.max(effMinWidth, parseLen - this._subsequentWidth);
|
|
177
|
+
pos = position;
|
|
178
|
+
total = 0;
|
|
179
|
+
} else {
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (negative) {
|
|
184
|
+
if (total === 0 && context.isStrict()) {
|
|
185
|
+
return ~(position - 1); // minus zero not allowed
|
|
186
|
+
}
|
|
187
|
+
if(total !== 0) {
|
|
188
|
+
total = -total;
|
|
189
|
+
}
|
|
190
|
+
} else if (this._signStyle === SignStyle.EXCEEDS_PAD && context.isStrict()) {
|
|
191
|
+
const parseLen = pos - position;
|
|
192
|
+
if (positive) {
|
|
193
|
+
if (parseLen <= this._minWidth) {
|
|
194
|
+
return ~(position - 1); // '+' only parsed if minWidth exceeded
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
if (parseLen > this._minWidth) {
|
|
198
|
+
return ~position; // '+' must be parsed if minWidth exceeded
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return this._setValue(context, total, position, pos);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Gets the value to output.
|
|
207
|
+
* (This is needed to allow e.g. ReducedPrinterParser to override this and change the value!
|
|
208
|
+
*
|
|
209
|
+
* @param context the context
|
|
210
|
+
* @param value the value of the field, not null
|
|
211
|
+
* @return the value
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
_getValue(context, value) {
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Stores the value.
|
|
220
|
+
*
|
|
221
|
+
* @param context the context to store into, not null
|
|
222
|
+
* @param value the value
|
|
223
|
+
* @param errorPos the position of the field being parsed
|
|
224
|
+
* @param successPos the position after the field being parsed
|
|
225
|
+
* @return the new position
|
|
226
|
+
*/
|
|
227
|
+
_setValue(context, value, errorPos, successPos) {
|
|
228
|
+
return context.setParsedField(this._field, value, errorPos, successPos);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
toString() {
|
|
232
|
+
if (this._minWidth === 1 && this._maxWidth === MAX_WIDTH && this._signStyle === SignStyle.NORMAL) {
|
|
233
|
+
return 'Value(' + this._field + ')';
|
|
234
|
+
}
|
|
235
|
+
if (this._minWidth === this._maxWidth && this._signStyle === SignStyle.NOT_NEGATIVE) {
|
|
236
|
+
return 'Value(' + this._field + ',' + this._minWidth + ')';
|
|
237
|
+
}
|
|
238
|
+
return 'Value(' + this._field + ',' + this._minWidth + ',' + this._maxWidth + ',' + this._signStyle + ')';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
//-----------------------------------------------------------------------
|
|
243
|
+
/**
|
|
244
|
+
* Prints and parses a reduced numeric date-time field.
|
|
245
|
+
* @private
|
|
246
|
+
*/
|
|
247
|
+
export class ReducedPrinterParser extends NumberPrinterParser {
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Constructor.
|
|
251
|
+
*
|
|
252
|
+
* @param {TemporalField} field the field to print, validated not null
|
|
253
|
+
* @param {number} width the field width, from 1 to 10
|
|
254
|
+
* @param {number} maxWidth the field max width, from 1 to 10
|
|
255
|
+
* @param {number} baseValue the base value
|
|
256
|
+
* @param {ChronoLocalDate} baseDate the base date
|
|
257
|
+
*/
|
|
258
|
+
constructor(field, width, maxWidth, baseValue, baseDate) {
|
|
259
|
+
super(field, width, maxWidth, SignStyle.NOT_NEGATIVE);
|
|
260
|
+
if (width < 1 || width > 10) {
|
|
261
|
+
throw new IllegalArgumentException('The width must be from 1 to 10 inclusive but was ' + width);
|
|
262
|
+
}
|
|
263
|
+
if (maxWidth < 1 || maxWidth > 10) {
|
|
264
|
+
throw new IllegalArgumentException('The maxWidth must be from 1 to 10 inclusive but was ' + maxWidth);
|
|
265
|
+
}
|
|
266
|
+
if (maxWidth < width) {
|
|
267
|
+
throw new IllegalArgumentException('The maxWidth must be greater than the width');
|
|
268
|
+
}
|
|
269
|
+
if (baseDate === null) {
|
|
270
|
+
if (field.range().isValidValue(baseValue) === false) {
|
|
271
|
+
throw new IllegalArgumentException('The base value must be within the range of the field');
|
|
272
|
+
}
|
|
273
|
+
if ((baseValue + EXCEED_POINTS[width]) > MathUtil.MAX_SAFE_INTEGER) {
|
|
274
|
+
throw new DateTimeException('Unable to add printer-parser as the range exceeds the capacity of an int');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
this._baseValue = baseValue;
|
|
278
|
+
this._baseDate = baseDate;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
*
|
|
283
|
+
* @param {DateTimePrintContext} context
|
|
284
|
+
* @param {number} value
|
|
285
|
+
*/
|
|
286
|
+
_getValue(context, value) {
|
|
287
|
+
const absValue = Math.abs(value);
|
|
288
|
+
let baseValue = this._baseValue;
|
|
289
|
+
if (this._baseDate !== null) {
|
|
290
|
+
// TODO: in threetenbp the following line is used, but we dont have Chronology yet,
|
|
291
|
+
// let chrono = Chronology.from(context.getTemporal());
|
|
292
|
+
// so let's use IsoChronology for now
|
|
293
|
+
context.temporal();
|
|
294
|
+
const chrono = IsoChronology.INSTANCE;
|
|
295
|
+
baseValue = chrono.date(this._baseDate).get(this._field);
|
|
296
|
+
}
|
|
297
|
+
if (value >= baseValue && value < baseValue + EXCEED_POINTS[this._minWidth]) {
|
|
298
|
+
return absValue % EXCEED_POINTS[this._minWidth];
|
|
299
|
+
}
|
|
300
|
+
return absValue % EXCEED_POINTS[this._maxWidth];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* @param {DateTimeParseContext} context
|
|
306
|
+
* @param {number} value
|
|
307
|
+
* @param {number} errorPos
|
|
308
|
+
* @param {number} successPos
|
|
309
|
+
*/
|
|
310
|
+
_setValue(context, value, errorPos, successPos) {
|
|
311
|
+
let baseValue = this._baseValue;
|
|
312
|
+
if (this._baseDate != null) {
|
|
313
|
+
const chrono = context.getEffectiveChronology();
|
|
314
|
+
baseValue = chrono.date(this._baseDate).get(this._field);
|
|
315
|
+
// TODO: not implemented??
|
|
316
|
+
// context.addChronologyChangedParser(this, value, errorPos, successPos);
|
|
317
|
+
}
|
|
318
|
+
const parseLen = successPos - errorPos;
|
|
319
|
+
if (parseLen === this._minWidth && value >= 0) {
|
|
320
|
+
const range = EXCEED_POINTS[this._minWidth];
|
|
321
|
+
const lastPart = baseValue % range;
|
|
322
|
+
const basePart = baseValue - lastPart;
|
|
323
|
+
if (baseValue > 0) {
|
|
324
|
+
value = basePart + value;
|
|
325
|
+
} else {
|
|
326
|
+
value = basePart - value;
|
|
327
|
+
}
|
|
328
|
+
if (value < baseValue) {
|
|
329
|
+
value += range;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return context.setParsedField(this._field, value, errorPos, successPos);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
withFixedWidth() {
|
|
336
|
+
if (this._subsequentWidth === -1) {
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
return new ReducedPrinterParser(this._field, this._minWidth, this._maxWidth, this._baseValue, this._baseDate, -1);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
*
|
|
344
|
+
* @param {number} subsequentWidth
|
|
345
|
+
* @returns {ReducedPrinterParser}
|
|
346
|
+
*/
|
|
347
|
+
withSubsequentWidth(subsequentWidth) {
|
|
348
|
+
return new ReducedPrinterParser(this._field, this._minWidth, this._maxWidth, this._baseValue, this._baseDate,
|
|
349
|
+
this._subsequentWidth + subsequentWidth);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
*
|
|
354
|
+
* @param {DateTimeParseContext} context
|
|
355
|
+
*/
|
|
356
|
+
isFixedWidth(context) {
|
|
357
|
+
if (context.isStrict() === false) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
return super.isFixedWidth(context);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
toString() {
|
|
364
|
+
return 'ReducedValue(' + this._field + ',' + this._minWidth + ',' + this._maxWidth + ',' + (this._baseDate != null ? this._baseDate : this._baseValue) + ')';
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
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 {IllegalArgumentException} from '../../errors';
|
|
9
|
+
import {MathUtil} from '../../MathUtil';
|
|
10
|
+
|
|
11
|
+
import {ChronoField} from '../../temporal/ChronoField';
|
|
12
|
+
|
|
13
|
+
//-----------------------------------------------------------------------
|
|
14
|
+
const PATTERNS = [
|
|
15
|
+
'+HH', '+HHmm', '+HH:mm', '+HHMM', '+HH:MM', '+HHMMss', '+HH:MM:ss', '+HHMMSS', '+HH:MM:SS'
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Prints or parses an offset ID.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export class OffsetIdPrinterParser {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Constructor.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} noOffsetText the text to use for UTC, not null
|
|
27
|
+
* @param {string} pattern the pattern
|
|
28
|
+
*/
|
|
29
|
+
constructor(noOffsetText, pattern) {
|
|
30
|
+
requireNonNull(noOffsetText, 'noOffsetText');
|
|
31
|
+
requireNonNull(pattern, 'pattern');
|
|
32
|
+
this.noOffsetText = noOffsetText;
|
|
33
|
+
this.type = this._checkPattern(pattern);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {String} pattern
|
|
38
|
+
* @return {number}
|
|
39
|
+
*/
|
|
40
|
+
_checkPattern(pattern) {
|
|
41
|
+
for (let i = 0; i < PATTERNS.length; i++) {
|
|
42
|
+
if (PATTERNS[i] === pattern) {
|
|
43
|
+
return i;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw new IllegalArgumentException('Invalid zone offset pattern: ' + pattern);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {DateTimePrintContext} context
|
|
51
|
+
* @param {StringBuilder} buf
|
|
52
|
+
* @return {boolean}
|
|
53
|
+
*/
|
|
54
|
+
print(context, buf) {
|
|
55
|
+
const offsetSecs = context.getValue(ChronoField.OFFSET_SECONDS);
|
|
56
|
+
if (offsetSecs == null) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const totalSecs = MathUtil.safeToInt(offsetSecs);
|
|
60
|
+
if (totalSecs === 0) {
|
|
61
|
+
buf.append(this.noOffsetText);
|
|
62
|
+
} else {
|
|
63
|
+
const absHours = Math.abs(MathUtil.intMod(MathUtil.intDiv(totalSecs, 3600), 100)); // anything larger than 99 silently dropped
|
|
64
|
+
const absMinutes = Math.abs(MathUtil.intMod(MathUtil.intDiv(totalSecs, 60), 60));
|
|
65
|
+
const absSeconds = Math.abs(MathUtil.intMod(totalSecs, 60));
|
|
66
|
+
const bufPos = buf.length();
|
|
67
|
+
let output = absHours;
|
|
68
|
+
buf.append(totalSecs < 0 ? '-' : '+')
|
|
69
|
+
.appendChar((MathUtil.intDiv(absHours, 10) + '0')).appendChar(MathUtil.intMod(absHours, 10) + '0');
|
|
70
|
+
if (this.type >= 3 || (this.type >= 1 && absMinutes > 0)) {
|
|
71
|
+
buf.append((this.type % 2) === 0 ? ':' : '')
|
|
72
|
+
.appendChar((MathUtil.intDiv(absMinutes, 10) + '0')).appendChar((absMinutes % 10 + '0'));
|
|
73
|
+
output += absMinutes;
|
|
74
|
+
if (this.type >= 7 || (this.type >= 5 && absSeconds > 0)) {
|
|
75
|
+
buf.append((this.type % 2) === 0 ? ':' : '')
|
|
76
|
+
.appendChar((MathUtil.intDiv(absSeconds, 10) + '0')).appendChar((absSeconds % 10 + '0'));
|
|
77
|
+
output += absSeconds;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (output === 0) {
|
|
81
|
+
buf.setLength(bufPos);
|
|
82
|
+
buf.append(this.noOffsetText);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {DateTimeParseContext} context
|
|
90
|
+
* @param {String} text
|
|
91
|
+
* @param {number} position
|
|
92
|
+
* @return {number}
|
|
93
|
+
*/
|
|
94
|
+
parse(context, text, position) {
|
|
95
|
+
const length = text.length;
|
|
96
|
+
const noOffsetLen = this.noOffsetText.length;
|
|
97
|
+
if (noOffsetLen === 0) {
|
|
98
|
+
if (position === length) {
|
|
99
|
+
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position);
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (position === length) {
|
|
103
|
+
return ~position;
|
|
104
|
+
}
|
|
105
|
+
if (context.subSequenceEquals(text, position, this.noOffsetText, 0, noOffsetLen)) {
|
|
106
|
+
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position + noOffsetLen);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// parse normal plus/minus offset
|
|
111
|
+
const sign = text[position]; // IOOBE if invalid position
|
|
112
|
+
if (sign === '+' || sign === '-') {
|
|
113
|
+
// starts
|
|
114
|
+
const negative = (sign === '-' ? -1 : 1);
|
|
115
|
+
const array = [0,0,0,0];
|
|
116
|
+
array[0] = position + 1;
|
|
117
|
+
if ((this._parseNumber(array, 1, text, true) ||
|
|
118
|
+
this._parseNumber(array, 2, text, this.type >=3) ||
|
|
119
|
+
this._parseNumber(array, 3, text, false)) === false) {
|
|
120
|
+
// success
|
|
121
|
+
const offsetSecs = MathUtil.safeZero(negative * (array[1] * 3600 + array[2] * 60 + array[3]));
|
|
122
|
+
return context.setParsedField(ChronoField.OFFSET_SECONDS, offsetSecs, position, array[0]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// handle special case of empty no offset text
|
|
126
|
+
if (noOffsetLen === 0) {
|
|
127
|
+
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position + noOffsetLen);
|
|
128
|
+
}
|
|
129
|
+
return ~position;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Parse a two digit zero-prefixed number.
|
|
134
|
+
*
|
|
135
|
+
* @param {number[]} array the array of parsed data, 0=pos,1=hours,2=mins,3=secs, not null
|
|
136
|
+
* @param {number} arrayIndex the index to parse the value into
|
|
137
|
+
* @param {string} parseText the offset ID, not null
|
|
138
|
+
* @param {boolean} required whether this number is required
|
|
139
|
+
* @return {boolean} true if an error occurred
|
|
140
|
+
*/
|
|
141
|
+
_parseNumber(array, arrayIndex, parseText, required) {
|
|
142
|
+
if ((this.type + 3) / 2 < arrayIndex) {
|
|
143
|
+
return false; // ignore seconds/minutes
|
|
144
|
+
}
|
|
145
|
+
let pos = array[0];
|
|
146
|
+
if ((this.type % 2) === 0 && arrayIndex > 1) {
|
|
147
|
+
if (pos + 1 > parseText.length || parseText[pos] !== ':') {
|
|
148
|
+
return required;
|
|
149
|
+
}
|
|
150
|
+
pos++;
|
|
151
|
+
}
|
|
152
|
+
if (pos + 2 > parseText.length) {
|
|
153
|
+
return required;
|
|
154
|
+
}
|
|
155
|
+
const ch1 = parseText[pos++];
|
|
156
|
+
const ch2 = parseText[pos++];
|
|
157
|
+
if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
|
|
158
|
+
return required;
|
|
159
|
+
}
|
|
160
|
+
const value = (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
|
|
161
|
+
if (value < 0 || value > 59) {
|
|
162
|
+
return required;
|
|
163
|
+
}
|
|
164
|
+
array[arrayIndex] = value;
|
|
165
|
+
array[0] = pos;
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
toString() {
|
|
171
|
+
const converted = this.noOffsetText.replace('\'', '\'\'');
|
|
172
|
+
return 'Offset(' + PATTERNS[this.type] + ',\'' + converted + '\')';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
OffsetIdPrinterParser.INSTANCE_ID = new OffsetIdPrinterParser('Z', '+HH:MM:ss');
|
|
176
|
+
OffsetIdPrinterParser.PATTERNS = PATTERNS;
|
|
177
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
3
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {assert} from '../../assert';
|
|
8
|
+
|
|
9
|
+
import {DateTimeException} from '../../errors';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Pads the output to a fixed width.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export class PadPrinterParserDecorator {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Constructor.
|
|
19
|
+
*
|
|
20
|
+
* @param printerParser the printer, not null
|
|
21
|
+
* @param padWidth the width to pad to, 1 or greater
|
|
22
|
+
* @param padChar the pad character
|
|
23
|
+
*/
|
|
24
|
+
constructor(printerParser, padWidth, padChar) {
|
|
25
|
+
// input checked by DateTimeFormatterBuilder
|
|
26
|
+
this._printerParser = printerParser;
|
|
27
|
+
this._padWidth = padWidth;
|
|
28
|
+
this._padChar = padChar;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
print(context, buf) {
|
|
32
|
+
const preLen = buf.length();
|
|
33
|
+
if (this._printerParser.print(context, buf) === false) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const len = buf.length() - preLen;
|
|
37
|
+
if (len > this._padWidth) {
|
|
38
|
+
throw new DateTimeException(
|
|
39
|
+
`Cannot print as output of ${len} characters exceeds pad width of ${this._padWidth}`);
|
|
40
|
+
}
|
|
41
|
+
for (let i = 0; i < this._padWidth - len; i++) {
|
|
42
|
+
buf.insert(preLen, this._padChar);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
parse(context, text, position) {
|
|
48
|
+
// cache context before changed by decorated parser
|
|
49
|
+
const strict = context.isStrict();
|
|
50
|
+
const caseSensitive = context.isCaseSensitive();
|
|
51
|
+
// parse
|
|
52
|
+
assert(!(position > text.length));
|
|
53
|
+
assert(position >= 0);
|
|
54
|
+
if (position === text.length) {
|
|
55
|
+
return ~position; // no more characters in the string
|
|
56
|
+
}
|
|
57
|
+
let endPos = position + this._padWidth;
|
|
58
|
+
if (endPos > text.length) {
|
|
59
|
+
if (strict) {
|
|
60
|
+
return ~position; // not enough characters in the string to meet the parse width
|
|
61
|
+
}
|
|
62
|
+
endPos = text.length;
|
|
63
|
+
}
|
|
64
|
+
let pos = position;
|
|
65
|
+
while (pos < endPos &&
|
|
66
|
+
(caseSensitive ? text[pos] === this._padChar : context.charEquals(text[pos], this._padChar))) {
|
|
67
|
+
pos++;
|
|
68
|
+
}
|
|
69
|
+
text = text.substring(0, endPos);
|
|
70
|
+
const resultPos = this._printerParser.parse(context, text, pos);
|
|
71
|
+
if (resultPos !== endPos && strict) {
|
|
72
|
+
return ~(position + pos); // parse of decorated field didn't parse to the end
|
|
73
|
+
}
|
|
74
|
+
return resultPos;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
toString() {
|
|
78
|
+
return `Pad(${this._printerParser},${this._padWidth}${(this._padChar === ' ' ? ')' : ',\'' + this._padChar + '\')')}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { Enum } from '../../Enum';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export class SettingsParser extends Enum {
|
|
13
|
+
|
|
14
|
+
print(/*context, buf*/) {
|
|
15
|
+
return true; // nothing to do here
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
parse(context, text, position) {
|
|
19
|
+
// using ordinals to avoid javac synthetic inner class
|
|
20
|
+
switch (this) {
|
|
21
|
+
case SettingsParser.SENSITIVE: context.setCaseSensitive(true); break;
|
|
22
|
+
case SettingsParser.INSENSITIVE: context.setCaseSensitive(false); break;
|
|
23
|
+
case SettingsParser.STRICT: context.setStrict(true); break;
|
|
24
|
+
case SettingsParser.LENIENT: context.setStrict(false); break;
|
|
25
|
+
}
|
|
26
|
+
return position;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
toString() {
|
|
30
|
+
// using ordinals to avoid javac synthetic inner class
|
|
31
|
+
switch (this) {
|
|
32
|
+
case SettingsParser.SENSITIVE: return 'ParseCaseSensitive(true)';
|
|
33
|
+
case SettingsParser.INSENSITIVE: return 'ParseCaseSensitive(false)';
|
|
34
|
+
case SettingsParser.STRICT: return 'ParseStrict(true)';
|
|
35
|
+
case SettingsParser.LENIENT: return 'ParseStrict(false)';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
SettingsParser.SENSITIVE = new SettingsParser('SENSITIVE');
|
|
41
|
+
SettingsParser.INSENSITIVE = new SettingsParser('INSENSITIVE');
|
|
42
|
+
SettingsParser.STRICT = new SettingsParser('STRICT');
|
|
43
|
+
SettingsParser.LENIENT = new SettingsParser('LENIENT');
|
|
44
|
+
|