@hyperframes/share 0.0.0-stage → 0.9.22
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 +51 -2
- package/dist/appOwnedPaths.d.mts +6 -0
- package/dist/fromReview.d.mts +15 -0
- package/dist/grantRefusal.d.mts +8 -0
- package/dist/host.d.mts +29 -0
- package/dist/hosts.d.ts +39 -0
- package/dist/index.d.mts +21 -0
- package/dist/projectLock.d.mts +17 -0
- package/dist/projectSnapshot.d.mts +20 -0
- package/dist/reviewAudience.d.mts +3 -0
- package/dist/reviewClient.d.mts +122 -0
- package/dist/reviewExport.d.mts +172 -0
- package/dist/reviewFiles.d.mts +43 -0
- package/dist/reviewLinkStates.d.mts +18 -0
- package/dist/reviewOpenCalls.d.mts +16 -0
- package/dist/reviewShare.d.mts +106 -0
- package/dist/reviewSwitch.d.mts +53 -0
- package/dist/reviewUpload.d.mts +16 -0
- package/dist/reviewVersionSentences.d.mts +2 -0
- package/dist/signedInRequest.d.mts +56 -0
- package/dist/storage.d.mts +20 -0
- package/dist/types/access.d.ts +12 -0
- package/dist/types/review.d.ts +59 -0
- package/dist/types/reviewWire.d.ts +200 -0
- package/dist/types/share.d.ts +119 -0
- package/dist/types/shareOpen.d.ts +96 -0
- package/package.json +112 -3
- package/scripts/copy-types.mjs +3 -0
- package/src/appOwnedPaths.mjs +27 -0
- package/src/fromReview.mjs +27 -0
- package/src/grantRefusal.mjs +28 -0
- package/src/host.mjs +46 -0
- package/src/hosts.d.ts +39 -0
- package/src/index.mjs +82 -0
- package/src/projectLock.mjs +120 -0
- package/src/projectSnapshot.mjs +120 -0
- package/src/reviewAudience.mjs +24 -0
- package/src/reviewClient.mjs +260 -0
- package/src/reviewExport.mjs +827 -0
- package/src/reviewFiles.mjs +98 -0
- package/src/reviewLinkStates.mjs +47 -0
- package/src/reviewOpenCalls.mjs +40 -0
- package/src/reviewShare.mjs +645 -0
- package/src/reviewSwitch.mjs +430 -0
- package/src/reviewUpload.mjs +98 -0
- package/src/reviewVersionSentences.mjs +48 -0
- package/src/signedInRequest.mjs +125 -0
- package/src/storage.mjs +116 -0
- package/src/types/access.d.ts +12 -0
- package/src/types/review.d.ts +59 -0
- package/src/types/reviewWire.d.ts +200 -0
- package/src/types/share.d.ts +119 -0
- package/src/types/shareOpen.d.ts +96 -0
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
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hyperframes/share
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node-only sharing kernel for Desktop, the CLI and local Studio's server. All hosts use the same review project, link settings, video versions and persisted retry state. This package does not render videos, sign users in, or define plan policy.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import {
|
|
7
|
+
bindShareHost,
|
|
8
|
+
reviewClient,
|
|
9
|
+
signedInRequest,
|
|
10
|
+
projectFingerprint,
|
|
11
|
+
shareForReview,
|
|
12
|
+
addVersion,
|
|
13
|
+
reviewStatus,
|
|
14
|
+
reviewVersion,
|
|
15
|
+
} from "@hyperframes/share";
|
|
16
|
+
|
|
17
|
+
bindShareHost({
|
|
18
|
+
normalize: realpathSync,
|
|
19
|
+
channelSite: "https://hyperframes.dev",
|
|
20
|
+
signinSites: ["https://hyperframes.dev"],
|
|
21
|
+
reviewUploadOrigins: ["https://review-bucket.s3.us-east-1.amazonaws.com"],
|
|
22
|
+
signedInRequest,
|
|
23
|
+
projectFingerprint,
|
|
24
|
+
latestExportFile, // (dir) => { path, fingerprint, id } | null
|
|
25
|
+
ffBinary, // ('ffprobe') => executable path
|
|
26
|
+
});
|
|
27
|
+
const client = reviewClient({ access, signedInEmail });
|
|
28
|
+
const share = await shareForReview({ projectPath, title, client, audience: "public" });
|
|
29
|
+
await addVersion({ projectPath, title, client, onProgress });
|
|
30
|
+
const [current, version] = await Promise.all([
|
|
31
|
+
reviewStatus({ projectPath, client }),
|
|
32
|
+
reviewVersion(projectPath),
|
|
33
|
+
]);
|
|
34
|
+
```
|
|
35
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
42
|
+
`reviewClient` exposes workspace capabilities, project listing/removal, grants, revision-checked access changes and export operations. `setReviewAccess`, `turnOffReviewLink`, and `removeReviewProject` retain the Desktop behavior. Enabling a revoked link produces a new URL. Disabling keeps the project and comments; removal is a separate operation.
|
|
43
|
+
|
|
44
|
+
Hosts can sync a renamed project with `client.updateTitle(id, { title, expected_title })`. An optional `fromReview` hook on `addVersion` supplies feedback attribution after sign-in on each send. Pass the same hook to `recheckHeld` or `refreshReviewExport` to clear the recorded activity when a pending version becomes ready.
|
|
45
|
+
|
|
46
|
+
Identity remains in the project’s generated review.json metadata (or the existing backend-specific filename); pending export requests remain in the generated review-export.json metadata. No bearer is stored there. A copied folder must deliberately reset sharing identity when creating a new project; a renamed folder retains it. A malformed/unreadable record fails instead of silently registering a new project. The error identifies the metadata file and asks the owner to restore a backup or contact support to reconnect the existing share; deleting the file can discard recovery state or consume another slot.
|
|
47
|
+
|
|
48
|
+
Metadata mutations and version uploads use separate cross-process locks under `.hyperframes`. Locks normally publish complete owner metadata with a hard link. Volumes that reject hard links use exclusive file creation instead; contenders wait while the owner metadata is written. An interrupted empty/malformed fallback lock is not automatically stolen. A lock is reclaimed only when the same machine proves its owner process is dead; live, foreign-machine and malformed locks are not stolen. Interrupted upload operations resume with their saved idempotency keys. Concurrent identical uploads re-read the completed version under the lock and do not create another version.
|
|
49
|
+
|
|
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
|
+
|
|
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.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** A file the film can never load, so no change report counts it: the app's own folders, anything hidden
|
|
2
|
+
* (a dot file or folder: .git, .DS_Store), installed packages, and temporary editor or download files.
|
|
3
|
+
* @param {string} relativePath */
|
|
4
|
+
export function isOutsideFilm(relativePath: string): boolean;
|
|
5
|
+
export const APP_OWNED_DIRS: string[];
|
|
6
|
+
export function isAppOwned(relativePath: string): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @typedef {{ read: (dir: string) => Promise<"yes" | "no" | null>,
|
|
2
|
+
* published: (dir: string, since: number) => Promise<void>, now: () => number }} FromReview */
|
|
3
|
+
/** @param {FromReview} host @param {string} dir */
|
|
4
|
+
export function readFromReview(host: FromReview, dir: string): Promise<{
|
|
5
|
+
value?: "yes" | "no" | undefined;
|
|
6
|
+
since: number;
|
|
7
|
+
}>;
|
|
8
|
+
/** Clear activity through the start of the successful share, keeping anything recorded later.
|
|
9
|
+
* @param {FromReview | null} host @param {string} dir @param {number | undefined} since */
|
|
10
|
+
export function sharedFromReview(host: FromReview | null, dir: string, since: number | undefined): Promise<void>;
|
|
11
|
+
export type FromReview = {
|
|
12
|
+
read: (dir: string) => Promise<"yes" | "no" | null>;
|
|
13
|
+
published: (dir: string, since: number) => Promise<void>;
|
|
14
|
+
now: () => number;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Definitive refusals are per-call data, not the project's mutable last-issue lookup.
|
|
2
|
+
* @param {unknown} error */
|
|
3
|
+
export function rejectedGrantRequest(error: unknown): boolean;
|
|
4
|
+
/** An explicit wire protocol survives Electron's Error-only serialization and the browser bridge.
|
|
5
|
+
* @param {string} reason @param {string} message */
|
|
6
|
+
export function grantRefusalMessage(reason: string, message: string): string;
|
|
7
|
+
/** @param {unknown} error */
|
|
8
|
+
export function decodeGrantRefusal(error: unknown): unknown;
|
package/dist/host.d.mts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function bindShareHost(part: Partial<ShareHost>): undefined;
|
|
2
|
+
/** @type {ShareHost["normalize"]} */
|
|
3
|
+
export const normalize: ShareHost["normalize"];
|
|
4
|
+
/** @type {ShareHost["assertOpenProject"]} */
|
|
5
|
+
export const assertOpenProject: ShareHost["assertOpenProject"];
|
|
6
|
+
/** @type {ShareHost["resolveOpenProjectByPath"]} */
|
|
7
|
+
export const resolveOpenProjectByPath: ShareHost["resolveOpenProjectByPath"];
|
|
8
|
+
/** @type {ShareHost["listOpenProjects"]} */
|
|
9
|
+
export const listOpenProjects: ShareHost["listOpenProjects"];
|
|
10
|
+
/** @type {ShareHost["homeName"]} */
|
|
11
|
+
export const homeName: ShareHost["homeName"];
|
|
12
|
+
/** @type {ShareHost["uploadWithProgress"]} */
|
|
13
|
+
export const uploadWithProgress: ShareHost["uploadWithProgress"];
|
|
14
|
+
/** @type {ShareHost["signedInRequest"]} */
|
|
15
|
+
export const signedInRequest: ShareHost["signedInRequest"];
|
|
16
|
+
/** @type {ShareHost["latestExportFile"]} */
|
|
17
|
+
export const latestExportFile: ShareHost["latestExportFile"];
|
|
18
|
+
export function reviewUploadOrigins(): readonly string[];
|
|
19
|
+
/** @type {ShareHost["projectFingerprint"]} */
|
|
20
|
+
export const projectFingerprint: ShareHost["projectFingerprint"];
|
|
21
|
+
/** @type {ShareHost["ffBinary"]} */
|
|
22
|
+
export const ffBinary: ShareHost["ffBinary"];
|
|
23
|
+
export function channelSite(): string;
|
|
24
|
+
export function signinSites(): string[];
|
|
25
|
+
export function runFile(file: string, args: string[]): import("node:child_process").PromiseWithChild<{
|
|
26
|
+
stdout: string;
|
|
27
|
+
stderr: string;
|
|
28
|
+
}>;
|
|
29
|
+
export type ShareHost = import("./hosts.js").ShareHost;
|
package/dist/hosts.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SignedInDeps, signedInRequest } from "./signedInRequest.mjs";
|
|
2
|
+
|
|
3
|
+
/** What sharing a project and its review link take from the host's main process (host.mjs bindShareHost). The
|
|
4
|
+
* network and the person's session stay the host's: every review call goes through its signed-in request and every
|
|
5
|
+
* archive through its uploader. */
|
|
6
|
+
export interface ShareHost {
|
|
7
|
+
execFile: typeof import("node:child_process").execFile;
|
|
8
|
+
/** The key every open-project lookup uses: the real path. */
|
|
9
|
+
normalize(path: string): string;
|
|
10
|
+
/** The open project's normalized path; refuses a project that is not open. */
|
|
11
|
+
assertOpenProject(path: string): string;
|
|
12
|
+
/** The open project at `path`, or null when it is not open. */
|
|
13
|
+
resolveOpenProjectByPath(path: string): { id: string; dir: string } | null;
|
|
14
|
+
/** All open projects, for invalidating removed review identities. */
|
|
15
|
+
listOpenProjects(): Array<{ dir: string }>;
|
|
16
|
+
/** The name the host shows for a project. */
|
|
17
|
+
homeName(path: string, folder?: string): string;
|
|
18
|
+
/** PUTs an archive through the host's network, hearing each chunk sent; answers the HTTP status. */
|
|
19
|
+
uploadWithProgress(
|
|
20
|
+
url: URL,
|
|
21
|
+
headers: Record<string, string>,
|
|
22
|
+
archive: Uint8Array,
|
|
23
|
+
onSent: (sent: number) => void,
|
|
24
|
+
): Promise<number>;
|
|
25
|
+
/** Requests to HeyGen's sign-in host as the signed-in person, traced as the host traces its API calls. */
|
|
26
|
+
signedInRequest(deps: Omit<SignedInDeps, "trace">): ReturnType<typeof signedInRequest>;
|
|
27
|
+
/** The newest finished export recorded in the project's renders folder whose file is still there. */
|
|
28
|
+
latestExportFile(dir: string): { path: string; fingerprint?: string; id: string } | null;
|
|
29
|
+
/** Trusted video upload origins configured by the host independently of the review API response. */
|
|
30
|
+
reviewUploadOrigins?: readonly string[];
|
|
31
|
+
/** The project as change detection sees it, as one hash. */
|
|
32
|
+
projectFingerprint(dir: string): Promise<string>;
|
|
33
|
+
/** The path of the host's FFmpeg tool `name`. */
|
|
34
|
+
ffBinary(name: "ffprobe"): string;
|
|
35
|
+
/** The sign-in site of the host's own channel, whose review record keeps the original name. */
|
|
36
|
+
channelSite: string;
|
|
37
|
+
/** Every sign-in site the host can sign in on. */
|
|
38
|
+
signinSites: string[];
|
|
39
|
+
}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { firstReviewAudience } from "./reviewAudience.mjs";
|
|
2
|
+
export { versionSentence } from "./reviewVersionSentences.mjs";
|
|
3
|
+
export { shareOpenCalls } from "./reviewOpenCalls.mjs";
|
|
4
|
+
export { bindShareHost } from "./host.mjs";
|
|
5
|
+
export type ShareHost = import("./hosts.js").ShareHost;
|
|
6
|
+
export type ReviewClient = import("./reviewClient.mjs").ReviewClient;
|
|
7
|
+
export type ReviewShare = import("./types/share.js").ReviewShare;
|
|
8
|
+
export type VersionRequest = import("./reviewExport.mjs").VersionRequest;
|
|
9
|
+
export type Wire = typeof import("./types/reviewWire.js");
|
|
10
|
+
export type AccessMode = import("./types/share.js").AccessMode;
|
|
11
|
+
export type ReviewExportProgress = import("./types/share.js").ReviewExportProgress;
|
|
12
|
+
export { setReviewSite, takenDown, listSpaces, reviewSpaces, shown, ownerOf, projectLine, oneAtATime, changeShare, reviewProjectId, localReviewProjects, reviewRecord, reviewRecordPath, reviewSwitchPath, onRebound, rebindRecord, setAsideReview, shareAnew, readShare, reviewStatus, shareForReview, setReviewAccess, turnOffReviewLink, reviewSentence, markReviewRemoved, removeLocalReview, removeReviewProject, reviewDestination } from "./reviewShare.mjs";
|
|
13
|
+
export { factsOf, reviewVersion, addVersion, recheckHeld, refreshReviewExport, addFirstVersion, versionFacts, versionOnPage, markFiles, pendingReviewExport } from "./reviewExport.mjs";
|
|
14
|
+
export { ReviewFailed, SHARING_REFUSALS, reviewClient } from "./reviewClient.mjs";
|
|
15
|
+
export { filesStateOf, reviewFiles } from "./reviewFiles.mjs";
|
|
16
|
+
export { switchOperationId, retryOldLink, oldLinkOf, changeSpace, resumeSpaceChange, switchSentence } from "./reviewSwitch.mjs";
|
|
17
|
+
export { fileSha256Base64, putFile } from "./reviewUpload.mjs";
|
|
18
|
+
export { linkStateOf, reviewLinkStates } from "./reviewLinkStates.mjs";
|
|
19
|
+
export { AccountUnreachable, UNREACHABLE, readOrUnreachable, orIfUnreachable, signedInRequest } from "./signedInRequest.mjs";
|
|
20
|
+
export { HF_ID_ATTRIBUTE, contentKey, snapshotProject, snapshotFingerprint, snapshotFiles, diffChangedFiles, projectFingerprint } from "./projectSnapshot.mjs";
|
|
21
|
+
export { ShareBusyError, withProjectShareLock } from "./projectLock.mjs";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @template T @param {string} projectPath @param {"review" | "export"} lane @param {() => Promise<T>} run
|
|
2
|
+
* @param {{ timeoutMs?: number, signal?: AbortSignal }} [options] @returns {Promise<T>} */
|
|
3
|
+
export function withProjectShareLock<T>(projectPath: string, lane: "review" | "export", run: () => Promise<T>, { timeoutMs, signal }?: {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}): Promise<T>;
|
|
7
|
+
export class ShareBusyError extends Error {
|
|
8
|
+
/** @param {string} path */
|
|
9
|
+
constructor(path: string);
|
|
10
|
+
reason: string;
|
|
11
|
+
lockPath: string;
|
|
12
|
+
}
|
|
13
|
+
export type Owner = {
|
|
14
|
+
token: string;
|
|
15
|
+
pid: number;
|
|
16
|
+
hostname: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @param {string} html */
|
|
2
|
+
export function contentKey(html: string): string;
|
|
3
|
+
/** @typedef {Map<string, unknown>} Snapshot */
|
|
4
|
+
/** @param {string} dir @param {{ byContent?: boolean, followSymlinks?: boolean }} [options] @returns {Promise<Snapshot>} */
|
|
5
|
+
export function snapshotProject(dir: string, { byContent, followSymlinks }?: {
|
|
6
|
+
byContent?: boolean;
|
|
7
|
+
followSymlinks?: boolean;
|
|
8
|
+
}): Promise<Snapshot>;
|
|
9
|
+
/** What an export's sidecar records of the project, from a snapshot already taken.
|
|
10
|
+
* @param {Snapshot} snapshot */
|
|
11
|
+
export function snapshotFingerprint(snapshot: Snapshot): string;
|
|
12
|
+
/** Just these project files, keyed as snapshotProject keys them (undefined: not a file the snapshot holds); null when
|
|
13
|
+
* one is a folder, which only a whole snapshot covers. @param {string} dir @param {Iterable<string>} files
|
|
14
|
+
* @returns {Promise<Map<string, unknown> | null>} */
|
|
15
|
+
export function snapshotFiles(dir: string, files: Iterable<string>): Promise<Map<string, unknown> | null>;
|
|
16
|
+
/** @param {Snapshot} before @param {Snapshot} after */
|
|
17
|
+
export function diffChangedFiles(before: Snapshot, after: Snapshot): string[];
|
|
18
|
+
export const HF_ID_ATTRIBUTE: RegExp;
|
|
19
|
+
export function projectFingerprint(projectPath: string): Promise<string>;
|
|
20
|
+
export type Snapshot = Map<string, unknown>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** @param {import("./types/reviewWire.js").ReviewEntitlements | null | undefined} entitlements
|
|
2
|
+
* @param {import("./types/share.js").AccessMode | undefined} chosen */
|
|
3
|
+
export function firstReviewAudience(entitlements: import("./types/reviewWire.js").ReviewEntitlements | null | undefined, chosen: import("./types/share.js").AccessMode | undefined): import("./types/share.js").AccessMode;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** @param {{ access: import("./types/access.js").ApiAccess, fetchImpl?: typeof fetch,
|
|
2
|
+
* signedInEmail?: () => Promise<string | null> }} deps */
|
|
3
|
+
export function reviewClient({ access, fetchImpl, signedInEmail }: {
|
|
4
|
+
access: import("./types/access.js").ApiAccess;
|
|
5
|
+
fetchImpl?: typeof fetch;
|
|
6
|
+
signedInEmail?: () => Promise<string | null>;
|
|
7
|
+
}): {
|
|
8
|
+
/** Accept, dismiss, reopen or resolve a thread. @param {string} id @param {string} rootId
|
|
9
|
+
* @param {{ action: import("./types/review.js").ReviewAction, expected_status_revision: number }} body */
|
|
10
|
+
setStatus: (id: string, rootId: string, body: {
|
|
11
|
+
action: import("./types/review.js").ReviewAction;
|
|
12
|
+
expected_status_revision: number;
|
|
13
|
+
}) => Promise<any>;
|
|
14
|
+
/** @param {string} id @param {string} rootId
|
|
15
|
+
* @param {{ client_operation_id: string, body: string, attachment_ids: string[] }} body */
|
|
16
|
+
reply: (id: string, rootId: string, body: {
|
|
17
|
+
client_operation_id: string;
|
|
18
|
+
body: string;
|
|
19
|
+
attachment_ids: string[];
|
|
20
|
+
}) => Promise<any>;
|
|
21
|
+
/** @param {string} id @param {{ title: string, expected_title: string }} body
|
|
22
|
+
* @returns {Promise<{title: string}>} */
|
|
23
|
+
updateTitle: (id: string, body: {
|
|
24
|
+
title: string;
|
|
25
|
+
expected_title: string;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
title: string;
|
|
28
|
+
}>;
|
|
29
|
+
/** @param {string} spaceId @param {string | null} [cursor] @returns
|
|
30
|
+
* {Promise<import("./types/reviewWire.js").ManagedReviewPage>} */
|
|
31
|
+
listProjects: (spaceId: string, cursor?: string | null) => Promise<import("./types/reviewWire.js").ManagedReviewPage>;
|
|
32
|
+
/** @param {string} id @returns {Promise<null>} */
|
|
33
|
+
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
|
+
openSummary: (token: string, versionId: string | null) => Promise<import("./types/shareOpen.js").OpenSummaryDTO>;
|
|
48
|
+
versionFiles: (token: string, versionId: string) => Promise<import("./types/shareOpen.js").VersionFilesDTO>;
|
|
49
|
+
fileUrls: (token: string, versionId: string, continuation: string, sha256s: string[]) => Promise<import("./types/shareOpen.js").FileUrlsDTO>;
|
|
50
|
+
logCopy: (token: string, versionId: string, handoffId: string | null) => Promise<null>;
|
|
51
|
+
/** The signed-in account's email, null when unknown; the record keeps it as the project's owner. */
|
|
52
|
+
signedInEmail: () => Promise<string | null>;
|
|
53
|
+
/** The spaces this account can share into, personal first.
|
|
54
|
+
* @returns {Promise<import("./types/reviewWire.js").SpaceDTO[]>} */
|
|
55
|
+
spaces: () => Promise<import("./types/reviewWire.js").SpaceDTO[]>;
|
|
56
|
+
/** The server's per-account flags on review-spaces, each on only for `true`: `hyperframes-review-version-sharing`
|
|
57
|
+
* and `hyperframes-review-share-files`. One read answers both.
|
|
58
|
+
* @returns {Promise<{ versionSharing: boolean, shareFiles: boolean }>} */
|
|
59
|
+
reviewFlags: () => Promise<{
|
|
60
|
+
versionSharing: boolean;
|
|
61
|
+
shareFiles: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
/** Registers into `spaceId`; without one the server uses the caller's default space.
|
|
64
|
+
* @param {import("./types/reviewWire.js").RegisterProjectRequest} body @param {string | null} [spaceId]
|
|
65
|
+
* @returns {Promise<ProjectDTO>} */
|
|
66
|
+
register: (body: import("./types/reviewWire.js").RegisterProjectRequest, spaceId?: string | null) => Promise<ProjectDTO>;
|
|
67
|
+
/** @param {string} id @returns {Promise<ShareDTO>} */
|
|
68
|
+
share: (id: string) => Promise<ShareDTO>;
|
|
69
|
+
/** @param {string} id @param {import("./types/reviewWire.js").UpdateProjectShareRequest} body
|
|
70
|
+
* @returns {Promise<ShareDTO>} */
|
|
71
|
+
updateShare: (id: string, body: import("./types/reviewWire.js").UpdateProjectShareRequest) => Promise<ShareDTO>;
|
|
72
|
+
/** @param {string} id @param {import("./types/reviewWire.js").ProjectOperationRequest} body @returns {Promise<ShareDTO>} */
|
|
73
|
+
linkOn: (id: string, body: import("./types/reviewWire.js").ProjectOperationRequest) => Promise<ShareDTO>;
|
|
74
|
+
/** @param {string} id @returns {Promise<null>} */
|
|
75
|
+
linkOff: (id: string) => Promise<null>;
|
|
76
|
+
/** @param {string} id @returns {Promise<ProjectDTO>} */
|
|
77
|
+
project: (id: string) => Promise<ProjectDTO>;
|
|
78
|
+
/** One page of the project's comments, every state. @param {string} id @param {URLSearchParams} query
|
|
79
|
+
* @returns {Promise<import("./types/reviewWire.js").FeedbackPage>} */
|
|
80
|
+
feedback: (id: string, query: URLSearchParams) => Promise<import("./types/reviewWire.js").FeedbackPage>;
|
|
81
|
+
/** A new version from a local MP4. A body factory runs after sign-in on each attempt.
|
|
82
|
+
* @param {string} id @param {ExportRequest | (() => Promise<ExportRequest>)} body @returns {Promise<ExportDTO>} */
|
|
83
|
+
createExport: (id: string, body: ExportRequest | (() => Promise<ExportRequest>)) => Promise<ExportDTO>;
|
|
84
|
+
/** @param {string} id @param {string} videoId @returns {Promise<ExportDTO>} */
|
|
85
|
+
readExport: (id: string, videoId: string) => Promise<ExportDTO>;
|
|
86
|
+
/** The upload is in storage: start processing. @param {string} id @param {string} videoId
|
|
87
|
+
* @returns {Promise<ExportDTO>} */
|
|
88
|
+
completeExport: (id: string, videoId: string) => Promise<ExportDTO>;
|
|
89
|
+
/** Attaches the synced snapshot to a version that has none; the same one again is a no-op, another is refused
|
|
90
|
+
* with 409 `snapshot_already_attached`. @param {string} id @param {string} versionId
|
|
91
|
+
* @param {import("./types/reviewWire.js").SnapshotRef} snapshot @returns {Promise<unknown>} */
|
|
92
|
+
attachSnapshot: (id: string, versionId: string, snapshot: import("./types/reviewWire.js").SnapshotRef) => Promise<unknown>;
|
|
93
|
+
};
|
|
94
|
+
/** A refused or failed call: the HTTP status (0 when the server was never reached) and the server's reason. */
|
|
95
|
+
export class ReviewFailed extends Error {
|
|
96
|
+
/** @param {number} status @param {string} reason @param {number} [currentRevision] @param {number} [retryAfterMs]
|
|
97
|
+
* @param {import("./types/reviewWire.js").ErrorEnvelope["data"]} [details] */
|
|
98
|
+
constructor(status: number, reason: string, currentRevision?: number, retryAfterMs?: number, details?: import("./types/reviewWire.js").ErrorEnvelope["data"]);
|
|
99
|
+
status: number;
|
|
100
|
+
reason: string;
|
|
101
|
+
currentRevision: number | undefined;
|
|
102
|
+
retryAfterMs: number | undefined;
|
|
103
|
+
details: {
|
|
104
|
+
reason: string;
|
|
105
|
+
current_revision?: number;
|
|
106
|
+
space?: {
|
|
107
|
+
name: string;
|
|
108
|
+
kind: "team";
|
|
109
|
+
};
|
|
110
|
+
workspace_id?: string;
|
|
111
|
+
project_limit?: number;
|
|
112
|
+
projects_used_up_to_limit?: number;
|
|
113
|
+
requested_feature?: string;
|
|
114
|
+
} | undefined;
|
|
115
|
+
}
|
|
116
|
+
/** The server's own "no" to the sharing read: signed out, not allowed, or no such route. */
|
|
117
|
+
export const SHARING_REFUSALS: number[];
|
|
118
|
+
export type ReviewClient = ReturnType<typeof reviewClient>;
|
|
119
|
+
export type ExportRequest = import("./types/reviewWire.js").ExportRequest;
|
|
120
|
+
export type ShareDTO = import("./types/reviewWire.js").ShareDTO;
|
|
121
|
+
export type ProjectDTO = import("./types/reviewWire.js").ProjectDTO;
|
|
122
|
+
export type ExportDTO = import("./types/reviewWire.js").ExportDTO;
|