@hyperframes/share 0.9.28-alpha.1 → 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 +6 -22
- package/src/reviewClient.mjs +83 -48
- package/src/reviewExport.mjs +41 -156
- package/src/reviewUpload.mjs +16 -18
- package/src/reviewVersionSentences.mjs +1 -2
- package/dist/shareSources.d.mts +0 -24
- package/dist/sourceIgnore.d.mts +0 -3
- 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/sourceIgnore.mjs +0 -69
- package/src/sources/adapterTypes.d.ts +0 -39
- package/src/sources/api.mjs +0 -114
- package/src/sources/capture.mjs +0 -264
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 HeyGen, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ const [current, version] = await Promise.all([
|
|
|
35
35
|
|
|
36
36
|
`access(refusedToken?)` returns `{ token, heygen, heygenApi, owner }` or null. It is read for every request. A refused bearer is passed back so the host can refresh it. `heygen` is the review API base. A host can inject its own `signedInRequest` to retain network tracing. `execFile` can likewise be injected to retain native process policy.
|
|
37
37
|
|
|
38
|
-
Video
|
|
38
|
+
Video uploads require exact storage origins from trusted host configuration. Set `reviewUploadOrigins` on the host or supply a comma-separated `HYPERFRAMES_REVIEW_UPLOAD_ORIGINS` environment variable. Configure the bucket-specific HTTPS origins used by the signer. Use URL origins without paths, trailing slashes, or wildcards. Local tests can explicitly allow an HTTP origin on `127.0.0.1`. An empty list refuses every video upload.
|
|
39
39
|
|
|
40
40
|
Before first registration the host must obtain explicit audience consent and prepare a current MP4. `shareForReview` registers/enables the link; it does not imply playable media. Await `addVersion`, then check the server project/latest ready version before reporting success. `addFirstVersion` starts background work and is for long-lived hosts only. `open: () => boolean` on `addVersion` bounds the polling lifetime without discarding the saved operation. `filesForExport(projectPath, renderedFingerprint)` optionally supplies an already-synced matching snapshot. Omit it for ordinary video sharing.
|
|
41
41
|
|
|
@@ -50,60 +50,3 @@ Metadata mutations and version uploads use separate cross-process locks under `.
|
|
|
50
50
|
`snapshotProject` skips symlinks by default, retaining Desktop watcher, change-set and saved-render compatibility; `snapshotFiles` also skips symlink entries. Set `followSymlinks: true` for a link-aware full snapshot. The CLI-facing `projectFingerprint` opts into following linked media (with cycle detection), so edited linked files invalidate its cached render. Both comparisons ignore HTML ID stamps. Export/history metadata, caches, hidden folders and installed packages are excluded. Hosts must record the fingerprint of the actual rendered source and must not relabel an old render with a newer fingerprint.
|
|
51
51
|
|
|
52
52
|
Public type exports include `ShareHost`, `ReviewClient`, `ReviewShare`, `VersionRequest`, and `Wire`, plus `@hyperframes/share/types/reviewWire` and `types/share`. Per-module entry points preserve Desktop imports during adoption.
|
|
53
|
-
|
|
54
|
-
## Source snapshots
|
|
55
|
-
|
|
56
|
-
`shareSources({access, spaceId})` prepares editable source for a rendered version:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
const sources = shareSources({ access, spaceId });
|
|
60
|
-
const result = await sources.prepare(projectPath, renderedFingerprint);
|
|
61
|
-
if (result.at === "ready") {
|
|
62
|
-
await addVersion({
|
|
63
|
-
projectPath,
|
|
64
|
-
title,
|
|
65
|
-
client,
|
|
66
|
-
filesForExport: sources.filesForExport,
|
|
67
|
-
requireSource: true,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Handle `unavailable.reason` before creating the video version. Plan ineligibility
|
|
73
|
-
can use video-only; changed source, conflicts and unexpected upload failures need
|
|
74
|
-
an explicit choice to omit source. The CLI exposes `--video-only` for that choice.
|
|
75
|
-
`filesForExport` only validates already-prepared source; it does not upload.
|
|
76
|
-
|
|
77
|
-
The adapter uses the portable-source-v4 capture/manifest rules and
|
|
78
|
-
multipart transport. The pinned policy, Unicode 15.1 registry (with its license),
|
|
79
|
-
and manifest test vectors are checked into this repository. Source is captured through
|
|
80
|
-
verified file handles; upload bytes are streamed and checked against their hash.
|
|
81
|
-
Workspace limits, upload receipts and published snapshot identity are checked.
|
|
82
|
-
Pending uploads retain their original idempotency key across retries. A conflict
|
|
83
|
-
is never auto-resolved. When local source changes, the adapter cancels an older
|
|
84
|
-
pending upload before starting another; uploads under verification are preserved.
|
|
85
|
-
A stalled storage PUT stops after 60 seconds without progress and can retry with
|
|
86
|
-
the same upload identity.
|
|
87
|
-
|
|
88
|
-
Default state uses `.hyperframes/share-sync.<backend-hash>.json`, with strict
|
|
89
|
-
account/backend/realpath binding, private atomic writes, and a process lock.
|
|
90
|
-
Hosts can inject a compatible `store` or read-only `existingBinding` resolver.
|
|
91
|
-
An external Desktop binding is reused only when exact and settled; this adapter
|
|
92
|
-
never writes Desktop's binding or starts a second upload on its behalf.
|
|
93
|
-
|
|
94
|
-
Source sharing requires an authorized account and a workspace that supports editable project files.
|
|
95
|
-
Source-plan/feature eligibility remains server controlled. Automated fixtures do
|
|
96
|
-
not establish live entitlement, moderation, source download or outside-editor
|
|
97
|
-
acceptance. See [the source guide](https://hyperframes.heygen.com/developers/share-source).
|
|
98
|
-
|
|
99
|
-
Tests run locally without an account or service credentials:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
node --test packages/share/tests/*.test.mjs
|
|
103
|
-
bun run --cwd packages/share build
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
The bundled Unicode data records SHA-256 hashes for its inputs in `sources`.
|
|
107
|
-
Those files are published in the [Unicode 15.1 database](https://www.unicode.org/Public/15.1.0/ucd/).
|
|
108
|
-
Keep the included Unicode license with redistributed data. The pinned version
|
|
109
|
-
keeps path comparison consistent across Node versions and operating systems.
|
package/dist/index.d.mts
CHANGED
|
@@ -19,4 +19,3 @@ export { linkStateOf, reviewLinkStates } from "./reviewLinkStates.mjs";
|
|
|
19
19
|
export { AccountUnreachable, UNREACHABLE, readOrUnreachable, orIfUnreachable, signedInRequest } from "./signedInRequest.mjs";
|
|
20
20
|
export { HF_ID_ATTRIBUTE, contentKey, snapshotProject, snapshotFingerprint, snapshotFiles, diffChangedFiles, projectFingerprint } from "./projectSnapshot.mjs";
|
|
21
21
|
export { ShareBusyError, withProjectShareLock } from "./projectLock.mjs";
|
|
22
|
-
export { shareSources, shareSourceFingerprint, createProjectShareSourceStore } from "./shareSources.mjs";
|
package/dist/projectLock.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @template T @param {string} projectPath @param {"review" | "export"
|
|
1
|
+
/** @template T @param {string} projectPath @param {"review" | "export"} lane @param {() => Promise<T>} run
|
|
2
2
|
* @param {{ timeoutMs?: number, signal?: AbortSignal }} [options] @returns {Promise<T>} */
|
|
3
|
-
export function withProjectShareLock<T>(projectPath: string, lane: "review" | "export"
|
|
3
|
+
export function withProjectShareLock<T>(projectPath: string, lane: "review" | "export", run: () => Promise<T>, { timeoutMs, signal }?: {
|
|
4
4
|
timeoutMs?: number;
|
|
5
5
|
signal?: AbortSignal;
|
|
6
6
|
}): Promise<T>;
|
|
@@ -16,7 +16,5 @@ export function snapshotFiles(dir: string, files: Iterable<string>): Promise<Map
|
|
|
16
16
|
/** @param {Snapshot} before @param {Snapshot} after */
|
|
17
17
|
export function diffChangedFiles(before: Snapshot, after: Snapshot): string[];
|
|
18
18
|
export const HF_ID_ATTRIBUTE: RegExp;
|
|
19
|
-
export function projectFingerprint(projectPath: string
|
|
20
|
-
byContent?: boolean;
|
|
21
|
-
}): Promise<string>;
|
|
19
|
+
export function projectFingerprint(projectPath: string): Promise<string>;
|
|
22
20
|
export type Snapshot = Map<string, unknown>;
|
package/dist/reviewClient.d.mts
CHANGED
|
@@ -18,6 +18,22 @@ export function reviewClient({ access, fetchImpl, signedInEmail }: {
|
|
|
18
18
|
body: string;
|
|
19
19
|
attachment_ids: string[];
|
|
20
20
|
}) => Promise<any>;
|
|
21
|
+
/** @param {string} id @param {string} grantId @param {{role: import("./types/reviewWire.js").AccessGrantDTO["role"],
|
|
22
|
+
* expected_revision: number}} body @returns {Promise<import("./types/reviewWire.js").AccessGrantDTO>} */
|
|
23
|
+
updateGrant: (id: string, grantId: string, body: {
|
|
24
|
+
role: import("./types/reviewWire.js").AccessGrantDTO["role"];
|
|
25
|
+
expected_revision: number;
|
|
26
|
+
}) => Promise<import("./types/reviewWire.js").AccessGrantDTO>;
|
|
27
|
+
/** @param {string} id @param {string} grantId @returns {Promise<null>} */
|
|
28
|
+
revokeGrant: (id: string, grantId: string) => Promise<null>;
|
|
29
|
+
/** The project's live grants. @param {string} id
|
|
30
|
+
* @returns {Promise<{items: import("./types/reviewWire.js").AccessGrantDTO[]}>} */
|
|
31
|
+
grants: (id: string) => Promise<{
|
|
32
|
+
items: import("./types/reviewWire.js").AccessGrantDTO[];
|
|
33
|
+
}>;
|
|
34
|
+
/** @param {string} id @param {import("./types/reviewWire.js").CreateGrantRequest} body
|
|
35
|
+
* @returns {Promise<import("./types/reviewWire.js").AccessGrantDTO>} */
|
|
36
|
+
createGrant: (id: string, body: import("./types/reviewWire.js").CreateGrantRequest) => Promise<import("./types/reviewWire.js").AccessGrantDTO>;
|
|
21
37
|
/** @param {string} id @param {{ title: string, expected_title: string }} body
|
|
22
38
|
* @returns {Promise<{title: string}>} */
|
|
23
39
|
updateTitle: (id: string, body: {
|
|
@@ -31,19 +47,6 @@ export function reviewClient({ access, fetchImpl, signedInEmail }: {
|
|
|
31
47
|
listProjects: (spaceId: string, cursor?: string | null) => Promise<import("./types/reviewWire.js").ManagedReviewPage>;
|
|
32
48
|
/** @param {string} id @returns {Promise<null>} */
|
|
33
49
|
removeProject: (id: string) => Promise<null>;
|
|
34
|
-
/** @param {string} id @returns {Promise<{items: import("./types/reviewWire.js").AccessGrantDTO[]}>} */
|
|
35
|
-
grants: (id: string) => Promise<{
|
|
36
|
-
items: import("./types/reviewWire.js").AccessGrantDTO[];
|
|
37
|
-
}>;
|
|
38
|
-
createGrant: (id: string, body: import("./types/reviewWire.js").CreateGrantRequest) => Promise<import("./types/reviewWire.js").AccessGrantDTO>;
|
|
39
|
-
/** @param {string} id @param {string} grantId @param {{role: import("./types/reviewWire.js").AccessGrantDTO["role"],
|
|
40
|
-
* expected_revision: number}} body @returns {Promise<import("./types/reviewWire.js").AccessGrantDTO>} */
|
|
41
|
-
updateGrant: (id: string, grantId: string, body: {
|
|
42
|
-
role: import("./types/reviewWire.js").AccessGrantDTO["role"];
|
|
43
|
-
expected_revision: number;
|
|
44
|
-
}) => Promise<import("./types/reviewWire.js").AccessGrantDTO>;
|
|
45
|
-
/** @param {string} id @param {string} grantId @returns {Promise<null>} */
|
|
46
|
-
revokeGrant: (id: string, grantId: string) => Promise<null>;
|
|
47
50
|
openSummary: (token: string, versionId: string | null) => Promise<import("./types/shareOpen.js").OpenSummaryDTO>;
|
|
48
51
|
versionFiles: (token: string, versionId: string) => Promise<import("./types/shareOpen.js").VersionFilesDTO>;
|
|
49
52
|
fileUrls: (token: string, versionId: string, continuation: string, sha256s: string[]) => Promise<import("./types/shareOpen.js").FileUrlsDTO>;
|
package/dist/reviewExport.d.mts
CHANGED
|
@@ -56,7 +56,6 @@ export function versionFacts(dir: string): Promise<{
|
|
|
56
56
|
exportedAt: string;
|
|
57
57
|
projectId: string;
|
|
58
58
|
files?: boolean;
|
|
59
|
-
snapshot?: ExportRequest["snapshot"];
|
|
60
59
|
checksum?: string;
|
|
61
60
|
} | null;
|
|
62
61
|
source: "ready" | "none" | "not-mp4" | "stale";
|
|
@@ -70,7 +69,6 @@ export function versionOnPage(dir: string): Promise<{
|
|
|
70
69
|
exportedAt: string;
|
|
71
70
|
projectId: string;
|
|
72
71
|
files?: boolean;
|
|
73
|
-
snapshot?: ExportRequest["snapshot"];
|
|
74
72
|
checksum?: string;
|
|
75
73
|
} | null>;
|
|
76
74
|
/** Records that `versionId` carries files now, if it is still the last ready version.
|
|
@@ -118,7 +116,6 @@ export type VersionRecord = {
|
|
|
118
116
|
body: ExportRequest;
|
|
119
117
|
videoId: string | null;
|
|
120
118
|
projectId?: string | null;
|
|
121
|
-
renderKey?: string;
|
|
122
119
|
checkingSince?: number;
|
|
123
120
|
snapshotRefused?: boolean;
|
|
124
121
|
unanswered?: boolean;
|
|
@@ -130,12 +127,8 @@ export type VersionRecord = {
|
|
|
130
127
|
exportedAt: string;
|
|
131
128
|
projectId: string;
|
|
132
129
|
files?: boolean;
|
|
133
|
-
snapshot?: ExportRequest["snapshot"];
|
|
134
130
|
checksum?: string;
|
|
135
131
|
} | null;
|
|
136
|
-
failure?: (Failure & {
|
|
137
|
-
projectId: string;
|
|
138
|
-
}) | null;
|
|
139
132
|
};
|
|
140
133
|
/**
|
|
141
134
|
* `onAdded`: a version went ready, with whether it carries files and whether it is the page's first from here.
|
|
@@ -149,7 +142,7 @@ export type VersionHooks = {
|
|
|
149
142
|
/**
|
|
150
143
|
* `projectId` overrides the recorded review project; `open`: a held video is watched only while the project is open.
|
|
151
144
|
* `filesForExport`: the synced snapshot a new version carries, null for
|
|
152
|
-
* none.
|
|
145
|
+
* none.
|
|
153
146
|
*/
|
|
154
147
|
export type VersionRequest = VersionHooks & {
|
|
155
148
|
projectPath: string;
|
|
@@ -162,9 +155,6 @@ export type VersionRequest = VersionHooks & {
|
|
|
162
155
|
projectId?: string | null;
|
|
163
156
|
filesForExport?: FilesForRender;
|
|
164
157
|
fromReview?: FromReview | null;
|
|
165
|
-
allowPending?: boolean;
|
|
166
|
-
requireSource?: boolean;
|
|
167
|
-
omitSource?: boolean;
|
|
168
158
|
};
|
|
169
159
|
/**
|
|
170
160
|
* The snapshot of `rendered`, the project as the export was rendered; null when the folder is not that render.
|
package/dist/reviewUpload.d.mts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* @param {string} file @returns {Promise<string>} */
|
|
3
3
|
export function fileSha256Base64(file: string): Promise<string>;
|
|
4
4
|
/** @typedef {"sent" | "expired" | "refused" | "offline"} PutOutcome */
|
|
5
|
-
/** @param {string} url */
|
|
6
|
-
export function trustedUploadUrl(url: string): URL | null;
|
|
7
5
|
/** Streams the file to the signed URL through main's fetch (the app's proxy), the server's headers as given plus
|
|
8
6
|
* the length, and no bearer. Nothing sent or answered for `stallMs` ends it as offline, never "Uploading" forever.
|
|
9
7
|
* @param {{ put_url: string, headers: Record<string, string> }} upload @param {string} file @param {number} size
|
package/package.json
CHANGED
package/scripts/copy-types.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { cp } from "node:fs/promises";
|
|
2
2
|
await cp("src/types", "dist/types", { recursive: true });
|
|
3
3
|
await cp("src/hosts.d.ts", "dist/hosts.d.ts");
|
|
4
|
-
|
|
5
|
-
await cp("src/sources/types.d.ts", "dist/sources/types.d.ts");
|
|
6
|
-
await cp("src/sources/adapterTypes.d.ts", "dist/sources/adapterTypes.d.ts");
|
package/src/index.mjs
CHANGED
|
@@ -80,9 +80,3 @@ export { bindShareHost } from "./host.mjs";
|
|
|
80
80
|
/** @typedef {import("./types/share.js").AccessMode} AccessMode */
|
|
81
81
|
/** @typedef {import("./types/share.js").ReviewExportProgress} ReviewExportProgress */
|
|
82
82
|
export { pendingReviewExport } from "./reviewExport.mjs";
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
shareSources,
|
|
86
|
-
shareSourceFingerprint,
|
|
87
|
-
createProjectShareSourceStore,
|
|
88
|
-
} from "./shareSources.mjs";
|
package/src/projectLock.mjs
CHANGED
|
@@ -80,7 +80,7 @@ async function claim(candidate, lock, owner) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
/** @template T @param {string} projectPath @param {"review" | "export"
|
|
83
|
+
/** @template T @param {string} projectPath @param {"review" | "export"} lane @param {() => Promise<T>} run
|
|
84
84
|
* @param {{ timeoutMs?: number, signal?: AbortSignal }} [options] @returns {Promise<T>} */
|
|
85
85
|
export async function withProjectShareLock(
|
|
86
86
|
projectPath,
|
|
@@ -90,14 +90,7 @@ export async function withProjectShareLock(
|
|
|
90
90
|
) {
|
|
91
91
|
const root = await realpath(projectPath);
|
|
92
92
|
const folder = await mkdirInside(root, ".hyperframes");
|
|
93
|
-
const lock = join(
|
|
94
|
-
folder,
|
|
95
|
-
lane === "review"
|
|
96
|
-
? "review.lock"
|
|
97
|
-
: lane === "source"
|
|
98
|
-
? "share-source.lock"
|
|
99
|
-
: "review-export.lock",
|
|
100
|
-
);
|
|
93
|
+
const lock = join(folder, lane === "review" ? "review.lock" : "review-export.lock");
|
|
101
94
|
const owner = { token: randomUUID(), pid: process.pid, hostname: hostname() };
|
|
102
95
|
const candidate = `${lock}.${owner.token}.tmp`;
|
|
103
96
|
await writeFile(candidate, JSON.stringify(owner), { flag: "wx", mode: 0o600 });
|
package/src/projectSnapshot.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
// A project's files as change detection sees them: every file the film can use (isOutsideFilm), keyed by mtime and
|
|
3
3
|
// size, except html, keyed by content without the data-hf-id stamps. A run's change set and the watcher both read it.
|
|
4
|
-
import { readSourceIgnore } from "./sourceIgnore.mjs";
|
|
5
4
|
import fs from "node:fs/promises";
|
|
6
5
|
import { constants } from "node:fs";
|
|
7
6
|
import path from "node:path";
|
|
@@ -32,7 +31,7 @@ async function snapshotKey(full, byContent) {
|
|
|
32
31
|
const stat = await handle.stat();
|
|
33
32
|
if (!stat.isFile()) return undefined;
|
|
34
33
|
if (full.endsWith(".html")) return contentKey(await handle.readFile("utf8"));
|
|
35
|
-
if (byContent) return await
|
|
34
|
+
if (byContent) return sha256(await handle.readFile());
|
|
36
35
|
return `${stat.mtimeMs}:${stat.size}`;
|
|
37
36
|
} catch {
|
|
38
37
|
return undefined;
|
|
@@ -41,13 +40,6 @@ async function snapshotKey(full, byContent) {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
/** @param {import("node:fs/promises").FileHandle} handle */
|
|
45
|
-
async function hashFile(handle) {
|
|
46
|
-
const hash = createHash("sha256");
|
|
47
|
-
for await (const chunk of handle.createReadStream({ autoClose: false })) hash.update(chunk);
|
|
48
|
-
return hash.digest("hex");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
/** @param {import("node:fs").Dirent} entry @param {string} full @param {boolean} followSymlinks */
|
|
52
44
|
async function entryKind(entry, full, followSymlinks) {
|
|
53
45
|
if (!entry.isSymbolicLink()) return entry;
|
|
@@ -61,7 +53,6 @@ async function entryKind(entry, full, followSymlinks) {
|
|
|
61
53
|
export async function snapshotProject(dir, { byContent = false, followSymlinks = false } = {}) {
|
|
62
54
|
/** @type {Snapshot} */
|
|
63
55
|
const result = new Map();
|
|
64
|
-
const ignored = await readSourceIgnore(dir);
|
|
65
56
|
/** @param {string} current @param {Set<string>} ancestors */
|
|
66
57
|
async function walk(current, ancestors) {
|
|
67
58
|
const real = await fs.realpath(current).catch(() => null);
|
|
@@ -76,7 +67,7 @@ export async function snapshotProject(dir, { byContent = false, followSymlinks =
|
|
|
76
67
|
}
|
|
77
68
|
for (const entry of entries) {
|
|
78
69
|
const full = path.join(current, entry.name);
|
|
79
|
-
if (
|
|
70
|
+
if (isOutsideFilm(path.relative(dir, full))) continue;
|
|
80
71
|
const kind = await entryKind(entry, full, followSymlinks);
|
|
81
72
|
if (kind?.isDirectory()) await walk(full, parents);
|
|
82
73
|
else if (kind?.isFile()) {
|
|
@@ -102,12 +93,11 @@ export function snapshotFingerprint(snapshot) {
|
|
|
102
93
|
export async function snapshotFiles(dir, files) {
|
|
103
94
|
/** @type {Map<string, unknown>} */
|
|
104
95
|
const result = new Map();
|
|
105
|
-
const ignored = await readSourceIgnore(dir);
|
|
106
96
|
for (const file of files) {
|
|
107
97
|
const full = path.join(dir, file);
|
|
108
98
|
const stat = await fs.lstat(full).catch(() => null);
|
|
109
99
|
if (stat?.isDirectory()) return null;
|
|
110
|
-
const holds = stat?.isFile() && !
|
|
100
|
+
const holds = stat?.isFile() && !isOutsideFilm(path.relative(dir, full));
|
|
111
101
|
result.set(file, holds ? await snapshotKey(full, false) : undefined);
|
|
112
102
|
}
|
|
113
103
|
return result;
|
|
@@ -125,12 +115,6 @@ export function diffChangedFiles(before, after) {
|
|
|
125
115
|
return changed;
|
|
126
116
|
}
|
|
127
117
|
|
|
128
|
-
/** @param {string} projectPath
|
|
129
|
-
export const projectFingerprint = async (projectPath
|
|
130
|
-
snapshotFingerprint(await snapshotProject(projectPath, {
|
|
131
|
-
|
|
132
|
-
/** @param {string} dir @param {string} full @param {(path: string) => boolean} ignored */
|
|
133
|
-
function excludedFromSnapshot(dir, full, ignored) {
|
|
134
|
-
const relative = path.relative(dir, full);
|
|
135
|
-
return isOutsideFilm(relative) || ignored(relative.split(path.sep).join("/"));
|
|
136
|
-
}
|
|
118
|
+
/** @param {string} projectPath */
|
|
119
|
+
export const projectFingerprint = async (projectPath) =>
|
|
120
|
+
snapshotFingerprint(await snapshotProject(projectPath, { followSymlinks: true }));
|