effect 4.0.0-beta.68 → 4.0.0-beta.69
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/Channel.d.ts.map +1 -1
- package/dist/Channel.js +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Effect.d.ts +485 -485
- package/dist/Effect.js +218 -218
- package/dist/index.d.ts +21 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -29
- package/dist/index.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +1 -1
- package/dist/unstable/ai/index.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +23 -0
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +23 -0
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +2 -0
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +27 -0
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +30 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +3 -0
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +3 -0
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +10 -0
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +3 -0
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +1 -1
- package/dist/unstable/cluster/index.js +1 -1
- package/dist/unstable/observability/index.d.ts +1 -1
- package/dist/unstable/observability/index.js +1 -1
- package/dist/unstable/process/index.d.ts +1 -1
- package/dist/unstable/process/index.js +1 -1
- package/dist/unstable/reactivity/index.d.ts +2 -3
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +2 -3
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +1 -1
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +6 -4
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +9 -7
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +0 -1
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +0 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +5 -9
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +3 -3
- package/src/Channel.ts +6 -1
- package/src/Effect.ts +491 -491
- package/src/index.ts +21 -29
- package/src/unstable/ai/index.ts +1 -1
- package/src/unstable/cli/Flag.ts +24 -0
- package/src/unstable/cli/Param.ts +32 -0
- package/src/unstable/cli/index.ts +1 -1
- package/src/unstable/cli/internal/command.ts +3 -0
- package/src/unstable/cli/internal/completions/descriptor.ts +3 -0
- package/src/unstable/cli/internal/help.ts +10 -0
- package/src/unstable/cli/internal/parser.ts +3 -0
- package/src/unstable/cluster/index.ts +1 -1
- package/src/unstable/observability/index.ts +1 -1
- package/src/unstable/process/index.ts +1 -1
- package/src/unstable/reactivity/index.ts +2 -3
- package/src/unstable/rpc/RpcWorker.ts +3 -1
- package/src/unstable/sql/Migrator.ts +9 -7
- package/src/unstable/sql/index.ts +0 -1
- package/src/unstable/workflow/WorkflowEngine.ts +7 -11
package/src/index.ts
CHANGED
|
@@ -894,7 +894,8 @@ export * as Cron from "./Cron.ts"
|
|
|
894
894
|
* and message digests. The base `Random` service is not cryptographically
|
|
895
895
|
* secure unless you replace it with a cryptographically secure implementation.
|
|
896
896
|
*
|
|
897
|
-
*
|
|
897
|
+
* **Example** (Providing a test Crypto service)
|
|
898
|
+
*
|
|
898
899
|
* ```ts
|
|
899
900
|
* import { Console, Crypto, Effect, Layer } from "effect"
|
|
900
901
|
*
|
|
@@ -915,7 +916,8 @@ export * as Cron from "./Cron.ts"
|
|
|
915
916
|
* Effect.runPromise(Effect.provide(program, TestCrypto))
|
|
916
917
|
* ```
|
|
917
918
|
*
|
|
918
|
-
*
|
|
919
|
+
* **Example** (Generating random bytes)
|
|
920
|
+
*
|
|
919
921
|
* ```ts
|
|
920
922
|
* import { Crypto, Effect, Layer } from "effect"
|
|
921
923
|
*
|
|
@@ -1219,7 +1221,7 @@ export * as Duration from "./Duration.ts"
|
|
|
1219
1221
|
* - **Testable**: Built-in support for testing with controlled environments
|
|
1220
1222
|
* - **Interruptible**: Effects can be safely interrupted and cancelled
|
|
1221
1223
|
*
|
|
1222
|
-
* **Example** (
|
|
1224
|
+
* **Example** (Creating and running effects)
|
|
1223
1225
|
*
|
|
1224
1226
|
* ```ts
|
|
1225
1227
|
* import { Console, Effect } from "effect"
|
|
@@ -1238,7 +1240,7 @@ export * as Duration from "./Duration.ts"
|
|
|
1238
1240
|
* Effect.runPromise(program).then(console.log) // 13
|
|
1239
1241
|
* ```
|
|
1240
1242
|
*
|
|
1241
|
-
* **Example** (
|
|
1243
|
+
* **Example** (Handling typed failures)
|
|
1242
1244
|
*
|
|
1243
1245
|
* ```ts
|
|
1244
1246
|
* import { Data, Effect } from "effect"
|
|
@@ -2290,8 +2292,7 @@ export * as HKT from "./HKT.ts"
|
|
|
2290
2292
|
* **Example** (Creating inspectable values)
|
|
2291
2293
|
*
|
|
2292
2294
|
* ```ts
|
|
2293
|
-
* import { Inspectable } from "effect"
|
|
2294
|
-
* import { format } from "effect/Formatter"
|
|
2295
|
+
* import { Formatter, Inspectable } from "effect"
|
|
2295
2296
|
*
|
|
2296
2297
|
* class User extends Inspectable.Class {
|
|
2297
2298
|
* constructor(
|
|
@@ -2312,7 +2313,7 @@ export * as HKT from "./HKT.ts"
|
|
|
2312
2313
|
*
|
|
2313
2314
|
* const user = new User("Alice", "alice@example.com")
|
|
2314
2315
|
* console.log(user.toString()) // Pretty printed JSON
|
|
2315
|
-
* console.log(format(user)) // Same as toString()
|
|
2316
|
+
* console.log(Formatter.format(user)) // Same as toString()
|
|
2316
2317
|
* ```
|
|
2317
2318
|
*
|
|
2318
2319
|
* @since 2.0.0
|
|
@@ -2388,7 +2389,7 @@ export * as Iterable from "./Iterable.ts"
|
|
|
2388
2389
|
* **Example** (Computing and applying a patch)
|
|
2389
2390
|
*
|
|
2390
2391
|
* ```ts
|
|
2391
|
-
* import
|
|
2392
|
+
* import { JsonPatch } from "effect"
|
|
2392
2393
|
*
|
|
2393
2394
|
* const oldValue = { name: "Alice", age: 30 }
|
|
2394
2395
|
* const newValue = { name: "Alice", age: 31, city: "NYC" }
|
|
@@ -2443,15 +2444,15 @@ export * as JsonPatch from "./JsonPatch.ts"
|
|
|
2443
2444
|
* **Example** (Building and parsing a JSON Pointer)
|
|
2444
2445
|
*
|
|
2445
2446
|
* ```ts
|
|
2446
|
-
* import {
|
|
2447
|
+
* import { JsonPointer } from "effect"
|
|
2447
2448
|
*
|
|
2448
2449
|
* // Build a JSON Pointer from path segments
|
|
2449
2450
|
* const segments = ["users", "name/alias", "value"]
|
|
2450
|
-
* const pointer = "/" + segments.map(escapeToken).join("/")
|
|
2451
|
+
* const pointer = "/" + segments.map(JsonPointer.escapeToken).join("/")
|
|
2451
2452
|
* // "/users/name~1alias/value"
|
|
2452
2453
|
*
|
|
2453
2454
|
* // Parse a JSON Pointer back to segments
|
|
2454
|
-
* const tokens = pointer.split("/").slice(1).map(unescapeToken)
|
|
2455
|
+
* const tokens = pointer.split("/").slice(1).map(JsonPointer.unescapeToken)
|
|
2455
2456
|
* // ["users", "name/alias", "value"]
|
|
2456
2457
|
* ```
|
|
2457
2458
|
*
|
|
@@ -2585,7 +2586,7 @@ export * as JsonSchema from "./JsonSchema.ts"
|
|
|
2585
2586
|
* - Prefer the effectful APIs unless synchronous allocation or mutation is
|
|
2586
2587
|
* required
|
|
2587
2588
|
*
|
|
2588
|
-
* @since
|
|
2589
|
+
* @since 4.0.0
|
|
2589
2590
|
*/
|
|
2590
2591
|
export * as Latch from "./Latch.ts"
|
|
2591
2592
|
|
|
@@ -2959,7 +2960,6 @@ export * as Metric from "./Metric.ts"
|
|
|
2959
2960
|
* - Size: O(1)
|
|
2960
2961
|
* - Iteration: O(n)
|
|
2961
2962
|
*
|
|
2962
|
-
* @category data-structures
|
|
2963
2963
|
* @since 2.0.0
|
|
2964
2964
|
*/
|
|
2965
2965
|
export * as MutableHashMap from "./MutableHashMap.ts"
|
|
@@ -3034,8 +3034,6 @@ export * as MutableHashMap from "./MutableHashMap.ts"
|
|
|
3034
3034
|
* // Output: ["apple", "cherry"]
|
|
3035
3035
|
* ```
|
|
3036
3036
|
*
|
|
3037
|
-
* @fileoverview
|
|
3038
|
-
* @category data-structures
|
|
3039
3037
|
* @since 2.0.0
|
|
3040
3038
|
*/
|
|
3041
3039
|
export * as MutableHashSet from "./MutableHashSet.ts"
|
|
@@ -3088,8 +3086,6 @@ export * as MutableHashSet from "./MutableHashSet.ts"
|
|
|
3088
3086
|
* - {@link remove} uses JavaScript strict equality semantics, not structural
|
|
3089
3087
|
* equality
|
|
3090
3088
|
*
|
|
3091
|
-
* @fileoverview
|
|
3092
|
-
* @category data-structures
|
|
3093
3089
|
* @since 4.0.0
|
|
3094
3090
|
*/
|
|
3095
3091
|
export * as MutableList from "./MutableList.ts"
|
|
@@ -3126,7 +3122,6 @@ export * as MutableList from "./MutableList.ts"
|
|
|
3126
3122
|
* - `compareAndSet` compares with Effect equality semantics, not only JavaScript reference equality
|
|
3127
3123
|
* - For state that must participate in `Effect` workflows, interruption, or fiber coordination, prefer higher-level Effect data types
|
|
3128
3124
|
*
|
|
3129
|
-
* @category data-structures
|
|
3130
3125
|
* @since 2.0.0
|
|
3131
3126
|
*/
|
|
3132
3127
|
export * as MutableRef from "./MutableRef.ts"
|
|
@@ -3231,7 +3226,7 @@ export * as Newtype from "./Newtype.ts"
|
|
|
3231
3226
|
* **Example** (Requiring a non-empty iterable)
|
|
3232
3227
|
*
|
|
3233
3228
|
* ```ts
|
|
3234
|
-
* import
|
|
3229
|
+
* import { NonEmptyIterable } from "effect"
|
|
3235
3230
|
*
|
|
3236
3231
|
* // NonEmptyIterable is a type that represents any iterable with at least one element
|
|
3237
3232
|
* function processNonEmpty<A>(data: NonEmptyIterable.NonEmptyIterable<A>): A {
|
|
@@ -3317,7 +3312,7 @@ export * as Newtype from "./Newtype.ts"
|
|
|
3317
3312
|
*
|
|
3318
3313
|
* ```ts
|
|
3319
3314
|
* import { Array, pipe } from "effect"
|
|
3320
|
-
* import type
|
|
3315
|
+
* import type { NonEmptyIterable } from "effect"
|
|
3321
3316
|
*
|
|
3322
3317
|
* // Many Array functions work with NonEmptyIterable
|
|
3323
3318
|
* declare const nonEmptyData: NonEmptyIterable.NonEmptyIterable<number>
|
|
@@ -3609,8 +3604,6 @@ export * as Order from "./Order.ts"
|
|
|
3609
3604
|
* right value, while `1` means it should come after
|
|
3610
3605
|
* - Reversing an `Ordering` swaps `-1` and `1`, but leaves `0` unchanged
|
|
3611
3606
|
*
|
|
3612
|
-
* @fileoverview
|
|
3613
|
-
* @category utilities
|
|
3614
3607
|
* @since 2.0.0
|
|
3615
3608
|
*/
|
|
3616
3609
|
export * as Ordering from "./Ordering.ts"
|
|
@@ -3811,7 +3804,7 @@ export * as Pool from "./Pool.ts"
|
|
|
3811
3804
|
* **Example** (Filter by a predicate)
|
|
3812
3805
|
*
|
|
3813
3806
|
* ```ts
|
|
3814
|
-
* import
|
|
3807
|
+
* import { Predicate } from "effect"
|
|
3815
3808
|
*
|
|
3816
3809
|
* const isPositive = (n: number) => n > 0
|
|
3817
3810
|
* const data = [2, -1, 3]
|
|
@@ -5159,7 +5152,7 @@ export * as ScopedRef from "./ScopedRef.ts"
|
|
|
5159
5152
|
* the requested permits cannot be acquired immediately.
|
|
5160
5153
|
* - Manual `take` / `release` usage must keep permit counts balanced.
|
|
5161
5154
|
*
|
|
5162
|
-
* @since
|
|
5155
|
+
* @since 4.0.0
|
|
5163
5156
|
*/
|
|
5164
5157
|
export * as Semaphore from "./Semaphore.ts"
|
|
5165
5158
|
|
|
@@ -5181,12 +5174,11 @@ export * as Semaphore from "./Semaphore.ts"
|
|
|
5181
5174
|
* **Common tasks**
|
|
5182
5175
|
*
|
|
5183
5176
|
* - Create simple sinks: {@link succeed}, {@link fail}, {@link fromEffect}
|
|
5184
|
-
* - Fold input: {@link fold}
|
|
5185
|
-
* - Collect values: {@link
|
|
5177
|
+
* - Fold input: {@link fold}
|
|
5178
|
+
* - Collect values: {@link collect}
|
|
5186
5179
|
* - Count or drain input: {@link count}, {@link drain}
|
|
5187
5180
|
* - Transform results: {@link map}, {@link mapEffect}, {@link as}
|
|
5188
|
-
* -
|
|
5189
|
-
* - Filter and refine input: {@link filterInput}, {@link filterInputEffect}
|
|
5181
|
+
* - Adapt input before consumption: {@link mapInput}, {@link mapInputEffect}
|
|
5190
5182
|
*
|
|
5191
5183
|
* **Gotchas**
|
|
5192
5184
|
*
|
|
@@ -5649,7 +5641,7 @@ export * as TxHashMap from "./TxHashMap.ts"
|
|
|
5649
5641
|
* - Mutate an existing set with {@link add}, {@link remove}, and {@link clear}
|
|
5650
5642
|
* - Query membership and size with {@link has}, {@link size}, and {@link isEmpty}
|
|
5651
5643
|
* - Derive new sets with {@link map}, {@link filter}, {@link union}, {@link intersection}, and {@link difference}
|
|
5652
|
-
* - Fold or collect values with {@link reduce}
|
|
5644
|
+
* - Fold or collect values with {@link reduce} and {@link toHashSet}
|
|
5653
5645
|
*
|
|
5654
5646
|
* **Gotchas**
|
|
5655
5647
|
*
|
package/src/unstable/ai/index.ts
CHANGED
|
@@ -353,8 +353,8 @@ export * as McpServer from "./McpServer.ts"
|
|
|
353
353
|
* **Example** (Creating a provider-specific model)
|
|
354
354
|
*
|
|
355
355
|
* ```ts
|
|
356
|
-
* import type { Layer } from "effect"
|
|
357
356
|
* import { Effect } from "effect"
|
|
357
|
+
* import type { Layer } from "effect"
|
|
358
358
|
* import { LanguageModel, Model } from "effect/unstable/ai"
|
|
359
359
|
*
|
|
360
360
|
* declare const myAnthropicLayer: Layer.Layer<LanguageModel.LanguageModel>
|
package/src/unstable/cli/Flag.ts
CHANGED
|
@@ -641,6 +641,30 @@ export const withMetavar: {
|
|
|
641
641
|
<A>(self: Flag<A>, metavar: string): Flag<A>
|
|
642
642
|
} = dual(2, <A>(self: Flag<A>, metavar: string) => Param.withMetavar(self, metavar))
|
|
643
643
|
|
|
644
|
+
/**
|
|
645
|
+
* Hides a flag from generated help output and shell completions while keeping
|
|
646
|
+
* it fully parseable on the command line.
|
|
647
|
+
*
|
|
648
|
+
* Useful for experimental or internal flags that should be accepted but not
|
|
649
|
+
* advertised — for example, `--experimental-foo`, debug toggles, or escape
|
|
650
|
+
* hatches that are not yet committed to the public CLI surface.
|
|
651
|
+
*
|
|
652
|
+
* **Example** (Hiding a flag from help)
|
|
653
|
+
*
|
|
654
|
+
* ```ts
|
|
655
|
+
* import { Flag } from "effect/unstable/cli"
|
|
656
|
+
*
|
|
657
|
+
* // Flag still parses --experimental-foo, but it does not appear in --help.
|
|
658
|
+
* const experimental = Flag.boolean("experimental-foo").pipe(
|
|
659
|
+
* Flag.withHidden
|
|
660
|
+
* )
|
|
661
|
+
* ```
|
|
662
|
+
*
|
|
663
|
+
* @category metadata
|
|
664
|
+
* @since 4.0.0
|
|
665
|
+
*/
|
|
666
|
+
export const withHidden = <A>(self: Flag<A>): Flag<A> => Param.withHidden(self)
|
|
667
|
+
|
|
644
668
|
/**
|
|
645
669
|
* Makes a flag optional, returning an Option type that can be None if not provided.
|
|
646
670
|
*
|
|
@@ -205,6 +205,7 @@ export interface Single<Kind extends ParamKind, out A> extends Param<Kind, A> {
|
|
|
205
205
|
readonly aliases: ReadonlyArray<string>
|
|
206
206
|
readonly primitiveType: Primitive.Primitive<A>
|
|
207
207
|
readonly typeName?: string | undefined
|
|
208
|
+
readonly hidden: boolean
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
/**
|
|
@@ -346,6 +347,7 @@ export const makeSingle = <const Kind extends ParamKind, A>(params: {
|
|
|
346
347
|
readonly typeName?: string | undefined
|
|
347
348
|
readonly description?: Option.Option<string> | undefined
|
|
348
349
|
readonly aliases?: ReadonlyArray<string> | undefined
|
|
350
|
+
readonly hidden?: boolean | undefined
|
|
349
351
|
}): Single<Kind, A> => {
|
|
350
352
|
const parse: Parse<A> = (args) =>
|
|
351
353
|
params.kind === argumentKind
|
|
@@ -356,6 +358,7 @@ export const makeSingle = <const Kind extends ParamKind, A>(params: {
|
|
|
356
358
|
...params,
|
|
357
359
|
description: params.description ?? Option.none(),
|
|
358
360
|
aliases: params.aliases ?? [],
|
|
361
|
+
hidden: params.hidden ?? false,
|
|
359
362
|
parse
|
|
360
363
|
})
|
|
361
364
|
}
|
|
@@ -1107,6 +1110,35 @@ export const withDescription: {
|
|
|
1107
1110
|
}))
|
|
1108
1111
|
})
|
|
1109
1112
|
|
|
1113
|
+
/**
|
|
1114
|
+
* Hides a parameter from generated help output and completions while keeping
|
|
1115
|
+
* it parseable on the command line.
|
|
1116
|
+
*
|
|
1117
|
+
* Useful for experimental, internal, or deprecated flags that should be
|
|
1118
|
+
* accepted but not advertised.
|
|
1119
|
+
*
|
|
1120
|
+
* **Example** (Hiding a flag from help)
|
|
1121
|
+
*
|
|
1122
|
+
* ```ts
|
|
1123
|
+
* import { Param } from "effect/unstable/cli"
|
|
1124
|
+
*
|
|
1125
|
+
* // @internal - this module is not exported publicly
|
|
1126
|
+
*
|
|
1127
|
+
* const experimental = Param.boolean(Param.flagKind, "experimental-foo").pipe(
|
|
1128
|
+
* Param.withHidden
|
|
1129
|
+
* )
|
|
1130
|
+
* ```
|
|
1131
|
+
*
|
|
1132
|
+
* @category metadata
|
|
1133
|
+
* @since 4.0.0
|
|
1134
|
+
*/
|
|
1135
|
+
export const withHidden = <Kind extends ParamKind, A>(self: Param<Kind, A>): Param<Kind, A> =>
|
|
1136
|
+
transformSingle(self, <X>(single: Single<Kind, X>) =>
|
|
1137
|
+
makeSingle({
|
|
1138
|
+
...single,
|
|
1139
|
+
hidden: true
|
|
1140
|
+
}))
|
|
1141
|
+
|
|
1110
1142
|
/**
|
|
1111
1143
|
* Transforms the parsed value of an option using a mapping function.
|
|
1112
1144
|
*
|
|
@@ -230,7 +230,7 @@ export * as HelpDoc from "./HelpDoc.ts"
|
|
|
230
230
|
* value; this is important for argument ordering and variadic parameters.
|
|
231
231
|
* - Some parsers require CLI services such as filesystem, path, terminal, or
|
|
232
232
|
* child-process support through the parsing environment.
|
|
233
|
-
*
|
|
233
|
+
*
|
|
234
234
|
* @since 4.0.0
|
|
235
235
|
*/
|
|
236
236
|
export * as Param from "./Param.ts"
|
|
@@ -157,6 +157,9 @@ export const makeCommand = <const Name extends string, Input, E, R, ContextInput
|
|
|
157
157
|
for (const option of config.flags) {
|
|
158
158
|
const singles = Param.extractSingleParams(option)
|
|
159
159
|
for (const single of singles) {
|
|
160
|
+
// Hidden flags still parse on the command line but are omitted from
|
|
161
|
+
// generated --help output.
|
|
162
|
+
if (single.hidden) continue
|
|
160
163
|
flags.push(toFlagDoc(single))
|
|
161
164
|
}
|
|
162
165
|
}
|
|
@@ -85,6 +85,9 @@ export const fromCommand = (cmd: Command.Any): Completions.CommandDescriptor =>
|
|
|
85
85
|
const singles = Param.extractSingleParams(flag)
|
|
86
86
|
for (const single of singles) {
|
|
87
87
|
if (single.kind !== "flag") continue
|
|
88
|
+
// Omit hidden flags from completion scripts so tab-completion in the
|
|
89
|
+
// shell does not advertise flags that are absent from --help.
|
|
90
|
+
if (single.hidden) continue
|
|
88
91
|
flags.push({
|
|
89
92
|
name: single.name,
|
|
90
93
|
aliases: single.aliases,
|
|
@@ -115,6 +115,12 @@ const getSharedFlagsForCommandPath = (
|
|
|
115
115
|
if (seen.has(single.name)) {
|
|
116
116
|
continue
|
|
117
117
|
}
|
|
118
|
+
// Hidden ancestor flags are excluded from the shared-flags section
|
|
119
|
+
// of subcommand help, the same way they're excluded from the owning
|
|
120
|
+
// command's own help output.
|
|
121
|
+
if (single.hidden) {
|
|
122
|
+
continue
|
|
123
|
+
}
|
|
118
124
|
seen.add(single.name)
|
|
119
125
|
sharedFlags.push(toFlagDoc(single))
|
|
120
126
|
}
|
|
@@ -160,6 +166,10 @@ export const getHelpForCommandPath = <Name extends string, Input, E, R, ContextI
|
|
|
160
166
|
for (const flag of flags) {
|
|
161
167
|
const singles = Param.extractSingleParams(flag.flag)
|
|
162
168
|
for (const single of singles) {
|
|
169
|
+
// Same rule as command-local flags: hidden globals are still parsed
|
|
170
|
+
// and still trigger their handlers, they just don't appear under
|
|
171
|
+
// "GLOBAL FLAGS" in --help.
|
|
172
|
+
if (single.hidden) continue
|
|
163
173
|
globalFlagDocs.push({
|
|
164
174
|
...toFlagDoc(single),
|
|
165
175
|
required: false
|
|
@@ -517,6 +517,9 @@ const createUnrecognizedFlagError = (
|
|
|
517
517
|
const validNames: Array<string> = []
|
|
518
518
|
|
|
519
519
|
for (const p of params) {
|
|
520
|
+
// Exclude hidden flags so a near-miss typo cannot reveal a flag name
|
|
521
|
+
// that was intentionally kept out of --help.
|
|
522
|
+
if (p.hidden) continue
|
|
520
523
|
validNames.push(p.name)
|
|
521
524
|
if (Primitive.isBoolean(p.primitiveType)) {
|
|
522
525
|
validNames.push(`no-${p.name}`)
|
|
@@ -740,7 +740,7 @@ export * as ShardId from "./ShardId.ts"
|
|
|
740
740
|
* transparency for stateful entities, singleton workloads that should run once
|
|
741
741
|
* per shard group, or durable message processing backed by cluster storage.
|
|
742
742
|
* Registered entity handlers are started on demand for shards owned by the
|
|
743
|
-
* current runner, while clients produced by {@link Sharding
|
|
743
|
+
* current runner, while clients produced by the {@link Sharding} service route
|
|
744
744
|
* requests through the sharding service instead of calling handlers directly.
|
|
745
745
|
*
|
|
746
746
|
* **Gotchas**
|
|
@@ -205,7 +205,7 @@ export * as OtlpTracer from "./OtlpTracer.ts"
|
|
|
205
205
|
*
|
|
206
206
|
* ```ts
|
|
207
207
|
* import { Effect, Metric } from "effect"
|
|
208
|
-
* import
|
|
208
|
+
* import { PrometheusMetrics } from "effect/unstable/observability"
|
|
209
209
|
*
|
|
210
210
|
* const program = Effect.gen(function*() {
|
|
211
211
|
* // Create and update metrics
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* **Example** (Spawning and piping commands)
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
|
-
* import { NodeServices } from "@effect/platform-node"
|
|
17
16
|
* import { Effect, Stream } from "effect"
|
|
17
|
+
* import { NodeServices } from "@effect/platform-node"
|
|
18
18
|
* import { ChildProcess } from "effect/unstable/process"
|
|
19
19
|
*
|
|
20
20
|
* // Build a command
|
|
@@ -203,9 +203,8 @@ export * as Hydration from "./Hydration.ts"
|
|
|
203
203
|
* store them. Registrations are tied to the surrounding scope, failures from a
|
|
204
204
|
* query fail the queue or stream, and invalidations that arrive while a query is
|
|
205
205
|
* already running schedule a single follow-up run. Use stable key values, be
|
|
206
|
-
* aware that the default layer is process-local, and
|
|
207
|
-
*
|
|
208
|
-
* the batch exits.
|
|
206
|
+
* aware that the default layer is process-local, and use the {@link Reactivity}
|
|
207
|
+
* service when many invalidations should be coalesced until the batch exits.
|
|
209
208
|
*
|
|
210
209
|
* @since 4.0.0
|
|
211
210
|
*/
|
|
@@ -62,7 +62,9 @@ export declare namespace InitialMessage {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const ProtocolTag
|
|
65
|
+
const ProtocolTag = Context.Service<Protocol, Protocol["Service"]>(
|
|
66
|
+
"effect/rpc/RpcServer/Protocol" satisfies Protocol["key"]
|
|
67
|
+
)
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Runs an effect, encodes its result with the schema's JSON codec, and returns
|
|
@@ -341,8 +341,8 @@ const isConstraintConflict = (error: SqlError): boolean =>
|
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
* Creates a migration loader from a glob record of dynamic import functions,
|
|
344
|
-
* parsing files named `<id>_<name>.js
|
|
345
|
-
* migrations by id.
|
|
344
|
+
* parsing files named `<id>_<name>.js`, `<id>_<name>.ts`,
|
|
345
|
+
* `<id>_<name>.mjs`, or `<id>_<name>.mts` and sorting migrations by id.
|
|
346
346
|
*
|
|
347
347
|
* @category loaders
|
|
348
348
|
* @since 4.0.0
|
|
@@ -352,7 +352,7 @@ export const fromGlob = (
|
|
|
352
352
|
): Loader =>
|
|
353
353
|
pipe(
|
|
354
354
|
Object.keys(migrations),
|
|
355
|
-
Arr.flatMapNullishOr((_) => _.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts)$/)),
|
|
355
|
+
Arr.flatMapNullishOr((_) => _.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts|mjs|mts)$/)),
|
|
356
356
|
Arr.map(
|
|
357
357
|
([key, id, name]): ResolvedMigration => [
|
|
358
358
|
Number(id),
|
|
@@ -366,7 +366,8 @@ export const fromGlob = (
|
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
368
|
* Creates a migration loader from a Babel-style glob record, parsing keys such
|
|
369
|
-
* as `_<id>_<name>Js
|
|
369
|
+
* as `_<id>_<name>Js`, `_<id>_<name>Ts`, `_<id>_<name>Mjs`, or
|
|
370
|
+
* `_<id>_<name>Mts` and sorting migrations by id.
|
|
370
371
|
*
|
|
371
372
|
* @category loaders
|
|
372
373
|
* @since 4.0.0
|
|
@@ -374,7 +375,7 @@ export const fromGlob = (
|
|
|
374
375
|
export const fromBabelGlob = (migrations: Record<string, any>): Loader =>
|
|
375
376
|
pipe(
|
|
376
377
|
Object.keys(migrations),
|
|
377
|
-
Arr.flatMapNullishOr((_) => _.match(/^_(\d+)_([^.]+?)(Js|Ts)?$/)),
|
|
378
|
+
Arr.flatMapNullishOr((_) => _.match(/^_(\d+)_([^.]+?)(Js|Ts|Mjs|Mts)?$/)),
|
|
378
379
|
Arr.map(
|
|
379
380
|
([key, id, name]): ResolvedMigration => [
|
|
380
381
|
Number(id),
|
|
@@ -410,7 +411,8 @@ export const fromRecord = (migrations: Record<string, Effect.Effect<void, unknow
|
|
|
410
411
|
|
|
411
412
|
/**
|
|
412
413
|
* Creates a migration loader that reads a directory with `FileSystem`, imports
|
|
413
|
-
* files named `<id>_<name>.js
|
|
414
|
+
* files named `<id>_<name>.js`, `<id>_<name>.ts`,
|
|
415
|
+
* `<id>_<name>.mjs`, or `<id>_<name>.mts`, and sorts migrations by id.
|
|
414
416
|
*
|
|
415
417
|
* @category loaders
|
|
416
418
|
* @since 4.0.0
|
|
@@ -427,7 +429,7 @@ export const fromFileSystem: (directory: string) => Loader<FileSystem> = Effect.
|
|
|
427
429
|
})
|
|
428
430
|
)
|
|
429
431
|
return files
|
|
430
|
-
.map((file) => Option.fromNullishOr(file.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts)$/)))
|
|
432
|
+
.map((file) => Option.fromNullishOr(file.match(/^(?:.*\/)?(\d+)_([^.]+)\.(js|ts|mjs|mts)$/)))
|
|
431
433
|
.flatMap(
|
|
432
434
|
Option.match({
|
|
433
435
|
onNone: () => [],
|
|
@@ -122,7 +122,6 @@ export * as SqlError from "./SqlError.ts"
|
|
|
122
122
|
* directly; MySQL performs a follow-up `select`, so generated ids, defaults,
|
|
123
123
|
* and trigger-updated values must be observable from that query.
|
|
124
124
|
*
|
|
125
|
-
* @category models
|
|
126
125
|
* @since 4.0.0
|
|
127
126
|
*/
|
|
128
127
|
export * as SqlModel from "./SqlModel.ts"
|
|
@@ -415,22 +415,18 @@ export const makeUnsafe = (options: Encoded): WorkflowEngine["Service"] =>
|
|
|
415
415
|
return options.interrupt(self, executionId)
|
|
416
416
|
})
|
|
417
417
|
}
|
|
418
|
+
const run = options.execute(self, {
|
|
419
|
+
executionId,
|
|
420
|
+
payload: payload as object,
|
|
421
|
+
discard: opts.discard ?? false,
|
|
422
|
+
parent: Option.getOrUndefined(parentInstance)
|
|
423
|
+
}) as Effect.Effect<Workflow.Result<Success["Type"], Error["Type"]>>
|
|
418
424
|
|
|
419
425
|
if (opts.discard) {
|
|
420
|
-
yield*
|
|
421
|
-
executionId,
|
|
422
|
-
payload: payload as object,
|
|
423
|
-
discard: true
|
|
424
|
-
})
|
|
426
|
+
yield* run
|
|
425
427
|
return executionId
|
|
426
428
|
}
|
|
427
429
|
|
|
428
|
-
const run = options.execute(self, {
|
|
429
|
-
executionId,
|
|
430
|
-
payload: payload as object,
|
|
431
|
-
discard: false,
|
|
432
|
-
parent: Option.getOrUndefined(parentInstance)
|
|
433
|
-
})
|
|
434
430
|
if (Option.isSome(parentInstance)) {
|
|
435
431
|
const wrapped = yield* Workflow.wrapActivityResult(
|
|
436
432
|
run,
|