@feathersdev/automerge 0.11.3 → 0.12.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 +20 -0
- package/esm/index.d.ts +4 -4
- package/esm/index.js +1 -1
- package/package.json +7 -7
- package/src/index.test.ts +40 -0
- package/src/index.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.12.0](https://github.com/feathersdev/app/compare/v0.11.4...v0.12.0) (2025-11-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Migrate to D1 ([#301](https://github.com/feathersdev/app/issues/301)) ([049fe52](https://github.com/feathersdev/app/commit/049fe52d22e1aae32c5b82c1618e4e2ff4193123)), closes [#302](https://github.com/feathersdev/app/issues/302) [#303](https://github.com/feathersdev/app/issues/303)
|
|
12
|
+
* Talon Auth ([#317](https://github.com/feathersdev/app/issues/317)) ([090eb19](https://github.com/feathersdev/app/commit/090eb19a26080ab5e1a219e2cbac1de19936541b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.11.4](https://github.com/feathersdev/app/compare/v0.11.3...v0.11.4) (2025-05-28)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @feathersdev/automerge
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [0.11.3](https://github.com/feathersdev/app/compare/v0.11.2...v0.11.3) (2025-05-26)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @feathersdev/automerge
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyDocumentId, StorageAdapterInterface } from '@automerge/automerge-repo';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TalonAuthClient } from 'talon-auth';
|
|
3
3
|
import { Repo } from '@automerge/automerge-repo';
|
|
4
4
|
export * from '@automerge/automerge-repo';
|
|
5
5
|
export interface AutomergeClientOptions {
|
|
@@ -8,10 +8,10 @@ export interface AutomergeClientOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const syncUrl = "https://automerge.feathers.dev";
|
|
10
10
|
export declare class AutomergeClient {
|
|
11
|
-
client:
|
|
11
|
+
client: TalonAuthClient;
|
|
12
12
|
options: AutomergeClientOptions;
|
|
13
13
|
private repo?;
|
|
14
|
-
constructor(client:
|
|
14
|
+
constructor(client: TalonAuthClient, options: AutomergeClientOptions);
|
|
15
15
|
private getDocFromToken;
|
|
16
16
|
connect(): Promise<Repo>;
|
|
17
17
|
/**
|
|
@@ -29,4 +29,4 @@ export declare class AutomergeClient {
|
|
|
29
29
|
* @param client The feathers auth client
|
|
30
30
|
* @returns A new Automerge client instance
|
|
31
31
|
*/
|
|
32
|
-
export declare function createAutomerge(client:
|
|
32
|
+
export declare function createAutomerge(client: TalonAuthClient, options?: Partial<AutomergeClientOptions>): AutomergeClient;
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Repo } from '@automerge/automerge-repo';
|
|
2
2
|
import { BrowserWebSocketClientAdapter } from '@automerge/automerge-repo-network-websocket';
|
|
3
3
|
import { IndexedDBStorageAdapter } from '@automerge/automerge-repo-storage-indexeddb';
|
|
4
|
-
import { verifyToken } from '
|
|
4
|
+
import { verifyToken } from 'talon-auth/internals';
|
|
5
5
|
export * from '@automerge/automerge-repo';
|
|
6
6
|
export const syncUrl = 'https://automerge.feathers.dev';
|
|
7
7
|
export class AutomergeClient {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersdev/automerge",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"description": "Feathers local-first data synchronization using Automerge",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Feathers Cloud Inc.",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"lib": "lib"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@automerge/automerge-repo": "^
|
|
46
|
-
"@automerge/automerge-repo-network-websocket": "^
|
|
47
|
-
"@automerge/automerge-repo-storage-indexeddb": "^
|
|
48
|
-
"
|
|
45
|
+
"@automerge/automerge-repo": "^2.3.1",
|
|
46
|
+
"@automerge/automerge-repo-network-websocket": "^2.3.1",
|
|
47
|
+
"@automerge/automerge-repo-storage-indexeddb": "^2.3.1",
|
|
48
|
+
"talon-auth": "0.12.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@vitest/browser": "^3.
|
|
51
|
+
"@vitest/browser": "^3.2.4"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "40136b6e7837a28a5d894a1028c0144e987a4cb9"
|
|
54
54
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Chunk, StorageAdapterInterface, StorageKey } from './index.js'
|
|
2
|
+
import assert from 'node:assert'
|
|
3
|
+
import { createClient, createMemoryStore } from 'talon-auth'
|
|
4
|
+
import { describe, it } from 'vitest'
|
|
5
|
+
import { createAutomerge } from './index.js'
|
|
6
|
+
|
|
7
|
+
class DummyStorageAdapter implements StorageAdapterInterface {
|
|
8
|
+
load(_key: StorageKey): Promise<Uint8Array | undefined> {
|
|
9
|
+
throw new Error('Method not implemented.')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
save(_key: StorageKey, _data: Uint8Array): Promise<void> {
|
|
13
|
+
throw new Error('Method not implemented.')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
remove(_key: StorageKey): Promise<void> {
|
|
17
|
+
throw new Error('Method not implemented.')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
loadRange(_keyPrefix: StorageKey): Promise<Chunk[]> {
|
|
21
|
+
throw new Error('Method not implemented.')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
removeRange(_keyPrefix: StorageKey): Promise<void> {
|
|
25
|
+
throw new Error('Method not implemented.')
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('@feathersdev/automerge', () => {
|
|
30
|
+
it('creates a client', () => {
|
|
31
|
+
const authClient = createClient({
|
|
32
|
+
appId: 'did:test',
|
|
33
|
+
store: createMemoryStore(),
|
|
34
|
+
})
|
|
35
|
+
const client = createAutomerge(authClient, {
|
|
36
|
+
storage: new DummyStorageAdapter(),
|
|
37
|
+
})
|
|
38
|
+
assert.ok(client)
|
|
39
|
+
})
|
|
40
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AnyDocumentId, StorageAdapterInterface } from '@automerge/automerge-repo'
|
|
2
|
-
import type {
|
|
2
|
+
import type { TalonAuthClient } from 'talon-auth'
|
|
3
3
|
import { Repo } from '@automerge/automerge-repo'
|
|
4
4
|
import { BrowserWebSocketClientAdapter } from '@automerge/automerge-repo-network-websocket'
|
|
5
5
|
import { IndexedDBStorageAdapter } from '@automerge/automerge-repo-storage-indexeddb'
|
|
6
|
-
import { verifyToken } from '
|
|
6
|
+
import { verifyToken } from 'talon-auth/internals'
|
|
7
7
|
|
|
8
8
|
export * from '@automerge/automerge-repo'
|
|
9
9
|
|
|
@@ -18,9 +18,9 @@ export class AutomergeClient {
|
|
|
18
18
|
private repo?: Repo
|
|
19
19
|
|
|
20
20
|
constructor(
|
|
21
|
-
public client:
|
|
21
|
+
public client: TalonAuthClient,
|
|
22
22
|
public options: AutomergeClientOptions,
|
|
23
|
-
) {}
|
|
23
|
+
) { }
|
|
24
24
|
|
|
25
25
|
private async getDocFromToken() {
|
|
26
26
|
const getAccessToken = await this.client.getAccessToken()
|
|
@@ -69,7 +69,7 @@ export class AutomergeClient {
|
|
|
69
69
|
* @param client The feathers auth client
|
|
70
70
|
* @returns A new Automerge client instance
|
|
71
71
|
*/
|
|
72
|
-
export function createAutomerge(client:
|
|
72
|
+
export function createAutomerge(client: TalonAuthClient, options?: Partial<AutomergeClientOptions>) {
|
|
73
73
|
const storage = options?.storage ?? new IndexedDBStorageAdapter()
|
|
74
74
|
|
|
75
75
|
return new AutomergeClient(client, {
|