@t4h.framework/transforms 0.2.10 → 0.2.12

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.
@@ -1,123 +1,71 @@
1
1
  ---
2
2
  name: framework-transforms
3
3
  description: >-
4
- Guides correct use of @t4h.framework/transforms in workflows: converting a
5
- JSON document (an array of records, possibly nested inside an envelope) into
6
- NDJSON so it can be fanned out with `split` from @t4h.framework/fs. Use
7
- whenever a workflow receives a JSON batch file that is NOT NDJSON — an API
8
- response or uploaded file shaped like `{ "a": { "b": [ ...records ] } }` —
9
- and each record must become its own workflow run, or when the user mentions
10
- converting JSON to NDJSON, splitting a JSON array, a records envelope, or
11
- the symbols `json`, `Json`, `toNDJson`, `JsonToNDJsonActivity`. Prefer this
12
- skill over parsing JSON in workflow code or hand-rolling delimiters over
4
+ Guides the use of @t4h.framework/transforms in T4H Framework workflows:
5
+ json(binary, { path }).toNDJson() changes a JSON document (an array of
6
+ records, possibly inside an envelope such as { "a": { "b": [ ... ] } }) into
7
+ NDJSON, so that split from @t4h.framework/fs starts one workflow for each
8
+ record. Use when a workflow receives a JSON batch file that is not NDJSON
9
+ (an API response or an uploaded file), when each record must become its own
10
+ workflow run, or when the user mentions JSON to NDJSON, splitting a JSON
11
+ array, a records envelope, json, Json, toNDJson or JsonToNDJsonActivity.
12
+ Use it instead of JSON.parse in workflow code or a hand-made delimiter over
13
13
  JSON text.
14
14
  ---
15
15
 
16
16
  # @t4h.framework/transforms
17
17
 
18
- Format conversions for workflow files. Package path:
19
- `framework/packages/transforms`. Peer dependencies: `@t4h.framework/core`,
20
- `@t4h.framework/fs`.
18
+ `json(binary, options)` only keeps the source and the options. The work runs
19
+ when you call `.toNDJson()`, which is an activity and returns the `Binary` of
20
+ a new NDJSON file.
21
21
 
22
- ## Import surface
22
+ ## Fan out a JSON batch file
23
23
 
24
- ```typescript
25
- import { json, Json, JsonToNDJsonActivity } from '@t4h.framework/transforms'
26
- ```
27
-
28
- `json(binary, options)` is the entry point: it captures the source document
29
- and returns a `Json` value whose `.toX()` methods run the actual transform —
30
- today `toNDJson()`, each future target (`toCsv`, ...) being one more method.
31
- Only the `.toX()` call does work; `json(...)` itself is synchronous and free.
32
-
33
- ## Workflow usage
34
-
35
- The canonical pipeline — download a JSON batch file, normalize it to NDJSON,
36
- fan it out one workflow per record:
24
+ 1. Get the source as a `Binary` (for example `response.body.binary` from
25
+ `@t4h.framework/http`).
26
+ 2. Call `json(binary, { path }).toNDJson()`. `path` is a dot path to the array.
27
+ Omit it when the root is the array.
28
+ 3. Give the result to `split` with `Split.line()`.
29
+ 4. In the child workflow, the input is one JSON line: use `Type.String()` as
30
+ the schema and `JSON.parse` it.
37
31
 
38
32
  ```typescript
39
33
  import { split, Split } from '@t4h.framework/fs'
40
- import { request } from '@t4h.framework/http'
41
34
  import { json } from '@t4h.framework/transforms'
42
35
 
43
- const main = new Workflow(inputSchema, async ({ url }) => {
44
- const response = await request({ url })
45
-
46
- // { "registros": { "registro": [ {...}, {...} ] } }
47
- const ndjson = await json(response.body.binary, {
48
- path: 'registros.registro',
49
- }).toNDJson()
36
+ const ndjson = await json(response.body.binary, {
37
+ path: 'registros.registro',
38
+ }).toNDJson()
50
39
 
51
- return await split(ndjson, processRecord, { delimiter: Split.line() })
52
- })
53
- ```
54
-
55
- Each child workflow receives one record as a raw JSON line (`Type.String()`
56
- input, `JSON.parse` it) — see the **framework-fs-split** skill for the
57
- `split`/`join` side.
58
-
59
- ## `json(binary, options).toNDJson()`
60
-
61
- ```typescript
62
- function json(binary: Binary, options?: JsonOptions): Json
63
- Json.prototype.toNDJson(): Promise<Binary>
40
+ return await split(ndjson, processRecord, { delimiter: Split.line() })
64
41
  ```
65
42
 
66
- `toNDJson()` rewrites the document as NDJSON — one line per element of the
67
- target array — and resolves with the `Binary` of the new file. Only that
68
- reference reaches workflow history; the content never does.
69
-
70
- | Option | Default | Behavior |
71
- | ---------- | ------- | ---------------------------------------------------------------------------------------------- |
72
- | `path` | — | Dot path to the array of records (`'registros.registro'`). Omit when the document root is the array. |
73
- | `encoding` | `utf8` | Encoding used to decode the source binary before parsing. |
74
-
75
- Behaviors you can rely on:
76
-
77
- - **Formatting-agnostic.** Minified, pretty-printed, arbitrary whitespace and
78
- BOM-prefixed documents all produce identical output. Values containing
79
- `"},{"`, escaped quotes, or nested structures are preserved exactly —
80
- records are re-serialized, never text-sliced.
81
- - **Any element type.** Array elements may be objects, arrays or scalars;
82
- each becomes one `JSON.stringify`'d line. An empty array yields an empty
83
- (zero-line) file, which `split` resolves as an empty batch.
84
- - **Fail-fast on shape mismatches.** `toNDJson()` rejects with a `TypeError`
85
- when the `path` cannot be resolved or does not land on an array, and with a
86
- `SyntaxError` on invalid JSON. There is no partial output.
87
-
88
- ## Limits
89
-
90
- The source document is parsed **in memory** inside the activity — fits files
91
- up to tens of megabytes comfortably. For gigabyte-scale JSON a streaming
92
- scanner would be needed; this package does not provide one today.
93
-
94
- ## Runtime requirements
95
-
96
- - Claim provider: `FileSystemClaim` (from `@t4h.framework/fs`).
97
- - Production whitelist: register `JsonToNDJsonActivity` via
98
- `runtime.addActivity`.
99
-
100
- ## Anti-patterns
101
-
102
- - **Parsing the batch file in workflow code.** `response.body.json()` is for
103
- small API payloads: on a batch file it re-reads and re-parses the whole
104
- document on every replay and holds it in workflow memory. Normalize with
105
- `toNDJson()` and fan out with `split` instead.
106
- - **Hand-rolling delimiters over JSON text.** `Split.char('},{')` over a JSON
107
- document breaks on formatting changes and on values containing structural
108
- characters. JSON is parsed, never text-split.
109
- - **Expecting records in the workflow.** The transform resolves with a
110
- `Binary` reference; records only materialize inside each child workflow run
111
- started by `split`.
112
- - **Iterating records and calling `startWorkflow` per item.** That pushes N
113
- entries into parent history; `split` keeps it O(1). See
114
- **framework-fs-split**.
115
-
116
- ## Related skills
117
-
118
- - `framework-fs-split` — `split`/`join`/`read`: fanning the NDJSON out into a
119
- batch of workflows and folding results back.
120
- - `framework-http` — downloading the source file; `response.body.binary` is
121
- the natural input to `json(...)`.
122
- - `framework-workflow-testing` — the harness for testing workflows that use
123
- this pipeline.
43
+ ## Traps
44
+
45
+ - Do not `JSON.parse` a batch file or call `response.body.json()` on it in
46
+ workflow code. The workflow keeps the full document in memory and parses it
47
+ again on each replay.
48
+ - Do not cut JSON text with `Split.char('},{')`. It breaks when the format
49
+ changes or when a value contains `},{`.
50
+ - The workflow gets a `Binary` reference, not records. Records exist only in
51
+ the child workflows that `split` starts.
52
+ - Do not loop over records and start one workflow for each. Use `split`.
53
+ - `toNDJson()` rejects with `TypeError` when `path` does not resolve or does
54
+ not point to an array, and with `SyntaxError` when the JSON is not valid.
55
+ - An empty array gives an empty file. `split` gives an empty batch.
56
+ - The runtime must give a `FileSystemClaim` (from `@t4h.framework/fs`),
57
+ because the activity writes the output file through it.
58
+
59
+ ## Test
60
+
61
+ Test the workflow with `TestWorkflowEnvironment` from
62
+ `@t4h.framework/core/testing`. Give a `FileSystemClaim` with `mockClaim`.
63
+ `toNDJson()` reads the source with `binary.stream()` and writes the output with
64
+ `fs.write`.
65
+
66
+ ## Reference
67
+
68
+ - Guide, options and guarantees:
69
+ https://tech4humans-brasil.github.io/framework/transforms/
70
+ - `split`: https://tech4humans-brasil.github.io/framework/fs/split
71
+ - Types: `node_modules/@t4h.framework/transforms/dist/json.d.ts`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @t4h.framework/transforms
2
2
 
3
+ ## 0.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#257](https://github.com/tech4humans-brasil/framework/pull/257) [`586bfb4`](https://github.com/tech4humans-brasil/framework/commit/586bfb4663f4a478527ee0c8db360603f034d615) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The transforms README is short and points to the docs site. The README and the skill no longer say that the source document is parsed in memory, because the transform reads it as a stream.
8
+
9
+ ## 0.2.11
10
+
11
+ ### Patch Changes
12
+
13
+ - [#241](https://github.com/tech4humans-brasil/framework/pull/241) [`f6b8454`](https://github.com/tech4humans-brasil/framework/commit/f6b845484d22e7c8e7240fe2e113f1cdea7c8ce3) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds seven rules to `@t4h.framework/core/eslint` and turns them on in `configs.recommended`:
14
+ - `no-io-in-workflow` reports `fetch` and calls to network, file, database and mail modules in a workflow and in the `constructor`, `toInput` and `toOutput` of an activity. It also reports `zlib` and `stream` calls there, because they work on the content in memory on each replay.
15
+ - `no-binary-subclass` reports a class that extends `Binary`.
16
+ - `no-framework-activity-in-app` reports `new` and `extends` on an activity of a framework package other than the core.
17
+ - `no-testing-import-in-source` reports an import of a `@t4h.framework/<package>/testing` entry out of a test file.
18
+ - `require-workflow-id` reports a `Workflow` with no `id`.
19
+ - `no-secret-to-string` reports a `Secret` that becomes a string.
20
+ - `no-literal-secret-in-authorization` reports a string literal in the `secret` or `clientSecret` field of an `Authorization`.
21
+
22
+ The package skills now name these rules in place of the text that the rules enforce. The docs and skills give each `Workflow` an `id`, read the HMAC secret from `EnvDesign`, and do not document a custom HTTP activity.
23
+
24
+ - [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
25
+
3
26
  ## 0.2.10
4
27
 
5
28
  ## 0.2.9
package/README.md CHANGED
@@ -1,43 +1,30 @@
1
1
  # @t4h.framework/transforms
2
2
 
3
- Data transform activities for workflows.
3
+ Durable data transforms for workflows. Today it has one transform:
4
+ `json(...).toNDJson()` changes a JSON document into NDJSON (one record on each
5
+ line), so that `split` from `@t4h.framework/fs` can start one workflow for
6
+ each record.
4
7
 
5
- ## JSON to NDJSON
8
+ ## Installation
6
9
 
7
- Rewrites a JSON document into NDJSON — one record per line — so it can be
8
- consumed by line-oriented activities such as `split` from
9
- `@t4h.framework/fs`. The transform is formatting-agnostic: minified,
10
- pretty-printed and BOM-prefixed documents all produce the same output.
10
+ ```bash
11
+ npm install @t4h.framework/transforms
12
+ ```
13
+
14
+ Peer dependencies: `@t4h.framework/core`, `@t4h.framework/fs`.
15
+
16
+ ## Usage
11
17
 
12
18
  ```typescript
13
19
  import { split, Split } from '@t4h.framework/fs'
14
20
  import { json } from '@t4h.framework/transforms'
15
21
 
16
- // { "registros": { "registro": [{ ... }, { ... }] } }
17
- const ndjson = await json(response.body.binary, {
18
- path: 'registros.registro',
19
- }).toNDJson()
22
+ // file: { "records": { "record": [{ ... }, { ... }] } }
23
+ const ndjson = await json(file, { path: 'records.record' }).toNDJson()
20
24
 
21
- const batch = await split(ndjson, registroWorkflow, {
22
- delimiter: Split.line(),
23
- })
25
+ await split(ndjson, processRecord, { delimiter: Split.line() })
24
26
  ```
25
27
 
26
- Omit `path` when the document root is the array itself. `json` captures the
27
- source document and its options; each `.toX()` method runs a dedicated
28
- transform activity, leaving room for other targets (`toCsv`, ...) later.
29
-
30
- ### Options
28
+ ## Documentation
31
29
 
32
- | Option | Default | Description |
33
- | ---------- | ------- | -------------------------------------------------- |
34
- | `path` | — | Dot path to the array of records (`a.b.c`) |
35
- | `encoding` | `utf8` | Encoding used to decode the source binary |
36
-
37
- ### Limits
38
-
39
- The source document is parsed in memory, so this activity fits files up to
40
- tens of megabytes. Only the resulting `Binary` reference crosses the
41
- activity boundary — the content itself never enters the workflow history.
42
-
43
- Peer dependencies: `@t4h.framework/core`, `@t4h.framework/fs`.
30
+ https://tech4humans-brasil.github.io/framework/transforms/
@@ -27,6 +27,10 @@ export class JsonToNDJsonActivity extends SyncActivity {
27
27
  return output;
28
28
  }
29
29
  }
30
+ const BYTE_ORDER_MARK = 0xfeff;
31
+ function stripByteOrderMark(text) {
32
+ return text.charCodeAt(0) === BYTE_ORDER_MARK ? text.slice(1) : text;
33
+ }
30
34
  async function* decode(source, encoding) {
31
35
  const decoder = new StringDecoder(encoding);
32
36
  let first = true;
@@ -34,9 +38,7 @@ async function* decode(source, encoding) {
34
38
  let text = decoder.write(chunk);
35
39
  if (first && text) {
36
40
  first = false;
37
- // external producers often prepend a byte order mark
38
- if (text.charCodeAt(0) === 0xfeff)
39
- text = text.slice(1);
41
+ text = stripByteOrderMark(text);
40
42
  }
41
43
  if (text)
42
44
  yield text;
@@ -45,6 +47,19 @@ async function* decode(source, encoding) {
45
47
  if (rest)
46
48
  yield rest;
47
49
  }
50
+ function opensContainer(token) {
51
+ return token.name === 'startObject' || token.name === 'startArray';
52
+ }
53
+ function closesContainer(token) {
54
+ return token.name === 'endObject' || token.name === 'endArray';
55
+ }
56
+ function nestingDelta(token) {
57
+ if (opensContainer(token))
58
+ return 1;
59
+ if (closesContainer(token))
60
+ return -1;
61
+ return 0;
62
+ }
48
63
  function navigate(path) {
49
64
  const segments = path ? path.split('.') : [];
50
65
  let mode = 'root';
@@ -55,67 +70,72 @@ function navigate(path) {
55
70
  ? `Expected an array at "${path}" in the JSON document`
56
71
  : 'Expected the JSON document root to be an array');
57
72
  const unresolvable = (length) => new TypeError(`Could not resolve "${segments.slice(0, length).join('.')}" in the JSON document`);
73
+ const startForwarding = (token) => {
74
+ if (token.name !== 'startArray')
75
+ throw notArray();
76
+ mode = 'forward';
77
+ depth = 1;
78
+ return token;
79
+ };
80
+ const onRoot = (token) => {
81
+ if (segments.length === 0)
82
+ return startForwarding(token);
83
+ if (token.name !== 'startObject')
84
+ throw unresolvable(1);
85
+ mode = 'key';
86
+ return none;
87
+ };
88
+ const onKey = (token) => {
89
+ if (token.name === 'endObject')
90
+ throw index === segments.length - 1 ? notArray() : unresolvable(index + 2);
91
+ matches = token.name === 'keyValue' && token.value === segments[index];
92
+ mode = 'value';
93
+ return none;
94
+ };
95
+ const skipValue = (token) => {
96
+ if (!opensContainer(token)) {
97
+ mode = 'key';
98
+ return none;
99
+ }
100
+ mode = 'skip';
101
+ depth = 1;
102
+ return none;
103
+ };
104
+ const onValue = (token) => {
105
+ if (!matches)
106
+ return skipValue(token);
107
+ if (index === segments.length - 1)
108
+ return startForwarding(token);
109
+ if (token.name !== 'startObject')
110
+ throw unresolvable(index + 2);
111
+ index += 1;
112
+ mode = 'key';
113
+ return none;
114
+ };
115
+ const onSkip = (token) => {
116
+ depth += nestingDelta(token);
117
+ if (depth === 0)
118
+ mode = 'key';
119
+ return none;
120
+ };
121
+ const onForward = (token) => {
122
+ depth += nestingDelta(token);
123
+ if (depth === 0)
124
+ mode = 'done';
125
+ return token;
126
+ };
58
127
  return token => {
59
128
  switch (mode) {
60
129
  case 'root':
61
- if (segments.length === 0) {
62
- if (token.name !== 'startArray')
63
- throw notArray();
64
- mode = 'forward';
65
- depth = 1;
66
- return token;
67
- }
68
- if (token.name !== 'startObject')
69
- throw unresolvable(1);
70
- mode = 'key';
71
- return none;
130
+ return onRoot(token);
72
131
  case 'key':
73
- if (token.name === 'endObject')
74
- throw index === segments.length - 1
75
- ? notArray()
76
- : unresolvable(index + 2);
77
- matches = token.name === 'keyValue' && token.value === segments[index];
78
- mode = 'value';
79
- return none;
132
+ return onKey(token);
80
133
  case 'value':
81
- if (!matches) {
82
- if (token.name === 'startObject' || token.name === 'startArray') {
83
- mode = 'skip';
84
- depth = 1;
85
- }
86
- else {
87
- mode = 'key';
88
- }
89
- return none;
90
- }
91
- if (index === segments.length - 1) {
92
- if (token.name !== 'startArray')
93
- throw notArray();
94
- mode = 'forward';
95
- depth = 1;
96
- return token;
97
- }
98
- if (token.name !== 'startObject')
99
- throw unresolvable(index + 2);
100
- index += 1;
101
- mode = 'key';
102
- return none;
134
+ return onValue(token);
103
135
  case 'skip':
104
- if (token.name === 'startObject' || token.name === 'startArray')
105
- depth += 1;
106
- else if (token.name === 'endObject' || token.name === 'endArray')
107
- depth -= 1;
108
- if (depth === 0)
109
- mode = 'key';
110
- return none;
136
+ return onSkip(token);
111
137
  case 'forward':
112
- if (token.name === 'startObject' || token.name === 'startArray')
113
- depth += 1;
114
- else if (token.name === 'endObject' || token.name === 'endArray')
115
- depth -= 1;
116
- if (depth === 0)
117
- mode = 'done';
118
- return token;
138
+ return onForward(token);
119
139
  case 'done':
120
140
  return none;
121
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"JsonToNDJsonActivity.js","sourceRoot":"","sources":["../../src/activities/JsonToNDJsonActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAe,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAc,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EACL,WAAW,GAEZ,MAAM,uCAAuC,CAAA;AAS9C,MAAM,OAAO,oBAAqB,SAAQ,YAKzC;IACkB,MAAM,GAAG,IAAI,KAAK,CAAC;QAClC,EAAE,EAAE,eAAe;KACpB,CAAC,CAAA;IAEK,OAAO,CACZ,MAAc,EACd,OAAoB;QAEpB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,EACf,MAAM,EACN,OAAO,GACmB;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAA;QAE3C,MAAM,OAAO,GAAG,KAAK,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;YACtD,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;YACjD,QA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;gBACT,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,KAAK,SAAS;gBACZ,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;YACzB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAA;QACf,CAAC;IACH,CAAC,CAAA;AACH,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,OAAuC;IAC7D,IAAI,CAAC;QACH,IAAI,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,OAAO;YAAE,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAC3E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChE,CAAC,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,KAAK,CAAA;IACX,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/transforms",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Data transform activities for the T4H Framework",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/transforms",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -26,14 +26,15 @@
26
26
  "scripts": {
27
27
  "build": "tsc --project tsconfig.build.json",
28
28
  "check-types": "tsc --noEmit",
29
- "lint": "eslint .",
29
+ "check-package": "publint --strict && attw --pack . --profile esm-only",
30
+ "lint": "eslint . --max-warnings 0",
30
31
  "prepublishOnly": "yarn build",
31
32
  "test": "vitest run",
32
33
  "test:watch": "vitest"
33
34
  },
34
35
  "devDependencies": {
35
- "@t4h.framework/core": "^0.19.0",
36
- "@t4h.framework/fs": "^0.13.0",
36
+ "@t4h.framework/core": "^0.21.0",
37
+ "@t4h.framework/fs": "^0.14.0",
37
38
  "typescript": "^5.9.3",
38
39
  "vitest": "^4.0.18"
39
40
  },