effect 3.13.7 → 3.13.9
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/dist/cjs/Array.js +460 -431
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +31 -89
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js +27 -71
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js +12 -10
- package/dist/cjs/Boolean.js.map +1 -1
- package/dist/cjs/Brand.js +2 -0
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Channel.js +0 -2
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Chunk.js +4 -0
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +0 -5
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +14 -24
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +11 -25
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js +6 -0
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/DateTime.js +2 -0
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Duration.js +2 -2
- package/dist/cjs/Effect.js +122 -53
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +21 -25
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Encoding.js +1 -1
- package/dist/cjs/Equivalence.js +1 -1
- package/dist/cjs/Function.js +21 -24
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/HashMap.js +0 -3
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/Iterable.js +9 -2
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/List.js +2 -0
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Logger.js +0 -2
- package/dist/cjs/Logger.js.map +1 -1
- package/dist/cjs/Mailbox.js +1 -0
- package/dist/cjs/Mailbox.js.map +1 -1
- package/dist/cjs/ManagedRuntime.js +0 -2
- package/dist/cjs/ManagedRuntime.js.map +1 -1
- package/dist/cjs/Metric.js +6 -12
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Number.js +22 -61
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js +5 -0
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js +1 -0
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js +2 -7
- package/dist/cjs/Ordering.js.map +1 -1
- package/dist/cjs/ParseResult.js +14 -8
- package/dist/cjs/ParseResult.js.map +1 -1
- package/dist/cjs/Pool.js +1 -1
- package/dist/cjs/Predicate.js +36 -77
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Random.js +1 -2
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/RcMap.js +5 -2
- package/dist/cjs/RcMap.js.map +1 -1
- package/dist/cjs/Record.js +28 -107
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/Redacted.js +3 -0
- package/dist/cjs/Redacted.js.map +1 -1
- package/dist/cjs/RegExp.js +2 -2
- package/dist/cjs/RegExp.js.map +1 -1
- package/dist/cjs/STM.js +3 -5
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schedule.js +2 -2
- package/dist/cjs/Schema.js +19 -16
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +0 -2
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/Sink.js +14 -10
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +24 -25
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/String.js +31 -2
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js +6 -0
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Symbol.js +1 -2
- package/dist/cjs/Symbol.js.map +1 -1
- package/dist/cjs/TestClock.js.map +1 -1
- package/dist/cjs/Trie.js +28 -0
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Tuple.js +9 -24
- package/dist/cjs/Tuple.js.map +1 -1
- package/dist/cjs/internal/matcher.js +1 -1
- package/dist/cjs/internal/matcher.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Array.d.ts +1235 -1188
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +61 -189
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +57 -165
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +28 -18
- package/dist/dts/Boolean.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +3 -3
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +0 -6
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +15 -0
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +0 -5
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +26 -54
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +9 -23
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +8 -0
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +6 -0
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +2 -2
- package/dist/dts/Effect.d.ts +153 -71
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +44 -57
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Encoding.d.ts +1 -1
- package/dist/dts/Equivalence.d.ts +1 -1
- package/dist/dts/Function.d.ts +55 -59
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +0 -9
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +13 -2
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/List.d.ts +10 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +0 -6
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Mailbox.d.ts +1 -0
- package/dist/dts/Mailbox.d.ts.map +1 -1
- package/dist/dts/ManagedRuntime.d.ts +0 -2
- package/dist/dts/ManagedRuntime.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +14 -20
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +1 -1
- package/dist/dts/Number.d.ts +52 -155
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +12 -0
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +1 -0
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +4 -17
- package/dist/dts/Ordering.d.ts.map +1 -1
- package/dist/dts/Pool.d.ts +1 -1
- package/dist/dts/Predicate.d.ts +56 -133
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Random.d.ts +1 -2
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/RcMap.d.ts +15 -6
- package/dist/dts/RcMap.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +68 -279
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/Redacted.d.ts +3 -0
- package/dist/dts/Redacted.d.ts.map +1 -1
- package/dist/dts/RegExp.d.ts +2 -2
- package/dist/dts/RegExp.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +5 -7
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +7 -7
- package/dist/dts/Schema.d.ts +32 -26
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts +0 -2
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +14 -10
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +58 -62
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/String.d.ts +47 -2
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +12 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Symbol.d.ts +1 -2
- package/dist/dts/Symbol.d.ts.map +1 -1
- package/dist/dts/TestClock.d.ts +2 -1
- package/dist/dts/TestClock.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +66 -0
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Tuple.d.ts +21 -62
- package/dist/dts/Tuple.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +8 -8
- package/dist/esm/Array.js +474 -442
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +31 -89
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js +27 -71
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js +12 -10
- package/dist/esm/Boolean.js.map +1 -1
- package/dist/esm/Brand.js +2 -0
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Channel.js +0 -2
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Chunk.js +4 -0
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +0 -5
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +14 -24
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +11 -25
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js +7 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/DateTime.js +2 -0
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Duration.js +2 -2
- package/dist/esm/Effect.js +123 -53
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +22 -25
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Encoding.js +1 -1
- package/dist/esm/Equivalence.js +1 -1
- package/dist/esm/Function.js +21 -24
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/HashMap.js +0 -3
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/Iterable.js +9 -2
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/List.js +2 -0
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Logger.js +0 -2
- package/dist/esm/Logger.js.map +1 -1
- package/dist/esm/Mailbox.js +1 -0
- package/dist/esm/Mailbox.js.map +1 -1
- package/dist/esm/ManagedRuntime.js +0 -2
- package/dist/esm/ManagedRuntime.js.map +1 -1
- package/dist/esm/Metric.js +6 -12
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Micro.js +1 -1
- package/dist/esm/Number.js +22 -61
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js +6 -0
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js +1 -0
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js +2 -7
- package/dist/esm/Ordering.js.map +1 -1
- package/dist/esm/ParseResult.js +14 -8
- package/dist/esm/ParseResult.js.map +1 -1
- package/dist/esm/Pool.js +1 -1
- package/dist/esm/Predicate.js +36 -77
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Random.js +1 -2
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/RcMap.js +5 -2
- package/dist/esm/RcMap.js.map +1 -1
- package/dist/esm/Record.js +28 -107
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/Redacted.js +3 -0
- package/dist/esm/Redacted.js.map +1 -1
- package/dist/esm/RegExp.js +2 -2
- package/dist/esm/RegExp.js.map +1 -1
- package/dist/esm/STM.js +3 -5
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schedule.js +2 -2
- package/dist/esm/Schema.js +19 -16
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +0 -2
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/Sink.js +14 -10
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +25 -25
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/String.js +31 -2
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js +6 -0
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Symbol.js +1 -2
- package/dist/esm/Symbol.js.map +1 -1
- package/dist/esm/TestClock.js.map +1 -1
- package/dist/esm/Trie.js +28 -0
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Tuple.js +11 -30
- package/dist/esm/Tuple.js.map +1 -1
- package/dist/esm/internal/matcher.js +1 -1
- package/dist/esm/internal/matcher.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Array.ts +1235 -1188
- package/src/BigDecimal.ts +61 -189
- package/src/BigInt.ts +57 -165
- package/src/Boolean.ts +28 -18
- package/src/Brand.ts +3 -3
- package/src/Channel.ts +0 -6
- package/src/Chunk.ts +16 -0
- package/src/Config.ts +0 -5
- package/src/Context.ts +26 -54
- package/src/Cron.ts +11 -25
- package/src/Data.ts +8 -0
- package/src/DateTime.ts +6 -0
- package/src/Duration.ts +2 -2
- package/src/Effect.ts +153 -71
- package/src/Either.ts +45 -58
- package/src/Encoding.ts +1 -1
- package/src/Equivalence.ts +1 -1
- package/src/Function.ts +55 -59
- package/src/HashMap.ts +0 -9
- package/src/Iterable.ts +13 -2
- package/src/List.ts +12 -0
- package/src/Logger.ts +0 -6
- package/src/Mailbox.ts +1 -0
- package/src/ManagedRuntime.ts +0 -2
- package/src/Metric.ts +14 -20
- package/src/Micro.ts +1 -1
- package/src/Number.ts +52 -155
- package/src/Option.ts +12 -0
- package/src/Order.ts +1 -0
- package/src/Ordering.ts +4 -17
- package/src/ParseResult.ts +16 -9
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +56 -133
- package/src/Random.ts +1 -2
- package/src/RcMap.ts +15 -6
- package/src/Record.ts +68 -279
- package/src/Redacted.ts +3 -0
- package/src/RegExp.ts +2 -2
- package/src/STM.ts +5 -7
- package/src/Schedule.ts +7 -7
- package/src/Schema.ts +37 -28
- package/src/SchemaAST.ts +0 -2
- package/src/Sink.ts +14 -10
- package/src/Stream.ts +56 -61
- package/src/String.ts +47 -2
- package/src/Struct.ts +12 -0
- package/src/Symbol.ts +1 -2
- package/src/TestClock.ts +2 -1
- package/src/Trie.ts +66 -0
- package/src/Tuple.ts +21 -62
- package/src/Utils.ts +8 -8
- package/src/internal/matcher.ts +1 -1
- package/src/internal/version.ts +1 -1
package/src/Context.ts
CHANGED
|
@@ -142,10 +142,9 @@ export declare namespace Tag {
|
|
|
142
142
|
/**
|
|
143
143
|
* Creates a new `Tag` instance with an optional key parameter.
|
|
144
144
|
*
|
|
145
|
-
* @param key - A key that will be used to compare tags.
|
|
146
|
-
*
|
|
147
145
|
* @example
|
|
148
146
|
* ```ts
|
|
147
|
+
* import * as assert from "node:assert"
|
|
149
148
|
* import { Context } from "effect"
|
|
150
149
|
*
|
|
151
150
|
* assert.strictEqual(Context.GenericTag("PORT").key === Context.GenericTag("PORT").key, true)
|
|
@@ -191,10 +190,9 @@ export const unsafeMake: <Services>(unsafeMap: Map<string, any>) => Context<Serv
|
|
|
191
190
|
/**
|
|
192
191
|
* Checks if the provided argument is a `Context`.
|
|
193
192
|
*
|
|
194
|
-
* @param input - The value to be checked if it is a `Context`.
|
|
195
|
-
*
|
|
196
193
|
* @example
|
|
197
194
|
* ```ts
|
|
195
|
+
* import * as assert from "node:assert"
|
|
198
196
|
* import { Context } from "effect"
|
|
199
197
|
*
|
|
200
198
|
* assert.strictEqual(Context.isContext(Context.empty()), true)
|
|
@@ -208,10 +206,9 @@ export const isContext: (input: unknown) => input is Context<never> = internal.i
|
|
|
208
206
|
/**
|
|
209
207
|
* Checks if the provided argument is a `Tag`.
|
|
210
208
|
*
|
|
211
|
-
* @param input - The value to be checked if it is a `Tag`.
|
|
212
|
-
*
|
|
213
209
|
* @example
|
|
214
210
|
* ```ts
|
|
211
|
+
* import * as assert from "node:assert"
|
|
215
212
|
* import { Context } from "effect"
|
|
216
213
|
*
|
|
217
214
|
* assert.strictEqual(Context.isTag(Context.GenericTag("Tag")), true)
|
|
@@ -225,7 +222,6 @@ export const isTag: (input: unknown) => input is Tag<any, any> = internal.isTag
|
|
|
225
222
|
/**
|
|
226
223
|
* Checks if the provided argument is a `Reference`.
|
|
227
224
|
*
|
|
228
|
-
* @param input - The value to be checked if it is a `Reference`.
|
|
229
225
|
* @since 3.11.0
|
|
230
226
|
* @category guards
|
|
231
227
|
* @experimental
|
|
@@ -237,6 +233,7 @@ export const isReference: (u: unknown) => u is Reference<any, any> = internal.is
|
|
|
237
233
|
*
|
|
238
234
|
* @example
|
|
239
235
|
* ```ts
|
|
236
|
+
* import * as assert from "node:assert"
|
|
240
237
|
* import { Context } from "effect"
|
|
241
238
|
*
|
|
242
239
|
* assert.strictEqual(Context.isContext(Context.empty()), true)
|
|
@@ -252,6 +249,7 @@ export const empty: () => Context<never> = internal.empty
|
|
|
252
249
|
*
|
|
253
250
|
* @example
|
|
254
251
|
* ```ts
|
|
252
|
+
* import * as assert from "node:assert"
|
|
255
253
|
* import { Context } from "effect"
|
|
256
254
|
*
|
|
257
255
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -272,6 +270,7 @@ export const make: <T extends Tag<any, any>>(tag: T, service: Tag.Service<T>) =>
|
|
|
272
270
|
*
|
|
273
271
|
* @example
|
|
274
272
|
* ```ts
|
|
273
|
+
* import * as assert from "node:assert"
|
|
275
274
|
* import { Context, pipe } from "effect"
|
|
276
275
|
*
|
|
277
276
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -296,6 +295,7 @@ export const add: {
|
|
|
296
295
|
*
|
|
297
296
|
* @example
|
|
298
297
|
* ```ts
|
|
298
|
+
* import * as assert from "node:assert"
|
|
299
299
|
* import { Context, pipe } from "effect"
|
|
300
300
|
*
|
|
301
301
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -320,6 +320,7 @@ export const add: {
|
|
|
320
320
|
*
|
|
321
321
|
* @example
|
|
322
322
|
* ```ts
|
|
323
|
+
* import * as assert from "node:assert"
|
|
323
324
|
* import { Context, pipe } from "effect"
|
|
324
325
|
*
|
|
325
326
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -344,11 +345,9 @@ export const add: {
|
|
|
344
345
|
/**
|
|
345
346
|
* Get a service from the context that corresponds to the given tag.
|
|
346
347
|
*
|
|
347
|
-
* @param self - The `Context` to search for the service.
|
|
348
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
349
|
-
*
|
|
350
348
|
* @example
|
|
351
349
|
* ```ts
|
|
350
|
+
* import * as assert from "node:assert"
|
|
352
351
|
* import { pipe, Context } from "effect"
|
|
353
352
|
*
|
|
354
353
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -369,11 +368,9 @@ export const get: {
|
|
|
369
368
|
/**
|
|
370
369
|
* Get a service from the context that corresponds to the given tag.
|
|
371
370
|
*
|
|
372
|
-
* @param self - The `Context` to search for the service.
|
|
373
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
374
|
-
*
|
|
375
371
|
* @example
|
|
376
372
|
* ```ts
|
|
373
|
+
* import * as assert from "node:assert"
|
|
377
374
|
* import { pipe, Context } from "effect"
|
|
378
375
|
*
|
|
379
376
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -394,11 +391,9 @@ export const get: {
|
|
|
394
391
|
/**
|
|
395
392
|
* Get a service from the context that corresponds to the given tag.
|
|
396
393
|
*
|
|
397
|
-
* @param self - The `Context` to search for the service.
|
|
398
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
399
|
-
*
|
|
400
394
|
* @example
|
|
401
395
|
* ```ts
|
|
396
|
+
* import * as assert from "node:assert"
|
|
402
397
|
* import { pipe, Context } from "effect"
|
|
403
398
|
*
|
|
404
399
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -419,11 +414,9 @@ export const get: {
|
|
|
419
414
|
/**
|
|
420
415
|
* Get a service from the context that corresponds to the given tag.
|
|
421
416
|
*
|
|
422
|
-
* @param self - The `Context` to search for the service.
|
|
423
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
424
|
-
*
|
|
425
417
|
* @example
|
|
426
418
|
* ```ts
|
|
419
|
+
* import * as assert from "node:assert"
|
|
427
420
|
* import { pipe, Context } from "effect"
|
|
428
421
|
*
|
|
429
422
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -444,11 +437,9 @@ export const get: {
|
|
|
444
437
|
/**
|
|
445
438
|
* Get a service from the context that corresponds to the given tag.
|
|
446
439
|
*
|
|
447
|
-
* @param self - The `Context` to search for the service.
|
|
448
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
449
|
-
*
|
|
450
440
|
* @example
|
|
451
441
|
* ```ts
|
|
442
|
+
* import * as assert from "node:assert"
|
|
452
443
|
* import { pipe, Context } from "effect"
|
|
453
444
|
*
|
|
454
445
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -500,11 +491,9 @@ export const getOrElse: {
|
|
|
500
491
|
*
|
|
501
492
|
* For a safer version see {@link getOption}.
|
|
502
493
|
*
|
|
503
|
-
* @param self - The `Context` to search for the service.
|
|
504
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
505
|
-
*
|
|
506
494
|
* @example
|
|
507
495
|
* ```ts
|
|
496
|
+
* import * as assert from "node:assert"
|
|
508
497
|
* import { Context } from "effect"
|
|
509
498
|
*
|
|
510
499
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -526,11 +515,9 @@ export const unsafeGet: {
|
|
|
526
515
|
*
|
|
527
516
|
* For a safer version see {@link getOption}.
|
|
528
517
|
*
|
|
529
|
-
* @param self - The `Context` to search for the service.
|
|
530
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
531
|
-
*
|
|
532
518
|
* @example
|
|
533
519
|
* ```ts
|
|
520
|
+
* import * as assert from "node:assert"
|
|
534
521
|
* import { Context } from "effect"
|
|
535
522
|
*
|
|
536
523
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -552,11 +539,9 @@ export const unsafeGet: {
|
|
|
552
539
|
*
|
|
553
540
|
* For a safer version see {@link getOption}.
|
|
554
541
|
*
|
|
555
|
-
* @param self - The `Context` to search for the service.
|
|
556
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
557
|
-
*
|
|
558
542
|
* @example
|
|
559
543
|
* ```ts
|
|
544
|
+
* import * as assert from "node:assert"
|
|
560
545
|
* import { Context } from "effect"
|
|
561
546
|
*
|
|
562
547
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -578,11 +563,9 @@ export const unsafeGet: {
|
|
|
578
563
|
* Get the value associated with the specified tag from the context wrapped in an `Option` object. If the tag is not
|
|
579
564
|
* found, the `Option` object will be `None`.
|
|
580
565
|
*
|
|
581
|
-
* @param self - The `Context` to search for the service.
|
|
582
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
583
|
-
*
|
|
584
566
|
* @example
|
|
585
567
|
* ```ts
|
|
568
|
+
* import * as assert from "node:assert"
|
|
586
569
|
* import { Context, Option } from "effect"
|
|
587
570
|
*
|
|
588
571
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -602,11 +585,9 @@ export const getOption: {
|
|
|
602
585
|
* Get the value associated with the specified tag from the context wrapped in an `Option` object. If the tag is not
|
|
603
586
|
* found, the `Option` object will be `None`.
|
|
604
587
|
*
|
|
605
|
-
* @param self - The `Context` to search for the service.
|
|
606
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
607
|
-
*
|
|
608
588
|
* @example
|
|
609
589
|
* ```ts
|
|
590
|
+
* import * as assert from "node:assert"
|
|
610
591
|
* import { Context, Option } from "effect"
|
|
611
592
|
*
|
|
612
593
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -626,11 +607,9 @@ export const getOption: {
|
|
|
626
607
|
* Get the value associated with the specified tag from the context wrapped in an `Option` object. If the tag is not
|
|
627
608
|
* found, the `Option` object will be `None`.
|
|
628
609
|
*
|
|
629
|
-
* @param self - The `Context` to search for the service.
|
|
630
|
-
* @param tag - The `Tag` of the service to retrieve.
|
|
631
|
-
*
|
|
632
610
|
* @example
|
|
633
611
|
* ```ts
|
|
612
|
+
* import * as assert from "node:assert"
|
|
634
613
|
* import { Context, Option } from "effect"
|
|
635
614
|
*
|
|
636
615
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -651,11 +630,9 @@ export const getOption: {
|
|
|
651
630
|
/**
|
|
652
631
|
* Merges two `Context`s, returning a new `Context` containing the services of both.
|
|
653
632
|
*
|
|
654
|
-
* @param self - The first `Context` to merge.
|
|
655
|
-
* @param that - The second `Context` to merge.
|
|
656
|
-
*
|
|
657
633
|
* @example
|
|
658
634
|
* ```ts
|
|
635
|
+
* import * as assert from "node:assert"
|
|
659
636
|
* import { Context } from "effect"
|
|
660
637
|
*
|
|
661
638
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -676,11 +653,9 @@ export const merge: {
|
|
|
676
653
|
/**
|
|
677
654
|
* Merges two `Context`s, returning a new `Context` containing the services of both.
|
|
678
655
|
*
|
|
679
|
-
* @param self - The first `Context` to merge.
|
|
680
|
-
* @param that - The second `Context` to merge.
|
|
681
|
-
*
|
|
682
656
|
* @example
|
|
683
657
|
* ```ts
|
|
658
|
+
* import * as assert from "node:assert"
|
|
684
659
|
* import { Context } from "effect"
|
|
685
660
|
*
|
|
686
661
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -701,11 +676,9 @@ export const merge: {
|
|
|
701
676
|
/**
|
|
702
677
|
* Merges two `Context`s, returning a new `Context` containing the services of both.
|
|
703
678
|
*
|
|
704
|
-
* @param self - The first `Context` to merge.
|
|
705
|
-
* @param that - The second `Context` to merge.
|
|
706
|
-
*
|
|
707
679
|
* @example
|
|
708
680
|
* ```ts
|
|
681
|
+
* import * as assert from "node:assert"
|
|
709
682
|
* import { Context } from "effect"
|
|
710
683
|
*
|
|
711
684
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -728,10 +701,9 @@ export const merge: {
|
|
|
728
701
|
/**
|
|
729
702
|
* Merges any number of `Context`s, returning a new `Context` containing the services of all.
|
|
730
703
|
*
|
|
731
|
-
* @param ctxs - The `Context`s to merge.
|
|
732
|
-
*
|
|
733
704
|
* @example
|
|
734
705
|
* ```ts
|
|
706
|
+
* import * as assert from "node:assert"
|
|
735
707
|
* import { Context } from "effect"
|
|
736
708
|
*
|
|
737
709
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -758,11 +730,9 @@ export const mergeAll: <T extends Array<unknown>>(
|
|
|
758
730
|
/**
|
|
759
731
|
* Returns a new `Context` that contains only the specified services.
|
|
760
732
|
*
|
|
761
|
-
* @param self - The `Context` to prune services from.
|
|
762
|
-
* @param tags - The list of `Tag`s to be included in the new `Context`.
|
|
763
|
-
*
|
|
764
733
|
* @example
|
|
765
734
|
* ```ts
|
|
735
|
+
* import * as assert from "node:assert"
|
|
766
736
|
* import { pipe, Context, Option } from "effect"
|
|
767
737
|
*
|
|
768
738
|
* const Port = Context.GenericTag<{ PORT: number }>("Port")
|
|
@@ -796,6 +766,7 @@ export const omit: <Services, S extends Array<ValidTagsById<Services>>>(
|
|
|
796
766
|
/**
|
|
797
767
|
* @example
|
|
798
768
|
* ```ts
|
|
769
|
+
* import * as assert from "node:assert"
|
|
799
770
|
* import { Context, Layer } from "effect"
|
|
800
771
|
*
|
|
801
772
|
* class MyTag extends Context.Tag("MyTag")<
|
|
@@ -824,6 +795,7 @@ export const Tag: <const Id extends string>(id: Id) => <Self, Shape>() => TagCla
|
|
|
824
795
|
* @example
|
|
825
796
|
* ```ts
|
|
826
797
|
* // Title: Declaring a Tag with a default value
|
|
798
|
+
* import * as assert from "node:assert"
|
|
827
799
|
* import { Context, Effect } from "effect"
|
|
828
800
|
*
|
|
829
801
|
* class SpecialNumber extends Context.Reference<SpecialNumber>()(
|
package/src/Cron.ts
CHANGED
|
@@ -106,8 +106,6 @@ const CronProto = {
|
|
|
106
106
|
/**
|
|
107
107
|
* Checks if a given value is a `Cron` instance.
|
|
108
108
|
*
|
|
109
|
-
* @param u - The value to check.
|
|
110
|
-
*
|
|
111
109
|
* @since 2.0.0
|
|
112
110
|
* @category guards
|
|
113
111
|
*/
|
|
@@ -116,8 +114,6 @@ export const isCron = (u: unknown): u is Cron => hasProperty(u, TypeId)
|
|
|
116
114
|
/**
|
|
117
115
|
* Creates a `Cron` instance.
|
|
118
116
|
*
|
|
119
|
-
* @param constraints - The cron constraints.
|
|
120
|
-
*
|
|
121
117
|
* @since 2.0.0
|
|
122
118
|
* @category constructors
|
|
123
119
|
*/
|
|
@@ -216,8 +212,6 @@ export class ParseError extends Data.TaggedError("CronParseError")<{
|
|
|
216
212
|
/**
|
|
217
213
|
* Returns `true` if the specified value is an `ParseError`, `false` otherwise.
|
|
218
214
|
*
|
|
219
|
-
* @param u - The value to check.
|
|
220
|
-
*
|
|
221
215
|
* @since 2.0.0
|
|
222
216
|
* @category guards
|
|
223
217
|
*/
|
|
@@ -226,10 +220,9 @@ export const isParseError = (u: unknown): u is ParseError => hasProperty(u, Pars
|
|
|
226
220
|
/**
|
|
227
221
|
* Parses a cron expression into a `Cron` instance.
|
|
228
222
|
*
|
|
229
|
-
* @param cron - The cron expression to parse.
|
|
230
|
-
*
|
|
231
223
|
* @example
|
|
232
224
|
* ```ts
|
|
225
|
+
* import * as assert from "node:assert"
|
|
233
226
|
* import { Cron, Either } from "effect"
|
|
234
227
|
*
|
|
235
228
|
* // At 04:00 on every day-of-month from 8 through 14.
|
|
@@ -327,13 +320,9 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron
|
|
|
327
320
|
/**
|
|
328
321
|
* Checks if a given `Date` falls within an active `Cron` time window.
|
|
329
322
|
*
|
|
330
|
-
* @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid.
|
|
331
|
-
*
|
|
332
|
-
* @param cron - The `Cron` instance.
|
|
333
|
-
* @param date - The `Date` to check against.
|
|
334
|
-
*
|
|
335
323
|
* @example
|
|
336
324
|
* ```ts
|
|
325
|
+
* import * as assert from "node:assert"
|
|
337
326
|
* import { Cron, Either } from "effect"
|
|
338
327
|
*
|
|
339
328
|
* const cron = Either.getOrThrow(Cron.parse("0 4 8-14 * *"))
|
|
@@ -341,6 +330,8 @@ export const unsafeParse = (cron: string, tz?: DateTime.TimeZone | string): Cron
|
|
|
341
330
|
* assert.deepStrictEqual(Cron.match(cron, new Date("2021-01-08 05:00:00")), false)
|
|
342
331
|
* ```
|
|
343
332
|
*
|
|
333
|
+
* @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid.
|
|
334
|
+
*
|
|
344
335
|
* @since 2.0.0
|
|
345
336
|
*/
|
|
346
337
|
export const match = (cron: Cron, date: DateTime.DateTime.Input): boolean => {
|
|
@@ -387,11 +378,9 @@ const daysInMonth = (date: Date): number =>
|
|
|
387
378
|
*
|
|
388
379
|
* Uses the current time as a starting point if no value is provided for `now`.
|
|
389
380
|
*
|
|
390
|
-
* @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid.
|
|
391
|
-
* @throws `Error` if the next run date cannot be found within 10,000 iterations.
|
|
392
|
-
*
|
|
393
381
|
* @example
|
|
394
382
|
* ```ts
|
|
383
|
+
* import * as assert from "node:assert"
|
|
395
384
|
* import { Cron, Either } from "effect"
|
|
396
385
|
*
|
|
397
386
|
* const after = new Date("2021-01-01 00:00:00")
|
|
@@ -399,14 +388,14 @@ const daysInMonth = (date: Date): number =>
|
|
|
399
388
|
* assert.deepStrictEqual(Cron.next(cron, after), new Date("2021-01-08 04:00:00"))
|
|
400
389
|
* ```
|
|
401
390
|
*
|
|
402
|
-
* @
|
|
403
|
-
* @
|
|
391
|
+
* @throws `IllegalArgumentException` if the given `DateTime.Input` is invalid.
|
|
392
|
+
* @throws `Error` if the next run date cannot be found within 10,000 iterations.
|
|
404
393
|
*
|
|
405
394
|
* @since 2.0.0
|
|
406
395
|
*/
|
|
407
|
-
export const next = (cron: Cron,
|
|
396
|
+
export const next = (cron: Cron, startFrom?: DateTime.DateTime.Input): Date => {
|
|
408
397
|
const tz = Option.getOrUndefined(cron.tz)
|
|
409
|
-
const zoned = dateTime.unsafeMakeZoned(
|
|
398
|
+
const zoned = dateTime.unsafeMakeZoned(startFrom ?? new Date(), {
|
|
410
399
|
timeZone: tz
|
|
411
400
|
})
|
|
412
401
|
|
|
@@ -529,14 +518,11 @@ export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
|
529
518
|
/**
|
|
530
519
|
* Returns an `IterableIterator` which yields the sequence of `Date`s that match the `Cron` instance.
|
|
531
520
|
*
|
|
532
|
-
* @param cron - The `Cron` instance.
|
|
533
|
-
* @param now - The `Date` to start searching from.
|
|
534
|
-
*
|
|
535
521
|
* @since 2.0.0
|
|
536
522
|
*/
|
|
537
|
-
export const sequence = function*(cron: Cron,
|
|
523
|
+
export const sequence = function*(cron: Cron, startFrom?: DateTime.DateTime.Input): IterableIterator<Date> {
|
|
538
524
|
while (true) {
|
|
539
|
-
yield
|
|
525
|
+
yield startFrom = next(cron, startFrom)
|
|
540
526
|
}
|
|
541
527
|
}
|
|
542
528
|
|
package/src/Data.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare namespace Case {
|
|
|
28
28
|
/**
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
|
+
* import * as assert from "node:assert"
|
|
31
32
|
* import { Data, Equal } from "effect"
|
|
32
33
|
*
|
|
33
34
|
* const alice = Data.struct({ name: "Alice", age: 30 })
|
|
@@ -56,6 +57,7 @@ export const unsafeStruct = <A extends Record<string, any>>(as: A): { readonly [
|
|
|
56
57
|
/**
|
|
57
58
|
* @example
|
|
58
59
|
* ```ts
|
|
60
|
+
* import * as assert from "node:assert"
|
|
59
61
|
* import { Data, Equal } from "effect"
|
|
60
62
|
*
|
|
61
63
|
* const alice = Data.tuple("Alice", 30)
|
|
@@ -77,6 +79,7 @@ export const tuple = <As extends ReadonlyArray<any>>(...as: As): Readonly<As> =>
|
|
|
77
79
|
/**
|
|
78
80
|
* @example
|
|
79
81
|
* ```ts
|
|
82
|
+
* import * as assert from "node:assert"
|
|
80
83
|
* import { Data, Equal } from "effect"
|
|
81
84
|
*
|
|
82
85
|
* const alice = Data.struct({ name: "Alice", age: 30 })
|
|
@@ -117,6 +120,7 @@ export {
|
|
|
117
120
|
*
|
|
118
121
|
* @example
|
|
119
122
|
* ```ts
|
|
123
|
+
* import * as assert from "node:assert"
|
|
120
124
|
* import { Data, Equal } from "effect"
|
|
121
125
|
*
|
|
122
126
|
* interface Person {
|
|
@@ -147,6 +151,7 @@ export {
|
|
|
147
151
|
*
|
|
148
152
|
* @example
|
|
149
153
|
* ```ts
|
|
154
|
+
* import * as assert from "node:assert"
|
|
150
155
|
* import { Data } from "effect"
|
|
151
156
|
*
|
|
152
157
|
* interface Person {
|
|
@@ -178,6 +183,7 @@ export const tagged = <A extends { readonly _tag: string }>(
|
|
|
178
183
|
*
|
|
179
184
|
* @example
|
|
180
185
|
* ```ts
|
|
186
|
+
* import * as assert from "node:assert"
|
|
181
187
|
* import { Data, Equal } from "effect"
|
|
182
188
|
*
|
|
183
189
|
* class Person extends Data.Class<{ readonly name: string }> {}
|
|
@@ -205,6 +211,7 @@ export const Class: new<A extends Record<string, any> = {}>(
|
|
|
205
211
|
*
|
|
206
212
|
* @example
|
|
207
213
|
* ```ts
|
|
214
|
+
* import * as assert from "node:assert"
|
|
208
215
|
* import { Data, Equal } from "effect"
|
|
209
216
|
*
|
|
210
217
|
* class Person extends Data.TaggedClass("Person")<{ readonly name: string }> {}
|
|
@@ -249,6 +256,7 @@ export const Structural: new<A>(
|
|
|
249
256
|
* Create a tagged enum data type, which is a union of `Data` structs.
|
|
250
257
|
*
|
|
251
258
|
* ```ts
|
|
259
|
+
* import * as assert from "node:assert"
|
|
252
260
|
* import { Data } from "effect"
|
|
253
261
|
*
|
|
254
262
|
* type HttpError = Data.TaggedEnum<{
|
package/src/DateTime.ts
CHANGED
|
@@ -1272,6 +1272,7 @@ export const toPartsUtc: (self: DateTime) => DateTime.PartsWithWeekday = Interna
|
|
|
1272
1272
|
* @category parts
|
|
1273
1273
|
* @example
|
|
1274
1274
|
* ```ts
|
|
1275
|
+
* import * as assert from "node:assert"
|
|
1275
1276
|
* import { DateTime } from "effect"
|
|
1276
1277
|
*
|
|
1277
1278
|
* const now = DateTime.unsafeMake({ year: 2024 })
|
|
@@ -1289,6 +1290,7 @@ export const getPartUtc: {
|
|
|
1289
1290
|
* @category parts
|
|
1290
1291
|
* @example
|
|
1291
1292
|
* ```ts
|
|
1293
|
+
* import * as assert from "node:assert"
|
|
1292
1294
|
* import { DateTime } from "effect"
|
|
1293
1295
|
*
|
|
1294
1296
|
* const now = DateTime.unsafeMake({ year: 2024 })
|
|
@@ -1306,6 +1308,7 @@ export const getPartUtc: {
|
|
|
1306
1308
|
* @category parts
|
|
1307
1309
|
* @example
|
|
1308
1310
|
* ```ts
|
|
1311
|
+
* import * as assert from "node:assert"
|
|
1309
1312
|
* import { DateTime } from "effect"
|
|
1310
1313
|
*
|
|
1311
1314
|
* const now = DateTime.unsafeMake({ year: 2024 })
|
|
@@ -1325,6 +1328,7 @@ export const getPartUtc: {
|
|
|
1325
1328
|
* @category parts
|
|
1326
1329
|
* @example
|
|
1327
1330
|
* ```ts
|
|
1331
|
+
* import * as assert from "node:assert"
|
|
1328
1332
|
* import { DateTime } from "effect"
|
|
1329
1333
|
*
|
|
1330
1334
|
* const now = DateTime.unsafeMakeZoned({ year: 2024 }, { timeZone: "Europe/London" })
|
|
@@ -1342,6 +1346,7 @@ export const getPart: {
|
|
|
1342
1346
|
* @category parts
|
|
1343
1347
|
* @example
|
|
1344
1348
|
* ```ts
|
|
1349
|
+
* import * as assert from "node:assert"
|
|
1345
1350
|
* import { DateTime } from "effect"
|
|
1346
1351
|
*
|
|
1347
1352
|
* const now = DateTime.unsafeMakeZoned({ year: 2024 }, { timeZone: "Europe/London" })
|
|
@@ -1359,6 +1364,7 @@ export const getPart: {
|
|
|
1359
1364
|
* @category parts
|
|
1360
1365
|
* @example
|
|
1361
1366
|
* ```ts
|
|
1367
|
+
* import * as assert from "node:assert"
|
|
1362
1368
|
* import { DateTime } from "effect"
|
|
1363
1369
|
*
|
|
1364
1370
|
* const now = DateTime.unsafeMakeZoned({ year: 2024 }, { timeZone: "Europe/London" })
|
package/src/Duration.ts
CHANGED
|
@@ -1001,8 +1001,6 @@ export const format = (self: DurationInput): string => {
|
|
|
1001
1001
|
*
|
|
1002
1002
|
* Milliseconds and nanoseconds are expressed as fractional seconds.
|
|
1003
1003
|
*
|
|
1004
|
-
* @throws `RangeError` If the duration is not finite.
|
|
1005
|
-
*
|
|
1006
1004
|
* @example
|
|
1007
1005
|
* ```ts
|
|
1008
1006
|
* import { Duration } from "effect"
|
|
@@ -1012,6 +1010,8 @@ export const format = (self: DurationInput): string => {
|
|
|
1012
1010
|
* Duration.unsafeFormatIso(Duration.millis(1500)) // => "PT1.5S"
|
|
1013
1011
|
* ```
|
|
1014
1012
|
*
|
|
1013
|
+
* @throws `RangeError` If the duration is not finite.
|
|
1014
|
+
*
|
|
1015
1015
|
* @since 3.13.0
|
|
1016
1016
|
* @category conversions
|
|
1017
1017
|
*/
|