uniweb 1.33.0 → 1.34.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/README.md +6 -6
- package/package.json +3 -3
- package/partials/agents.md +4 -4
- package/partials/guides/backend.md +1 -1
- package/partials/guides/data.md +28 -4
- package/partials/guides/ship.md +1 -0
- package/src/backend/asset-download.js +24 -6
- package/src/backend/library-types.js +56 -13
- package/src/backend/site-sync.js +13 -3
- package/src/commands/build.js +15 -12
- package/src/commands/publish.js +18 -120
- package/src/commands/pull.js +10 -1
- package/src/commands/push.js +0 -3
- package/src/commands/register.js +89 -13
- package/src/framework-index.json +5 -5
- package/src/utils/records-guard.js +7 -6
- package/templates/workspace/README.md.hbs +3 -0
- package/src/utils/schemaless-report.js +0 -30
- package/src/utils/site-data-upload.js +0 -310
package/src/commands/publish.js
CHANGED
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
* nothing (§4, foundation-bring-along.js). *(This read "releases the new
|
|
18
18
|
* version first (or asks)" until 2026-10-16; changed code has been released
|
|
19
19
|
* without asking since 2026-09-24.)*
|
|
20
|
-
* 3. SYNCS — builds the site data (link mode), uploads media and
|
|
21
|
-
*
|
|
22
|
-
* `uniweb push` uses);
|
|
20
|
+
* 3. SYNCS — builds the site data (link mode), uploads media, and pushes
|
|
21
|
+
* content (the same two-lane sync `uniweb push` uses);
|
|
23
22
|
* 4. GOES LIVE — POST /dev/site/publish/{uuid}. When the backend answers 402
|
|
24
23
|
* (the site must be paid for first), it opens the settlement URL the
|
|
25
24
|
* backend hands over, verbatim, and stops; the content is already synced,
|
|
@@ -57,10 +56,7 @@ import yaml from 'js-yaml'
|
|
|
57
56
|
import {
|
|
58
57
|
loadDeployYml,
|
|
59
58
|
resolvePublishTarget,
|
|
60
|
-
recordLastDeploy
|
|
61
|
-
collectSchemalessData,
|
|
62
|
-
collectSchemalessDataAssets,
|
|
63
|
-
rewriteSchemalessDataAssets
|
|
59
|
+
recordLastDeploy
|
|
64
60
|
} from '@uniweb/build/site'
|
|
65
61
|
import { emitSyncPackages } from '@uniweb/build/uwx'
|
|
66
62
|
import {
|
|
@@ -142,11 +138,6 @@ import {
|
|
|
142
138
|
readPaymentRefusal,
|
|
143
139
|
settleRefusal
|
|
144
140
|
} from '../backend/payment-handoff.js'
|
|
145
|
-
import { reportSchemalessQueries } from '../utils/schemaless-report.js'
|
|
146
|
-
import {
|
|
147
|
-
uploadSiteData,
|
|
148
|
-
describeDataRefusal
|
|
149
|
-
} from '../utils/site-data-upload.js'
|
|
150
141
|
|
|
151
142
|
const c = {
|
|
152
143
|
reset: '\x1b[0m',
|
|
@@ -654,9 +645,10 @@ export async function publish(args = []) {
|
|
|
654
645
|
if (!guard.ok) return { exitCode: 1 }
|
|
655
646
|
}
|
|
656
647
|
|
|
657
|
-
// 3.
|
|
658
|
-
//
|
|
659
|
-
//
|
|
648
|
+
// 3. A first emit: what the push will send, and what stops it before anything goes up —
|
|
649
|
+
// a record it cannot send, and a folder or query whose data schema resolves to nothing
|
|
650
|
+
// (`refusals`): every record has one [Diego, 2026-11-11]. ⛔ Until then such a query was
|
|
651
|
+
// "schema-less", and this step partitioned the queries so 4c could upload its compiled files.
|
|
660
652
|
// ⭐ With the keys this deployment's Sections take (`deploymentFields`), as the push below
|
|
661
653
|
// is: this emit says which files go up, and a key sent only where it is taken can name one —
|
|
662
654
|
// `touch_icon` does. ⛔ Until 2026-10-28 it went without them, so a touch icon was sent as the
|
|
@@ -685,11 +677,6 @@ export async function publish(args = []) {
|
|
|
685
677
|
}
|
|
686
678
|
// …and so does a page a pull held whose files changed since (`refuseChangedHeld`).
|
|
687
679
|
if (refuseChangedHeld(probe, { error: say.err, note: say.dim })) return { exitCode: 1 }
|
|
688
|
-
const schemalessNames = (probe.schemaless || []).map((col) => col.name)
|
|
689
|
-
// A product decision the author is usually making unknowingly — say it at warn
|
|
690
|
-
// level, not dim among everything else. See the helper for what the old
|
|
691
|
-
// message got wrong.
|
|
692
|
-
reportSchemalessQueries(probe.schemaless, say)
|
|
693
680
|
const localAssets = probe.localAssets || []
|
|
694
681
|
|
|
695
682
|
// 3a. A copy with no site uuid for this backend (`sync.json`) is bound to no site
|
|
@@ -748,8 +735,8 @@ export async function publish(args = []) {
|
|
|
748
735
|
// that moved to `settings.fetch`, and the warning holds for any name.
|
|
749
736
|
//
|
|
750
737
|
// A file map needs a name nothing else claims (`static_data` / `data_files`
|
|
751
|
-
// were proposed) AND a consumer that reads it
|
|
752
|
-
//
|
|
738
|
+
// were proposed) AND a consumer that reads it. Neither was settled, and since
|
|
739
|
+
// 2026-11-11 no file of compiled data goes up at all: every record does.
|
|
753
740
|
...(fnd.ref ? { injectInfo: { foundation: fnd.ref } } : {}),
|
|
754
741
|
...(Object.keys(ext.pins).length ? { injectExtensions: ext.pins } : {}),
|
|
755
742
|
...(assetRewrite ? { assetRewrite } : {}),
|
|
@@ -777,7 +764,7 @@ export async function publish(args = []) {
|
|
|
777
764
|
report
|
|
778
765
|
})
|
|
779
766
|
if (!site.uuid) {
|
|
780
|
-
say.dim('No media
|
|
767
|
+
say.dim('No media was uploaded.')
|
|
781
768
|
reportWriteBacks(commitWriteBacks(siteDir, client.origin, { complete: false, released }), { note: say.dim })
|
|
782
769
|
return { exitCode: 1 }
|
|
783
770
|
}
|
|
@@ -786,16 +773,11 @@ export async function publish(args = []) {
|
|
|
786
773
|
site.created &&
|
|
787
774
|
say.dim('The site was created with its content, which names its media by their local paths until a push uploads them.')
|
|
788
775
|
|
|
789
|
-
// 4.
|
|
790
|
-
//
|
|
791
|
-
// 2026-
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
// 4b. Upload ALL local media (entity refs + ball refs) on one asset lane →
|
|
796
|
-
// the ref→serveUrl map; rewrite the entity content AND the ball with it.
|
|
797
|
-
// …and each file record's file (`@uniweb/file` — `{ ref, path, contentType }`, already located).
|
|
798
|
-
const mediaRefs = [...new Set([...localAssets, ...ballAssets]), ...(probe.localFiles || [])]
|
|
776
|
+
// 4. Upload ALL local media on one asset lane → the ref→serveUrl map the content is
|
|
777
|
+
// rewritten with — and each file record's file (`@uniweb/file` — `{ ref, path,
|
|
778
|
+
// contentType }`, already located). ⛔ Until 2026-11-11 the compiled files of a query
|
|
779
|
+
// with no data schema were gathered first, for their records' media, and uploaded in 4c.
|
|
780
|
+
const mediaRefs = [...new Set(localAssets), ...(probe.localFiles || [])]
|
|
799
781
|
if (mediaRefs.length) {
|
|
800
782
|
say.info('Uploading media…')
|
|
801
783
|
try {
|
|
@@ -831,7 +813,6 @@ export async function publish(args = []) {
|
|
|
831
813
|
(repoOf(siteDir) ? '' : ' — commit it')
|
|
832
814
|
)
|
|
833
815
|
}
|
|
834
|
-
if (ballAssets.length) ball = rewriteSchemalessDataAssets(ball, map)
|
|
835
816
|
say.dim(
|
|
836
817
|
`Media : ${Object.keys(map).length}/${mediaRefs.length - served.length} ref(s) → serve URL`
|
|
837
818
|
)
|
|
@@ -851,95 +832,12 @@ export async function publish(args = []) {
|
|
|
851
832
|
}
|
|
852
833
|
}
|
|
853
834
|
|
|
854
|
-
// 4c. Deliver the schema-less collection data — one object per file.
|
|
855
|
-
//
|
|
856
|
-
// Each `dist/data/**` file is PUT to the target `data-uploads` returns,
|
|
857
|
-
// landing at its serving tail. Hosting intercepts `/data/**.json` and
|
|
858
|
-
// reads `_data/{tail}` from the site bucket, so the file is served from
|
|
859
|
-
// where it lands: **nothing records where anything went**, and no `info`
|
|
860
|
-
// field is stamped.
|
|
861
|
-
//
|
|
862
|
-
// ⛔ NO BALL. A CLI sends separates or a ball, never both — presence of a
|
|
863
|
-
// ball is the backend's signal for which CLI it is talking to, and
|
|
864
|
-
// sending both destroys it along with their ability to know when the
|
|
865
|
-
// unwrap can be deleted. Released CLIs keep sending one and their unwrap
|
|
866
|
-
// keeps serving them; this one does not.
|
|
867
|
-
//
|
|
868
|
-
// 📌 No capability gate, deliberately. A backend predating this lane
|
|
869
|
-
// answers 404 and the publish fails — accepted while pre-prod [Diego,
|
|
870
|
-
// 2026-08-18: "we are pre-prod. I'm not concerned about old cli vs new"].
|
|
871
|
-
// A gate was written and removed: it is machinery for a population that
|
|
872
|
-
// does not exist, which is the failure this work kept catching in others.
|
|
873
|
-
// `client.discover()` is the mechanism if that changes — `DISCOVERY_DEFAULTS`
|
|
874
|
-
// makes an absent key non-breaking by construction.
|
|
875
|
-
//
|
|
876
|
-
// ⛔ UNCONDITIONAL — `if (ball)` was here until 2026-09-01 and it was the bug.
|
|
877
|
-
//
|
|
878
|
-
// `collectSchemalessData` returns null for an empty set, so a publish that
|
|
879
|
-
// carried no schema-less data sent NO PLAN AT ALL. The backend reconciles a
|
|
880
|
-
// site's data usage against this manifest, and a request that never arrives
|
|
881
|
-
// is not a manifest saying "none" — it is silence, indistinguishable from a
|
|
882
|
-
// publish that never happened. So deleting your LAST schema-less collection
|
|
883
|
-
// — the exact operation the reconcile exists to make free — was the one
|
|
884
|
-
// operation that could not be expressed, and the site kept paying for it
|
|
885
|
-
// until the whole site was deleted.
|
|
886
|
-
//
|
|
887
|
-
// ⭐ The general shape, worth more than the fix: an EMPTY set and NO set are
|
|
888
|
-
// different statements, and an `if (x)` guard collapses them into one. The
|
|
889
|
-
// cost is always paid by whoever is downstream trying to tell them apart.
|
|
890
|
-
//
|
|
891
|
-
// Both halves agreed in channel backend↔framework (2026-09-01); the
|
|
892
|
-
// backend's route accepts an empty `files` array as of the same exchange.
|
|
893
|
-
say.info('Uploading schema-less record data…')
|
|
894
|
-
try {
|
|
895
|
-
const r = await uploadSiteData({
|
|
896
|
-
apiBase: client.origin,
|
|
897
|
-
token: await client.token(),
|
|
898
|
-
siteUuid: site.uuid,
|
|
899
|
-
// The plan and every direct PUT name the workspace the rest of the publish did.
|
|
900
|
-
workspace: client.workspace,
|
|
901
|
-
workspaceSource: client.workspaceSource,
|
|
902
|
-
ball,
|
|
903
|
-
onProgress: (m) => say.dim(` ${m}`)
|
|
904
|
-
})
|
|
905
|
-
if (r.failed.length) {
|
|
906
|
-
// A file whose bytes did not land must not be published: the site would
|
|
907
|
-
// serve a stale copy or 404, and the only trace would be a warning.
|
|
908
|
-
say.err(
|
|
909
|
-
`${r.failed.length} data file(s) failed to upload — not publishing.`
|
|
910
|
-
)
|
|
911
|
-
for (const f of r.failed) say.dim(` ${f.path} (HTTP ${f.status})`)
|
|
912
|
-
sentSoFar()
|
|
913
|
-
return { exitCode: 1 }
|
|
914
|
-
}
|
|
915
|
-
say.dim(`Record data : ${r.uploaded.length} file(s) [${r.mode}]`)
|
|
916
|
-
} catch (err) {
|
|
917
|
-
// The workspace this publish works in, refused — said as itself, as at every other door.
|
|
918
|
-
if (err instanceof WorkspaceMismatchError) {
|
|
919
|
-
say.err(err.message)
|
|
920
|
-
sentSoFar()
|
|
921
|
-
return { exitCode: 1 }
|
|
922
|
-
}
|
|
923
|
-
// A typed plan refusal gets its own account (quota, or whatever else the
|
|
924
|
-
// backend names); anything else falls through to the raw message. Same
|
|
925
|
-
// treatment the asset plan and the site create already get — this was the
|
|
926
|
-
// last door still printing the problem document at the user verbatim.
|
|
927
|
-
const refusal = describeDataRefusal(err)
|
|
928
|
-
if (refusal) {
|
|
929
|
-
say.err(refusal.headline)
|
|
930
|
-
for (const line of refusal.notes) say.dim(line)
|
|
931
|
-
} else {
|
|
932
|
-
say.err(`Record data upload failed: ${err.message}`)
|
|
933
|
-
}
|
|
934
|
-
sentSoFar()
|
|
935
|
-
return { exitCode: 1 }
|
|
936
|
-
}
|
|
937
|
-
|
|
938
835
|
// 5. Push the site (content + folder) over the send-only-changed cache —
|
|
939
836
|
// the SAME two-lane submission `uniweb push` uses — stamping
|
|
940
837
|
// the pinned foundation ref and rewriting local media refs to serve URLs.
|
|
941
|
-
// (It stamped `info.data_bundle` until 2026-08-18
|
|
942
|
-
//
|
|
838
|
+
// (It stamped `info.data_bundle` until 2026-08-18. ⛔ Until 2026-11-11 a step 4c
|
|
839
|
+
// sent the compiled files of the queries with no data schema, before this push:
|
|
840
|
+
// every record has a data schema since, and goes up with this push.)
|
|
943
841
|
// ⭐ WHAT THE SITE HAS — read before the push, for the language selection. Only this
|
|
944
842
|
// read sees a decision the owner made in the app since this clone last synced. It
|
|
945
843
|
// reads this backend's site, from sync.json; a never-synced site has none.
|
package/src/commands/pull.js
CHANGED
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
dataBlockModels,
|
|
82
82
|
siteDefaultSectionType,
|
|
83
83
|
recordsToProject,
|
|
84
|
+
readSiteFoundationDeclarations,
|
|
84
85
|
siteSelfScope,
|
|
85
86
|
readZip,
|
|
86
87
|
computeUnitHashes,
|
|
@@ -1265,9 +1266,15 @@ export async function pull(args = [], deps = {}) {
|
|
|
1265
1266
|
)
|
|
1266
1267
|
}
|
|
1267
1268
|
}
|
|
1269
|
+
// ⭐ WHAT THE SITE'S FOUNDATION DECLARES, read from its source where it is local, as the build
|
|
1270
|
+
// reads it (`readSiteFoundationDeclarations`): a copy whose foundation has not been built — every
|
|
1271
|
+
// fresh clone — still knows which data key types which folder. ⛔ Until 2026-11-11 the pull read a
|
|
1272
|
+
// built `dist/` only, and such a copy wrote a typed folder's records again in their type's folder.
|
|
1273
|
+
const foundationDeclared = await readSiteFoundationDeclarations(projDir)
|
|
1268
1274
|
const report = siteContentDocumentToProject({
|
|
1269
1275
|
document: siteDoc,
|
|
1270
1276
|
siteRoot: projDir,
|
|
1277
|
+
foundation: foundationDeclared,
|
|
1271
1278
|
// Which backend's asset ids to read back as the author's own paths. Without
|
|
1272
1279
|
// it a pull leaves every image pointing at a backend route.
|
|
1273
1280
|
backend: client.origin,
|
|
@@ -1332,7 +1339,9 @@ export async function pull(args = [], deps = {}) {
|
|
|
1332
1339
|
resolveDeclaration: (name) => declByModel.get(name) || null,
|
|
1333
1340
|
// The scope a model's `@/x` was qualified with, so `@acme/article` is placed
|
|
1334
1341
|
// back in `records/article/` — see `pullScope`.
|
|
1335
|
-
scope: pullScope
|
|
1342
|
+
scope: pullScope,
|
|
1343
|
+
// What the foundation declares, read again now the site's content (its `site.yml`) is in.
|
|
1344
|
+
foundation: await readSiteFoundationDeclarations(projDir)
|
|
1336
1345
|
}
|
|
1337
1346
|
})
|
|
1338
1347
|
// ⭐ THE FOLDER'S PLACEMENT IDENTITY, from the folder this pull took — as a push banks
|
package/src/commands/push.js
CHANGED
|
@@ -71,7 +71,6 @@ import { updateBackendMap, carryServed, SYNC_STORE_FILE } from '@uniweb/build/uw
|
|
|
71
71
|
import { BackendClient, BackendUnreachableError } from '../backend/client.js'
|
|
72
72
|
import { resolveSiteDir } from './deploy.js'
|
|
73
73
|
import { refuseIfContentDoesNotConform } from '../utils/conformance.js'
|
|
74
|
-
import { reportSchemalessQueries } from '../utils/schemaless-report.js'
|
|
75
74
|
import { checkFlags } from '../utils/flag-guard.js'
|
|
76
75
|
import {
|
|
77
76
|
syncedElsewhere,
|
|
@@ -668,8 +667,6 @@ export async function push(args = [], deps = {}) {
|
|
|
668
667
|
if (refuseUnsendableRecords(pkg.refusals, { error, note })) return { exitCode: 1 }
|
|
669
668
|
if (refuseChangedHeld(pkg, { error, note })) return { exitCode: 1 }
|
|
670
669
|
noteHeldLeftOut(pkg, { note })
|
|
671
|
-
// Warn level, not dim: this is the author choosing entities vs static files.
|
|
672
|
-
reportSchemalessQueries(pkg.schemaless, { warn, dim: note })
|
|
673
670
|
|
|
674
671
|
const totalEntities =
|
|
675
672
|
(siteContent?.entityCount || 0) + (records?.entityCount || 0)
|
package/src/commands/register.js
CHANGED
|
@@ -74,11 +74,15 @@ import {
|
|
|
74
74
|
import { execSync } from 'node:child_process'
|
|
75
75
|
import { resolve, join, relative } from 'node:path'
|
|
76
76
|
import prompts from 'prompts'
|
|
77
|
+
import { collectNestedRefs } from '@uniweb/schemas/format'
|
|
77
78
|
import { buildRegistryPackage, buildSchemaOnlyPackage } from '@uniweb/build/uwx'
|
|
78
79
|
import {
|
|
79
80
|
classifyPackage,
|
|
80
81
|
isSchemasPackage,
|
|
81
82
|
collectStandaloneSchemas,
|
|
83
|
+
buildMappingMap,
|
|
84
|
+
ownMappingFiles,
|
|
85
|
+
loadMappingFile,
|
|
82
86
|
readFoundationName,
|
|
83
87
|
checkFoundationName,
|
|
84
88
|
checkRegistrationScope,
|
|
@@ -263,6 +267,35 @@ function sayRefused({ res, parsedBody, rawBody, scope, member, what }) {
|
|
|
263
267
|
}
|
|
264
268
|
}
|
|
265
269
|
|
|
270
|
+
/**
|
|
271
|
+
* The mappings a foundation carries from a library (`lib.mappings`, in full), read from its
|
|
272
|
+
* `mappings/`, with each one a `keys_from` names there, keyed `@/<name>` as the library spells them.
|
|
273
|
+
*/
|
|
274
|
+
async function libraryMappingsWanted(lib, own) {
|
|
275
|
+
if (!(lib.mappings || []).length) return {}
|
|
276
|
+
const files = new Map(ownMappingFiles(lib.dir).map((m) => [`@/${m.name}`, m.file]))
|
|
277
|
+
const out = {}
|
|
278
|
+
const queue = lib.mappings.map(own).filter(Boolean)
|
|
279
|
+
while (queue.length) {
|
|
280
|
+
const ref = queue.pop()
|
|
281
|
+
if (out[ref] || !files.has(ref)) continue
|
|
282
|
+
out[ref] = await loadMappingFile(files.get(ref))
|
|
283
|
+
const from = typeof out[ref]?.keys_from === 'string' ? own(out[ref].keys_from) : null
|
|
284
|
+
if (from) queue.push(from)
|
|
285
|
+
}
|
|
286
|
+
return out
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** A mapping's reverse `follow` lines' `model`s, as written. */
|
|
290
|
+
function followModelsOf(decl) {
|
|
291
|
+
const out = []
|
|
292
|
+
for (const line of Array.isArray(decl?.follow) ? decl.follow : []) {
|
|
293
|
+
if (!line || typeof line !== 'object') continue
|
|
294
|
+
for (const spec of Object.values(line)) if (spec && typeof spec.model === 'string') out.push(spec.model)
|
|
295
|
+
}
|
|
296
|
+
return out
|
|
297
|
+
}
|
|
298
|
+
|
|
266
299
|
/**
|
|
267
300
|
* Register the data schemas a library defines, before the foundation that names them
|
|
268
301
|
* (`backend/library-types.js`): the library's package whole, as `uniweb register` there sends it.
|
|
@@ -286,10 +319,31 @@ async function registerLibraryTypes(lib, { client, exporter, at }) {
|
|
|
286
319
|
try {
|
|
287
320
|
// The types the foundation names from it, and no other of its files: those may be another
|
|
288
321
|
// package's to register, or a copy of one the foundation defines (`library-types.js`).
|
|
289
|
-
const
|
|
322
|
+
const own = (ref) => (ref.startsWith('@/') ? ref : ref.startsWith(`${lib.scope}/`) ? `@/${ref.slice(lib.scope.length + 1)}` : null)
|
|
323
|
+
const wanted = new Set(lib.refs.map(own))
|
|
290
324
|
const all = await collectStandaloneSchemas(lib.dir)
|
|
325
|
+
// ⭐ The mappings it carries from here, each with the ones its `keys_from` names, and the types
|
|
326
|
+
// of this library they name: a registry takes a mapping only after what it names.
|
|
327
|
+
const mappings = await libraryMappingsWanted(lib, own)
|
|
328
|
+
for (const decl of Object.values(mappings)) {
|
|
329
|
+
for (const ref of [decl.model, ...followModelsOf(decl)]) {
|
|
330
|
+
const local = typeof ref === 'string' ? own(ref) : null
|
|
331
|
+
if (local && all[local]) wanted.add(local)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
// …and what those types name, of this library, as the build would have named them.
|
|
335
|
+
for (const queue = [...wanted]; queue.length; ) {
|
|
336
|
+
for (const ref of collectNestedRefs(all[queue.pop()] || {})) {
|
|
337
|
+
const local = own(ref)
|
|
338
|
+
if (local && all[local] && !wanted.has(local)) {
|
|
339
|
+
wanted.add(local)
|
|
340
|
+
queue.push(local)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
291
344
|
doc = buildSchemaOnlyPackage({
|
|
292
345
|
schemas: Object.fromEntries(Object.entries(all).filter(([key]) => wanted.has(key))),
|
|
346
|
+
mappings,
|
|
293
347
|
scope: lib.scope,
|
|
294
348
|
exporter
|
|
295
349
|
})
|
|
@@ -298,7 +352,8 @@ async function registerLibraryTypes(lib, { client, exporter, at }) {
|
|
|
298
352
|
return null
|
|
299
353
|
}
|
|
300
354
|
const names = doc.entities.map((e) => e.name)
|
|
301
|
-
|
|
355
|
+
const typeNames = doc.entities.filter((e) => e.model === '@uniweb/data-schema').map((e) => e.name)
|
|
356
|
+
info(`Registering ${(lib.mappings || []).length ? 'the data schemas and mappings' : 'the data schemas'} in ${at} (${names.join(', ')}) …`)
|
|
302
357
|
let res
|
|
303
358
|
try {
|
|
304
359
|
res = await client.register(JSON.stringify(doc, null, 2))
|
|
@@ -315,10 +370,13 @@ async function registerLibraryTypes(lib, { client, exporter, at }) {
|
|
|
315
370
|
}
|
|
316
371
|
if (res.ok) {
|
|
317
372
|
const answers = Array.isArray(body?.data_schemas) ? body.data_schemas : []
|
|
318
|
-
if (answers.length === names.length && answers.every((a) => a?.unchanged === true)) {
|
|
373
|
+
if (names.length === typeNames.length && answers.length === names.length && answers.every((a) => a?.unchanged === true)) {
|
|
319
374
|
log(` ${colors.dim}Unchanged: the registry holds them as they are.${colors.reset}`)
|
|
320
375
|
} else {
|
|
321
|
-
|
|
376
|
+
const mappingCount = names.length - typeNames.length
|
|
377
|
+
success(
|
|
378
|
+
`Registered ${[typeNames.length && `${typeNames.length} data schema(s)`, mappingCount && `${mappingCount} mapping(s)`].filter(Boolean).join(' and ')} under ${lib.scope}, from ${at}`
|
|
379
|
+
)
|
|
322
380
|
}
|
|
323
381
|
return { names, body }
|
|
324
382
|
}
|
|
@@ -330,10 +388,13 @@ async function registerLibraryTypes(lib, { client, exporter, at }) {
|
|
|
330
388
|
const held = await Promise.all(
|
|
331
389
|
lib.refs.map((ref) => client.readDataSchema(ref).catch(() => undefined))
|
|
332
390
|
)
|
|
391
|
+
// A mapping isn't read back here: the foundation's own register is refused, naming the mapping
|
|
392
|
+
// and its library, when the registry doesn't hold it.
|
|
333
393
|
if (held.every(Boolean)) {
|
|
334
|
-
const
|
|
394
|
+
const taken = [...lib.refs, ...(lib.mappings || [])]
|
|
395
|
+
const one = taken.length === 1
|
|
335
396
|
info(
|
|
336
|
-
`${
|
|
397
|
+
`${taken.join(', ')} ${one ? 'is' : 'are'} registered under ${lib.scope}, whose members change ${one ? 'it' : 'them'}: the foundation is released against ${one ? 'it' : 'them'} as registered.`
|
|
337
398
|
)
|
|
338
399
|
return { names: [], body: null }
|
|
339
400
|
}
|
|
@@ -837,17 +898,20 @@ async function runRegister(args = []) {
|
|
|
837
898
|
// the package's own schemas; the foundation path reads its built schema.json.
|
|
838
899
|
let schema = null
|
|
839
900
|
let schemas = null
|
|
901
|
+
let mappings = null
|
|
840
902
|
if (standalone) {
|
|
841
903
|
try {
|
|
842
904
|
schemas = await collectStandaloneSchemas(targetDir)
|
|
905
|
+
// A library's mappings, beside its types (`mappings/`): registered with them, after them.
|
|
906
|
+
mappings = await buildMappingMap(targetDir, { ownTypes: Object.keys(schemas || {}), shownIn: 'mappings' })
|
|
843
907
|
} catch (err) {
|
|
844
908
|
error(`Could not read the schemas package: ${err.message}`)
|
|
845
909
|
return { exitCode: 2 }
|
|
846
910
|
}
|
|
847
|
-
if (!schemas || Object.keys(schemas).length === 0) {
|
|
848
|
-
error('No data schemas found in this package.')
|
|
911
|
+
if ((!schemas || Object.keys(schemas).length === 0) && Object.keys(mappings || {}).length === 0) {
|
|
912
|
+
error('No data schemas or mappings found in this package.')
|
|
849
913
|
log(
|
|
850
|
-
` ${colors.dim}Expected a package that exports schemas (getSchema / schemas), or a schemas/ directory of *.yml files.${colors.reset}`
|
|
914
|
+
` ${colors.dim}Expected a package that exports schemas (getSchema / schemas), or a schemas/ or mappings/ directory of *.yml files.${colors.reset}`
|
|
851
915
|
)
|
|
852
916
|
return { exitCode: 2 }
|
|
853
917
|
}
|
|
@@ -923,7 +987,11 @@ async function runRegister(args = []) {
|
|
|
923
987
|
let fromLibraries = []
|
|
924
988
|
if (!standalone) {
|
|
925
989
|
try {
|
|
926
|
-
fromLibraries = await typesFromLibraries({
|
|
990
|
+
fromLibraries = await typesFromLibraries({
|
|
991
|
+
schemas: schema?.dataSchemas || {},
|
|
992
|
+
mappings: schema?._mappings || {},
|
|
993
|
+
foundationDir: targetDir
|
|
994
|
+
})
|
|
927
995
|
} catch (err) {
|
|
928
996
|
// ⛔ Said, never silent: a build too old to tell which library defines a type registers none,
|
|
929
997
|
// and the registry then refuses the foundation for it.
|
|
@@ -981,7 +1049,7 @@ async function runRegister(args = []) {
|
|
|
981
1049
|
let doc
|
|
982
1050
|
try {
|
|
983
1051
|
doc = standalone
|
|
984
|
-
? buildSchemaOnlyPackage({ schemas, scope, exporter })
|
|
1052
|
+
? buildSchemaOnlyPackage({ schemas, mappings, scope, exporter })
|
|
985
1053
|
: buildRegistryPackage({
|
|
986
1054
|
schema,
|
|
987
1055
|
foundationDir: targetDir,
|
|
@@ -1012,9 +1080,17 @@ async function runRegister(args = []) {
|
|
|
1012
1080
|
log(
|
|
1013
1081
|
` ${colors.dim}data schemas ${standalone ? 'registered' : 'defined'}: ${defined.length ? defined.join(', ') : '(none)'}${colors.reset}`
|
|
1014
1082
|
)
|
|
1083
|
+
const definedMappings = doc.entities.filter((e) => e.model === '@uniweb/mapping-schema').map((e) => e.name)
|
|
1084
|
+
if (definedMappings.length) {
|
|
1085
|
+
log(` ${colors.dim}mappings ${standalone ? 'registered' : 'defined'}: ${definedMappings.join(', ')}${colors.reset}`)
|
|
1086
|
+
}
|
|
1015
1087
|
for (const lib of fromLibraries) {
|
|
1088
|
+
const taken = [
|
|
1089
|
+
lib.refs.length && `data schemas ${lib.refs.join(', ')}`,
|
|
1090
|
+
(lib.mappings || []).length && `mappings ${lib.mappings.join(', ')}`
|
|
1091
|
+
].filter(Boolean).join('; ')
|
|
1016
1092
|
log(
|
|
1017
|
-
` ${colors.dim}
|
|
1093
|
+
` ${colors.dim}from ${shownAt(lib.dir)}: ${taken} — ${isPreview ? 'would be registered' : 'registered'} from there first${colors.reset}`
|
|
1018
1094
|
)
|
|
1019
1095
|
}
|
|
1020
1096
|
if (scope)
|
|
@@ -1141,7 +1217,7 @@ async function runRegister(args = []) {
|
|
|
1141
1217
|
if (!alreadyRegistered) {
|
|
1142
1218
|
success(
|
|
1143
1219
|
standalone
|
|
1144
|
-
? `Registered ${defined.length} data schema(s)${scope ? ` under ${scope}` : ''}`
|
|
1220
|
+
? `Registered ${[defined.length && `${defined.length} data schema(s)`, definedMappings.length && `${definedMappings.length} mapping(s)`].filter(Boolean).join(' and ')}${scope ? ` under ${scope}` : ''}`
|
|
1145
1221
|
: `Registered ${registeredName}@${schema._self.version}${defined.length ? ` + ${defined.length} data schema(s)` : ''}`
|
|
1146
1222
|
)
|
|
1147
1223
|
}
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-11T22:21:29.972Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.7.0"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.23.1"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.10"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"version": "1.2.17"
|
|
37
37
|
},
|
|
38
38
|
"@uniweb/runtime": {
|
|
39
|
-
"version": "1.6.
|
|
39
|
+
"version": "1.6.3"
|
|
40
40
|
},
|
|
41
41
|
"@uniweb/scene": {
|
|
42
42
|
"version": "1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"@uniweb/schemas": {
|
|
45
|
-
"version": "1.7.
|
|
45
|
+
"version": "1.7.2"
|
|
46
46
|
},
|
|
47
47
|
"@uniweb/scholar": {
|
|
48
48
|
"version": "1.1.2"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"version": "1.3.2"
|
|
61
61
|
},
|
|
62
62
|
"@uniweb/unipress": {
|
|
63
|
-
"version": "1.1.
|
|
63
|
+
"version": "1.1.40"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"templates": {
|
|
@@ -91,12 +91,13 @@ export async function guardEmptyRecords({ siteDir, backend, args = [], warn, not
|
|
|
91
91
|
/**
|
|
92
92
|
* Say when a push leaves the backend's folder as it is although it holds records.
|
|
93
93
|
*
|
|
94
|
-
* A records directory that holds files but no records —
|
|
95
|
-
* folder, by design (`sendsFolder` in `@uniweb/build`): that is not an author
|
|
96
|
-
* author who has just taken the records out and kept such files expects them
|
|
97
|
-
* backend, and the push said nothing (2026-10-29: a gallery's records moving to
|
|
98
|
-
*
|
|
99
|
-
* push or pull, say they stay,
|
|
94
|
+
* A records directory that holds files but no records — files the walk does not read as records,
|
|
95
|
+
* say — states no folder, by design (`sendsFolder` in `@uniweb/build`): that is not an author
|
|
96
|
+
* emptying it. But an author who has just taken the records out and kept such files expects them
|
|
97
|
+
* gone from the backend, and the push said nothing (2026-10-29: a gallery's records moving to
|
|
98
|
+
* another schema, articles with no data schema left beside them, which a push refuses since
|
|
99
|
+
* 2026-11-11). So where this copy holds placements from an earlier push or pull, say they stay,
|
|
100
|
+
* and how they would go.
|
|
100
101
|
*
|
|
101
102
|
* @param {object} params
|
|
102
103
|
* @param {object} params.pkg - what `emitSyncPackages` returned; `sendsFolder: false` is the case
|
|
@@ -100,6 +100,9 @@ export default function Hero({ content }) {
|
|
|
100
100
|
`text-heading` and `text-body` are theme tokens. A site's `theme.yml` sets their colors, so one
|
|
101
101
|
component works in light and dark sections, and on every site that uses it.
|
|
102
102
|
|
|
103
|
+
Every site also gives AI assistants something to read: an `llms.txt` index and a Markdown copy of
|
|
104
|
+
each page, on Uniweb hosting and in every static build.
|
|
105
|
+
|
|
103
106
|
## The project and the Uniweb app
|
|
104
107
|
|
|
105
108
|
A publish brings the site into the app, and so does a push, which sends it as a draft without
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report queries publishing without a data schema.
|
|
3
|
-
*
|
|
4
|
-
* ⭐ This is a PRODUCT decision the author is making, usually without knowing:
|
|
5
|
-
* entities or static files. It is reported at warn level for that reason — the
|
|
6
|
-
* producer deliberately emits a structured entry rather than a prose warning so
|
|
7
|
-
* this can say what the trade actually is.
|
|
8
|
-
*
|
|
9
|
-
* The old line said `"… — not synced"`, dim, among everything else. The data IS
|
|
10
|
-
* delivered (as static files), so that read as "my data did not upload" to
|
|
11
|
-
* anyone who did not skim past it. Neither reading tells an author what they
|
|
12
|
-
* gave up or how to get it back.
|
|
13
|
-
*
|
|
14
|
-
* @param {Array<{name: string, model?: string}>} schemaless
|
|
15
|
-
* @param {{ warn: (m: string) => void, dim: (m: string) => void }} out
|
|
16
|
-
*/
|
|
17
|
-
export function reportSchemalessQueries(schemaless, out) {
|
|
18
|
-
if (!schemaless?.length) return
|
|
19
|
-
const names = schemaless.map((c) => c.name)
|
|
20
|
-
const label = names.length === 1 ? 'query' : 'queries'
|
|
21
|
-
out.warn(
|
|
22
|
-
`${names.length} ${label} shipping as STATIC FILES, not entities: ${names.join(', ')}`
|
|
23
|
-
)
|
|
24
|
-
out.dim('No queries, no editor, no detail projection — and a republish to change the data.')
|
|
25
|
-
out.dim(
|
|
26
|
-
`Declare a data schema to get entities. Each resolves its schema by subfolder name (${schemaless
|
|
27
|
-
.map((c) => `${c.name} → ${c.model || c.name}`)
|
|
28
|
-
.join(', ')}), or set \`schema:\` on the query.`
|
|
29
|
-
)
|
|
30
|
-
}
|