effect 4.0.0-beta.30 → 4.0.0-beta.31
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 +2 -2
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Cron.js +3 -3
- package/dist/Cron.js.map +1 -1
- package/dist/DateTime.d.ts +33 -77
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +1 -1
- package/dist/DateTime.js.map +1 -1
- package/dist/Duration.d.ts +29 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +77 -48
- package/dist/Duration.js.map +1 -1
- package/dist/Layer.d.ts +97 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +8 -2
- package/dist/Layer.js.map +1 -1
- package/dist/Schema.d.ts +2316 -114
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1331 -67
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.js +2 -2
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/internal/dateTime.js +57 -50
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +1 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +3 -4
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +30 -16
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +10 -87
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +4 -4
- package/dist/unstable/cli/GlobalFlag.js.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/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +1 -3
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Channel.ts +3 -3
- package/src/Cron.ts +3 -3
- package/src/DateTime.ts +35 -77
- package/src/Duration.ts +78 -23
- package/src/Layer.ts +123 -19
- package/src/Schema.ts +2317 -115
- package/src/SchemaAST.ts +2 -2
- package/src/SchemaRepresentation.ts +2 -2
- package/src/internal/dateTime.ts +60 -51
- package/src/internal/effect.ts +1 -1
- package/src/unstable/ai/Chat.ts +11 -13
- package/src/unstable/ai/LanguageModel.ts +148 -97
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/GlobalFlag.ts +4 -5
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -1
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/http/HttpClientResponse.ts +2 -2
- package/src/unstable/http/HttpIncomingMessage.ts +1 -1
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +2 -2
- package/src/unstable/httpapi/HttpApiBuilder.ts +4 -4
- package/src/unstable/persistence/Persistable.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -3
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/src/SchemaAST.ts
CHANGED
|
@@ -2394,9 +2394,9 @@ export function memoizeThunk<A>(f: () => A): () => A {
|
|
|
2394
2394
|
* readonly children: ReadonlyArray<Category>
|
|
2395
2395
|
* }
|
|
2396
2396
|
*
|
|
2397
|
-
* const Category
|
|
2397
|
+
* const Category = Schema.Struct({
|
|
2398
2398
|
* name: Schema.String,
|
|
2399
|
-
* children: Schema.Array(Schema.suspend(() => Category))
|
|
2399
|
+
* children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
|
|
2400
2400
|
* })
|
|
2401
2401
|
*
|
|
2402
2402
|
* // The recursive branch is a Suspend node
|
|
@@ -1646,7 +1646,7 @@ export const fromASTs: (asts: readonly [AST.AST, ...Array<AST.AST>]) => MultiDoc
|
|
|
1646
1646
|
*
|
|
1647
1647
|
* @since 4.0.0
|
|
1648
1648
|
*/
|
|
1649
|
-
export const DocumentFromJson: Schema.Codec<Document,
|
|
1649
|
+
export const DocumentFromJson: Schema.Codec<Document, Schema.Json> = Schema.toCodecJson($Document)
|
|
1650
1650
|
|
|
1651
1651
|
/**
|
|
1652
1652
|
* Schema codec that decodes a {@link MultiDocument} from JSON and encodes it
|
|
@@ -1657,7 +1657,7 @@ export const DocumentFromJson: Schema.Codec<Document, unknown> = Schema.toCodecJ
|
|
|
1657
1657
|
*
|
|
1658
1658
|
* @since 4.0.0
|
|
1659
1659
|
*/
|
|
1660
|
-
export const MultiDocumentFromJson: Schema.Codec<MultiDocument,
|
|
1660
|
+
export const MultiDocumentFromJson: Schema.Codec<MultiDocument, Schema.Json> = Schema.toCodecJson($MultiDocument)
|
|
1661
1661
|
|
|
1662
1662
|
/**
|
|
1663
1663
|
* Wraps a single {@link Document} as a {@link MultiDocument} with one
|
package/src/internal/dateTime.ts
CHANGED
|
@@ -39,10 +39,10 @@ const ProtoUtc = {
|
|
|
39
39
|
...Proto,
|
|
40
40
|
_tag: "Utc",
|
|
41
41
|
[Hash.symbol](this: DateTime.Utc) {
|
|
42
|
-
return Hash.number(this.
|
|
42
|
+
return Hash.number(this.epochMilliseconds)
|
|
43
43
|
},
|
|
44
44
|
[Equal.symbol](this: DateTime.Utc, that: unknown) {
|
|
45
|
-
return isDateTime(that) && that._tag === "Utc" && this.
|
|
45
|
+
return isDateTime(that) && that._tag === "Utc" && this.epochMilliseconds === that.epochMilliseconds
|
|
46
46
|
},
|
|
47
47
|
toString(this: DateTime.Utc) {
|
|
48
48
|
return `DateTime.Utc(${toDateUtc(this).toJSON()})`
|
|
@@ -53,10 +53,10 @@ const ProtoZoned = {
|
|
|
53
53
|
...Proto,
|
|
54
54
|
_tag: "Zoned",
|
|
55
55
|
[Hash.symbol](this: DateTime.Zoned) {
|
|
56
|
-
return Hash.combine(Hash.number(this.
|
|
56
|
+
return Hash.combine(Hash.number(this.epochMilliseconds))(Hash.hash(this.zone))
|
|
57
57
|
},
|
|
58
58
|
[Equal.symbol](this: DateTime.Zoned, that: unknown) {
|
|
59
|
-
return isDateTime(that) && that._tag === "Zoned" && this.
|
|
59
|
+
return isDateTime(that) && that._tag === "Zoned" && this.epochMilliseconds === that.epochMilliseconds &&
|
|
60
60
|
Equal.equals(this.zone, that.zone)
|
|
61
61
|
},
|
|
62
62
|
toString(this: DateTime.Zoned) {
|
|
@@ -120,7 +120,7 @@ export const makeZonedProto = (
|
|
|
120
120
|
partsUtc?: DateTime.DateTime.PartsWithWeekday
|
|
121
121
|
): DateTime.Zoned => {
|
|
122
122
|
const self = Object.create(ProtoZoned)
|
|
123
|
-
self.
|
|
123
|
+
self.epochMilliseconds = epochMillis
|
|
124
124
|
self.zone = zone
|
|
125
125
|
Object.defineProperty(self, "partsUtc", {
|
|
126
126
|
value: partsUtc,
|
|
@@ -169,11 +169,13 @@ export const isZoned = (self: DateTime.DateTime): self is DateTime.Zoned => self
|
|
|
169
169
|
// =============================================================================
|
|
170
170
|
|
|
171
171
|
/** @internal */
|
|
172
|
-
export const Equivalence: Equ.Equivalence<DateTime.DateTime> = Equ.make((a, b) =>
|
|
172
|
+
export const Equivalence: Equ.Equivalence<DateTime.DateTime> = Equ.make((a, b) =>
|
|
173
|
+
a.epochMilliseconds === b.epochMilliseconds
|
|
174
|
+
)
|
|
173
175
|
|
|
174
176
|
/** @internal */
|
|
175
177
|
export const Order: order.Order<DateTime.DateTime> = order.make((self, that) =>
|
|
176
|
-
self.
|
|
178
|
+
self.epochMilliseconds < that.epochMilliseconds ? -1 : self.epochMilliseconds > that.epochMilliseconds ? 1 : 0
|
|
177
179
|
)
|
|
178
180
|
|
|
179
181
|
/** @internal */
|
|
@@ -193,7 +195,7 @@ export const clamp: {
|
|
|
193
195
|
|
|
194
196
|
const makeUtc = (epochMillis: number): DateTime.Utc => {
|
|
195
197
|
const self = Object.create(ProtoUtc)
|
|
196
|
-
self.
|
|
198
|
+
self.epochMilliseconds = epochMillis
|
|
197
199
|
Object.defineProperty(self, "partsUtc", {
|
|
198
200
|
value: undefined,
|
|
199
201
|
enumerable: false,
|
|
@@ -218,6 +220,9 @@ export const makeUnsafe = <A extends DateTime.DateTime.Input>(input: A): DateTim
|
|
|
218
220
|
} else if (input instanceof Date) {
|
|
219
221
|
return fromDateUnsafe(input) as DateTime.DateTime.PreserveZone<A>
|
|
220
222
|
} else if (typeof input === "object") {
|
|
223
|
+
if ("epochMilliseconds" in input) {
|
|
224
|
+
return makeUtc(input.epochMilliseconds) as DateTime.DateTime.PreserveZone<A>
|
|
225
|
+
}
|
|
221
226
|
const date = new Date(0)
|
|
222
227
|
setPartsDate(date, input)
|
|
223
228
|
return fromDateUnsafe(date) as DateTime.DateTime.PreserveZone<A>
|
|
@@ -238,32 +243,36 @@ export const makeZonedUnsafe = (input: DateTime.DateTime.Input, options?: {
|
|
|
238
243
|
readonly adjustForTimeZone?: boolean | undefined
|
|
239
244
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
240
245
|
}): DateTime.Zoned => {
|
|
241
|
-
|
|
246
|
+
let timeZoneOption = options?.timeZone
|
|
247
|
+
if (timeZoneOption === undefined && isDateTime(input) && isZoned(input)) {
|
|
242
248
|
return input
|
|
243
249
|
}
|
|
244
250
|
const self = makeUnsafe(input)
|
|
245
|
-
if (self.
|
|
246
|
-
throw new RangeError(`Epoch millis out of range: ${self.
|
|
251
|
+
if (self.epochMilliseconds < minEpochMillis || self.epochMilliseconds > maxEpochMillis) {
|
|
252
|
+
throw new RangeError(`Epoch millis out of range: ${self.epochMilliseconds}`)
|
|
253
|
+
}
|
|
254
|
+
if (timeZoneOption === undefined && typeof input === "object" && "timeZoneId" in input) {
|
|
255
|
+
timeZoneOption = input.timeZoneId
|
|
247
256
|
}
|
|
248
257
|
let zone: DateTime.TimeZone
|
|
249
|
-
if (
|
|
250
|
-
const offset = new Date(self.
|
|
258
|
+
if (timeZoneOption === undefined) {
|
|
259
|
+
const offset = new Date(self.epochMilliseconds).getTimezoneOffset() * -60 * 1000
|
|
251
260
|
zone = zoneMakeOffset(offset)
|
|
252
|
-
} else if (isTimeZone(
|
|
253
|
-
zone =
|
|
254
|
-
} else if (typeof
|
|
255
|
-
zone = zoneMakeOffset(
|
|
261
|
+
} else if (isTimeZone(timeZoneOption)) {
|
|
262
|
+
zone = timeZoneOption
|
|
263
|
+
} else if (typeof timeZoneOption === "number") {
|
|
264
|
+
zone = zoneMakeOffset(timeZoneOption)
|
|
256
265
|
} else {
|
|
257
|
-
const parsedZone = zoneFromString(
|
|
266
|
+
const parsedZone = zoneFromString(timeZoneOption)
|
|
258
267
|
if (parsedZone === undefined) {
|
|
259
|
-
throw new IllegalArgumentError(`Invalid time zone: ${
|
|
268
|
+
throw new IllegalArgumentError(`Invalid time zone: ${timeZoneOption}`)
|
|
260
269
|
}
|
|
261
270
|
zone = parsedZone
|
|
262
271
|
}
|
|
263
272
|
if (options?.adjustForTimeZone !== true) {
|
|
264
|
-
return makeZonedProto(self.
|
|
273
|
+
return makeZonedProto(self.epochMilliseconds, zone, self.partsUtc)
|
|
265
274
|
}
|
|
266
|
-
return makeZonedFromAdjusted(self.
|
|
275
|
+
return makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? "compatible")
|
|
267
276
|
}
|
|
268
277
|
|
|
269
278
|
/** @internal */
|
|
@@ -307,7 +316,7 @@ export const nowUnsafe: LazyArg<DateTime.Utc> = () => makeUtc(Date.now())
|
|
|
307
316
|
// =============================================================================
|
|
308
317
|
|
|
309
318
|
/** @internal */
|
|
310
|
-
export const toUtc = (self: DateTime.DateTime): DateTime.Utc => makeUtc(self.
|
|
319
|
+
export const toUtc = (self: DateTime.DateTime): DateTime.Utc => makeUtc(self.epochMilliseconds)
|
|
311
320
|
|
|
312
321
|
/** @internal */
|
|
313
322
|
export const setZone: {
|
|
@@ -324,8 +333,8 @@ export const setZone: {
|
|
|
324
333
|
readonly disambiguation?: DateTime.Disambiguation | undefined
|
|
325
334
|
}): DateTime.Zoned =>
|
|
326
335
|
options?.adjustForTimeZone === true
|
|
327
|
-
? makeZonedFromAdjusted(self.
|
|
328
|
-
: makeZonedProto(self.
|
|
336
|
+
? makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? "compatible")
|
|
337
|
+
: makeZonedProto(self.epochMilliseconds, zone, self.partsUtc))
|
|
329
338
|
|
|
330
339
|
/** @internal */
|
|
331
340
|
export const setZoneOffset: {
|
|
@@ -533,18 +542,18 @@ export const isPastUnsafe = (self: DateTime.DateTime): boolean => isGreaterThan(
|
|
|
533
542
|
// =============================================================================
|
|
534
543
|
|
|
535
544
|
/** @internal */
|
|
536
|
-
export const toDateUtc = (self: DateTime.DateTime): Date => new Date(self.
|
|
545
|
+
export const toDateUtc = (self: DateTime.DateTime): Date => new Date(self.epochMilliseconds)
|
|
537
546
|
|
|
538
547
|
/** @internal */
|
|
539
548
|
export const toDate = (self: DateTime.DateTime): Date => {
|
|
540
549
|
if (self._tag === "Utc") {
|
|
541
|
-
return new Date(self.
|
|
550
|
+
return new Date(self.epochMilliseconds)
|
|
542
551
|
} else if (self.zone._tag === "Offset") {
|
|
543
|
-
return new Date(self.
|
|
544
|
-
} else if (self.
|
|
545
|
-
return new Date(self.
|
|
552
|
+
return new Date(self.epochMilliseconds + self.zone.offset)
|
|
553
|
+
} else if (self.adjustedEpochMilliseconds !== undefined) {
|
|
554
|
+
return new Date(self.adjustedEpochMilliseconds)
|
|
546
555
|
}
|
|
547
|
-
const parts = self.zone.format.formatToParts(self.
|
|
556
|
+
const parts = self.zone.format.formatToParts(self.epochMilliseconds).filter((_) => _.type !== "literal")
|
|
548
557
|
const date = new Date(0)
|
|
549
558
|
date.setUTCFullYear(
|
|
550
559
|
Number(parts[2].value),
|
|
@@ -557,7 +566,7 @@ export const toDate = (self: DateTime.DateTime): Date => {
|
|
|
557
566
|
Number(parts[5].value),
|
|
558
567
|
Number(parts[6].value)
|
|
559
568
|
)
|
|
560
|
-
self.
|
|
569
|
+
self.adjustedEpochMilliseconds = date.getTime()
|
|
561
570
|
return date
|
|
562
571
|
}
|
|
563
572
|
|
|
@@ -582,7 +591,7 @@ const offsetToString = (offset: number): string => {
|
|
|
582
591
|
export const zonedOffsetIso = (self: DateTime.Zoned): string => offsetToString(zonedOffset(self))
|
|
583
592
|
|
|
584
593
|
/** @internal */
|
|
585
|
-
export const toEpochMillis = (self: DateTime.DateTime): number => self.
|
|
594
|
+
export const toEpochMillis = (self: DateTime.DateTime): number => self.epochMilliseconds
|
|
586
595
|
|
|
587
596
|
/** @internal */
|
|
588
597
|
export const removeTime = (self: DateTime.DateTime): DateTime.Utc =>
|
|
@@ -596,10 +605,10 @@ export const removeTime = (self: DateTime.DateTime): DateTime.Utc =>
|
|
|
596
605
|
// =============================================================================
|
|
597
606
|
|
|
598
607
|
const dateToParts = (date: Date): DateTime.DateTime.PartsWithWeekday => ({
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
608
|
+
millisecond: date.getUTCMilliseconds(),
|
|
609
|
+
second: date.getUTCSeconds(),
|
|
610
|
+
minute: date.getUTCMinutes(),
|
|
611
|
+
hour: date.getUTCHours(),
|
|
603
612
|
day: date.getUTCDate(),
|
|
604
613
|
weekDay: date.getUTCDay(),
|
|
605
614
|
month: date.getUTCMonth() + 1,
|
|
@@ -652,17 +661,17 @@ const setPartsDate = (date: Date, parts: Partial<DateTime.DateTime.PartsWithWeek
|
|
|
652
661
|
const diff = parts.weekDay - date.getUTCDay()
|
|
653
662
|
date.setUTCDate(date.getUTCDate() + diff)
|
|
654
663
|
}
|
|
655
|
-
if (parts.
|
|
656
|
-
date.setUTCHours(parts.
|
|
664
|
+
if (parts.hour !== undefined) {
|
|
665
|
+
date.setUTCHours(parts.hour)
|
|
657
666
|
}
|
|
658
|
-
if (parts.
|
|
659
|
-
date.setUTCMinutes(parts.
|
|
667
|
+
if (parts.minute !== undefined) {
|
|
668
|
+
date.setUTCMinutes(parts.minute)
|
|
660
669
|
}
|
|
661
|
-
if (parts.
|
|
662
|
-
date.setUTCSeconds(parts.
|
|
670
|
+
if (parts.second !== undefined) {
|
|
671
|
+
date.setUTCSeconds(parts.second)
|
|
663
672
|
}
|
|
664
|
-
if (parts.
|
|
665
|
-
date.setUTCMilliseconds(parts.
|
|
673
|
+
if (parts.millisecond !== undefined) {
|
|
674
|
+
date.setUTCMilliseconds(parts.millisecond)
|
|
666
675
|
}
|
|
667
676
|
}
|
|
668
677
|
|
|
@@ -925,8 +934,8 @@ export const add: {
|
|
|
925
934
|
2,
|
|
926
935
|
(self: DateTime.DateTime, parts: Partial<DateTime.DateTime.PartsForMath>): DateTime.DateTime =>
|
|
927
936
|
mutate(self, (date) => {
|
|
928
|
-
if (parts.
|
|
929
|
-
addMillis(date, parts.
|
|
937
|
+
if (parts.milliseconds) {
|
|
938
|
+
addMillis(date, parts.milliseconds)
|
|
930
939
|
}
|
|
931
940
|
if (parts.seconds) {
|
|
932
941
|
addMillis(date, parts.seconds * 1000)
|
|
@@ -1100,7 +1109,7 @@ export const nearest: {
|
|
|
1100
1109
|
readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
|
|
1101
1110
|
}): DateTime.DateTime =>
|
|
1102
1111
|
mutate(self, (date) => {
|
|
1103
|
-
if (part === "
|
|
1112
|
+
if (part === "millisecond") return
|
|
1104
1113
|
const millis = date.getTime()
|
|
1105
1114
|
const start = new Date(millis)
|
|
1106
1115
|
startOfDate(start, part, options)
|
|
@@ -1157,7 +1166,7 @@ export const format: {
|
|
|
1157
1166
|
return new Intl.DateTimeFormat(options?.locale, {
|
|
1158
1167
|
timeZone: self._tag === "Utc" ? "UTC" : intlTimeZone(self.zone),
|
|
1159
1168
|
...options
|
|
1160
|
-
}).format(self.
|
|
1169
|
+
}).format(self.epochMilliseconds)
|
|
1161
1170
|
} catch {
|
|
1162
1171
|
return new Intl.DateTimeFormat(options?.locale, {
|
|
1163
1172
|
timeZone: "UTC",
|
|
@@ -1190,7 +1199,7 @@ export const formatLocal: {
|
|
|
1190
1199
|
readonly locale?: Intl.LocalesArgument
|
|
1191
1200
|
}
|
|
1192
1201
|
| undefined
|
|
1193
|
-
): string => new Intl.DateTimeFormat(options?.locale, options).format(self.
|
|
1202
|
+
): string => new Intl.DateTimeFormat(options?.locale, options).format(self.epochMilliseconds))
|
|
1194
1203
|
|
|
1195
1204
|
/** @internal */
|
|
1196
1205
|
export const formatUtc: {
|
|
@@ -1220,13 +1229,13 @@ export const formatUtc: {
|
|
|
1220
1229
|
new Intl.DateTimeFormat(options?.locale, {
|
|
1221
1230
|
...options,
|
|
1222
1231
|
timeZone: "UTC"
|
|
1223
|
-
}).format(self.
|
|
1232
|
+
}).format(self.epochMilliseconds))
|
|
1224
1233
|
|
|
1225
1234
|
/** @internal */
|
|
1226
1235
|
export const formatIntl: {
|
|
1227
1236
|
(format: Intl.DateTimeFormat): (self: DateTime.DateTime) => string
|
|
1228
1237
|
(self: DateTime.DateTime, format: Intl.DateTimeFormat): string
|
|
1229
|
-
} = dual(2, (self: DateTime.DateTime, format: Intl.DateTimeFormat): string => format.format(self.
|
|
1238
|
+
} = dual(2, (self: DateTime.DateTime, format: Intl.DateTimeFormat): string => format.format(self.epochMilliseconds))
|
|
1230
1239
|
|
|
1231
1240
|
/** @internal */
|
|
1232
1241
|
export const formatIso = (self: DateTime.DateTime): string => toDateUtc(self).toISOString()
|
package/src/internal/effect.ts
CHANGED
|
@@ -6195,7 +6195,7 @@ const prettyLoggerBrowser = (options: {
|
|
|
6195
6195
|
export const defaultLogger = loggerMake<unknown, void>(({ cause, date, fiber, logLevel, message }) => {
|
|
6196
6196
|
const message_ = Array.isArray(message) ? message.slice() : [message]
|
|
6197
6197
|
if (cause.reasons.length > 0) {
|
|
6198
|
-
message_.
|
|
6198
|
+
message_.push(causePretty(cause))
|
|
6199
6199
|
}
|
|
6200
6200
|
const now = date.getTime()
|
|
6201
6201
|
const spans = fiber.getRef(CurrentLogSpans)
|
package/src/unstable/ai/Chat.ts
CHANGED
|
@@ -64,7 +64,6 @@ import * as IdGenerator from "./IdGenerator.ts"
|
|
|
64
64
|
import * as LanguageModel from "./LanguageModel.ts"
|
|
65
65
|
import * as Prompt from "./Prompt.ts"
|
|
66
66
|
import type * as Response from "./Response.ts"
|
|
67
|
-
import type * as Tool from "./Tool.ts"
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
69
|
* The `Chat` service tag for dependency injection.
|
|
@@ -200,10 +199,9 @@ export interface Service {
|
|
|
200
199
|
* ```
|
|
201
200
|
*/
|
|
202
201
|
readonly generateText: <
|
|
203
|
-
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
LanguageModel.GenerateTextResponse<Tools>,
|
|
202
|
+
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options>
|
|
203
|
+
>(options: Options & LanguageModel.GenerateTextOptions<LanguageModel.ExtractTools<Options>>) => Effect.Effect<
|
|
204
|
+
LanguageModel.GenerateTextResponse<LanguageModel.ExtractTools<Options>>,
|
|
207
205
|
LanguageModel.ExtractError<Options>,
|
|
208
206
|
LanguageModel.LanguageModel | LanguageModel.ExtractServices<Options>
|
|
209
207
|
>
|
|
@@ -234,10 +232,9 @@ export interface Service {
|
|
|
234
232
|
* ```
|
|
235
233
|
*/
|
|
236
234
|
readonly streamText: <
|
|
237
|
-
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Response.StreamPart<Tools>,
|
|
235
|
+
Options extends NoExcessProperties<LanguageModel.GenerateTextOptions<any>, Options>
|
|
236
|
+
>(options: Options & LanguageModel.GenerateTextOptions<LanguageModel.ExtractTools<Options>>) => Stream.Stream<
|
|
237
|
+
Response.StreamPart<LanguageModel.ExtractTools<Options>>,
|
|
241
238
|
LanguageModel.ExtractError<Options>,
|
|
242
239
|
LanguageModel.LanguageModel | LanguageModel.ExtractServices<Options>
|
|
243
240
|
>
|
|
@@ -278,10 +275,11 @@ export interface Service {
|
|
|
278
275
|
readonly generateObject: <
|
|
279
276
|
ObjectEncoded extends Record<string, any>,
|
|
280
277
|
ObjectSchema extends Schema.Encoder<ObjectEncoded, unknown>,
|
|
281
|
-
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
Options extends NoExcessProperties<LanguageModel.GenerateObjectOptions<any, ObjectSchema>, Options>
|
|
279
|
+
>(
|
|
280
|
+
options: Options & LanguageModel.GenerateObjectOptions<LanguageModel.ExtractTools<Options>, ObjectSchema>
|
|
281
|
+
) => Effect.Effect<
|
|
282
|
+
LanguageModel.GenerateObjectResponse<LanguageModel.ExtractTools<Options>, ObjectSchema["Type"]>,
|
|
285
283
|
LanguageModel.ExtractError<Options>,
|
|
286
284
|
LanguageModel.ExtractServices<Options> | ObjectSchema["DecodingServices"] | LanguageModel.LanguageModel
|
|
287
285
|
>
|