uniweb 1.34.9 → 1.34.10
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/package.json +6 -6
- package/src/backend/site-sync.js +35 -5
- package/src/commands/pull.js +14 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.10",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"js-yaml": "^4.3.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
|
-
"@uniweb/
|
|
45
|
-
"@uniweb/content-writer": "~1.3.2",
|
|
44
|
+
"@uniweb/semantic-parser": "~1.13.5",
|
|
46
45
|
"@uniweb/core": "~1.6.13",
|
|
47
|
-
"@uniweb/
|
|
46
|
+
"@uniweb/schemas": "~1.7.4",
|
|
47
|
+
"@uniweb/content-writer": "~1.3.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/
|
|
50
|
+
"@uniweb/semantic-parser": "~1.13.5",
|
|
51
51
|
"@uniweb/content-reader": "~1.5.10",
|
|
52
|
-
"@uniweb/
|
|
52
|
+
"@uniweb/build": "~1.23.8"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@uniweb/build": {
|
package/src/backend/site-sync.js
CHANGED
|
@@ -1422,6 +1422,18 @@ export function writeQueryUuids(siteDir, backend, map) {
|
|
|
1422
1422
|
if (!map || !Object.keys(map).length) return
|
|
1423
1423
|
updateBackendMap(siteDir, backend, 'queries', map)
|
|
1424
1424
|
}
|
|
1425
|
+
/**
|
|
1426
|
+
* The query declarations' identity, by name, from a document the backend handed back (a pull's site
|
|
1427
|
+
* content, or the one a push stored): written WHOLE, so a query removed in the app leaves with its
|
|
1428
|
+
* `$uuid`. A document that carries no `queries` at all leaves the map as it is.
|
|
1429
|
+
*
|
|
1430
|
+
* ⛔ Until 2026-11-13 it was merged, so a query removed in the app kept its `$uuid`, and a new one of the
|
|
1431
|
+
* same name took it on the next push: the failure `writeFolderPlacements` describes for a folder entry.
|
|
1432
|
+
*/
|
|
1433
|
+
export function writeQueryUuidsFrom(siteDir, backend, doc) {
|
|
1434
|
+
if (!Array.isArray(doc?.queries)) return
|
|
1435
|
+
setBackendMap(siteDir, backend, 'queries', collectQueryUuids(doc))
|
|
1436
|
+
}
|
|
1425
1437
|
// Placements a recovery found missing, beside the ones this copy holds (`recoverRecordsIdentity`).
|
|
1426
1438
|
export function writeFolderItemUuids(siteDir, backend, map) {
|
|
1427
1439
|
if (!map || !Object.keys(map).length) return
|
|
@@ -1497,6 +1509,24 @@ export function writeItemUuids(siteDir, backend, map) {
|
|
|
1497
1509
|
if (!map || !Object.keys(map).length) return
|
|
1498
1510
|
updateBackendMap(siteDir, backend, 'items', map)
|
|
1499
1511
|
}
|
|
1512
|
+
/**
|
|
1513
|
+
* The units' identity from a document the backend handed back (a pull's site content, or the one a push
|
|
1514
|
+
* stored), with the paths banked before for a unit it still holds: a page the app moved keeps, beside
|
|
1515
|
+
* its new path, the one its files have, which a push of that page needs while a pull holds it. A unit the
|
|
1516
|
+
* document no longer holds leaves with its `$uuid`.
|
|
1517
|
+
*
|
|
1518
|
+
* ⛔ Until 2026-11-13 each document was merged into the map, so a page or section removed in the app kept
|
|
1519
|
+
* its `$uuid` under its path, and a new one made at that path took it on the next push: the failure
|
|
1520
|
+
* `writeFolderPlacements` describes for a folder entry, where the backend re-created the removed row
|
|
1521
|
+
* under the old id. A document with no units leaves the map as it is.
|
|
1522
|
+
*/
|
|
1523
|
+
export function writeItemUuidsFrom(siteDir, backend, doc) {
|
|
1524
|
+
const now = collectUnitUuids(doc)
|
|
1525
|
+
if (!Object.keys(now).length) return
|
|
1526
|
+
const held = new Set(Object.values(now))
|
|
1527
|
+
const kept = Object.entries(readItemUuids(siteDir, backend)).filter(([, uuid]) => held.has(uuid))
|
|
1528
|
+
setBackendMap(siteDir, backend, 'items', { ...Object.fromEntries(kept), ...now })
|
|
1529
|
+
}
|
|
1500
1530
|
|
|
1501
1531
|
/**
|
|
1502
1532
|
* The identity of each record's list items:
|
|
@@ -2897,8 +2927,7 @@ export async function pushSyncPackages({
|
|
|
2897
2927
|
// unique. Without it every push after the first re-sends the whole `collections`
|
|
2898
2928
|
// section uuid-less and is refused.
|
|
2899
2929
|
if (siteFinalizedDoc) {
|
|
2900
|
-
|
|
2901
|
-
if (Object.keys(recordIds).length) writeQueryUuids(siteDir, client.origin, recordIds)
|
|
2930
|
+
writeQueryUuidsFrom(siteDir, client.origin, siteFinalizedDoc)
|
|
2902
2931
|
// ⭐ THE SERVICES THIS COPY NOW HOLDS, `{ name: $uuid }`: those the push stated and
|
|
2903
2932
|
// those held before, as the site returned them (`heldServices`). A service added on
|
|
2904
2933
|
// the site since this copy's last pull is left out — held, the next push would state
|
|
@@ -2941,9 +2970,10 @@ export async function pushSyncPackages({
|
|
|
2941
2970
|
if (Object.keys(patch).length) writeUnitBases(siteDir, client.origin, patch)
|
|
2942
2971
|
// The backend's post-write document carries `$uuid` per item at every nesting
|
|
2943
2972
|
// level, so the push that just landed also re-arms identity for the next one.
|
|
2944
|
-
//
|
|
2945
|
-
//
|
|
2946
|
-
|
|
2973
|
+
// An item that no longer exists must not keep a uuid that would re-target something
|
|
2974
|
+
// else, so a unit the document no longer holds leaves the map (`writeItemUuidsFrom`).
|
|
2975
|
+
// ⛔ This said "replaced wholesale" while the write merged, and those uuids stayed.
|
|
2976
|
+
if (theirs) writeItemUuidsFrom(siteDir, client.origin, theirs)
|
|
2947
2977
|
else {
|
|
2948
2978
|
// ⛔ BANKING IS BEST-EFFORT AND ITS FAILURE USED TO BE SILENT — say it here,
|
|
2949
2979
|
// because the cost lands two commands away and names something else.
|
package/src/commands/pull.js
CHANGED
|
@@ -86,7 +86,6 @@ import {
|
|
|
86
86
|
readZip,
|
|
87
87
|
computeUnitHashes,
|
|
88
88
|
collectUnitUuids,
|
|
89
|
-
collectQueryUuids,
|
|
90
89
|
documentSchema
|
|
91
90
|
} from '@uniweb/build/uwx'
|
|
92
91
|
import {
|
|
@@ -100,7 +99,7 @@ import {
|
|
|
100
99
|
deploymentFields,
|
|
101
100
|
entityHashes,
|
|
102
101
|
rebankSyncHashes,
|
|
103
|
-
|
|
102
|
+
writeQueryUuidsFrom,
|
|
104
103
|
mergeBaseVersions,
|
|
105
104
|
writeItemBaseVersions,
|
|
106
105
|
pulledItemVersions,
|
|
@@ -110,7 +109,7 @@ import {
|
|
|
110
109
|
writeUnitBases,
|
|
111
110
|
commitWriteBacks,
|
|
112
111
|
reportWriteBacks,
|
|
113
|
-
|
|
112
|
+
writeItemUuidsFrom,
|
|
114
113
|
writeFolderPlacements,
|
|
115
114
|
writeHeldTypes,
|
|
116
115
|
readItemBaseVersions
|
|
@@ -1268,11 +1267,12 @@ export async function pull(args = [], deps = {}) {
|
|
|
1268
1267
|
pulledVersions = pulledItemVersions(siteDoc, content.itemVersions)
|
|
1269
1268
|
// Per-item identity for the next push. Without it the backend reads our
|
|
1270
1269
|
// records as new and re-mints every page and section row.
|
|
1271
|
-
|
|
1270
|
+
// A unit the document no longer holds, removed in the app, leaves with its uuid.
|
|
1271
|
+
writeItemUuidsFrom(projDir, client.origin, siteDoc)
|
|
1272
1272
|
// The collections section's identity has no file to live in either — same
|
|
1273
1273
|
// reason, same remedy, keyed by name. A pull is the other route by which a
|
|
1274
1274
|
// copy can recover it (see readQueryUuids).
|
|
1275
|
-
|
|
1275
|
+
writeQueryUuidsFrom(projDir, client.origin, siteDoc)
|
|
1276
1276
|
// Bring the media down BEFORE projecting: a newly-landed asset gains a map
|
|
1277
1277
|
// entry, and the projection reads that map to put authored paths back. Run
|
|
1278
1278
|
// after, and this pull's new assets would project as URLs and only restore
|
|
@@ -1320,7 +1320,7 @@ export async function pull(args = [], deps = {}) {
|
|
|
1320
1320
|
// The mounts it may write into, each one the site declares writable (above).
|
|
1321
1321
|
writableMounts: mounts.writable,
|
|
1322
1322
|
// Where each page was before this pull, read before its identity merged the pulled document's
|
|
1323
|
-
// in (`
|
|
1323
|
+
// in (`writeItemUuidsFrom`, above): a page the app moved is found where the files keep it.
|
|
1324
1324
|
priorItems
|
|
1325
1325
|
})
|
|
1326
1326
|
wrote.push(...report.pages, ...report.sections, ...report.layout)
|
|
@@ -1530,6 +1530,11 @@ export async function pull(args = [], deps = {}) {
|
|
|
1530
1530
|
const syncFile = join(siteDir, 'sync.json')
|
|
1531
1531
|
const cacheFile = join(siteDir, '.uniweb', 'backend-cache.json')
|
|
1532
1532
|
const before = { sync: bytesOf(syncFile), cache: bytesOf(cacheFile) }
|
|
1533
|
+
// The files as the person left them, before this pull writes anything back: whether a merge
|
|
1534
|
+
// sets work of theirs aside. ⛔ Until 2026-11-13 it was judged after the write-back below, so a
|
|
1535
|
+
// pull that changed `sync.json` (a page added or removed in the app) said "your uncommitted
|
|
1536
|
+
// changes come back" to someone who had none.
|
|
1537
|
+
const asTheyLeftThem = snapshotFiles(repo)
|
|
1533
1538
|
// What this copy keeps, taken back from the stand-in: the identity the backend minted
|
|
1534
1539
|
// (`sync.json`, before the merge, so a merge's stash carries it) and its caches.
|
|
1535
1540
|
const syncNow = bytesOf(join(projDir, 'sync.json'))
|
|
@@ -1641,8 +1646,9 @@ export async function pull(args = [], deps = {}) {
|
|
|
1641
1646
|
pin: recorded.pins.find((p) => p.at === n.at)
|
|
1642
1647
|
}))
|
|
1643
1648
|
}
|
|
1644
|
-
// Whether
|
|
1645
|
-
|
|
1649
|
+
// Whether work of the person's was set aside for the merge: the files as they left them,
|
|
1650
|
+
// against HEAD. The identity this pull wrote back is its own, and comes back with the rest.
|
|
1651
|
+
merge.setAside = asTheyLeftThem !== repo.head
|
|
1646
1652
|
merge.noBase = !force && !base
|
|
1647
1653
|
merge.movedFrom = merge.noBase ? siteMovedFrom : null
|
|
1648
1654
|
merge.changed = changedInFiles(repo, {
|