effect 4.0.0-beta.25 → 4.0.0-beta.27
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/Cause.d.ts +1 -1
- package/dist/Config.js +4 -4
- package/dist/Config.js.map +1 -1
- package/dist/Data.d.ts +2 -2
- package/dist/Data.js +2 -2
- package/dist/Effect.d.ts +51 -35
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +16 -12
- package/dist/Effect.js.map +1 -1
- package/dist/ErrorReporter.d.ts +2 -4
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +1 -3
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Layer.d.ts +112 -117
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -44
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +4 -4
- package/dist/LayerMap.js +3 -3
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Metric.d.ts +2 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +2 -4
- package/dist/Metric.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +72 -5
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +36 -36
- package/dist/Schedule.js +14 -14
- package/dist/Schema.d.ts +15 -32
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +9 -17
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.js +91 -2
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +3 -3
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +12 -8
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/Stdio.d.ts +10 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +18 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/schema/representation.js +7 -3
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +6 -3
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +8 -4
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +7 -5
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +23 -56
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +25 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +117 -62
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +95 -32
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/internal/command.d.ts +27 -10
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +40 -23
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +4 -4
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +25 -7
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +26 -6
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +16 -0
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +11 -0
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +6 -7
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +10 -10
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -2
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +6 -15
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +16 -21
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +56 -0
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +66 -0
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +2 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +3 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +21 -0
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +2 -2
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +1 -1
- package/src/Config.ts +4 -4
- package/src/Data.ts +2 -2
- package/src/Effect.ts +60 -31
- package/src/ErrorReporter.ts +2 -4
- package/src/Layer.ts +112 -117
- package/src/LayerMap.ts +4 -4
- package/src/ManagedRuntime.ts +1 -1
- package/src/Metric.ts +2 -4
- package/src/Runtime.ts +95 -5
- package/src/Schedule.ts +36 -36
- package/src/Schema.ts +20 -52
- package/src/SchemaAST.ts +127 -2
- package/src/SchemaGetter.ts +3 -3
- package/src/SchemaRepresentation.ts +12 -8
- package/src/Stdio.ts +21 -2
- package/src/index.ts +1 -1
- package/src/internal/schema/representation.ts +8 -4
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/unstable/ai/AiError.ts +8 -4
- package/src/unstable/ai/LanguageModel.ts +8 -5
- package/src/unstable/cli/CliError.ts +47 -59
- package/src/unstable/cli/Command.ts +348 -180
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/internal/command.ts +62 -32
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +41 -16
- package/src/unstable/cli/internal/parser.ts +36 -10
- package/src/unstable/http/Headers.ts +34 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +4 -7
- package/src/unstable/httpapi/HttpApiClient.ts +6 -6
- package/src/unstable/httpapi/HttpApiEndpoint.ts +4 -4
- package/src/unstable/httpapi/HttpApiError.ts +23 -21
- package/src/unstable/reactivity/Atom.ts +132 -0
- package/src/unstable/reactivity/AtomHttpApi.ts +2 -2
- package/src/unstable/rpc/RpcServer.ts +5 -0
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/sql/SqlSchema.ts +2 -2
package/src/LayerMap.ts
CHANGED
|
@@ -27,7 +27,7 @@ const TypeId = "~effect/LayerMap"
|
|
|
27
27
|
* // Create a LayerMap that provides different database configurations
|
|
28
28
|
* const createDatabaseLayerMap = LayerMap.make((env: string) =>
|
|
29
29
|
* Layer.succeed(DatabaseService)({
|
|
30
|
-
* query: (sql) => Effect.succeed(`${env}: ${sql}`)
|
|
30
|
+
* query: Effect.fn("DatabaseService.query")((sql) => Effect.succeed(`${env}: ${sql}`))
|
|
31
31
|
* })
|
|
32
32
|
* )
|
|
33
33
|
*
|
|
@@ -91,7 +91,7 @@ export interface LayerMap<in out K, in out I, in out E = never> {
|
|
|
91
91
|
* const layerMap = yield* LayerMap.make(
|
|
92
92
|
* (env: string) =>
|
|
93
93
|
* Layer.succeed(DatabaseService)({
|
|
94
|
-
* query: (sql) => Effect.succeed(`${env}: ${sql}`)
|
|
94
|
+
* query: Effect.fn("DatabaseService.query")((sql) => Effect.succeed(`${env}: ${sql}`))
|
|
95
95
|
* }),
|
|
96
96
|
* { idleTimeToLive: "5 seconds" }
|
|
97
97
|
* )
|
|
@@ -171,10 +171,10 @@ export const make: <
|
|
|
171
171
|
* // Create predefined layers
|
|
172
172
|
* const layers = {
|
|
173
173
|
* development: Layer.succeed(DevDatabase)({
|
|
174
|
-
* query: (sql) => Effect.succeed(`DEV: ${sql}`)
|
|
174
|
+
* query: Effect.fn("DevDatabase.query")((sql) => Effect.succeed(`DEV: ${sql}`))
|
|
175
175
|
* }),
|
|
176
176
|
* production: Layer.succeed(ProdDatabase)({
|
|
177
|
-
* query: (sql) => Effect.succeed(`PROD: ${sql}`)
|
|
177
|
+
* query: Effect.fn("ProdDatabase.query")((sql) => Effect.succeed(`PROD: ${sql}`))
|
|
178
178
|
* })
|
|
179
179
|
* } as const
|
|
180
180
|
*
|
package/src/ManagedRuntime.ts
CHANGED
|
@@ -141,7 +141,7 @@ export interface ManagedRuntime<in R, out ER> {
|
|
|
141
141
|
* readonly notify: (message: string) => Effect.Effect<void>
|
|
142
142
|
* }>()("Notifications") {
|
|
143
143
|
* static readonly layer = Layer.succeed(this)({
|
|
144
|
-
* notify: (message) => Console.log(message)
|
|
144
|
+
* notify: Effect.fn("Notifications.notify")((message) => Console.log(message))
|
|
145
145
|
* })
|
|
146
146
|
* }
|
|
147
147
|
*
|
package/src/Metric.ts
CHANGED
|
@@ -4801,7 +4801,7 @@ export const FiberRuntimeMetricsImpl: FiberRuntimeMetricsService = {
|
|
|
4801
4801
|
* Effect.gen(function*() {
|
|
4802
4802
|
* yield* Effect.sleep(`${50 + id * 10} millis`)
|
|
4803
4803
|
* if (id % 7 === 0) {
|
|
4804
|
-
* yield*
|
|
4804
|
+
* return yield* new AppError({ operation: `fetch-user-${id}` })
|
|
4805
4805
|
* }
|
|
4806
4806
|
* return { id, name: `User ${id}`, email: `user${id}@example.com` }
|
|
4807
4807
|
* })
|
|
@@ -4940,9 +4940,7 @@ export const disableRuntimeMetricsLayer = Layer.succeed(FiberRuntimeMetrics)(und
|
|
|
4940
4940
|
* yield* Effect.sleep(`${100 + i * 50} millis`)
|
|
4941
4941
|
* if (i % 4 === 0) {
|
|
4942
4942
|
* // Simulate some failures
|
|
4943
|
-
* yield*
|
|
4944
|
-
* new RuntimeMetricsError({ operation: `task-${i}` })
|
|
4945
|
-
* )
|
|
4943
|
+
* return yield* new RuntimeMetricsError({ operation: `task-${i}` })
|
|
4946
4944
|
* }
|
|
4947
4945
|
* return `Task ${i} completed`
|
|
4948
4946
|
* }).pipe(
|
package/src/Runtime.ts
CHANGED
|
@@ -117,7 +117,9 @@ export const defaultTeardown: Teardown = <E, A>(
|
|
|
117
117
|
exit: Exit.Exit<E, A>,
|
|
118
118
|
onExit: (code: number) => void
|
|
119
119
|
) => {
|
|
120
|
-
|
|
120
|
+
if (Exit.isSuccess(exit)) return onExit(0)
|
|
121
|
+
if (Cause.hasInterruptsOnly(exit.cause)) return onExit(130)
|
|
122
|
+
return onExit(getErrorExitCode(Cause.squash(exit.cause)))
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
/**
|
|
@@ -206,10 +208,9 @@ export const makeRunMain = (
|
|
|
206
208
|
? Effect.runFork(effect)
|
|
207
209
|
: Effect.runFork(
|
|
208
210
|
Effect.tapCause(effect, (cause) => {
|
|
209
|
-
if (Cause.hasInterruptsOnly(cause))
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return Effect.logError(cause)
|
|
211
|
+
if (Cause.hasInterruptsOnly(cause)) return Effect.void
|
|
212
|
+
const isReported = getErrorReported(Cause.squash(cause))
|
|
213
|
+
return isReported ? Effect.logError(cause) : Effect.void
|
|
213
214
|
})
|
|
214
215
|
)
|
|
215
216
|
try {
|
|
@@ -221,3 +222,92 @@ export const makeRunMain = (
|
|
|
221
222
|
const teardown = options?.teardown ?? defaultTeardown
|
|
222
223
|
return f({ fiber, teardown })
|
|
223
224
|
})
|
|
225
|
+
|
|
226
|
+
declare global {
|
|
227
|
+
interface Error {
|
|
228
|
+
readonly [errorExitCode]?: number
|
|
229
|
+
readonly [errorReported]?: boolean
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @category Exit code management
|
|
235
|
+
* @since 4.0.0
|
|
236
|
+
*/
|
|
237
|
+
export type errorExitCode = "~effect/Runtime/errorExitCode"
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Allows associating an exit code with an error for determining the process
|
|
241
|
+
* exit code on failure.
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* import { Data, Effect, Runtime } from "effect"
|
|
245
|
+
* import { NodeRuntime } from "@effect/platform-node"
|
|
246
|
+
*
|
|
247
|
+
* class MyError extends Data.TaggedError("MyError") {
|
|
248
|
+
* readonly [Runtime.errorExitCode] = 42
|
|
249
|
+
* }
|
|
250
|
+
*
|
|
251
|
+
* // If the program fails with MyError, the process will exit with code 42
|
|
252
|
+
* NodeRuntime.runMain(Effect.fail(new MyError()))
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @category Exit code management
|
|
256
|
+
* @since 4.0.0
|
|
257
|
+
*/
|
|
258
|
+
export const errorExitCode: errorExitCode = "~effect/Runtime/errorExitCode"
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @category Exit code management
|
|
262
|
+
* @since 4.0.0
|
|
263
|
+
*/
|
|
264
|
+
export const getErrorExitCode = (u: unknown): number => {
|
|
265
|
+
if (typeof u === "object" && u !== null && errorExitCode in u) {
|
|
266
|
+
const code = u[errorExitCode]
|
|
267
|
+
if (typeof code === "number") {
|
|
268
|
+
return code
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return 1
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @category Error reporting management
|
|
276
|
+
* @since 4.0.0
|
|
277
|
+
*/
|
|
278
|
+
export type errorReported = "~effect/Runtime/errorReported"
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Allows an error to opt-out of error reporting.
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* import { Data, Effect, Runtime } from "effect"
|
|
285
|
+
* import { NodeRuntime } from "@effect/platform-node"
|
|
286
|
+
*
|
|
287
|
+
* class MyError extends Data.TaggedError("MyError") {
|
|
288
|
+
* readonly [Runtime.errorReported] = true
|
|
289
|
+
* }
|
|
290
|
+
*
|
|
291
|
+
* // If the program fails with MyError, the process will exit with code 1 but
|
|
292
|
+
* // no error will be logged.
|
|
293
|
+
* NodeRuntime.runMain(Effect.fail(new MyError()))
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @category Error reporting management
|
|
297
|
+
* @since 4.0.0
|
|
298
|
+
*/
|
|
299
|
+
export const errorReported: errorReported = "~effect/Runtime/errorReported"
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @category Error reporting management
|
|
303
|
+
* @since 4.0.0
|
|
304
|
+
*/
|
|
305
|
+
export const getErrorReported = (u: unknown): boolean => {
|
|
306
|
+
if (typeof u === "object" && u !== null && errorReported in u) {
|
|
307
|
+
const isReported = u[errorReported]
|
|
308
|
+
if (typeof isReported === "boolean") {
|
|
309
|
+
return isReported
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return true
|
|
313
|
+
}
|
package/src/Schedule.ts
CHANGED
|
@@ -72,7 +72,7 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
|
|
|
72
72
|
* const program = Effect.gen(function*() {
|
|
73
73
|
* // Using retry schedule
|
|
74
74
|
* const result1 = yield* Effect.retry(
|
|
75
|
-
* Effect.fail("temporary error"),
|
|
75
|
+
* Effect.suspend(() => Math.random() > 0.5 ? Effect.fail("temporary error") : Effect.succeed("Success")),
|
|
76
76
|
* retrySchedule
|
|
77
77
|
* )
|
|
78
78
|
*
|
|
@@ -200,7 +200,7 @@ export const CurrentMetadata = ServiceMap.Reference<Metadata>("effect/Schedule/C
|
|
|
200
200
|
* Effect.gen(function*() {
|
|
201
201
|
* attempt++
|
|
202
202
|
* if (attempt < 3) {
|
|
203
|
-
* yield* Effect.fail(`Attempt ${attempt} failed`)
|
|
203
|
+
* return yield* Effect.fail(`Attempt ${attempt} failed`)
|
|
204
204
|
* }
|
|
205
205
|
* return `Success on attempt ${attempt}`
|
|
206
206
|
* }),
|
|
@@ -619,7 +619,7 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
|
619
619
|
* Effect.gen(function*() {
|
|
620
620
|
* attempt++
|
|
621
621
|
* if (attempt < 5) {
|
|
622
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
622
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
623
623
|
* }
|
|
624
624
|
* return `Success on attempt ${attempt}`
|
|
625
625
|
* }),
|
|
@@ -736,7 +736,7 @@ export const addDelay: {
|
|
|
736
736
|
* Effect.gen(function*() {
|
|
737
737
|
* attempt++
|
|
738
738
|
* if (attempt < 5) {
|
|
739
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
739
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
740
740
|
* }
|
|
741
741
|
* return `Success on attempt ${attempt}`
|
|
742
742
|
* }),
|
|
@@ -855,7 +855,7 @@ export const addDelay: {
|
|
|
855
855
|
* Effect.gen(function*() {
|
|
856
856
|
* attempt++
|
|
857
857
|
* if (attempt < 5) {
|
|
858
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
858
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
859
859
|
* }
|
|
860
860
|
* return `Success on attempt ${attempt}`
|
|
861
861
|
* }),
|
|
@@ -909,7 +909,7 @@ export const addDelay: {
|
|
|
909
909
|
* attempt++
|
|
910
910
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
911
911
|
* if (attempt < 6) {
|
|
912
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
912
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
913
913
|
* }
|
|
914
914
|
* return `Success on attempt ${attempt}`
|
|
915
915
|
* }),
|
|
@@ -948,7 +948,7 @@ export const andThen: {
|
|
|
948
948
|
* attempt++
|
|
949
949
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
950
950
|
* if (attempt < 6) {
|
|
951
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
951
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
952
952
|
* }
|
|
953
953
|
* return `Success on attempt ${attempt}`
|
|
954
954
|
* }),
|
|
@@ -989,7 +989,7 @@ export const andThen: {
|
|
|
989
989
|
* attempt++
|
|
990
990
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
991
991
|
* if (attempt < 6) {
|
|
992
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
992
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
993
993
|
* }
|
|
994
994
|
* return `Success on attempt ${attempt}`
|
|
995
995
|
* }),
|
|
@@ -1397,7 +1397,7 @@ export const andThenResult: {
|
|
|
1397
1397
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1398
1398
|
*
|
|
1399
1399
|
* if (attempt < 3) {
|
|
1400
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1400
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1401
1401
|
* }
|
|
1402
1402
|
*
|
|
1403
1403
|
* return `Success on attempt ${attempt}`
|
|
@@ -1465,7 +1465,7 @@ export const both: {
|
|
|
1465
1465
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1466
1466
|
*
|
|
1467
1467
|
* if (attempt < 3) {
|
|
1468
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1468
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1469
1469
|
* }
|
|
1470
1470
|
*
|
|
1471
1471
|
* return `Success on attempt ${attempt}`
|
|
@@ -1535,7 +1535,7 @@ export const both: {
|
|
|
1535
1535
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1536
1536
|
*
|
|
1537
1537
|
* if (attempt < 3) {
|
|
1538
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1538
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1539
1539
|
* }
|
|
1540
1540
|
*
|
|
1541
1541
|
* return `Success on attempt ${attempt}`
|
|
@@ -1966,7 +1966,7 @@ export const bothWith: {
|
|
|
1966
1966
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1967
1967
|
*
|
|
1968
1968
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
1969
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1969
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1970
1970
|
* }
|
|
1971
1971
|
*
|
|
1972
1972
|
* return `Success on attempt ${attempt}`
|
|
@@ -2029,7 +2029,7 @@ export const compose: {
|
|
|
2029
2029
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
2030
2030
|
*
|
|
2031
2031
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
2032
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2032
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2033
2033
|
* }
|
|
2034
2034
|
*
|
|
2035
2035
|
* return `Success on attempt ${attempt}`
|
|
@@ -2094,7 +2094,7 @@ export const compose: {
|
|
|
2094
2094
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
2095
2095
|
*
|
|
2096
2096
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
2097
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2097
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2098
2098
|
* }
|
|
2099
2099
|
*
|
|
2100
2100
|
* return `Success on attempt ${attempt}`
|
|
@@ -2642,7 +2642,7 @@ export const collectWhile: {
|
|
|
2642
2642
|
* yield* Console.log("Complex scheduled task...")
|
|
2643
2643
|
* // Simulate occasional failures
|
|
2644
2644
|
* if (Math.random() < 0.3) {
|
|
2645
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2645
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2646
2646
|
* }
|
|
2647
2647
|
* return "success"
|
|
2648
2648
|
* }),
|
|
@@ -2766,7 +2766,7 @@ export const cron: {
|
|
|
2766
2766
|
* yield* Console.log("Complex scheduled task...")
|
|
2767
2767
|
* // Simulate occasional failures
|
|
2768
2768
|
* if (Math.random() < 0.3) {
|
|
2769
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2769
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2770
2770
|
* }
|
|
2771
2771
|
* return "success"
|
|
2772
2772
|
* }),
|
|
@@ -2890,7 +2890,7 @@ export const cron: {
|
|
|
2890
2890
|
* yield* Console.log("Complex scheduled task...")
|
|
2891
2891
|
* // Simulate occasional failures
|
|
2892
2892
|
* if (Math.random() < 0.3) {
|
|
2893
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2893
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2894
2894
|
* }
|
|
2895
2895
|
* return "success"
|
|
2896
2896
|
* }),
|
|
@@ -3098,7 +3098,7 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
3098
3098
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
3099
3099
|
*
|
|
3100
3100
|
* if (Math.random() < 0.8) { // 80% failure rate
|
|
3101
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3101
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3102
3102
|
* }
|
|
3103
3103
|
*
|
|
3104
3104
|
* return `Success on attempt ${attempt}`
|
|
@@ -3172,7 +3172,7 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
|
|
|
3172
3172
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
3173
3173
|
*
|
|
3174
3174
|
* if (attempt < 6) {
|
|
3175
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3175
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3176
3176
|
* }
|
|
3177
3177
|
*
|
|
3178
3178
|
* return `Success on attempt ${attempt}`
|
|
@@ -3242,7 +3242,7 @@ export const either: {
|
|
|
3242
3242
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
3243
3243
|
*
|
|
3244
3244
|
* if (attempt < 6) {
|
|
3245
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3245
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3246
3246
|
* }
|
|
3247
3247
|
*
|
|
3248
3248
|
* return `Success on attempt ${attempt}`
|
|
@@ -3314,7 +3314,7 @@ export const either: {
|
|
|
3314
3314
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
3315
3315
|
*
|
|
3316
3316
|
* if (attempt < 6) {
|
|
3317
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3317
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3318
3318
|
* }
|
|
3319
3319
|
*
|
|
3320
3320
|
* return `Success on attempt ${attempt}`
|
|
@@ -3841,7 +3841,7 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
|
|
|
3841
3841
|
* attempt++
|
|
3842
3842
|
* if (attempt < 4) {
|
|
3843
3843
|
* yield* Console.log(`Attempt ${attempt} failed, retrying...`)
|
|
3844
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
3844
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
3845
3845
|
* }
|
|
3846
3846
|
* return `Success on attempt ${attempt}`
|
|
3847
3847
|
* }),
|
|
@@ -3891,7 +3891,7 @@ export const exponential = (
|
|
|
3891
3891
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
3892
3892
|
*
|
|
3893
3893
|
* if (attempt < 5) {
|
|
3894
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3894
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3895
3895
|
* }
|
|
3896
3896
|
*
|
|
3897
3897
|
* return `Success on attempt ${attempt}`
|
|
@@ -4436,7 +4436,7 @@ export const passthrough = <Output, Input, Error, Env>(
|
|
|
4436
4436
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
4437
4437
|
*
|
|
4438
4438
|
* if (attempt < 4) {
|
|
4439
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4439
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4440
4440
|
* }
|
|
4441
4441
|
*
|
|
4442
4442
|
* return `Success on attempt ${attempt}`
|
|
@@ -4923,7 +4923,7 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4923
4923
|
* Effect.gen(function*() {
|
|
4924
4924
|
* attempt++
|
|
4925
4925
|
* if (attempt < 4) {
|
|
4926
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4926
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4927
4927
|
* }
|
|
4928
4928
|
* return `Success on attempt ${attempt}`
|
|
4929
4929
|
* }),
|
|
@@ -4994,7 +4994,7 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4994
4994
|
* const errorType = isCritical
|
|
4995
4995
|
* ? "critical database failure"
|
|
4996
4996
|
* : "temporary network issue"
|
|
4997
|
-
* yield* Effect.fail(new Error(errorType))
|
|
4997
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
4998
4998
|
* }),
|
|
4999
4999
|
* alertingSchedule
|
|
5000
5000
|
* ).pipe(
|
|
@@ -5046,7 +5046,7 @@ export const tapInput: {
|
|
|
5046
5046
|
* Effect.gen(function*() {
|
|
5047
5047
|
* attempt++
|
|
5048
5048
|
* if (attempt < 4) {
|
|
5049
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
5049
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
5050
5050
|
* }
|
|
5051
5051
|
* return `Success on attempt ${attempt}`
|
|
5052
5052
|
* }),
|
|
@@ -5117,7 +5117,7 @@ export const tapInput: {
|
|
|
5117
5117
|
* const errorType = isCritical
|
|
5118
5118
|
* ? "critical database failure"
|
|
5119
5119
|
* : "temporary network issue"
|
|
5120
|
-
* yield* Effect.fail(new Error(errorType))
|
|
5120
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
5121
5121
|
* }),
|
|
5122
5122
|
* alertingSchedule
|
|
5123
5123
|
* ).pipe(
|
|
@@ -5171,7 +5171,7 @@ export const tapInput: {
|
|
|
5171
5171
|
* Effect.gen(function*() {
|
|
5172
5172
|
* attempt++
|
|
5173
5173
|
* if (attempt < 4) {
|
|
5174
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
5174
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
5175
5175
|
* }
|
|
5176
5176
|
* return `Success on attempt ${attempt}`
|
|
5177
5177
|
* }),
|
|
@@ -5242,7 +5242,7 @@ export const tapInput: {
|
|
|
5242
5242
|
* const errorType = isCritical
|
|
5243
5243
|
* ? "critical database failure"
|
|
5244
5244
|
* : "temporary network issue"
|
|
5245
|
-
* yield* Effect.fail(new Error(errorType))
|
|
5245
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
5246
5246
|
* }),
|
|
5247
5247
|
* alertingSchedule
|
|
5248
5248
|
* ).pipe(
|
|
@@ -5304,7 +5304,7 @@ export const tapInput: {
|
|
|
5304
5304
|
* Effect.gen(function*() {
|
|
5305
5305
|
* attempt++
|
|
5306
5306
|
* if (attempt < 4) {
|
|
5307
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5307
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5308
5308
|
* }
|
|
5309
5309
|
* return `Success on attempt ${attempt}`
|
|
5310
5310
|
* }),
|
|
@@ -5388,7 +5388,7 @@ export const tapOutput: {
|
|
|
5388
5388
|
* Effect.gen(function*() {
|
|
5389
5389
|
* attempt++
|
|
5390
5390
|
* if (attempt < 4) {
|
|
5391
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5391
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5392
5392
|
* }
|
|
5393
5393
|
* return `Success on attempt ${attempt}`
|
|
5394
5394
|
* }),
|
|
@@ -5474,7 +5474,7 @@ export const tapOutput: {
|
|
|
5474
5474
|
* Effect.gen(function*() {
|
|
5475
5475
|
* attempt++
|
|
5476
5476
|
* if (attempt < 4) {
|
|
5477
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5477
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5478
5478
|
* }
|
|
5479
5479
|
* return `Success on attempt ${attempt}`
|
|
5480
5480
|
* }),
|
|
@@ -5588,7 +5588,7 @@ export const tapOutput: {
|
|
|
5588
5588
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
5589
5589
|
*
|
|
5590
5590
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
5591
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5591
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5592
5592
|
* }
|
|
5593
5593
|
*
|
|
5594
5594
|
* return `Success on attempt ${attempt}`
|
|
@@ -5667,7 +5667,7 @@ export const take: {
|
|
|
5667
5667
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
5668
5668
|
*
|
|
5669
5669
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
5670
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5670
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5671
5671
|
* }
|
|
5672
5672
|
*
|
|
5673
5673
|
* return `Success on attempt ${attempt}`
|
|
@@ -5748,7 +5748,7 @@ export const take: {
|
|
|
5748
5748
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
5749
5749
|
*
|
|
5750
5750
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
5751
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5751
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
5752
5752
|
* }
|
|
5753
5753
|
*
|
|
5754
5754
|
* return `Success on attempt ${attempt}`
|
package/src/Schema.ts
CHANGED
|
@@ -8667,11 +8667,11 @@ export function toJsonSchemaDocument(schema: Top, options?: ToJsonSchemaOptions)
|
|
|
8667
8667
|
}
|
|
8668
8668
|
|
|
8669
8669
|
// -----------------------------------------------------------------------------
|
|
8670
|
-
//
|
|
8670
|
+
// Canonical Codecs
|
|
8671
8671
|
// -----------------------------------------------------------------------------
|
|
8672
8672
|
|
|
8673
8673
|
/**
|
|
8674
|
-
* @category
|
|
8674
|
+
* @category Canonical Codecs
|
|
8675
8675
|
* @since 4.0.0
|
|
8676
8676
|
*/
|
|
8677
8677
|
export function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, unknown, RD, RE> {
|
|
@@ -8679,7 +8679,7 @@ export function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T,
|
|
|
8679
8679
|
}
|
|
8680
8680
|
|
|
8681
8681
|
/**
|
|
8682
|
-
* @category
|
|
8682
|
+
* @category Canonical Codecs
|
|
8683
8683
|
* @since 4.0.0
|
|
8684
8684
|
*/
|
|
8685
8685
|
export function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]> {
|
|
@@ -8687,13 +8687,13 @@ export function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]>
|
|
|
8687
8687
|
}
|
|
8688
8688
|
|
|
8689
8689
|
/**
|
|
8690
|
-
* @category
|
|
8690
|
+
* @category Canonical Codecs
|
|
8691
8691
|
* @since 4.0.0
|
|
8692
8692
|
*/
|
|
8693
8693
|
export type StringTree = Tree<string | undefined>
|
|
8694
8694
|
|
|
8695
8695
|
/**
|
|
8696
|
-
* The StringTree
|
|
8696
|
+
* The StringTree canonical codec converts **every leaf value to a string**, while
|
|
8697
8697
|
* preserving the original structure.
|
|
8698
8698
|
*
|
|
8699
8699
|
* Declarations are converted to `undefined` (unless they have a
|
|
@@ -8707,7 +8707,7 @@ export type StringTree = Tree<string | undefined>
|
|
|
8707
8707
|
*
|
|
8708
8708
|
* Defaults to `false`.
|
|
8709
8709
|
*
|
|
8710
|
-
* @category
|
|
8710
|
+
* @category Canonical Codecs
|
|
8711
8711
|
* @since 4.0.0
|
|
8712
8712
|
*/
|
|
8713
8713
|
export function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, StringTree, RD, RE>
|
|
@@ -8740,7 +8740,7 @@ type XmlEncoderOptions = {
|
|
|
8740
8740
|
}
|
|
8741
8741
|
|
|
8742
8742
|
/**
|
|
8743
|
-
* @category
|
|
8743
|
+
* @category Canonical Codecs
|
|
8744
8744
|
* @since 4.0.0
|
|
8745
8745
|
*/
|
|
8746
8746
|
export function toEncoderXml<T, E, RD, RE>(
|
|
@@ -8860,8 +8860,6 @@ function serializerTree(
|
|
|
8860
8860
|
onMissingAnnotation: (ast: AST.AST) => AST.AST
|
|
8861
8861
|
): AST.AST {
|
|
8862
8862
|
switch (ast._tag) {
|
|
8863
|
-
case "Unknown":
|
|
8864
|
-
case "ObjectKeyword":
|
|
8865
8863
|
case "Declaration": {
|
|
8866
8864
|
const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec
|
|
8867
8865
|
if (Predicate.isFunction(getLink)) {
|
|
@@ -8878,6 +8876,9 @@ function serializerTree(
|
|
|
8878
8876
|
return AST.replaceEncoding(ast, [nullToString])
|
|
8879
8877
|
case "Boolean":
|
|
8880
8878
|
return AST.replaceEncoding(ast, [booleanToString])
|
|
8879
|
+
case "Unknown":
|
|
8880
|
+
case "ObjectKeyword":
|
|
8881
|
+
return AST.replaceEncoding(ast, [AST.unknownToStringTree])
|
|
8881
8882
|
case "Enum":
|
|
8882
8883
|
case "Number":
|
|
8883
8884
|
case "Literal":
|
|
@@ -9104,13 +9105,13 @@ export function toDifferJsonPatch<T, E>(schema: Codec<T, E>): Differ<T, JsonPatc
|
|
|
9104
9105
|
* @category Tree
|
|
9105
9106
|
* @since 4.0.0
|
|
9106
9107
|
*/
|
|
9107
|
-
export type Tree<Node> = Node |
|
|
9108
|
+
export type Tree<Node> = Node | TreeRecord<Node> | ReadonlyArray<Tree<Node>>
|
|
9108
9109
|
|
|
9109
9110
|
/**
|
|
9110
9111
|
* @category Tree
|
|
9111
9112
|
* @since 4.0.0
|
|
9112
9113
|
*/
|
|
9113
|
-
export interface
|
|
9114
|
+
export interface TreeRecord<A> {
|
|
9114
9115
|
readonly [x: string]: Tree<A>
|
|
9115
9116
|
}
|
|
9116
9117
|
|
|
@@ -9133,51 +9134,12 @@ export function Tree<S extends Top>(node: S) {
|
|
|
9133
9134
|
return Tree
|
|
9134
9135
|
}
|
|
9135
9136
|
|
|
9136
|
-
/**
|
|
9137
|
-
* @category Tree
|
|
9138
|
-
* @since 4.0.0
|
|
9139
|
-
*/
|
|
9140
|
-
export type MutableTree<A> = A | MutableTreeRecord<A> | Array<MutableTree<A>>
|
|
9141
|
-
|
|
9142
|
-
/**
|
|
9143
|
-
* @category Tree
|
|
9144
|
-
* @since 4.0.0
|
|
9145
|
-
*/
|
|
9146
|
-
export interface MutableTreeRecord<A> {
|
|
9147
|
-
[x: string]: MutableTree<A>
|
|
9148
|
-
}
|
|
9149
|
-
|
|
9150
|
-
/**
|
|
9151
|
-
* @category Tree
|
|
9152
|
-
* @since 4.0.0
|
|
9153
|
-
*/
|
|
9154
|
-
export function MutableTree<S extends Top>(node: S) {
|
|
9155
|
-
const MutableTree$ref = suspend((): Codec<
|
|
9156
|
-
MutableTree<S["Type"]>,
|
|
9157
|
-
MutableTree<S["Encoded"]>,
|
|
9158
|
-
S["DecodingServices"],
|
|
9159
|
-
S["EncodingServices"]
|
|
9160
|
-
> => MutableTree)
|
|
9161
|
-
const MutableTree = Union([
|
|
9162
|
-
node,
|
|
9163
|
-
mutable(Array(MutableTree$ref)),
|
|
9164
|
-
Record(String, mutableKey(MutableTree$ref))
|
|
9165
|
-
])
|
|
9166
|
-
return MutableTree
|
|
9167
|
-
}
|
|
9168
|
-
|
|
9169
9137
|
/**
|
|
9170
9138
|
* @category JSON
|
|
9171
9139
|
* @since 4.0.0
|
|
9172
9140
|
*/
|
|
9173
9141
|
export type Json = null | number | boolean | string | JsonArray | JsonObject
|
|
9174
9142
|
|
|
9175
|
-
/**
|
|
9176
|
-
* @category JSON
|
|
9177
|
-
* @since 4.0.0
|
|
9178
|
-
*/
|
|
9179
|
-
export const Json: Codec<Json> = Tree(Union([Null, Number, Boolean, String]))
|
|
9180
|
-
|
|
9181
9143
|
/**
|
|
9182
9144
|
* @category JSON
|
|
9183
9145
|
* @since 4.0.0
|
|
@@ -9196,13 +9158,13 @@ export interface JsonObject {
|
|
|
9196
9158
|
* @category JSON
|
|
9197
9159
|
* @since 4.0.0
|
|
9198
9160
|
*/
|
|
9199
|
-
export
|
|
9161
|
+
export const Json: Codec<Json> = make(AST.Json)
|
|
9200
9162
|
|
|
9201
9163
|
/**
|
|
9202
9164
|
* @category JSON
|
|
9203
9165
|
* @since 4.0.0
|
|
9204
9166
|
*/
|
|
9205
|
-
export
|
|
9167
|
+
export type MutableJson = null | number | boolean | string | MutableJsonArray | MutableJsonObject
|
|
9206
9168
|
|
|
9207
9169
|
/**
|
|
9208
9170
|
* @category JSON
|
|
@@ -9218,6 +9180,12 @@ export interface MutableJsonObject {
|
|
|
9218
9180
|
[x: string]: MutableJson
|
|
9219
9181
|
}
|
|
9220
9182
|
|
|
9183
|
+
/**
|
|
9184
|
+
* @category JSON
|
|
9185
|
+
* @since 4.0.0
|
|
9186
|
+
*/
|
|
9187
|
+
export const MutableJson: Codec<MutableJson> = make(AST.MutableJson)
|
|
9188
|
+
|
|
9221
9189
|
// -----------------------------------------------------------------------------
|
|
9222
9190
|
// Annotations
|
|
9223
9191
|
// -----------------------------------------------------------------------------
|