@t4h.framework/fs 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.
Files changed (30) hide show
  1. package/.ai/skills/framework-fs/SKILL.md +191 -0
  2. package/dist/ActivityFileSystemClaim.d.ts +7 -0
  3. package/dist/ActivityFileSystemClaim.d.ts.map +1 -0
  4. package/dist/ActivityFileSystemClaim.js +3 -0
  5. package/dist/ActivityFileSystemClaim.js.map +1 -0
  6. package/dist/activities/FileSplitActivity.d.ts +36 -0
  7. package/dist/activities/FileSplitActivity.d.ts.map +1 -0
  8. package/dist/activities/FileSplitActivity.js +46 -0
  9. package/dist/activities/FileSplitActivity.js.map +1 -0
  10. package/dist/activities/__tests__/FileSplitActivity.spec.d.ts +2 -0
  11. package/dist/activities/__tests__/FileSplitActivity.spec.d.ts.map +1 -0
  12. package/dist/activities/__tests__/FileSplitActivity.spec.js +167 -0
  13. package/dist/activities/__tests__/FileSplitActivity.spec.js.map +1 -0
  14. package/dist/helpers/__tests__/csv-reader.spec.d.ts +2 -0
  15. package/dist/helpers/__tests__/csv-reader.spec.d.ts.map +1 -0
  16. package/dist/helpers/__tests__/csv-reader.spec.js +60 -0
  17. package/dist/helpers/__tests__/csv-reader.spec.js.map +1 -0
  18. package/dist/helpers/csv-reader.d.ts +8 -0
  19. package/dist/helpers/csv-reader.d.ts.map +1 -0
  20. package/dist/helpers/csv-reader.js +14 -0
  21. package/dist/helpers/csv-reader.js.map +1 -0
  22. package/dist/helpers/parsers.d.ts +9 -0
  23. package/dist/helpers/parsers.d.ts.map +1 -0
  24. package/dist/helpers/parsers.js +14 -0
  25. package/dist/helpers/parsers.js.map +1 -0
  26. package/dist/testing/index.d.ts +3 -0
  27. package/dist/testing/index.d.ts.map +1 -0
  28. package/dist/testing/index.js +32 -0
  29. package/dist/testing/index.js.map +1 -0
  30. package/package.json +5 -6
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: framework-fs
3
+ description: >-
4
+ Guides correct use of @t4h.framework/fs in T4H Framework workflows: the
5
+ FileSystemClaim abstraction that the package activities (http, jsx) use to
6
+ read/write files, the Binary result workflows consume, and runtime providers.
7
+ Use when a workflow orchestrates file-backed package activities, consuming
8
+ Binary results, mocking FileSystemClaim in workflow tests, registering fs
9
+ claim providers, or debugging missing fs provider errors.
10
+ ---
11
+
12
+ # @t4h.framework/fs
13
+
14
+ File system **claim** for reading and writing files inside workflow activities. The package defines only the abstract contract; concrete storage (local disk, object storage, etc.) is supplied by the **runtime** or **dev** claim registry.
15
+
16
+ Package path: `framework/packages/fs`. Peer dependency: `@t4h.framework/core` (`Binary`).
17
+
18
+ ---
19
+
20
+ ## Import surface
21
+
22
+ The package exports a single public symbol from `src/fs.ts`:
23
+
24
+ ```typescript
25
+ import { FileSystemClaim } from '@t4h.framework/fs'
26
+ ```
27
+
28
+ Do not import from internal paths such as `src/FileSystemClaim.ts` in application code.
29
+
30
+ ---
31
+
32
+ ## FileSystemClaim contract
33
+
34
+ ```typescript
35
+ import type { Readable } from 'node:stream'
36
+ import type { Binary } from '@t4h.framework/core'
37
+
38
+ export abstract class FileSystemClaim {
39
+ public abstract write(
40
+ path: string,
41
+ readable: Readable | Buffer,
42
+ ): Binary | Promise<Binary>
43
+
44
+ public abstract read(path: string): Binary | Promise<Binary>
45
+ }
46
+ ```
47
+
48
+ | Method | Purpose |
49
+ |--------|---------|
50
+ | `write(path, readable)` | Persist stream or buffer at `path`; return a `Binary` handle (metadata + `stream()`). |
51
+ | `read(path)` | Load an existing file at `path`; return a `Binary` handle. |
52
+
53
+ Both methods may return synchronously or as a `Promise`. Implementations choose storage layout; callers should only rely on the returned `Binary` API.
54
+
55
+ ### Binary (from `@t4h.framework/core`)
56
+
57
+ ```typescript
58
+ export abstract class Binary {
59
+ public abstract readonly contentType: string
60
+ public abstract readonly contentLength: number
61
+ public abstract stream(): Readable | Promise<Readable>
62
+ }
63
+ ```
64
+
65
+ The package activities return this `Binary` to your workflow — e.g. an `http`
66
+ response `Body` is backed by it. Consume it with `stream()` (or the higher-level
67
+ `body.json()` / `text()` that packages expose):
68
+
69
+ ```typescript
70
+ const stream = await binary.stream()
71
+ // consume stream (e.g. stream.toArray() then Buffer.concat)
72
+ ```
73
+
74
+ ---
75
+
76
+ ## How workflows use it
77
+
78
+ Workflows never call `FileSystemClaim` directly. File I/O happens inside the
79
+ **ready-made package activities** that already own the claim — the `http` client
80
+ persists response bodies, jsx render activities write their output — and you
81
+ read the resulting `Binary` (e.g. `await res.body.json()` / `text()`). Your only
82
+ responsibility is that the runtime **registers a provider** (below). See
83
+ **Known consumers** for which package primitives to orchestrate.
84
+
85
+ ---
86
+
87
+ ## Runtime provider
88
+
89
+ The runtime must register a concrete subclass:
90
+
91
+ ```typescript
92
+ { provide: FileSystemClaim, value: new MyFileSystemClaimImpl() }
93
+ ```
94
+
95
+ `MyFileSystemClaimImpl` must extend `FileSystemClaim` and implement `write` and `read`. The README uses `LocalFileSystemClaimImpl` as a **placeholder name** for that implementation; there is no class by that name in this monorepo.
96
+
97
+ ---
98
+
99
+ ## Known consumers in this monorepo
100
+
101
+ These packages depend on `@t4h.framework/fs` and declare `FileSystemClaim`; read their skills/README for full workflow patterns.
102
+
103
+ | Package | Usage |
104
+ |---------|--------|
105
+ | `@t4h.framework/http` | The HTTP activity persists response bodies to `fs` and returns them wrapped in a `Body` — you read them with `res.body.json()` / `text()`. |
106
+ | `@t4h.framework/jsx` | Render activities write their output to `fs` and hand back a `Binary` you consume in the workflow. |
107
+
108
+ Orchestrate these package primitives from your workflow; the `fs` write/read happens inside them.
109
+
110
+ ---
111
+
112
+ ## Testing
113
+
114
+ Test the **workflow** with `TestWorkflowEnvironment` from
115
+ `@t4h.framework/core/testing`, mocking `FileSystemClaim` (plus whatever other
116
+ claims the triggered activities need, e.g. `HttpClientRequestClaim` for an HTTP
117
+ call). See the **framework-workflow-testing** skill for the harness API.
118
+
119
+ ```typescript
120
+ import { Readable } from 'node:stream'
121
+ import { Binary } from '@t4h.framework/core'
122
+ import { TestWorkflowEnvironment, mockClaim } from '@t4h.framework/core/testing'
123
+ import { FileSystemClaim } from '@t4h.framework/fs'
124
+
125
+ class MockBinary extends Binary {
126
+ public readonly contentType: string
127
+ public readonly contentLength: number
128
+
129
+ constructor(private readonly data: Buffer, contentType: string) {
130
+ super()
131
+ this.contentType = contentType
132
+ this.contentLength = data.byteLength
133
+ }
134
+
135
+ public stream() {
136
+ return Readable.from(this.data)
137
+ }
138
+ }
139
+
140
+ // mockImplementation: replay runs the workflow twice, so return a fresh Binary each call.
141
+ const mockWrite = vi.fn().mockImplementation(async (_path: string, readable: Readable) => {
142
+ const chunks = await readable.toArray()
143
+ return new MockBinary(Buffer.concat(chunks), 'application/json')
144
+ })
145
+
146
+ const env = TestWorkflowEnvironment.create({ now: 0 })
147
+
148
+ await env.execute(workflow, input, {
149
+ claims: [
150
+ mockClaim(FileSystemClaim, { write: mockWrite, read: vi.fn() }),
151
+ // ...other claims the workflow's activities need
152
+ ],
153
+ })
154
+ ```
155
+
156
+ Assert `mockWrite` was called with the expected path and body when relevant.
157
+
158
+ ---
159
+
160
+ ## Implementing a custom FileSystemClaim
161
+
162
+ 1. **Extend** `FileSystemClaim` from `@t4h.framework/fs`.
163
+ 2. **Return** a `Binary` subclass (or core-compatible `Binary`) from `write` and `read` with correct `contentType`, `contentLength`, and `stream()`.
164
+ 3. **Accept** `Readable | Buffer` in `write` (match the abstract signature).
165
+ 4. **Register** `{ provide: FileSystemClaim, value: new YourImpl() }` in the runtime (tests use `mockClaim(FileSystemClaim, ...)` instead).
166
+ 5. **Keep paths deterministic** when activities replay — unpredictable temp paths are fine if only `Binary` metadata is serialized and replay re-executes `write`; know your serializer/replay story if `path` is persisted.
167
+
168
+ ---
169
+
170
+ ## App / monorepo checklist
171
+
172
+ 1. Add `"@t4h.framework/fs": "workspace:^"` (or published version) to app `dependencies` when activities use `FileSystemClaim`.
173
+ 2. Ensure **`@t4h.framework/core`** is available (peer of `fs`).
174
+ 3. Register **`FileSystemClaim`** in the runtime or test `claims` array.
175
+ 4. Orchestrate file I/O through the package activities that own `FileSystemClaim` (http, jsx) — workflow code never declares an activity or accesses `this.claims.fs`.
176
+
177
+ ---
178
+
179
+ ## Anti-patterns
180
+
181
+ - Importing from `@t4h.framework/fs` paths other than the package export (`FileSystemClaim` only).
182
+ - Omitting `FileSystemClaim` from providers while using `@t4h.framework/http` or `@t4h.framework/jsx` activities that require `fs`.
183
+ - Assuming `packages/fs` ships a concrete disk/S3 implementation — it does not; implement and register `FileSystemClaim` in your runtime or test harness.
184
+
185
+ ---
186
+
187
+ ## Related skills
188
+
189
+ - `framework-core` — `Claim`, `Binary`, and the `TestWorkflowEnvironment` testing harness.
190
+ - `framework-http` — HTTP activities that persist bodies via `FileSystemClaim`.
191
+ - `framework-jsx` — render activities that write/read via `fs`.
@@ -0,0 +1,7 @@
1
+ import type { Readable } from 'node:stream';
2
+ import type { Binary } from '@t4h.framework/core';
3
+ export declare abstract class ActivityFileSystemClaim {
4
+ abstract write(path: string, readable: Readable | Buffer): Binary | Promise<Binary>;
5
+ abstract read(path: string): Binary | Promise<Binary>;
6
+ }
7
+ //# sourceMappingURL=ActivityFileSystemClaim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityFileSystemClaim.d.ts","sourceRoot":"","sources":["../src/ActivityFileSystemClaim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,8BAAsB,uBAAuB;aAC3B,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAC1B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;aAEX,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAC7D"}
@@ -0,0 +1,3 @@
1
+ export class ActivityFileSystemClaim {
2
+ }
3
+ //# sourceMappingURL=ActivityFileSystemClaim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityFileSystemClaim.js","sourceRoot":"","sources":["../src/ActivityFileSystemClaim.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,uBAAuB;CAO5C"}
@@ -0,0 +1,36 @@
1
+ import { AsyncActivityAwaitable, type Binary, StartWorkflowActivity, SyncActivity, Workflow } from '@t4h.framework/core';
2
+ import type Type from 'typebox';
3
+ import { type ParserFormat } from '../helpers/parsers.js';
4
+ export type FileSplitOptionsBase<TFormat extends ParserFormat> = {
5
+ format: TFormat;
6
+ encoding?: BufferEncoding;
7
+ };
8
+ type FileSplitOptionsLine = FileSplitOptionsBase<'txt' | 'ndjson'> & {
9
+ trimEnd?: boolean;
10
+ };
11
+ type FileSplitOptionsCSV = FileSplitOptionsBase<'csv'> & {
12
+ delimiter?: string;
13
+ };
14
+ type FileSplitOptionsCustom = FileSplitOptionsBase<string> & {
15
+ delimiter?: string;
16
+ trimEnd?: boolean;
17
+ };
18
+ type FileSplitOptions = FileSplitOptionsLine | FileSplitOptionsCSV | FileSplitOptionsCustom;
19
+ export type FileSplitActivityInput = {
20
+ binary: Binary;
21
+ options?: FileSplitOptions;
22
+ };
23
+ export declare class FileSplitActivity extends SyncActivity<readonly [binary: Binary, options?: FileSplitOptions], FileSplitActivityInput, Binary[], Binary[]> {
24
+ private readonly claims;
25
+ toInput(binary: Binary, options?: FileSplitOptions): FileSplitActivityInput;
26
+ run({ binary, options, }: FileSplitActivityInput): Promise<Binary[]>;
27
+ toOutput(binaries: Binary[]): Binary[];
28
+ }
29
+ type BinaryWorkflow = Workflow<Type.TObject<{
30
+ binary: Type.TSchema;
31
+ }>, any>;
32
+ export declare function split(binary: Binary, workflow: BinaryWorkflow, options?: FileSplitOptions & {
33
+ parallel?: boolean;
34
+ }): Promise<AsyncActivityAwaitable<StartWorkflowActivity>[]>;
35
+ export {};
36
+ //# sourceMappingURL=FileSplitActivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSplitActivity.d.ts","sourceRoot":"","sources":["../../src/activities/FileSplitActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,MAAM,EAIX,qBAAqB,EACrB,YAAY,EACZ,QAAQ,EACT,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAG/B,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAElE,MAAM,MAAM,oBAAoB,CAAC,OAAO,SAAS,YAAY,IAAI;IAC/D,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED,KAAK,oBAAoB,GAAG,oBAAoB,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,mBAAmB,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAGD,KAAK,sBAAsB,GAAG,oBAAoB,CAAC,MAAM,CAAC,GAAG;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,gBAAgB,GACjB,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,CAAA;AAE1B,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC3B,CAAA;AAED,qBAAa,iBAAkB,SAAQ,YAAY,CACjD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,EACrD,sBAAsB,EACtB,MAAM,EAAE,EACR,MAAM,EAAE,CACT;IACC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAErB;IAEK,OAAO,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,gBAAgB,GACzB,sBAAsB;IAIZ,GAAG,CAAC,EACf,MAAM,EACN,OAA2B,GAC5B,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAqCtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;CAG9C;AAED,KAAK,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;IAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAA;CAAE,CAAC,EAAE,GAAG,CAAC,CAAA;AAE3E,wBAAsB,KAAK,CACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,4DAgBpD"}
@@ -0,0 +1,46 @@
1
+ import { AsyncActivityAwaitable, Claim, History, startWorkflow, StartWorkflowActivity, SyncActivity, Workflow, } from '@t4h.framework/core';
2
+ import { FileSystemClaim } from '../FileSystemClaim.js';
3
+ import { parsers } from '../helpers/parsers.js';
4
+ export class FileSplitActivity extends SyncActivity {
5
+ claims = new Claim({
6
+ fs: FileSystemClaim,
7
+ });
8
+ toInput(binary, options) {
9
+ return { binary, options };
10
+ }
11
+ async run({ binary, options = { format: 'txt' }, }) {
12
+ const stream = await binary.stream();
13
+ const encoding = options.encoding ?? 'utf8';
14
+ stream.setEncoding(encoding);
15
+ const format = options.format;
16
+ const parser = parsers.get(format);
17
+ if (!parser)
18
+ throw new Error(`Unknown file split format: "${format}"`);
19
+ const delimiter = 'delimiter' in options ? options.delimiter : undefined;
20
+ const trimEnd = 'trimEnd' in options ? options.trimEnd : false;
21
+ const binaries = [];
22
+ let index = 0;
23
+ for await (const record of parser(stream, { encoding, delimiter })) {
24
+ const value = trimEnd ? record.trimEnd() : record;
25
+ if (!value)
26
+ continue;
27
+ binaries.push(await this.claims.fs.write(`lines/${index++}.txt`, Buffer.from(value, encoding)));
28
+ }
29
+ return binaries;
30
+ }
31
+ toOutput(binaries) {
32
+ return binaries;
33
+ }
34
+ }
35
+ export async function split(binary, workflow, options) {
36
+ const binaries = await History.reconciler(FileSplitActivity, binary, options);
37
+ const workflows = [];
38
+ for (const entry of binaries) {
39
+ workflows.push(await startWorkflow(workflow, {
40
+ binary: entry,
41
+ parallel: options?.parallel,
42
+ }));
43
+ }
44
+ return workflows;
45
+ }
46
+ //# sourceMappingURL=FileSplitActivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSplitActivity.js","sourceRoot":"","sources":["../../src/activities/FileSplitActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,KAAK,EACL,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,QAAQ,GACT,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAqB,MAAM,uBAAuB,CAAA;AA+BlE,MAAM,OAAO,iBAAkB,SAAQ,YAKtC;IACkB,MAAM,GAAG,IAAI,KAAK,CAAC;QAClC,EAAE,EAAE,eAAe;KACpB,CAAC,CAAA;IAEK,OAAO,CACZ,MAAc,EACd,OAA0B;QAE1B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,EACf,MAAM,EACN,OAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GACJ;QACvB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAA;QAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAA;QAE3C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QAE5B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAE7B,MAAM,MAAM,GAAG,O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CAAC;QAC7B,SAAS,CAAC,IAAI,CACZ,MAAM,aAAa,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,OAAO,EAAE,QAAQ;SAC5B,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FileSplitActivity.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSplitActivity.spec.d.ts","sourceRoot":"","sources":["../../../src/activities/__tests__/FileSplitActivity.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,167 @@
1
+ import { Readable } from 'node:stream';
2
+ import { Claim } from '@t4h.framework/core';
3
+ import { describe, expect, it, vi } from 'vitest';
4
+ import { FileSystemClaim } from '../../FileSystemClaim.js';
5
+ import { FileSplitActivity, } from '../FileSplitActivity.js';
6
+ function makeBinary(content) {
7
+ const stream = Readable.from([content]);
8
+ const binary = {
9
+ contentType: 'text/plain',
10
+ contentLength: Buffer.byteLength(content),
11
+ stream: () => stream,
12
+ };
13
+ return { binary, stream };
14
+ }
15
+ async function runActivity(input) {
16
+ const write = vi.fn((path, content) => ({ path, content }));
17
+ const binaries = await Claim.run([
18
+ {
19
+ provide: FileSystemClaim,
20
+ value: { write },
21
+ },
22
+ ], () => {
23
+ const activity = new FileSplitActivity();
24
+ return activity.run(input);
25
+ });
26
+ return { binaries, write };
27
+ }
28
+ describe('BinarySplitActivity', () => {
29
+ describe('toInput', () => {
30
+ it('wraps the binary and options into the activity input', () => {
31
+ const activity = new FileSplitActivity();
32
+ const { binary } = makeBinary('');
33
+ const options = { format: 'csv', delimiter: ';' };
34
+ const input = activity.toInput(binary, options);
35
+ expect(input).toEqual({ binary, options });
36
+ });
37
+ it('leaves options undefined when none are provided', () => {
38
+ const activity = new FileSplitActivity();
39
+ const { binary } = makeBinary('');
40
+ const input = activity.toInput(binary);
41
+ expect(input).toEqual({ binary, options: undefined });
42
+ });
43
+ });
44
+ describe('toOutput', () => {
45
+ it('returns the binaries unchanged', () => {
46
+ const activity = new FileSplitActivity();
47
+ const binaries = [{}, {}];
48
+ expect(activity.toOutput(binaries)).toBe(binaries);
49
+ });
50
+ });
51
+ describe('run (txt / ndjson)', () => {
52
+ it('writes one file per non-empty line using an incrementing index', async () => {
53
+ const { binary } = makeBinary('foo\nbar\nbaz\n');
54
+ const { binaries, write } = await runActivity({ binary });
55
+ expect(write).toHaveBeenCalledTimes(3);
56
+ expect(write).toHaveBeenNthCalledWith(1, 'lines/0.txt', Buffer.from('foo', 'utf8'));
57
+ expect(write).toHaveBeenNthCalledWith(2, 'lines/1.txt', Buffer.from('bar', 'utf8'));
58
+ expect(write).toHaveBeenNthCalledWith(3, 'lines/2.txt', Buffer.from('baz', 'utf8'));
59
+ expect(binaries).toHaveLength(3);
60
+ });
61
+ it('defaults to the txt format when no options are provided', async () => {
62
+ const { binary } = makeBinary('only-line\n');
63
+ const { write } = await runActivity({ binary });
64
+ expect(write).toHaveBeenCalledOnce();
65
+ expect(write).toHaveBeenCalledWith('lines/0.txt', Buffer.from('only-line', 'utf8'));
66
+ });
67
+ it('treats ndjson identically to txt (line based)', async () => {
68
+ const { binary } = makeBinary('{"a":1}\n{"b":2}\n');
69
+ const { write } = await runActivity({
70
+ binary,
71
+ options: { format: 'ndjson' },
72
+ });
73
+ expect(write).toHaveBeenNthCalledWith(1, 'lines/0.txt', Buffer.from('{"a":1}', 'utf8'));
74
+ expect(write).toHaveBeenNthCalledWith(2, 'lines/1.txt', Buffer.from('{"b":2}', 'utf8'));
75
+ });
76
+ it('skips truly empty lines but keeps whitespace-only lines verbatim by default (trimEnd off)', async () => {
77
+ const { binary } = makeBinary('foo\n\n \nbar\n');
78
+ const { write } = await runActivity({ binary });
79
+ // With trimEnd off, only the empty line is dropped; ' ' is written as-is.
80
+ expect(write).toHaveBeenCalledTimes(3);
81
+ expect(write).toHaveBeenNthCalledWith(1, 'lines/0.txt', Buffer.from('foo', 'utf8'));
82
+ expect(write).toHaveBeenNthCalledWith(2, 'lines/1.txt', Buffer.from(' ', 'utf8'));
83
+ expect(write).toHaveBeenNthCalledWith(3, 'lines/2.txt', Buffer.from('bar', 'utf8'));
84
+ });
85
+ it('trims trailing whitespace and drops now-empty lines when trimEnd is enabled', async () => {
86
+ const { binary } = makeBinary(' keep-leading \n \n');
87
+ const { write } = await runActivity({
88
+ binary,
89
+ options: { format: 'txt', trimEnd: true },
90
+ });
91
+ // Leading whitespace is preserved; the whitespace-only line trims to '' and is skipped.
92
+ expect(write).toHaveBeenCalledOnce();
93
+ expect(write).toHaveBeenCalledWith('lines/0.txt', Buffer.from(' keep-leading', 'utf8'));
94
+ });
95
+ it('returns an empty array when the stream has no usable lines', async () => {
96
+ const { binary } = makeBinary('\n\n');
97
+ const { binaries, write } = await runActivity({ binary });
98
+ expect(binaries).toEqual([]);
99
+ expect(write).not.toHaveBeenCalled();
100
+ });
101
+ it('sets the default utf8 encoding on the stream', async () => {
102
+ const { binary, stream } = makeBinary('foo\n');
103
+ const setEncoding = vi.spyOn(stream, 'setEncoding');
104
+ await runActivity({ binary });
105
+ expect(setEncoding).toHaveBeenCalledWith('utf8');
106
+ });
107
+ it('honors a custom encoding on both the stream and the written buffer', async () => {
108
+ const { binary, stream } = makeBinary('foo\n');
109
+ const setEncoding = vi.spyOn(stream, 'setEncoding');
110
+ const { write } = await runActivity({
111
+ binary,
112
+ options: { format: 'txt', encoding: 'latin1' },
113
+ });
114
+ expect(setEncoding).toHaveBeenCalledWith('latin1');
115
+ expect(write).toHaveBeenCalledWith('lines/0.txt', Buffer.from('foo', 'latin1'));
116
+ });
117
+ });
118
+ describe('run (csv)', () => {
119
+ it('parses each row and writes it as a serialized JSON object', async () => {
120
+ const { binary } = makeBinary('name,age\nalice,30\nbob,25\n');
121
+ const { binaries, write } = await runActivity({
122
+ binary,
123
+ options: { format: 'csv' },
124
+ });
125
+ expect(write).toHaveBeenCalledTimes(2);
126
+ expect(write).toHaveBeenNthCalledWith(1, 'lines/0.txt', Buffer.from(JSON.stringify({ name: 'alice', age: '30' }), 'utf8'));
127
+ expect(write).toHaveBeenNthCalledWith(2, 'lines/1.txt', Buffer.from(JSON.stringify({ name: 'bob', age: '25' }), 'utf8'));
128
+ expect(binaries).toHaveLength(2);
129
+ });
130
+ it('honors a custom delimiter when parsing rows', async () => {
131
+ const { binary } = makeBinary('a;b\n1;2\n');
132
+ const { write } = await runActivity({
133
+ binary,
134
+ options: { format: 'csv', delimiter: ';' },
135
+ });
136
+ // A wrong delimiter would collapse the two columns into a single key.
137
+ expect(write).toHaveBeenCalledOnce();
138
+ expect(write).toHaveBeenCalledWith('lines/0.txt', Buffer.from(JSON.stringify({ a: '1', b: '2' }), 'utf8'));
139
+ });
140
+ it('writes nothing when the csv contains only a header row', async () => {
141
+ const { binary } = makeBinary('a,b\n');
142
+ const { binaries, write } = await runActivity({
143
+ binary,
144
+ options: { format: 'csv' },
145
+ });
146
+ expect(binaries).toEqual([]);
147
+ expect(write).not.toHaveBeenCalled();
148
+ });
149
+ it('applies a custom encoding to both the stream and the serialized buffer', async () => {
150
+ const { binary, stream } = makeBinary('a,b\n1,2\n');
151
+ const setEncoding = vi.spyOn(stream, 'setEncoding');
152
+ const { write } = await runActivity({
153
+ binary,
154
+ options: { format: 'csv', encoding: 'latin1' },
155
+ });
156
+ expect(setEncoding).toHaveBeenCalledWith('latin1');
157
+ expect(write).toHaveBeenCalledWith('lines/0.txt', Buffer.from(JSON.stringify({ a: '1', b: '2' }), 'latin1'));
158
+ });
159
+ });
160
+ describe('run (claims)', () => {
161
+ it('throws when no FileSystemClaim provider is registered', async () => {
162
+ const { binary } = makeBinary('foo\n');
163
+ await expect(Claim.run([], () => new FileSplitActivity().run({ binary }))).rejects.toThrow(/FileSystemClaim/);
164
+ });
165
+ });
166
+ });
167
+ //# sourceMappingURL=FileSplitActivity.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSplitActivity.spec.js","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+ //# sourceMappingURL=csv-reader.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-reader.spec.d.ts","sourceRoot":"","sources":["../../../src/helpers/__tests__/csv-reader.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,60 @@
1
+ import { Readable } from 'node:stream';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { csvReader } from '../csv-reader.js';
4
+ async function collect(iterable) {
5
+ const records = [];
6
+ for await (const record of iterable)
7
+ records.push(record);
8
+ return records;
9
+ }
10
+ describe('csvReader', () => {
11
+ it('parses rows into objects keyed by the header row', async () => {
12
+ const stream = Readable.from(['name,age\nalice,30\nbob,25\n']);
13
+ const records = await collect(csvReader(stream));
14
+ expect(records).toEqual([
15
+ JSON.stringify({ name: 'alice', age: '30' }),
16
+ JSON.stringify({ name: 'bob', age: '25' }),
17
+ ]);
18
+ });
19
+ it('uses comma as the default delimiter', async () => {
20
+ const stream = Readable.from(['a,b\n1,2\n']);
21
+ const records = await collect(csvReader(stream));
22
+ expect(records).toEqual([JSON.stringify({ a: '1', b: '2' })]);
23
+ });
24
+ it('respects a custom delimiter', async () => {
25
+ const stream = Readable.from(['a;b\n1;2\n']);
26
+ const records = await collect(csvReader(stream, { delimiter: ';' }));
27
+ expect(records).toEqual([JSON.stringify({ a: '1', b: '2' })]);
28
+ });
29
+ it('tolerates rows with a mismatched column count (relax_column_count)', async () => {
30
+ const stream = Readable.from(['a,b\n1\n2,3,4\n']);
31
+ const records = await collect(csvReader(stream, { delimiter: ',' }));
32
+ expect(records).toEqual([
33
+ JSON.stringify({ a: '1' }),
34
+ JSON.stringify({ a: '2', b: '3' }),
35
+ ]);
36
+ });
37
+ it('yields nothing for an empty stream', async () => {
38
+ const stream = Readable.from(['']);
39
+ const records = await collect(csvReader(stream));
40
+ expect(records).toEqual([]);
41
+ });
42
+ it('yields nothing when only the header row is present', async () => {
43
+ const stream = Readable.from(['a,b\n']);
44
+ const records = await collect(csvReader(stream));
45
+ expect(records).toEqual([]);
46
+ });
47
+ it('sets the stream encoding when the encoding option is provided', async () => {
48
+ const stream = Readable.from(['a,b\n1,2\n']);
49
+ const setEncoding = vi.spyOn(stream, 'setEncoding');
50
+ await collect(csvReader(stream, { encoding: 'latin1' }));
51
+ expect(setEncoding).toHaveBeenCalledWith('latin1');
52
+ });
53
+ it('does not touch the stream encoding when no encoding option is provided', async () => {
54
+ const stream = Readable.from(['a,b\n1,2\n']);
55
+ const setEncoding = vi.spyOn(stream, 'setEncoding');
56
+ await collect(csvReader(stream));
57
+ expect(setEncoding).not.toHaveBeenCalled();
58
+ });
59
+ });
60
+ //# sourceMappingURL=csv-reader.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-reader.spec.js","sourceRoot":"","sources":["../../../src/helpers/__tests__/csv-reader.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,KAAK,UAAU,OAAO,CAAI,QAA0B;IAClD,MAAM,OAAO,GAAQ,EAAE,CAAA;IAEvB,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAEzD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAA;QAE9D,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QAEhD,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YACtB,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AAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;QACtF,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA;QAC5C,MAAM,WAAW,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;QAEnD,MAAM,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QAEhC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IAC5C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { Readable } from 'node:stream';
2
+ interface Options {
3
+ delimiter?: string;
4
+ encoding?: BufferEncoding;
5
+ }
6
+ export declare function csvReader(stream: Readable, options?: Options): AsyncGenerator<string, void, unknown>;
7
+ export {};
8
+ //# sourceMappingURL=csv-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-reader.d.ts","sourceRoot":"","sources":["../../src/helpers/csv-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C,UAAU,OAAO;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,wBAAuB,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,yCAcnE"}
@@ -0,0 +1,14 @@
1
+ import { parse } from 'csv-parse';
2
+ export async function* csvReader(stream, options) {
3
+ if (options?.encoding)
4
+ stream.setEncoding(options.encoding);
5
+ const reader = stream.pipe(parse({
6
+ delimiter: options?.delimiter,
7
+ columns: true,
8
+ relax_column_count: true,
9
+ }));
10
+ for await (const record of reader) {
11
+ yield JSON.stringify(record);
12
+ }
13
+ }
14
+ //# sourceMappingURL=csv-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv-reader.js","sourceRoot":"","sources":["../../src/helpers/csv-reader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAOjC,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,CAAC,MAAgB,EAAE,OAAiB;IAClE,IAAI,OAAO,EAAE,QAAQ;QAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAE3D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CACxB,KAAK,CAAC;QACJ,SAAS,EAAE,OAAO,EAAE,SAAS;QAC7B,OAAO,EAAE,IAAI;QACb,kBAAkB,EAAE,IAAI;KACzB,CAAC,CACH,CAAA;IAED,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Readable } from 'node:stream';
2
+ export type Parser = (stream: Readable, options: {
3
+ encoding: BufferEncoding;
4
+ delimiter?: string;
5
+ }) => AsyncIterable<string>;
6
+ export type ParserFormat = 'txt' | 'ndjson' | 'csv' | string;
7
+ export declare const parsers: Map<string, Parser>;
8
+ export declare function registerParser(name: ParserFormat, parser: Parser): void;
9
+ //# sourceMappingURL=parsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/helpers/parsers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C,MAAM,MAAM,MAAM,GAAG,CACnB,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KACtD,aAAa,CAAC,MAAM,CAAC,CAAA;AAE1B,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAA;AAE5D,eAAO,MAAM,OAAO,qBAQlB,CAAA;AAEF,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvE"}
@@ -0,0 +1,14 @@
1
+ import { createInterface } from 'node:readline';
2
+ import { csvReader } from './csv-reader.js';
3
+ export const parsers = new Map([
4
+ ['txt', stream => createInterface({ input: stream, crlfDelay: Infinity })],
5
+ ['ndjson', stream => createInterface({ input: stream, crlfDelay: Infinity })],
6
+ [
7
+ 'csv',
8
+ (stream, { encoding, delimiter }) => csvReader(stream, { encoding, delimiter }),
9
+ ],
10
+ ]);
11
+ export function registerParser(name, parser) {
12
+ parsers.set(name, parser);
13
+ }
14
+ //# sourceMappingURL=parsers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/helpers/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAS3C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAuB;IACnD,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E;QACE,KAAK;QACL,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,CAClC,SAAS,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;KAC7C;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,cAAc,CAAC,IAAkB,EAAE,MAAc;IAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FileSystemClaim } from '../FileSystemClaim.js';
2
+ export declare function mockFileSystemClaim(implementation?: Partial<FileSystemClaim>): import("@t4h.framework/core").ClaimProvider<FileSystemClaim>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAmBvD,wBAAgB,mBAAmB,CACjC,cAAc,GAAE,OAAO,CAAC,eAAe,CAAM,gEAiB9C"}
@@ -0,0 +1,32 @@
1
+ import { Readable } from 'node:stream';
2
+ import { Binary } from '@t4h.framework/core';
3
+ import { mockClaim } from '@t4h.framework/core/testing';
4
+ import { FileSystemClaim } from '../FileSystemClaim.js';
5
+ class MemoryBinary extends Binary {
6
+ data;
7
+ contentType;
8
+ constructor(data, contentType) {
9
+ super();
10
+ this.data = data;
11
+ this.contentType = contentType;
12
+ }
13
+ get contentLength() {
14
+ return this.data.byteLength;
15
+ }
16
+ stream() {
17
+ return Readable.from(this.data);
18
+ }
19
+ }
20
+ export function mockFileSystemClaim(implementation = {}) {
21
+ return mockClaim(FileSystemClaim, {
22
+ write: async (_filepath, readable) => {
23
+ const chunks = [];
24
+ for await (const chunk of readable)
25
+ chunks.push(Buffer.from(chunk));
26
+ return new MemoryBinary(Buffer.concat(chunks), 'application/octet-stream');
27
+ },
28
+ read: async (filepath) => new MemoryBinary(Buffer.from(filepath), 'application/octet-stream'),
29
+ ...implementation,
30
+ });
31
+ }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../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t4h.framework/fs",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "File system module for the T4H Framework",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/fs",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -20,7 +20,8 @@
20
20
  "types": "./dist/fs.d.ts",
21
21
  "files": [
22
22
  "dist",
23
- "LICENSE"
23
+ "LICENSE",
24
+ ".ai"
24
25
  ],
25
26
  "scripts": {
26
27
  "build": "tsc --project tsconfig.build.json",
@@ -28,14 +29,12 @@
28
29
  "lint": "eslint .",
29
30
  "prepublishOnly": "yarn build"
30
31
  },
31
- "dependencies": {
32
- "@t4h.framework/core": "^0.3.0"
33
- },
34
32
  "devDependencies": {
33
+ "@t4h.framework/core": "^0.8.0",
35
34
  "typescript": "^5.9.3"
36
35
  },
37
36
  "peerDependencies": {
38
- "@t4h.framework/core": "^0.3.0"
37
+ "@t4h.framework/core": "^0.8.0"
39
38
  },
40
39
  "packageManager": "yarn@4.12.0",
41
40
  "engines": {