effect 3.13.9 → 3.13.11
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/Arbitrary.js +38 -22
- package/dist/cjs/Arbitrary.js.map +1 -1
- package/dist/cjs/Array.js +50 -50
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/Brand.js +9 -4
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Cause.js +1 -0
- package/dist/cjs/Cause.js.map +1 -1
- package/dist/cjs/Chunk.js +25 -23
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +2 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +4 -4
- package/dist/cjs/Effect.js +823 -632
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +12 -12
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/LogLevel.js +1 -1
- package/dist/cjs/Logger.js +12 -12
- package/dist/cjs/Match.js +26 -26
- package/dist/cjs/Option.js +43 -43
- package/dist/cjs/Predicate.js +6 -2
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Schema.js +21 -17
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +49 -25
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/Scope.js +2 -0
- package/dist/cjs/Scope.js.map +1 -1
- package/dist/cjs/Stream.js +93 -93
- package/dist/cjs/internal/core.js +1 -1
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/schema/util.js +23 -14
- package/dist/cjs/internal/schema/util.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/Array.d.ts +47 -47
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +14 -6
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +1 -0
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +91 -89
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +2 -1
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +4 -4
- package/dist/dts/Effect.d.ts +2107 -1621
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +33 -33
- package/dist/dts/LogLevel.d.ts +3 -3
- package/dist/dts/Logger.d.ts +16 -16
- package/dist/dts/Match.d.ts +26 -26
- package/dist/dts/Option.d.ts +84 -84
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +53 -21
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/Scope.d.ts +2 -0
- package/dist/dts/Scope.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +229 -229
- package/dist/esm/Arbitrary.js +38 -22
- package/dist/esm/Arbitrary.js.map +1 -1
- package/dist/esm/Array.js +50 -50
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/Brand.js +9 -4
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Cause.js +1 -0
- package/dist/esm/Cause.js.map +1 -1
- package/dist/esm/Chunk.js +25 -23
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +2 -1
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +4 -4
- package/dist/esm/Effect.js +845 -648
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +17 -17
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/LogLevel.js +1 -1
- package/dist/esm/Logger.js +12 -12
- package/dist/esm/Match.js +26 -26
- package/dist/esm/Option.js +48 -48
- package/dist/esm/Predicate.js +3 -0
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Schema.js +21 -17
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +46 -22
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/Scope.js +2 -0
- package/dist/esm/Scope.js.map +1 -1
- package/dist/esm/Stream.js +101 -101
- package/dist/esm/internal/core.js +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/schema/util.js +23 -14
- package/dist/esm/internal/schema/util.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +39 -24
- package/src/Array.ts +116 -113
- package/src/Brand.ts +14 -6
- package/src/Cause.ts +1 -0
- package/src/Chunk.ts +97 -95
- package/src/Config.ts +2 -1
- package/src/Context.ts +4 -4
- package/src/Effect.ts +2107 -1621
- package/src/Either.ts +34 -34
- package/src/LogLevel.ts +3 -3
- package/src/Logger.ts +16 -16
- package/src/Match.ts +26 -26
- package/src/Option.ts +84 -84
- package/src/Predicate.ts +4 -0
- package/src/Schema.ts +87 -41
- package/src/SchemaAST.ts +47 -22
- package/src/Scope.ts +2 -0
- package/src/Stream.ts +229 -229
- package/src/internal/core.ts +2 -1
- package/src/internal/schema/util.ts +34 -25
- package/src/internal/version.ts +1 -1
package/dist/dts/Either.d.ts
CHANGED
|
@@ -1123,10 +1123,6 @@ export declare const gen: Gen.Gen<EitherTypeLambda, Gen.Adapter<EitherTypeLambda
|
|
|
1123
1123
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1124
1124
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1125
1125
|
*
|
|
1126
|
-
* @see {@link bind}
|
|
1127
|
-
* @see {@link bindTo}
|
|
1128
|
-
* @see {@link let_ let}
|
|
1129
|
-
*
|
|
1130
1126
|
* @example
|
|
1131
1127
|
* ```ts
|
|
1132
1128
|
* import * as assert from "node:assert"
|
|
@@ -1141,6 +1137,10 @@ export declare const gen: Gen.Gen<EitherTypeLambda, Gen.Adapter<EitherTypeLambda
|
|
|
1141
1137
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1142
1138
|
* ```
|
|
1143
1139
|
*
|
|
1140
|
+
* @see {@link bind}
|
|
1141
|
+
* @see {@link bindTo}
|
|
1142
|
+
* @see {@link let_ let}
|
|
1143
|
+
*
|
|
1144
1144
|
* @category do notation
|
|
1145
1145
|
* @since 2.0.0
|
|
1146
1146
|
*/
|
|
@@ -1155,10 +1155,6 @@ export declare const Do: Either<{}>;
|
|
|
1155
1155
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1156
1156
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1157
1157
|
*
|
|
1158
|
-
* @see {@link Do}
|
|
1159
|
-
* @see {@link bindTo}
|
|
1160
|
-
* @see {@link let_ let}
|
|
1161
|
-
*
|
|
1162
1158
|
* @example
|
|
1163
1159
|
* ```ts
|
|
1164
1160
|
* import * as assert from "node:assert"
|
|
@@ -1173,6 +1169,10 @@ export declare const Do: Either<{}>;
|
|
|
1173
1169
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1174
1170
|
* ```
|
|
1175
1171
|
*
|
|
1172
|
+
* @see {@link Do}
|
|
1173
|
+
* @see {@link bindTo}
|
|
1174
|
+
* @see {@link let_ let}
|
|
1175
|
+
*
|
|
1176
1176
|
* @category do notation
|
|
1177
1177
|
* @since 2.0.0
|
|
1178
1178
|
*/
|
|
@@ -1187,10 +1187,6 @@ export declare const bind: {
|
|
|
1187
1187
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1188
1188
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1189
1189
|
*
|
|
1190
|
-
* @see {@link Do}
|
|
1191
|
-
* @see {@link bindTo}
|
|
1192
|
-
* @see {@link let_ let}
|
|
1193
|
-
*
|
|
1194
1190
|
* @example
|
|
1195
1191
|
* ```ts
|
|
1196
1192
|
* import * as assert from "node:assert"
|
|
@@ -1205,6 +1201,10 @@ export declare const bind: {
|
|
|
1205
1201
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1206
1202
|
* ```
|
|
1207
1203
|
*
|
|
1204
|
+
* @see {@link Do}
|
|
1205
|
+
* @see {@link bindTo}
|
|
1206
|
+
* @see {@link let_ let}
|
|
1207
|
+
*
|
|
1208
1208
|
* @category do notation
|
|
1209
1209
|
* @since 2.0.0
|
|
1210
1210
|
*/
|
|
@@ -1221,10 +1221,6 @@ export declare const bind: {
|
|
|
1221
1221
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1222
1222
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1223
1223
|
*
|
|
1224
|
-
* @see {@link Do}
|
|
1225
|
-
* @see {@link bindTo}
|
|
1226
|
-
* @see {@link let_ let}
|
|
1227
|
-
*
|
|
1228
1224
|
* @example
|
|
1229
1225
|
* ```ts
|
|
1230
1226
|
* import * as assert from "node:assert"
|
|
@@ -1239,6 +1235,10 @@ export declare const bind: {
|
|
|
1239
1235
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1240
1236
|
* ```
|
|
1241
1237
|
*
|
|
1238
|
+
* @see {@link Do}
|
|
1239
|
+
* @see {@link bindTo}
|
|
1240
|
+
* @see {@link let_ let}
|
|
1241
|
+
*
|
|
1242
1242
|
* @category do notation
|
|
1243
1243
|
* @since 2.0.0
|
|
1244
1244
|
*/
|
|
@@ -1256,10 +1256,6 @@ export declare const bind: {
|
|
|
1256
1256
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1257
1257
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1258
1258
|
*
|
|
1259
|
-
* @see {@link Do}
|
|
1260
|
-
* @see {@link bind}
|
|
1261
|
-
* @see {@link let_ let}
|
|
1262
|
-
*
|
|
1263
1259
|
* @example
|
|
1264
1260
|
* ```ts
|
|
1265
1261
|
* import * as assert from "node:assert"
|
|
@@ -1274,6 +1270,10 @@ export declare const bind: {
|
|
|
1274
1270
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1275
1271
|
* ```
|
|
1276
1272
|
*
|
|
1273
|
+
* @see {@link Do}
|
|
1274
|
+
* @see {@link bind}
|
|
1275
|
+
* @see {@link let_ let}
|
|
1276
|
+
*
|
|
1277
1277
|
* @category do notation
|
|
1278
1278
|
* @since 2.0.0
|
|
1279
1279
|
*/
|
|
@@ -1288,10 +1288,6 @@ export declare const bindTo: {
|
|
|
1288
1288
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1289
1289
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1290
1290
|
*
|
|
1291
|
-
* @see {@link Do}
|
|
1292
|
-
* @see {@link bind}
|
|
1293
|
-
* @see {@link let_ let}
|
|
1294
|
-
*
|
|
1295
1291
|
* @example
|
|
1296
1292
|
* ```ts
|
|
1297
1293
|
* import * as assert from "node:assert"
|
|
@@ -1306,6 +1302,10 @@ export declare const bindTo: {
|
|
|
1306
1302
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1307
1303
|
* ```
|
|
1308
1304
|
*
|
|
1305
|
+
* @see {@link Do}
|
|
1306
|
+
* @see {@link bind}
|
|
1307
|
+
* @see {@link let_ let}
|
|
1308
|
+
*
|
|
1309
1309
|
* @category do notation
|
|
1310
1310
|
* @since 2.0.0
|
|
1311
1311
|
*/
|
|
@@ -1322,10 +1322,6 @@ export declare const bindTo: {
|
|
|
1322
1322
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1323
1323
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1324
1324
|
*
|
|
1325
|
-
* @see {@link Do}
|
|
1326
|
-
* @see {@link bind}
|
|
1327
|
-
* @see {@link let_ let}
|
|
1328
|
-
*
|
|
1329
1325
|
* @example
|
|
1330
1326
|
* ```ts
|
|
1331
1327
|
* import * as assert from "node:assert"
|
|
@@ -1340,6 +1336,10 @@ export declare const bindTo: {
|
|
|
1340
1336
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1341
1337
|
* ```
|
|
1342
1338
|
*
|
|
1339
|
+
* @see {@link Do}
|
|
1340
|
+
* @see {@link bind}
|
|
1341
|
+
* @see {@link let_ let}
|
|
1342
|
+
*
|
|
1343
1343
|
* @category do notation
|
|
1344
1344
|
* @since 2.0.0
|
|
1345
1345
|
*/
|
|
@@ -1366,10 +1366,6 @@ export {
|
|
|
1366
1366
|
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
1367
1367
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
1368
1368
|
*
|
|
1369
|
-
* @see {@link Do}
|
|
1370
|
-
* @see {@link bindTo}
|
|
1371
|
-
* @see {@link bind}
|
|
1372
|
-
*
|
|
1373
1369
|
* @example
|
|
1374
1370
|
* ```ts
|
|
1375
1371
|
* import * as assert from "node:assert"
|
|
@@ -1382,8 +1378,12 @@ export {
|
|
|
1382
1378
|
* Either.let("sum", ({ x, y }) => x + y)
|
|
1383
1379
|
* )
|
|
1384
1380
|
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
1385
|
-
*
|
|
1386
1381
|
* ```
|
|
1382
|
+
*
|
|
1383
|
+
* @see {@link Do}
|
|
1384
|
+
* @see {@link bindTo}
|
|
1385
|
+
* @see {@link bind}
|
|
1386
|
+
*
|
|
1387
1387
|
* @category do notation
|
|
1388
1388
|
* @since 2.0.0
|
|
1389
1389
|
*/
|
package/dist/dts/LogLevel.d.ts
CHANGED
|
@@ -173,7 +173,7 @@ export declare const allLevels: readonly LogLevel[];
|
|
|
173
173
|
* }).pipe(LogLevel.locally(LogLevel.Warning))
|
|
174
174
|
* })
|
|
175
175
|
*
|
|
176
|
-
*
|
|
176
|
+
* Effect.runFork(program)
|
|
177
177
|
* // timestamp=... level=INFO fiber=#0 message=message1
|
|
178
178
|
* // timestamp=... level=WARN fiber=#0 message=message2
|
|
179
179
|
* // timestamp=... level=WARN fiber=#0 message=message3
|
|
@@ -209,7 +209,7 @@ export declare const locally: {
|
|
|
209
209
|
* }).pipe(LogLevel.locally(LogLevel.Warning))
|
|
210
210
|
* })
|
|
211
211
|
*
|
|
212
|
-
*
|
|
212
|
+
* Effect.runFork(program)
|
|
213
213
|
* // timestamp=... level=INFO fiber=#0 message=message1
|
|
214
214
|
* // timestamp=... level=WARN fiber=#0 message=message2
|
|
215
215
|
* // timestamp=... level=WARN fiber=#0 message=message3
|
|
@@ -245,7 +245,7 @@ export declare const locally: {
|
|
|
245
245
|
* }).pipe(LogLevel.locally(LogLevel.Warning))
|
|
246
246
|
* })
|
|
247
247
|
*
|
|
248
|
-
*
|
|
248
|
+
* Effect.runFork(program)
|
|
249
249
|
* // timestamp=... level=INFO fiber=#0 message=message1
|
|
250
250
|
* // timestamp=... level=WARN fiber=#0 message=message2
|
|
251
251
|
* // timestamp=... level=WARN fiber=#0 message=message3
|
package/dist/dts/Logger.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare namespace Logger {
|
|
|
87
87
|
* Effect.provide(Logger.replace(Logger.defaultLogger, logger))
|
|
88
88
|
* )
|
|
89
89
|
*
|
|
90
|
-
*
|
|
90
|
+
* Effect.runFork(program)
|
|
91
91
|
* // [INFO] start
|
|
92
92
|
* // [DEBUG] task1 done
|
|
93
93
|
* // [DEBUG] task2 done
|
|
@@ -207,7 +207,7 @@ export declare const map: {
|
|
|
207
207
|
* yield* Effect.log("three")
|
|
208
208
|
* }).pipe(Effect.provide(LoggerLive))
|
|
209
209
|
*
|
|
210
|
-
*
|
|
210
|
+
* Effect.runFork(program)
|
|
211
211
|
* // BATCH [
|
|
212
212
|
* // timestamp=... level=INFO fiber=#0 message=one
|
|
213
213
|
* // timestamp=... level=INFO fiber=#0 message=two
|
|
@@ -240,7 +240,7 @@ export declare const batched: {
|
|
|
240
240
|
* yield* Effect.log("three")
|
|
241
241
|
* }).pipe(Effect.provide(LoggerLive))
|
|
242
242
|
*
|
|
243
|
-
*
|
|
243
|
+
* Effect.runFork(program)
|
|
244
244
|
* // BATCH [
|
|
245
245
|
* // timestamp=... level=INFO fiber=#0 message=one
|
|
246
246
|
* // timestamp=... level=INFO fiber=#0 message=two
|
|
@@ -273,7 +273,7 @@ export declare const batched: {
|
|
|
273
273
|
* yield* Effect.log("three")
|
|
274
274
|
* }).pipe(Effect.provide(LoggerLive))
|
|
275
275
|
*
|
|
276
|
-
*
|
|
276
|
+
* Effect.runFork(program)
|
|
277
277
|
* // BATCH [
|
|
278
278
|
* // timestamp=... level=INFO fiber=#0 message=one
|
|
279
279
|
* // timestamp=... level=INFO fiber=#0 message=two
|
|
@@ -420,7 +420,7 @@ export declare const test: {
|
|
|
420
420
|
*
|
|
421
421
|
* const program = Effect.logDebug("message1").pipe(Logger.withMinimumLogLevel(LogLevel.Debug))
|
|
422
422
|
*
|
|
423
|
-
*
|
|
423
|
+
* Effect.runFork(program)
|
|
424
424
|
* // timestamp=... level=DEBUG fiber=#0 message=message1
|
|
425
425
|
* ```
|
|
426
426
|
*
|
|
@@ -438,7 +438,7 @@ export declare const withMinimumLogLevel: {
|
|
|
438
438
|
*
|
|
439
439
|
* const program = Effect.logDebug("message1").pipe(Logger.withMinimumLogLevel(LogLevel.Debug))
|
|
440
440
|
*
|
|
441
|
-
*
|
|
441
|
+
* Effect.runFork(program)
|
|
442
442
|
* // timestamp=... level=DEBUG fiber=#0 message=message1
|
|
443
443
|
* ```
|
|
444
444
|
*
|
|
@@ -456,7 +456,7 @@ export declare const withMinimumLogLevel: {
|
|
|
456
456
|
*
|
|
457
457
|
* const program = Effect.logDebug("message1").pipe(Logger.withMinimumLogLevel(LogLevel.Debug))
|
|
458
458
|
*
|
|
459
|
-
*
|
|
459
|
+
* Effect.runFork(program)
|
|
460
460
|
* // timestamp=... level=DEBUG fiber=#0 message=message1
|
|
461
461
|
* ```
|
|
462
462
|
*
|
|
@@ -545,7 +545,7 @@ export declare const defaultLogger: Logger<unknown, void>;
|
|
|
545
545
|
* Effect.withLogSpan("myspan")
|
|
546
546
|
* )
|
|
547
547
|
*
|
|
548
|
-
*
|
|
548
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.json)))
|
|
549
549
|
* // {"message":["message1","message2"],"logLevel":"INFO","timestamp":"...","annotations":{"key2":"value2","key1":"value1"},"spans":{"myspan":0},"fiberId":"#0"}
|
|
550
550
|
* ```
|
|
551
551
|
*
|
|
@@ -566,7 +566,7 @@ export declare const jsonLogger: Logger<unknown, string>;
|
|
|
566
566
|
* Effect.withLogSpan("myspan")
|
|
567
567
|
* )
|
|
568
568
|
*
|
|
569
|
-
*
|
|
569
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.logFmt)))
|
|
570
570
|
* // timestamp=... level=INFO fiber=#0 message=message1 message=message2 myspan=0ms key2=value2 key1=value1
|
|
571
571
|
* ```
|
|
572
572
|
*
|
|
@@ -594,7 +594,7 @@ export declare const stringLogger: Logger<unknown, string>;
|
|
|
594
594
|
* Effect.withLogSpan("myspan")
|
|
595
595
|
* )
|
|
596
596
|
*
|
|
597
|
-
*
|
|
597
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.pretty)))
|
|
598
598
|
* // green --v v-- bold and cyan
|
|
599
599
|
* // [07:51:54.434] INFO (#0) myspan=1ms: message1
|
|
600
600
|
* // message2
|
|
@@ -633,7 +633,7 @@ export declare const prettyLoggerDefault: Logger<unknown, void>;
|
|
|
633
633
|
* Effect.withLogSpan("myspan")
|
|
634
634
|
* )
|
|
635
635
|
*
|
|
636
|
-
*
|
|
636
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.structured)))
|
|
637
637
|
* // {
|
|
638
638
|
* // message: [ 'message1', 'message2' ],
|
|
639
639
|
* // logLevel: 'INFO',
|
|
@@ -675,7 +675,7 @@ export declare const tracerLogger: Logger<unknown, void>;
|
|
|
675
675
|
* Effect.withLogSpan("myspan")
|
|
676
676
|
* )
|
|
677
677
|
*
|
|
678
|
-
*
|
|
678
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.json)))
|
|
679
679
|
* // {"message":["message1","message2"],"logLevel":"INFO","timestamp":"...","annotations":{"key2":"value2","key1":"value1"},"spans":{"myspan":0},"fiberId":"#0"}
|
|
680
680
|
* ```
|
|
681
681
|
*
|
|
@@ -696,7 +696,7 @@ export declare const json: Layer.Layer<never>;
|
|
|
696
696
|
* Effect.withLogSpan("myspan")
|
|
697
697
|
* )
|
|
698
698
|
*
|
|
699
|
-
*
|
|
699
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.logFmt)))
|
|
700
700
|
* // timestamp=... level=INFO fiber=#0 message=message1 message=message2 myspan=0ms key2=value2 key1=value1
|
|
701
701
|
* ```
|
|
702
702
|
*
|
|
@@ -719,7 +719,7 @@ export declare const logFmt: Layer.Layer<never>;
|
|
|
719
719
|
* Effect.withLogSpan("myspan")
|
|
720
720
|
* )
|
|
721
721
|
*
|
|
722
|
-
*
|
|
722
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.pretty)))
|
|
723
723
|
* // green --v v-- bold and cyan
|
|
724
724
|
* // [07:51:54.434] INFO (#0) myspan=1ms: message1
|
|
725
725
|
* // message2
|
|
@@ -746,7 +746,7 @@ export declare const pretty: Layer.Layer<never>;
|
|
|
746
746
|
* Effect.withLogSpan("myspan")
|
|
747
747
|
* )
|
|
748
748
|
*
|
|
749
|
-
*
|
|
749
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.structured)))
|
|
750
750
|
* // {
|
|
751
751
|
* // message: [ 'message1', 'message2' ],
|
|
752
752
|
* // logLevel: 'INFO',
|
|
@@ -777,7 +777,7 @@ export declare const structured: Layer.Layer<never>;
|
|
|
777
777
|
* })
|
|
778
778
|
*
|
|
779
779
|
* // Logging disabled using a layer
|
|
780
|
-
*
|
|
780
|
+
* Effect.runFork(program.pipe(Effect.provide(Logger.minimumLogLevel(LogLevel.None))))
|
|
781
781
|
* // task done
|
|
782
782
|
* ```
|
|
783
783
|
*
|
package/dist/dts/Match.d.ts
CHANGED
|
@@ -146,11 +146,9 @@ export interface Not {
|
|
|
146
146
|
* created, you can use pattern-matching functions like {@link when} to define
|
|
147
147
|
* how different values should be processed.
|
|
148
148
|
*
|
|
149
|
-
*
|
|
149
|
+
* **Example** (Matching Numbers and Strings)
|
|
150
150
|
*
|
|
151
|
-
* @example
|
|
152
151
|
* ```ts
|
|
153
|
-
* // Title: Matching Numbers and Strings
|
|
154
152
|
* import { Match } from "effect"
|
|
155
153
|
*
|
|
156
154
|
* // Create a matcher for values that are either strings or numbers
|
|
@@ -173,6 +171,8 @@ export interface Not {
|
|
|
173
171
|
* // Output: "string: hello"
|
|
174
172
|
* ```
|
|
175
173
|
*
|
|
174
|
+
* @see {@link value} for creating a matcher from a specific value.
|
|
175
|
+
*
|
|
176
176
|
* @category Creating a matcher
|
|
177
177
|
* @since 1.0.0
|
|
178
178
|
*/
|
|
@@ -190,11 +190,9 @@ export declare const type: <I>() => Matcher<I, Types.Without<never>, I, never, n
|
|
|
190
190
|
* Once the matcher is created, you can use pattern-matching functions like
|
|
191
191
|
* {@link when} to define how different cases should be handled.
|
|
192
192
|
*
|
|
193
|
-
*
|
|
193
|
+
* **Example** (Matching an Object by Property)
|
|
194
194
|
*
|
|
195
|
-
* @example
|
|
196
195
|
* ```ts
|
|
197
|
-
* // Title: Matching an Object by Property
|
|
198
196
|
* import { Match } from "effect"
|
|
199
197
|
*
|
|
200
198
|
* const input = { name: "John", age: 30 }
|
|
@@ -214,6 +212,8 @@ export declare const type: <I>() => Matcher<I, Types.Without<never>, I, never, n
|
|
|
214
212
|
* // Output: "John is 30 years old"
|
|
215
213
|
* ```
|
|
216
214
|
*
|
|
215
|
+
* @see {@link type} for creating a matcher from a specific type.
|
|
216
|
+
*
|
|
217
217
|
* @category Creating a matcher
|
|
218
218
|
* @since 1.0.0
|
|
219
219
|
*/
|
|
@@ -252,9 +252,9 @@ export declare const typeTags: <I>() => <P extends {
|
|
|
252
252
|
* **Important:** This function must be the first step in the matcher pipeline.
|
|
253
253
|
* If used later, TypeScript will not enforce type consistency correctly.
|
|
254
254
|
*
|
|
255
|
-
*
|
|
255
|
+
* **Example** (Validating Return Type Consistency)
|
|
256
|
+
*
|
|
256
257
|
* ```ts
|
|
257
|
-
* // Title: Validating Return Type Consistency
|
|
258
258
|
* import { Match } from "effect"
|
|
259
259
|
*
|
|
260
260
|
* const match = Match.type<{ a: number } | { b: string }>().pipe(
|
|
@@ -286,14 +286,9 @@ export declare const withReturnType: <Ret>() => <I, F, R, A, Pr, _>(self: Matche
|
|
|
286
286
|
* specific values or apply logical conditions to determine a match. It works
|
|
287
287
|
* well with structured objects and primitive types.
|
|
288
288
|
*
|
|
289
|
-
*
|
|
290
|
-
* condition.
|
|
291
|
-
* @see {@link whenAnd} Use this when a value must match all provided patterns.
|
|
292
|
-
* @see {@link orElse} Provides a fallback when no patterns match.
|
|
289
|
+
* **Example** (Matching with Values and Predicates)
|
|
293
290
|
*
|
|
294
|
-
* @example
|
|
295
291
|
* ```ts
|
|
296
|
-
* // Title: Matching with Values and Predicates
|
|
297
292
|
* import { Match } from "effect"
|
|
298
293
|
*
|
|
299
294
|
* // Create a matcher for objects with an "age" property
|
|
@@ -316,6 +311,11 @@ export declare const withReturnType: <Ret>() => <I, F, R, A, Pr, _>(self: Matche
|
|
|
316
311
|
* // Output: "4 is too young"
|
|
317
312
|
* ```
|
|
318
313
|
*
|
|
314
|
+
* @see {@link whenOr} Use this when multiple patterns should match in a single
|
|
315
|
+
* condition.
|
|
316
|
+
* @see {@link whenAnd} Use this when a value must match all provided patterns.
|
|
317
|
+
* @see {@link orElse} Provides a fallback when no patterns match.
|
|
318
|
+
*
|
|
319
319
|
* @category Defining patterns
|
|
320
320
|
* @since 1.0.0
|
|
321
321
|
*/
|
|
@@ -549,9 +549,9 @@ export declare const discriminatorsExhaustive: <D extends string>(field: D) => <
|
|
|
549
549
|
* of naming the tag field as `"_tag"`. Ensure that your discriminated unions
|
|
550
550
|
* follow this naming convention for proper functionality.
|
|
551
551
|
*
|
|
552
|
-
*
|
|
552
|
+
* **Example** (Matching a Discriminated Union by Tag)
|
|
553
|
+
*
|
|
553
554
|
* ```ts
|
|
554
|
-
* // Title: Matching a Discriminated Union by Tag
|
|
555
555
|
* import { Match } from "effect"
|
|
556
556
|
*
|
|
557
557
|
* type Event =
|
|
@@ -691,9 +691,9 @@ export declare const tagsExhaustive: <R, Ret, P extends {
|
|
|
691
691
|
* Any excluded value will bypass the provided function and continue matching
|
|
692
692
|
* through other cases.
|
|
693
693
|
*
|
|
694
|
-
*
|
|
694
|
+
* **Example** (Ignoring a Specific Value)
|
|
695
|
+
*
|
|
695
696
|
* ```ts
|
|
696
|
-
* // Title: Ignoring a Specific Value
|
|
697
697
|
* import { Match } from "effect"
|
|
698
698
|
*
|
|
699
699
|
* // Create a matcher for string or number values
|
|
@@ -834,9 +834,9 @@ export declare const instanceOfUnsafe: <A extends abstract new (...args: any) =>
|
|
|
834
834
|
* `default` clause in a `switch` statement or the final `else` in an `if-else`
|
|
835
835
|
* chain.
|
|
836
836
|
*
|
|
837
|
-
*
|
|
837
|
+
* **Example** (Providing a Default Value When No Patterns Match)
|
|
838
|
+
*
|
|
838
839
|
* ```ts
|
|
839
|
-
* // Title: Providing a Default Value When No Patterns Match
|
|
840
840
|
* import { Match } from "effect"
|
|
841
841
|
*
|
|
842
842
|
* // Create a matcher for string or number values
|
|
@@ -890,9 +890,9 @@ export declare const orElseAbsurd: <I, R, RA, A, Pr, Ret>(self: Matcher<I, R, RA
|
|
|
890
890
|
* unmatched case should be explicitly handled rather than returning a default
|
|
891
891
|
* value or throwing an error.
|
|
892
892
|
*
|
|
893
|
-
*
|
|
893
|
+
* **Example** (Extracting a User Role with `Match.either`)
|
|
894
|
+
*
|
|
894
895
|
* ```ts
|
|
895
|
-
* // Title: Extracting a User Role with Either
|
|
896
896
|
* import { Match } from "effect"
|
|
897
897
|
*
|
|
898
898
|
* type User = { readonly role: "admin" | "editor" | "viewer" }
|
|
@@ -928,9 +928,9 @@ export declare const either: <I, F, R, A, Pr, Ret>(self: Matcher<I, F, R, A, Pr,
|
|
|
928
928
|
* handled explicitly rather than throwing an error or returning a default
|
|
929
929
|
* value.
|
|
930
930
|
*
|
|
931
|
-
*
|
|
931
|
+
* **Example** (Extracting a User Role with `Match.option`)
|
|
932
|
+
*
|
|
932
933
|
* ```ts
|
|
933
|
-
* // Title: Extracting a User Role with Option
|
|
934
934
|
* import { Match } from "effect"
|
|
935
935
|
*
|
|
936
936
|
* type User = { readonly role: "admin" | "editor" | "viewer" }
|
|
@@ -959,9 +959,9 @@ export declare const option: <I, F, R, A, Pr, Ret>(self: Matcher<I, F, R, A, Pr,
|
|
|
959
959
|
* TypeScript will produce a type error. This is particularly useful when
|
|
960
960
|
* working with unions, as it helps prevent unintended gaps in pattern matching.
|
|
961
961
|
*
|
|
962
|
-
*
|
|
962
|
+
* **Example** (Ensuring All Cases Are Covered)
|
|
963
|
+
*
|
|
963
964
|
* ```ts
|
|
964
|
-
* // Title: Ensuring All Cases Are Covered
|
|
965
965
|
* import { Match } from "effect"
|
|
966
966
|
*
|
|
967
967
|
* // Create a matcher for string or number values
|