effect 4.0.0-beta.105 → 4.0.0-beta.107
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 +26 -0
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +47 -0
- package/dist/Channel.js.map +1 -1
- package/dist/Config.js +3 -3
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +35 -3
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +41 -8
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +13 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Fiber.d.ts +1 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Function.d.ts +26 -0
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +36 -0
- package/dist/Function.js.map +1 -1
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +34 -17
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Schema.d.ts +32 -84
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +58 -54
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -17
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +39 -28
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +44 -7
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +15 -4
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +1 -1
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Stream.d.ts +10 -0
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +12 -23
- package/dist/Stream.js.map +1 -1
- package/dist/TxQueue.js +1 -1
- package/dist/TxQueue.js.map +1 -1
- package/dist/internal/effect.js +2 -4
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/executionPlan.js +3 -2
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/rcRef.js +18 -13
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +32 -16
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toArbitrary.d.ts +1 -4
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -1
- package/dist/internal/schema/toArbitrary.js +0 -74
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +18 -4
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +45 -43
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/testing/TestSchema.js +2 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +128 -128
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +23 -11
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +4 -3
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +38 -13
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +6 -3
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +2 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +20 -1
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +26 -2
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +23 -0
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +23 -4
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +2 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +3 -3
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +14 -5
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +6 -5
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +14 -12
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +3 -3
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +2 -3
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +4 -4
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +3 -2
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +7 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +2 -0
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +4 -12
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/headers.js +16 -2
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.js +23 -8
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +1 -1
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +8 -0
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +5 -0
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +9 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +15 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +20 -16
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +11 -12
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/package.json +1 -1
- package/src/Channel.ts +58 -0
- package/src/Config.ts +3 -3
- package/src/ConfigProvider.ts +43 -8
- package/src/Duration.ts +12 -1
- package/src/Fiber.ts +1 -1
- package/src/Function.ts +37 -0
- package/src/JsonSchema.ts +43 -42
- package/src/Schema.ts +68 -146
- package/src/SchemaAST.ts +50 -30
- package/src/SchemaRepresentation.ts +44 -7
- package/src/ScopedRef.ts +3 -1
- package/src/Stream.ts +12 -30
- package/src/TxQueue.ts +1 -1
- package/src/internal/effect.ts +3 -6
- package/src/internal/executionPlan.ts +3 -2
- package/src/internal/rcRef.ts +24 -16
- package/src/internal/schema/fromJsonSchemaDocument.ts +36 -18
- package/src/internal/schema/toArbitrary.ts +0 -72
- package/src/internal/schema/toJsonSchemaDocument.ts +24 -4
- package/src/internal/schema/toRepresentation.ts +66 -48
- package/src/testing/TestSchema.ts +2 -2
- package/src/unstable/ai/McpServer.ts +23 -11
- package/src/unstable/ai/Prompt.ts +37 -15
- package/src/unstable/cli/Argument.ts +6 -3
- package/src/unstable/cli/CliError.ts +28 -2
- package/src/unstable/cli/Command.ts +44 -4
- package/src/unstable/cluster/Entity.ts +7 -2
- package/src/unstable/cluster/EntityProxy.ts +12 -5
- package/src/unstable/cluster/Sharding.ts +29 -17
- package/src/unstable/eventlog/EventLogEncryption.ts +15 -16
- package/src/unstable/eventlog/EventLogMessage.ts +2 -3
- package/src/unstable/eventlog/EventLogRemote.ts +4 -4
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +8 -3
- package/src/unstable/http/Multipart.ts +4 -13
- package/src/unstable/http/MultipartParser/internal/headers.ts +16 -387
- package/src/unstable/http/MultipartParser/internal/multipart.ts +25 -8
- package/src/unstable/httpapi/OpenApi.ts +4 -1
- package/src/unstable/process/ChildProcess.ts +8 -0
- package/src/unstable/rpc/RpcClient.ts +5 -0
- package/src/unstable/sql/Migrator.ts +22 -9
- package/src/unstable/sql/SqlResolver.ts +28 -20
- package/src/unstable/workers/Worker.ts +13 -14
|
@@ -261,8 +261,8 @@ export class WriteChunkedRpc extends Rpc.make("EventLog.WriteChunked", {
|
|
|
261
261
|
*
|
|
262
262
|
* **Details**
|
|
263
263
|
*
|
|
264
|
-
* It includes the client public key, target store id,
|
|
265
|
-
*
|
|
264
|
+
* It includes the client public key, target store id, and encrypted entries
|
|
265
|
+
* with their AES-GCM initialization vectors.
|
|
266
266
|
*
|
|
267
267
|
* @category protocols
|
|
268
268
|
* @since 4.0.0
|
|
@@ -270,7 +270,6 @@ export class WriteChunkedRpc extends Rpc.make("EventLog.WriteChunked", {
|
|
|
270
270
|
export class WriteEntries extends Schema.Class<WriteEntries>("effect/eventlog/EventLogRemote/WriteEntries")({
|
|
271
271
|
publicKey: Schema.String,
|
|
272
272
|
storeId: StoreId,
|
|
273
|
-
iv: Transferable.Uint8Array,
|
|
274
273
|
encryptedEntries: Schema.Array(EncryptedEntry)
|
|
275
274
|
}) {
|
|
276
275
|
static FromMsgpack = Msgpack.schema(WriteEntries)
|
|
@@ -307,14 +307,14 @@ export const makeEncrypted = Effect.gen(function*(): Effect.fn.Return<
|
|
|
307
307
|
return yield* makeWith({
|
|
308
308
|
encodeWrite: (options) =>
|
|
309
309
|
encryption.encrypt(options.identity, options.entries).pipe(
|
|
310
|
-
Effect.flatMap((
|
|
310
|
+
Effect.flatMap((encryptedEntries) =>
|
|
311
311
|
new WriteEntries({
|
|
312
312
|
publicKey: options.identity.publicKey,
|
|
313
313
|
storeId: options.storeId,
|
|
314
|
-
|
|
315
|
-
encryptedEntries: msg.encryptedEntries.map((entry, i) => ({
|
|
314
|
+
encryptedEntries: encryptedEntries.map((entry, i) => ({
|
|
316
315
|
entryId: options.entries[i].id,
|
|
317
|
-
|
|
316
|
+
iv: entry.iv,
|
|
317
|
+
encryptedEntry: entry.encryptedEntry
|
|
318
318
|
}))
|
|
319
319
|
}).encoded
|
|
320
320
|
)
|
|
@@ -67,10 +67,10 @@ export const layerRpcHandlers = Layer.unwrap(Effect.gen(function*() {
|
|
|
67
67
|
})
|
|
68
68
|
}
|
|
69
69
|
if (request.encryptedEntries.length === 0) return
|
|
70
|
-
const entries = request.encryptedEntries.map(({ encryptedEntry, entryId }) =>
|
|
70
|
+
const entries = request.encryptedEntries.map(({ encryptedEntry, entryId, iv }) =>
|
|
71
71
|
new PersistedEntry({
|
|
72
72
|
entryId,
|
|
73
|
-
iv
|
|
73
|
+
iv,
|
|
74
74
|
encryptedEntry
|
|
75
75
|
})
|
|
76
76
|
)
|
|
@@ -436,14 +436,19 @@ export const toClientRequest = (request: HttpServerRequest): HttpClientRequest.H
|
|
|
436
436
|
Option.getOrElse(toURL(request), () => request.url)
|
|
437
437
|
)
|
|
438
438
|
|
|
439
|
-
const toClientBody = (request: HttpServerRequest): HttpBody.HttpBody =>
|
|
440
|
-
hasBody(request.method)
|
|
439
|
+
const toClientBody = (request: HttpServerRequest): HttpBody.HttpBody => {
|
|
440
|
+
if (!hasBody(request.method)) {
|
|
441
|
+
return HttpBody.empty
|
|
442
|
+
}
|
|
443
|
+
const formData = getFormDataBody(request)
|
|
444
|
+
return formData === undefined
|
|
441
445
|
? HttpBody.stream(
|
|
442
446
|
request.stream,
|
|
443
447
|
request.headers["content-type"],
|
|
444
448
|
parseContentLength(request.headers["content-length"])
|
|
445
449
|
)
|
|
446
|
-
: HttpBody.
|
|
450
|
+
: HttpBody.formData(formData)
|
|
451
|
+
}
|
|
447
452
|
|
|
448
453
|
const parseContentLength = (contentLength: string | undefined): number | undefined => {
|
|
449
454
|
if (contentLength === undefined) {
|
|
@@ -602,7 +602,7 @@ class FileImpl extends PartBase implements File {
|
|
|
602
602
|
this.contentType = info.contentType
|
|
603
603
|
this.content = Stream.fromChannel(channel)
|
|
604
604
|
this.contentEffect = channel.pipe(
|
|
605
|
-
|
|
605
|
+
Channel.mkUint8Array,
|
|
606
606
|
Effect.mapError((cause) => MultipartError.fromReason("InternalError", cause))
|
|
607
607
|
)
|
|
608
608
|
}
|
|
@@ -635,24 +635,15 @@ const defaultWriteFile = (path: string, file: File) =>
|
|
|
635
635
|
* **Gotchas**
|
|
636
636
|
*
|
|
637
637
|
* This materializes the full content in memory.
|
|
638
|
+
* The source channel must not reuse or mutate emitted buffers, which are retained
|
|
639
|
+
* until collection completes.
|
|
638
640
|
*
|
|
639
641
|
* @category converting
|
|
640
642
|
* @since 4.0.0
|
|
641
643
|
*/
|
|
642
644
|
export const collectUint8Array = <OE, OD, R>(
|
|
643
645
|
self: Channel.Channel<Arr.NonEmptyReadonlyArray<Uint8Array>, OE, OD, unknown, unknown, unknown, R>
|
|
644
|
-
): Effect.Effect<Uint8Array<ArrayBuffer>, OE, R> =>
|
|
645
|
-
Channel.runFold(self, constant(new Uint8Array(0)), (accumulator, chunk) => {
|
|
646
|
-
const totalLength = chunk.reduce((sum, element) => sum + element.length, accumulator.length)
|
|
647
|
-
const newAccumulator = new Uint8Array(totalLength)
|
|
648
|
-
newAccumulator.set(accumulator, 0)
|
|
649
|
-
let offset = accumulator.length
|
|
650
|
-
for (const element of chunk) {
|
|
651
|
-
newAccumulator.set(element, offset)
|
|
652
|
-
offset += element.length
|
|
653
|
-
}
|
|
654
|
-
return newAccumulator
|
|
655
|
-
})
|
|
646
|
+
): Effect.Effect<Uint8Array<ArrayBuffer>, OE, R> => Channel.mkUint8Array(self)
|
|
656
647
|
|
|
657
648
|
/**
|
|
658
649
|
* Persists a stream of multipart parts into a record.
|
|
@@ -12,394 +12,23 @@ type State = (typeof State)[keyof typeof State]
|
|
|
12
12
|
|
|
13
13
|
const constContinue: Continue = { _tag: "Continue" }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
0
|
|
21
|
-
|
|
22
|
-
0,
|
|
23
|
-
0,
|
|
24
|
-
0,
|
|
25
|
-
0,
|
|
26
|
-
0,
|
|
27
|
-
0,
|
|
28
|
-
0,
|
|
29
|
-
0,
|
|
30
|
-
0,
|
|
31
|
-
0,
|
|
32
|
-
0,
|
|
33
|
-
0,
|
|
34
|
-
0,
|
|
35
|
-
0,
|
|
36
|
-
0,
|
|
37
|
-
0,
|
|
38
|
-
0,
|
|
39
|
-
0,
|
|
40
|
-
0,
|
|
41
|
-
0,
|
|
42
|
-
0,
|
|
43
|
-
0,
|
|
44
|
-
0,
|
|
45
|
-
0,
|
|
46
|
-
0,
|
|
47
|
-
0,
|
|
48
|
-
0,
|
|
49
|
-
1,
|
|
50
|
-
0,
|
|
51
|
-
1,
|
|
52
|
-
1,
|
|
53
|
-
1,
|
|
54
|
-
1,
|
|
55
|
-
1,
|
|
56
|
-
0,
|
|
57
|
-
0,
|
|
58
|
-
1,
|
|
59
|
-
1,
|
|
60
|
-
0,
|
|
61
|
-
1,
|
|
62
|
-
1,
|
|
63
|
-
0,
|
|
64
|
-
1,
|
|
65
|
-
1,
|
|
66
|
-
1,
|
|
67
|
-
1,
|
|
68
|
-
1,
|
|
69
|
-
1,
|
|
70
|
-
1,
|
|
71
|
-
1,
|
|
72
|
-
1,
|
|
73
|
-
1,
|
|
74
|
-
0,
|
|
75
|
-
0,
|
|
76
|
-
0,
|
|
77
|
-
0,
|
|
78
|
-
0,
|
|
79
|
-
0,
|
|
80
|
-
0,
|
|
81
|
-
1,
|
|
82
|
-
1,
|
|
83
|
-
1,
|
|
84
|
-
1,
|
|
85
|
-
1,
|
|
86
|
-
1,
|
|
87
|
-
1,
|
|
88
|
-
1,
|
|
89
|
-
1,
|
|
90
|
-
1,
|
|
91
|
-
1,
|
|
92
|
-
1,
|
|
93
|
-
1,
|
|
94
|
-
1,
|
|
95
|
-
1,
|
|
96
|
-
1,
|
|
97
|
-
1,
|
|
98
|
-
1,
|
|
99
|
-
1,
|
|
100
|
-
1,
|
|
101
|
-
1,
|
|
102
|
-
1,
|
|
103
|
-
1,
|
|
104
|
-
1,
|
|
105
|
-
1,
|
|
106
|
-
1,
|
|
107
|
-
0,
|
|
108
|
-
0,
|
|
109
|
-
0,
|
|
110
|
-
1,
|
|
111
|
-
1,
|
|
112
|
-
1,
|
|
113
|
-
1,
|
|
114
|
-
1,
|
|
115
|
-
1,
|
|
116
|
-
1,
|
|
117
|
-
1,
|
|
118
|
-
1,
|
|
119
|
-
1,
|
|
120
|
-
1,
|
|
121
|
-
1,
|
|
122
|
-
1,
|
|
123
|
-
1,
|
|
124
|
-
1,
|
|
125
|
-
1,
|
|
126
|
-
1,
|
|
127
|
-
1,
|
|
128
|
-
1,
|
|
129
|
-
1,
|
|
130
|
-
1,
|
|
131
|
-
1,
|
|
132
|
-
1,
|
|
133
|
-
1,
|
|
134
|
-
1,
|
|
135
|
-
1,
|
|
136
|
-
1,
|
|
137
|
-
1,
|
|
138
|
-
1,
|
|
139
|
-
0,
|
|
140
|
-
1,
|
|
141
|
-
0,
|
|
142
|
-
1
|
|
143
|
-
]
|
|
15
|
+
// RFC 7230 token characters, allowed in header names
|
|
16
|
+
// The previous table stopped at byte 126; zero-filled entries for bytes 127-255
|
|
17
|
+
// preserve its rejection behavior because callers accept only entries equal to 1.
|
|
18
|
+
const constNameChars = new Uint8Array(256)
|
|
19
|
+
for (const char of "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") {
|
|
20
|
+
constNameChars[char.charCodeAt(0)] = 1
|
|
21
|
+
}
|
|
144
22
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
0,
|
|
155
|
-
1,
|
|
156
|
-
0,
|
|
157
|
-
0,
|
|
158
|
-
0,
|
|
159
|
-
0,
|
|
160
|
-
0,
|
|
161
|
-
0,
|
|
162
|
-
0,
|
|
163
|
-
0,
|
|
164
|
-
0,
|
|
165
|
-
0,
|
|
166
|
-
0,
|
|
167
|
-
0,
|
|
168
|
-
0,
|
|
169
|
-
0,
|
|
170
|
-
0,
|
|
171
|
-
0,
|
|
172
|
-
0,
|
|
173
|
-
0,
|
|
174
|
-
0,
|
|
175
|
-
0,
|
|
176
|
-
0,
|
|
177
|
-
0,
|
|
178
|
-
1,
|
|
179
|
-
1,
|
|
180
|
-
1,
|
|
181
|
-
1,
|
|
182
|
-
1,
|
|
183
|
-
1,
|
|
184
|
-
1,
|
|
185
|
-
1,
|
|
186
|
-
1,
|
|
187
|
-
1,
|
|
188
|
-
1,
|
|
189
|
-
1,
|
|
190
|
-
1,
|
|
191
|
-
1,
|
|
192
|
-
1,
|
|
193
|
-
1,
|
|
194
|
-
1,
|
|
195
|
-
1,
|
|
196
|
-
1,
|
|
197
|
-
1,
|
|
198
|
-
1,
|
|
199
|
-
1,
|
|
200
|
-
1,
|
|
201
|
-
1,
|
|
202
|
-
1,
|
|
203
|
-
1,
|
|
204
|
-
1,
|
|
205
|
-
1,
|
|
206
|
-
1,
|
|
207
|
-
1,
|
|
208
|
-
1,
|
|
209
|
-
1,
|
|
210
|
-
1,
|
|
211
|
-
1,
|
|
212
|
-
1,
|
|
213
|
-
1,
|
|
214
|
-
1,
|
|
215
|
-
1,
|
|
216
|
-
1,
|
|
217
|
-
1,
|
|
218
|
-
1,
|
|
219
|
-
1,
|
|
220
|
-
1,
|
|
221
|
-
1,
|
|
222
|
-
1,
|
|
223
|
-
1,
|
|
224
|
-
1,
|
|
225
|
-
1,
|
|
226
|
-
1,
|
|
227
|
-
1,
|
|
228
|
-
1,
|
|
229
|
-
1,
|
|
230
|
-
1,
|
|
231
|
-
1,
|
|
232
|
-
1,
|
|
233
|
-
1,
|
|
234
|
-
1,
|
|
235
|
-
1,
|
|
236
|
-
1,
|
|
237
|
-
1,
|
|
238
|
-
1,
|
|
239
|
-
1,
|
|
240
|
-
1,
|
|
241
|
-
1,
|
|
242
|
-
1,
|
|
243
|
-
1,
|
|
244
|
-
1,
|
|
245
|
-
1,
|
|
246
|
-
1,
|
|
247
|
-
1,
|
|
248
|
-
1,
|
|
249
|
-
1,
|
|
250
|
-
1,
|
|
251
|
-
1,
|
|
252
|
-
1,
|
|
253
|
-
1,
|
|
254
|
-
1,
|
|
255
|
-
1,
|
|
256
|
-
1,
|
|
257
|
-
1,
|
|
258
|
-
1,
|
|
259
|
-
1,
|
|
260
|
-
1,
|
|
261
|
-
1,
|
|
262
|
-
1,
|
|
263
|
-
1,
|
|
264
|
-
1,
|
|
265
|
-
1,
|
|
266
|
-
1,
|
|
267
|
-
1,
|
|
268
|
-
1,
|
|
269
|
-
1,
|
|
270
|
-
1,
|
|
271
|
-
1,
|
|
272
|
-
1,
|
|
273
|
-
0,
|
|
274
|
-
1,
|
|
275
|
-
1,
|
|
276
|
-
1,
|
|
277
|
-
1,
|
|
278
|
-
1,
|
|
279
|
-
1,
|
|
280
|
-
1,
|
|
281
|
-
1,
|
|
282
|
-
1,
|
|
283
|
-
1,
|
|
284
|
-
1,
|
|
285
|
-
1,
|
|
286
|
-
1,
|
|
287
|
-
1,
|
|
288
|
-
1,
|
|
289
|
-
1,
|
|
290
|
-
1,
|
|
291
|
-
1,
|
|
292
|
-
1,
|
|
293
|
-
1,
|
|
294
|
-
1,
|
|
295
|
-
1,
|
|
296
|
-
1,
|
|
297
|
-
1,
|
|
298
|
-
1,
|
|
299
|
-
1,
|
|
300
|
-
1,
|
|
301
|
-
1,
|
|
302
|
-
1,
|
|
303
|
-
1,
|
|
304
|
-
1,
|
|
305
|
-
1,
|
|
306
|
-
1,
|
|
307
|
-
1,
|
|
308
|
-
1,
|
|
309
|
-
1,
|
|
310
|
-
1,
|
|
311
|
-
1,
|
|
312
|
-
1,
|
|
313
|
-
1,
|
|
314
|
-
1,
|
|
315
|
-
1,
|
|
316
|
-
1,
|
|
317
|
-
1,
|
|
318
|
-
1,
|
|
319
|
-
1,
|
|
320
|
-
1,
|
|
321
|
-
1,
|
|
322
|
-
1,
|
|
323
|
-
1,
|
|
324
|
-
1,
|
|
325
|
-
1,
|
|
326
|
-
1,
|
|
327
|
-
1,
|
|
328
|
-
1,
|
|
329
|
-
1,
|
|
330
|
-
1,
|
|
331
|
-
1,
|
|
332
|
-
1,
|
|
333
|
-
1,
|
|
334
|
-
1,
|
|
335
|
-
1,
|
|
336
|
-
1,
|
|
337
|
-
1,
|
|
338
|
-
1,
|
|
339
|
-
1,
|
|
340
|
-
1,
|
|
341
|
-
1,
|
|
342
|
-
1,
|
|
343
|
-
1,
|
|
344
|
-
1,
|
|
345
|
-
1,
|
|
346
|
-
1,
|
|
347
|
-
1,
|
|
348
|
-
1,
|
|
349
|
-
1,
|
|
350
|
-
1,
|
|
351
|
-
1,
|
|
352
|
-
1,
|
|
353
|
-
1,
|
|
354
|
-
1,
|
|
355
|
-
1,
|
|
356
|
-
1,
|
|
357
|
-
1,
|
|
358
|
-
1,
|
|
359
|
-
1,
|
|
360
|
-
1,
|
|
361
|
-
1,
|
|
362
|
-
1,
|
|
363
|
-
1,
|
|
364
|
-
1,
|
|
365
|
-
1,
|
|
366
|
-
1,
|
|
367
|
-
1,
|
|
368
|
-
1,
|
|
369
|
-
1,
|
|
370
|
-
1,
|
|
371
|
-
1,
|
|
372
|
-
1,
|
|
373
|
-
1,
|
|
374
|
-
1,
|
|
375
|
-
1,
|
|
376
|
-
1,
|
|
377
|
-
1,
|
|
378
|
-
1,
|
|
379
|
-
1,
|
|
380
|
-
1,
|
|
381
|
-
1,
|
|
382
|
-
1,
|
|
383
|
-
1,
|
|
384
|
-
1,
|
|
385
|
-
1,
|
|
386
|
-
1,
|
|
387
|
-
1,
|
|
388
|
-
1,
|
|
389
|
-
1,
|
|
390
|
-
1,
|
|
391
|
-
1,
|
|
392
|
-
1,
|
|
393
|
-
1,
|
|
394
|
-
1,
|
|
395
|
-
1,
|
|
396
|
-
1,
|
|
397
|
-
1,
|
|
398
|
-
1,
|
|
399
|
-
1,
|
|
400
|
-
1,
|
|
401
|
-
1
|
|
402
|
-
]
|
|
23
|
+
// HTAB, visible ASCII and obs-text, allowed in header values
|
|
24
|
+
const constValueChars = new Uint8Array(256)
|
|
25
|
+
constValueChars[9] = 1
|
|
26
|
+
for (let i = 32; i <= 126; i++) {
|
|
27
|
+
constValueChars[i] = 1
|
|
28
|
+
}
|
|
29
|
+
for (let i = 128; i <= 255; i++) {
|
|
30
|
+
constValueChars[i] = 1
|
|
31
|
+
}
|
|
403
32
|
|
|
404
33
|
export function make() {
|
|
405
34
|
const decoder = new TextDecoder()
|
|
@@ -74,7 +74,8 @@ export function make({
|
|
|
74
74
|
isFile: false,
|
|
75
75
|
fieldChunks: [] as Array<Uint8Array>,
|
|
76
76
|
fieldSize: 0,
|
|
77
|
-
done: false
|
|
77
|
+
done: false,
|
|
78
|
+
stopped: false
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
function skipBody() {
|
|
@@ -83,11 +84,23 @@ export function make({
|
|
|
83
84
|
state.onChunk = noopOnChunk
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
function stop(error: MultipartError) {
|
|
88
|
+
state.stopped = true
|
|
89
|
+
if (state.state === State.body && state.isFile) {
|
|
90
|
+
state.onChunk(null)
|
|
91
|
+
}
|
|
92
|
+
onError(error)
|
|
93
|
+
}
|
|
94
|
+
|
|
86
95
|
const headerParser = HP.make()
|
|
87
96
|
|
|
88
97
|
const split = Search.make(
|
|
89
98
|
`\r\n--${boundary}`,
|
|
90
99
|
function(index, chunk) {
|
|
100
|
+
if (state.stopped) {
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
if (index === 0) {
|
|
92
105
|
// data before the first boundary
|
|
93
106
|
skipBody()
|
|
@@ -127,12 +140,12 @@ export function make({
|
|
|
127
140
|
|
|
128
141
|
state.parts++
|
|
129
142
|
if (state.parts > maxParts) {
|
|
130
|
-
|
|
143
|
+
return stop(errMaxParts)
|
|
131
144
|
}
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
if ((state.partSize += chunk.length) > maxPartSize) {
|
|
135
|
-
|
|
148
|
+
return stop(errMaxPartSize)
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
if (state.state === State.headers) {
|
|
@@ -199,7 +212,7 @@ export function make({
|
|
|
199
212
|
} else {
|
|
200
213
|
const buf = chunk.subarray(result.endPosition)
|
|
201
214
|
if ((state.fieldSize += buf.length) > maxFieldSize) {
|
|
202
|
-
|
|
215
|
+
return stop(errMaxFieldSize)
|
|
203
216
|
}
|
|
204
217
|
state.fieldChunks.push(buf)
|
|
205
218
|
}
|
|
@@ -208,7 +221,7 @@ export function make({
|
|
|
208
221
|
state.onChunk(chunk)
|
|
209
222
|
} else {
|
|
210
223
|
if ((state.fieldSize += chunk.length) > maxFieldSize) {
|
|
211
|
-
|
|
224
|
+
return stop(errMaxFieldSize)
|
|
212
225
|
}
|
|
213
226
|
state.fieldChunks.push(chunk)
|
|
214
227
|
}
|
|
@@ -219,15 +232,18 @@ export function make({
|
|
|
219
232
|
|
|
220
233
|
return {
|
|
221
234
|
write(chunk: Uint8Array) {
|
|
235
|
+
if (state.stopped) {
|
|
236
|
+
return
|
|
237
|
+
}
|
|
222
238
|
if ((state.totalSize += chunk.length) > maxTotalSize) {
|
|
223
|
-
return
|
|
239
|
+
return stop(errMaxTotalSize)
|
|
224
240
|
}
|
|
225
241
|
return split.write(chunk)
|
|
226
242
|
},
|
|
227
243
|
end() {
|
|
228
244
|
split.end()
|
|
229
|
-
if (!state.done) {
|
|
230
|
-
|
|
245
|
+
if (!state.done && !state.stopped) {
|
|
246
|
+
stop(errEndNotReached)
|
|
231
247
|
}
|
|
232
248
|
|
|
233
249
|
state.state = State.headers
|
|
@@ -240,6 +256,7 @@ export function make({
|
|
|
240
256
|
state.fieldChunks = []
|
|
241
257
|
state.fieldSize = 0
|
|
242
258
|
state.done = false
|
|
259
|
+
state.stopped = false
|
|
243
260
|
}
|
|
244
261
|
} as const
|
|
245
262
|
}
|
|
@@ -220,7 +220,10 @@ type CompileSchemas = (
|
|
|
220
220
|
const compileSchemas: CompileSchemas = (asts) =>
|
|
221
221
|
JsonSchema.toMultiDocumentOpenApi3_1(
|
|
222
222
|
InternalToJsonSchemaDocument.toJsonSchemaMultiDocument(
|
|
223
|
-
InternalToRepresentation.toRepresentations(
|
|
223
|
+
InternalToRepresentation.toRepresentations(
|
|
224
|
+
Arr.map(asts, Schema.toCodecJsonAST),
|
|
225
|
+
InternalToJsonSchemaDocument.toRepresentationOptions
|
|
226
|
+
)
|
|
224
227
|
)
|
|
225
228
|
)
|
|
226
229
|
|
|
@@ -432,6 +432,14 @@ export interface CommandOptions extends KillOptions {
|
|
|
432
432
|
* Defaults to `true` on non-Windows platforms and `false` on Windows platforms.
|
|
433
433
|
*/
|
|
434
434
|
readonly detached?: boolean | undefined
|
|
435
|
+
/**
|
|
436
|
+
* If set to `true`, prevents the child process's console or GUI window from
|
|
437
|
+
* becoming visible on Windows.
|
|
438
|
+
*
|
|
439
|
+
* Defaults to `true` unless `detached` is set to `true`. This option has no
|
|
440
|
+
* effect on non-Windows platforms.
|
|
441
|
+
*/
|
|
442
|
+
readonly windowsHide?: boolean | undefined
|
|
435
443
|
/**
|
|
436
444
|
* Configuration options for the standard input stream for the child process.
|
|
437
445
|
*/
|
|
@@ -1299,6 +1299,11 @@ export const makeProtocolWorker = (
|
|
|
1299
1299
|
undefined
|
|
1300
1300
|
}).pipe(
|
|
1301
1301
|
Effect.tapCause((cause) => {
|
|
1302
|
+
for (const [requestId, entry] of entries) {
|
|
1303
|
+
if (entry.worker !== backing) continue
|
|
1304
|
+
entries.delete(requestId)
|
|
1305
|
+
entry.latch.openUnsafe()
|
|
1306
|
+
}
|
|
1302
1307
|
const error = Cause.findError(cause)
|
|
1303
1308
|
return broadcast({
|
|
1304
1309
|
_tag: "ClientProtocolError",
|
|
@@ -15,6 +15,7 @@ import { FileSystem } from "../../FileSystem.ts"
|
|
|
15
15
|
import { pipe } from "../../Function.ts"
|
|
16
16
|
import * as Option from "../../Option.ts"
|
|
17
17
|
import * as Order from "../../Order.ts"
|
|
18
|
+
import { Path } from "../../Path.ts"
|
|
18
19
|
import * as Client from "./SqlClient.ts"
|
|
19
20
|
import type { SqlError } from "./SqlError.ts"
|
|
20
21
|
|
|
@@ -400,11 +401,19 @@ export const fromRecord = (migrations: Record<string, Effect.Effect<void, unknow
|
|
|
400
401
|
* files named `<id>_<name>.js`, `<id>_<name>.ts`,
|
|
401
402
|
* `<id>_<name>.mjs`, or `<id>_<name>.mts`, and sorts migrations by id.
|
|
402
403
|
*
|
|
404
|
+
* **Details**
|
|
405
|
+
*
|
|
406
|
+
* Requires a `Path` service appropriate for the migration directory's path
|
|
407
|
+
* syntax. On Windows, prefer a platform-aware implementation such as
|
|
408
|
+
* `NodePath.layer`; the core `Path.layer` uses POSIX semantics and does not
|
|
409
|
+
* preserve Windows drive-letter paths.
|
|
410
|
+
*
|
|
403
411
|
* @category loaders
|
|
404
412
|
* @since 4.0.0
|
|
405
413
|
*/
|
|
406
|
-
export const fromFileSystem: (directory: string) => Loader<FileSystem> = Effect.fnUntraced(function*(directory) {
|
|
414
|
+
export const fromFileSystem: (directory: string) => Loader<FileSystem | Path> = Effect.fnUntraced(function*(directory) {
|
|
407
415
|
const Fs = yield* FileSystem
|
|
416
|
+
const path = yield* Path
|
|
408
417
|
const files = yield* Effect.mapError(
|
|
409
418
|
Fs.readDirectory(directory),
|
|
410
419
|
(cause) =>
|
|
@@ -424,14 +433,18 @@ export const fromFileSystem: (directory: string) => Loader<FileSystem> = Effect.
|
|
|
424
433
|
[
|
|
425
434
|
Number(id),
|
|
426
435
|
name,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
// `import` needs a file URL: on Windows an absolute path such as
|
|
437
|
+
// `D:\migrations\1_init.ts` is rejected by the ESM loader. `orDie` keeps the
|
|
438
|
+
// failure a defect so `loadMigration` reports it as an import error.
|
|
439
|
+
Effect.flatMap(Effect.orDie(path.toFileUrl(path.join(directory, basename))), (url) =>
|
|
440
|
+
Effect.promise(
|
|
441
|
+
() =>
|
|
442
|
+
import(
|
|
443
|
+
/* @vite-ignore */
|
|
444
|
+
/* webpackIgnore: true */
|
|
445
|
+
url.href
|
|
446
|
+
)
|
|
447
|
+
))
|
|
435
448
|
]
|
|
436
449
|
] as const
|
|
437
450
|
})
|