| … | … | @@ -0,0 +1,45 @@ |
| 1 | # hyper-orgs |
| 2 | |
| 3 | P2P organization management — a `hyper-rooms` schema for orgs, |
| 4 | members, resources (repos/datasets/whatever), grants, invites, and |
| 5 | access requests. |
| 6 | |
| 7 | One Autobase per org (a Room). Members are autobase writers |
| 8 | (role-aware: owner = indexer; writer = plain). Schema validates ops |
| 9 | and applies them to a Hyperbee view keyed by `org:<id>`, |
| 10 | `member:<orgId>:<userId>`, `grant:<orgId>:<resourceId>:<userId>`, etc. |
| 11 | |
| 12 | Used by `pear-git-v3` (the daemon mounts a `HyperOrgs` instance per |
| 13 | identity). |
| 14 | |
| 15 | ## Usage |
| 16 | |
| 17 | ```js |
| 18 | import { HyperOrgs } from 'hyper-orgs' |
| 19 | |
| 20 | const orgs = new HyperOrgs(corestore, { |
| 21 | bootstrapKey: existingOrgsKey || null |
| 22 | }) |
| 23 | await orgs.ready() |
| 24 | |
| 25 | await orgs.createOrg({ id: 'acme', name: 'Acme Inc.', ownerId: alice }) |
| 26 | await orgs.addMember('acme', { userId: bob, role: 'writer' }) |
| 27 | await orgs.grant('acme', { resourceId: 'repo:foo', userId: bob, perm: 'push' }) |
| 28 | ``` |
| 29 | |
| 30 | ## Schema |
| 31 | |
| 32 | See `lib/schema.js` for the full op list. Reserved names guard the |
| 33 | namespace; `validateName` is the canonical name check. |
| 34 | |
| 35 | ## Tests |
| 36 | |
| 37 | ```bash |
| 38 | npm test |
| 39 | ``` |
| 40 | |
| 41 | ## Related |
| 42 | |
| 43 | - `hyper-rooms` — the underlying Room class. |
| 44 | - `pear-git-v3` — primary consumer. |
| 45 | - `hyper-issues` — sibling room schema, same shape. |