effect 4.0.0-beta.50 → 4.0.0-beta.51
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/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +18 -14
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +4 -4
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +2 -4
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Duration.js +1 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Schema.d.ts +77 -9
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +37 -7
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +6 -0
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +216 -229
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +3 -5
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +3 -2
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -11
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.js +14 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/internal/effect.js +142 -65
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +3 -2
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -0
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +6 -6
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +9 -8
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +6 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +6 -5
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +1 -10
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +2 -11
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +4 -4
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +11 -0
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +14 -9
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/package.json +1 -1
- package/src/BigDecimal.ts +20 -16
- package/src/BigInt.ts +4 -4
- package/src/Brand.ts +2 -4
- package/src/Duration.ts +1 -1
- package/src/Schema.ts +87 -11
- package/src/SchemaAST.ts +315 -267
- package/src/SchemaGetter.ts +4 -6
- package/src/SchemaIssue.ts +28 -15
- package/src/SchemaParser.ts +8 -2
- package/src/internal/effect.ts +196 -69
- package/src/unstable/cluster/Runners.ts +8 -5
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -0
- package/src/unstable/cluster/SqlRunnerStorage.ts +12 -6
- package/src/unstable/eventlog/SqlEventJournal.ts +10 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +8 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +9 -3
- package/src/unstable/httpapi/OpenApi.ts +2 -14
- package/src/unstable/observability/OtlpMetrics.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +41 -36
|
@@ -322,7 +322,8 @@ export const makeStorage = (options?: {
|
|
|
322
322
|
)
|
|
323
323
|
},
|
|
324
324
|
sql.withTransaction,
|
|
325
|
-
Effect.orDie
|
|
325
|
+
Effect.orDie,
|
|
326
|
+
withTracerDisabled
|
|
326
327
|
),
|
|
327
328
|
entriesAfter: (storeId, entry) =>
|
|
328
329
|
sql`
|
|
@@ -333,7 +334,8 @@ export const makeStorage = (options?: {
|
|
|
333
334
|
`.pipe(
|
|
334
335
|
Effect.flatMap(decodeRemoteEntries),
|
|
335
336
|
Effect.map(Arr.map((r) => r.entry)),
|
|
336
|
-
Effect.orDie
|
|
337
|
+
Effect.orDie,
|
|
338
|
+
withTracerDisabled
|
|
337
339
|
),
|
|
338
340
|
write: Effect.fnUntraced(
|
|
339
341
|
function*(storeId, entries) {
|
|
@@ -389,6 +391,7 @@ export const makeStorage = (options?: {
|
|
|
389
391
|
},
|
|
390
392
|
Effect.scoped,
|
|
391
393
|
sql.withTransaction,
|
|
394
|
+
withTracerDisabled,
|
|
392
395
|
Effect.orDie
|
|
393
396
|
),
|
|
394
397
|
changes: Effect.fnUntraced(
|
|
@@ -410,6 +413,7 @@ export const makeStorage = (options?: {
|
|
|
410
413
|
)
|
|
411
414
|
},
|
|
412
415
|
Effect.orDie,
|
|
416
|
+
withTracerDisabled,
|
|
413
417
|
Stream.unwrap
|
|
414
418
|
),
|
|
415
419
|
withTransaction: (effect) =>
|
|
@@ -417,7 +421,7 @@ export const makeStorage = (options?: {
|
|
|
417
421
|
Effect.catchIf(SqlError.isSqlError, Effect.die)
|
|
418
422
|
)
|
|
419
423
|
})
|
|
420
|
-
})
|
|
424
|
+
}).pipe(withTracerDisabled)
|
|
421
425
|
|
|
422
426
|
/**
|
|
423
427
|
* @since 4.0.0
|
|
@@ -498,3 +502,5 @@ const decodeStoreSequence = (rows: unknown): Effect.Effect<number, Schema.Schema
|
|
|
498
502
|
const decodeSessionAuthBindings = (
|
|
499
503
|
rows: unknown
|
|
500
504
|
): Effect.Effect<ReadonlyArray<SessionAuthBindingSql>, Schema.SchemaError> => decodeSessionAuthBindingRows(rows)
|
|
505
|
+
|
|
506
|
+
const withTracerDisabled = Effect.withTracerEnabled(false)
|
|
@@ -199,21 +199,11 @@ function processAnnotation<Services, S, I>(
|
|
|
199
199
|
* and overrides. Cached results are used for better performance when the same
|
|
200
200
|
* `HttpApi` instance is processed multiple times.
|
|
201
201
|
*
|
|
202
|
-
* **Options**
|
|
203
|
-
*
|
|
204
|
-
* - `additionalProperties`: Controls how additional properties are handled while resolving the JSON schema. Possible values include:
|
|
205
|
-
* - `false`: Disallow additional properties (default)
|
|
206
|
-
* - `true`: Allow additional properties
|
|
207
|
-
* - `JsonSchema`: Use the provided JSON Schema for additional properties
|
|
208
|
-
*
|
|
209
202
|
* @category constructors
|
|
210
203
|
* @since 4.0.0
|
|
211
204
|
*/
|
|
212
205
|
export function fromApi<Id extends string, Groups extends HttpApiGroup.Any>(
|
|
213
|
-
api: HttpApi.HttpApi<Id, Groups
|
|
214
|
-
options?: {
|
|
215
|
-
readonly additionalProperties?: boolean | JsonSchema.JsonSchema | undefined
|
|
216
|
-
} | undefined
|
|
206
|
+
api: HttpApi.HttpApi<Id, Groups>
|
|
217
207
|
): OpenAPISpec {
|
|
218
208
|
const cached = apiCache.get(api)
|
|
219
209
|
if (cached !== undefined) {
|
|
@@ -484,9 +474,7 @@ export function fromApi<Id extends string, Groups extends HttpApiGroup.Any>(
|
|
|
484
474
|
Arr.map(pathOps, (op) => op.ast)
|
|
485
475
|
)
|
|
486
476
|
const jsonSchemaMultiDocument = JsonSchema.toMultiDocumentOpenApi3_1(
|
|
487
|
-
SchemaRepresentation.toJsonSchemaMultiDocument(multiDocument
|
|
488
|
-
additionalProperties: options?.additionalProperties
|
|
489
|
-
})
|
|
477
|
+
SchemaRepresentation.toJsonSchemaMultiDocument(multiDocument)
|
|
490
478
|
)
|
|
491
479
|
const patchOps: Array<JsonPatch.JsonPatchOperation> = pathOps.map((op, i) => {
|
|
492
480
|
const oppath = escapePath(op.path)
|
|
@@ -124,7 +124,7 @@ export const make: (options: {
|
|
|
124
124
|
if (typeof currentCount === "bigint" && typeof previousCount === "bigint") {
|
|
125
125
|
reportValue = currentCount - previousCount
|
|
126
126
|
// Handle reset: if current < previous, report current value
|
|
127
|
-
if (reportValue <
|
|
127
|
+
if (reportValue < BigInt(0)) {
|
|
128
128
|
reportValue = currentCount
|
|
129
129
|
}
|
|
130
130
|
} else {
|
|
@@ -29,9 +29,9 @@ const encodeTag = (fieldNumber: number, wireType: WireType): number => (fieldNum
|
|
|
29
29
|
export const encodeVarint = (value: number | bigint): Uint8Array => {
|
|
30
30
|
const bytes: Array<number> = []
|
|
31
31
|
let n = typeof value === "bigint" ? value : BigInt(value)
|
|
32
|
-
while (n >
|
|
33
|
-
bytes.push(Number(n &
|
|
34
|
-
n >>=
|
|
32
|
+
while (n > BigInt(127)) {
|
|
33
|
+
bytes.push(Number(n & BigInt(127)) | 0x80)
|
|
34
|
+
n >>= BigInt(7)
|
|
35
35
|
}
|
|
36
36
|
bytes.push(Number(n))
|
|
37
37
|
return new Uint8Array(bytes)
|
|
@@ -44,7 +44,7 @@ export const encodeVarint = (value: number | bigint): Uint8Array => {
|
|
|
44
44
|
*/
|
|
45
45
|
export const encodeSint = (value: number | bigint): Uint8Array => {
|
|
46
46
|
const n = typeof value === "bigint" ? value : BigInt(value)
|
|
47
|
-
const zigzag = (n <<
|
|
47
|
+
const zigzag = (n << BigInt(1)) ^ (n >> BigInt(63))
|
|
48
48
|
return encodeVarint(zigzag)
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -400,47 +400,52 @@ interface JsonRpcResponse {
|
|
|
400
400
|
type JsonRpcMessage = JsonRpcRequest | JsonRpcResponse
|
|
401
401
|
|
|
402
402
|
/**
|
|
403
|
+
* Create a MessagePack serialization with custom msgpackr options.
|
|
404
|
+
*
|
|
403
405
|
* @since 4.0.0
|
|
404
406
|
* @category serialization
|
|
405
407
|
*/
|
|
406
|
-
export const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
bytes.set(prev, incomplete.length)
|
|
426
|
-
buf = bytes
|
|
427
|
-
incomplete = undefined
|
|
428
|
-
}
|
|
429
|
-
try {
|
|
430
|
-
return unpackr.unpackMultiple(buf)
|
|
431
|
-
} catch (error_) {
|
|
432
|
-
const error = error_ as any
|
|
433
|
-
if (error.incomplete) {
|
|
434
|
-
incomplete = buf.subarray(error.lastPosition)
|
|
435
|
-
return error.values ?? []
|
|
408
|
+
export const makeMsgPack = (options?: Msgpackr.Options | undefined): RpcSerialization["Service"] =>
|
|
409
|
+
RpcSerialization.of({
|
|
410
|
+
contentType: "application/msgpack",
|
|
411
|
+
includesFraming: true,
|
|
412
|
+
makeUnsafe: () => {
|
|
413
|
+
const unpackr = new Msgpackr.Unpackr(options)
|
|
414
|
+
const packr = new Msgpackr.Packr(options)
|
|
415
|
+
const encoder = new TextEncoder()
|
|
416
|
+
let incomplete: Uint8Array | undefined = undefined
|
|
417
|
+
return {
|
|
418
|
+
decode(bytes) {
|
|
419
|
+
let buf = typeof bytes === "string" ? encoder.encode(bytes) : bytes
|
|
420
|
+
if (incomplete !== undefined) {
|
|
421
|
+
const prev = buf
|
|
422
|
+
bytes = new Uint8Array(incomplete.length + buf.length)
|
|
423
|
+
bytes.set(incomplete)
|
|
424
|
+
bytes.set(prev, incomplete.length)
|
|
425
|
+
buf = bytes
|
|
426
|
+
incomplete = undefined
|
|
436
427
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
428
|
+
try {
|
|
429
|
+
return unpackr.unpackMultiple(buf)
|
|
430
|
+
} catch (error_) {
|
|
431
|
+
const error = error_ as any
|
|
432
|
+
if (error.incomplete) {
|
|
433
|
+
incomplete = buf.subarray(error.lastPosition)
|
|
434
|
+
return error.values ?? []
|
|
435
|
+
}
|
|
436
|
+
throw error_
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
encode: (response) => packr.pack(response)
|
|
440
|
+
}
|
|
441
441
|
}
|
|
442
|
-
}
|
|
443
|
-
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @since 4.0.0
|
|
446
|
+
* @category serialization
|
|
447
|
+
*/
|
|
448
|
+
export const msgPack: RpcSerialization["Service"] = makeMsgPack({ useRecords: true })
|
|
444
449
|
|
|
445
450
|
/**
|
|
446
451
|
* A rpc serialization layer that uses JSON for serialization.
|