@hyperframes/share 0.9.28-alpha.0 → 0.9.28
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 +190 -0
- package/README.md +1 -58
- package/dist/index.d.mts +0 -1
- package/dist/projectLock.d.mts +2 -2
- package/dist/projectSnapshot.d.mts +1 -3
- package/dist/reviewClient.d.mts +16 -13
- package/dist/reviewExport.d.mts +1 -11
- package/dist/reviewUpload.d.mts +0 -2
- package/package.json +1 -1
- package/scripts/copy-types.mjs +0 -3
- package/src/index.mjs +0 -6
- package/src/projectLock.mjs +2 -9
- package/src/projectSnapshot.mjs +4 -11
- package/src/reviewClient.mjs +83 -48
- package/src/reviewExport.mjs +37 -145
- package/src/reviewUpload.mjs +16 -18
- package/dist/shareSources.d.mts +0 -24
- package/dist/sources/adapterTypes.d.ts +0 -39
- package/dist/sources/api.d.mts +0 -29
- package/dist/sources/capture.d.mts +0 -24
- package/dist/sources/contract.d.mts +0 -2
- package/dist/sources/errors.d.mts +0 -24
- package/dist/sources/limits.d.mts +0 -12
- package/dist/sources/manifest.d.mts +0 -23
- package/dist/sources/pathPolicy.d.mts +0 -25
- package/dist/sources/projectState.d.mts +0 -9
- package/dist/sources/store.d.mts +0 -3
- package/dist/sources/transfer.d.mts +0 -45
- package/dist/sources/types.d.ts +0 -353
- package/dist/sources/unicode.d.mts +0 -15
- package/dist/sources/upload.d.mts +0 -9
- package/dist/sources/uploadFiles.d.mts +0 -31
- package/dist/sources/wire.d.mts +0 -21
- package/src/shareSources.mjs +0 -236
- package/src/sources/adapterTypes.d.ts +0 -39
- package/src/sources/api.mjs +0 -114
- package/src/sources/capture.mjs +0 -262
- package/src/sources/contract/LICENSE-Unicode.txt +0 -39
- package/src/sources/contract/path-policy.json +0 -311
- package/src/sources/contract/unicode-15.1.0.json +0 -6179
- package/src/sources/contract.mjs +0 -13
- package/src/sources/errors.mjs +0 -77
- package/src/sources/limits.mjs +0 -48
- package/src/sources/manifest.mjs +0 -154
- package/src/sources/pathPolicy.mjs +0 -197
- package/src/sources/projectState.mjs +0 -59
- package/src/sources/store.mjs +0 -82
- package/src/sources/transfer.mjs +0 -196
- package/src/sources/types.d.ts +0 -353
- package/src/sources/unicode.mjs +0 -163
- package/src/sources/upload.mjs +0 -201
- package/src/sources/uploadFiles.mjs +0 -263
- package/src/sources/wire.mjs +0 -205
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** A file's SHA-256 by path, size, time and inode, kept for the launch so a check after a focus reads no bytes.
|
|
2
|
-
* Only a settled file's hash is kept. */
|
|
3
|
-
export function hashMemo(now?: () => number): {
|
|
4
|
-
/** @param {Found} file */
|
|
5
|
-
get: (file: Found) => string | null;
|
|
6
|
-
/** @param {Found} file @param {string} sha256 */
|
|
7
|
-
set: (file: Found, sha256: string) => void;
|
|
8
|
-
};
|
|
9
|
-
/** The file's SHA-256, read through the handle `openListed` checked; null when the file is not the one listed, or its
|
|
10
|
-
* bytes changed while being read. `root` is the project's real path; `resolve` finds a folder's real path.
|
|
11
|
-
* @param {string} root @param {Found} file @param {typeof realpath} [resolve] */
|
|
12
|
-
export function hashListedFile(root: string, file: Found, resolve?: typeof realpath): Promise<string | null>;
|
|
13
|
-
/** Captures `root` (a project's real path). `memo` reuses hashes of unchanged files; a send should pass a fresh one.
|
|
14
|
-
* @param {string} root @param {{ memo?: ReturnType<typeof hashMemo>, limits?: import("./types.js").Limits }} [options]
|
|
15
|
-
* @returns {Promise<Capture>} */
|
|
16
|
-
export function captureProject(root: string, { memo, limits }?: {
|
|
17
|
-
memo?: ReturnType<typeof hashMemo>;
|
|
18
|
-
limits?: import("./types.js").Limits;
|
|
19
|
-
}): Promise<Capture>;
|
|
20
|
-
export type CaptureProblem = import("./types.js").CaptureProblem;
|
|
21
|
-
export type Found = import("./types.js").Found;
|
|
22
|
-
export type Walk = import("./types.js").Walk;
|
|
23
|
-
export type Capture = import("./types.js").Capture;
|
|
24
|
-
import { realpath } from "node:fs/promises";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** The typed error for a refusal: the envelope's code when it is one of the sync routes', else the status's.
|
|
2
|
-
* @param {Response} reply @returns {Promise<SyncApiError>} */
|
|
3
|
-
export function refusalOf(reply: Response): Promise<SyncApiError>;
|
|
4
|
-
/** A sync route's refusal or failure. `status` is 0 when the server was never reached. */
|
|
5
|
-
export class SyncApiError extends Error {
|
|
6
|
-
/** @param {SyncErrorKind} kind @param {{ status?: number, code?: string | null, param?: string | null,
|
|
7
|
-
* requestId?: string | null, retryAfterMs?: number | null, detail?: string }} [about] */
|
|
8
|
-
constructor(kind: SyncErrorKind, about?: {
|
|
9
|
-
status?: number;
|
|
10
|
-
code?: string | null;
|
|
11
|
-
param?: string | null;
|
|
12
|
-
requestId?: string | null;
|
|
13
|
-
retryAfterMs?: number | null;
|
|
14
|
-
detail?: string;
|
|
15
|
-
});
|
|
16
|
-
kind: import("./types.js").SyncErrorKind;
|
|
17
|
-
status: number;
|
|
18
|
-
code: string | null;
|
|
19
|
-
param: string | null;
|
|
20
|
-
requestId: string | null;
|
|
21
|
-
retryAfterMs: number | null;
|
|
22
|
-
detail: string | null;
|
|
23
|
-
}
|
|
24
|
-
export type SyncErrorKind = import("./types.js").SyncErrorKind;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** The first limit broken, in the server's fixed order (file count, file size, project size, manifest size), with
|
|
2
|
-
* the biggest files first; null when the push fits. @param {readonly { path: string, size: number }[]} files
|
|
3
|
-
* @param {number} manifestBytes @param {Limits} [limits] @returns {import("./types.js").OverLimit | null} */
|
|
4
|
-
export function overLimit(files: readonly {
|
|
5
|
-
path: string;
|
|
6
|
-
size: number;
|
|
7
|
-
}[], manifestBytes: number, limits?: Limits): import("./types.js").OverLimit | null;
|
|
8
|
-
/** @typedef {import("./types.js").Limits} Limits @typedef {import("./types.js").LimitName} LimitName */
|
|
9
|
-
/** @type {Limits} */
|
|
10
|
-
export const V1_LIMITS: Limits;
|
|
11
|
-
export type Limits = import("./types.js").Limits;
|
|
12
|
-
export type LimitName = import("./types.js").LimitName;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** The canonical bytes of a valid document. @param {ManifestDocument} document */
|
|
2
|
-
export function canonicalBytes(document: ManifestDocument): Buffer<ArrayBuffer>;
|
|
3
|
-
/** Validates a manifest document as the server does; throws ManifestInvalid. @param {unknown} raw
|
|
4
|
-
* @param {boolean} [stored] @returns {Manifest} */
|
|
5
|
-
export function parseManifest(raw: unknown, stored?: boolean): Manifest;
|
|
6
|
-
/** Stored manifest bytes, which must already be canonical so their hash is the snapshot's manifest_sha256.
|
|
7
|
-
* @param {Uint8Array} body @returns {Manifest} */
|
|
8
|
-
export function parseCanonicalManifest(body: Uint8Array): Manifest;
|
|
9
|
-
export const ENTRYPOINT: "index.html";
|
|
10
|
-
/** @typedef {import("./types.js").ManifestFile} ManifestFile @typedef {import("./types.js").Violation} Violation
|
|
11
|
-
* @typedef {import("./types.js").ManifestDocument} ManifestDocument @typedef {import("./types.js").Manifest} Manifest */
|
|
12
|
-
/** Why a manifest was refused; `code` is the first violation's, in the server's order. */
|
|
13
|
-
export class ManifestInvalid extends Error {
|
|
14
|
-
/** @param {Violation[]} violations */
|
|
15
|
-
constructor(violations: Violation[]);
|
|
16
|
-
violations: import("./types.js").Violation[];
|
|
17
|
-
code: string;
|
|
18
|
-
}
|
|
19
|
-
export function parseStoredManifest(raw: unknown): Manifest;
|
|
20
|
-
export type ManifestFile = import("./types.js").ManifestFile;
|
|
21
|
-
export type Violation = import("./types.js").Violation;
|
|
22
|
-
export type ManifestDocument = import("./types.js").ManifestDocument;
|
|
23
|
-
export type Manifest = import("./types.js").Manifest;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** The first rule matching a path's folded spelling. @param {string} path @returns {PathRule} */
|
|
2
|
-
export function classifyPath(path: string): PathRule;
|
|
3
|
-
/** `path` unchanged when every client can store it and the policy lets it travel; throws PathViolation otherwise,
|
|
4
|
-
* naming the first failing check in the registry's order. @param {string} path
|
|
5
|
-
* @param {boolean} [stored] */
|
|
6
|
-
export function validatePath(path: string, stored?: boolean): string;
|
|
7
|
-
/** Refuses duplicates, and any two paths (or a path and a directory prefix) one filesystem would store as one name.
|
|
8
|
-
* Each path must already pass validatePath. @param {readonly string[]} paths */
|
|
9
|
-
export function checkInventoryPaths(paths: readonly string[]): void;
|
|
10
|
-
/** Whether no file under folder `dir` can be listed, so a capture need not open it: its first matching rule
|
|
11
|
-
* excludes the folder and all below it, and no include rule before that one can reach inside. @param {string} dir */
|
|
12
|
-
export function excludedFolder(dir: string): boolean;
|
|
13
|
-
/** @typedef {import("./types.js").PathRule} PathRule @typedef {import("./types.js").PolicyDocument} PolicyDocument */
|
|
14
|
-
/** A path the policy refuses: `code` is the golden vectors' shared vocabulary, `rule` the excluding rule's id. */
|
|
15
|
-
export class PathViolation extends Error {
|
|
16
|
-
/** @param {string} code @param {string} path @param {string} [rule] */
|
|
17
|
-
constructor(code: string, path: string, rule?: string);
|
|
18
|
-
code: string;
|
|
19
|
-
path: string;
|
|
20
|
-
rule: string | null;
|
|
21
|
-
}
|
|
22
|
-
export function prefiltered(name: string): boolean;
|
|
23
|
-
export function skippedSymlink(path: string): boolean;
|
|
24
|
-
export type PathRule = import("./types.js").PathRule;
|
|
25
|
-
export type PolicyDocument = import("./types.js").PolicyDocument;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** A predicate for the paths the project's render-outputs.json lists, and everything under them; none when the file
|
|
2
|
-
* is missing or not version 1. @param {string} root @returns {Promise<(rel: string) => boolean>} */
|
|
3
|
-
export function readRenderOutputs(root: string): Promise<(rel: string) => boolean>;
|
|
4
|
-
/** An open agent turn (its history-turn.json exists) or a project lock whose holder still runs.
|
|
5
|
-
* @param {string} root */
|
|
6
|
-
export function settledState(root: string): Promise<{
|
|
7
|
-
agentTurnOpen: boolean;
|
|
8
|
-
projectLocked: boolean;
|
|
9
|
-
}>;
|
package/dist/sources/store.d.mts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** Project-local state is excluded by the portable source policy. Account/root mismatches fail closed, including copied folders.
|
|
2
|
-
* @returns {import("./adapterTypes.js").SourceStore} */
|
|
3
|
-
export function createProjectShareSourceStore(): import("./adapterTypes.js").SourceStore;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** PUTs bytes of `file` to a signed URL with exactly the headers the grant signed. Resolves once storage keeps them;
|
|
2
|
-
* the bytes sent must hash to `sha256`, or it throws `changed` whatever storage answered.
|
|
3
|
-
* @param {{ fetchImpl: typeof fetch, url: string, headers: Record<string, string>, file: string, path: string,
|
|
4
|
-
* start: number, length: number, sha256: string, signal: AbortSignal, onBytes?: (bytes: number) => void, stallMs?: number }} put */
|
|
5
|
-
export function putRange(put: {
|
|
6
|
-
fetchImpl: typeof fetch;
|
|
7
|
-
url: string;
|
|
8
|
-
headers: Record<string, string>;
|
|
9
|
-
file: string;
|
|
10
|
-
path: string;
|
|
11
|
-
start: number;
|
|
12
|
-
length: number;
|
|
13
|
-
sha256: string;
|
|
14
|
-
signal: AbortSignal;
|
|
15
|
-
onBytes?: (bytes: number) => void;
|
|
16
|
-
stallMs?: number;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
/** Each part's SHA-256 (parts of `partBytes`, the last one shorter) and the whole file's, in one read.
|
|
19
|
-
* @param {string} file @param {number} size @param {number} partBytes @param {AbortSignal} signal */
|
|
20
|
-
export function partDigests(file: string, size: number, partBytes: number, signal: AbortSignal): Promise<{
|
|
21
|
-
parts: string[];
|
|
22
|
-
whole: string;
|
|
23
|
-
complete: boolean;
|
|
24
|
-
}>;
|
|
25
|
-
/** Runs `work` over `items`, `limit` at a time. The first failure stops new work; the rest finish, then it throws.
|
|
26
|
-
* @template T @param {readonly T[]} items @param {number} limit @param {(item: T) => Promise<void>} work */
|
|
27
|
-
export function eachLimit<T>(items: readonly T[], limit: number, work: (item: T) => Promise<void>): Promise<void>;
|
|
28
|
-
/** Why a transfer stopped. `expired`: the signed URL no longer works (ask for a new one). `exists`: a create-only PUT
|
|
29
|
-
* found the object already written. `changed`: the file's bytes are not the ones captured. `unreadable`: the file
|
|
30
|
-
* could not be read (a drive unplugged, a file deleted). `corrupt`: downloaded bytes do not hash to what was asked.
|
|
31
|
-
* `transient`: the network or the store failed; the same request may be sent again. */
|
|
32
|
-
export class TransferError extends Error {
|
|
33
|
-
/** @param {"expired" | "exists" | "changed" | "unreadable" | "corrupt" | "transient" | "refused"} kind
|
|
34
|
-
* @param {{ status?: number, path?: string }} [about] */
|
|
35
|
-
constructor(kind: "expired" | "exists" | "changed" | "unreadable" | "corrupt" | "transient" | "refused", about?: {
|
|
36
|
-
status?: number;
|
|
37
|
-
path?: string;
|
|
38
|
-
});
|
|
39
|
-
kind: "expired" | "refused" | "changed" | "unreadable" | "exists" | "corrupt" | "transient";
|
|
40
|
-
status: number;
|
|
41
|
-
path: string | null;
|
|
42
|
-
}
|
|
43
|
-
export function isAbort(error: unknown): boolean;
|
|
44
|
-
export function realWait(ms: number, signal?: AbortSignal): Promise<undefined>;
|
|
45
|
-
export function backoffMs(attempt: number, askedMs?: number | null, baseMs?: number, maxMs?: number): number;
|
package/dist/sources/types.d.ts
DELETED
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
export interface SyncTooBig {
|
|
2
|
-
limit: "file_count" | "file_size" | "project_size" | "manifest_size";
|
|
3
|
-
actual: number;
|
|
4
|
-
maximum: number;
|
|
5
|
-
biggest: { path: string; size: number }[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** A file that keeps a project from being captured; it is never left out silently. */
|
|
9
|
-
export interface SyncCaptureProblem {
|
|
10
|
-
path: string;
|
|
11
|
-
problem: "symlink" | "special-file" | "unreadable" | "invalid-name" | "changed" | "no-entrypoint";
|
|
12
|
-
/** For `invalid-name`, the path policy's code (`reserved_name`, `path_collision`, ...). */
|
|
13
|
-
code?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ManifestFile {
|
|
17
|
-
path: string;
|
|
18
|
-
sha256: string;
|
|
19
|
-
size: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ManifestDocument {
|
|
23
|
-
format_version: 1;
|
|
24
|
-
entrypoint: "index.html";
|
|
25
|
-
files: ManifestFile[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** A valid manifest: its document in canonical order, the canonical bytes and their SHA-256. */
|
|
29
|
-
export interface Manifest {
|
|
30
|
-
document: ManifestDocument;
|
|
31
|
-
canonical: Buffer;
|
|
32
|
-
sha256: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface Violation {
|
|
36
|
-
code: string;
|
|
37
|
-
path?: string;
|
|
38
|
-
rule?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type LimitName = SyncTooBig["limit"];
|
|
42
|
-
|
|
43
|
-
export interface Limits {
|
|
44
|
-
maxFiles: number;
|
|
45
|
-
maxFileBytes: number;
|
|
46
|
-
maxProjectBytes: number;
|
|
47
|
-
maxManifestBytes: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type OverLimit = SyncTooBig;
|
|
51
|
-
|
|
52
|
-
type ClientAction = "include" | "exclude" | "wait_then_exclude";
|
|
53
|
-
|
|
54
|
-
export interface PathRule {
|
|
55
|
-
id: string;
|
|
56
|
-
regex: string;
|
|
57
|
-
client_action: ClientAction;
|
|
58
|
-
server_action: "allow" | "reject";
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** The fields of contract/path-policy.json this client reads. */
|
|
62
|
-
export interface PolicyDocument {
|
|
63
|
-
policy_version: string;
|
|
64
|
-
stored_manifest: { legacy_agent_state_regex: string };
|
|
65
|
-
unicode: { version: string };
|
|
66
|
-
rules: PathRule[];
|
|
67
|
-
path: {
|
|
68
|
-
max_path_bytes: number;
|
|
69
|
-
max_segment_bytes: number;
|
|
70
|
-
forbidden_characters: string;
|
|
71
|
-
reserved_segment_regex: string;
|
|
72
|
-
canonical_spelling_roots: string[];
|
|
73
|
-
};
|
|
74
|
-
client_prefilter: { names: string[] };
|
|
75
|
-
client_symlinks: { skip_prefixes: string[] };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type CaptureProblem = SyncCaptureProblem;
|
|
79
|
-
|
|
80
|
-
/** What an owner workspace's plan allows composition sync, as the limits route answered it. `unread` when it could not
|
|
81
|
-
* be read: `not-deployed` is a server without the route (a 404), and nothing is refused on an unread answer. */
|
|
82
|
-
export type SyncLimitsRead =
|
|
83
|
-
| {
|
|
84
|
-
at: "read";
|
|
85
|
-
syncAllowed: boolean;
|
|
86
|
-
maxCompositions: number;
|
|
87
|
-
/** Live compositions in the workspace when it was read. */
|
|
88
|
-
compositions: number;
|
|
89
|
-
push: Limits;
|
|
90
|
-
}
|
|
91
|
-
| { at: "unread"; why: "not-deployed" | "offline" | "failed" };
|
|
92
|
-
|
|
93
|
-
/** A file a capture lists, before hashing. */
|
|
94
|
-
export interface Found {
|
|
95
|
-
path: string;
|
|
96
|
-
full: string;
|
|
97
|
-
size: number;
|
|
98
|
-
mtimeMs: number;
|
|
99
|
-
ino: number;
|
|
100
|
-
dev: number;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface Walk {
|
|
104
|
-
files: Found[];
|
|
105
|
-
problems: CaptureProblem[];
|
|
106
|
-
waiting: string[];
|
|
107
|
-
skippedLinks: string[];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export type Capture =
|
|
111
|
-
| {
|
|
112
|
-
at: "captured";
|
|
113
|
-
manifest: Manifest;
|
|
114
|
-
settled: { agentTurnOpen: boolean; projectLocked: boolean };
|
|
115
|
-
waiting: string[];
|
|
116
|
-
skippedLinks: string[];
|
|
117
|
-
}
|
|
118
|
-
| { at: "problems"; problems: CaptureProblem[] }
|
|
119
|
-
| { at: "too-big"; over: OverLimit };
|
|
120
|
-
|
|
121
|
-
export type SyncErrorKind =
|
|
122
|
-
| "offline"
|
|
123
|
-
| "signed-out"
|
|
124
|
-
| "malformed"
|
|
125
|
-
| "not-enabled"
|
|
126
|
-
| "byok"
|
|
127
|
-
| "no-write-role"
|
|
128
|
-
| "forbidden"
|
|
129
|
-
| "composition-not-found"
|
|
130
|
-
| "not-found"
|
|
131
|
-
| "too-large"
|
|
132
|
-
| "reference-invalid"
|
|
133
|
-
| "upload-not-pending"
|
|
134
|
-
| "active-uploads-exceeded"
|
|
135
|
-
| "file-not-writable"
|
|
136
|
-
| "idempotency-key-reused"
|
|
137
|
-
| "request-in-progress"
|
|
138
|
-
| "snapshot-not-downloadable"
|
|
139
|
-
| "conflict-not-open"
|
|
140
|
-
| "download-expired"
|
|
141
|
-
| "invalid-parameter"
|
|
142
|
-
| "plan-required"
|
|
143
|
-
| "limit-reached"
|
|
144
|
-
| "rate-limited"
|
|
145
|
-
| "unavailable"
|
|
146
|
-
| "server-error"
|
|
147
|
-
| "refused";
|
|
148
|
-
|
|
149
|
-
export interface Composition {
|
|
150
|
-
id: string;
|
|
151
|
-
spaceId: string;
|
|
152
|
-
title: string;
|
|
153
|
-
createdBy: string;
|
|
154
|
-
/** Null before the first publish. */
|
|
155
|
-
latestSnapshotId: string | null;
|
|
156
|
-
createdAt: string;
|
|
157
|
-
updatedAt: string;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface Snapshot {
|
|
161
|
-
id: string;
|
|
162
|
-
compositionId: string;
|
|
163
|
-
baseSnapshotId: string | null;
|
|
164
|
-
publicationOutcome: "published" | "conflict_saved";
|
|
165
|
-
conflictedWithSnapshotId: string | null;
|
|
166
|
-
conflictState: "open" | "resolved" | "discarded" | null;
|
|
167
|
-
resolvedBySnapshotId: string | null;
|
|
168
|
-
createdBy: string;
|
|
169
|
-
createdByName?: string | null;
|
|
170
|
-
clientType: string;
|
|
171
|
-
summary: string | null;
|
|
172
|
-
summarySource: string;
|
|
173
|
-
manifestSha256: string;
|
|
174
|
-
createdAt: string;
|
|
175
|
-
/** Only with `include=manifest`, and only once its bytes hash to manifestSha256. */
|
|
176
|
-
manifest: Manifest | null;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
type UploadStatus = "pending" | "verifying" | "completed" | "failed" | "expired";
|
|
180
|
-
|
|
181
|
-
export interface UploadReceipt {
|
|
182
|
-
uploadId: string;
|
|
183
|
-
compositionId: string;
|
|
184
|
-
snapshotId: string;
|
|
185
|
-
status: UploadStatus;
|
|
186
|
-
/** Why a failed upload failed: cancelled, content_incomplete, verification_timeout, access_revoked. */
|
|
187
|
-
errorCode: string | null;
|
|
188
|
-
baseSnapshotId: string | null;
|
|
189
|
-
resolvesConflictSnapshotIds: string[];
|
|
190
|
-
manifestSha256: string;
|
|
191
|
-
uploadDeadline: string;
|
|
192
|
-
verificationDeadline: string | null;
|
|
193
|
-
completedAt: string | null;
|
|
194
|
-
result: {
|
|
195
|
-
snapshotId: string;
|
|
196
|
-
publicationOutcome: "published" | "conflict_saved";
|
|
197
|
-
conflictedWithSnapshotId: string | null;
|
|
198
|
-
} | null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
interface BlobRef {
|
|
202
|
-
sha256: string;
|
|
203
|
-
size: number;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export interface BeginResult extends UploadReceipt {
|
|
207
|
-
/** Already saved in the base or a named conflict: never uploaded. */
|
|
208
|
-
present: BlobRef[];
|
|
209
|
-
/** To upload through upload-urls before submitting. */
|
|
210
|
-
needed: BlobRef[];
|
|
211
|
-
/** False for a replay of the same push under the same Idempotency-Key. */
|
|
212
|
-
created: boolean;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export interface BeginRequest {
|
|
216
|
-
idempotencyKey: string;
|
|
217
|
-
baseSnapshotId: string | null;
|
|
218
|
-
resolvesConflictSnapshotIds: string[];
|
|
219
|
-
summary: { text: string; source: "user" | "agent" } | null;
|
|
220
|
-
manifest: Manifest;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
interface PartGrant {
|
|
224
|
-
partNumber: number;
|
|
225
|
-
length: number;
|
|
226
|
-
url: string;
|
|
227
|
-
headers: Record<string, string>;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export interface FileGrant {
|
|
231
|
-
sha256: string;
|
|
232
|
-
size: number;
|
|
233
|
-
expiresAt: string;
|
|
234
|
-
/** Files up to 64 MiB: one PUT. */
|
|
235
|
-
url: string | null;
|
|
236
|
-
headers: Record<string, string>;
|
|
237
|
-
/** Files over 64 MiB: the file's one multipart upload, and the requested parts. */
|
|
238
|
-
multipartUploadId: string | null;
|
|
239
|
-
parts: PartGrant[];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export interface GrantRequest {
|
|
243
|
-
sha256: string;
|
|
244
|
-
multipartUploadId?: string;
|
|
245
|
-
parts?: { partNumber: number; sha256: string }[];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export interface DownloadBatch {
|
|
249
|
-
snapshotId: string;
|
|
250
|
-
manifestSha256: string;
|
|
251
|
-
continuationToken: string;
|
|
252
|
-
continuationExpiresAt: string;
|
|
253
|
-
urls: { sha256: string; size: number; url: string; expiresAt: string }[];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export interface Page<T> {
|
|
257
|
-
items: T[];
|
|
258
|
-
nextToken: string | null;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export type CompositionRead =
|
|
262
|
-
| { at: "fresh"; composition: Composition; etag: string | null }
|
|
263
|
-
| { at: "unchanged"; etag: string };
|
|
264
|
-
|
|
265
|
-
/** Whose binding: the backend's API host, the signed-in account (accountPrincipal) and the project's real path. */
|
|
266
|
-
export interface BindingKey {
|
|
267
|
-
backend: string;
|
|
268
|
-
account: string;
|
|
269
|
-
projectPath: string;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** A push recorded before its Begin is sent, so a lost answer is recovered by sending the same body under the same
|
|
273
|
-
* Idempotency-Key; the upload's ids and deadlines land once an answer comes back. */
|
|
274
|
-
export interface InflightUpload {
|
|
275
|
-
idempotencyKey: string;
|
|
276
|
-
baseSnapshotId: string | null;
|
|
277
|
-
resolvesConflictSnapshotIds: string[];
|
|
278
|
-
summary: { text: string; source: "user" | "agent" } | null;
|
|
279
|
-
manifest: ManifestDocument;
|
|
280
|
-
manifestSha256: string;
|
|
281
|
-
uploadId: string | null;
|
|
282
|
-
snapshotId: string | null;
|
|
283
|
-
uploadDeadline: string | null;
|
|
284
|
-
verificationDeadline: string | null;
|
|
285
|
-
begunAt: number;
|
|
286
|
-
/** Files whose bytes reached staging, by SHA-256, so a resumed send does not write them again. */
|
|
287
|
-
sent?: string[];
|
|
288
|
-
/** Each multipart file's pinned upload and the parts already written, by the file's SHA-256. */
|
|
289
|
-
multipart?: Record<string, { uploadId: string; partsDone: number[] }>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface Binding extends BindingKey {
|
|
293
|
-
version: 1;
|
|
294
|
-
/** Client-generated, kept before the first request so a retried create names the same composition. */
|
|
295
|
-
compositionId: string;
|
|
296
|
-
ownerSpaceId: string;
|
|
297
|
-
/** The owner workspace as the account's list last named it, so a project whose workspace the account left can
|
|
298
|
-
* still be named. Absent from bindings made before it was kept, and until a list names the workspace. */
|
|
299
|
-
owner?: { name: string; kind: "personal" | "team" };
|
|
300
|
-
boundAt: number;
|
|
301
|
-
/** The composition as last read, and the ETag it came with; null before the create was answered. */
|
|
302
|
-
composition: Composition | null;
|
|
303
|
-
etag: string | null;
|
|
304
|
-
/** The snapshot this copy was last sent as or got from, with its manifest, so local changes need no network. */
|
|
305
|
-
base: { snapshotId: string; manifest: ManifestDocument; manifestSha256: string } | null;
|
|
306
|
-
inflight: InflightUpload | null;
|
|
307
|
-
/** Set while Get from the cloud is filling a folder it made, until the folder is added to Home. Until then the
|
|
308
|
-
* folder is not a project on this Mac, and the next Get of the composition finishes it. */
|
|
309
|
-
gettingFromCloud?: true;
|
|
310
|
-
/** What the marker that Get put in its folder holds: the only proof a file of that name there is not the person's. */
|
|
311
|
-
getToken?: string;
|
|
312
|
-
/** Set on the folder a Duplicate fills from the cloud: it is bound only while it downloads, so no Get ever opens
|
|
313
|
-
* it, and its binding goes once latest is in (duplicate.mjs). */
|
|
314
|
-
duplicate?: true;
|
|
315
|
-
/** The conflicts this Mac's sends saved, newest last: Compare names them as this project's, not another
|
|
316
|
-
* computer's. */
|
|
317
|
-
savedHere?: string[];
|
|
318
|
-
/** Set on a binding Work on {owner}'s project made from a share: the account reaches the owner's workspace through
|
|
319
|
-
* that share's grant, not membership, so every request names the review project (sync-backed sharing C5). */
|
|
320
|
-
sharedFrom?: SharedFrom;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** The share a binding came from: its review project, the owner's name and their workspace's, as the share named
|
|
324
|
-
* them when it was opened. */
|
|
325
|
-
export interface SharedFrom {
|
|
326
|
-
reviewProjectId: string;
|
|
327
|
-
owner: string;
|
|
328
|
-
workspace: string | null;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** A workspace's last refusal of a new composition: not admitted to sync yet, or encrypted (BYOK). */
|
|
332
|
-
export interface SpaceRefusal {
|
|
333
|
-
kind: "not-enabled" | "byok";
|
|
334
|
-
at: number;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** One send or get under way for a project: the binding it owns until it ends, and where its states go. */
|
|
338
|
-
export interface UploadJob {
|
|
339
|
-
api: import("./api.mjs").SourceApi;
|
|
340
|
-
space: string;
|
|
341
|
-
composition: string;
|
|
342
|
-
uploadId: string;
|
|
343
|
-
inflight: InflightUpload;
|
|
344
|
-
local: Map<string, { path: string; full: string }>;
|
|
345
|
-
needed: { sha256: string; size: number }[];
|
|
346
|
-
fetchImpl: typeof fetch;
|
|
347
|
-
wait: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
348
|
-
signal: AbortSignal;
|
|
349
|
-
now: () => number;
|
|
350
|
-
persist: () => void;
|
|
351
|
-
onBytes: (bytes: number) => void;
|
|
352
|
-
onFile: () => void;
|
|
353
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Whether every code point is assigned in Unicode 15.1. @param {string} value */
|
|
2
|
-
export function allAssigned(value: string): boolean;
|
|
3
|
-
/** The spelling two names share on a case-insensitive or normalizing filesystem: NFC(casefold(NFC(value))).
|
|
4
|
-
* @param {string} value */
|
|
5
|
-
export function comparisonKey(value: string): string;
|
|
6
|
-
export const UNICODE_VERSION: "15.1.0";
|
|
7
|
-
export function nfc(value: string): string;
|
|
8
|
-
export type UnicodeTableFile = {
|
|
9
|
-
unicode_version: string;
|
|
10
|
-
casefold: Record<string, string>;
|
|
11
|
-
combining: Record<string, number>;
|
|
12
|
-
decomposition: Record<string, number[]>;
|
|
13
|
-
composition: Record<string, number>;
|
|
14
|
-
assigned_ranges: [number, number][];
|
|
15
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Resolve an older capture before starting an upload for the current files.
|
|
2
|
-
* @param {SourceUpload} job @returns {Promise<import("./adapterTypes.js").SourceResult | null>} */
|
|
3
|
-
export function recoverSourceUpload(job: SourceUpload): Promise<import("./adapterTypes.js").SourceResult | null>;
|
|
4
|
-
/** Only published verification results can become share source; conflict_saved is preserved for explicit recovery.
|
|
5
|
-
* @param {SourceRun} run @returns {Promise<import("./adapterTypes.js").SourceResult>} */
|
|
6
|
-
export function uploadSource(run: SourceRun): Promise<import("./adapterTypes.js").SourceResult>;
|
|
7
|
-
export type SourceRun = import("./adapterTypes.js").SourceRun;
|
|
8
|
-
export type SourceUpload = Pick<SourceRun, "binding" | "api" | "store">;
|
|
9
|
-
export type UploadReceipt = import("./types.js").UploadReceipt;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** Writes every needed file the in-flight record does not list as sent. @param {UploadJob} job */
|
|
2
|
-
export function uploadNeeded(job: UploadJob): Promise<void>;
|
|
3
|
-
/** The file's multipart upload can take no more parts (`hyperframes_composition_upload_file_not_writable`): this
|
|
4
|
-
* upload cannot finish, so its owner must resolve it before a retry can begin a new one. */
|
|
5
|
-
export class NotWritable extends Error {
|
|
6
|
-
constructor();
|
|
7
|
-
}
|
|
8
|
-
export type UploadJob = import("./types.js").UploadJob;
|
|
9
|
-
export type Signed = {
|
|
10
|
-
url: string;
|
|
11
|
-
headers: Record<string, string>;
|
|
12
|
-
expiresAt: string;
|
|
13
|
-
};
|
|
14
|
-
export type Part = {
|
|
15
|
-
number: number;
|
|
16
|
-
sha256: string;
|
|
17
|
-
start: number;
|
|
18
|
-
length: number;
|
|
19
|
-
};
|
|
20
|
-
export type Bytes = {
|
|
21
|
-
file: {
|
|
22
|
-
path: string;
|
|
23
|
-
full: string;
|
|
24
|
-
};
|
|
25
|
-
start: number;
|
|
26
|
-
length: number;
|
|
27
|
-
sha256: string;
|
|
28
|
-
};
|
|
29
|
-
export type FileGrant = import("./types.js").FileGrant;
|
|
30
|
-
export type GrantRequest = import("./types.js").GrantRequest;
|
|
31
|
-
export type InflightUpload = import("./types.js").InflightUpload;
|
package/dist/sources/wire.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** @param {unknown} value @param {string} field @returns {Record<string, unknown>} */
|
|
2
|
-
export function objectOf(value: unknown, field: string): Record<string, unknown>;
|
|
3
|
-
/** @param {unknown} raw @returns {Composition} */
|
|
4
|
-
export function compositionOf(raw: unknown): Composition;
|
|
5
|
-
/** @param {unknown} raw @returns {Snapshot} */
|
|
6
|
-
export function snapshotOf(raw: unknown): Snapshot;
|
|
7
|
-
/** @param {unknown} raw @returns {UploadReceipt} */
|
|
8
|
-
export function uploadOf(raw: unknown): UploadReceipt;
|
|
9
|
-
/** @param {unknown} raw @returns {Extract<SyncLimitsRead, { at: "read" }>} */
|
|
10
|
-
export function syncLimitsOf(raw: unknown): Extract<SyncLimitsRead, {
|
|
11
|
-
at: "read";
|
|
12
|
-
}>;
|
|
13
|
-
export function beginOf(raw: unknown, created: boolean): BeginResult;
|
|
14
|
-
export function grantsOf(raw: unknown): FileGrant[];
|
|
15
|
-
export type SyncLimitsRead = import("./types.js").SyncLimitsRead;
|
|
16
|
-
export type Composition = import("./types.js").Composition;
|
|
17
|
-
export type Snapshot = import("./types.js").Snapshot;
|
|
18
|
-
export type UploadReceipt = import("./types.js").UploadReceipt;
|
|
19
|
-
export type BeginResult = import("./types.js").BeginResult;
|
|
20
|
-
export type FileGrant = import("./types.js").FileGrant;
|
|
21
|
-
export type DownloadBatch = import("./types.js").DownloadBatch;
|