uniweb 1.35.1 → 1.35.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "1.35.1",
3
+ "version": "1.35.2",
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/schemas": "~1.7.4",
45
- "@uniweb/semantic-parser": "~1.13.5",
46
44
  "@uniweb/core": "~1.6.13",
47
- "@uniweb/content-writer": "~1.3.2"
45
+ "@uniweb/semantic-parser": "~1.13.5",
46
+ "@uniweb/content-writer": "~1.3.2",
47
+ "@uniweb/schemas": "~1.7.4"
48
48
  },
49
49
  "peerDependencies": {
50
+ "@uniweb/build": "~1.24.1",
50
51
  "@uniweb/semantic-parser": "~1.13.5",
51
- "@uniweb/content-reader": "~1.5.11",
52
- "@uniweb/build": "~1.24.0"
52
+ "@uniweb/content-reader": "~1.5.11"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@uniweb/build": {
@@ -218,6 +218,8 @@ await createEntity({ schema: '@/submission', unit: course.unit, items: [...] })
218
218
 
219
219
  Nested items in one create: give an item `uuid: uuidv7()` and a later item names it as `parent` (`{ section: 'degrees/thesis', parent: degree, data }`); those uuids serve the write alone.
220
220
 
221
+ **Sent twice, made once:** give a create the new entry's own `uuid`, made once when the person starts adding it (`const [uuid] = useState(uuidv7)`), and a second click or a retry answers with the entry the first one made. Without it, each call makes an entry.
222
+
221
223
  ## A backend on your machine
222
224
 
223
225
  ```yaml
@@ -6,6 +6,7 @@ On-demand guide (`uniweb guide promote`); AGENTS.md is assumed read. For a site
6
6
 
7
7
  - **The person** connects each account at its network, in a browser signed in to the app; you hand them the address `uniweb promote connect <network>` prints. They turn on the site's Analytics, which carries Promote, in the app. They reconnect an account that needs it, and an admin hands on one whose person left. They decide what goes out and what is spent.
8
8
  - **You** draft posts and campaigns, check the pages they link to, send and start what your person agreed to, and read what it brought. You act with their session, at the access they have; an account's tokens never pass through the CLI.
9
+ - **Access follows the site's.** Reading and drafting take edit on the site; sending, scheduling, starting, pausing and resuming take admin. Someone who can only view the site sees none of its Promote.
9
10
 
10
11
  ## On one screen
11
12
 
@@ -203,7 +203,7 @@ async function targetSite(args, client, verb) {
203
203
  * @param {{ site: string, origin: string, what: string, index?: object }} ctx - `what` completes
204
204
  * "You may not …"; `index` names a campaign a refusal names by uuid
205
205
  */
206
- async function sayRefusal(res, { site, origin, what, index = null, notFound = null }) {
206
+ async function sayRefusal(res, { site, origin, what, index = null, notFound = null, forbidden = null }) {
207
207
  const body = await res.clone().json().catch(() => null)
208
208
  const reason = typeof body?.reason === 'string' ? body.reason : null
209
209
  const own = [reason, body?.detail ?? body?.message ?? body?.title].filter((x) => typeof x === 'string' && x).join(': ')
@@ -215,6 +215,8 @@ async function sayRefusal(res, { site, origin, what, index = null, notFound = nu
215
215
  say.err(`Only an admin of the site may ${what}. What is written stays, for one of them to do it.`)
216
216
  } else if (res.status === 403 && body?.op === 'edit' && body?.target) {
217
217
  say.err(`The account it goes out through is not shared with you for that. Use one you can use, or ask whoever connected it to share it.`)
218
+ } else if (res.status === 403 && forbidden) {
219
+ say.err(forbidden)
218
220
  } else if (res.status === 403) {
219
221
  say.err(`You may not ${what} on this site${body?.op ? ` (it takes ${body.op})` : ''}.`)
220
222
  } else if (res.status === 404) {
@@ -235,6 +237,9 @@ async function sayRefusal(res, { site, origin, what, index = null, notFound = nu
235
237
  /** A 404 on reading a site's Promote: no such site there, or a backend without these routes. */
236
238
  const notOffered = (origin, site) => `${origin} has no site ${site}, or does not offer Promote to this CLI yet.`
237
239
 
240
+ /** A 403 on reading it: the site is shared with you to view, and Promote takes edit. */
241
+ const VIEW_ONLY = 'Promote is for those who can edit the site, and you can only view it: an owner or admin of the site can give you edit, in the app.'
242
+
238
243
  /**
239
244
  * The networks the deployment offers to connect, as tokens. None when `/dev/config` names none,
240
245
  * since the backend leaves `promote.networks` out while it offers none; null when `/dev/config`
@@ -353,7 +358,7 @@ async function status(args) {
353
358
  offeredNetworks(client)
354
359
  ])
355
360
  if (!res.ok) {
356
- await sayRefusal(res, { site, origin: client.origin, what: 'read Promote', notFound: notOffered(client.origin, site) })
361
+ await sayRefusal(res, { site, origin: client.origin, what: 'read Promote', notFound: notOffered(client.origin, site), forbidden: VIEW_ONLY })
357
362
  return { exitCode: 1 }
358
363
  }
359
364
  const promotion = (await res.json().catch(() => null))?.promotion ?? null
@@ -722,7 +727,7 @@ async function begin(args, command, verb) {
722
727
  async function readIndex(client, site) {
723
728
  const res = await client.readPromotion(site)
724
729
  if (!res.ok) {
725
- await sayRefusal(res, { site, origin: client.origin, what: 'read Promote', notFound: notOffered(client.origin, site) })
730
+ await sayRefusal(res, { site, origin: client.origin, what: 'read Promote', notFound: notOffered(client.origin, site), forbidden: VIEW_ONLY })
726
731
  return null
727
732
  }
728
733
  return indexPromotion((await res.json().catch(() => null))?.promotion ?? null)
@@ -869,7 +869,8 @@ async function appChecks(siteDir, siteYml, { offline, args, git }) {
869
869
  * @param {Response|null} res - the promotion read, made beside the site's other reads
870
870
  */
871
871
  async function promoteChecks(client, uuid, res, { now = Date.now() } = {}) {
872
- if (!res || res.status === 404) return { checks: [], proposals: [] }
872
+ // A 403 is someone who can only view the site: Promote is shown to those who can edit it.
873
+ if (!res || res.status === 404 || res.status === 403) return { checks: [], proposals: [] }
873
874
  if (!res.ok) {
874
875
  return { checks: [{ id: 'promote.site', state: 'unknown', summary: `Could not read the site's Promote: HTTP ${res.status}.` }], proposals: [] }
875
876
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-16T19:23:17.851Z",
3
+ "generatedAt": "2026-11-16T23:13:17.578Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
- "version": "1.7.1"
6
+ "version": "1.7.2"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.24.0"
9
+ "version": "1.24.1"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
12
  "version": "1.5.11"