@adonis-agora/collaboration 0.9.3 → 0.10.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.
- package/CHANGELOG.md +110 -0
- package/dist/providers/collaboration_provider.d.ts +15 -5
- package/dist/providers/collaboration_provider.d.ts.map +1 -1
- package/dist/providers/collaboration_provider.js +53 -24
- package/dist/providers/collaboration_provider.js.map +1 -1
- package/dist/src/auth/token.d.ts +20 -2
- package/dist/src/auth/token.d.ts.map +1 -1
- package/dist/src/auth/token.js +31 -8
- package/dist/src/auth/token.js.map +1 -1
- package/dist/src/codegen_init.d.ts.map +1 -1
- package/dist/src/codegen_init.js +11 -1
- package/dist/src/codegen_init.js.map +1 -1
- package/dist/src/collaboration_manager.d.ts.map +1 -1
- package/dist/src/collaboration_manager.js +4 -0
- package/dist/src/collaboration_manager.js.map +1 -1
- package/dist/src/define_config.d.ts +32 -1
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +6 -0
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/drivers/automerge/automerge_driver.d.ts +7 -1
- package/dist/src/drivers/automerge/automerge_driver.d.ts.map +1 -1
- package/dist/src/drivers/automerge/automerge_driver.js +74 -11
- package/dist/src/drivers/automerge/automerge_driver.js.map +1 -1
- package/dist/src/drivers/yjs/yjs_driver.d.ts +20 -0
- package/dist/src/drivers/yjs/yjs_driver.d.ts.map +1 -1
- package/dist/src/drivers/yjs/yjs_driver.js +84 -19
- package/dist/src/drivers/yjs/yjs_driver.js.map +1 -1
- package/dist/src/http/types.d.ts +24 -1
- package/dist/src/http/types.d.ts.map +1 -1
- package/dist/src/http/types.js.map +1 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/observability.d.ts +52 -0
- package/dist/src/observability.d.ts.map +1 -0
- package/dist/src/observability.js +50 -0
- package/dist/src/observability.js.map +1 -0
- package/dist/src/routes.d.ts +35 -5
- package/dist/src/routes.d.ts.map +1 -1
- package/dist/src/routes.js +117 -26
- package/dist/src/routes.js.map +1 -1
- package/dist/src/services/comment_service.d.ts +9 -0
- package/dist/src/services/comment_service.d.ts.map +1 -1
- package/dist/src/services/comment_service.js +17 -4
- package/dist/src/services/comment_service.js.map +1 -1
- package/dist/src/storage/lucid_storage.d.ts +7 -0
- package/dist/src/storage/lucid_storage.d.ts.map +1 -1
- package/dist/src/storage/lucid_storage.js +34 -11
- package/dist/src/storage/lucid_storage.js.map +1 -1
- package/dist/src/types.d.ts +14 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/versioning.d.ts +6 -0
- package/dist/src/versioning.d.ts.map +1 -1
- package/dist/src/versioning.js +10 -0
- package/dist/src/versioning.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,115 @@
|
|
|
1
1
|
# @adonis-agora/collaboration
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b44c00e: `useAutomergeDoc` reconnects, and two parameters the routes discard are gone
|
|
8
|
+
|
|
9
|
+
**The Automerge hook opened one socket and never rebuilt it.** `ws.onclose` set `status` to
|
|
10
|
+
`'disconnected'` and that was the end of it — the effect's deps (`docName`, `config`,
|
|
11
|
+
`WebSocketImpl`) are all stable, so nothing ever ran again. Meanwhile `change()` went on mutating
|
|
12
|
+
the local document and never sending it: a user typing into a document that had stopped syncing,
|
|
13
|
+
with no state on the hook that could have told them.
|
|
14
|
+
|
|
15
|
+
It now reconnects on the same terms as the Yjs `DocSession`, sharing its vocabulary rather than
|
|
16
|
+
growing a second one — `MAX_RECONNECT_ATTEMPTS`, `isPermanentFailure` and the exhausted-budget error
|
|
17
|
+
are now exported from `session.ts` and used by both. A fresh token per attempt, backoff from 1s
|
|
18
|
+
capped at 15s, five attempts, reset by a connection that opens, and an exhausted budget that keeps
|
|
19
|
+
the last real failure as its `cause`. A **permanent** failure is not retried at all: a `4000` /
|
|
20
|
+
`4001` / `4003` close, or a document the server routes to another engine.
|
|
21
|
+
|
|
22
|
+
**Changes made while disconnected are not dropped.** The protocol exchanges whole documents, so the
|
|
23
|
+
local doc is its own outbox: the change is applied locally, counted, and the whole saved document is
|
|
24
|
+
written the moment a socket is open again. Two new fields on the result make that visible —
|
|
25
|
+
`pendingChanges` (local changes not yet written to the socket) and `synced` (the server's state has
|
|
26
|
+
been merged on the _current_ connection, the Automerge counterpart of the Yjs flag). Disabling the
|
|
27
|
+
editor on a disconnect is no longer the honest thing to do; showing `pendingChanges` is.
|
|
28
|
+
|
|
29
|
+
**Breaking, small:** `userId` is gone from three client signatures, because the routes already
|
|
30
|
+
ignored it in favour of the authenticated caller — `createVersion(config, docName, label)`,
|
|
31
|
+
`createComment(config, input)` and `useComments().create({ space, anchor, body, authorName? })`. It
|
|
32
|
+
was dead on the wire while reading as if it decided who the author was. Drop the argument; nothing
|
|
33
|
+
else changes.
|
|
34
|
+
|
|
35
|
+
**`CommentService.get(docName, commentId)`** is new. Authorizing a comment PATCH or DELETE resolved
|
|
36
|
+
its one comment by listing the document's entire thread and filtering — correct, and O(n) in the
|
|
37
|
+
comments, so the check got slower the longer the discussion got. `CollaborationStorage` gains an
|
|
38
|
+
optional `getComment`, implemented by `LucidStorage` as an indexed single-row query; storages
|
|
39
|
+
without it fall back to the old scan, now behind one call.
|
|
40
|
+
|
|
41
|
+
- b44c00e: Fix route registration, authorize in manual mode, comment permissions, restore semantics, presence wiring and failure visibility.
|
|
42
|
+
|
|
43
|
+
**Route registration phase (behaviour change).** The provider registered the built-in REST routes in
|
|
44
|
+
`ready()`, which runs _after_ `Server.boot()` has called `router.commit()` — the router drains its
|
|
45
|
+
pending list there and refuses everything later, so the auto-registered `/collaboration/*` endpoints
|
|
46
|
+
were silently orphaned and answered `404` in a served build while looking perfectly configured.
|
|
47
|
+
Registration moved to `boot()`. The WebSocket attach stays in `ready()`, where it belongs: the node
|
|
48
|
+
HTTP server does not exist before `start()`. A test now drives the real lifecycle order and pins
|
|
49
|
+
both directions.
|
|
50
|
+
|
|
51
|
+
**`authorize` in manual mode (behaviour change, security).** `resolveRuntime` read `authorize` only
|
|
52
|
+
from the options, and only the provider passed it — so `collaborationRoutes(router)` called from
|
|
53
|
+
`start/routes.ts` had none, and the absent variable failed in opposite directions in the same file:
|
|
54
|
+
`guard()` fell to its deny literal (`403` for everyone on `/comments`, `/versions`, `/state`) while
|
|
55
|
+
`issueToken` skipped the check entirely (`if (authorize) {…}`), handing any authenticated caller a
|
|
56
|
+
token for any document. Now there is one resolution order — the explicit option, else the manager's
|
|
57
|
+
rule (declared document → global `authorize` → deny), else the app config, else deny — and
|
|
58
|
+
`issueToken` **throws `CollabForbiddenError` when it has no rule** instead of minting. Manual
|
|
59
|
+
registration enforces exactly what the provider and the WebSocket handshake enforce.
|
|
60
|
+
|
|
61
|
+
**`collaborationRoutes` is synchronous (API change).** It was `async` only to `await import()` the
|
|
62
|
+
app config, and a `RouteGroup` closes as soon as its callback returns — so it could not be wrapped in
|
|
63
|
+
`router.group(() => …)` and every consuming app wrote a global middleware matched against a
|
|
64
|
+
hardcoded `/collaboration` prefix, which silently stopped protecting anything when `routes.prefix`
|
|
65
|
+
changed. Config is now resolved lazily at request time and the function returns `void`; an existing
|
|
66
|
+
`await collaborationRoutes(...)` still works. `defaultResolveUser` also calls `ctx.auth.check()`
|
|
67
|
+
(or `authenticate()`) before reading `ctx.auth.user`, so a lazily-resolving auth stack produces a
|
|
68
|
+
caller instead of a blanket `401`.
|
|
69
|
+
|
|
70
|
+
**Comment mutations are author-or-elevated (behaviour change, security).** `PATCH`/`DELETE
|
|
71
|
+
/comments/:id` checked only the document-level `canComment` and then called
|
|
72
|
+
`comments.resolve/remove`, which never look at `userId` — anyone who could comment could resolve or
|
|
73
|
+
delete anyone else's thread. The rule is now explicit and exported as `canMutateComment`: the author
|
|
74
|
+
may always mutate their own comment, anyone else needs `canWrite` on the document. An unknown
|
|
75
|
+
comment id answers `404`.
|
|
76
|
+
|
|
77
|
+
**`restoreVersion` honours its contract (behaviour change).** Both drivers did `void restoredBy` and
|
|
78
|
+
overwrote the document without recording what they replaced, in the one operation of a version
|
|
79
|
+
history that most needs to be undoable. A restore now writes the pre-restore state to the history
|
|
80
|
+
first, as a version labelled `restored from #<seq>` attributed to `restoredBy`, and a bad
|
|
81
|
+
`versionId` still fails before anything is written.
|
|
82
|
+
|
|
83
|
+
**Presence is actually wired.** The provider built a `RedisPresenceStore` from `redisUrl` and the
|
|
84
|
+
manager wrapped it in a `PresenceService`, but `#buildDriver` never passed `presence` into the driver
|
|
85
|
+
options — the drivers' join/leave were dead code and `listPresence()` returned `[]` forever. It is
|
|
86
|
+
forwarded now, and the driver's bookkeeping is keyed by **socket** instead of by document: the old
|
|
87
|
+
`Map<docName, userId>` held one slot per document, so a second editor overwrote the first and either
|
|
88
|
+
disconnect evicted both. A user with two tabs leaves the roster only when the last one closes. The
|
|
89
|
+
Automerge driver feeds presence too.
|
|
90
|
+
|
|
91
|
+
**Storage and authorize failures are visible, and denial is distinct from error.** The library took no
|
|
92
|
+
logger and emitted no events; `onStoreDocument`/`beforeUnloadDocument` called `saveDocument` bare
|
|
93
|
+
inside hooks that swallow throws, and a throw from `authorize` escaped `onAuthenticate` as a generic
|
|
94
|
+
handshake failure — so an outage and a denial looked identical to the client, and an app-side
|
|
95
|
+
database error inside the rule became an unbounded reconnect storm. New: `onCollaborationError`,
|
|
96
|
+
`collaborationEvents`, `setCollaborationLogger` (the provider installs the Adonis logger when it can
|
|
97
|
+
resolve one), and `CollabAuthorizationError`, thrown when the rule could not be evaluated, alongside
|
|
98
|
+
`CollabForbiddenError` for an actual denial.
|
|
99
|
+
|
|
100
|
+
**Document names are type-checkable.** `defineConfig` is generic, so the literal keys of `documents`
|
|
101
|
+
survive instead of being widened to `string`, and the new `InferCollabDocumentNames<typeof config>`
|
|
102
|
+
derives the union of declared patterns (`CollabDocumentNameFor` resolves one into a concrete name
|
|
103
|
+
shape). The Assembler codegen hook only ever indexed `app/collaboration/documents`, which apps that
|
|
104
|
+
declare documents inline in `config/collaboration.ts` never create; that limitation is now stated in
|
|
105
|
+
the hook and the docs point at the config route.
|
|
106
|
+
|
|
107
|
+
**Also:** `AutomergeDriver.close()` no longer hangs forever on a driver that was never attached
|
|
108
|
+
(`this.wss?.close(cb)` never runs `cb` when there is no server). Docs corrected where they asserted
|
|
109
|
+
the broken behaviour: `authorize` is evaluated **once per connection**, not "on every relevant
|
|
110
|
+
permission change" — revoking access does not drop an open socket; the versions `POST` body has no
|
|
111
|
+
`userId`; and the routes, presence and manual-mode pages describe what the code does.
|
|
112
|
+
|
|
3
113
|
## 0.9.1
|
|
4
114
|
|
|
5
115
|
### 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()
|
|
8
|
-
*
|
|
9
|
-
* - `ready()`
|
|
10
|
-
*
|
|
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;
|
|
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()
|
|
12
|
-
*
|
|
13
|
-
* - `ready()`
|
|
14
|
-
*
|
|
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
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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,MAAM,qCAAqC,CAAC;AAEzE
|
|
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,EAAqB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAA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EF,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"}
|
package/dist/src/auth/token.d.ts
CHANGED
|
@@ -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
|
|
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;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}
|
|
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
|
|
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
|
-
|
|
70
|
-
|
|
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,CAA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OAAO,EACP,iEAAiE,OAAO,oFAAoF,CAC7J,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GAAqB,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnE,IAAI,CAAC,UAAU,CAAC,OAAO;QAAE,MAAM,IAAI,oBAAoB,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":"
|
|
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"}
|
package/dist/src/codegen_init.js
CHANGED
|
@@ -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
|
|
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
|
|
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,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AAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIzE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -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,CAAm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AC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAuB;QACjD,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,OAAO,CAAC,GAAG,CAAC,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:
|
|
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,MA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;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;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,sBAAsB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAE3E;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC,CAAA;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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAqCA
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAmC,MAAS;IACtE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -18,7 +18,13 @@ export declare class AutomergeDriver implements CollaborationDriver {
|
|
|
18
18
|
/** Versions = markers over the native history (heads hash). */
|
|
19
19
|
createVersion(docName: string, createdBy: string | null, label: string | null): Promise<CollabVersion>;
|
|
20
20
|
listVersions(docName: string): Promise<CollabVersion[]>;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Restores `versionId` — recording the state it replaces as a new version
|
|
23
|
+
* attributed to `restoredBy`, per the driver contract. Automerge keeps the
|
|
24
|
+
* change history natively, but the *version list* is ours, and a restore
|
|
25
|
+
* that leaves no entry in it is a restore nobody can undo.
|
|
26
|
+
*/
|
|
27
|
+
restoreVersion(docName: string, versionId: string, restoredBy: string | null): Promise<void>;
|
|
22
28
|
diffVersions(docName: string, aId: string, bId: string): Promise<CollabDiffSummary>;
|
|
23
29
|
close(): Promise<void>;
|
|
24
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automerge_driver.d.ts","sourceRoot":"","sources":["../../../../src/drivers/automerge/automerge_driver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"automerge_driver.d.ts","sourceRoot":"","sources":["../../../../src/drivers/automerge/automerge_driver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAEpF,OAA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