@protobase/cli 0.107.2 → 0.108.0

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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.107.2";
2
+ var version = "0.108.0";
3
3
  //#endregion
4
4
  export { version };
@@ -1,7 +1,7 @@
1
1
  import { addAppRoleToOwners, addEveryUser, addMember, createOrganization, listOrganizations, removeMember, setMemberRoles } from "@protobase/server";
2
2
  //#region src/organizations/api.ts
3
3
  const organizationsApi = (auth) => ({
4
- listOrganizations: () => listOrganizations(auth),
4
+ listOrganizations: (after) => listOrganizations(auth, after && { after }),
5
5
  createOrganization: (input) => createOrganization(auth, input),
6
6
  addMember: (input) => addMember(auth, input),
7
7
  setMemberRoles: (input) => setMemberRoles(auth, input),
@@ -4,14 +4,18 @@ const slugOf = (name) => name.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerC
4
4
  /** `a,b` as a list of roles; an empty text is none. */
5
5
  const parseRoleList = (text) => text === void 0 ? void 0 : text.split(",").map((name) => name.trim()).filter(Boolean);
6
6
  const listOrganizationsCommand = async (api, out) => {
7
- const organizations = await api.listOrganizations();
8
- if (organizations.length === 0) {
7
+ let page = await api.listOrganizations();
8
+ if (page.organizations.length === 0) {
9
9
  out("No organizations yet. Create one with: protobase organizations create \"Acme\" --owner you@example.com\n");
10
10
  return;
11
11
  }
12
- for (const organization of organizations) {
13
- out(`${organization.slug} ${organization.name} (${organization.id})\n`);
14
- for (const member of organization.members) out(` ${member.email} ${member.role}${member.appRoles.length > 0 ? ` ${member.appRoles.join(",")}` : ""}\n`);
12
+ for (;;) {
13
+ for (const organization of page.organizations) {
14
+ out(`${organization.slug} ${organization.name} (${organization.id})\n`);
15
+ for (const member of organization.members) out(` ${member.email} ${member.role}${member.appRoles.length > 0 ? ` ${member.appRoles.join(",")}` : ""}\n`);
16
+ }
17
+ if (!page.next) return;
18
+ page = await api.listOrganizations(page.next);
15
19
  }
16
20
  };
17
21
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.107.2",
3
+ "version": "0.108.0",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.107.2",
47
- "@protobase/layout": "0.107.2",
48
- "@protobase/query": "0.107.2",
49
- "@protobase/schema": "0.107.2",
50
- "@protobase/server": "0.107.2",
51
- "@protobase/ui": "0.107.2",
52
- "@protobase/workflows": "0.107.2",
46
+ "@protobase/config": "0.108.0",
47
+ "@protobase/layout": "0.108.0",
48
+ "@protobase/query": "0.108.0",
49
+ "@protobase/schema": "0.108.0",
50
+ "@protobase/server": "0.108.0",
51
+ "@protobase/ui": "0.108.0",
52
+ "@protobase/workflows": "0.108.0",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -749,7 +749,7 @@ await createOrganization(auth, { name, slug, owner: email, id? })
749
749
  await addMember(auth, { organization, email, role?, appRoles? }) // role: owner, admin or member (default)
750
750
  await setMemberRoles(auth, { organization, email, role?, appRoles? })
751
751
  await removeMember(auth, { organization, email }) // refuses the last owner
752
- await listOrganizations(auth) // oldest first, with members' emails and roles
752
+ await listOrganizations(auth, { after?, size? }) // a page, oldest first: { organizations: [{ id, name, slug, members }], next? }
753
753
  await addAppRoleToOwners(auth, appRole) // a role the project added later, to every owner
754
754
  ```
755
755