@narumitw/pi-sync 0.50.2 → 0.51.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 +4 -1
- package/dist/chunks/{chunk-6LP3MCR2.ts → chunk-2JZFHNLM.ts} +3 -5
- package/dist/chunks/chunk-2JZFHNLM.ts.map +7 -0
- package/dist/chunks/{chunk-LCRI3ABW.ts → chunk-2RZSQWBH.ts} +8 -19
- package/dist/chunks/chunk-2RZSQWBH.ts.map +7 -0
- package/dist/chunks/{chunk-IJ6FJFA5.ts → chunk-4AIHXRKE.ts} +11 -17
- package/dist/chunks/chunk-4AIHXRKE.ts.map +7 -0
- package/dist/chunks/{chunk-C7XY5NF5.ts → chunk-4MPIH46N.ts} +29 -51
- package/dist/chunks/chunk-4MPIH46N.ts.map +7 -0
- package/dist/chunks/{chunk-5B3FXBLE.ts → chunk-6546TS54.ts} +16 -20
- package/dist/chunks/chunk-6546TS54.ts.map +7 -0
- package/dist/chunks/{chunk-Q2TUM5X6.ts → chunk-6NT3YFGY.ts} +2 -2
- package/dist/chunks/chunk-6NT3YFGY.ts.map +7 -0
- package/dist/chunks/{chunk-2B2ELUF5.ts → chunk-7D5SF7P3.ts} +1 -1
- package/dist/chunks/chunk-7D5SF7P3.ts.map +7 -0
- package/dist/chunks/{chunk-4CHTZMEO.ts → chunk-7KHKWL3Q.ts} +37 -55
- package/dist/chunks/chunk-7KHKWL3Q.ts.map +7 -0
- package/dist/chunks/{chunk-ZI5MXMEX.ts → chunk-BVVP33U5.ts} +2 -4
- package/dist/chunks/chunk-BVVP33U5.ts.map +7 -0
- package/dist/chunks/{chunk-SZWBGPID.ts → chunk-DM4X4FIA.ts} +8 -13
- package/dist/chunks/chunk-DM4X4FIA.ts.map +7 -0
- package/dist/chunks/{chunk-SL64RLXR.ts → chunk-DZUSTGQV.ts} +8 -16
- package/dist/chunks/chunk-DZUSTGQV.ts.map +7 -0
- package/dist/chunks/{chunk-G4RNQQZS.ts → chunk-E42GXD6D.ts} +13 -19
- package/dist/chunks/chunk-E42GXD6D.ts.map +7 -0
- package/dist/chunks/{chunk-Z4DQF6L3.ts → chunk-ECYCNZOE.ts} +1 -1
- package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
- package/dist/chunks/{chunk-OEX4ABY6.ts → chunk-EEJPYTWE.ts} +11 -21
- package/dist/chunks/chunk-EEJPYTWE.ts.map +7 -0
- package/dist/chunks/{chunk-CPEHGXJV.ts → chunk-G4RUXRWZ.ts} +3 -5
- package/dist/chunks/chunk-G4RUXRWZ.ts.map +7 -0
- package/dist/chunks/{chunk-T2B5IU74.ts → chunk-HGJH56KR.ts} +4 -4
- package/dist/chunks/chunk-HGJH56KR.ts.map +7 -0
- package/dist/chunks/{chunk-JAAKLL6M.ts → chunk-IVXEDPAD.ts} +10 -34
- package/dist/chunks/chunk-IVXEDPAD.ts.map +7 -0
- package/dist/chunks/chunk-K3RIEL6J.ts +20 -0
- package/dist/chunks/chunk-K3RIEL6J.ts.map +7 -0
- package/dist/chunks/{chunk-LTBWGSBV.ts → chunk-MSSW6F3R.ts} +1 -1
- package/dist/chunks/chunk-MSSW6F3R.ts.map +7 -0
- package/dist/chunks/{chunk-T3HH3UEJ.ts → chunk-OVDTF5CH.ts} +4 -10
- package/dist/chunks/chunk-OVDTF5CH.ts.map +7 -0
- package/dist/chunks/{chunk-NJFUIVYL.ts → chunk-PWMWOJP4.ts} +1 -1
- package/dist/chunks/chunk-PWMWOJP4.ts.map +7 -0
- package/dist/chunks/{chunk-HUDQATCL.ts → chunk-Q32CQWPM.ts} +6 -8
- package/dist/chunks/chunk-Q32CQWPM.ts.map +7 -0
- package/dist/chunks/{chunk-ETTRJDNP.ts → chunk-QLSN7AGX.ts} +6 -13
- package/dist/chunks/chunk-QLSN7AGX.ts.map +7 -0
- package/dist/chunks/{chunk-THMF4BVL.ts → chunk-SWUXA3MH.ts} +1 -1
- package/dist/chunks/chunk-SWUXA3MH.ts.map +7 -0
- package/dist/chunks/{chunk-TEN2ZBJV.ts → chunk-T2SJD3N7.ts} +2 -4
- package/dist/chunks/chunk-T2SJD3N7.ts.map +7 -0
- package/dist/chunks/{chunk-AUSDLD6F.ts → chunk-T56RNRZJ.ts} +10 -26
- package/dist/chunks/chunk-T56RNRZJ.ts.map +7 -0
- package/dist/chunks/{chunk-KW7YQEZN.ts → chunk-UA7RXOIT.ts} +48 -100
- package/dist/chunks/chunk-UA7RXOIT.ts.map +7 -0
- package/dist/chunks/{chunk-D5X27LCA.ts → chunk-UETBKTDI.ts} +1 -1
- package/dist/chunks/chunk-UETBKTDI.ts.map +7 -0
- package/dist/chunks/{chunk-CHH26D4F.ts → chunk-YFADF5ZQ.ts} +7 -6
- package/dist/chunks/chunk-YFADF5ZQ.ts.map +7 -0
- package/dist/chunks/{chunk-CCSN3F47.ts → chunk-YPXGU5OR.ts} +4 -4
- package/dist/chunks/chunk-YPXGU5OR.ts.map +7 -0
- package/dist/chunks/{file-selection-FTTKAOYX.ts → file-selection-RAVHRYFG.ts} +14 -26
- package/dist/chunks/file-selection-RAVHRYFG.ts.map +7 -0
- package/dist/chunks/{git-backend-GMVS4PD4.ts → git-backend-IAANDL3K.ts} +41 -104
- package/dist/chunks/git-backend-IAANDL3K.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-OTUMQM26.ts +23 -0
- package/dist/chunks/{manager-ui-5KLKVMRC.ts → manager-ui-763NEKJY.ts} +124 -251
- package/dist/chunks/manager-ui-763NEKJY.ts.map +7 -0
- package/dist/chunks/remote-selection-ui-TZTJF32Y.ts +22 -0
- package/dist/chunks/{s3-backend-66O4FGBH.ts → s3-backend-XGXUOPUN.ts} +23 -54
- package/dist/chunks/s3-backend-XGXUOPUN.ts.map +7 -0
- package/dist/chunks/{setup-switch-IS2PEZ3J.ts → setup-switch-5G2VNJHL.ts} +9 -9
- package/dist/chunks/{setup-wizard-IUB6ESEU.ts → setup-wizard-YIEWGX32.ts} +12 -12
- package/dist/chunks/setup-wizard-YIEWGX32.ts.map +7 -0
- package/dist/chunks/{snapshot-HKEWCVK6.ts → snapshot-JL5DFSXI.ts} +5 -5
- package/dist/chunks/sync-inspection-P3ENJLNF.ts +20 -0
- package/dist/chunks/{sync-operations-LBX3GKCM.ts → sync-operations-AR76EB6C.ts} +85 -201
- package/dist/chunks/sync-operations-AR76EB6C.ts.map +7 -0
- package/dist/chunks/{sync-state-Q2FTXTW6.ts → sync-state-VHJUZ4YG.ts} +6 -6
- package/dist/chunks/{webdav-backend-ECIKD7SO.ts → webdav-backend-3EGUONAT.ts} +20 -51
- package/dist/chunks/webdav-backend-3EGUONAT.ts.map +7 -0
- package/dist/index.ts +49 -74
- package/dist/index.ts.map +3 -3
- package/docs/settings.md +9 -0
- package/package.json +61 -62
- package/src/backends/backend-factory.ts +15 -15
- package/src/backends/backend-identity.ts +31 -31
- package/src/backends/backend-types.ts +42 -42
- package/src/backends/git/git-backend.ts +714 -788
- package/src/backends/git/git-config.ts +104 -111
- package/src/backends/git/git-runner.ts +230 -247
- package/src/backends/git/git-storage.ts +228 -245
- package/src/backends/s3/s3-backend.ts +408 -441
- package/src/backends/s3/s3-client.ts +288 -333
- package/src/backends/sync-backend.ts +65 -65
- package/src/backends/webdav/webdav-backend.ts +542 -589
- package/src/backends/webdav/webdav-client.ts +292 -316
- package/src/backends/webdav/webdav-config.ts +57 -68
- package/src/commands/command-execution.ts +270 -289
- package/src/commands/command-handler.ts +160 -163
- package/src/commands/command-types.ts +13 -13
- package/src/commands/command.ts +190 -196
- package/src/commands/setup-completions.ts +1 -1
- package/src/paths.ts +47 -47
- package/src/settings/config-errors.ts +4 -5
- package/src/settings/config-file.ts +473 -506
- package/src/settings/config.ts +171 -174
- package/src/settings/settings-management.ts +191 -216
- package/src/settings/settings-store.ts +63 -77
- package/src/settings/settings-types.ts +78 -75
- package/src/settings/settings-validation.ts +328 -364
- package/src/snapshot/session-paths.ts +41 -55
- package/src/snapshot/snapshot-apply.ts +197 -229
- package/src/snapshot/snapshot-codec.ts +29 -31
- package/src/snapshot/snapshot-paths.ts +4 -6
- package/src/snapshot/snapshot-transaction.ts +161 -170
- package/src/snapshot/snapshot-types.ts +24 -24
- package/src/snapshot/snapshot.ts +310 -343
- package/src/state/json-file.ts +11 -11
- package/src/state/lock.ts +226 -242
- package/src/state/lockfile-fs.ts +20 -20
- package/src/state/operation-availability.ts +36 -41
- package/src/state/state-directory.ts +171 -173
- package/src/state/state-types.ts +15 -15
- package/src/state/sync-state-store.ts +23 -23
- package/src/sync/automatic-sync.ts +75 -80
- package/src/sync/remote-snapshot.ts +52 -60
- package/src/sync/setup-switch.ts +99 -114
- package/src/sync/signals.ts +3 -5
- package/src/sync/startup-check.ts +97 -111
- package/src/sync/sync-decision.ts +76 -80
- package/src/sync/sync-error-guidance.ts +41 -48
- package/src/sync/sync-errors.ts +10 -10
- package/src/sync/sync-inspection.ts +29 -33
- package/src/sync/sync-loaders.ts +28 -36
- package/src/sync/sync-mutations.ts +510 -622
- package/src/sync/sync-operations.ts +7 -7
- package/src/sync/sync-policy.ts +296 -326
- package/src/sync/sync-queries.ts +175 -194
- package/src/sync/sync-state.ts +74 -100
- package/src/sync-extension.ts +89 -101
- package/src/sync.ts +26 -26
- package/src/types.ts +37 -37
- package/src/ui/automatic-sync-summary.ts +1 -3
- package/src/ui/cancellable-operation.ts +92 -112
- package/src/ui/file-selection.ts +250 -274
- package/src/ui/manager-attention.ts +51 -63
- package/src/ui/manager-recovery.ts +48 -57
- package/src/ui/manager-result-dispatcher.ts +62 -76
- package/src/ui/manager-state.ts +200 -232
- package/src/ui/manager-ui.ts +264 -362
- package/src/ui/remote-selection-ui.ts +547 -588
- package/src/ui/secret-input.ts +198 -214
- package/src/ui/settings-ui.ts +175 -172
- package/src/ui/setup/git-ui.ts +232 -261
- package/src/ui/setup/s3-credentials-ui.ts +58 -65
- package/src/ui/setup/s3-ui.ts +171 -195
- package/src/ui/setup/setup-actions.ts +91 -101
- package/src/ui/setup/setup-location-ui.ts +121 -137
- package/src/ui/setup/setup-name-ui.ts +27 -27
- package/src/ui/setup/setup-prompts.ts +65 -65
- package/src/ui/setup/setup-review.ts +58 -59
- package/src/ui/setup/setup-switcher.ts +156 -160
- package/src/ui/setup/setup-wizard.ts +28 -28
- package/src/ui/setup/text-input.ts +54 -58
- package/src/ui/setup/webdav-ui.ts +246 -293
- package/src/ui/storage-connections-ui.ts +317 -369
- package/src/ui/sync-attention.ts +148 -164
- package/src/ui/sync-format.ts +110 -121
- package/src/ui/sync-resolution-ui.ts +147 -153
- package/src/ui/sync-setups-ui.ts +218 -238
- package/src/ui/sync-status.ts +17 -0
- package/src/ui/terminal-text.ts +2 -2
- package/dist/chunks/chunk-2B2ELUF5.ts.map +0 -7
- package/dist/chunks/chunk-4CHTZMEO.ts.map +0 -7
- package/dist/chunks/chunk-5B3FXBLE.ts.map +0 -7
- package/dist/chunks/chunk-6LP3MCR2.ts.map +0 -7
- package/dist/chunks/chunk-AUSDLD6F.ts.map +0 -7
- package/dist/chunks/chunk-C7XY5NF5.ts.map +0 -7
- package/dist/chunks/chunk-CCSN3F47.ts.map +0 -7
- package/dist/chunks/chunk-CHH26D4F.ts.map +0 -7
- package/dist/chunks/chunk-CPEHGXJV.ts.map +0 -7
- package/dist/chunks/chunk-D5X27LCA.ts.map +0 -7
- package/dist/chunks/chunk-ETTRJDNP.ts.map +0 -7
- package/dist/chunks/chunk-G4RNQQZS.ts.map +0 -7
- package/dist/chunks/chunk-HUDQATCL.ts.map +0 -7
- package/dist/chunks/chunk-IJ6FJFA5.ts.map +0 -7
- package/dist/chunks/chunk-JAAKLL6M.ts.map +0 -7
- package/dist/chunks/chunk-KW7YQEZN.ts.map +0 -7
- package/dist/chunks/chunk-LCRI3ABW.ts.map +0 -7
- package/dist/chunks/chunk-LTBWGSBV.ts.map +0 -7
- package/dist/chunks/chunk-NJFUIVYL.ts.map +0 -7
- package/dist/chunks/chunk-OEX4ABY6.ts.map +0 -7
- package/dist/chunks/chunk-Q2TUM5X6.ts.map +0 -7
- package/dist/chunks/chunk-SL64RLXR.ts.map +0 -7
- package/dist/chunks/chunk-SZWBGPID.ts.map +0 -7
- package/dist/chunks/chunk-T2B5IU74.ts.map +0 -7
- package/dist/chunks/chunk-T3HH3UEJ.ts.map +0 -7
- package/dist/chunks/chunk-TEN2ZBJV.ts.map +0 -7
- package/dist/chunks/chunk-THMF4BVL.ts.map +0 -7
- package/dist/chunks/chunk-Z4DQF6L3.ts.map +0 -7
- package/dist/chunks/chunk-ZI5MXMEX.ts.map +0 -7
- package/dist/chunks/file-selection-FTTKAOYX.ts.map +0 -7
- package/dist/chunks/git-backend-GMVS4PD4.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-FKIBM3GO.ts +0 -22
- package/dist/chunks/manager-ui-5KLKVMRC.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-D7RBRJNL.ts +0 -21
- package/dist/chunks/s3-backend-66O4FGBH.ts.map +0 -7
- package/dist/chunks/setup-wizard-IUB6ESEU.ts.map +0 -7
- package/dist/chunks/sync-inspection-CST2KL65.ts +0 -20
- package/dist/chunks/sync-operations-LBX3GKCM.ts.map +0 -7
- package/dist/chunks/webdav-backend-ECIKD7SO.ts.map +0 -7
- /package/dist/chunks/{manager-result-dispatcher-FKIBM3GO.ts.map → manager-result-dispatcher-OTUMQM26.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-D7RBRJNL.ts.map → remote-selection-ui-TZTJF32Y.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-IS2PEZ3J.ts.map → setup-switch-5G2VNJHL.ts.map} +0 -0
- /package/dist/chunks/{snapshot-HKEWCVK6.ts.map → snapshot-JL5DFSXI.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-CST2KL65.ts.map → sync-inspection-P3ENJLNF.ts.map} +0 -0
- /package/dist/chunks/{sync-state-Q2FTXTW6.ts.map → sync-state-VHJUZ4YG.ts.map} +0 -0
package/docs/settings.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- [Complete version 3 example](#complete-version-3-example)
|
|
6
6
|
- [Required backend shapes](#required-backend-shapes)
|
|
7
|
+
- [Status display](#status-display)
|
|
7
8
|
- [Secret scanning](#secret-scanning)
|
|
8
9
|
- [Included content](#included-content)
|
|
9
10
|
- [Unsupported old settings and recovery](#unsupported-old-settings-and-recovery)
|
|
@@ -36,6 +37,7 @@ If both paths exist, `pi-sync.json` wins and the legacy file remains untouched.
|
|
|
36
37
|
"activeSyncSetup": "home",
|
|
37
38
|
"onSwitch": "ask-before-pull",
|
|
38
39
|
"skipSecretScan": false,
|
|
40
|
+
"showStatus": true,
|
|
39
41
|
"storageConnections": {
|
|
40
42
|
"r2": {
|
|
41
43
|
"type": "s3",
|
|
@@ -140,6 +142,13 @@ The global **After switching setup (all setups)** setting persists as `onSwitch`
|
|
|
140
142
|
- `pull-after-switch` — require observable UI and start the normal reviewed pull;
|
|
141
143
|
- `switch-only` — switch without reading or applying remote content.
|
|
142
144
|
|
|
145
|
+
### Status display
|
|
146
|
+
|
|
147
|
+
The global `showStatus` setting accepts a boolean and defaults to `true` when omitted from an existing version 3 document.
|
|
148
|
+
Set it through **/sync → Settings → Show status (all setups)**; changes are saved and applied immediately for every setup.
|
|
149
|
+
When `false`, pi-sync clears and suppresses status text for background checks, manual and automatic transfers, and review attention.
|
|
150
|
+
TUI review widgets and TUI/RPC notifications remain available, and lifecycle cleanup still clears any stale status owned by pi-sync.
|
|
151
|
+
|
|
143
152
|
### Secret scanning
|
|
144
153
|
|
|
145
154
|
The global `skipSecretScan` setting accepts a boolean and defaults to `false`, including when omitted from an existing version 3 document.
|
package/package.json
CHANGED
|
@@ -1,64 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
2
|
+
"name": "@narumitw/pi-sync",
|
|
3
|
+
"version": "0.51.0",
|
|
4
|
+
"description": "Pi extension that syncs Pi configuration through Git, WebDAV, Cloudflare R2, or S3-compatible storage.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"private": false,
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package",
|
|
10
|
+
"pi-extension",
|
|
11
|
+
"pi",
|
|
12
|
+
"sync",
|
|
13
|
+
"r2",
|
|
14
|
+
"s3",
|
|
15
|
+
"webdav",
|
|
16
|
+
"nextcloud",
|
|
17
|
+
"synology",
|
|
18
|
+
"git",
|
|
19
|
+
"github",
|
|
20
|
+
"gitlab",
|
|
21
|
+
"forgejo"
|
|
22
|
+
],
|
|
23
|
+
"files": [
|
|
24
|
+
"src",
|
|
25
|
+
"dist",
|
|
26
|
+
"docs",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"pi": {
|
|
31
|
+
"extensions": [
|
|
32
|
+
"./dist/index.ts"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node scripts/build-runtime.mjs",
|
|
37
|
+
"check": "npm run build && biome check . && npm run typecheck",
|
|
38
|
+
"format": "biome check --write .",
|
|
39
|
+
"prepack": "npm run build",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@narumitw/pi-tui-kit": "^0.59.0",
|
|
44
|
+
"fast-xml-parser": "^5.11.1",
|
|
45
|
+
"proper-lockfile": "^4.1.2"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
49
|
+
"@earendil-works/pi-tui": "0.85.1",
|
|
50
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
51
|
+
"esbuild": "0.28.2",
|
|
52
|
+
"typescript": "7.0.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
56
|
+
"@earendil-works/pi-tui": "*"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/narumiruna/pi-extensions",
|
|
61
|
+
"directory": "packages/pi-sync"
|
|
62
|
+
}
|
|
64
63
|
}
|
|
@@ -2,22 +2,22 @@ import type { AnySyncConfig } from "../settings/settings-types.js";
|
|
|
2
2
|
import type { SyncBackend } from "./sync-backend.js";
|
|
3
3
|
|
|
4
4
|
export type SyncBackendFactory = {
|
|
5
|
-
|
|
5
|
+
bivarianceHack(config: AnySyncConfig): SyncBackend | Promise<SyncBackend>;
|
|
6
6
|
}["bivarianceHack"];
|
|
7
7
|
|
|
8
8
|
export const createSyncBackend: SyncBackendFactory = async (config) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
switch (config.backend.type) {
|
|
10
|
+
case "s3": {
|
|
11
|
+
const { S3SyncBackend } = await import("./s3/s3-backend.js");
|
|
12
|
+
return new S3SyncBackend(config.backend);
|
|
13
|
+
}
|
|
14
|
+
case "webdav": {
|
|
15
|
+
const { WebDavSyncBackend } = await import("./webdav/webdav-backend.js");
|
|
16
|
+
return new WebDavSyncBackend(config.backend);
|
|
17
|
+
}
|
|
18
|
+
case "git": {
|
|
19
|
+
const { GitSyncBackend } = await import("./git/git-backend.js");
|
|
20
|
+
return new GitSyncBackend(config.backend);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
23
|
};
|
|
@@ -3,38 +3,38 @@ import { normalizeGitRemoteIdentity } from "./git/git-config.js";
|
|
|
3
3
|
import { normalizeWebDavIdentityUrl } from "./webdav/webdav-config.js";
|
|
4
4
|
|
|
5
5
|
export function backendIdentityCoordinates(config: AnySyncConfig) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
switch (config.backend.type) {
|
|
7
|
+
case "s3":
|
|
8
|
+
return JSON.stringify([
|
|
9
|
+
"s3",
|
|
10
|
+
normalizeEndpointIdentity(config.backend.profile.endpoint),
|
|
11
|
+
config.backend.destination.bucket,
|
|
12
|
+
config.storagePath,
|
|
13
|
+
]);
|
|
14
|
+
case "git":
|
|
15
|
+
return JSON.stringify([
|
|
16
|
+
"git",
|
|
17
|
+
normalizeGitRemoteIdentity(config.backend.profile.remote),
|
|
18
|
+
config.backend.destination.branch,
|
|
19
|
+
config.storagePath,
|
|
20
|
+
]);
|
|
21
|
+
case "webdav":
|
|
22
|
+
return JSON.stringify([
|
|
23
|
+
"webdav",
|
|
24
|
+
normalizeWebDavIdentityUrl(config.backend.profile.url),
|
|
25
|
+
config.backend.profile.username,
|
|
26
|
+
config.storagePath,
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function normalizeEndpointIdentity(endpoint: string) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
try {
|
|
33
|
+
const url = new URL(endpoint.trim());
|
|
34
|
+
url.hostname = url.hostname.toLowerCase();
|
|
35
|
+
url.pathname = url.pathname.replace(/\/+$/gu, "");
|
|
36
|
+
return url.toString().replace(/\/$/u, "");
|
|
37
|
+
} catch {
|
|
38
|
+
return endpoint.trim();
|
|
39
|
+
}
|
|
40
40
|
}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
import type { SnapshotSelection } from "../snapshot/snapshot-types.js";
|
|
2
2
|
/** Backend-only resolved S3 connection fields. */
|
|
3
3
|
export interface ResolvedS3StorageProfile {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
kind: "r2" | "s3-compatible";
|
|
5
|
+
endpoint: string;
|
|
6
|
+
region: string;
|
|
7
|
+
accessKeyId: string;
|
|
8
|
+
secretAccessKey: string;
|
|
9
|
+
sessionToken?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/** Backend-only coordinates. `prefix` is the complete reviewed v3 storage path. */
|
|
13
13
|
export interface ResolvedS3Destination {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
bucket: string;
|
|
15
|
+
prefix: string;
|
|
16
|
+
/** Snapshot/wire identity; never derived from the local setup name. */
|
|
17
|
+
namespace: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface ResolvedS3Backend {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
type: "s3";
|
|
22
|
+
profile: ResolvedS3StorageProfile;
|
|
23
|
+
destination: ResolvedS3Destination;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface ResolvedWebDavStorageProfile {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
kind: "webdav";
|
|
28
|
+
url: string;
|
|
29
|
+
username: string;
|
|
30
|
+
password: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** Backend-only coordinates. `path` is the complete reviewed v3 storage path. */
|
|
34
34
|
export interface ResolvedWebDavDestination {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
path: string;
|
|
36
|
+
namespace: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export interface ResolvedWebDavBackend {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
type: "webdav";
|
|
41
|
+
profile: ResolvedWebDavStorageProfile;
|
|
42
|
+
destination: ResolvedWebDavDestination;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface ResolvedGitStorageProfile {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
kind: "git";
|
|
47
|
+
remote: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** Backend-only coordinates. `directory` is the complete reviewed v3 storage path. */
|
|
51
51
|
export interface ResolvedGitDestination {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
branch: string;
|
|
53
|
+
directory: string;
|
|
54
|
+
namespace: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export interface ResolvedGitBackend {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
type: "git";
|
|
59
|
+
profile: ResolvedGitStorageProfile;
|
|
60
|
+
destination: ResolvedGitDestination;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export type ResolvedSyncBackend = ResolvedS3Backend | ResolvedWebDavBackend | ResolvedGitBackend;
|
|
64
64
|
|
|
65
65
|
export interface LatestPointer {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
version: number;
|
|
67
|
+
profile: string;
|
|
68
|
+
snapshot: string;
|
|
69
|
+
sha256: string;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
machine: string;
|
|
72
|
+
syncSessions?: boolean;
|
|
73
|
+
/** Lightweight projection; the immutable snapshot remains authoritative. */
|
|
74
|
+
selection?: SnapshotSelection;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export interface RemoteObject<T> {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
value?: T;
|
|
79
|
+
etag?: string;
|
|
80
|
+
missing: boolean;
|
|
81
81
|
}
|