@thi.ng/csp 2.1.8 → 2.1.11
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 +1 -1
- package/channel.js +11 -11
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
package/channel.js
CHANGED
|
@@ -61,7 +61,7 @@ export class Channel {
|
|
|
61
61
|
this.txbuf = new DCons();
|
|
62
62
|
this.tx = tx ? tx(Channel.RFN) : null;
|
|
63
63
|
this.onerror = tx && (err || defaultErrorHandler);
|
|
64
|
-
this.state = 0 /* OPEN */;
|
|
64
|
+
this.state = 0 /* State.OPEN */;
|
|
65
65
|
this.isBusy = false;
|
|
66
66
|
}
|
|
67
67
|
static constantly(x, delay) {
|
|
@@ -268,7 +268,7 @@ export class Channel {
|
|
|
268
268
|
}
|
|
269
269
|
write(value) {
|
|
270
270
|
return new Promise((resolve) => {
|
|
271
|
-
if (this.state !== 0 /* OPEN */) {
|
|
271
|
+
if (this.state !== 0 /* State.OPEN */) {
|
|
272
272
|
resolve(false);
|
|
273
273
|
}
|
|
274
274
|
if (this.writes.length < Channel.MAX_WRITES) {
|
|
@@ -277,7 +277,7 @@ export class Channel {
|
|
|
277
277
|
? async () => {
|
|
278
278
|
try {
|
|
279
279
|
if (isReduced(this.tx[2](this.txbuf, value))) {
|
|
280
|
-
this.state = 1 /* CLOSED */;
|
|
280
|
+
this.state = 1 /* State.CLOSED */;
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
catch (e) {
|
|
@@ -296,7 +296,7 @@ export class Channel {
|
|
|
296
296
|
}
|
|
297
297
|
read() {
|
|
298
298
|
return new Promise((resolve) => {
|
|
299
|
-
if (this.state === 2 /* DONE */) {
|
|
299
|
+
if (this.state === 2 /* State.DONE */) {
|
|
300
300
|
resolve(undefined);
|
|
301
301
|
}
|
|
302
302
|
this.reads.push(resolve);
|
|
@@ -309,17 +309,17 @@ export class Channel {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
close(flush = false) {
|
|
312
|
-
if (this.state === 0 /* OPEN */) {
|
|
313
|
-
this.state = 1 /* CLOSED */;
|
|
312
|
+
if (this.state === 0 /* State.OPEN */) {
|
|
313
|
+
this.state = 1 /* State.CLOSED */;
|
|
314
314
|
flush && this.flush();
|
|
315
315
|
return this.process();
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
isClosed() {
|
|
319
|
-
return this.state !== 0 /* OPEN */;
|
|
319
|
+
return this.state !== 0 /* State.OPEN */;
|
|
320
320
|
}
|
|
321
321
|
isReadable() {
|
|
322
|
-
return ((this.state !== 2 /* DONE */ && this.buf && this.buf.length > 0) ||
|
|
322
|
+
return ((this.state !== 2 /* State.DONE */ && this.buf && this.buf.length > 0) ||
|
|
323
323
|
(this.writes && this.writes.length > 0) ||
|
|
324
324
|
(this.txbuf && this.txbuf.length > 0));
|
|
325
325
|
}
|
|
@@ -419,8 +419,8 @@ export class Channel {
|
|
|
419
419
|
})();
|
|
420
420
|
}
|
|
421
421
|
release() {
|
|
422
|
-
if (this.state === 1 /* CLOSED */) {
|
|
423
|
-
this.state = 2 /* DONE */;
|
|
422
|
+
if (this.state === 1 /* State.CLOSED */) {
|
|
423
|
+
this.state = 2 /* State.DONE */;
|
|
424
424
|
this.flush();
|
|
425
425
|
this.buf.release();
|
|
426
426
|
delete this.reads;
|
|
@@ -457,7 +457,7 @@ export class Channel {
|
|
|
457
457
|
buf.push(put);
|
|
458
458
|
put.resolve(true);
|
|
459
459
|
}
|
|
460
|
-
if (this.state === 1 /* CLOSED */) {
|
|
460
|
+
if (this.state === 1 /* State.CLOSED */) {
|
|
461
461
|
if (this.tx && !writes.length) {
|
|
462
462
|
try {
|
|
463
463
|
// finalize/complete transducer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/csp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"description": "ES6 promise based CSP primitives & operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,20 +38,20 @@
|
|
|
38
38
|
"testnode": "tsc -p test && node build/test/node.js"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.3.
|
|
42
|
-
"@thi.ng/arrays": "^2.
|
|
43
|
-
"@thi.ng/checks": "^3.1
|
|
44
|
-
"@thi.ng/dcons": "^3.2.
|
|
45
|
-
"@thi.ng/errors": "^2.1.
|
|
46
|
-
"@thi.ng/transducers": "^8.3.
|
|
41
|
+
"@thi.ng/api": "^8.3.7",
|
|
42
|
+
"@thi.ng/arrays": "^2.3.0",
|
|
43
|
+
"@thi.ng/checks": "^3.2.1",
|
|
44
|
+
"@thi.ng/dcons": "^3.2.6",
|
|
45
|
+
"@thi.ng/errors": "^2.1.7",
|
|
46
|
+
"@thi.ng/transducers": "^8.3.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@microsoft/api-extractor": "^7.
|
|
50
|
-
"@thi.ng/testament": "^0.2.
|
|
49
|
+
"@microsoft/api-extractor": "^7.25.0",
|
|
50
|
+
"@thi.ng/testament": "^0.2.8",
|
|
51
51
|
"rimraf": "^3.0.2",
|
|
52
52
|
"tools": "^0.0.1",
|
|
53
|
-
"typedoc": "^0.22.
|
|
54
|
-
"typescript": "^4.
|
|
53
|
+
"typedoc": "^0.22.17",
|
|
54
|
+
"typescript": "^4.7.3"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"async",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"status": "deprecated",
|
|
103
103
|
"year": 2016
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "e64b1ab39ae9bcc494ef006f6329e5182fa2a326\n"
|
|
106
106
|
}
|