@t4h.framework/fs 0.9.3 → 0.9.5

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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @t4h.framework/fs
2
2
 
3
+ ## 0.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174](https://github.com/tech4humans-brasil/framework/pull/174) [`7cd75e4`](https://github.com/tech4humans-brasil/framework/commit/7cd75e4f557d9f5fbe3e486d5a3981186fa38797) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds `asset(path)`, which reads a file shipped with the project.
8
+
9
+ Fonts a PDF embeds, images a template draws, a fixed lookup table: they belong
10
+ to the project, not to a run. Reading them with `readFileSync` appears to work
11
+ and then costs dearly, because every primitive persists its input — a value
12
+ holding a `Buffer` is serialized whole, once per activity that receives it, so
13
+ a 1.5 MB font used by a workflow that runs per record is written into the
14
+ history per record. `asset` returns a `Binary`, which travels as a reference
15
+ and is read only where the bytes are needed.
16
+
17
+ Declare the files in `framework.config.ts` under `build.assets` (renamed from
18
+ `build.additionalFiles`, with no fallback — rename the key to keep shipping
19
+ files). `build` now records the copied paths and `publish` sends them, so a
20
+ runtime knows which entries of the artifact are assets. `AssetClaim` is the
21
+ contract each runtime implements.
22
+
23
+ ## 0.9.4
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [[`aa72268`](https://github.com/tech4humans-brasil/framework/commit/aa72268d040a743743cac31cc14e26b8620b0e3f)]:
28
+ - @t4h.framework/core@0.14.0
29
+
3
30
  ## 0.9.3
4
31
 
5
32
  ### Patch Changes
@@ -0,0 +1,6 @@
1
+ import { type Binary } from '@t4h.framework/core';
2
+ export declare abstract class AssetClaim {
3
+ abstract resolve(path: string): Binary | Promise<Binary>;
4
+ }
5
+ export declare function asset(path: string): Promise<Binary>;
6
+ //# sourceMappingURL=AssetClaim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetClaim.d.ts","sourceRoot":"","sources":["../src/AssetClaim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAExD,8BAAsB,UAAU;aACd,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAChE;AAED,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIzD"}
@@ -0,0 +1,8 @@
1
+ import { Claim } from '@t4h.framework/core';
2
+ export class AssetClaim {
3
+ }
4
+ export async function asset(path) {
5
+ const claims = new Claim({ assets: AssetClaim });
6
+ return await claims.assets.resolve(path);
7
+ }
8
+ //# sourceMappingURL=AssetClaim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetClaim.js","sourceRoot":"","sources":["../src/AssetClaim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,qBAAqB,CAAA;AAExD,MAAM,OAAgB,UAAU;CAE/B;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAY;IACtC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;IAEhD,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC1C,CAAC"}
package/dist/fs.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './AssetClaim.js';
1
2
  export * from './FileSystemClaim.js';
2
3
  export * from './activities/FileJoinActivity.js';
3
4
  export * from './activities/FileReadActivity.js';
package/dist/fs.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA"}
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA"}
package/dist/fs.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './AssetClaim.js';
1
2
  export * from './FileSystemClaim.js';
2
3
  export * from './activities/FileJoinActivity.js';
3
4
  export * from './activities/FileReadActivity.js';
package/dist/fs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA"}
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/fs",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
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",
@@ -32,12 +32,12 @@
32
32
  "test:watch": "vitest"
33
33
  },
34
34
  "devDependencies": {
35
- "@t4h.framework/core": "^0.13.0",
35
+ "@t4h.framework/core": "^0.14.0",
36
36
  "typescript": "^5.9.3",
37
37
  "vitest": "^4.0.18"
38
38
  },
39
39
  "peerDependencies": {
40
- "@t4h.framework/core": "^0.13.0"
40
+ "@t4h.framework/core": "^0.14.0"
41
41
  },
42
42
  "packageManager": "yarn@4.12.0",
43
43
  "engines": {