@book.dev/sdk 1.60.0 → 1.65.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.
Files changed (49) hide show
  1. package/dist/account.d.ts +11 -0
  2. package/dist/account.js +27 -0
  3. package/dist/account.js.map +1 -1
  4. package/dist/ai.d.ts +10 -0
  5. package/dist/ai.js +12 -0
  6. package/dist/ai.js.map +1 -1
  7. package/dist/authorize.d.ts +104 -0
  8. package/dist/authorize.js +151 -0
  9. package/dist/authorize.js.map +1 -0
  10. package/dist/authors.d.ts +26 -0
  11. package/dist/authors.js +81 -0
  12. package/dist/authors.js.map +1 -0
  13. package/dist/backup.d.ts +46 -0
  14. package/dist/backup.js +15 -0
  15. package/dist/backup.js.map +1 -1
  16. package/dist/client.d.ts +124 -3
  17. package/dist/client.js +113 -10
  18. package/dist/client.js.map +1 -1
  19. package/dist/connection.d.ts +23 -0
  20. package/dist/connection.js +56 -0
  21. package/dist/connection.js.map +1 -1
  22. package/dist/forwarding/index.d.ts +2 -1
  23. package/dist/forwarding/index.js +2 -1
  24. package/dist/forwarding/index.js.map +1 -1
  25. package/dist/forwarding/rosterAssertion.d.ts +49 -0
  26. package/dist/forwarding/rosterAssertion.js +89 -0
  27. package/dist/forwarding/rosterAssertion.js.map +1 -0
  28. package/dist/forwarding/tunnelClient.js +11 -1
  29. package/dist/forwarding/tunnelClient.js.map +1 -1
  30. package/dist/forwarding/tunnelProtocol.d.ts +11 -0
  31. package/dist/forwarding/tunnelProtocol.js +11 -0
  32. package/dist/forwarding/tunnelProtocol.js.map +1 -1
  33. package/dist/identity.d.ts +238 -0
  34. package/dist/identity.js +273 -0
  35. package/dist/identity.js.map +1 -0
  36. package/dist/index.d.ts +13 -9
  37. package/dist/index.js +9 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/provenance.d.ts +168 -0
  40. package/dist/provenance.js +31 -0
  41. package/dist/provenance.js.map +1 -0
  42. package/dist/routes.d.ts +53 -0
  43. package/dist/routes.js +50 -0
  44. package/dist/routes.js.map +1 -1
  45. package/dist/suggestions.d.ts +17 -2
  46. package/dist/types.d.ts +100 -0
  47. package/dist/types.js +9 -0
  48. package/dist/types.js.map +1 -1
  49. package/package.json +6 -1
package/dist/routes.js CHANGED
@@ -85,5 +85,55 @@ export const API = {
85
85
  comments: (pageId) => `/api/pages/${encodeURIComponent(pageId)}/comments`,
86
86
  /** A single comment: `DELETE`. */
87
87
  comment: (id) => `/api/comments/${encodeURIComponent(id)}`,
88
+ /**
89
+ * On-demand heavy database compaction (`POST`): VACUUM FULL to physically
90
+ * reclaim heap bloat. Embedded (PGlite) only — a server backed by external
91
+ * Postgres answers 409. See OB-164.
92
+ */
93
+ compact: '/api/maintenance/compact',
94
+ // ── Multi-user (identity, policy, provenance) — OB-165 ───────────────────────
95
+ /**
96
+ * Instance multi-user policy: `GET` returns {@link InstanceInfo} (guest
97
+ * policy, trusted issuer URLs, and the principal resolved for *this* request);
98
+ * `PUT` updates the policy (owner only).
99
+ */
100
+ instance: '/api/instance',
101
+ /** A page's change provenance (the edit log), newest first: `GET`. */
102
+ pageEdits: (id) => `/api/pages/${encodeURIComponent(id)}/edits`,
103
+ // ── Sharing: roster invites + per-page ACL — OB-191 ──────────────────────────
104
+ /**
105
+ * The member roster: `GET` (list) / `POST` (invite by email or handle/subject).
106
+ * Instance-writer (owner/admin/loopback) only — managing or even seeing the
107
+ * roster is a privileged action.
108
+ */
109
+ members: '/api/members',
110
+ /** A single roster row: `PATCH` (role/status) / `DELETE` (revoke). */
111
+ member: (id) => `/api/members/${encodeURIComponent(id)}`,
112
+ /**
113
+ * A page's per-page ACL grants: `GET` (list) / `POST` (share to an email or
114
+ * handle/subject) / `DELETE` (`?subject=` | `?email=` to revoke). Gated on
115
+ * write of the page itself (you manage sharing of pages you can write).
116
+ */
117
+ pageAcl: (id) => `/api/pages/${encodeURIComponent(id)}/acl`,
118
+ /**
119
+ * A page's audience-scope visibility (OB-182 §1.1): `GET` returns
120
+ * `{visibility}` (read-gated); `PUT` `{visibility}` sets it (write-gated — same
121
+ * "you manage sharing of pages you can write" rule as the ACL).
122
+ */
123
+ pageVisibility: (id) => `/api/pages/${encodeURIComponent(id)}/visibility`,
124
+ // ── Managed workspace: instance ↔ workspace roster sync — OB-199 ─────────────
125
+ /**
126
+ * On-demand roster sync of a managed instance: `GET` reports the binding +
127
+ * last-sync status; `POST` pulls the bound workspace roster from the account and
128
+ * reconciles it into the local roster (managed rows only). Instance-writer
129
+ * (owner/admin/loopback) only. The same sync also runs periodically.
130
+ */
131
+ workspaceSync: '/api/workspace/sync',
132
+ // ── Scheduled backups — OB-166 ───────────────────────────────────────────────
133
+ /** Scheduled-backup policy: `GET` returns {@link BackupStatus}; `PUT` updates
134
+ * the policy and returns the new status. */
135
+ backups: '/api/backups',
136
+ /** Run a backup immediately: `POST` `{cadence?}` → the written file's name. */
137
+ backupRun: '/api/backups/run',
88
138
  };
89
139
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,MAAM,EAAE,SAAS;IACjB,kDAAkD;IAClD,KAAK,EAAE,YAAY;IACnB,oFAAoF;IACpF,IAAI,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,EAAE;IACpE,wFAAwF;IACxF,cAAc,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,aAAa;IACzF,+DAA+D;IAC/D,aAAa,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,YAAY;IACvF,wEAAwE;IACxE,WAAW,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,UAAU;IACnF,qFAAqF;IACrF,QAAQ,EAA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B,kBAAkB,CAAC,EAAE,CAAC,EAAE;IAChF,mGAAmG;IACnG,QAAQ,EAAE,CAAC,MAAc,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,MAAM,CAAC,WAAW;IACzF,kCAAkC;IAClC,OAAO,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE;IAE1E;;;;OAIG;IACH,OAAO,EAAE,0BAA0B;IAEnC,gFAAgF;IAChF;;;;OAIG;IACH,QAAQ,EAAE,eAAe;IACzB,sEAAsE;IACtE,SAAS,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,QAAQ;IAE/E,gFAAgF;IAChF;;;;OAIG;IACH,OAAO,EAAE,cAAc;IACvB,sEAAsE;IACtE,MAAM,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE;IACxE;;;;OAIG;IACH,OAAO,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,MAAM;IAC3E;;;;OAIG;IACH,cAAc,EAAE,CAAC,EAAU,EAAU,EAAE,CAAC,cAAc,kBAAkB,CAAC,EAAE,CAAC,aAAa;IAEzF,gFAAgF;IAChF;;;;;OAKG;IACH,aAAa,EAAE,qBAAqB;IAEpC,gFAAgF;IAChF;iDAC6C;IAC7C,OAAO,EAAE,cAAc;IACvB,+EAA+E;IAC/E,SAAS,EAAE,kBAAkB;CACrB,CAAC"}
@@ -34,8 +34,23 @@ export interface CommentRun {
34
34
  a?: string;
35
35
  };
36
36
  }
37
+ import type { VerifiedVia } from './identity';
37
38
  /** Who authored a suggestion or comment. */
38
39
  export type SuggestionAuthorKind = 'ai' | 'human';
40
+ /**
41
+ * Server-stamped author identity (OB-165) carried alongside the display
42
+ * `authorName`. Unlike `authorName` (a label the client supplies), these come
43
+ * from the request's *verified* principal, so they're the authoritative "who".
44
+ * Absent on rows written before multi-user, or by an unauthenticated path.
45
+ */
46
+ export interface AuthoredIdentity {
47
+ /** The principal's stable subject (`iss#sub`, or `guest:<name>`). */
48
+ authorSubject?: string;
49
+ /** The issuer that vouched for a verified author (empty for guests). */
50
+ authorIssuer?: string;
51
+ /** How the author was established (`jws` / `guest` / `unverified` / `local`). */
52
+ authorVerified?: VerifiedVia;
53
+ }
39
54
  /** The change a suggestion proposes — mirrors the agent write-tool kinds. */
40
55
  export type SuggestionKind = 'replace-text' | 'set-cell' | 'insert' | 'delete' | 'set-theme';
41
56
  /** Lifecycle of a suggestion. */
@@ -60,7 +75,7 @@ export interface SuggestionTarget {
60
75
  propertyId?: string;
61
76
  }
62
77
  /** A persisted, reviewable proposed change to a page. */
63
- export interface StoredSuggestion {
78
+ export interface StoredSuggestion extends AuthoredIdentity {
64
79
  id: string;
65
80
  pageId: string;
66
81
  authorKind: SuggestionAuthorKind;
@@ -100,7 +115,7 @@ export interface SuggestionUpdate {
100
115
  status?: SuggestionStatus;
101
116
  }
102
117
  /** A threaded comment on a suggestion, or a standalone comment on a block. */
103
- export interface StoredComment {
118
+ export interface StoredComment extends AuthoredIdentity {
104
119
  id: string;
105
120
  pageId: string;
106
121
  /** The suggestion this comment belongs to (a review-thread comment). */
package/dist/types.d.ts CHANGED
@@ -31,6 +31,15 @@ export interface PageSnapshot {
31
31
  * written before the feature shipped (treated as "unknown — assume changed").
32
32
  */
33
33
  mtimes?: Array<[string, string]>;
34
+ /**
35
+ * `[blockId, subject]` pairs — the *verified* author (`iss#sub`) who last
36
+ * changed each block, a sparse map carried with the snapshot so an edit is
37
+ * still correctly attributed after it syncs to another instance (OB-170). The
38
+ * server stamps it on write from the request's verified principal; only
39
+ * verified identities appear (guest/local/unverified edits are not recorded
40
+ * here). Absent on single-user / unverified documents. See sdk `authors.ts`.
41
+ */
42
+ authors?: Array<[string, string]>;
34
43
  }
35
44
  /** An empty snapshot, for initializing a brand-new page. */
36
45
  export declare const emptyPageSnapshot: () => PageSnapshot;
@@ -95,6 +104,97 @@ export interface PageInput {
95
104
  * created; a later content save with the same id leaves the parent untouched.
96
105
  */
97
106
  parentId?: string | null;
107
+ /**
108
+ * Optional client idempotency key for the **create** path (no `id`). A retried/
109
+ * replayed keyless create carrying the same key returns the page the first call
110
+ * minted instead of a duplicate (ER-7). Ignored when `id` is present (an id-bearing
111
+ * upsert is already idempotent via the store's `ON CONFLICT` no-op). Scoped to the
112
+ * server-resolved principal, so one user's key never collides with another's. Not
113
+ * persisted on the page — it only keys the dedup ledger.
114
+ */
115
+ idempotencyKey?: string;
116
+ }
117
+ /**
118
+ * Sharing & access model (OB-188; contract docs/sharing-access-contract-spike-OB-182.md).
119
+ * These are the data-model types behind migration 0011 — the roster row, the
120
+ * per-page ACL row, and the per-page visibility scope. The *authorization* layer
121
+ * (`authorize()` in §1.1) is OB-189 and is intentionally NOT defined here.
122
+ */
123
+ /**
124
+ * Per-page audience scope (OB-182 §1.1). `inherit` resolves up the **parent**
125
+ * chain for an ordinary page (or, for a database row, via the database host page)
126
+ * down to `InstanceConfig.defaultVisibility` at the root. The other four are the
127
+ * fixed audience scopes: `public` (anyone, incl. anonymous), `authenticated` (any
128
+ * signed-in jws user), `members` (active roster members), `restricted`
129
+ * (owner/admin/ACL only).
130
+ */
131
+ export type PageVisibility = 'inherit' | 'public' | 'authenticated' | 'members' | 'restricted';
132
+ /** Alias for {@link PageVisibility} (the OB-188 directive's shorthand name). */
133
+ export type Visibility = PageVisibility;
134
+ /** Every {@link PageVisibility} value, in escalating-privacy order — the source of
135
+ * truth for server-side validation and the share dialog's scope picker. */
136
+ export declare const PAGE_VISIBILITIES: readonly PageVisibility[];
137
+ /** The two OSS roster roles (OB-182): `admin` = full access, `viewer` = locked
138
+ * read-only. (Contract §1.1 names this union `Role`.) */
139
+ export type MemberRole = 'admin' | 'viewer';
140
+ /**
141
+ * Lifecycle of a roster row (OB-182 §2.1). `invited` = an email persona not yet
142
+ * claimed by a signed-in subject; `active` = bound + live; `suspended` = retained
143
+ * but grants nothing. Only `active` rows resolve to a role at request time (S3).
144
+ */
145
+ export type MemberStatus = 'invited' | 'active' | 'suspended';
146
+ /**
147
+ * Where a roster row came from (OB-199). `local` = a locally-issued invite (the
148
+ * OB-191 path); `managed` = projected from the bound account workspace's roster by
149
+ * the periodic sync. The two coexist: the managed sync only ever touches `managed`
150
+ * rows, so a local invite is never clobbered (and vice-versa).
151
+ */
152
+ export type MemberSource = 'local' | 'managed';
153
+ /** Per-page ACL grant level (OB-182 §1.1). */
154
+ export type AclLevel = 'read' | 'write';
155
+ /**
156
+ * One roster row — the data-server-native `members` table (OB-182 §2.1). A row is
157
+ * either an EMAIL PERSONA (`email` set, `subject` NULL until claimed on sign-in)
158
+ * or a SUBJECT/handle MEMBER (`subject` set, `email` NULL). One account `subject`
159
+ * may back several persona rows — one per verified email — each its own member
160
+ * with its own role. `issuer` PINS the email-authority for a persona so a federated
161
+ * issuer can never satisfy an `account.book.pub`-scoped grant (B1).
162
+ */
163
+ export interface Member {
164
+ id: string;
165
+ /** Bound `iss#sub`; `null` until an email persona is claimed. */
166
+ subject: string | null;
167
+ /** Persona email (lowercased); `null` for a subject/handle member. */
168
+ email: string | null;
169
+ /** The pinned email-authority issuer for a persona (B1). */
170
+ issuer: string;
171
+ role: MemberRole;
172
+ status: MemberStatus;
173
+ /**
174
+ * Provenance of the row (OB-199): `local` for a locally-issued invite (OB-191),
175
+ * `managed` for a row projected from the bound workspace roster. Defaults to
176
+ * `local`; the managed sync only ever writes/removes `managed` rows.
177
+ * Optional: absent (a pre-OB-199 row / a test fixture) is treated as `local`.
178
+ */
179
+ source?: MemberSource;
180
+ /** The principal subject that issued the invite, if any. */
181
+ invitedBy: string | null;
182
+ createdAt: string;
183
+ }
184
+ /**
185
+ * One per-page ACL grant — a row of the `page_acl` table (OB-182 §2.3). Exactly
186
+ * one grantee key is set: `subject` (a grantee already bound to any trusted issuer)
187
+ * XOR `email` (a grantee by persona email, lowercased). An email grant MUST pin an
188
+ * `issuer` (the email-authority — B1).
189
+ */
190
+ export interface PageAcl {
191
+ pageId: string;
192
+ subject: string | null;
193
+ email: string | null;
194
+ issuer: string | null;
195
+ level: AclLevel;
196
+ invitedBy: string | null;
197
+ createdAt: string;
98
198
  }
99
199
  /** Status of a desktop install's local server. */
100
200
  export interface ServerInfo {
package/dist/types.js CHANGED
@@ -13,4 +13,13 @@ export const emptyPageSnapshot = () => ({
13
13
  values: [],
14
14
  names: [],
15
15
  });
16
+ /** Every {@link PageVisibility} value, in escalating-privacy order — the source of
17
+ * truth for server-side validation and the share dialog's scope picker. */
18
+ export const PAGE_VISIBILITIES = [
19
+ 'inherit',
20
+ 'public',
21
+ 'authenticated',
22
+ 'members',
23
+ 'restricted',
24
+ ];
16
25
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4BH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAiB,EAAE,CAAC,CAAC;IACpD,QAAQ,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC;IACtB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqCH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAiB,EAAE,CAAC,CAAC;IACpD,QAAQ,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC;IACtB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC,CAAC;AAgGH;4EAC4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,SAAS;IACT,QAAQ;IACR,eAAe;IACf,SAAS;IACT,YAAY;CACb,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@book.dev/sdk",
3
- "version": "1.60.0",
3
+ "version": "1.65.0",
4
4
  "description": "Shared OpenBook types and HTTP client used by the server, desktop, and web.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/eliotlim/OpenBook.git",
8
+ "directory": "packages/sdk"
9
+ },
5
10
  "publishConfig": {
6
11
  "access": "public"
7
12
  },