@libp2p/record 2.0.0 → 2.0.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/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/record.d.ts +3 -2
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js.map +1 -1
- package/package.json +13 -8
- package/src/index.ts +2 -1
- package/src/record.ts +3 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
1
2
|
import { Record } from './record.js';
|
|
2
3
|
export declare class Libp2pRecord {
|
|
3
4
|
key: Uint8Array;
|
|
4
5
|
value: Uint8Array;
|
|
5
6
|
timeReceived: Date;
|
|
6
7
|
constructor(key: Uint8Array, value: Uint8Array, timeReceived: Date);
|
|
7
|
-
serialize():
|
|
8
|
+
serialize(): Uint8ArrayList;
|
|
8
9
|
/**
|
|
9
10
|
* Return the object format ready to be given to the protobuf library.
|
|
10
11
|
*/
|
|
@@ -16,7 +17,7 @@ export declare class Libp2pRecord {
|
|
|
16
17
|
/**
|
|
17
18
|
* Decode a protobuf encoded record
|
|
18
19
|
*/
|
|
19
|
-
static deserialize(raw: Uint8Array): Libp2pRecord;
|
|
20
|
+
static deserialize(raw: Uint8Array | Uint8ArrayList): Libp2pRecord;
|
|
20
21
|
/**
|
|
21
22
|
* Create a record from the raw object returned from the protobuf library
|
|
22
23
|
*/
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AAGpB,qBAAa,YAAY;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,IAAI,CAAA;gBAEZ,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI;IAcnE,SAAS;IAIT;;OAEG;IACH,gBAAgB;;;;;IAQhB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAG,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AAGpB,qBAAa,YAAY;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,IAAI,CAAA;gBAEZ,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI;IAcnE,SAAS;IAIT;;OAEG;IACH,gBAAgB;;;;;IAQhB;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAG,EAAE,UAAU,GAAG,cAAc;IAMpD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAE,GAAG,EAAE,MAAM;CAiBrC"}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,MAAM,OAAO,YAAY;IAKvB,YAAa,GAAe,EAAE,KAAiB,EAAE,YAAkB;QACjE,IAAI,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;SAC5C;QAED,IAAI,CAAC,CAAC,KAAK,YAAY,UA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;IACZ,CAAC;CACF"}
|
package/dist/src/record.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Codec } from 'protons-runtime';
|
|
2
|
+
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
2
3
|
export interface Record {
|
|
3
4
|
key: Uint8Array;
|
|
4
5
|
value: Uint8Array;
|
|
@@ -6,7 +7,7 @@ export interface Record {
|
|
|
6
7
|
}
|
|
7
8
|
export declare namespace Record {
|
|
8
9
|
const codec: () => Codec<Record>;
|
|
9
|
-
const encode: (obj: Record) =>
|
|
10
|
-
const decode: (buf: Uint8Array) => Record;
|
|
10
|
+
const encode: (obj: Record) => Uint8ArrayList;
|
|
11
|
+
const decode: (buf: Uint8Array | Uint8ArrayList) => Record;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=record.d.ts.map
|
package/dist/src/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,yBAAiB,MAAM,CAAC;IACf,MAAM,KAAK,QAAO,MAAM,MAAM,CAMpC,CAAA;IAEM,MAAM,MAAM,QAAS,MAAM,KAAG,cAEpC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,MAEzD,CAAA;CACF"}
|
package/dist/src/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAUtF,MAAM,KAAW,MAAM,CAgBtB;AAhBD,WAAiB,MAAM;IACR,YAAK,GAAG,GAAkB,EAAE;QACvC,OAAO,OAAO,CAAS;YACrB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YAChC,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;YAClC,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE;SAC3C,CAAC,CAAA;IACJ,CAAC,CAAA;IAEY,aAAM,GAAG,CAAC,GAAW,EAAkB,EAAE;QACpD,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IAC3C,CAAC,CAAA;IAEY,aAAM,GAAG,CAAC,GAAgC,EAAU,EAAE;QACjE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;IAC3C,CAAC,CAAA;AACH,CAAC,EAhBgB,MAAM,KAAN,MAAM,QAgBtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/record",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "libp2p record implementation",
|
|
5
5
|
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -93,15 +93,15 @@
|
|
|
93
93
|
"release": "patch"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
"type": "
|
|
96
|
+
"type": "docs",
|
|
97
97
|
"release": "patch"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"type": "
|
|
100
|
+
"type": "test",
|
|
101
101
|
"release": "patch"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
"type": "
|
|
104
|
+
"type": "deps",
|
|
105
105
|
"release": "patch"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
@@ -131,7 +131,11 @@
|
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
"type": "docs",
|
|
134
|
-
"section": "
|
|
134
|
+
"section": "Documentation"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"type": "deps",
|
|
138
|
+
"section": "Dependencies"
|
|
135
139
|
},
|
|
136
140
|
{
|
|
137
141
|
"type": "test",
|
|
@@ -165,12 +169,13 @@
|
|
|
165
169
|
"@libp2p/interface-dht": "^1.0.0",
|
|
166
170
|
"err-code": "^3.0.1",
|
|
167
171
|
"multiformats": "^9.4.5",
|
|
168
|
-
"protons-runtime": "^
|
|
172
|
+
"protons-runtime": "^2.0.2",
|
|
173
|
+
"uint8arraylist": "^2.1.1",
|
|
169
174
|
"uint8arrays": "^3.0.0"
|
|
170
175
|
},
|
|
171
176
|
"devDependencies": {
|
|
172
|
-
"@libp2p/crypto": "^0.
|
|
177
|
+
"@libp2p/crypto": "^1.0.2",
|
|
173
178
|
"aegir": "^37.0.13",
|
|
174
|
-
"protons": "^
|
|
179
|
+
"protons": "^4.0.1"
|
|
175
180
|
}
|
|
176
181
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
1
2
|
import {
|
|
2
3
|
Record
|
|
3
4
|
} from './record.js'
|
|
@@ -40,7 +41,7 @@ export class Libp2pRecord {
|
|
|
40
41
|
/**
|
|
41
42
|
* Decode a protobuf encoded record
|
|
42
43
|
*/
|
|
43
|
-
static deserialize (raw: Uint8Array) {
|
|
44
|
+
static deserialize (raw: Uint8Array | Uint8ArrayList) {
|
|
44
45
|
const rec = Record.decode(raw)
|
|
45
46
|
|
|
46
47
|
return new Libp2pRecord(rec.key, rec.value, new Date(rec.timeReceived))
|
package/src/record.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { encodeMessage, decodeMessage, message, bytes, string } from 'protons-runtime'
|
|
5
5
|
import type { Codec } from 'protons-runtime'
|
|
6
|
+
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
6
7
|
|
|
7
8
|
export interface Record {
|
|
8
9
|
key: Uint8Array
|
|
@@ -19,11 +20,11 @@ export namespace Record {
|
|
|
19
20
|
})
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export const encode = (obj: Record):
|
|
23
|
+
export const encode = (obj: Record): Uint8ArrayList => {
|
|
23
24
|
return encodeMessage(obj, Record.codec())
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export const decode = (buf: Uint8Array): Record => {
|
|
27
|
+
export const decode = (buf: Uint8Array | Uint8ArrayList): Record => {
|
|
27
28
|
return decodeMessage(buf, Record.codec())
|
|
28
29
|
}
|
|
29
30
|
}
|