uniweb 1.30.2 → 1.31.1
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 +4 -4
- package/partials/guides/data.md +1 -1
- package/src/backend/client.js +7 -38
- package/src/backend/site-sync.js +129 -155
- package/src/commands/doctor.js +3 -3
- package/src/commands/publish.js +85 -87
- package/src/commands/pull.js +6 -1
- package/src/commands/push.js +90 -100
- package/src/framework-index.json +6 -6
- package/src/utils/config.js +1 -1
- package/src/utils/site-data-upload.js +1 -1
- package/src/utils/workspace-packages.js +12 -242
- package/src/utils/workspace-patterns.js +272 -0
package/src/commands/publish.js
CHANGED
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
ensureRegisteredFoundation,
|
|
109
109
|
recoverUnbankedIdentity,
|
|
110
110
|
keepTranslationsOfEdits,
|
|
111
|
-
|
|
111
|
+
createSiteFromItsContent,
|
|
112
112
|
refuseUnsendableRecords,
|
|
113
113
|
clearRemoteSyncStateIfUnbound,
|
|
114
114
|
untakenBase,
|
|
@@ -382,8 +382,8 @@ export async function publish(args = []) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
// ⭐ THE WORKSPACE THIS PUBLISH WORKS IN — the one chosen with the login, unless this
|
|
385
|
-
// command names another (`workspace.js`). Resolved up front:
|
|
386
|
-
//
|
|
385
|
+
// command names another (`workspace.js`). Resolved up front: a first publish creates the site
|
|
386
|
+
// in it (`createSiteFromItsContent`), and a site the backend keeps elsewhere is refused.
|
|
387
387
|
const ws = await resolveWorkspace({ client, args, offline: dryRun })
|
|
388
388
|
if (ws.refused) {
|
|
389
389
|
say.err('This publish works in one workspace, and none is chosen.')
|
|
@@ -700,31 +700,89 @@ export async function publish(args = []) {
|
|
|
700
700
|
`Cleared stale sync state from a previous site (${droppedState.join(', ')}).`
|
|
701
701
|
)
|
|
702
702
|
}
|
|
703
|
-
//
|
|
704
|
-
//
|
|
705
|
-
//
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
//
|
|
710
|
-
//
|
|
711
|
-
|
|
712
|
-
|
|
703
|
+
// publish rides the same gated push as `uniweb push`: if an app author has
|
|
704
|
+
// edited since this clone last synced, the push is refused rather than
|
|
705
|
+
// overwriting them, and nothing goes live. `--force` drops the precondition.
|
|
706
|
+
const forced = args.includes('--force')
|
|
707
|
+
let assetRewrite = null
|
|
708
|
+
let assetIds = null
|
|
709
|
+
// ⭐ THE PACKAGE AS THIS PUBLISH SENDS IT, read from this copy's state when it is built: once to
|
|
710
|
+
// create the site (3b), and once to push it (5), after the media and the identity the create banked.
|
|
711
|
+
const emitOptionsNow = async () => ({
|
|
712
|
+
backend: client.origin,
|
|
713
|
+
// The keys this deployment's Sections take — see deploymentFields.
|
|
714
|
+
...fields,
|
|
715
|
+
// Placement identity for the folder — see writeFolderItemUuids.
|
|
716
|
+
folderItemUuids: readFolderItemUuids(siteDir, client.origin),
|
|
717
|
+
// Identity for the records' list items — see readRecordItemUuids.
|
|
718
|
+
recordItemUuids: readRecordItemUuids(siteDir, client.origin),
|
|
719
|
+
...(foundationDir ? { foundationDir } : {}),
|
|
720
|
+
resolveModel,
|
|
721
|
+
priorHashes: readSyncCache(siteDir, client.origin),
|
|
722
|
+
// Per-item identity, recovered from the backend when this clone has never seen it.
|
|
723
|
+
// Without it the backend re-mints every page and section row (see readItemUuids).
|
|
724
|
+
itemUuids: await ensureItemUuids({ client, siteDir, note: (m) => say.dim(m) }),
|
|
725
|
+
...(forced
|
|
726
|
+
? {}
|
|
727
|
+
: {
|
|
728
|
+
baseVersions: readBaseVersions(siteDir, client.origin),
|
|
729
|
+
itemBaseVersions: readItemBaseVersions(siteDir, client.origin),
|
|
730
|
+
// What a pull held is left out while its files still say it — see `uniweb push`.
|
|
731
|
+
heldUnits: readHeldUnits(siteDir, client.origin)
|
|
732
|
+
}),
|
|
733
|
+
// Stamp the PINNED foundation ref (`@scope/name@version`) from the bring-along
|
|
734
|
+
// on the site-content entity — the one key `injectInfo` carries since the
|
|
735
|
+
// data-bundle URL went (2026-08-18). Delivery is version-pinned end-to-end (a
|
|
736
|
+
// foundation is delivered only by a concrete version, agreed with backend and
|
|
737
|
+
// measured end to end on 2026-06-25), so pinning the released version on the
|
|
738
|
+
// wire is required when site.yml uses an unversioned local ref; injectInfo
|
|
739
|
+
// overrides info.foundation. A registry/URL ref → fnd.ref is null → the
|
|
740
|
+
// site.yml ref is forwarded verbatim (already pinned).
|
|
741
|
+
// ⛔ DO NOT STAMP A FILE MAP INTO `info` HERE. `injectInfo` WINS the merge
|
|
742
|
+
// (`sync-package.js`: `{...siteDoc.info, ...injectInfo}`), so any name stamped
|
|
743
|
+
// here silently replaces what the author's document carries under it, and the
|
|
744
|
+
// store validator accepts it — nothing errors at any layer. This was written
|
|
745
|
+
// about `info.data`, which carried the site's `fetch:` block until 2026-09-09;
|
|
746
|
+
// that moved to `settings.fetch`, and the warning holds for any name.
|
|
747
|
+
//
|
|
748
|
+
// A file map needs a name nothing else claims (`static_data` / `data_files`
|
|
749
|
+
// were proposed) AND a consumer that reads it — neither settled. Until then
|
|
750
|
+
// the schema-less data goes as 4c sends it: one object per file, no bundle.
|
|
751
|
+
...(fnd.ref ? { injectInfo: { foundation: fnd.ref } } : {}),
|
|
752
|
+
...(Object.keys(ext.pins).length ? { injectExtensions: ext.pins } : {}),
|
|
753
|
+
...(assetRewrite ? { assetRewrite } : {}),
|
|
754
|
+
...(assetIds ? { assetIds } : {})
|
|
755
|
+
})
|
|
756
|
+
const report = {
|
|
757
|
+
info: (m) => say.info(m),
|
|
758
|
+
note: (m) => say.dim(m),
|
|
759
|
+
error: (m) => say.err(m),
|
|
760
|
+
dim: (x) => `${c.dim}${x}${c.reset}`
|
|
761
|
+
}
|
|
762
|
+
// 3b. The site exists before a single byte is uploaded against it, and a first publish
|
|
763
|
+
// creates it FROM ITS CONTENT (`createSiteFromItsContent`): the backend takes the content
|
|
764
|
+
// or creates nothing, so a publish it refuses leaves no site and no uploaded bytes behind.
|
|
765
|
+
// Uploaded bytes are metered against an owning entity and freed by deleting it, so they go
|
|
766
|
+
// up only once it exists. A no-op once `sync.json` holds this backend's site uuid.
|
|
713
767
|
//
|
|
714
|
-
//
|
|
715
|
-
//
|
|
716
|
-
|
|
768
|
+
// ⛔ Until 2026-11-09 this made an EMPTY site first (`POST /dev/site`). A content push the
|
|
769
|
+
// backend refused then left that site behind, empty, and this copy could not push again
|
|
770
|
+
// without `--force`. A test asserts the create precedes the upload.
|
|
771
|
+
const site = await createSiteFromItsContent({
|
|
717
772
|
client,
|
|
718
773
|
siteDir,
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
note: (m) => say.dim(m)
|
|
774
|
+
emit: async () => emitSyncPackages(siteDir, await emitOptionsNow()),
|
|
775
|
+
report
|
|
722
776
|
})
|
|
723
777
|
if (!site.uuid) {
|
|
724
|
-
say.
|
|
725
|
-
|
|
778
|
+
say.dim('No media or record data was uploaded.')
|
|
779
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: false, released }), { note: say.dim })
|
|
726
780
|
return { exitCode: 1 }
|
|
727
781
|
}
|
|
782
|
+
// What a first publish has sent by now, when an upload then fails: said, since it is not nothing.
|
|
783
|
+
const sentSoFar = () =>
|
|
784
|
+
site.created &&
|
|
785
|
+
say.dim('The site was created with its content, which names its media by their local paths until a push uploads them.')
|
|
728
786
|
|
|
729
787
|
// 4. Gather the schema-less data files BEFORE uploading media, since their
|
|
730
788
|
// records can carry local media too. (No search index rides here since
|
|
@@ -734,8 +792,6 @@ export async function publish(args = []) {
|
|
|
734
792
|
|
|
735
793
|
// 4b. Upload ALL local media (entity refs + ball refs) on one asset lane →
|
|
736
794
|
// the ref→serveUrl map; rewrite the entity content AND the ball with it.
|
|
737
|
-
let assetRewrite = null
|
|
738
|
-
let assetIds = null
|
|
739
795
|
// …and each file record's file (`@uniweb/file` — `{ ref, path, contentType }`, already located).
|
|
740
796
|
const mediaRefs = [...new Set([...localAssets, ...ballAssets]), ...(probe.localFiles || [])]
|
|
741
797
|
if (mediaRefs.length) {
|
|
@@ -758,6 +814,7 @@ export async function publish(args = []) {
|
|
|
758
814
|
if (failed.length) {
|
|
759
815
|
say.err(`${failed.length} asset(s) failed to upload — not publishing.`)
|
|
760
816
|
for (const f of failed) say.dim(` ${f.path} (HTTP ${f.status})`)
|
|
817
|
+
sentSoFar()
|
|
761
818
|
return { exitCode: 1 }
|
|
762
819
|
}
|
|
763
820
|
if (Object.keys(map).length) assetRewrite = map
|
|
@@ -787,6 +844,7 @@ export async function publish(args = []) {
|
|
|
787
844
|
} else {
|
|
788
845
|
say.err(`Media upload failed: ${err.message}`)
|
|
789
846
|
}
|
|
847
|
+
sentSoFar()
|
|
790
848
|
return { exitCode: 1 }
|
|
791
849
|
}
|
|
792
850
|
}
|
|
@@ -849,6 +907,7 @@ export async function publish(args = []) {
|
|
|
849
907
|
`${r.failed.length} data file(s) failed to upload — not publishing.`
|
|
850
908
|
)
|
|
851
909
|
for (const f of r.failed) say.dim(` ${f.path} (HTTP ${f.status})`)
|
|
910
|
+
sentSoFar()
|
|
852
911
|
return { exitCode: 1 }
|
|
853
912
|
}
|
|
854
913
|
say.dim(`Record data : ${r.uploaded.length} file(s) [${r.mode}]`)
|
|
@@ -856,6 +915,7 @@ export async function publish(args = []) {
|
|
|
856
915
|
// The workspace this publish works in, refused — said as itself, as at every other door.
|
|
857
916
|
if (err instanceof WorkspaceMismatchError) {
|
|
858
917
|
say.err(err.message)
|
|
918
|
+
sentSoFar()
|
|
859
919
|
return { exitCode: 1 }
|
|
860
920
|
}
|
|
861
921
|
// A typed plan refusal gets its own account (quota, or whatever else the
|
|
@@ -869,6 +929,7 @@ export async function publish(args = []) {
|
|
|
869
929
|
} else {
|
|
870
930
|
say.err(`Record data upload failed: ${err.message}`)
|
|
871
931
|
}
|
|
932
|
+
sentSoFar()
|
|
872
933
|
return { exitCode: 1 }
|
|
873
934
|
}
|
|
874
935
|
|
|
@@ -877,35 +938,6 @@ export async function publish(args = []) {
|
|
|
877
938
|
// the pinned foundation ref and rewriting local media refs to serve URLs.
|
|
878
939
|
// (It stamped `info.data_bundle` until 2026-08-18; the ball is gone and
|
|
879
940
|
// collection data now lands at its serving tail, so nothing records it.)
|
|
880
|
-
const priorHashes = readSyncCache(siteDir, client.origin)
|
|
881
|
-
// Per-item identity, recovered from the backend when this clone has never seen it.
|
|
882
|
-
// Without it the backend re-mints every page and section row (see readItemUuids).
|
|
883
|
-
const itemUuids = await ensureItemUuids({
|
|
884
|
-
client,
|
|
885
|
-
siteDir,
|
|
886
|
-
note: (m) => say.dim(m)
|
|
887
|
-
})
|
|
888
|
-
// Stamp the PINNED foundation ref (`@scope/name@version`) from the bring-along
|
|
889
|
-
// on the site-content entity — the one key `injectInfo` carries since the
|
|
890
|
-
// data-bundle URL went (2026-08-18). Delivery is version-pinned end-to-end (a
|
|
891
|
-
// foundation is delivered only by a concrete version, agreed with backend and
|
|
892
|
-
// measured end to end on 2026-06-25), so pinning the released version on the
|
|
893
|
-
// wire is required when site.yml uses an unversioned local ref; injectInfo
|
|
894
|
-
// overrides info.foundation. A registry/URL ref → fnd.ref is null → the
|
|
895
|
-
// site.yml ref is forwarded verbatim (already pinned).
|
|
896
|
-
// ⛔ DO NOT STAMP A FILE MAP INTO `info` HERE. `injectInfo` WINS the merge
|
|
897
|
-
// (`sync-package.js`: `{...siteDoc.info, ...injectInfo}`), so any name stamped
|
|
898
|
-
// here silently replaces what the author's document carries under it, and the
|
|
899
|
-
// store validator accepts it — nothing errors at any layer. This was written
|
|
900
|
-
// about `info.data`, which carried the site's `fetch:` block until 2026-09-09;
|
|
901
|
-
// that moved to `settings.fetch`, and the warning holds for any name.
|
|
902
|
-
//
|
|
903
|
-
// A file map needs a name nothing else claims (`static_data` / `data_files`
|
|
904
|
-
// were proposed) AND a consumer that reads it — neither settled. Until then
|
|
905
|
-
// the schema-less data goes as 4c sends it: one object per file, no bundle.
|
|
906
|
-
const injectInfo = {
|
|
907
|
-
...(fnd.ref ? { foundation: fnd.ref } : {})
|
|
908
|
-
}
|
|
909
941
|
// ⭐ WHAT THE SITE HAS — read before the push, for the language selection. Only this
|
|
910
942
|
// read sees a decision the owner made in the app since this clone last synced. It
|
|
911
943
|
// reads this backend's site, from sync.json; a never-synced site has none.
|
|
@@ -948,10 +980,6 @@ export async function publish(args = []) {
|
|
|
948
980
|
}
|
|
949
981
|
}
|
|
950
982
|
|
|
951
|
-
// publish rides the same gated push as `uniweb push`: if an app author has
|
|
952
|
-
// edited since this clone last synced, the push is refused rather than
|
|
953
|
-
// overwriting them, and nothing goes live. `--force` drops the precondition.
|
|
954
|
-
const forced = args.includes('--force')
|
|
955
983
|
// A foundation named by catalog ref — a clone's: its kept registered version types a query named
|
|
956
984
|
// for a data key (`ensureRegisteredFoundation`).
|
|
957
985
|
await ensureRegisteredFoundation({
|
|
@@ -960,31 +988,7 @@ export async function publish(args = []) {
|
|
|
960
988
|
siteUuid: readBackendState(siteDir, client.origin).site?.uuid,
|
|
961
989
|
ref: siteYml?.foundation
|
|
962
990
|
})
|
|
963
|
-
const emitOptions =
|
|
964
|
-
backend: client.origin,
|
|
965
|
-
// The keys this deployment's Sections take — see deploymentFields.
|
|
966
|
-
...fields,
|
|
967
|
-
// Placement identity for the folder — see writeFolderItemUuids.
|
|
968
|
-
folderItemUuids: readFolderItemUuids(siteDir, client.origin),
|
|
969
|
-
// Identity for the records' list items — see readRecordItemUuids.
|
|
970
|
-
recordItemUuids: readRecordItemUuids(siteDir, client.origin),
|
|
971
|
-
...(foundationDir ? { foundationDir } : {}),
|
|
972
|
-
resolveModel,
|
|
973
|
-
priorHashes,
|
|
974
|
-
itemUuids,
|
|
975
|
-
...(forced
|
|
976
|
-
? {}
|
|
977
|
-
: {
|
|
978
|
-
baseVersions: readBaseVersions(siteDir, client.origin),
|
|
979
|
-
itemBaseVersions: readItemBaseVersions(siteDir, client.origin),
|
|
980
|
-
// What a pull held is left out while its files still say it — see `uniweb push`.
|
|
981
|
-
heldUnits: readHeldUnits(siteDir, client.origin)
|
|
982
|
-
}),
|
|
983
|
-
...(Object.keys(injectInfo).length ? { injectInfo } : {}),
|
|
984
|
-
...(Object.keys(ext.pins).length ? { injectExtensions: ext.pins } : {}),
|
|
985
|
-
...(assetRewrite ? { assetRewrite } : {}),
|
|
986
|
-
...(assetIds ? { assetIds } : {})
|
|
987
|
-
}
|
|
991
|
+
const emitOptions = await emitOptionsNow()
|
|
988
992
|
let pkg
|
|
989
993
|
try {
|
|
990
994
|
pkg = await emitSyncPackages(siteDir, emitOptions)
|
|
@@ -1011,12 +1015,6 @@ export async function publish(args = []) {
|
|
|
1011
1015
|
// here, at publish, and never at push: syncing records does not depend on it.
|
|
1012
1016
|
const notAsked = recordsNotAsked({ siteYml, shown: pkg.recordsShown })
|
|
1013
1017
|
if (notAsked) say.warn(notAsked)
|
|
1014
|
-
const report = {
|
|
1015
|
-
info: (m) => say.info(m),
|
|
1016
|
-
note: (m) => say.dim(m),
|
|
1017
|
-
error: (m) => say.err(m),
|
|
1018
|
-
dim: (s) => `${c.dim}${s}${c.reset}`
|
|
1019
|
-
}
|
|
1020
1018
|
const pushResult = await pushSyncPackages({
|
|
1021
1019
|
client,
|
|
1022
1020
|
siteDir,
|
package/src/commands/pull.js
CHANGED
|
@@ -1350,6 +1350,11 @@ export async function pull(args = [], deps = {}) {
|
|
|
1350
1350
|
removed.push(resolve(projDir, report.recordsFile))
|
|
1351
1351
|
}
|
|
1352
1352
|
records += report.placed.length + report.updated.length
|
|
1353
|
+
// ⭐ Another site's records, mounted (`site.yml::paths`): read where they are, and left as the
|
|
1354
|
+
// owner's files hold them, since a pull of this site writes nothing there.
|
|
1355
|
+
if (report.leftToOwner?.length) {
|
|
1356
|
+
note(` ${report.leftToOwner.length} record(s) are mounted from another site (site.yml paths:) and left as its files hold them`)
|
|
1357
|
+
}
|
|
1353
1358
|
// ⭐ A FILE RECORD'S BYTES (`@uniweb/file`, 2026-09-28): fetched to where `folder.yml` now
|
|
1354
1359
|
// places each one, as media are fetched. A file that did not arrive is a record not taken —
|
|
1355
1360
|
// reported, and the pull fails below as it does for any, so the next one fetches it again.
|
|
@@ -1379,7 +1384,7 @@ export async function pull(args = [], deps = {}) {
|
|
|
1379
1384
|
if (report.skipped.length) {
|
|
1380
1385
|
recordsNotPlaced = describeUnplacedRecords({
|
|
1381
1386
|
docs: folderLane.docs,
|
|
1382
|
-
taken: report.placed.length + report.updated.length + report.unchanged.length,
|
|
1387
|
+
taken: report.placed.length + report.updated.length + report.unchanged.length + (report.leftToOwner?.length || 0),
|
|
1383
1388
|
skipped: report.skipped
|
|
1384
1389
|
})
|
|
1385
1390
|
error(recordsNotPlaced.headline)
|
package/src/commands/push.js
CHANGED
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
recoverUnbankedIdentity,
|
|
101
101
|
ensureItemUuids,
|
|
102
102
|
refuseUnsendableRecords,
|
|
103
|
-
|
|
103
|
+
createSiteFromItsContent,
|
|
104
104
|
clearRemoteSyncStateIfUnbound,
|
|
105
105
|
untakenBase,
|
|
106
106
|
keepTranslationsOfEdits,
|
|
@@ -384,16 +384,7 @@ export async function push(args = [], deps = {}) {
|
|
|
384
384
|
)
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
|
|
388
|
-
// Per-item identity, without which the backend reads every record as new and
|
|
389
|
-
// recreates every page and section row.
|
|
390
|
-
//
|
|
391
|
-
// An offline preview (`-o` / `--dry-run`) still stamps from the CACHE — that is a
|
|
392
|
-
// local file read, so it stays offline, and it keeps the emitted `.uwx` faithful
|
|
393
|
-
// to what a real push would send. Only the network RECOVERY is skipped, so a
|
|
394
|
-
// preview never reaches the backend. (Emitting `{}` here instead would make the
|
|
395
|
-
// preview quietly unrepresentative, which is the one thing `-o` exists to avoid.)
|
|
396
|
-
// Local media rides the SAME asset lane `publish` uses, and it rides it FIRST.
|
|
387
|
+
// Local media rides the SAME asset lane `publish` uses, before the content that names it.
|
|
397
388
|
//
|
|
398
389
|
// Push is the collaboration verb: a teammate opens the site in the visual app
|
|
399
390
|
// right after it. Content that still points at `/images/hero.png` — bytes the
|
|
@@ -401,15 +392,14 @@ export async function push(args = [], deps = {}) {
|
|
|
401
392
|
// push exists to avoid. `publish` uploaded and rewrote; push dropped
|
|
402
393
|
// `localAssets` on the floor.
|
|
403
394
|
//
|
|
404
|
-
//
|
|
405
|
-
//
|
|
406
|
-
//
|
|
407
|
-
//
|
|
408
|
-
//
|
|
409
|
-
//
|
|
410
|
-
//
|
|
411
|
-
//
|
|
412
|
-
// behind when a later step fails.
|
|
395
|
+
// ⭐ A SITE'S FIRST PUSH IS THE EXCEPTION, and the reason is the same metering. Bytes need an
|
|
396
|
+
// owner to be freed, and until 2026-11-09 the owner was an empty site made for them, so a
|
|
397
|
+
// content push the backend refused left that site behind, empty, and this copy unable to push
|
|
398
|
+
// without `--force`. Now the site is created FROM ITS CONTENT (`createSiteFromItsContent`):
|
|
399
|
+
// the backend takes the content or creates nothing, the media go up once it has, and the
|
|
400
|
+
// content goes again with their serve URLs, seconds later, on a site nobody has opened yet.
|
|
401
|
+
// So a refused first push leaves no site and no bytes. A later push still uploads before
|
|
402
|
+
// its content, and bytes it sent stay on the site's books if the content is then refused.
|
|
413
403
|
//
|
|
414
404
|
// The probe emit runs WITHOUT `priorHashes`, so it surfaces every local ref
|
|
415
405
|
// rather than only the changed ones. That is not waste — the lane is
|
|
@@ -470,6 +460,59 @@ export async function push(args = [], deps = {}) {
|
|
|
470
460
|
|
|
471
461
|
let assetRewrite = null
|
|
472
462
|
let assetIds = null
|
|
463
|
+
const resolveModel = makeModelResolver({ client, offline: Boolean(output) || dryRun, siteDir })
|
|
464
|
+
// ⭐ THE PACKAGE AS THIS PUSH SENDS IT, read from this copy's state when it is built. A site's
|
|
465
|
+
// first push builds it twice, to create the site and again once the media went up, and the
|
|
466
|
+
// identity, bases and hashes the first one banks are what the second one sends.
|
|
467
|
+
const emitOptionsNow = async () => ({
|
|
468
|
+
backend: client.origin,
|
|
469
|
+
// Placement identity for the folder — see writeFolderItemUuids.
|
|
470
|
+
folderItemUuids: readFolderItemUuids(siteDir, client.origin),
|
|
471
|
+
// Identity for the `queries` section — see readQueryUuids. Keyed by
|
|
472
|
+
// name, because a declaration has no file for a path-keyed map to hold.
|
|
473
|
+
queryUuids: readQueryUuids(siteDir, client.origin),
|
|
474
|
+
// The keys this deployment's Sections take — see deploymentFields.
|
|
475
|
+
...fields,
|
|
476
|
+
// Identity for the records' list items — see readRecordItemUuids.
|
|
477
|
+
recordItemUuids: readRecordItemUuids(siteDir, client.origin),
|
|
478
|
+
...(foundationDir ? { foundationDir } : {}),
|
|
479
|
+
resolveModel,
|
|
480
|
+
priorHashes: readSyncCache(siteDir, client.origin),
|
|
481
|
+
sendAll,
|
|
482
|
+
// Per-item identity, without which the backend reads every record as new and recreates
|
|
483
|
+
// every page and section row. An offline preview (`-o` / `--dry-run`) still stamps from the
|
|
484
|
+
// CACHE, a local read, so the emitted `.uwx` is faithful to what a push would send; only the
|
|
485
|
+
// network RECOVERY is skipped. `ensureItemUuids` mints nothing: on a first push, with no site
|
|
486
|
+
// uuid for this backend, it returns at once.
|
|
487
|
+
itemUuids: output || dryRun ? readItemUuids(siteDir, client.origin) : await ensureItemUuids({ client, siteDir, note }),
|
|
488
|
+
// The PINNED foundation ref from the bring-along above, stamped over the
|
|
489
|
+
// authored `site.yml` string. Delivery is version-pinned end to end, so an
|
|
490
|
+
// unpinned local name on the wire names code no host can serve. Absent when
|
|
491
|
+
// the site already references a registry ref or URL — then site.yml's own
|
|
492
|
+
// value rides verbatim. The create of a site carries it too, since it is this emit.
|
|
493
|
+
...(fnd.ref ? { injectInfo: { foundation: fnd.ref } } : {}),
|
|
494
|
+
// Both grains are dropped together by --force: one flag, one meaning,
|
|
495
|
+
// no partial-force mode.
|
|
496
|
+
...(force
|
|
497
|
+
? {}
|
|
498
|
+
: {
|
|
499
|
+
baseVersions: readBaseVersions(siteDir, client.origin),
|
|
500
|
+
itemBaseVersions: readItemBaseVersions(siteDir, client.origin),
|
|
501
|
+
// ⭐ What a pull held is left out while its files still say what they said, so the backend
|
|
502
|
+
// keeps the app's version (`readHeldUnits`). `--force` sends it with everything else.
|
|
503
|
+
heldUnits: readHeldUnits(siteDir, client.origin)
|
|
504
|
+
}),
|
|
505
|
+
...(assetRewrite ? { assetRewrite } : {}),
|
|
506
|
+
...(assetIds ? { assetIds } : {})
|
|
507
|
+
})
|
|
508
|
+
const report = {
|
|
509
|
+
info,
|
|
510
|
+
note,
|
|
511
|
+
error,
|
|
512
|
+
dim: (s) => `${colors.dim}${s}${colors.reset}`
|
|
513
|
+
}
|
|
514
|
+
// What creating the site sent, when this push created it (`createSiteFromItsContent`).
|
|
515
|
+
let created = null
|
|
473
516
|
if (!output && !dryRun) {
|
|
474
517
|
let mediaRefs = []
|
|
475
518
|
let refusals = []
|
|
@@ -481,7 +524,7 @@ export async function push(args = [], deps = {}) {
|
|
|
481
524
|
// Placement identity for the folder — see writeFolderItemUuids.
|
|
482
525
|
folderItemUuids: readFolderItemUuids(siteDir, client.origin),
|
|
483
526
|
...(foundationDir ? { foundationDir } : {}),
|
|
484
|
-
resolveModel
|
|
527
|
+
resolveModel,
|
|
485
528
|
// What a pull held, for a page that changed since to stop the push before anything goes up.
|
|
486
529
|
...(force ? {} : { heldUnits: readHeldUnits(siteDir, client.origin) })
|
|
487
530
|
})
|
|
@@ -499,31 +542,27 @@ export async function push(args = [], deps = {}) {
|
|
|
499
542
|
// …and so does a page a pull held whose files changed since (`refuseChangedHeld`).
|
|
500
543
|
if (refuseChangedHeld(held, { error, note })) return { exitCode: 1 }
|
|
501
544
|
if (mediaRefs.length) {
|
|
502
|
-
// The site has to exist before its bytes do — an upload with no owning
|
|
503
|
-
//
|
|
504
|
-
//
|
|
505
|
-
//
|
|
506
|
-
//
|
|
507
|
-
|
|
508
|
-
// and push did neither until 2026-08-19: it sent the authored alias (`src`),
|
|
509
|
-
// which names a foundation no deployment can resolve. A site created that way
|
|
510
|
-
// keeps the bad ref, and the backend's create guard now refuses it outright
|
|
511
|
-
// (channel backend↔framework, their measurement).
|
|
512
|
-
//
|
|
513
|
-
// ⭐ Same shape as the send-only-changed defect fixed this morning, and missed
|
|
514
|
-
// for the same reason: the rule was applied at the writers under discussion and
|
|
515
|
-
// a third caller of the same value was never enumerated.
|
|
516
|
-
const site = await ensureSiteExists({
|
|
545
|
+
// The site has to exist before its bytes do — an upload with no owning entity is
|
|
546
|
+
// charged and cannot be freed, because freeing means deleting the owner. A site's
|
|
547
|
+
// first push creates it from its content, so a push the backend refuses leaves no site
|
|
548
|
+
// and no bytes (`createSiteFromItsContent`); a no-op once `sync.json` holds this
|
|
549
|
+
// backend's site uuid.
|
|
550
|
+
const site = await createSiteFromItsContent({
|
|
517
551
|
client,
|
|
518
552
|
siteDir,
|
|
519
|
-
|
|
520
|
-
|
|
553
|
+
emit: async () => emitSyncPackages(siteDir, await emitOptionsNow()),
|
|
554
|
+
report
|
|
521
555
|
})
|
|
522
556
|
if (!site.uuid) {
|
|
523
|
-
|
|
524
|
-
|
|
557
|
+
note('No media was uploaded.')
|
|
558
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: false, released }), { note })
|
|
525
559
|
return { exitCode: 1 }
|
|
526
560
|
}
|
|
561
|
+
if (site.created) created = site
|
|
562
|
+
// What a first push has sent by now, when the media then fail: said, since it is not nothing.
|
|
563
|
+
const sentSoFar = () =>
|
|
564
|
+
site.created &&
|
|
565
|
+
note('The site was created with its content, which names its media by their local paths until a push uploads them.')
|
|
527
566
|
info('Uploading media…')
|
|
528
567
|
try {
|
|
529
568
|
const { map, ids, served, failed } = await uploadSiteMedia(
|
|
@@ -543,9 +582,11 @@ export async function push(args = [], deps = {}) {
|
|
|
543
582
|
// the uploader, and not worth blocking a push over.
|
|
544
583
|
if (failed.length) {
|
|
545
584
|
error(
|
|
546
|
-
`${failed.length} asset(s) failed to upload — nothing was pushed
|
|
585
|
+
`${failed.length} asset(s) failed to upload — ${site.created ? 'nothing else was pushed.' : 'nothing was pushed.'}`
|
|
547
586
|
)
|
|
548
587
|
for (const f of failed) note(` ${f.path} (HTTP ${f.status})`)
|
|
588
|
+
sentSoFar()
|
|
589
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: false, released }), { note })
|
|
549
590
|
return { exitCode: 1 }
|
|
550
591
|
}
|
|
551
592
|
if (Object.keys(map).length) assetRewrite = map
|
|
@@ -574,15 +615,13 @@ export async function push(args = [], deps = {}) {
|
|
|
574
615
|
} else {
|
|
575
616
|
error(`Media upload failed: ${err.message}`)
|
|
576
617
|
}
|
|
618
|
+
sentSoFar()
|
|
619
|
+
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: false, released }), { note })
|
|
577
620
|
return { exitCode: 1 }
|
|
578
621
|
}
|
|
579
622
|
}
|
|
580
623
|
}
|
|
581
624
|
|
|
582
|
-
const itemUuids =
|
|
583
|
-
output || dryRun
|
|
584
|
-
? readItemUuids(siteDir, client.origin)
|
|
585
|
-
: await ensureItemUuids({ client, siteDir, note })
|
|
586
625
|
// A foundation named by catalog ref — a clone's: its kept registered version types a query named
|
|
587
626
|
// for a data key (`ensureRegisteredFoundation`). Offline, only what is already kept.
|
|
588
627
|
if (!output && !dryRun) {
|
|
@@ -597,46 +636,7 @@ export async function push(args = [], deps = {}) {
|
|
|
597
636
|
// each held one it no longer lists (`statedServices`) — and the backend decides per
|
|
598
637
|
// service. Said here: what the file asks that will not be sent as written.
|
|
599
638
|
announceServices({ siteYml, say: { warn }, supports: await foundationSupports(siteDir, siteYml) })
|
|
600
|
-
const emitOptions =
|
|
601
|
-
backend: client.origin,
|
|
602
|
-
// Placement identity for the folder — see writeFolderItemUuids.
|
|
603
|
-
folderItemUuids: readFolderItemUuids(siteDir, client.origin),
|
|
604
|
-
// Identity for the `queries` section — see readQueryUuids. Keyed by
|
|
605
|
-
// name, because a declaration has no file for a path-keyed map to hold.
|
|
606
|
-
queryUuids: readQueryUuids(siteDir, client.origin),
|
|
607
|
-
// The keys this deployment's Sections take — see deploymentFields.
|
|
608
|
-
...fields,
|
|
609
|
-
// Identity for the records' list items — see readRecordItemUuids.
|
|
610
|
-
recordItemUuids: readRecordItemUuids(siteDir, client.origin),
|
|
611
|
-
...(foundationDir ? { foundationDir } : {}),
|
|
612
|
-
resolveModel: makeModelResolver({
|
|
613
|
-
client,
|
|
614
|
-
offline: Boolean(output) || dryRun,
|
|
615
|
-
siteDir
|
|
616
|
-
}),
|
|
617
|
-
priorHashes,
|
|
618
|
-
sendAll,
|
|
619
|
-
itemUuids,
|
|
620
|
-
// The PINNED foundation ref from the bring-along above, stamped over the
|
|
621
|
-
// authored `site.yml` string. Delivery is version-pinned end to end, so an
|
|
622
|
-
// unpinned local name on the wire names code no host can serve. Absent when
|
|
623
|
-
// the site already references a registry ref or URL — then site.yml's own
|
|
624
|
-
// value rides verbatim.
|
|
625
|
-
...(fnd.ref ? { injectInfo: { foundation: fnd.ref } } : {}),
|
|
626
|
-
// Both grains are dropped together by --force: one flag, one meaning,
|
|
627
|
-
// no partial-force mode.
|
|
628
|
-
...(force
|
|
629
|
-
? {}
|
|
630
|
-
: {
|
|
631
|
-
baseVersions: readBaseVersions(siteDir, client.origin),
|
|
632
|
-
itemBaseVersions: readItemBaseVersions(siteDir, client.origin),
|
|
633
|
-
// ⭐ What a pull held is left out while its files still say what they said, so the backend
|
|
634
|
-
// keeps the app's version (`readHeldUnits`). `--force` sends it with everything else.
|
|
635
|
-
heldUnits: readHeldUnits(siteDir, client.origin)
|
|
636
|
-
}),
|
|
637
|
-
...(assetRewrite ? { assetRewrite } : {}),
|
|
638
|
-
...(assetIds ? { assetIds } : {})
|
|
639
|
-
}
|
|
639
|
+
const emitOptions = await emitOptionsNow()
|
|
640
640
|
let pkg
|
|
641
641
|
try {
|
|
642
642
|
pkg = await emitSyncPackages(siteDir, emitOptions)
|
|
@@ -733,27 +733,17 @@ export async function push(args = [], deps = {}) {
|
|
|
733
733
|
|
|
734
734
|
// Submit both lanes, back-fill the minted uuids, and persist the send-only-changed
|
|
735
735
|
// cache. Shared with `uniweb publish` via ../backend/site-sync.js.
|
|
736
|
-
const result = await pushSyncPackages({
|
|
737
|
-
client,
|
|
738
|
-
siteDir,
|
|
739
|
-
pkg,
|
|
740
|
-
report: {
|
|
741
|
-
info,
|
|
742
|
-
note,
|
|
743
|
-
error,
|
|
744
|
-
dim: (s) => `${colors.dim}${s}${colors.reset}`
|
|
745
|
-
}
|
|
746
|
-
})
|
|
736
|
+
const result = await pushSyncPackages({ client, siteDir, pkg, report })
|
|
747
737
|
// What the push wrote into the files is committed, whatever became of the lanes.
|
|
748
738
|
const written = commitWriteBacks(siteDir, client.origin, { complete: result.complete, released })
|
|
749
739
|
if (result.exitCode !== 0) {
|
|
750
740
|
reportWriteBacks(written, { note })
|
|
751
741
|
return { exitCode: result.exitCode }
|
|
752
742
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
)
|
|
743
|
+
// A first push created the site before this, so what that sent counts too.
|
|
744
|
+
const total = (created?.finalizedTotal || 0) + result.finalizedTotal
|
|
745
|
+
const wrote = [...(created?.wrote || []), ...result.wrote]
|
|
746
|
+
success(`Pushed ${total} entit${total === 1 ? 'y' : 'ies'}` + (wrote.length ? ` — ${wrote.join(', ')}` : ''))
|
|
757
747
|
reportWriteBacks(written, { note })
|
|
758
748
|
// ⭐ The records this push took out of the site's folder are off the live site already (it reads
|
|
759
749
|
// its folder as it stands): offer to delete them from the backend (ruled 2026-11-04).
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-09T20:11:18.154Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.10"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.20.1"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.9"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"version": "1.0.8"
|
|
25
25
|
},
|
|
26
26
|
"@uniweb/kit": {
|
|
27
|
-
"version": "1.7.
|
|
27
|
+
"version": "1.7.18"
|
|
28
28
|
},
|
|
29
29
|
"@uniweb/loom": {
|
|
30
30
|
"version": "1.1.3"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"version": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"@uniweb/schemas": {
|
|
45
|
-
"version": "1.
|
|
45
|
+
"version": "1.7.0"
|
|
46
46
|
},
|
|
47
47
|
"@uniweb/scholar": {
|
|
48
48
|
"version": "1.1.0"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"version": "1.3.2"
|
|
61
61
|
},
|
|
62
62
|
"@uniweb/unipress": {
|
|
63
|
-
"version": "1.1.
|
|
63
|
+
"version": "1.1.37"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"templates": {
|
package/src/utils/config.js
CHANGED
|
@@ -465,7 +465,7 @@ export async function updateRootScripts(rootDir, sites, pm = 'pnpm') {
|
|
|
465
465
|
// scripts named or run another way now (by its project's name; under npm, by its folder). A script
|
|
466
466
|
// under the person's own name for a command, or whose command the CLI doesn't write, stays.
|
|
467
467
|
// ⛔ Until 2026-10-13 they were only ever added: after `rename site blog journal`, `dev:blog`
|
|
468
|
-
// still ran `uniweb dev blog`. ⛔
|
|
468
|
+
// still ran `uniweb dev blog`. ⛔ In 1.30.0 and 1.30.1 only a gone site's went, so a
|
|
469
469
|
// renamed project kept its old pair beside the new one.
|
|
470
470
|
for (const [key, value] of Object.entries(scripts)) {
|
|
471
471
|
if (!(key in newScripts) && cliNamed(key, value)) delete scripts[key]
|
|
@@ -253,7 +253,7 @@ export async function uploadSiteData({
|
|
|
253
253
|
* swallowing).
|
|
254
254
|
*
|
|
255
255
|
* ⭐ The THIRD door, and the last to get one. `/dev/assets` has
|
|
256
|
-
* `describeAssetRefusal`,
|
|
256
|
+
* `describeAssetRefusal`, a site create has `describeStorageRefusal`, and this
|
|
257
257
|
* lane threw prose with the JSON inlined until 2026-09-01 — which is the failure
|
|
258
258
|
* the other two describers exist to prevent, so leaving it was just an untreated
|
|
259
259
|
* instance of a solved problem.
|