@libp2p/record 2.0.2 → 2.0.3
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/record.d.ts.map +1 -1
- package/dist/src/record.js +14 -30
- package/dist/src/record.js.map +1 -1
- package/package.json +5 -5
- package/src/record.ts +14 -30
package/dist/src/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,yBAAiB,MAAM,CAAC;IAGf,MAAM,KAAK,QAAO,MAAM,MAAM,CA0DpC,CAAA;IAEM,MAAM,MAAM,QAAS,MAAM,KAAG,UAEpC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,MAEzD,CAAA;CACF"}
|
package/dist/src/record.js
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable complexity */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
3
5
|
import { encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
4
6
|
export var Record;
|
|
5
7
|
(function (Record) {
|
|
6
8
|
let _codec;
|
|
7
9
|
Record.codec = () => {
|
|
8
10
|
if (_codec == null) {
|
|
9
|
-
_codec = message((obj,
|
|
11
|
+
_codec = message((obj, w, opts = {}) => {
|
|
10
12
|
if (opts.lengthDelimited !== false) {
|
|
11
|
-
|
|
13
|
+
w.fork();
|
|
12
14
|
}
|
|
13
|
-
if (obj.key != null) {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
if (opts.writeDefaults === true || (obj.key != null && obj.key.byteLength > 0)) {
|
|
16
|
+
w.uint32(10);
|
|
17
|
+
w.bytes(obj.key);
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
if (opts.writeDefaults === true || (obj.value != null && obj.value.byteLength > 0)) {
|
|
20
|
+
w.uint32(18);
|
|
21
|
+
w.bytes(obj.value);
|
|
19
22
|
}
|
|
20
|
-
if (obj.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw new Error('Protocol error: required field "value" was not found in object');
|
|
26
|
-
}
|
|
27
|
-
if (obj.timeReceived != null) {
|
|
28
|
-
writer.uint32(42);
|
|
29
|
-
writer.string(obj.timeReceived);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw new Error('Protocol error: required field "timeReceived" was not found in object');
|
|
23
|
+
if (opts.writeDefaults === true || obj.timeReceived !== '') {
|
|
24
|
+
w.uint32(42);
|
|
25
|
+
w.string(obj.timeReceived);
|
|
33
26
|
}
|
|
34
27
|
if (opts.lengthDelimited !== false) {
|
|
35
|
-
|
|
28
|
+
w.ldelim();
|
|
36
29
|
}
|
|
37
30
|
}, (reader, length) => {
|
|
38
31
|
const obj = {
|
|
@@ -58,15 +51,6 @@ export var Record;
|
|
|
58
51
|
break;
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
|
-
if (obj.key == null) {
|
|
62
|
-
throw new Error('Protocol error: value for required field "key" was not found in protobuf');
|
|
63
|
-
}
|
|
64
|
-
if (obj.value == null) {
|
|
65
|
-
throw new Error('Protocol error: value for required field "value" was not found in protobuf');
|
|
66
|
-
}
|
|
67
|
-
if (obj.timeReceived == null) {
|
|
68
|
-
throw new Error('Protocol error: value for required field "timeReceived" was not found in protobuf');
|
|
69
|
-
}
|
|
70
54
|
return obj;
|
|
71
55
|
});
|
|
72
56
|
}
|
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;
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/record.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+BAA+B;AAC/B,oDAAoD;AACpD,8EAA8E;AAE9E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAUvE,MAAM,KAAW,MAAM,CAsEtB;AAtED,WAAiB,MAAM;IACrB,IAAI,MAAqB,CAAA;IAEZ,YAAK,GAAG,GAAkB,EAAE;QACvC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,OAAO,CAAS,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;gBAC7C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;oBAClC,CAAC,CAAC,IAAI,EAAE,CAAA;iBACT;gBAED,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE;oBAC9E,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBACZ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;iBACjB;gBAED,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE;oBAClF,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,C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ACF;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAC,CAAA;SACH;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAEY,aAAM,GAAG,CAAC,GAAW,EAAc,EAAE;QAChD,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,EAtEgB,MAAM,KAAN,MAAM,QAsEtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/record",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "libp2p record implementation",
|
|
5
5
|
"author": "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -168,14 +168,14 @@
|
|
|
168
168
|
"dependencies": {
|
|
169
169
|
"@libp2p/interface-dht": "^1.0.0",
|
|
170
170
|
"err-code": "^3.0.1",
|
|
171
|
-
"multiformats": "^
|
|
172
|
-
"protons-runtime": "^
|
|
171
|
+
"multiformats": "^10.0.0",
|
|
172
|
+
"protons-runtime": "^4.0.1",
|
|
173
173
|
"uint8arraylist": "^2.1.1",
|
|
174
|
-
"uint8arrays": "^
|
|
174
|
+
"uint8arrays": "^4.0.2"
|
|
175
175
|
},
|
|
176
176
|
"devDependencies": {
|
|
177
177
|
"@libp2p/crypto": "^1.0.2",
|
|
178
178
|
"aegir": "^37.0.13",
|
|
179
|
-
"protons": "^
|
|
179
|
+
"protons": "^6.0.0"
|
|
180
180
|
}
|
|
181
181
|
}
|
package/src/record.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable complexity */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
3
5
|
|
|
4
6
|
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
5
7
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
@@ -16,34 +18,28 @@ export namespace Record {
|
|
|
16
18
|
|
|
17
19
|
export const codec = (): Codec<Record> => {
|
|
18
20
|
if (_codec == null) {
|
|
19
|
-
_codec = message<Record>((obj,
|
|
21
|
+
_codec = message<Record>((obj, w, opts = {}) => {
|
|
20
22
|
if (opts.lengthDelimited !== false) {
|
|
21
|
-
|
|
23
|
+
w.fork()
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
if (obj.key != null) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} else {
|
|
28
|
-
throw new Error('Protocol error: required field "key" was not found in object')
|
|
26
|
+
if (opts.writeDefaults === true || (obj.key != null && obj.key.byteLength > 0)) {
|
|
27
|
+
w.uint32(10)
|
|
28
|
+
w.bytes(obj.key)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if (obj.value != null) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} else {
|
|
35
|
-
throw new Error('Protocol error: required field "value" was not found in object')
|
|
31
|
+
if (opts.writeDefaults === true || (obj.value != null && obj.value.byteLength > 0)) {
|
|
32
|
+
w.uint32(18)
|
|
33
|
+
w.bytes(obj.value)
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
if (obj.timeReceived
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error('Protocol error: required field "timeReceived" was not found in object')
|
|
36
|
+
if (opts.writeDefaults === true || obj.timeReceived !== '') {
|
|
37
|
+
w.uint32(42)
|
|
38
|
+
w.string(obj.timeReceived)
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
if (opts.lengthDelimited !== false) {
|
|
46
|
-
|
|
42
|
+
w.ldelim()
|
|
47
43
|
}
|
|
48
44
|
}, (reader, length) => {
|
|
49
45
|
const obj: any = {
|
|
@@ -73,18 +69,6 @@ export namespace Record {
|
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
if (obj.key == null) {
|
|
77
|
-
throw new Error('Protocol error: value for required field "key" was not found in protobuf')
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (obj.value == null) {
|
|
81
|
-
throw new Error('Protocol error: value for required field "value" was not found in protobuf')
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (obj.timeReceived == null) {
|
|
85
|
-
throw new Error('Protocol error: value for required field "timeReceived" was not found in protobuf')
|
|
86
|
-
}
|
|
87
|
-
|
|
88
72
|
return obj
|
|
89
73
|
})
|
|
90
74
|
}
|