@adonis-agora/collaboration 0.9.3 → 0.10.1

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 (57) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/dist/providers/collaboration_provider.d.ts +15 -5
  3. package/dist/providers/collaboration_provider.d.ts.map +1 -1
  4. package/dist/providers/collaboration_provider.js +53 -24
  5. package/dist/providers/collaboration_provider.js.map +1 -1
  6. package/dist/src/auth/token.d.ts +20 -2
  7. package/dist/src/auth/token.d.ts.map +1 -1
  8. package/dist/src/auth/token.js +31 -8
  9. package/dist/src/auth/token.js.map +1 -1
  10. package/dist/src/codegen_init.d.ts.map +1 -1
  11. package/dist/src/codegen_init.js +11 -1
  12. package/dist/src/codegen_init.js.map +1 -1
  13. package/dist/src/collaboration_manager.d.ts.map +1 -1
  14. package/dist/src/collaboration_manager.js +4 -0
  15. package/dist/src/collaboration_manager.js.map +1 -1
  16. package/dist/src/define_config.d.ts +32 -1
  17. package/dist/src/define_config.d.ts.map +1 -1
  18. package/dist/src/define_config.js +6 -0
  19. package/dist/src/define_config.js.map +1 -1
  20. package/dist/src/drivers/automerge/automerge_driver.d.ts +7 -1
  21. package/dist/src/drivers/automerge/automerge_driver.d.ts.map +1 -1
  22. package/dist/src/drivers/automerge/automerge_driver.js +74 -11
  23. package/dist/src/drivers/automerge/automerge_driver.js.map +1 -1
  24. package/dist/src/drivers/yjs/yjs_driver.d.ts +20 -0
  25. package/dist/src/drivers/yjs/yjs_driver.d.ts.map +1 -1
  26. package/dist/src/drivers/yjs/yjs_driver.js +113 -20
  27. package/dist/src/drivers/yjs/yjs_driver.js.map +1 -1
  28. package/dist/src/http/types.d.ts +24 -1
  29. package/dist/src/http/types.d.ts.map +1 -1
  30. package/dist/src/http/types.js.map +1 -1
  31. package/dist/src/index.d.ts +4 -3
  32. package/dist/src/index.d.ts.map +1 -1
  33. package/dist/src/index.js +3 -2
  34. package/dist/src/index.js.map +1 -1
  35. package/dist/src/observability.d.ts +52 -0
  36. package/dist/src/observability.d.ts.map +1 -0
  37. package/dist/src/observability.js +50 -0
  38. package/dist/src/observability.js.map +1 -0
  39. package/dist/src/routes.d.ts +35 -5
  40. package/dist/src/routes.d.ts.map +1 -1
  41. package/dist/src/routes.js +117 -26
  42. package/dist/src/routes.js.map +1 -1
  43. package/dist/src/services/comment_service.d.ts +9 -0
  44. package/dist/src/services/comment_service.d.ts.map +1 -1
  45. package/dist/src/services/comment_service.js +17 -4
  46. package/dist/src/services/comment_service.js.map +1 -1
  47. package/dist/src/storage/lucid_storage.d.ts +7 -0
  48. package/dist/src/storage/lucid_storage.d.ts.map +1 -1
  49. package/dist/src/storage/lucid_storage.js +34 -11
  50. package/dist/src/storage/lucid_storage.js.map +1 -1
  51. package/dist/src/types.d.ts +14 -4
  52. package/dist/src/types.d.ts.map +1 -1
  53. package/dist/src/versioning.d.ts +6 -0
  54. package/dist/src/versioning.d.ts.map +1 -1
  55. package/dist/src/versioning.js +10 -0
  56. package/dist/src/versioning.js.map +1 -1
  57. package/package.json +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,155 @@
1
1
  # @adonis-agora/collaboration
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1ac1a30: The Yjs WebSocket never reached Hocuspocus: `attach()` opened sockets nobody listened to
8
+
9
+ `@hocuspocus/server` 4 does not listen on the socket it is given. `handleConnection` takes a
10
+ `WebSocketLike` — `send`, `close`, `readyState`, no events — and returns a `ClientConnection`
11
+ that the integrator has to feed with `handleMessage` and `handleClose`, which is exactly what
12
+ the package's own `Server` does through its crossws hooks. The Yjs driver called
13
+ `handleConnection` and dropped the return value.
14
+
15
+ What that looked like from outside: the upgrade succeeded, the client reported `connected`, sent
16
+ Auth + SyncStep1 + Awareness, and nothing ever came back — with a valid token or a bogus one.
17
+ The server never ran `onAuthenticate`, never loaded a document, never stored one; a
18
+ `createVersion` from the REST side found no live document and snapshotted an empty one. An app
19
+ that "worked" this way for weeks had an empty `collab_documents` table and a history made of
20
+ 2-byte versions, while every editor opened blank on top of the text the app had saved elsewhere.
21
+
22
+ `attach()` now wires the three hooks. A new test drives the real path — node HTTP server, the
23
+ driver's upgrade handler, the same `HocuspocusProvider` a browser uses — and checks that the
24
+ client syncs, that what it types reaches the live document and the storage, that a version is
25
+ no longer 2 bytes, and that a bad token gets the socket closed instead of left hanging. Socket
26
+ errors are reported through `reportCollaborationError` under the new `transport` scope.
27
+
28
+ - 88c3e5e: Say what ships out of the box, and stop forcing Excalidraw on apps that never render it
29
+
30
+ `@excalidraw/excalidraw` was declared a **required** peer while `react` was marked optional —
31
+ backwards on both counts. `ExcalidrawBoard` reaches for Excalidraw through a dynamic
32
+ `await import()`, so an app that never renders a board never loads it; meanwhile `DocSession` and
33
+ the REST client are framework-free, which is why `react` is optional and correctly so. Excalidraw
34
+ is now optional too, and an app using this package for Tiptap or plain text installs neither.
35
+
36
+ The docs index gained **What works out of the box** — the four sync engines and where each one's
37
+ socket lives, the three editors with the peer each needs (and why rich text deliberately has no
38
+ adapter), the three storages, and what presence costs. `docs_compile.spec.ts` fails when a shipped
39
+ engine or storage is missing from that table, and parses every page with the compiler the docs site
40
+ uses underneath — an unparseable page took the site's build down once, from a repo that had not
41
+ changed.
42
+
43
+ ## 0.10.0
44
+
45
+ ### Minor Changes
46
+
47
+ - b44c00e: `useAutomergeDoc` reconnects, and two parameters the routes discard are gone
48
+
49
+ **The Automerge hook opened one socket and never rebuilt it.** `ws.onclose` set `status` to
50
+ `'disconnected'` and that was the end of it — the effect's deps (`docName`, `config`,
51
+ `WebSocketImpl`) are all stable, so nothing ever ran again. Meanwhile `change()` went on mutating
52
+ the local document and never sending it: a user typing into a document that had stopped syncing,
53
+ with no state on the hook that could have told them.
54
+
55
+ It now reconnects on the same terms as the Yjs `DocSession`, sharing its vocabulary rather than
56
+ growing a second one — `MAX_RECONNECT_ATTEMPTS`, `isPermanentFailure` and the exhausted-budget error
57
+ are now exported from `session.ts` and used by both. A fresh token per attempt, backoff from 1s
58
+ capped at 15s, five attempts, reset by a connection that opens, and an exhausted budget that keeps
59
+ the last real failure as its `cause`. A **permanent** failure is not retried at all: a `4000` /
60
+ `4001` / `4003` close, or a document the server routes to another engine.
61
+
62
+ **Changes made while disconnected are not dropped.** The protocol exchanges whole documents, so the
63
+ local doc is its own outbox: the change is applied locally, counted, and the whole saved document is
64
+ written the moment a socket is open again. Two new fields on the result make that visible —
65
+ `pendingChanges` (local changes not yet written to the socket) and `synced` (the server's state has
66
+ been merged on the _current_ connection, the Automerge counterpart of the Yjs flag). Disabling the
67
+ editor on a disconnect is no longer the honest thing to do; showing `pendingChanges` is.
68
+
69
+ **Breaking, small:** `userId` is gone from three client signatures, because the routes already
70
+ ignored it in favour of the authenticated caller — `createVersion(config, docName, label)`,
71
+ `createComment(config, input)` and `useComments().create({ space, anchor, body, authorName? })`. It
72
+ was dead on the wire while reading as if it decided who the author was. Drop the argument; nothing
73
+ else changes.
74
+
75
+ **`CommentService.get(docName, commentId)`** is new. Authorizing a comment PATCH or DELETE resolved
76
+ its one comment by listing the document's entire thread and filtering — correct, and O(n) in the
77
+ comments, so the check got slower the longer the discussion got. `CollaborationStorage` gains an
78
+ optional `getComment`, implemented by `LucidStorage` as an indexed single-row query; storages
79
+ without it fall back to the old scan, now behind one call.
80
+
81
+ - b44c00e: Fix route registration, authorize in manual mode, comment permissions, restore semantics, presence wiring and failure visibility.
82
+
83
+ **Route registration phase (behaviour change).** The provider registered the built-in REST routes in
84
+ `ready()`, which runs _after_ `Server.boot()` has called `router.commit()` — the router drains its
85
+ pending list there and refuses everything later, so the auto-registered `/collaboration/*` endpoints
86
+ were silently orphaned and answered `404` in a served build while looking perfectly configured.
87
+ Registration moved to `boot()`. The WebSocket attach stays in `ready()`, where it belongs: the node
88
+ HTTP server does not exist before `start()`. A test now drives the real lifecycle order and pins
89
+ both directions.
90
+
91
+ **`authorize` in manual mode (behaviour change, security).** `resolveRuntime` read `authorize` only
92
+ from the options, and only the provider passed it — so `collaborationRoutes(router)` called from
93
+ `start/routes.ts` had none, and the absent variable failed in opposite directions in the same file:
94
+ `guard()` fell to its deny literal (`403` for everyone on `/comments`, `/versions`, `/state`) while
95
+ `issueToken` skipped the check entirely (`if (authorize) {…}`), handing any authenticated caller a
96
+ token for any document. Now there is one resolution order — the explicit option, else the manager's
97
+ rule (declared document → global `authorize` → deny), else the app config, else deny — and
98
+ `issueToken` **throws `CollabForbiddenError` when it has no rule** instead of minting. Manual
99
+ registration enforces exactly what the provider and the WebSocket handshake enforce.
100
+
101
+ **`collaborationRoutes` is synchronous (API change).** It was `async` only to `await import()` the
102
+ app config, and a `RouteGroup` closes as soon as its callback returns — so it could not be wrapped in
103
+ `router.group(() => …)` and every consuming app wrote a global middleware matched against a
104
+ hardcoded `/collaboration` prefix, which silently stopped protecting anything when `routes.prefix`
105
+ changed. Config is now resolved lazily at request time and the function returns `void`; an existing
106
+ `await collaborationRoutes(...)` still works. `defaultResolveUser` also calls `ctx.auth.check()`
107
+ (or `authenticate()`) before reading `ctx.auth.user`, so a lazily-resolving auth stack produces a
108
+ caller instead of a blanket `401`.
109
+
110
+ **Comment mutations are author-or-elevated (behaviour change, security).** `PATCH`/`DELETE
111
+ /comments/:id` checked only the document-level `canComment` and then called
112
+ `comments.resolve/remove`, which never look at `userId` — anyone who could comment could resolve or
113
+ delete anyone else's thread. The rule is now explicit and exported as `canMutateComment`: the author
114
+ may always mutate their own comment, anyone else needs `canWrite` on the document. An unknown
115
+ comment id answers `404`.
116
+
117
+ **`restoreVersion` honours its contract (behaviour change).** Both drivers did `void restoredBy` and
118
+ overwrote the document without recording what they replaced, in the one operation of a version
119
+ history that most needs to be undoable. A restore now writes the pre-restore state to the history
120
+ first, as a version labelled `restored from #<seq>` attributed to `restoredBy`, and a bad
121
+ `versionId` still fails before anything is written.
122
+
123
+ **Presence is actually wired.** The provider built a `RedisPresenceStore` from `redisUrl` and the
124
+ manager wrapped it in a `PresenceService`, but `#buildDriver` never passed `presence` into the driver
125
+ options — the drivers' join/leave were dead code and `listPresence()` returned `[]` forever. It is
126
+ forwarded now, and the driver's bookkeeping is keyed by **socket** instead of by document: the old
127
+ `Map<docName, userId>` held one slot per document, so a second editor overwrote the first and either
128
+ disconnect evicted both. A user with two tabs leaves the roster only when the last one closes. The
129
+ Automerge driver feeds presence too.
130
+
131
+ **Storage and authorize failures are visible, and denial is distinct from error.** The library took no
132
+ logger and emitted no events; `onStoreDocument`/`beforeUnloadDocument` called `saveDocument` bare
133
+ inside hooks that swallow throws, and a throw from `authorize` escaped `onAuthenticate` as a generic
134
+ handshake failure — so an outage and a denial looked identical to the client, and an app-side
135
+ database error inside the rule became an unbounded reconnect storm. New: `onCollaborationError`,
136
+ `collaborationEvents`, `setCollaborationLogger` (the provider installs the Adonis logger when it can
137
+ resolve one), and `CollabAuthorizationError`, thrown when the rule could not be evaluated, alongside
138
+ `CollabForbiddenError` for an actual denial.
139
+
140
+ **Document names are type-checkable.** `defineConfig` is generic, so the literal keys of `documents`
141
+ survive instead of being widened to `string`, and the new `InferCollabDocumentNames<typeof config>`
142
+ derives the union of declared patterns (`CollabDocumentNameFor` resolves one into a concrete name
143
+ shape). The Assembler codegen hook only ever indexed `app/collaboration/documents`, which apps that
144
+ declare documents inline in `config/collaboration.ts` never create; that limitation is now stated in
145
+ the hook and the docs point at the config route.
146
+
147
+ **Also:** `AutomergeDriver.close()` no longer hangs forever on a driver that was never attached
148
+ (`this.wss?.close(cb)` never runs `cb` when there is no server). Docs corrected where they asserted
149
+ the broken behaviour: `authorize` is evaluated **once per connection**, not "on every relevant
150
+ permission change" — revoking access does not drop an open socket; the versions `POST` body has no
151
+ `userId`; and the routes, presence and manual-mode pages describe what the code does.
152
+
3
153
  ## 0.9.1
4
154
 
5
155
  ### Patch Changes
@@ -4,18 +4,28 @@ import type { ApplicationService } from '@adonisjs/core/types';
4
4
  *
5
5
  * - `register()` hands the booted app to `services/main` and binds the
6
6
  * `CollaborationManager` singleton from `config/collaboration.ts`;
7
- * - `boot()`/`ready()` attaches the collaboration WebSocket upgrade to the
8
- * Adonis HTTP server (path from config, default `/collaboration`);
9
- * - `ready()` registers the built-in REST endpoints automatically unless
10
- * `routes.enabled: false` — then call `collaborationRoutes(router)` in
11
- * `start/routes.ts` with your own middleware;
7
+ * - `boot()` installs the logger and registers the built-in REST endpoints
8
+ * — **before** the router commits — unless `routes.enabled: false`;
9
+ * - `ready()` attaches the collaboration WebSocket upgrade to the Adonis HTTP
10
+ * server (path from config, default `/collaboration`);
12
11
  * - `shutdown()` flushes pending stores and closes all connections.
12
+ *
13
+ * The two phases are not interchangeable, and both directions of the mistake
14
+ * are silent:
15
+ *
16
+ * - routes must be registered in `boot()`, because `Server.boot()` calls
17
+ * `router.commit()` during `start()` and everything registered after that
18
+ * is dropped from the route store — the endpoints look configured and
19
+ * answer 404;
20
+ * - the WebSocket attach must stay in `ready()`, because the node HTTP
21
+ * server only exists once Ignitor created it in `start()`.
13
22
  */
14
23
  export default class CollaborationServiceProvider {
15
24
  protected app: ApplicationService;
16
25
  private config?;
17
26
  constructor(app: ApplicationService);
18
27
  register(): void;
28
+ boot(): Promise<void>;
19
29
  ready(): Promise<void>;
20
30
  shutdown(): Promise<void>;
21
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration_provider.d.ts","sourceRoot":"","sources":["../../providers/collaboration_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAQ/D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA4B;IAGnC,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAF7C,OAAO,CAAC,MAAM,CAAC,CAAyB;gBAElB,GAAG,EAAE,kBAAkB;IAE7C,QAAQ;IA8BF,KAAK;IAiDL,QAAQ;CAIf"}
1
+ {"version":3,"file":"collaboration_provider.d.ts","sourceRoot":"","sources":["../../providers/collaboration_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA4B;IAGnC,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAF7C,OAAO,CAAC,MAAM,CAAC,CAAyB;gBAElB,GAAG,EAAE,kBAAkB;IAE7C,QAAQ;IA8BF,IAAI;IAyCJ,KAAK;IA0BL,QAAQ;CAKf"}
@@ -1,5 +1,6 @@
1
1
  import { Redis } from 'ioredis';
2
2
  import { CollaborationManager } from '../src/collaboration_manager.js';
3
+ import { setCollaborationLogger } from '../src/observability.js';
3
4
  import { collaborationRoutes } from '../src/routes.js';
4
5
  import { setBootedApp } from '../src/services/booted_app.js';
5
6
  import { RedisPresenceStore } from '../src/services/presence_service.js';
@@ -8,12 +9,21 @@ import { RedisPresenceStore } from '../src/services/presence_service.js';
8
9
  *
9
10
  * - `register()` hands the booted app to `services/main` and binds the
10
11
  * `CollaborationManager` singleton from `config/collaboration.ts`;
11
- * - `boot()`/`ready()` attaches the collaboration WebSocket upgrade to the
12
- * Adonis HTTP server (path from config, default `/collaboration`);
13
- * - `ready()` registers the built-in REST endpoints automatically unless
14
- * `routes.enabled: false` — then call `collaborationRoutes(router)` in
15
- * `start/routes.ts` with your own middleware;
12
+ * - `boot()` installs the logger and registers the built-in REST endpoints
13
+ * — **before** the router commits — unless `routes.enabled: false`;
14
+ * - `ready()` attaches the collaboration WebSocket upgrade to the Adonis HTTP
15
+ * server (path from config, default `/collaboration`);
16
16
  * - `shutdown()` flushes pending stores and closes all connections.
17
+ *
18
+ * The two phases are not interchangeable, and both directions of the mistake
19
+ * are silent:
20
+ *
21
+ * - routes must be registered in `boot()`, because `Server.boot()` calls
22
+ * `router.commit()` during `start()` and everything registered after that
23
+ * is dropped from the route store — the endpoints look configured and
24
+ * answer 404;
25
+ * - the WebSocket attach must stay in `ready()`, because the node HTTP
26
+ * server only exists once Ignitor created it in `start()`.
17
27
  */
18
28
  export default class CollaborationServiceProvider {
19
29
  app;
@@ -45,22 +55,18 @@ export default class CollaborationServiceProvider {
45
55
  return new CollaborationManager(managerConfig, presenceStore);
46
56
  });
47
57
  }
48
- async ready() {
49
- // Attach happens in `ready()` (lifecycle phase 4): Ignitor created the
50
- // node HTTP server during `start()` (phase 3), so getNodeServer() exists.
51
- // Outside the web process (ace/console/test/repl) there is no HTTP
52
- // server — collaboration does not start; the manager stays available.
53
- const env = this.app.getEnvironment();
54
- if (env !== 'web') {
55
- return;
58
+ async boot() {
59
+ // Storage and authorize failures otherwise vanish inside socket hooks.
60
+ try {
61
+ const logger = (await this.app.container.make('logger'));
62
+ if (logger && typeof logger.error === 'function') {
63
+ setCollaborationLogger(logger);
64
+ }
56
65
  }
57
- const manager = await this.app.container.make(CollaborationManager);
58
- const adonisServer = (await this.app.container.make('server'));
59
- const nodeServer = adonisServer.getNodeServer?.();
60
- if (!nodeServer) {
61
- throw new Error('[@adonis-agora/collaboration] getNodeServer() unavailable in ready() — check @adonisjs/http-server version');
66
+ catch {
67
+ // No logger bound (bare container, some test harnesses): the event
68
+ // stream in src/observability.ts still carries every failure.
62
69
  }
63
- await manager.attach(nodeServer);
64
70
  // Auto-register built-in REST endpoints unless explicitly disabled.
65
71
  const routes = this.config?.routes;
66
72
  if (routes?.enabled === false) {
@@ -68,7 +74,16 @@ export default class CollaborationServiceProvider {
68
74
  }
69
75
  const router = (await this.app.container.make('router'));
70
76
  const runtimeOptions = {
77
+ // Resolved per request, never here: building the manager during boot
78
+ // would open its Redis connection in every environment, including ace.
71
79
  managerFallback: () => this.app.container.make(CollaborationManager),
80
+ // The token endpoint must resolve permissions exactly like the WebSocket
81
+ // handshake does — through the manager, so declared documents' own
82
+ // `authorize` applies and an unmatched document still fails closed.
83
+ authorize: async (ctx, docName) => {
84
+ const manager = await this.app.container.make(CollaborationManager);
85
+ return manager.authorize(ctx, docName);
86
+ },
72
87
  };
73
88
  if (routes?.prefix !== undefined)
74
89
  runtimeOptions.prefix = routes.prefix;
@@ -76,13 +91,27 @@ export default class CollaborationServiceProvider {
76
91
  runtimeOptions.middleware = routes.middleware;
77
92
  if (routes?.resolveUser !== undefined)
78
93
  runtimeOptions.resolveUser = routes.resolveUser;
79
- // The token endpoint must resolve permissions exactly like the WebSocket
80
- // handshake does — through the manager, so declared documents' own
81
- // `authorize` applies and an unmatched document still fails closed.
82
- runtimeOptions.authorize = (ctx, docName) => manager.authorize(ctx, docName);
83
- await collaborationRoutes(router, runtimeOptions);
94
+ collaborationRoutes(router, runtimeOptions);
95
+ }
96
+ async ready() {
97
+ // Attach happens in `ready()` (lifecycle phase 4): Ignitor created the
98
+ // node HTTP server during `start()` (phase 3), so getNodeServer() exists.
99
+ // Outside the web process (ace/console/test/repl) there is no HTTP
100
+ // server — collaboration does not start; the manager stays available.
101
+ const env = this.app.getEnvironment();
102
+ if (env !== 'web') {
103
+ return;
104
+ }
105
+ const manager = await this.app.container.make(CollaborationManager);
106
+ const adonisServer = (await this.app.container.make('server'));
107
+ const nodeServer = adonisServer.getNodeServer?.();
108
+ if (!nodeServer) {
109
+ throw new Error('[@adonis-agora/collaboration] getNodeServer() unavailable in ready() — check @adonisjs/http-server version');
110
+ }
111
+ await manager.attach(nodeServer);
84
112
  }
85
113
  async shutdown() {
114
+ setCollaborationLogger(undefined);
86
115
  const manager = await this.app.container.make(CollaborationManager);
87
116
  await manager.close();
88
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration_provider.js","sourceRoot":"","sources":["../../providers/collaboration_provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAA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AAI,CAAC,oBAAoB,CAAC,CAAC;QAEpE,MAAM,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAE5D,CAAC;QAEF,MAAM,UAAU,GAAG,YAAY,CAAC,aAAa,EAAE,EAAE,CAAC;QAClD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACpE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -46,11 +46,29 @@ export interface IssuedToken {
46
46
  }
47
47
  /** Thrown when authorize() denies read access for the document. */
48
48
  export declare class CollabForbiddenError extends Error {
49
- constructor(docName: string);
49
+ constructor(docName: string, message?: string);
50
+ }
51
+ /**
52
+ * Thrown when the permission rule itself could not be evaluated — a broken
53
+ * `authorize`, or a database the rule needs and cannot reach.
54
+ *
55
+ * Distinct from {@link CollabForbiddenError} on purpose: "you may not" is a
56
+ * final answer a client should respect, while "we could not tell" is a
57
+ * transient condition it may retry. Collapsing the two is what turns an app's
58
+ * database blip into an unbounded reconnect storm.
59
+ */
60
+ export declare class CollabAuthorizationError extends Error {
61
+ readonly docName: string;
62
+ readonly cause?: unknown | undefined;
63
+ constructor(docName: string, cause?: unknown | undefined);
50
64
  }
51
65
  /**
52
66
  * Issues an ephemeral credential for `docName`, enforcing the permission
53
- * seam via `authorize` when one is provided.
67
+ * seam via `authorize`.
68
+ *
69
+ * **Fails closed without a rule.** Skipping the check when `authorize` is
70
+ * absent handed any authenticated caller a token for any document; an absent
71
+ * rule is a misconfiguration, not a grant.
54
72
  */
55
73
  export declare function issueToken(config: TokenIssuerConfig, user: {
56
74
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/auth/token.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7F;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAC9E;AAED,0EAA0E;AAC1E,MAAM,MAAM,WAAW,GAAG,CACxB,GAAG,EAAE,uBAAuB,EAC5B,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE/B,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAAE,EACjG,MAAM,EAAE,MAAM,EACd,gBAAgB,SAAM,GACrB,MAAM,CAQR;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAoBzD;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,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CAAC,EAAE,WAAW,GACtB,OAAO,CAAC,WAAW,CAAC,CA+BtB"}
@@ -52,26 +52,49 @@ export function buildWsUrl(config, docName) {
52
52
  }
53
53
  /** Thrown when authorize() denies read access for the document. */
54
54
  export class CollabForbiddenError extends Error {
55
- constructor(docName) {
56
- super(`no access to document "${docName}"`);
55
+ constructor(docName, message) {
56
+ super(message ?? `no access to document "${docName}"`);
57
57
  this.name = 'CollabForbiddenError';
58
58
  }
59
59
  }
60
+ /**
61
+ * Thrown when the permission rule itself could not be evaluated — a broken
62
+ * `authorize`, or a database the rule needs and cannot reach.
63
+ *
64
+ * Distinct from {@link CollabForbiddenError} on purpose: "you may not" is a
65
+ * final answer a client should respect, while "we could not tell" is a
66
+ * transient condition it may retry. Collapsing the two is what turns an app's
67
+ * database blip into an unbounded reconnect storm.
68
+ */
69
+ export class CollabAuthorizationError extends Error {
70
+ docName;
71
+ cause;
72
+ constructor(docName, cause) {
73
+ super(`could not evaluate access to document "${docName}"`);
74
+ this.docName = docName;
75
+ this.cause = cause;
76
+ this.name = 'CollabAuthorizationError';
77
+ }
78
+ }
60
79
  /**
61
80
  * Issues an ephemeral credential for `docName`, enforcing the permission
62
- * seam via `authorize` when one is provided.
81
+ * seam via `authorize`.
82
+ *
83
+ * **Fails closed without a rule.** Skipping the check when `authorize` is
84
+ * absent handed any authenticated caller a token for any document; an absent
85
+ * rule is a misconfiguration, not a grant.
63
86
  */
64
87
  export async function issueToken(config, user, docName, authorize) {
65
88
  const ctx = {
66
89
  userId: user.id,
67
90
  ...(user.name ? { user: { name: user.name } } : {}),
68
91
  };
69
- let permission;
70
- if (authorize) {
71
- permission = await authorize(ctx, docName);
72
- if (!permission.canRead)
73
- throw new CollabForbiddenError(docName);
92
+ if (!authorize) {
93
+ throw new CollabForbiddenError(docName, `no authorize rule configured — refusing to issue a token for "${docName}". Set authorize in config/collaboration.ts, or pass one to collaborationRoutes().`);
74
94
  }
95
+ const permission = await authorize(ctx, docName);
96
+ if (!permission.canRead)
97
+ throw new CollabForbiddenError(docName);
75
98
  if (config.engine === 'partykit') {
76
99
  if (!config.partykit?.jwtSecret) {
77
100
  throw new Error('config.partykit.jwtSecret is required when engine=partykit');
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/auth/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA6B1D,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAC/B,OAAiG,EACjG,MAAc,EACd,gBAAgB,GAAG,GAAG;IAEtB,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,gBAAgB,EAAE,CAAC;IACnE,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC3F,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IACrD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACpF,OAAO,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;AACpC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,MAAc;IAEd,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CA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AAoB,CAAC,OAAO,CAAC,CAAC;IAEjE,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QACD,OAAO;YACL,KAAK,EAAE,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACjF,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC1D,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"codegen_init.d.ts","sourceRoot":"","sources":["../../src/codegen_init.ts"],"names":[],"mappings":"wBA8D2B,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI;AAAxF,wBAAyF"}
1
+ {"version":3,"file":"codegen_init.d.ts","sourceRoot":"","sources":["../../src/codegen_init.ts"],"names":[],"mappings":"wBAwE2B,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI;AAAxF,wBAAyF"}
@@ -17,12 +17,22 @@ import { renderDocumentsRegistry } from './codegen/documents_registry.js';
17
17
  * init: [() => import('@adonis-agora/collaboration/codegen_init')]
18
18
  * }
19
19
  * ```
20
+ *
21
+ * **Scope, stated plainly.** This hook only knows about the directory, which
22
+ * only exists once `make:collab-document` created it. Documents declared the
23
+ * other supported way — `defineDocument` inline in `config/collaboration.ts` —
24
+ * are invisible to it, and it early-returns generating nothing. For those,
25
+ * derive the union from the config with `InferCollabDocumentNames<typeof
26
+ * collaborationConfig>`; `defineConfig` is generic so the literal keys
27
+ * survive. See docs/codegen/documents-registry.
20
28
  */
21
29
  // The wrapper's inferred return type references non-portable @poppinss
22
30
  // internals — annotate explicitly so the declaration emit stays portable.
23
31
  const initHook = hooks.init((_parent, _hooksManager, indexGenerator) => {
24
32
  const source = './app/collaboration/documents';
25
- // Directory not created yet: nothing to index (make:collab-document creates it).
33
+ // Directory not created yet: nothing to index. Apps that declare their
34
+ // documents inline in config/collaboration.ts never create it — that is
35
+ // expected, and InferCollabDocumentNames is their route to the same type.
26
36
  if (!existsSync(source)) {
27
37
  return;
28
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codegen_init.js","sourceRoot":"","sources":["../../src/codegen_init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAyB,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAEjG;;;;;;;;;;;;;;;;GAgBG;AACH,uEAAuE;AACvE,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CACzB,CACE,OAAgB,EAChB,aAAsB,EACtB,cAEC,EACD,EAAE;IACF,MAAM,MAAM,GAAG,+BAA+B,CAAC;IAE/C,iFAAiF;IACjF,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,cAAc,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACpC,MAAM;QACN,IAAI,EAAE,CAAC,SAAS,CAAC;QACjB,MAAM,EAAE,wCAAwC;QAChD,EAAE,EAAE,CACF,GAAyC,EACzC,M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 -78,6 +78,10 @@ export class CollaborationManager {
78
78
  const shared = {
79
79
  authorize: (ctx, docName) => this.authorize(ctx, docName),
80
80
  ...(storage ? { storage } : {}),
81
+ // Without this the presence store the provider builds from `redisUrl`
82
+ // is never reached: the drivers' join/leave both guard on
83
+ // `options.presence`, so `listPresence()` answered [] forever.
84
+ ...(this.presence ? { presence: this.presence } : {}),
81
85
  ...(this.config.path !== undefined ? { path: this.config.path } : {}),
82
86
  ...(this.config.debounce !== undefined ? { debounce: this.config.debounce } : {}),
83
87
  };
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration_manager.js","sourceRoot":"","sources":["../../src/collaboration_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAEL,eAAe,GAEhB,MAAM,gCAAgC,CAAC;AAUxC;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IACd,MAAM,CAAsB;IAC5B,OAAO,GAAG,IAAI,GAAG,EAA4C,CAAC;IACvE,MAAM,CAA8B;IAC5C,QAAQ,CAAiB;IACzB,QAAQ,CAAmB;IAE3B,YAAY,MAA2B,EAAE,aAA6B;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACnE,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC;QACrD,CAAC;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AC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;CACF;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
@@ -36,6 +36,37 @@ export type CollaborationAppConfig = {
36
36
  /**
37
37
  * Type-safe config helper used in the app's `config/collaboration.ts` —
38
38
  * same pattern as @adonisjs/*'s `defineConfig`.
39
+ *
40
+ * Generic over the literal config so the **keys of `documents` survive**.
41
+ * Returning the widened `CollaborationAppConfig` collapsed them to `string`,
42
+ * which is why there was no way to get a union of declared document names out
43
+ * of the config and every call site hand-built doc-name strings. See
44
+ * {@link InferCollabDocumentNames}.
39
45
  */
40
- export declare function defineConfig(config: CollaborationAppConfig): CollaborationAppConfig;
46
+ export declare function defineConfig<T extends CollaborationAppConfig>(config: T): T;
47
+ /**
48
+ * The union of document-name patterns declared in `config/collaboration.ts`.
49
+ *
50
+ * ```ts
51
+ * // types/collaboration.ts
52
+ * import type { InferCollabDocumentNames } from '@adonis-agora/collaboration'
53
+ * import collaborationConfig from '#config/collaboration'
54
+ *
55
+ * export type CollabDocumentName = InferCollabDocumentNames<typeof collaborationConfig>
56
+ * // → 'researches/:id/writing' | 'whiteboards/:id'
57
+ * ```
58
+ *
59
+ * The patterns keep their `:param` segments — they are the declaration, not a
60
+ * resolved name. Build a concrete name from one with
61
+ * {@link CollabDocumentNameFor} when you want the parameters checked too.
62
+ */
63
+ export type InferCollabDocumentNames<T> = T extends {
64
+ documents: infer D;
65
+ } ? Extract<keyof D, string> : never;
66
+ /**
67
+ * A declared pattern with its `:params` replaced by strings — so
68
+ * `'researches/:id/writing'` accepts `` `researches/${string}/writing` `` and
69
+ * rejects a typo'd `'research/42/writing'`.
70
+ */
71
+ export type CollabDocumentNameFor<Pattern extends string> = Pattern extends `${infer Head}/:${infer Rest}` ? Rest extends `${string}/${infer Tail}` ? `${Head}/${string}/${CollabDocumentNameFor<Tail>}` : `${Head}/${string}` : Pattern;
41
72
  //# sourceMappingURL=define_config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,8EAA8E;IAC9E,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACzC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,qBAAqB;QACrB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,iCAAiC;QACjC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,qEAAqE;QACrE,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;QACvB,8DAA8D;QAC9D,WAAW,CAAC,EAAE,aAAa,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,sBAAsB,G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CAAE,GACtE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GACxB,KAAK,CAAC;AAEV;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,MAAM,IACtD,OAAO,SAAS,GAAG,MAAM,IAAI,KAAK,MAAM,IAAI,EAAE,GAC1C,IAAI,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,EAAE,GACpC,GAAG,IAAI,IAAI,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,GAClD,GAAG,IAAI,IAAI,MAAM,EAAE,GACrB,OAAO,CAAC"}
@@ -1,6 +1,12 @@
1
1
  /**
2
2
  * Type-safe config helper used in the app's `config/collaboration.ts` —
3
3
  * same pattern as @adonisjs/*'s `defineConfig`.
4
+ *
5
+ * Generic over the literal config so the **keys of `documents` survive**.
6
+ * Returning the widened `CollaborationAppConfig` collapsed them to `string`,
7
+ * which is why there was no way to get a union of declared document names out
8
+ * of the config and every call site hand-built doc-name strings. See
9
+ * {@link InferCollabDocumentNames}.
4
10
  */
5
11
  export function defineConfig(config) {
6
12
  return config;