@thi.ng/rstream-csp 3.1.84 → 3.1.86
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/index.js +25 -29
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import { LOGGER } from "@thi.ng/rstream/logger";
|
|
2
2
|
import { Stream } from "@thi.ng/rstream/stream";
|
|
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
|
-
isActive = false;
|
|
30
|
-
};
|
|
31
|
-
}, opts);
|
|
3
|
+
const fromChannel = (src, opts) => {
|
|
4
|
+
opts = { id: `channel-${src.id}`, closeChannel: true, ...opts };
|
|
5
|
+
return new Stream((stream) => {
|
|
6
|
+
let isActive = true;
|
|
7
|
+
(async () => {
|
|
8
|
+
let x;
|
|
9
|
+
while ((x = null, x = await src.read()) !== void 0) {
|
|
10
|
+
if (x === void 0 || !isActive) {
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
stream.next(x);
|
|
14
|
+
}
|
|
15
|
+
stream.done();
|
|
16
|
+
})();
|
|
17
|
+
return () => {
|
|
18
|
+
if (opts.closeChannel !== false) {
|
|
19
|
+
src.close(true);
|
|
20
|
+
LOGGER.info("closed channel", src.id);
|
|
21
|
+
}
|
|
22
|
+
isActive = false;
|
|
23
|
+
};
|
|
24
|
+
}, opts);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
fromChannel
|
|
32
28
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream-csp",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.86",
|
|
4
4
|
"description": "@thi.ng/csp bridge module for @thi.ng/rstream",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn
|
|
27
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
28
30
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
29
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
@@ -33,12 +35,12 @@
|
|
|
33
35
|
"test": "bun test"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@thi.ng/csp": "^2.1.
|
|
37
|
-
"@thi.ng/rstream": "^8.2.
|
|
38
|
+
"@thi.ng/csp": "^2.1.82",
|
|
39
|
+
"@thi.ng/rstream": "^8.2.14"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@microsoft/api-extractor": "^7.38.3",
|
|
41
|
-
"
|
|
43
|
+
"esbuild": "^0.19.8",
|
|
42
44
|
"rimraf": "^5.0.5",
|
|
43
45
|
"tools": "^0.0.1",
|
|
44
46
|
"typedoc": "^0.25.4",
|
|
@@ -75,5 +77,5 @@
|
|
|
75
77
|
],
|
|
76
78
|
"year": 2018
|
|
77
79
|
},
|
|
78
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
|
|
79
81
|
}
|