@t4h.framework/fs 0.14.0 → 0.14.3
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/CHANGELOG.md +13 -0
- package/README.md +22 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @t4h.framework/fs
|
|
2
2
|
|
|
3
|
+
## 0.14.3
|
|
4
|
+
|
|
5
|
+
## 0.14.2
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#276](https://github.com/tech4humans-brasil/framework/pull/276) [`7b38934`](https://github.com/tech4humans-brasil/framework/commit/7b38934e8f9207c98c33afcd76e3a7a4da7e8b14) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The README tells about `asset`, has a usage sample that compiles, and links
|
|
10
|
+
to the guide, the API reference and the changelog. The docs do not name the
|
|
11
|
+
packages or the storage behind a `Binary`, and they give the Node.js version
|
|
12
|
+
and the peer dependency.
|
|
13
|
+
|
|
14
|
+
## 0.14.1
|
|
15
|
+
|
|
3
16
|
## 0.14.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -2,35 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
File functions for T4H Framework workflows. `read` brings a small byte window
|
|
4
4
|
into the workflow, `write` turns workflow content into a file, `split` starts
|
|
5
|
-
one child workflow per record of a file,
|
|
6
|
-
|
|
5
|
+
one child workflow per record of a file, `join` folds the batch results back
|
|
6
|
+
into one file, and `asset` reads a file that ships with the project. Only
|
|
7
|
+
references to the files go into the workflow history.
|
|
7
8
|
|
|
8
9
|
## Install
|
|
9
10
|
|
|
10
11
|
```bash
|
|
11
|
-
npm install @t4h.framework/fs
|
|
12
|
+
npm install @t4h.framework/fs @t4h.framework/core
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
Peer dependency: `@t4h.framework/core`.
|
|
15
|
+
Requires Node.js 22.13 or later. Peer dependency: `@t4h.framework/core`.
|
|
15
16
|
|
|
16
17
|
## Usage
|
|
17
18
|
|
|
18
19
|
```typescript
|
|
20
|
+
import Type from 'typebox'
|
|
21
|
+
|
|
22
|
+
import { type Binary, Workflow } from '@t4h.framework/core'
|
|
19
23
|
import { join, split, Split } from '@t4h.framework/fs'
|
|
20
24
|
|
|
25
|
+
const processRecord = new Workflow(
|
|
26
|
+
{ id: 'process-record', schema: Type.String() },
|
|
27
|
+
async (record: string) => record.slice(0, 10),
|
|
28
|
+
)
|
|
29
|
+
|
|
21
30
|
const main = new Workflow(
|
|
22
|
-
{ id: 'main', schema:
|
|
31
|
+
{ id: 'main', schema: Type.Any() },
|
|
23
32
|
async (file: Binary) => {
|
|
24
33
|
const batch = await split(file, processRecord, {
|
|
25
34
|
delimiter: Split.line(),
|
|
26
35
|
timeoutInMs: 3_600_000,
|
|
27
36
|
})
|
|
28
37
|
|
|
29
|
-
return await join(batch, { format: 'lines', header: 'id
|
|
38
|
+
return await join(batch, { format: 'lines', header: 'id' })
|
|
30
39
|
},
|
|
31
40
|
)
|
|
32
41
|
```
|
|
33
42
|
|
|
34
43
|
## Documentation
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
- [Guide](https://tech4humans-brasil.github.io/framework/fs/)
|
|
46
|
+
- [API reference](https://tech4humans-brasil.github.io/framework/api/fs)
|
|
47
|
+
- [Changelog](./CHANGELOG.md)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/fs",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"test:watch": "vitest"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@t4h.framework/core": "^0.
|
|
36
|
+
"@t4h.framework/core": "^0.22.0",
|
|
37
37
|
"typescript": "^5.9.3",
|
|
38
38
|
"vitest": "^4.0.18"
|
|
39
39
|
},
|