@effected/jsonl 0.3.0 → 0.5.0

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/index.d.ts CHANGED
@@ -51,7 +51,7 @@ declare const LineSlice_base: Schema.Class<LineSlice, Schema.Struct<{
51
51
  *
52
52
  * @public
53
53
  */
54
- declare class LineSlice extends LineSlice_base {}
54
+ export declare class LineSlice extends LineSlice_base {}
55
55
  //#endregion
56
56
  //#region src/JsonlError.d.ts
57
57
  declare const MalformedLine_base: Schema.Class<MalformedLine, Schema.TaggedStruct<"MalformedLine", {
@@ -84,7 +84,7 @@ declare const MalformedLine_base: Schema.Class<MalformedLine, Schema.TaggedStruc
84
84
  *
85
85
  * @public
86
86
  */
87
- declare class MalformedLine extends MalformedLine_base {
87
+ export declare class MalformedLine extends MalformedLine_base {
88
88
  get message(): string;
89
89
  }
90
90
  declare const UnknownEvent_base: Schema.Class<UnknownEvent, Schema.TaggedStruct<"UnknownEvent", {
@@ -106,7 +106,7 @@ declare const UnknownEvent_base: Schema.Class<UnknownEvent, Schema.TaggedStruct<
106
106
  *
107
107
  * @public
108
108
  */
109
- declare class UnknownEvent extends UnknownEvent_base {
109
+ export declare class UnknownEvent extends UnknownEvent_base {
110
110
  get message(): string;
111
111
  }
112
112
  declare const InvalidData_base: Schema.Class<InvalidData, Schema.TaggedStruct<"InvalidData", {
@@ -134,7 +134,7 @@ declare const InvalidData_base: Schema.Class<InvalidData, Schema.TaggedStruct<"I
134
134
  *
135
135
  * @public
136
136
  */
137
- declare class InvalidData extends InvalidData_base {
137
+ export declare class InvalidData extends InvalidData_base {
138
138
  get message(): string;
139
139
  }
140
140
  declare const TerminalViolation_base: Schema.Class<TerminalViolation, Schema.TaggedStruct<"TerminalViolation", {
@@ -152,7 +152,7 @@ declare const TerminalViolation_base: Schema.Class<TerminalViolation, Schema.Tag
152
152
  *
153
153
  * @public
154
154
  */
155
- declare class TerminalViolation extends TerminalViolation_base {
155
+ export declare class TerminalViolation extends TerminalViolation_base {
156
156
  get message(): string;
157
157
  }
158
158
  declare const JournalNotFound_base: Schema.Class<JournalNotFound, Schema.TaggedStruct<"JournalNotFound", {
@@ -171,7 +171,7 @@ declare const JournalNotFound_base: Schema.Class<JournalNotFound, Schema.TaggedS
171
171
  *
172
172
  * @public
173
173
  */
174
- declare class JournalNotFound extends JournalNotFound_base {
174
+ export declare class JournalNotFound extends JournalNotFound_base {
175
175
  get message(): string;
176
176
  }
177
177
  declare const UnserializableData_base: Schema.Class<UnserializableData, Schema.TaggedStruct<"UnserializableData", {
@@ -202,7 +202,7 @@ declare const UnserializableData_base: Schema.Class<UnserializableData, Schema.T
202
202
  *
203
203
  * @public
204
204
  */
205
- declare class UnserializableData extends UnserializableData_base {
205
+ export declare class UnserializableData extends UnserializableData_base {
206
206
  get message(): string;
207
207
  }
208
208
  declare const JournalClosed_base: Schema.Class<JournalClosed, Schema.TaggedStruct<"JournalClosed", {
@@ -224,7 +224,7 @@ declare const JournalClosed_base: Schema.Class<JournalClosed, Schema.TaggedStruc
224
224
  *
225
225
  * @public
226
226
  */
227
- declare class JournalClosed extends JournalClosed_base {
227
+ export declare class JournalClosed extends JournalClosed_base {
228
228
  get message(): string;
229
229
  }
230
230
  declare const JournalResync_base: Schema.Class<JournalResync, Schema.TaggedStruct<"JournalResync", {
@@ -265,7 +265,7 @@ declare const JournalResync_base: Schema.Class<JournalResync, Schema.TaggedStruc
265
265
  *
266
266
  * @public
267
267
  */
268
- declare class JournalResync extends JournalResync_base {
268
+ export declare class JournalResync extends JournalResync_base {
269
269
  get message(): string;
270
270
  }
271
271
  /**
@@ -306,13 +306,13 @@ type DataSchema = Schema.Codec<unknown, unknown, never, never>;
306
306
  *
307
307
  * @public
308
308
  */
309
- type JsonlEventTypeId = "~effected/jsonl/JsonlEvent";
309
+ export type JsonlEventTypeId = "~effected/jsonl/JsonlEvent";
310
310
  /**
311
311
  * Runtime type identifier marking a JSONL event definition.
312
312
  *
313
313
  * @public
314
314
  */
315
- declare const JsonlEventTypeId: JsonlEventTypeId;
315
+ export declare const JsonlEventTypeId: JsonlEventTypeId;
316
316
  /**
317
317
  * One event definition: a tag, the schema its `data` must satisfy, and the two
318
318
  * lifecycle markings.
@@ -324,7 +324,7 @@ declare const JsonlEventTypeId: JsonlEventTypeId;
324
324
  *
325
325
  * @public
326
326
  */
327
- interface JsonlEvent<out Tag extends string, in out Data extends DataSchema = Schema.Codec<void, void, never, never>, out Terminal extends boolean = false, out Reopen extends boolean = false> {
327
+ export interface JsonlEvent<out Tag extends string, in out Data extends DataSchema = Schema.Codec<void, void, never, never>, out Terminal extends boolean = false, out Reopen extends boolean = false> {
328
328
  readonly [JsonlEventTypeId]: JsonlEventTypeId;
329
329
  /** The string tag: the envelope discriminant and the primary filter key. */
330
330
  readonly tag: Tag;
@@ -345,7 +345,7 @@ interface JsonlEvent<out Tag extends string, in out Data extends DataSchema = Sc
345
345
  *
346
346
  * @public
347
347
  */
348
- declare namespace JsonlEvent {
348
+ export declare namespace JsonlEvent {
349
349
  /**
350
350
  * A type-erased event definition.
351
351
  *
@@ -411,7 +411,7 @@ declare namespace JsonlEvent {
411
411
  *
412
412
  * @public
413
413
  */
414
- declare const JsonlEvent: {
414
+ export declare const JsonlEvent: {
415
415
  readonly make: <const Tag extends string, Data extends DataSchema, const Terminal extends boolean = false, const Reopen extends boolean = false>(tag: Tag, options: {
416
416
  readonly data: Data;
417
417
  readonly terminal?: Terminal | undefined;
@@ -434,7 +434,7 @@ declare const JsonlEvent: {
434
434
  *
435
435
  * @public
436
436
  */
437
- declare const EnvelopeFrame: Schema.Struct<{
437
+ export declare const EnvelopeFrame: Schema.Struct<{
438
438
  readonly at: Schema.DateTimeUtcFromString;
439
439
  readonly event: Schema.String;
440
440
  readonly scope: Schema.optionalKey<Schema.String>;
@@ -450,7 +450,7 @@ declare const EnvelopeFrame: Schema.Struct<{
450
450
  *
451
451
  * @public
452
452
  */
453
- interface Envelope<out Tag extends string, out Data> {
453
+ export interface Envelope<out Tag extends string, out Data> {
454
454
  /** UTC timestamp, assigned by the service at append time from the `Clock`. */
455
455
  readonly at: DateTime.Utc;
456
456
  /** The event tag: the union discriminant and the primary filter key. */
@@ -492,7 +492,7 @@ type EnvelopeWithTag<R extends JsonlEvent.Registry, T extends string> = Extract<
492
492
  *
493
493
  * @public
494
494
  */
495
- declare const Envelope: {
495
+ export declare const Envelope: {
496
496
  /**
497
497
  * Stage one only: decode the frame, leaving `data` untouched.
498
498
  *
@@ -885,7 +885,7 @@ interface JournalClass<Self, Id extends string, R extends JsonlEvent.Registry> e
885
885
  *
886
886
  * @public
887
887
  */
888
- declare const Journal: {
888
+ export declare const Journal: {
889
889
  readonly Service: <Self>() => <const Id extends string, const R extends JsonlEvent.Registry>(id: Id, options: {
890
890
  readonly events: R;
891
891
  }) => JournalClass<Self, Id, R>;
@@ -908,7 +908,7 @@ declare const ParsedLine_base: Schema.Class<ParsedLine, Schema.Struct<{
908
908
  *
909
909
  * @public
910
910
  */
911
- declare class ParsedLine extends ParsedLine_base {}
911
+ export declare class ParsedLine extends ParsedLine_base {}
912
912
  /**
913
913
  * Splitting, parsing and corrupt-tail walk-back over JSONL text.
914
914
  *
@@ -920,7 +920,7 @@ declare class ParsedLine extends ParsedLine_base {}
920
920
  *
921
921
  * @public
922
922
  */
923
- declare class Line {
923
+ export declare class Line {
924
924
  /**
925
925
  * The UTF-8 byte length of a string.
926
926
  *
@@ -1028,5 +1028,5 @@ declare class Line {
1028
1028
  static lastValid(text: string): Option.Option<ParsedLine>;
1029
1029
  }
1030
1030
  //#endregion
1031
- export { type AppendOptions, type CursoredSlice, type DataSchema, Envelope, EnvelopeFrame, type EnvelopeOf, type EnvelopeUnion, type EnvelopeWithTag, InvalidData, Journal, type JournalClass, JournalClosed, type JournalConfig, JournalNotFound, type JournalReadError, JournalResync, type JournalShape, type JournalWriteError, type JsonlError, JsonlEvent, JsonlEventTypeId, Line, LineSlice, MalformedLine, ParsedLine, type Slice, TerminalViolation, UnknownEvent, UnserializableData };
1031
+ export type { AppendOptions, CursoredSlice, DataSchema, EnvelopeOf, EnvelopeUnion, EnvelopeWithTag, JournalClass, JournalConfig, JournalReadError, JournalShape, JournalWriteError, JsonlError, Slice };
1032
1032
  //# sourceMappingURL=index.d.ts.map
package/internal/tail.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Effect, Option } from "effect";
1
+ import { ByteSize, Effect, Option } from "effect";
2
2
 
3
3
  //#region src/internal/tail.ts
4
4
  /** UTF-8 BOM, as bytes. `U+FEFF` encodes to these three. */
@@ -66,11 +66,11 @@ const probeBomBytes = (fs, path) => Effect.gen(function* () {
66
66
  */
67
67
  const readTail = (fs, path, window, bomBytes) => Effect.gen(function* () {
68
68
  const info = yield* fs.stat(path);
69
- const physicalSize = Number(info.size);
69
+ const physicalSize = ByteSize.toNumberUnsafe(info.size);
70
70
  const logicalSize = physicalSize - bomBytes;
71
71
  const from = Math.max(bomBytes, physicalSize - window);
72
72
  const file = yield* fs.open(path, { flag: "r" });
73
- yield* file.seek(from, "start");
73
+ yield* file.seek(BigInt(from), "start");
74
74
  const read = yield* file.readAlloc(physicalSize - from);
75
75
  const bytes = Option.getOrElse(read, () => /* @__PURE__ */ new Uint8Array(0));
76
76
  const windowAtFileStart = from === bomBytes;
@@ -124,7 +124,7 @@ const readTailUntil = (fs, path, bomBytes, decode, initialWindow = DEFAULT_WINDO
124
124
  const readRangeText = (fs, path, from, length) => Effect.gen(function* () {
125
125
  if (length <= 0) return "";
126
126
  const file = yield* fs.open(path, { flag: "r" });
127
- yield* file.seek(from, "start");
127
+ yield* file.seek(BigInt(from), "start");
128
128
  const decoder = new TextDecoder();
129
129
  let text = "";
130
130
  let remaining = length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/jsonl",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Append-only, schema-validated JSONL journals as a definable Effect service.",
6
6
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "effect": "4.0.0-rc.109"
40
+ "effect": "4.0.0-rc.115"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=24.11.0"
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.12"
8
+ "packageVersion": "7.59.1"
9
9
  }
10
10
  ]
11
11
  }