@t4h.framework/fs 0.0.0-experimental-c0d4325

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tech four humans
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @t4h.framework/fs
2
+
3
+ File system claim for reading and writing files within activities.
4
+
5
+ ## Claim
6
+
7
+ ### FileSystemClaim
8
+
9
+ Abstract dependency for file system operations. An activity declares this claim when it needs to read or write files. The runtime provides a concrete implementation (e.g. local disk, S3, GCS).
10
+
11
+ ```typescript
12
+ import { FileSystemClaim } from '@t4h.framework/fs'
13
+ ```
14
+
15
+ ### Interface
16
+
17
+ ```typescript
18
+ abstract class FileSystemClaim {
19
+ public abstract write(path: string, readable: Readable | Buffer): Binary | Promise<Binary>
20
+ public abstract read(path: string): Binary | Promise<Binary>
21
+ }
22
+ ```
23
+
24
+ ### Usage inside an activity
25
+
26
+ ```typescript
27
+ import { SyncActivity, Claim } from '@t4h.framework/core'
28
+ import { FileSystemClaim } from '@t4h.framework/fs'
29
+
30
+ class SaveReportActivity extends SyncActivity<[data: Buffer], { path: string }, any> {
31
+ private readonly claims = new Claim({
32
+ fs: FileSystemClaim,
33
+ })
34
+
35
+ public async toInput(data: Buffer) {
36
+ return { path: 'reports/output.pdf' }
37
+ }
38
+
39
+ public async run(input: { path: string }) {
40
+ const binary = await this.claims.fs.write(input.path, Buffer.from('...'))
41
+ return { contentType: binary.contentType }
42
+ }
43
+
44
+ public toOutput(output: any) {
45
+ return output
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### Runtime provider
51
+
52
+ The runtime must supply a concrete implementation:
53
+
54
+ ```typescript
55
+ { provide: FileSystemClaim, value: new LocalFileSystemClaimImpl() }
56
+ ```
@@ -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,7 @@
1
+ import type { Readable } from 'node:stream';
2
+ import type { Binary } from '@t4h.framework/core';
3
+ export declare abstract class FileSystemClaim {
4
+ abstract write(path: string, readable: Readable | Buffer): Binary | Promise<Binary>;
5
+ abstract read(path: string): Binary | Promise<Binary>;
6
+ }
7
+ //# sourceMappingURL=FileSystemClaim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystemClaim.d.ts","sourceRoot":"","sources":["../src/FileSystemClaim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,8BAAsB,eAAe;aACnB,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 FileSystemClaim {
2
+ }
3
+ //# sourceMappingURL=FileSystemClaim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystemClaim.js","sourceRoot":"","sources":["../src/FileSystemClaim.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,eAAe;CAOpC"}
package/dist/fs.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './FileSystemClaim.js';
2
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
package/dist/fs.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './FileSystemClaim.js';
2
+ //# sourceMappingURL=fs.js.map
package/dist/fs.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@t4h.framework/fs",
3
+ "version": "0.0.0-experimental-c0d4325",
4
+ "description": "File system module for the T4H Framework",
5
+ "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/fs",
6
+ "bugs": "https://github.com/tech4humans-brasil/framework/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/tech4humans-brasil/framework.git",
10
+ "directory": "packages/fs"
11
+ },
12
+ "license": "MIT",
13
+ "author": "Tech4Humans <contact@tech4h.com.br> (https://tech4h.com.br)",
14
+ "type": "module",
15
+ "exports": {
16
+ "types": "./dist/fs.d.ts",
17
+ "import": "./dist/fs.js"
18
+ },
19
+ "module": "./dist/fs.js",
20
+ "types": "./dist/fs.d.ts",
21
+ "files": [
22
+ "dist",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc --project tsconfig.build.json",
27
+ "check-types": "tsc --noEmit",
28
+ "lint": "eslint .",
29
+ "prepublishOnly": "yarn build"
30
+ },
31
+ "dependencies": {
32
+ "@t4h.framework/core": "workspace:^"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "^5.9.3"
36
+ },
37
+ "peerDependencies": {
38
+ "@t4h.framework/core": "workspace:^"
39
+ },
40
+ "packageManager": "yarn@4.12.0",
41
+ "engines": {
42
+ "node": ">=22"
43
+ },
44
+ "stableVersion": "0.0.0"
45
+ }