@compforge/harness-common 0.5.3 → 0.5.4
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/README.md +14 -5
- package/dist/file.d.ts +22 -10
- package/dist/file.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,11 +27,20 @@ view during initialize, so concurrent consumers share them and dispose before th
|
|
|
27
27
|
Dependency graphs must be acyclic. A failed initialization permits retry only after successful cleanup;
|
|
28
28
|
failed cleanup poisons that key and is reported again when the root manager is disposed.
|
|
29
29
|
|
|
30
|
-
`FileDataSource`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
`FileDataSource` declares a nonempty group of distinct `paths` that can be acquired together.
|
|
31
|
+
`FileClient.read` obtains the whole group once and returns one `FileReadResult` per declared path,
|
|
32
|
+
in order: `{ path, status: "ok", bytes }` or `{ path, status: "error", error }`. Empty files succeed;
|
|
33
|
+
missing and oversized files keep independent errors without discarding successful siblings.
|
|
34
|
+
|
|
35
|
+
Callers specify `maxBytes` per file, `maxTotalBytes` for all retained bytes (including in-progress
|
|
36
|
+
files), `timeoutMs` for the complete operation including queueing, and optional cancellation.
|
|
37
|
+
Cancellation, total-budget exhaustion, the group deadline and transport/protocol failures reject
|
|
38
|
+
the whole operation. Every read observes fresh bytes; a co-acquisition group is not an atomic
|
|
39
|
+
filesystem snapshot. Parsing, configuration precedence and persistence belong to consumers.
|
|
40
|
+
Platform implementations live in `@compforge/harness-toolbox/file`.
|
|
41
|
+
|
|
42
|
+
Version 0.5.4 replaces the single `path` and byte-only return value; single-file consumers declare
|
|
43
|
+
`paths: [path]` and consume the sole per-file result. There is no implicit legacy adapter.
|
|
35
44
|
|
|
36
45
|
Service identifies a Component's runtime presence in an Environment. A Component belongs to a Repository
|
|
37
46
|
on a Forge. Product is a separate business identity; consumers own its many-to-many associations
|
package/dist/file.d.ts
CHANGED
|
@@ -2,28 +2,40 @@ import type { Client } from "./client.js";
|
|
|
2
2
|
import type { ClientManager } from "./client-manager.js";
|
|
3
3
|
import type { DataSource } from "./datasource.js";
|
|
4
4
|
export interface FileReadOptions {
|
|
5
|
-
/** Maximum complete file
|
|
5
|
+
/** Maximum complete size of each file; an oversized file returns an error without partial bytes. */
|
|
6
6
|
maxBytes: number;
|
|
7
|
-
/**
|
|
7
|
+
/** Maximum bytes retained across the whole read, including in-progress files. */
|
|
8
|
+
maxTotalBytes: number;
|
|
9
|
+
/** One deadline for queueing and acquiring the complete group. */
|
|
8
10
|
timeoutMs: number;
|
|
9
11
|
signal?: AbortSignal;
|
|
10
12
|
}
|
|
13
|
+
export type FileReadResult = {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly status: "ok";
|
|
16
|
+
readonly bytes: Uint8Array;
|
|
17
|
+
} | {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly status: "error";
|
|
20
|
+
readonly error: Error;
|
|
21
|
+
};
|
|
11
22
|
/**
|
|
12
|
-
* @spec Each read
|
|
13
|
-
*
|
|
14
|
-
*
|
|
23
|
+
* @spec Each read acquires the declared group once and returns one result per path, in declaration order.
|
|
24
|
+
* Individual file failures do not discard other files; cancellation, the group deadline, total budget
|
|
25
|
+
* and transport/protocol failures reject the operation. Every read obtains fresh bytes.
|
|
26
|
+
* @rule Group acquisition is not an atomic filesystem snapshot. Parsing and evidence belong to consumers.
|
|
15
27
|
*/
|
|
16
28
|
export interface FileClient extends Client {
|
|
17
|
-
read(options: FileReadOptions): Promise<
|
|
29
|
+
read(options: FileReadOptions): Promise<readonly FileReadResult[]>;
|
|
18
30
|
}
|
|
19
31
|
/**
|
|
20
|
-
* A
|
|
21
|
-
* @why
|
|
22
|
-
* @rule clientKey identifies access, not cached
|
|
32
|
+
* A nonempty group of distinct paths that the caller declares can be acquired together.
|
|
33
|
+
* @why The source is the acquisition unit; grouping does not require consumers to guess transport capabilities.
|
|
34
|
+
* @rule clientKey identifies access and the group, not cached contents or a Service-owned alias.
|
|
23
35
|
* @see {@link component://../../../docs/toolbox.md}
|
|
24
36
|
*/
|
|
25
37
|
export declare abstract class FileDataSource<C extends FileClient = FileClient> implements DataSource<C> {
|
|
26
|
-
abstract readonly
|
|
38
|
+
abstract readonly paths: readonly string[];
|
|
27
39
|
readonly description?: string;
|
|
28
40
|
abstract readonly clientKey: string;
|
|
29
41
|
abstract createClient(clients: Pick<ClientManager, "get">, signal: AbortSignal): C;
|
package/dist/file.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
* @why
|
|
4
|
-
* @rule clientKey identifies access, not cached
|
|
2
|
+
* A nonempty group of distinct paths that the caller declares can be acquired together.
|
|
3
|
+
* @why The source is the acquisition unit; grouping does not require consumers to guess transport capabilities.
|
|
4
|
+
* @rule clientKey identifies access and the group, not cached contents or a Service-owned alias.
|
|
5
5
|
* @see {@link component://../../../docs/toolbox.md}
|
|
6
6
|
*/
|
|
7
7
|
export class FileDataSource {
|