@peerbit/log 4.0.64 → 4.0.66-5e3fbc8
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.
|
@@ -6,6 +6,8 @@ import type { EntryType } from "./entry-type.js";
|
|
|
6
6
|
import { type EntryEncryption } from "./entry-v0.js";
|
|
7
7
|
import type { CanAppend, Entry } from "./entry.js";
|
|
8
8
|
import type { SortableEntry } from "./log-sorting.js";
|
|
9
|
+
type Bytes = Uint8Array<ArrayBufferLike>;
|
|
10
|
+
type NormalizeBytes<T> = T extends Uint8Array<any> ? Bytes : T;
|
|
9
11
|
export declare const createEntry: <T>(properties: {
|
|
10
12
|
store: Blocks;
|
|
11
13
|
data: T;
|
|
@@ -22,5 +24,6 @@ export declare const createEntry: <T>(properties: {
|
|
|
22
24
|
encryption?: EntryEncryption;
|
|
23
25
|
identity: Identity;
|
|
24
26
|
signers?: ((data: Uint8Array) => Promise<SignatureWithKey> | SignatureWithKey)[];
|
|
25
|
-
}) => Promise<Entry<T
|
|
27
|
+
}) => Promise<Promise<Entry<NormalizeBytes<T>>>>;
|
|
28
|
+
export {};
|
|
26
29
|
//# sourceMappingURL=entry-create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-create.d.ts","sourceRoot":"","sources":["../../src/entry-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,KAAK,eAAe,EAAW,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,E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,"file":"entry-create.js","sourceRoot":"","sources":["../../src/entry-create.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,OAAO,EAAE,MAAM,eAAe,CAAC;AAS9D,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAK,UAkBpC,EAA8C,EAAE;IAChD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAiB,CAAsC,CAAC;AAC/E,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
2
|
+
"name": "@peerbit/log",
|
|
3
|
+
"version": "4.0.66-5e3fbc8",
|
|
4
|
+
"description": "Append-only log CRDT",
|
|
5
|
+
"author": "dao.xyz",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
"*": {
|
|
12
|
+
"*": [
|
|
13
|
+
"*",
|
|
14
|
+
"dist/*",
|
|
15
|
+
"dist/src/*",
|
|
16
|
+
"dist/src/*/index"
|
|
17
|
+
],
|
|
18
|
+
"src/*": [
|
|
19
|
+
"*",
|
|
20
|
+
"dist/*",
|
|
21
|
+
"dist/src/*",
|
|
22
|
+
"dist/src/*/index"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"dist",
|
|
29
|
+
"!dist/test",
|
|
30
|
+
"!**/*.tsbuildinfo"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/src/index.d.ts",
|
|
35
|
+
"import": "./dist/src/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"eslintConfig": {
|
|
39
|
+
"extends": "peerbit",
|
|
40
|
+
"parserOptions": {
|
|
41
|
+
"project": true,
|
|
42
|
+
"sourceType": "module"
|
|
43
|
+
},
|
|
44
|
+
"ignorePatterns": [
|
|
45
|
+
"!.aegir.js",
|
|
46
|
+
"test/ts-use",
|
|
47
|
+
"*.d.ts"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=16.15.1"
|
|
55
|
+
},
|
|
56
|
+
"keywords": [
|
|
57
|
+
"ipfs",
|
|
58
|
+
"log",
|
|
59
|
+
"crdts",
|
|
60
|
+
"crdt"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@dao-xyz/borsh": "^5.2.3",
|
|
64
|
+
"@peerbit/cache": "2.1.4-5e3fbc8",
|
|
65
|
+
"@peerbit/blocks-interface": "1.4.8-5e3fbc8",
|
|
66
|
+
"@peerbit/crypto": "2.3.11-5e3fbc8",
|
|
67
|
+
"@peerbit/logger": "1.0.3-5e3fbc8",
|
|
68
|
+
"@peerbit/time": "2.2.0-5e3fbc8",
|
|
69
|
+
"libp2p": "^2.8.9",
|
|
70
|
+
"p-queue": "^8.0.1",
|
|
71
|
+
"path-browserify": "^1.0.1",
|
|
72
|
+
"uuid": "^10.0.0",
|
|
73
|
+
"@peerbit/indexer-interface": "2.0.12-5e3fbc8",
|
|
74
|
+
"@peerbit/indexer-simple": "1.1.17-5e3fbc8"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@peerbit/test-utils": "2.1.54-5e3fbc8",
|
|
78
|
+
"@types/yallist": "^4.0.4",
|
|
79
|
+
"assert": "^2.0.0",
|
|
80
|
+
"json-stringify-deterministic": "^1.0.7"
|
|
81
|
+
},
|
|
82
|
+
"contributors": [
|
|
83
|
+
"haadcode",
|
|
84
|
+
"aphelionz",
|
|
85
|
+
"shamb0t",
|
|
86
|
+
"thiagodelgado111",
|
|
87
|
+
"mistakia",
|
|
88
|
+
"satazor",
|
|
89
|
+
"RichardLitt",
|
|
90
|
+
"greenkeeperio-bot",
|
|
91
|
+
"chrisdostert",
|
|
92
|
+
"zachferland",
|
|
93
|
+
"kaibakker",
|
|
94
|
+
"dignifiedquire",
|
|
95
|
+
"adam-palazzo"
|
|
96
|
+
],
|
|
97
|
+
"scripts": {
|
|
98
|
+
"clean": "aegir clean",
|
|
99
|
+
"build": "aegir build --no-bundle",
|
|
100
|
+
"test": "aegir test --target node",
|
|
101
|
+
"lint": "aegir lint"
|
|
102
|
+
},
|
|
103
|
+
"localMaintainers": [
|
|
104
|
+
"dao.xyz"
|
|
105
|
+
]
|
|
106
106
|
}
|
package/src/entry-create.ts
CHANGED
|
@@ -7,6 +7,11 @@ import { type EntryEncryption, EntryV0 } from "./entry-v0.js";
|
|
|
7
7
|
import type { CanAppend, Entry } from "./entry.js";
|
|
8
8
|
import type { SortableEntry } from "./log-sorting.js";
|
|
9
9
|
|
|
10
|
+
type Bytes = Uint8Array<ArrayBufferLike>;
|
|
11
|
+
|
|
12
|
+
// If T is any Uint8Array<…>, normalize to Bytes; otherwise leave T untouched
|
|
13
|
+
type NormalizeBytes<T> = T extends Uint8Array<any> ? Bytes : T;
|
|
14
|
+
|
|
10
15
|
export const createEntry = async <T>(properties: {
|
|
11
16
|
store: Blocks;
|
|
12
17
|
data: T;
|
|
@@ -25,6 +30,6 @@ export const createEntry = async <T>(properties: {
|
|
|
25
30
|
signers?: ((
|
|
26
31
|
data: Uint8Array,
|
|
27
32
|
) => Promise<SignatureWithKey> | SignatureWithKey)[];
|
|
28
|
-
}): Promise<Entry<T
|
|
29
|
-
return EntryV0.create(properties)
|
|
33
|
+
}): Promise<Promise<Entry<NormalizeBytes<T>>>> => {
|
|
34
|
+
return EntryV0.create(properties as any) as Promise<Entry<NormalizeBytes<T>>>;
|
|
30
35
|
};
|