@narumitw/pi-sync 0.25.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +238 -121
- package/package.json +7 -2
- package/src/command.ts +162 -24
- package/src/config.ts +395 -89
- package/src/file-selection.ts +280 -0
- package/src/index.ts +1 -0
- package/src/lock.ts +3 -3
- package/src/manager-ui.ts +961 -0
- package/src/s3-client.ts +47 -13
- package/src/settings-management.ts +307 -0
- package/src/snapshot-apply.ts +41 -17
- package/src/snapshot-transaction.ts +201 -0
- package/src/snapshot.ts +76 -95
- package/src/sync-format.ts +168 -0
- package/src/sync-policy.ts +129 -0
- package/src/sync-state.ts +167 -0
- package/src/sync.ts +357 -351
- package/src/types.ts +47 -0
package/src/types.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
export type StorageProfileKind = "r2" | "s3-compatible";
|
|
2
|
+
|
|
3
|
+
export interface StorageProfileSettings {
|
|
4
|
+
kind?: StorageProfileKind;
|
|
5
|
+
endpoint?: string;
|
|
6
|
+
region?: string;
|
|
7
|
+
accessKeyId?: string;
|
|
8
|
+
secretAccessKey?: string;
|
|
9
|
+
sessionToken?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SyncTargetSettings {
|
|
13
|
+
profile?: string;
|
|
14
|
+
bucket?: string;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
namespace?: string;
|
|
17
|
+
autoSync?: boolean;
|
|
18
|
+
syncFiles?: unknown;
|
|
19
|
+
syncSessions?: boolean;
|
|
20
|
+
extraFiles?: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PiSyncSettingsV2 {
|
|
24
|
+
version: 2;
|
|
25
|
+
activeTarget?: string;
|
|
26
|
+
profiles?: Record<string, StorageProfileSettings>;
|
|
27
|
+
targets?: Record<string, SyncTargetSettings>;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
1
31
|
export interface SyncConfig {
|
|
2
32
|
endpoint: string;
|
|
3
33
|
bucket: string;
|
|
@@ -5,13 +35,24 @@ export interface SyncConfig {
|
|
|
5
35
|
accessKeyId: string;
|
|
6
36
|
secretAccessKey: string;
|
|
7
37
|
sessionToken?: string;
|
|
38
|
+
/** Remote namespace retained as `profile` for snapshot/wire compatibility. */
|
|
8
39
|
profile: string;
|
|
9
40
|
prefix: string;
|
|
41
|
+
target?: string;
|
|
42
|
+
storageProfile?: string;
|
|
43
|
+
storageKind?: StorageProfileKind;
|
|
44
|
+
autoSync?: boolean;
|
|
45
|
+
settingsVersion?: 1 | 2;
|
|
46
|
+
syncFiles?: string[];
|
|
10
47
|
syncSessions: boolean;
|
|
11
48
|
extraFiles: string[];
|
|
12
49
|
}
|
|
13
50
|
|
|
14
51
|
export interface PartialConfig {
|
|
52
|
+
target?: string;
|
|
53
|
+
storageProfile?: string;
|
|
54
|
+
storageKind?: StorageProfileKind;
|
|
55
|
+
settingsVersion?: 1 | 2;
|
|
15
56
|
endpoint?: string;
|
|
16
57
|
bucket?: string;
|
|
17
58
|
region?: string;
|
|
@@ -21,6 +62,7 @@ export interface PartialConfig {
|
|
|
21
62
|
profile?: string;
|
|
22
63
|
prefix?: string;
|
|
23
64
|
autoSync?: boolean | string;
|
|
65
|
+
syncFiles?: unknown;
|
|
24
66
|
syncSessions?: boolean | string;
|
|
25
67
|
extraFiles?: unknown;
|
|
26
68
|
}
|
|
@@ -63,6 +105,7 @@ export interface SyncState {
|
|
|
63
105
|
lastAppliedSnapshot?: string;
|
|
64
106
|
lastRemoteEtag?: string;
|
|
65
107
|
lastFileHashes: Record<string, string>;
|
|
108
|
+
syncFiles?: string[];
|
|
66
109
|
syncSessions?: boolean;
|
|
67
110
|
extraFiles?: string[];
|
|
68
111
|
}
|
|
@@ -81,6 +124,9 @@ export interface CommandOptions {
|
|
|
81
124
|
silent: boolean;
|
|
82
125
|
reload: boolean;
|
|
83
126
|
auto: boolean;
|
|
127
|
+
target?: string;
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
onCommit?: () => void;
|
|
84
130
|
args: string[];
|
|
85
131
|
}
|
|
86
132
|
|
|
@@ -91,6 +137,7 @@ export interface CommandArgumentCompletion {
|
|
|
91
137
|
}
|
|
92
138
|
|
|
93
139
|
export interface SnapshotOptions {
|
|
140
|
+
syncFiles?: string[];
|
|
94
141
|
syncSessions?: boolean;
|
|
95
142
|
sessionDir?: string;
|
|
96
143
|
extraFiles?: string[];
|