effect 4.0.0-beta.12 → 4.0.0-beta.14
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/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Schedule.js +1 -1
- package/dist/Schedule.js.map +1 -1
- package/dist/SchemaAST.js +1 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/request.js +2 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +36 -36
- package/dist/unstable/ai/McpSchema.js +8 -8
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +24 -2
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +41 -6
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +69 -30
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +160 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +157 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +10 -0
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +1 -5
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +4 -22
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +19 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +53 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +20 -35
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +3 -4
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +4 -4
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +3 -3
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +3 -3
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +14 -14
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +9 -3
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/package.json +1 -1
- package/src/ManagedRuntime.ts +1 -1
- package/src/Schedule.ts +1 -1
- package/src/SchemaAST.ts +1 -1
- package/src/index.ts +47 -0
- package/src/internal/request.ts +2 -2
- package/src/internal/schema/annotations.ts +2 -0
- package/src/unstable/ai/McpSchema.ts +8 -8
- package/src/unstable/cli/CliOutput.ts +32 -2
- package/src/unstable/cli/Command.ts +104 -37
- package/src/unstable/cli/GlobalFlag.ts +321 -0
- package/src/unstable/cli/HelpDoc.ts +12 -0
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/command.ts +5 -30
- package/src/unstable/cli/internal/help.ts +65 -0
- package/src/unstable/cli/internal/parser.ts +23 -52
- package/src/unstable/httpapi/OpenApi.ts +3 -4
- package/src/unstable/reactivity/Atom.ts +6 -6
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/schema/VariantSchema.ts +6 -6
- package/src/unstable/sql/SqlError.ts +11 -9
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help Documentation
|
|
3
|
+
* ================
|
|
4
|
+
*
|
|
5
|
+
* Internal helpers for generating help documentation.
|
|
6
|
+
* Extracted from command.ts to avoid circular dependencies.
|
|
7
|
+
*/
|
|
8
|
+
import * as Effect from "../../../Effect.ts"
|
|
9
|
+
import type * as ServiceMap from "../../../ServiceMap.ts"
|
|
10
|
+
import type { Command } from "../Command.ts"
|
|
11
|
+
import type { GlobalFlag } from "../GlobalFlag.ts"
|
|
12
|
+
import type { FlagDoc, HelpDoc } from "../HelpDoc.ts"
|
|
13
|
+
import * as Param from "../Param.ts"
|
|
14
|
+
import * as Primitive from "../Primitive.ts"
|
|
15
|
+
import { toImpl } from "./command.ts"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to get help documentation for a specific command path.
|
|
19
|
+
* Navigates through the command hierarchy to find the right command.
|
|
20
|
+
* Reads global flags from the registry and includes them in the help doc.
|
|
21
|
+
*/
|
|
22
|
+
export const getHelpForCommandPath = <Name extends string, Input, E, R>(
|
|
23
|
+
command: Command<Name, Input, E, R>,
|
|
24
|
+
commandPath: ReadonlyArray<string>,
|
|
25
|
+
registry: ServiceMap.Reference<Set<GlobalFlag<unknown>>>
|
|
26
|
+
): Effect.Effect<HelpDoc, never, never> =>
|
|
27
|
+
Effect.gen(function*() {
|
|
28
|
+
let currentCommand: Command.Any = command
|
|
29
|
+
|
|
30
|
+
for (let i = 1; i < commandPath.length; i++) {
|
|
31
|
+
const subcommandName = commandPath[i]
|
|
32
|
+
let subcommand: Command.Any | undefined = undefined
|
|
33
|
+
|
|
34
|
+
for (const group of currentCommand.subcommands) {
|
|
35
|
+
subcommand = group.commands.find((sub) => sub.name === subcommandName)
|
|
36
|
+
if (subcommand) {
|
|
37
|
+
break
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (subcommand) {
|
|
42
|
+
currentCommand = subcommand
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const baseDoc = toImpl(currentCommand).buildHelpDoc(commandPath)
|
|
47
|
+
|
|
48
|
+
const flags = yield* registry
|
|
49
|
+
const globalFlagDocs: Array<FlagDoc> = []
|
|
50
|
+
for (const flag of flags) {
|
|
51
|
+
const singles = Param.extractSingleParams(flag.flag)
|
|
52
|
+
for (const single of singles) {
|
|
53
|
+
const formattedAliases = single.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`)
|
|
54
|
+
globalFlagDocs.push({
|
|
55
|
+
name: single.name,
|
|
56
|
+
aliases: formattedAliases,
|
|
57
|
+
type: single.typeName ?? Primitive.getTypeName(single.primitiveType),
|
|
58
|
+
description: single.description,
|
|
59
|
+
required: false
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { ...baseDoc, globalFlags: globalFlagDocs }
|
|
65
|
+
})
|
|
@@ -25,14 +25,11 @@
|
|
|
25
25
|
* - Errors accumulate rather than throwing exceptions
|
|
26
26
|
*/
|
|
27
27
|
import * as Effect from "../../../Effect.ts"
|
|
28
|
-
import type { LogLevel } from "../../../LogLevel.ts"
|
|
29
|
-
import * as Option from "../../../Option.ts"
|
|
30
28
|
import * as CliError from "../CliError.ts"
|
|
31
29
|
import type { Command, ParsedTokens } from "../Command.ts"
|
|
32
30
|
import * as Param from "../Param.ts"
|
|
33
31
|
import * as Primitive from "../Primitive.ts"
|
|
34
32
|
import { suggest } from "./auto-suggest.ts"
|
|
35
|
-
import { completionsFlag, helpFlag, logLevelFlag, versionFlag } from "./builtInFlags.ts"
|
|
36
33
|
import { toImpl } from "./command.ts"
|
|
37
34
|
import type { LexResult, Token } from "./lexer.ts"
|
|
38
35
|
|
|
@@ -46,36 +43,6 @@ export const getCommandPath = (parsedInput: ParsedTokens): ReadonlyArray<string>
|
|
|
46
43
|
? [parsedInput.subcommand.name, ...getCommandPath(parsedInput.subcommand.parsedInput)]
|
|
47
44
|
: []
|
|
48
45
|
|
|
49
|
-
/** @internal */
|
|
50
|
-
export const extractBuiltInOptions = (
|
|
51
|
-
tokens: ReadonlyArray<Token>
|
|
52
|
-
): Effect.Effect<
|
|
53
|
-
{
|
|
54
|
-
help: boolean
|
|
55
|
-
logLevel: LogLevel | undefined
|
|
56
|
-
version: boolean
|
|
57
|
-
completions: "bash" | "zsh" | "fish" | undefined
|
|
58
|
-
remainder: ReadonlyArray<Token>
|
|
59
|
-
},
|
|
60
|
-
CliError.CliError,
|
|
61
|
-
Param.Environment
|
|
62
|
-
> =>
|
|
63
|
-
Effect.gen(function*() {
|
|
64
|
-
const { flagMap, remainder } = consumeKnownFlags(tokens, builtInFlagRegistry)
|
|
65
|
-
const emptyArgs: Param.ParsedArgs = { flags: flagMap, arguments: [] }
|
|
66
|
-
const [, help] = yield* helpFlag.parse(emptyArgs)
|
|
67
|
-
const [, logLevel] = yield* logLevelFlag.parse(emptyArgs)
|
|
68
|
-
const [, version] = yield* versionFlag.parse(emptyArgs)
|
|
69
|
-
const [, completions] = yield* completionsFlag.parse(emptyArgs)
|
|
70
|
-
return {
|
|
71
|
-
help,
|
|
72
|
-
logLevel: Option.getOrUndefined(logLevel),
|
|
73
|
-
version,
|
|
74
|
-
completions: Option.getOrUndefined(completions),
|
|
75
|
-
remainder
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
46
|
/** @internal */
|
|
80
47
|
export const parseArgs = (
|
|
81
48
|
lexResult: LexResult,
|
|
@@ -249,8 +216,9 @@ const makeCursor = (tokens: ReadonlyArray<Token>): TokenCursor => {
|
|
|
249
216
|
/**
|
|
250
217
|
* Creates a registry for O(1) flag lookup by name or alias.
|
|
251
218
|
* @throws Error if duplicate names or aliases are detected (developer error)
|
|
219
|
+
* @internal
|
|
252
220
|
*/
|
|
253
|
-
const createFlagRegistry = (params: ReadonlyArray<FlagParam>): FlagRegistry => {
|
|
221
|
+
export const createFlagRegistry = (params: ReadonlyArray<FlagParam>): FlagRegistry => {
|
|
254
222
|
const index = new Map<string, FlagParam>()
|
|
255
223
|
|
|
256
224
|
for (const param of params) {
|
|
@@ -276,9 +244,22 @@ const buildSubcommandIndex = (
|
|
|
276
244
|
subcommands: Command.Any["subcommands"]
|
|
277
245
|
): Map<string, Command<string, unknown, unknown, unknown>> => {
|
|
278
246
|
const index = new Map<string, Command<string, unknown, unknown, unknown>>()
|
|
247
|
+
const setKey = (key: string, command: Command<string, unknown, unknown, unknown>) => {
|
|
248
|
+
const existing = index.get(key)
|
|
249
|
+
if (existing && existing !== command) {
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Duplicate subcommand name/alias "${key}" in command definition (conflicts with "${existing.name}")`
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
index.set(key, command)
|
|
255
|
+
}
|
|
256
|
+
|
|
279
257
|
for (const group of subcommands) {
|
|
280
258
|
for (const subcommand of group.commands) {
|
|
281
|
-
|
|
259
|
+
setKey(subcommand.name, subcommand)
|
|
260
|
+
if (subcommand.alias && subcommand.alias !== subcommand.name) {
|
|
261
|
+
setKey(subcommand.alias, subcommand)
|
|
262
|
+
}
|
|
282
263
|
}
|
|
283
264
|
}
|
|
284
265
|
return index
|
|
@@ -288,8 +269,10 @@ const buildSubcommandIndex = (
|
|
|
288
269
|
/* Flag Accumulator */
|
|
289
270
|
/* ========================================================================== */
|
|
290
271
|
|
|
291
|
-
/** Creates an empty flag map with all known flag names initialized to [].
|
|
292
|
-
|
|
272
|
+
/** Creates an empty flag map with all known flag names initialized to [].
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
export const createEmptyFlagMap = (params: ReadonlyArray<FlagParam>): FlagMap =>
|
|
293
276
|
Object.fromEntries(params.map((p) => [p.name, []]))
|
|
294
277
|
|
|
295
278
|
/**
|
|
@@ -378,9 +361,10 @@ const consumeFlagValue = (
|
|
|
378
361
|
/**
|
|
379
362
|
* Consumes known flags from a token stream.
|
|
380
363
|
* Unrecognized tokens are passed through to remainder.
|
|
381
|
-
* Used for both
|
|
364
|
+
* Used for both global flag extraction and npm-style parent flag collection.
|
|
365
|
+
* @internal
|
|
382
366
|
*/
|
|
383
|
-
const consumeKnownFlags = (
|
|
367
|
+
export const consumeKnownFlags = (
|
|
384
368
|
tokens: ReadonlyArray<Token>,
|
|
385
369
|
registry: FlagRegistry
|
|
386
370
|
): { flagMap: FlagMap; remainder: ReadonlyArray<Token> } => {
|
|
@@ -409,19 +393,6 @@ const consumeKnownFlags = (
|
|
|
409
393
|
return { flagMap, remainder }
|
|
410
394
|
}
|
|
411
395
|
|
|
412
|
-
/* ========================================================================== */
|
|
413
|
-
/* Built-in Flags */
|
|
414
|
-
/* ========================================================================== */
|
|
415
|
-
|
|
416
|
-
const builtInFlagParams: ReadonlyArray<FlagParam> = [
|
|
417
|
-
...Param.extractSingleParams(logLevelFlag),
|
|
418
|
-
...Param.extractSingleParams(helpFlag),
|
|
419
|
-
...Param.extractSingleParams(versionFlag),
|
|
420
|
-
...Param.extractSingleParams(completionsFlag)
|
|
421
|
-
]
|
|
422
|
-
|
|
423
|
-
const builtInFlagRegistry = createFlagRegistry(builtInFlagParams)
|
|
424
|
-
|
|
425
396
|
/* ========================================================================== */
|
|
426
397
|
/* Error Creation */
|
|
427
398
|
/* ========================================================================== */
|
|
@@ -351,10 +351,9 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Any>(
|
|
|
351
351
|
ast: toEncodingAST(ast, encoding),
|
|
352
352
|
path: ["paths", path, method, "responses", String(status), "content", contentType, "schema"]
|
|
353
353
|
})
|
|
354
|
-
op.responses[status].content
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
354
|
+
op.responses[status].content ??= {}
|
|
355
|
+
op.responses[status].content[contentType] = {
|
|
356
|
+
schema: {}
|
|
358
357
|
}
|
|
359
358
|
})
|
|
360
359
|
})
|
|
@@ -417,7 +417,7 @@ export const make: {
|
|
|
417
417
|
options?: {
|
|
418
418
|
readonly initialValue?: A
|
|
419
419
|
}
|
|
420
|
-
): Atom<AsyncResult.AsyncResult<A, E>>
|
|
420
|
+
): Atom<AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>>
|
|
421
421
|
// -----------------------------------------------------------------------------
|
|
422
422
|
// constructors
|
|
423
423
|
// -----------------------------------------------------------------------------
|
|
@@ -431,7 +431,7 @@ export const make: {
|
|
|
431
431
|
options?: {
|
|
432
432
|
readonly initialValue?: A
|
|
433
433
|
}
|
|
434
|
-
): Atom<AsyncResult.AsyncResult<A, E>>
|
|
434
|
+
): Atom<AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>>
|
|
435
435
|
// -----------------------------------------------------------------------------
|
|
436
436
|
// constructors
|
|
437
437
|
// -----------------------------------------------------------------------------
|
|
@@ -477,11 +477,11 @@ const makeRead: {
|
|
|
477
477
|
<A, E>(stream: Stream.Stream<A, E, AtomRegistry>, options?: {
|
|
478
478
|
readonly initialValue?: A
|
|
479
479
|
readonly uninterruptible?: boolean | undefined
|
|
480
|
-
}): (get: Context, services?: ServiceMap.ServiceMap<any>) => AsyncResult.AsyncResult<A, E>
|
|
480
|
+
}): (get: Context, services?: ServiceMap.ServiceMap<any>) => AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>
|
|
481
481
|
<A, E>(create: (get: Context) => Stream.Stream<A, E, AtomRegistry>, options?: {
|
|
482
482
|
readonly initialValue?: A
|
|
483
483
|
readonly uninterruptible?: boolean | undefined
|
|
484
|
-
}): (get: Context, services?: ServiceMap.ServiceMap<any>) => AsyncResult.AsyncResult<A, E>
|
|
484
|
+
}): (get: Context, services?: ServiceMap.ServiceMap<any>) => AsyncResult.AsyncResult<A, E | Cause.NoSuchElementError>
|
|
485
485
|
<A>(create: (get: Context) => A): (get: Context, services?: ServiceMap.ServiceMap<any>) => A
|
|
486
486
|
<A>(initialValue: A): Writable<A>
|
|
487
487
|
} = <A, E>(
|
|
@@ -653,10 +653,10 @@ export interface AtomRuntime<R, ER = never> extends Atom<AsyncResult.AsyncResult
|
|
|
653
653
|
}): Atom<AsyncResult.AsyncResult<A, E | ER>>
|
|
654
654
|
<A, E>(create: (get: Context) => Stream.Stream<A, E, AtomRegistry | Reactivity.Reactivity | R>, options?: {
|
|
655
655
|
readonly initialValue?: A
|
|
656
|
-
}): Atom<AsyncResult.AsyncResult<A, E | ER>>
|
|
656
|
+
}): Atom<AsyncResult.AsyncResult<A, E | ER | Cause.NoSuchElementError>>
|
|
657
657
|
<A, E>(stream: Stream.Stream<A, E, AtomRegistry | Reactivity.Reactivity | R>, options?: {
|
|
658
658
|
readonly initialValue?: A
|
|
659
|
-
}): Atom<AsyncResult.AsyncResult<A, E | ER>>
|
|
659
|
+
}): Atom<AsyncResult.AsyncResult<A, E | ER | Cause.NoSuchElementError>>
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
readonly fn: {
|
package/src/unstable/rpc/Rpc.ts
CHANGED
|
@@ -521,7 +521,7 @@ export type ExtractProvides<R extends Any, Tag extends string> = R extends Rpc<
|
|
|
521
521
|
infer _Error,
|
|
522
522
|
infer _Middleware,
|
|
523
523
|
infer _Requires
|
|
524
|
-
> ? RpcMiddleware.Provides<_Middleware> :
|
|
524
|
+
> ? RpcMiddleware.Provides<_Middleware["Identifier"]> :
|
|
525
525
|
never
|
|
526
526
|
|
|
527
527
|
/**
|
|
@@ -301,12 +301,12 @@ export const make = <
|
|
|
301
301
|
config: A & { readonly [K in Exclude<keyof A, Variants[number]>]: never }
|
|
302
302
|
) => Field<A>
|
|
303
303
|
readonly FieldOnly: <const Keys extends ReadonlyArray<Variants[number]>>(
|
|
304
|
-
|
|
304
|
+
keys: Keys
|
|
305
305
|
) => <S extends Schema.Top>(
|
|
306
306
|
schema: S
|
|
307
307
|
) => Field<{ readonly [K in Keys[number]]: S }>
|
|
308
308
|
readonly FieldExcept: <const Keys extends ReadonlyArray<Variants[number]>>(
|
|
309
|
-
|
|
309
|
+
keys: Keys
|
|
310
310
|
) => <S extends Schema.Top>(
|
|
311
311
|
schema: S
|
|
312
312
|
) => Field<{ readonly [K in Exclude<Variants[number], Keys[number]>]: S }>
|
|
@@ -364,7 +364,7 @@ export const make = <
|
|
|
364
364
|
readonly [V in Variants[number]]: Extract<V, Struct<Fields>>
|
|
365
365
|
}
|
|
366
366
|
readonly Union: <const Members extends ReadonlyArray<Struct<any>>>(
|
|
367
|
-
|
|
367
|
+
members: Members
|
|
368
368
|
) => Union<Members> & Union.Variants<Members, Variants[number]>
|
|
369
369
|
readonly extract: {
|
|
370
370
|
<V extends Variants[number]>(
|
|
@@ -403,7 +403,7 @@ export const make = <
|
|
|
403
403
|
return Base
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
function FieldOnly<Keys extends Variants
|
|
406
|
+
function FieldOnly<const Keys extends ReadonlyArray<Variants[number]>>(keys: Keys) {
|
|
407
407
|
return function<S extends Schema.Top>(schema: S) {
|
|
408
408
|
const obj: Record<string, S> = {}
|
|
409
409
|
for (const key of keys) {
|
|
@@ -412,7 +412,7 @@ export const make = <
|
|
|
412
412
|
return Field(obj)
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
function FieldExcept<Keys extends Variants
|
|
415
|
+
function FieldExcept<const Keys extends ReadonlyArray<Variants[number]>>(keys: Keys) {
|
|
416
416
|
return function<S extends Schema.Top>(schema: S) {
|
|
417
417
|
const obj: Record<string, S> = {}
|
|
418
418
|
for (const variant of options.variants) {
|
|
@@ -423,7 +423,7 @@ export const make = <
|
|
|
423
423
|
return Field(obj)
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
function UnionVariants(
|
|
426
|
+
function UnionVariants(members: ReadonlyArray<Struct<any>>) {
|
|
427
427
|
return Union(members, options.variants)
|
|
428
428
|
}
|
|
429
429
|
const fieldEvolve = dual(
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
|
-
import * as
|
|
4
|
+
import * as Schema from "../../Schema.ts"
|
|
5
5
|
|
|
6
6
|
const TypeId = "~effect/sql/SqlError"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @since 4.0.0
|
|
10
10
|
*/
|
|
11
|
-
export class SqlError extends
|
|
12
|
-
cause:
|
|
13
|
-
message
|
|
14
|
-
}
|
|
11
|
+
export class SqlError extends Schema.TaggedErrorClass<SqlError>("effect/sql/SqlError")("SqlError", {
|
|
12
|
+
cause: Schema.Defect,
|
|
13
|
+
message: Schema.optional(Schema.String)
|
|
14
|
+
}) {
|
|
15
15
|
/**
|
|
16
16
|
* @since 4.0.0
|
|
17
17
|
*/
|
|
@@ -21,10 +21,12 @@ export class SqlError extends Data.TaggedError("SqlError")<{
|
|
|
21
21
|
/**
|
|
22
22
|
* @since 4.0.0
|
|
23
23
|
*/
|
|
24
|
-
export class ResultLengthMismatch
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
export class ResultLengthMismatch
|
|
25
|
+
extends Schema.TaggedErrorClass<ResultLengthMismatch>("effect/sql/ResultLengthMismatch")("ResultLengthMismatch", {
|
|
26
|
+
expected: Schema.Number,
|
|
27
|
+
actual: Schema.Number
|
|
28
|
+
})
|
|
29
|
+
{
|
|
28
30
|
/**
|
|
29
31
|
* @since 4.0.0
|
|
30
32
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtInFlags.d.ts","sourceRoot":"","sources":["../../../../src/unstable/cli/internal/builtInFlags.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in options that are automatically available for CLI commands.
|
|
3
|
-
* @since 4.0.0
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
import * as Option from "../../../Option.js";
|
|
7
|
-
import * as Flag from "../Flag.js";
|
|
8
|
-
/**
|
|
9
|
-
* Built-in --log-level option with all Effect LogLevel values.
|
|
10
|
-
* Maps CLI strings to proper LogLevel constants.
|
|
11
|
-
*
|
|
12
|
-
* @since 4.0.0
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export const logLevelFlag = /*#__PURE__*/Flag.choiceWithValue("log-level", [["all", "All"], ["trace", "Trace"], ["debug", "Debug"], ["info", "Info"], ["warn", "Warn"], ["warning", "Warn"],
|
|
16
|
-
// alias
|
|
17
|
-
["error", "Error"], ["fatal", "Fatal"], ["none", "None"]]).pipe(Flag.optional, /*#__PURE__*/Flag.withDescription("Sets the minimum log level for the command"));
|
|
18
|
-
/**
|
|
19
|
-
* Built-in --help/-h option.
|
|
20
|
-
*
|
|
21
|
-
* @since 4.0.0
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export const helpFlag = /*#__PURE__*/Flag.boolean("help").pipe(/*#__PURE__*/Flag.withAlias("h"), /*#__PURE__*/Flag.withDescription("Show help information"));
|
|
25
|
-
/**
|
|
26
|
-
* Built-in --version option.
|
|
27
|
-
*
|
|
28
|
-
* @since 4.0.0
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export const versionFlag = /*#__PURE__*/Flag.boolean("version").pipe(/*#__PURE__*/Flag.withDescription("Show version information"));
|
|
32
|
-
/**
|
|
33
|
-
* Built-in --completions option to print shell completion scripts.
|
|
34
|
-
* Generates a dynamic completion shim that calls the CLI at runtime.
|
|
35
|
-
* Accepts one of: bash | zsh | fish | sh (alias of bash).
|
|
36
|
-
*
|
|
37
|
-
* @since 4.0.0
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export const completionsFlag = /*#__PURE__*/Flag.choice("completions", ["bash", "zsh", "fish", "sh"]).pipe(Flag.optional,
|
|
41
|
-
/*#__PURE__*/
|
|
42
|
-
// Map "sh" to "bash" while preserving Option-ness
|
|
43
|
-
Flag.map(v => Option.map(v, s => s === "sh" ? "bash" : s)), /*#__PURE__*/Flag.withDescription("Print shell completion script for the given shell"));
|
|
44
|
-
//# sourceMappingURL=builtInFlags.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtInFlags.js","names":["Option","Flag","logLevelFlag","choiceWithValue","pipe","optional","withDescription","helpFlag","boolean","withAlias","versionFlag","completionsFlag","choice","map","v","s"],"sources":["../../../../src/unstable/cli/internal/builtInFlags.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAOA,OAAO,KAAKA,MAAM,MAAM,oBAAoB;AAC5C,OAAO,KAAKC,IAAI,MAAM,YAAY;AAElC;;;;;;;AAOA,OAAO,MAAMC,YAAY,gBAAuCD,IAAI,CACjEE,eAAe,CACd,WAAW,EACX,CACE,CAAC,KAAK,EAAE,KAAK,CAAC,EACd,CAAC,OAAO,EAAE,OAAO,CAAC,EAClB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClB,CAAC,MAAM,EAAE,MAAM,CAAC,EAChB,CAAC,MAAM,EAAE,MAAM,CAAC,EAChB,CAAC,SAAS,EAAE,MAAM,CAAC;AAAE;AACrB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClB,CAAC,MAAM,EAAE,MAAM,CAAC,CACR,CACX,CACAC,IAAI,CACHH,IAAI,CAACI,QAAQ,eACbJ,IAAI,CAACK,eAAe,CAAC,4CAA4C,CAAC,CACnE;AAEH;;;;;;AAMA,OAAO,MAAMC,QAAQ,gBAAuBN,IAAI,CAC7CO,OAAO,CAAC,MAAM,CAAC,CACfJ,IAAI,cACHH,IAAI,CAACQ,SAAS,CAAC,GAAG,CAAC,eACnBR,IAAI,CAACK,eAAe,CAAC,uBAAuB,CAAC,CAC9C;AAEH;;;;;;AAMA,OAAO,MAAMI,WAAW,gBAAuBT,IAAI,CAChDO,OAAO,CAAC,SAAS,CAAC,CAClBJ,IAAI,cACHH,IAAI,CAACK,eAAe,CAAC,0BAA0B,CAAC,CACjD;AAEH;;;;;;;;AAQA,OAAO,MAAMK,eAAe,gBAAsDV,IAAI,CACnFW,MAAM,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAU,CAAC,CAC7DR,IAAI,CACHH,IAAI,CAACI,QAAQ;AAAA;AACb;AACAJ,IAAI,CAACY,GAAG,CAAEC,CAAC,IAAKd,MAAM,CAACa,GAAG,CAACC,CAAC,EAAGC,CAAC,IAAMA,CAAC,KAAK,IAAI,GAAG,MAAM,GAAGA,CAAE,CAAC,CAAC,eAChEd,IAAI,CAACK,eAAe,CAAC,mDAAmD,CAAC,CAC1E","ignoreList":[]}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in options that are automatically available for CLI commands.
|
|
3
|
-
* @since 4.0.0
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { LogLevel } from "../../../LogLevel.ts"
|
|
8
|
-
import * as Option from "../../../Option.ts"
|
|
9
|
-
import * as Flag from "../Flag.ts"
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Built-in --log-level option with all Effect LogLevel values.
|
|
13
|
-
* Maps CLI strings to proper LogLevel constants.
|
|
14
|
-
*
|
|
15
|
-
* @since 4.0.0
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export const logLevelFlag: Flag.Flag<Option.Option<LogLevel>> = Flag
|
|
19
|
-
.choiceWithValue(
|
|
20
|
-
"log-level",
|
|
21
|
-
[
|
|
22
|
-
["all", "All"],
|
|
23
|
-
["trace", "Trace"],
|
|
24
|
-
["debug", "Debug"],
|
|
25
|
-
["info", "Info"],
|
|
26
|
-
["warn", "Warn"],
|
|
27
|
-
["warning", "Warn"], // alias
|
|
28
|
-
["error", "Error"],
|
|
29
|
-
["fatal", "Fatal"],
|
|
30
|
-
["none", "None"]
|
|
31
|
-
] as const
|
|
32
|
-
)
|
|
33
|
-
.pipe(
|
|
34
|
-
Flag.optional,
|
|
35
|
-
Flag.withDescription("Sets the minimum log level for the command")
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Built-in --help/-h option.
|
|
40
|
-
*
|
|
41
|
-
* @since 4.0.0
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
export const helpFlag: Flag.Flag<boolean> = Flag
|
|
45
|
-
.boolean("help")
|
|
46
|
-
.pipe(
|
|
47
|
-
Flag.withAlias("h"),
|
|
48
|
-
Flag.withDescription("Show help information")
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Built-in --version option.
|
|
53
|
-
*
|
|
54
|
-
* @since 4.0.0
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
export const versionFlag: Flag.Flag<boolean> = Flag
|
|
58
|
-
.boolean("version")
|
|
59
|
-
.pipe(
|
|
60
|
-
Flag.withDescription("Show version information")
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Built-in --completions option to print shell completion scripts.
|
|
65
|
-
* Generates a dynamic completion shim that calls the CLI at runtime.
|
|
66
|
-
* Accepts one of: bash | zsh | fish | sh (alias of bash).
|
|
67
|
-
*
|
|
68
|
-
* @since 4.0.0
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
export const completionsFlag: Flag.Flag<Option.Option<"bash" | "zsh" | "fish">> = Flag
|
|
72
|
-
.choice("completions", ["bash", "zsh", "fish", "sh"] as const)
|
|
73
|
-
.pipe(
|
|
74
|
-
Flag.optional,
|
|
75
|
-
// Map "sh" to "bash" while preserving Option-ness
|
|
76
|
-
Flag.map((v) => Option.map(v, (s) => (s === "sh" ? "bash" : s))),
|
|
77
|
-
Flag.withDescription("Print shell completion script for the given shell")
|
|
78
|
-
)
|