@fluid-app/fluid-cli-member-site 0.1.29 → 0.1.31

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 CHANGED
@@ -38,20 +38,23 @@ which it is with `--as member` or `--as admin`, and a site of the other owner
38
38
  kind is refused before any request, with the login it needs. Without `--as`,
39
39
  the server decides, and a refusal names the login the site needs.
40
40
 
41
- `fluid login` signs in admins and reps. An admin who is also a rep of the same
42
- company builds both kinds of site after one normal `fluid login`: `--as admin`
43
- builds company sites with the admin session, and `--as member` builds the
44
- admin's own member sites with a rep session that the identity service narrows
45
- the same login to, with no second sign-in. The identity service issues that
46
- rep session only to a person who is a rep in the company. An admin who is not
47
- one gets "You are not a rep at <company>, so you cannot build a member site
48
- there. Use --as admin for company sites." before any member API request.
49
-
50
- Only a login made through the identity service can be narrowed. A legacy login,
51
- and a token set in `FLUID_TOKEN`, are sent as they are for `--as member` too,
52
- so an admin on a legacy login is still refused by the member API and builds
53
- company sites only. A member signs in to this command with the member's own
54
- token, set in `FLUID_TOKEN`.
41
+ `fluid login` signs in admins and reps, and either login builds member sites.
42
+ A rep's login writes to the member API as that rep. An admin who is also a rep
43
+ of the same company builds both kinds of site after one normal `fluid login`:
44
+ `--as admin` builds company sites, and `--as member` builds the admin's own
45
+ member sites, acting as that person's own rep membership, with no second
46
+ sign-in. On a company on the identity service the CLI narrows the login to a
47
+ rep session; on the legacy sign-in the member API accepts the admin's login for
48
+ that person's own rep membership.
49
+
50
+ An admin who is not a rep of the company has no member sites there. On the
51
+ identity service the CLI says "You are not a rep at <company>, so you cannot
52
+ build a member site there. Use --as admin for company sites." before any
53
+ request; on the legacy sign-in the member API refuses the login. A token set in
54
+ `FLUID_TOKEN` is sent as it is: an admin's opaque admin token is refused by the
55
+ member API, while an admin's legacy login JWT acts only for that person's own
56
+ rep membership, as `fluid login` does. A member who is not a rep signs in to
57
+ this command with the member's own token, set in `FLUID_TOKEN`.
55
58
 
56
59
  ## Commands
57
60
 
@@ -107,8 +110,9 @@ rileys-shop/
107
110
  page is `pages/index.liquid`.
108
111
  - `config/access.json` is the site's declaration of the viewer data it uses and
109
112
  the actions it takes as the viewer: `{ "uses": ["member.email", "orders: read"] }`.
110
- A member site has it once it has a draft declaration, and a company site never
111
- does. It is a draft until the site is published.
113
+ A site has it once it has a draft declaration, whoever owns the site: a company
114
+ site's is written with an admin login that may change themes. It is a draft
115
+ until the site is published.
112
116
  - `config/pages.json` holds the site's default `layout` and, for each page, its
113
117
  `slug`, `title`, `position`, `published`, `layout` and `menu` (the menu's
114
118
  slug). It holds no page content, which is in `pages/<slug>.liquid`. A page
@@ -173,8 +177,7 @@ What it sends, in this order:
173
177
  2. Each changed or new layout, section, snippet and asset, and `config/access.json`
174
178
  (`PUT files/:path`), in path order, so the declaration goes ahead of the
175
179
  layouts. A changed file carries its recorded `version`; a new one carries
176
- `must_not_exist`. On a company site the push leaves `config/access.json`
177
- alone and says so, as the server refuses the path.
180
+ `must_not_exist`. A company site's `config/access.json` is pushed the same way.
178
181
  3. Each new page (`POST pages`) with its file's content, then each changed page
179
182
  (`PATCH pages/:id`) with the changed row fields and the changed content, each
180
183
  with the page's `lock_version`.
package/dist/index.mjs CHANGED
@@ -1791,10 +1791,6 @@ function isPlainFile(path) {
1791
1791
  const kind = classifyPath(path).kind;
1792
1792
  return kind === "layout" || kind === "section" || kind === "snippet" || kind === "asset" || kind === "access";
1793
1793
  }
1794
- /** A company site takes no declaration and the server refuses the path, so a push leaves it alone. */
1795
- function skipsAccess(binding, path) {
1796
- return binding.owner_kind === "company" && path === "config/access.json";
1797
- }
1798
1794
  function isRecord(value) {
1799
1795
  return typeof value === "object" && value !== null && !Array.isArray(value);
1800
1796
  }
@@ -2177,10 +2173,6 @@ function planPush(binding, tree) {
2177
2173
  }
2178
2174
  for (const [path, text] of [...tree.files].sort(([a], [b]) => a < b ? -1 : 1)) {
2179
2175
  if (!isPlainFile(path)) continue;
2180
- if (skipsAccess(binding, path)) {
2181
- plan.notes.push(`${path} is not pushed: a company site takes no access declaration.`);
2182
- continue;
2183
- }
2184
2176
  const bound = binding.files[path];
2185
2177
  if (!changed(text, bound?.sha256)) continue;
2186
2178
  if (path === "config/access.json") {
@@ -2212,7 +2204,6 @@ function planPush(binding, tree) {
2212
2204
  }
2213
2205
  for (const path of Object.keys(binding.files).sort()) {
2214
2206
  if (!isPlainFile(path) || tree.files.has(path)) continue;
2215
- if (skipsAccess(binding, path)) continue;
2216
2207
  const bound = binding.files[path];
2217
2208
  if (bound.version === void 0) {
2218
2209
  plan.refusals.push(noVersion(path));