@feathersdev/automerge 0.11.4 → 0.13.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.
- package/CHANGELOG.md +14 -11
- package/esm/index.d.ts +4 -4
- package/esm/index.js +1 -1
- package/package.json +9 -9
- package/src/index.test.ts +40 -0
- package/src/index.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,36 +3,39 @@
|
|
|
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.
|
|
6
|
+
## [0.13.1](https://github.com/feathersdev/app/compare/v0.13.0...v0.13.1) (2026-02-21)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @feathersdev/automerge
|
|
9
9
|
|
|
10
|
+
# [0.13.0](https://github.com/feathersdev/app/compare/v0.12.0...v0.13.0) (2026-02-21)
|
|
10
11
|
|
|
12
|
+
### Bug Fixes
|
|
11
13
|
|
|
14
|
+
- Fix build scripts and tests passing ([#347](https://github.com/feathersdev/app/issues/347)) ([ea2de04](https://github.com/feathersdev/app/commit/ea2de0409d6ceb5cbf8355bf65c0bd5aea927e22))
|
|
12
15
|
|
|
16
|
+
# [0.12.0](https://github.com/feathersdev/app/compare/v0.11.4...v0.12.0) (2025-11-04)
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
### Features
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
- 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)
|
|
21
|
+
- Talon Auth ([#317](https://github.com/feathersdev/app/issues/317)) ([090eb19](https://github.com/feathersdev/app/commit/090eb19a26080ab5e1a219e2cbac1de19936541b))
|
|
17
22
|
|
|
23
|
+
## [0.11.4](https://github.com/feathersdev/app/compare/v0.11.3...v0.11.4) (2025-05-28)
|
|
18
24
|
|
|
25
|
+
**Note:** Version bump only for package @feathersdev/automerge
|
|
19
26
|
|
|
27
|
+
## [0.11.3](https://github.com/feathersdev/app/compare/v0.11.2...v0.11.3) (2025-05-26)
|
|
20
28
|
|
|
29
|
+
**Note:** Version bump only for package @feathersdev/automerge
|
|
21
30
|
|
|
22
31
|
## [0.11.2](https://github.com/feathersdev/app/compare/v0.11.1...v0.11.2) (2025-05-26)
|
|
23
32
|
|
|
24
|
-
|
|
25
33
|
### Bug Fixes
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
- Move to automerge.feathers.dev ([#286](https://github.com/feathersdev/app/issues/286)) ([c4bf48a](https://github.com/feathersdev/app/commit/c4bf48a9c845f1738067328c835133205b02fc0e))
|
|
32
36
|
|
|
33
37
|
# [0.11.0](https://github.com/feathersdev/app/compare/v0.10.1...v0.11.0) (2025-05-25)
|
|
34
38
|
|
|
35
|
-
|
|
36
39
|
### Features
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
- Basic Automerge feature integration ([#275](https://github.com/feathersdev/app/issues/275)) ([3ccc80c](https://github.com/feathersdev/app/commit/3ccc80cdd02db52fc32d7e1566b844ef211c2c0f))
|
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.13.1",
|
|
5
5
|
"description": "Feathers local-first data synchronization using Automerge",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Feathers Cloud Inc.",
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"node": ">= 18"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"prepublish": "pnpm
|
|
39
|
-
"
|
|
38
|
+
"prepublish": "pnpm build",
|
|
39
|
+
"build": "shx rm -rf esm/ && npx tsc --outDir esm/"
|
|
40
40
|
},
|
|
41
41
|
"directories": {
|
|
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.5.3",
|
|
46
|
+
"@automerge/automerge-repo-network-websocket": "^2.5.3",
|
|
47
|
+
"@automerge/automerge-repo-storage-indexeddb": "^2.5.3",
|
|
48
|
+
"talon-auth": "^0.13.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@vitest/browser": "^3.
|
|
51
|
+
"@vitest/browser": "^3.2.4"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "05917231b2ce1b808f6955cf082ef8588252ecf3"
|
|
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,8 +18,8 @@ export class AutomergeClient {
|
|
|
18
18
|
private repo?: Repo
|
|
19
19
|
|
|
20
20
|
constructor(
|
|
21
|
-
public client:
|
|
22
|
-
public options: AutomergeClientOptions
|
|
21
|
+
public client: TalonAuthClient,
|
|
22
|
+
public options: AutomergeClientOptions
|
|
23
23
|
) {}
|
|
24
24
|
|
|
25
25
|
private async getDocFromToken() {
|
|
@@ -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, {
|