effect 4.1.0 → 4.1.1
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/README.md +30 -0
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/dist/BigDecimal.d.ts +139 -7
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +83 -14
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Equal.d.ts +2 -2
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +3 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Hash.d.ts +3 -2
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -4
- package/dist/Hash.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -8
- package/dist/Iterable.js.map +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +5 -1
- package/dist/Path.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +2 -1
- package/dist/Pool.js.map +1 -1
- package/dist/Schema.d.ts +2 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +4 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +4 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.js +2 -2
- package/dist/ai/McpClient.d.ts +171 -19
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +277 -66
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +108 -0
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +99 -0
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts +120 -6
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +215 -34
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +20 -11
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +5 -7
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/internal/mcpCore.js +72 -3
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +42 -7
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +12 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +3 -3
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSkills.d.ts +2 -0
- package/dist/ai/internal/mcpSkills.d.ts.map +1 -0
- package/dist/ai/internal/mcpSkills.js +428 -0
- package/dist/ai/internal/mcpSkills.js.map +1 -0
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +15 -5
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Reply.d.ts +1 -1
- package/dist/cluster/Reply.d.ts.map +1 -1
- package/dist/cluster/Reply.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +4 -1
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +15 -7
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/crypto/Aead.d.ts +2 -1
- package/dist/crypto/Aead.d.ts.map +1 -1
- package/dist/crypto/Aead.js +2 -2
- package/dist/crypto/Aead.js.map +1 -1
- package/dist/crypto/Cipher.d.ts +2 -1
- package/dist/crypto/Cipher.d.ts.map +1 -1
- package/dist/crypto/Cipher.js +2 -2
- package/dist/crypto/Cipher.js.map +1 -1
- package/dist/crypto/KeyAgreement.d.ts +3 -2
- package/dist/crypto/KeyAgreement.d.ts.map +1 -1
- package/dist/crypto/KeyAgreement.js +2 -2
- package/dist/crypto/KeyAgreement.js.map +1 -1
- package/dist/crypto/KeyFormat.d.ts +33 -1
- package/dist/crypto/KeyFormat.d.ts.map +1 -1
- package/dist/crypto/KeyFormat.js.map +1 -1
- package/dist/crypto/KeyWrap.d.ts +4 -3
- package/dist/crypto/KeyWrap.d.ts.map +1 -1
- package/dist/crypto/KeyWrap.js +2 -2
- package/dist/crypto/KeyWrap.js.map +1 -1
- package/dist/crypto/Mac.d.ts +2 -1
- package/dist/crypto/Mac.d.ts.map +1 -1
- package/dist/crypto/Mac.js +2 -2
- package/dist/crypto/Mac.js.map +1 -1
- package/dist/crypto/Signature.d.ts +3 -2
- package/dist/crypto/Signature.d.ts.map +1 -1
- package/dist/crypto/Signature.js +2 -2
- package/dist/crypto/Signature.js.map +1 -1
- package/dist/crypto/WebCrypto.d.ts +19 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -1
- package/dist/crypto/WebCrypto.js.map +1 -1
- package/dist/crypto/internal/asymmetric.js.map +1 -1
- package/dist/crypto/internal/key.js +3 -2
- package/dist/crypto/internal/key.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +26 -3
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Ndjson.d.ts +5 -4
- package/dist/encoding/Ndjson.d.ts.map +1 -1
- package/dist/encoding/Ndjson.js +6 -5
- package/dist/encoding/Ndjson.js.map +1 -1
- package/dist/encoding/Sse.d.ts +3 -1
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +5 -3
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +7 -0
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +7 -0
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +7 -1
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +27 -12
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +10 -0
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.d.ts +17 -0
- package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.js +14 -2
- package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +21 -0
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +22 -0
- package/dist/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/graphql/GraphQLClient.d.ts +3 -1
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLClientError.d.ts +14 -9
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
- package/dist/graphql/GraphQLClientError.js +14 -21
- package/dist/graphql/GraphQLClientError.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +12 -3
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +4 -1
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/http/HttpClient.d.ts +189 -7
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +75 -2
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +38 -22
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/internal/mimeTypes.d.ts +4 -1
- package/dist/http/internal/mimeTypes.d.ts.map +1 -1
- package/dist/http/internal/mimeTypes.js +4 -1
- package/dist/http/internal/mimeTypes.js.map +1 -1
- package/dist/http-api/HttpApiSchema.js +1 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/internal/dateTime.js +49 -24
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +10 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/glob.js +234 -56
- package/dist/internal/glob.js.map +1 -1
- package/dist/internal/graphql.js +21 -7
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/graphqlHeaders.d.ts +7 -0
- package/dist/internal/graphqlHeaders.d.ts.map +1 -1
- package/dist/internal/graphqlHeaders.js +11 -0
- package/dist/internal/graphqlHeaders.js.map +1 -1
- package/dist/internal/request.js +29 -42
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +7 -8
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +285 -0
- package/dist/jose/JoseError.d.ts.map +1 -0
- package/dist/jose/JoseError.js +269 -0
- package/dist/jose/JoseError.js.map +1 -0
- package/dist/jose/Jwe.d.ts +128 -0
- package/dist/jose/Jwe.d.ts.map +1 -0
- package/dist/jose/Jwe.js +134 -0
- package/dist/jose/Jwe.js.map +1 -0
- package/dist/jose/Jwk.d.ts +597 -0
- package/dist/jose/Jwk.d.ts.map +1 -0
- package/dist/jose/Jwk.js +503 -0
- package/dist/jose/Jwk.js.map +1 -0
- package/dist/jose/Jwks.d.ts +236 -0
- package/dist/jose/Jwks.d.ts.map +1 -0
- package/dist/jose/Jwks.js +306 -0
- package/dist/jose/Jwks.js.map +1 -0
- package/dist/jose/Jws.d.ts +177 -0
- package/dist/jose/Jws.d.ts.map +1 -0
- package/dist/jose/Jws.js +183 -0
- package/dist/jose/Jws.js.map +1 -0
- package/dist/jose/Jwt.d.ts +270 -0
- package/dist/jose/Jwt.d.ts.map +1 -0
- package/dist/jose/Jwt.js +293 -0
- package/dist/jose/Jwt.js.map +1 -0
- package/dist/jose/index.d.ts +51 -0
- package/dist/jose/index.d.ts.map +1 -0
- package/dist/jose/index.js +52 -0
- package/dist/jose/index.js.map +1 -0
- package/dist/jose/internal/compact.d.ts +2 -0
- package/dist/jose/internal/compact.d.ts.map +1 -0
- package/dist/jose/internal/compact.js +179 -0
- package/dist/jose/internal/compact.js.map +1 -0
- package/dist/net/Host.d.ts.map +1 -1
- package/dist/net/Host.js +5 -10
- package/dist/net/Host.js.map +1 -1
- package/dist/observability/OtlpSerialization.d.ts +1 -1
- package/dist/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/observability/OtlpSerialization.js +10 -4
- package/dist/observability/OtlpSerialization.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +3 -3
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/observability/internal/protobuf.js +6 -0
- package/dist/observability/internal/protobuf.js.map +1 -1
- package/dist/persistence/CircuitBreaker.d.ts +98 -38
- package/dist/persistence/CircuitBreaker.d.ts.map +1 -1
- package/dist/persistence/CircuitBreaker.js +67 -29
- package/dist/persistence/CircuitBreaker.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts +8 -0
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +63 -12
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/persistence/index.d.ts +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/reactivity/AtomRegistry.js +17 -7
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +1 -1
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +14 -2
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +38 -21
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +3 -2
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcMessage.js.map +1 -1
- package/dist/sql/Migrator.d.ts +9 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +18 -6
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +38 -3
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +4 -3
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +41 -3
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +24 -20
- package/dist/sql/Statement.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +4 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +5 -0
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +5 -1
- package/src/BigDecimal.ts +170 -16
- package/src/Equal.ts +3 -3
- package/src/Hash.ts +5 -4
- package/src/Iterable.ts +8 -5
- package/src/Path.ts +6 -1
- package/src/Pool.ts +2 -1
- package/src/Schema.ts +3 -2
- package/src/SchemaRepresentation.ts +4 -2
- package/src/SchemaTransformation.ts +2 -2
- package/src/ai/McpClient.ts +488 -91
- package/src/ai/McpSchema.ts +119 -0
- package/src/ai/McpServer.ts +261 -38
- package/src/ai/Prompt.ts +16 -11
- package/src/ai/Tool.ts +5 -10
- package/src/ai/internal/mcpCore.ts +165 -12
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +41 -7
- package/src/ai/internal/mcpProtocol.ts +15 -0
- package/src/ai/internal/mcpRuntime.ts +6 -3
- package/src/ai/internal/mcpSkills.ts +480 -0
- package/src/cluster/ClusterWorkflowEngine.ts +22 -8
- package/src/cluster/Reply.ts +1 -1
- package/src/cluster/Sharding.ts +4 -1
- package/src/cluster/internal/entityManager.ts +24 -10
- package/src/crypto/Aead.ts +3 -3
- package/src/crypto/Cipher.ts +3 -3
- package/src/crypto/KeyAgreement.ts +4 -4
- package/src/crypto/KeyFormat.ts +30 -1
- package/src/crypto/KeyWrap.ts +6 -6
- package/src/crypto/Mac.ts +3 -3
- package/src/crypto/Signature.ts +4 -4
- package/src/crypto/WebCrypto.ts +20 -0
- package/src/crypto/internal/asymmetric.ts +2 -1
- package/src/crypto/internal/key.ts +12 -5
- package/src/encoding/Base64Url.ts +27 -3
- package/src/encoding/Ndjson.ts +6 -5
- package/src/encoding/Sse.ts +5 -3
- package/src/eventlog/EventLog.ts +7 -0
- package/src/eventlog/EventLogServer.ts +31 -12
- package/src/eventlog/EventLogServerEncrypted.ts +5 -0
- package/src/eventlog/EventLogServerUnencrypted.ts +19 -2
- package/src/eventlog/EventLogSessionAuth.ts +26 -0
- package/src/graphql/GraphQLClient.ts +3 -1
- package/src/graphql/GraphQLClientError.ts +15 -22
- package/src/graphql/GraphQLProtocol.ts +12 -3
- package/src/http/HttpClient.ts +210 -11
- package/src/http/HttpServerRequest.ts +61 -23
- package/src/http/internal/mimeTypes.ts +4 -1
- package/src/http-api/HttpApiSchema.ts +1 -1
- package/src/internal/dateTime.ts +54 -24
- package/src/internal/effect.ts +6 -0
- package/src/internal/glob.ts +279 -63
- package/src/internal/graphql.ts +27 -9
- package/src/internal/graphqlHeaders.ts +13 -0
- package/src/internal/request.ts +51 -58
- package/src/internal/schema/fromJsonSchemaDocument.ts +11 -10
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +329 -0
- package/src/jose/Jwe.ts +196 -0
- package/src/jose/Jwk.ts +777 -0
- package/src/jose/Jwks.ts +418 -0
- package/src/jose/Jws.ts +312 -0
- package/src/jose/Jwt.ts +493 -0
- package/src/jose/index.ts +58 -0
- package/src/jose/internal/compact.ts +195 -0
- package/src/net/Host.ts +5 -10
- package/src/observability/OtlpSerialization.ts +13 -5
- package/src/observability/internal/otlpProtobuf.ts +6 -6
- package/src/observability/internal/protobuf.ts +10 -0
- package/src/persistence/CircuitBreaker.ts +113 -48
- package/src/persistence/RateLimiter.ts +84 -15
- package/src/persistence/index.ts +1 -1
- package/src/reactivity/AtomRegistry.ts +19 -8
- package/src/rpc/Rpc.ts +3 -1
- package/src/rpc/RpcClient.ts +44 -24
- package/src/rpc/RpcMessage.ts +3 -2
- package/src/sql/Migrator.ts +35 -18
- package/src/sql/SqlClient.ts +43 -8
- package/src/sql/Statement.ts +52 -22
- package/src/workflow/Workflow.ts +4 -0
- package/src/workflow/WorkflowEngine.ts +5 -0
package/README.md
CHANGED
|
@@ -58,3 +58,33 @@ The `effect` package is a collection of modules. Some of the core ones:
|
|
|
58
58
|
| Schema | A powerful library for defining, validating, and transforming structured data with type-safe encoding and decoding. |
|
|
59
59
|
|
|
60
60
|
In v4, functionality that previously lived in separate packages ships inside `effect` under the `effect/*` namespaces, including `http`, `http-api`, `rpc`, `cluster`, `workflow`, `cli`, `ai`, `sql`, and `reactivity`.
|
|
61
|
+
|
|
62
|
+
## JOSE
|
|
63
|
+
|
|
64
|
+
`effect/jose` provides unstable APIs for algorithm-bound JWKs, compact JWS and JWE, schema-typed signed and encrypted JWTs, and local or remote JWKS resolution, built on `effect/crypto`. Signatures use HS256/384/512, RS256/384/512, PS256/384/512, ES256/384/512 (P-256/P-384/P-521), or EdDSA (Ed25519); encryption uses `dir` with `A256GCM`. `Jwk` also generates symmetric keys, computes JWK thumbprints and thumbprint URIs, and imports and exports SPKI and PKCS#8 keys in DER or PEM form.
|
|
65
|
+
|
|
66
|
+
Apply an application-specific limit to untrusted token lengths before verification, decryption, or unverified decoding. These APIs decode tokens in memory and do not impose a global token-size limit.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { Effect, Layer, Schema } from "effect"
|
|
70
|
+
import { Mac, SecureRandom, Signature } from "effect/crypto"
|
|
71
|
+
import { Jwk, Jwt } from "effect/jose"
|
|
72
|
+
|
|
73
|
+
const Claims = Schema.Struct({ sub: Schema.String })
|
|
74
|
+
|
|
75
|
+
const program = Effect.gen(function*() {
|
|
76
|
+
const pair = yield* Jwk.generateKeyPair({ algorithm: "ES256", kid: "signing-key" })
|
|
77
|
+
const signingKey = yield* Jwk.importPrivate(pair.privateKey, "ES256")
|
|
78
|
+
const verificationKey = yield* Jwk.importPublic(pair.publicKey, "ES256")
|
|
79
|
+
const token = yield* Jwt.sign(Claims, { sub: "user_1" }, signingKey, { typ: "JWT" })
|
|
80
|
+
return yield* Jwt.verify(Claims, token, verificationKey, { typ: "JWT" })
|
|
81
|
+
}).pipe(
|
|
82
|
+
Effect.provide(
|
|
83
|
+
Layer.mergeAll(Mac.layerWebCrypto, Signature.layerWebCrypto).pipe(Layer.provide(SecureRandom.layerWebCrypto))
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For encrypted JWTs, use `Jwt.encrypt` and `Jwt.decrypt`. Both `Jwe.decrypt` and `Jwt.decrypt` accept effectful key resolvers for key rotation; resolver headers are unauthenticated and must be used only to select a key.
|
|
89
|
+
|
|
90
|
+
See [third-party notices](THIRD_PARTY_NOTICES.md) for test attribution.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This package is licensed under the [MIT license](LICENSE).
|
|
4
|
+
|
|
5
|
+
Selected JOSE contracts and fixtures are adapted from the pinned upstream
|
|
6
|
+
snapshot below. The runtime uses Effect services; the npm `jose` package is
|
|
7
|
+
used only for tests and independent interoperation.
|
|
8
|
+
|
|
9
|
+
## JOSE contracts
|
|
10
|
+
|
|
11
|
+
Selected public contract tests in [test/jose/](test/jose/) follow behaviours exercised by
|
|
12
|
+
[panva/jose](https://github.com/panva/jose/tree/505a55b8f73536082367b2614cb77e927ba96ec1),
|
|
13
|
+
v6.2.12, commit `505a55b8f73536082367b2614cb77e927ba96ec1` (Filip Skokan).
|
|
14
|
+
The selected source contracts are adapted to the supported profile:
|
|
15
|
+
|
|
16
|
+
| Upstream tests | Local tests |
|
|
17
|
+
| -------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
|
18
|
+
| `test/jws/compact.verify.test.ts`, `test/jws/flattened.verify.test.ts`, `test/jws/crit.test.ts`, `test/jws/restrictions.test.ts` | `test/jose/Jws.test.ts` |
|
|
19
|
+
| `test/jwk/jwk2key.test.ts`, `test/jwk/key_input.test.ts` | `test/jose/Jwk.test.ts` |
|
|
20
|
+
| `test/jwt/verify.test.ts` | `test/jose/Jwt.test.ts` |
|
|
21
|
+
| `test/jwks/local.test.ts`, `test/jwks/remote.test.ts` | `test/jose/Jwks.test.ts` |
|
|
22
|
+
| `test/jwe/compact.encrypt.test.ts`, `test/jwe/compact.decrypt.test.ts`, `test/jwe/flattened.decrypt.test.ts` | `test/jose/Jwe.test.ts` |
|
|
23
|
+
|
|
24
|
+
Only applicable public behavior is adapted; flattened-format tests supply shared
|
|
25
|
+
header and authentication-tag validation, not JSON serialization support. Known
|
|
26
|
+
answer vectors come from RFC 7515 Appendix A. Tests use independent
|
|
27
|
+
interoperation against that release, plus Effect-specific policy, scoped
|
|
28
|
+
cancellation and refresh-coalescing regressions. This is not a full upstream
|
|
29
|
+
suite port or a claim of full upstream compatibility.
|
|
30
|
+
|
|
31
|
+
The source implementation informs claim validation, protected-header policy, and
|
|
32
|
+
key selection in `src/jose/Jwt.ts`, `src/jose/Jws.ts`, `src/jose/Jwk.ts`, `src/jose/Jwks.ts`, and
|
|
33
|
+
`src/jose/Jwe.ts`; these implementations are written for Effect services and Schema.
|
|
34
|
+
No panva/jose runtime implementation is bundled or required.
|
|
35
|
+
|
|
36
|
+
The wire formats follow RFC 7515, RFC 7516, RFC 7517, RFC 7518, RFC 7519,
|
|
37
|
+
and RFC 8037; policy follows RFC 8725. The only RFC material copied is the
|
|
38
|
+
RFC 7515 Appendix A example keys and tokens used as test vectors.
|
|
39
|
+
|
|
40
|
+
### panva/jose — MIT
|
|
41
|
+
|
|
42
|
+
The MIT License (MIT)
|
|
43
|
+
|
|
44
|
+
Copyright (c) 2018 Filip Skokan
|
|
45
|
+
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
48
|
+
in the Software without restriction, including without limitation the rights
|
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
51
|
+
furnished to do so, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
The above copyright notice and this permission notice shall be included in all
|
|
54
|
+
copies or substantial portions of the Software.
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
package/dist/BigDecimal.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* divide, round, and format decimal values such as money, quantities, and
|
|
6
6
|
* measurements.
|
|
7
7
|
*
|
|
8
|
+
* Parsed scales are limited to ±10,000, and operations that align scales throw
|
|
9
|
+
* a `RangeError` when the scales differ by more than 20,000.
|
|
10
|
+
*
|
|
8
11
|
* @stability stable
|
|
9
12
|
* @since 2.0.0
|
|
10
13
|
*/
|
|
@@ -141,6 +144,10 @@ export declare const normalize: (self: BigDecimal) => BigDecimal;
|
|
|
141
144
|
* digits beyond the target scale by `bigint` division, which truncates toward
|
|
142
145
|
* zero.
|
|
143
146
|
*
|
|
147
|
+
* **Gotchas**
|
|
148
|
+
*
|
|
149
|
+
* Throws a `RangeError` if the scale changes by more than 20,000.
|
|
150
|
+
*
|
|
144
151
|
* **Example** (Scaling decimal precision)
|
|
145
152
|
*
|
|
146
153
|
* ```ts import.meta.vitest
|
|
@@ -177,6 +184,10 @@ export declare const scale: {
|
|
|
177
184
|
* digits beyond the target scale by `bigint` division, which truncates toward
|
|
178
185
|
* zero.
|
|
179
186
|
*
|
|
187
|
+
* **Gotchas**
|
|
188
|
+
*
|
|
189
|
+
* Throws a `RangeError` if the scale changes by more than 20,000.
|
|
190
|
+
*
|
|
180
191
|
* **Example** (Scaling decimal precision)
|
|
181
192
|
*
|
|
182
193
|
* ```ts import.meta.vitest
|
|
@@ -213,6 +224,10 @@ export declare const scale: {
|
|
|
213
224
|
* digits beyond the target scale by `bigint` division, which truncates toward
|
|
214
225
|
* zero.
|
|
215
226
|
*
|
|
227
|
+
* **Gotchas**
|
|
228
|
+
*
|
|
229
|
+
* Throws a `RangeError` if the scale changes by more than 20,000.
|
|
230
|
+
*
|
|
216
231
|
* **Example** (Scaling decimal precision)
|
|
217
232
|
*
|
|
218
233
|
* ```ts import.meta.vitest
|
|
@@ -245,6 +260,10 @@ export declare const scale: {
|
|
|
245
260
|
* Use when you need a decimal addition function for piping or higher-order APIs
|
|
246
261
|
* while preserving decimal precision.
|
|
247
262
|
*
|
|
263
|
+
* **Gotchas**
|
|
264
|
+
*
|
|
265
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
266
|
+
*
|
|
248
267
|
* **Example** (Adding decimals)
|
|
249
268
|
*
|
|
250
269
|
* ```ts import.meta.vitest
|
|
@@ -271,6 +290,10 @@ export declare const sum: {
|
|
|
271
290
|
* Use when you need a decimal addition function for piping or higher-order APIs
|
|
272
291
|
* while preserving decimal precision.
|
|
273
292
|
*
|
|
293
|
+
* **Gotchas**
|
|
294
|
+
*
|
|
295
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
296
|
+
*
|
|
274
297
|
* **Example** (Adding decimals)
|
|
275
298
|
*
|
|
276
299
|
* ```ts import.meta.vitest
|
|
@@ -297,6 +320,10 @@ export declare const sum: {
|
|
|
297
320
|
* Use when you need a decimal addition function for piping or higher-order APIs
|
|
298
321
|
* while preserving decimal precision.
|
|
299
322
|
*
|
|
323
|
+
* **Gotchas**
|
|
324
|
+
*
|
|
325
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
326
|
+
*
|
|
300
327
|
* **Example** (Adding decimals)
|
|
301
328
|
*
|
|
302
329
|
* ```ts import.meta.vitest
|
|
@@ -324,6 +351,10 @@ export declare const sum: {
|
|
|
324
351
|
* Use when you need to aggregate decimal quantities with decimal precision
|
|
325
352
|
* instead of converting through JavaScript numbers.
|
|
326
353
|
*
|
|
354
|
+
* **Gotchas**
|
|
355
|
+
*
|
|
356
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
357
|
+
*
|
|
327
358
|
* **Example** (Adding multiple decimals)
|
|
328
359
|
*
|
|
329
360
|
* ```ts import.meta.vitest
|
|
@@ -452,6 +483,10 @@ export declare const multiplyAll: (collection: Iterable<BigDecimal>) => BigDecim
|
|
|
452
483
|
*
|
|
453
484
|
* Use to subtract one `BigDecimal` value from another.
|
|
454
485
|
*
|
|
486
|
+
* **Gotchas**
|
|
487
|
+
*
|
|
488
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
489
|
+
*
|
|
455
490
|
* **Example** (Subtracting decimals)
|
|
456
491
|
*
|
|
457
492
|
* ```ts import.meta.vitest
|
|
@@ -475,6 +510,10 @@ export declare const subtract: {
|
|
|
475
510
|
*
|
|
476
511
|
* Use to subtract one `BigDecimal` value from another.
|
|
477
512
|
*
|
|
513
|
+
* **Gotchas**
|
|
514
|
+
*
|
|
515
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
516
|
+
*
|
|
478
517
|
* **Example** (Subtracting decimals)
|
|
479
518
|
*
|
|
480
519
|
* ```ts import.meta.vitest
|
|
@@ -498,6 +537,10 @@ export declare const subtract: {
|
|
|
498
537
|
*
|
|
499
538
|
* Use to subtract one `BigDecimal` value from another.
|
|
500
539
|
*
|
|
540
|
+
* **Gotchas**
|
|
541
|
+
*
|
|
542
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
543
|
+
*
|
|
501
544
|
* **Example** (Subtracting decimals)
|
|
502
545
|
*
|
|
503
546
|
* ```ts import.meta.vitest
|
|
@@ -1497,6 +1540,10 @@ export declare const negate: (n: BigDecimal) => BigDecimal;
|
|
|
1497
1540
|
*
|
|
1498
1541
|
* If the divisor is `0`, the result will be `Option.none()`.
|
|
1499
1542
|
*
|
|
1543
|
+
* **Gotchas**
|
|
1544
|
+
*
|
|
1545
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
1546
|
+
*
|
|
1500
1547
|
* **Example** (Computing remainders safely)
|
|
1501
1548
|
*
|
|
1502
1549
|
* ```ts import.meta.vitest
|
|
@@ -1531,6 +1578,10 @@ export declare const remainder: {
|
|
|
1531
1578
|
*
|
|
1532
1579
|
* If the divisor is `0`, the result will be `Option.none()`.
|
|
1533
1580
|
*
|
|
1581
|
+
* **Gotchas**
|
|
1582
|
+
*
|
|
1583
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
1584
|
+
*
|
|
1534
1585
|
* **Example** (Computing remainders safely)
|
|
1535
1586
|
*
|
|
1536
1587
|
* ```ts import.meta.vitest
|
|
@@ -1565,6 +1616,10 @@ export declare const remainder: {
|
|
|
1565
1616
|
*
|
|
1566
1617
|
* If the divisor is `0`, the result will be `Option.none()`.
|
|
1567
1618
|
*
|
|
1619
|
+
* **Gotchas**
|
|
1620
|
+
*
|
|
1621
|
+
* Throws a `RangeError` if the operands' scales differ by more than 20,000.
|
|
1622
|
+
*
|
|
1568
1623
|
* **Example** (Computing remainders safely)
|
|
1569
1624
|
*
|
|
1570
1625
|
* ```ts import.meta.vitest
|
|
@@ -1598,7 +1653,8 @@ export declare const remainder: {
|
|
|
1598
1653
|
*
|
|
1599
1654
|
* **Gotchas**
|
|
1600
1655
|
*
|
|
1601
|
-
* Throws a `RangeError` if the divisor is `0
|
|
1656
|
+
* Throws a `RangeError` if the divisor is `0` or the operands' scales differ by
|
|
1657
|
+
* more than 20,000.
|
|
1602
1658
|
*
|
|
1603
1659
|
* **Example** (Computing remainders unsafely)
|
|
1604
1660
|
*
|
|
@@ -1629,7 +1685,8 @@ export declare const remainderUnsafe: {
|
|
|
1629
1685
|
*
|
|
1630
1686
|
* **Gotchas**
|
|
1631
1687
|
*
|
|
1632
|
-
* Throws a `RangeError` if the divisor is `0
|
|
1688
|
+
* Throws a `RangeError` if the divisor is `0` or the operands' scales differ by
|
|
1689
|
+
* more than 20,000.
|
|
1633
1690
|
*
|
|
1634
1691
|
* **Example** (Computing remainders unsafely)
|
|
1635
1692
|
*
|
|
@@ -1660,7 +1717,8 @@ export declare const remainderUnsafe: {
|
|
|
1660
1717
|
*
|
|
1661
1718
|
* **Gotchas**
|
|
1662
1719
|
*
|
|
1663
|
-
* Throws a `RangeError` if the divisor is `0
|
|
1720
|
+
* Throws a `RangeError` if the divisor is `0` or the operands' scales differ by
|
|
1721
|
+
* more than 20,000.
|
|
1664
1722
|
*
|
|
1665
1723
|
* **Example** (Computing remainders unsafely)
|
|
1666
1724
|
*
|
|
@@ -1889,8 +1947,9 @@ export declare const fromNumber: (n: number) => Option.Option<BigDecimal>;
|
|
|
1889
1947
|
* **Details**
|
|
1890
1948
|
*
|
|
1891
1949
|
* Returns `Option.some` for valid decimal or exponent notation and
|
|
1892
|
-
* `Option.none` when the
|
|
1893
|
-
*
|
|
1950
|
+
* `Option.none` otherwise, including when the scale, before or after removing
|
|
1951
|
+
* trailing zeros, is outside ±10,000 (for example, more than 10,000 fractional
|
|
1952
|
+
* digits). The empty string parses as zero.
|
|
1894
1953
|
*
|
|
1895
1954
|
* **Example** (Parsing decimal strings safely)
|
|
1896
1955
|
*
|
|
@@ -1919,8 +1978,9 @@ export declare const fromString: (s: string) => Option.Option<BigDecimal>;
|
|
|
1919
1978
|
*
|
|
1920
1979
|
* **Details**
|
|
1921
1980
|
*
|
|
1922
|
-
* Accepts the same syntax as `fromString`. Use `fromString`
|
|
1923
|
-
* should be represented as `Option.none` instead of
|
|
1981
|
+
* Accepts the same syntax and scale limits as `fromString`. Use `fromString`
|
|
1982
|
+
* when invalid input should be represented as `Option.none` instead of
|
|
1983
|
+
* throwing.
|
|
1924
1984
|
*
|
|
1925
1985
|
* **Example** (Parsing decimal strings unsafely)
|
|
1926
1986
|
*
|
|
@@ -2144,6 +2204,15 @@ export type RoundingMode = "ceil" | "floor" | "to-zero" | "from-zero" | "half-ce
|
|
|
2144
2204
|
*
|
|
2145
2205
|
* Use to round a decimal at a requested scale with an explicit rounding mode.
|
|
2146
2206
|
*
|
|
2207
|
+
* **Details**
|
|
2208
|
+
*
|
|
2209
|
+
* Values already at or below the target scale are returned unchanged.
|
|
2210
|
+
*
|
|
2211
|
+
* **Gotchas**
|
|
2212
|
+
*
|
|
2213
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2214
|
+
* than 20,000.
|
|
2215
|
+
*
|
|
2147
2216
|
* **Example** (Rounding decimals)
|
|
2148
2217
|
*
|
|
2149
2218
|
* ```ts import.meta.vitest
|
|
@@ -2172,6 +2241,15 @@ export declare const round: {
|
|
|
2172
2241
|
*
|
|
2173
2242
|
* Use to round a decimal at a requested scale with an explicit rounding mode.
|
|
2174
2243
|
*
|
|
2244
|
+
* **Details**
|
|
2245
|
+
*
|
|
2246
|
+
* Values already at or below the target scale are returned unchanged.
|
|
2247
|
+
*
|
|
2248
|
+
* **Gotchas**
|
|
2249
|
+
*
|
|
2250
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2251
|
+
* than 20,000.
|
|
2252
|
+
*
|
|
2175
2253
|
* **Example** (Rounding decimals)
|
|
2176
2254
|
*
|
|
2177
2255
|
* ```ts import.meta.vitest
|
|
@@ -2203,6 +2281,15 @@ export declare const round: {
|
|
|
2203
2281
|
*
|
|
2204
2282
|
* Use to round a decimal at a requested scale with an explicit rounding mode.
|
|
2205
2283
|
*
|
|
2284
|
+
* **Details**
|
|
2285
|
+
*
|
|
2286
|
+
* Values already at or below the target scale are returned unchanged.
|
|
2287
|
+
*
|
|
2288
|
+
* **Gotchas**
|
|
2289
|
+
*
|
|
2290
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2291
|
+
* than 20,000.
|
|
2292
|
+
*
|
|
2206
2293
|
* **Example** (Rounding decimals)
|
|
2207
2294
|
*
|
|
2208
2295
|
* ```ts import.meta.vitest
|
|
@@ -2237,6 +2324,11 @@ export declare const round: {
|
|
|
2237
2324
|
* Use when you need to discard fractional digits beyond a scale rather than
|
|
2238
2325
|
* round half up, half down, or toward an infinity.
|
|
2239
2326
|
*
|
|
2327
|
+
* **Gotchas**
|
|
2328
|
+
*
|
|
2329
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2330
|
+
* than 20,000.
|
|
2331
|
+
*
|
|
2240
2332
|
* **Example** (Truncating decimals)
|
|
2241
2333
|
*
|
|
2242
2334
|
* ```ts import.meta.vitest
|
|
@@ -2264,6 +2356,11 @@ export declare const truncate: {
|
|
|
2264
2356
|
* Use when you need to discard fractional digits beyond a scale rather than
|
|
2265
2357
|
* round half up, half down, or toward an infinity.
|
|
2266
2358
|
*
|
|
2359
|
+
* **Gotchas**
|
|
2360
|
+
*
|
|
2361
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2362
|
+
* than 20,000.
|
|
2363
|
+
*
|
|
2267
2364
|
* **Example** (Truncating decimals)
|
|
2268
2365
|
*
|
|
2269
2366
|
* ```ts import.meta.vitest
|
|
@@ -2291,6 +2388,11 @@ export declare const truncate: {
|
|
|
2291
2388
|
* Use when you need to discard fractional digits beyond a scale rather than
|
|
2292
2389
|
* round half up, half down, or toward an infinity.
|
|
2293
2390
|
*
|
|
2391
|
+
* **Gotchas**
|
|
2392
|
+
*
|
|
2393
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2394
|
+
* than 20,000.
|
|
2395
|
+
*
|
|
2294
2396
|
* **Example** (Truncating decimals)
|
|
2295
2397
|
*
|
|
2296
2398
|
* ```ts import.meta.vitest
|
|
@@ -2323,6 +2425,11 @@ export declare const truncate: {
|
|
|
2323
2425
|
* decimal point, and negative scales round positions to the left of the decimal
|
|
2324
2426
|
* point.
|
|
2325
2427
|
*
|
|
2428
|
+
* **Gotchas**
|
|
2429
|
+
*
|
|
2430
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2431
|
+
* than 20,000.
|
|
2432
|
+
*
|
|
2326
2433
|
* @see {@link floor} for rounding toward negative infinity
|
|
2327
2434
|
* @see {@link truncate} for rounding toward zero
|
|
2328
2435
|
* @see {@link round} for configurable rounding modes
|
|
@@ -2354,6 +2461,11 @@ export declare const ceil: {
|
|
|
2354
2461
|
* decimal point, and negative scales round positions to the left of the decimal
|
|
2355
2462
|
* point.
|
|
2356
2463
|
*
|
|
2464
|
+
* **Gotchas**
|
|
2465
|
+
*
|
|
2466
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2467
|
+
* than 20,000.
|
|
2468
|
+
*
|
|
2357
2469
|
* @see {@link floor} for rounding toward negative infinity
|
|
2358
2470
|
* @see {@link truncate} for rounding toward zero
|
|
2359
2471
|
* @see {@link round} for configurable rounding modes
|
|
@@ -2385,6 +2497,11 @@ export declare const ceil: {
|
|
|
2385
2497
|
* decimal point, and negative scales round positions to the left of the decimal
|
|
2386
2498
|
* point.
|
|
2387
2499
|
*
|
|
2500
|
+
* **Gotchas**
|
|
2501
|
+
*
|
|
2502
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2503
|
+
* than 20,000.
|
|
2504
|
+
*
|
|
2388
2505
|
* @see {@link floor} for rounding toward negative infinity
|
|
2389
2506
|
* @see {@link truncate} for rounding toward zero
|
|
2390
2507
|
* @see {@link round} for configurable rounding modes
|
|
@@ -2411,6 +2528,11 @@ export declare const ceil: {
|
|
|
2411
2528
|
*
|
|
2412
2529
|
* Use to round a decimal toward negative infinity at a requested scale.
|
|
2413
2530
|
*
|
|
2531
|
+
* **Gotchas**
|
|
2532
|
+
*
|
|
2533
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2534
|
+
* than 20,000.
|
|
2535
|
+
*
|
|
2414
2536
|
* **Example** (Rounding decimals down)
|
|
2415
2537
|
*
|
|
2416
2538
|
* ```ts import.meta.vitest
|
|
@@ -2436,6 +2558,11 @@ export declare const floor: {
|
|
|
2436
2558
|
*
|
|
2437
2559
|
* Use to round a decimal toward negative infinity at a requested scale.
|
|
2438
2560
|
*
|
|
2561
|
+
* **Gotchas**
|
|
2562
|
+
*
|
|
2563
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2564
|
+
* than 20,000.
|
|
2565
|
+
*
|
|
2439
2566
|
* **Example** (Rounding decimals down)
|
|
2440
2567
|
*
|
|
2441
2568
|
* ```ts import.meta.vitest
|
|
@@ -2461,6 +2588,11 @@ export declare const floor: {
|
|
|
2461
2588
|
*
|
|
2462
2589
|
* Use to round a decimal toward negative infinity at a requested scale.
|
|
2463
2590
|
*
|
|
2591
|
+
* **Gotchas**
|
|
2592
|
+
*
|
|
2593
|
+
* Throws a `RangeError` if the value's scale exceeds the target scale by more
|
|
2594
|
+
* than 20,000.
|
|
2595
|
+
*
|
|
2464
2596
|
* **Example** (Rounding decimals down)
|
|
2465
2597
|
*
|
|
2466
2598
|
* ```ts import.meta.vitest
|
package/dist/BigDecimal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BigDecimal.d.ts","sourceRoot":"","sources":["../src/BigDecimal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BigDecimal.d.ts","sourceRoot":"","sources":["../src/BigDecimal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,kBAAkB,CAAA;AACtE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,eAAe,CAAA;AAS5D,QAAA,MAAM,MAAM,uBAAuB,CAAA;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW;IACpE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAGvB;AA6BD;;;;;;;;;;;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