@indigoai-us/hq-cloud 5.11.2 → 5.11.3
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/dist/bin/sync-runner.d.ts +9 -0
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +71 -4
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +60 -0
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts +9 -0
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +3 -1
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +33 -0
- package/dist/cli/share.test.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/remote-pull.d.ts +51 -0
- package/dist/remote-pull.d.ts.map +1 -0
- package/dist/remote-pull.js +40 -0
- package/dist/remote-pull.js.map +1 -0
- package/dist/remote-pull.test.d.ts +2 -0
- package/dist/remote-pull.test.d.ts.map +1 -0
- package/dist/remote-pull.test.js +229 -0
- package/dist/remote-pull.test.js.map +1 -0
- package/dist/s3.d.ts +12 -1
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +44 -1
- package/dist/s3.js.map +1 -1
- package/dist/s3.test.d.ts +9 -0
- package/dist/s3.test.d.ts.map +1 -0
- package/dist/s3.test.js +164 -0
- package/dist/s3.test.js.map +1 -0
- package/dist/watcher.d.ts +3 -1
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +6 -2
- package/dist/watcher.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/sync-runner.test.ts +82 -0
- package/src/bin/sync-runner.ts +77 -4
- package/src/cli/share.test.ts +48 -0
- package/src/cli/share.ts +12 -1
- package/src/index.ts +1 -1
- package/src/remote-pull.test.ts +241 -0
- package/src/remote-pull.ts +101 -0
- package/src/s3.test.ts +166 -0
- package/src/s3.ts +63 -0
- package/src/watcher.ts +7 -2
package/src/watcher.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { EntityContext } from "./types.js";
|
|
|
15
15
|
import { createIgnoreFilter, isWithinSizeLimit } from "./ignore.js";
|
|
16
16
|
import { readJournal, writeJournal, hashFile, updateEntry } from "./journal.js";
|
|
17
17
|
import { uploadFile, deleteRemoteFile } from "./s3.js";
|
|
18
|
+
import type { UploadAuthor } from "./s3.js";
|
|
18
19
|
|
|
19
20
|
const DEBOUNCE_MS = 2000;
|
|
20
21
|
|
|
@@ -28,14 +29,16 @@ export class SyncWatcher {
|
|
|
28
29
|
private watcher: FSWatcher | null = null;
|
|
29
30
|
private hqRoot: string;
|
|
30
31
|
private ctx: EntityContext;
|
|
32
|
+
private author?: UploadAuthor;
|
|
31
33
|
private shouldSync: (filePath: string, isDir?: boolean) => boolean;
|
|
32
34
|
private pendingChanges = new Map<string, PendingChange>();
|
|
33
35
|
private debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
34
36
|
private processing = false;
|
|
35
37
|
|
|
36
|
-
constructor(hqRoot: string, ctx: EntityContext) {
|
|
38
|
+
constructor(hqRoot: string, ctx: EntityContext, author?: UploadAuthor) {
|
|
37
39
|
this.hqRoot = hqRoot;
|
|
38
40
|
this.ctx = ctx;
|
|
41
|
+
this.author = author;
|
|
39
42
|
this.shouldSync = createIgnoreFilter(hqRoot);
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -116,7 +119,9 @@ export class SyncWatcher {
|
|
|
116
119
|
const existing = journal.files[relativePath];
|
|
117
120
|
if (existing && existing.hash === hash) continue;
|
|
118
121
|
|
|
119
|
-
const { etag } =
|
|
122
|
+
const { etag } = this.author
|
|
123
|
+
? await uploadFile(this.ctx, change.absolutePath, relativePath, this.author)
|
|
124
|
+
: await uploadFile(this.ctx, change.absolutePath, relativePath);
|
|
120
125
|
updateEntry(journal, relativePath, hash, stat.size, "up", etag);
|
|
121
126
|
}
|
|
122
127
|
} catch (err) {
|