@push.rocks/smartstream 3.0.34 → 3.0.35

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.
@@ -0,0 +1 @@
1
+ console.log('Hello from deno');
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartstream',
6
- version: '3.0.34',
6
+ version: '3.0.35',
7
7
  description: 'simplifies access to node streams'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLG1DQUFtQztDQUNqRCxDQUFBIn0=
@@ -2,3 +2,5 @@ export * from './smartstream.classes.smartduplex.js';
2
2
  export * from './smartstream.classes.streamwrapper.js';
3
3
  export * from './smartstream.classes.streamintake.js';
4
4
  export * from './smartstream.functions.js';
5
+ import * as plugins from './smartstream.plugins.js';
6
+ export declare const webstream: typeof plugins.webstream;
package/dist_ts/index.js CHANGED
@@ -2,4 +2,6 @@ export * from './smartstream.classes.smartduplex.js';
2
2
  export * from './smartstream.classes.streamwrapper.js';
3
3
  export * from './smartstream.classes.streamintake.js';
4
4
  export * from './smartstream.functions.js';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsd0NBQXdDLENBQUM7QUFDdkQsY0FBYyx1Q0FBdUMsQ0FBQztBQUV0RCxjQUFjLDRCQUE0QixDQUFBIn0=
5
+ import * as plugins from './smartstream.plugins.js';
6
+ export const webstream = plugins.webstream;
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsd0NBQXdDLENBQUM7QUFDdkQsY0FBYyx1Q0FBdUMsQ0FBQztBQUV0RCxjQUFjLDRCQUE0QixDQUFDO0FBRTNDLE9BQU8sS0FBSyxPQUFPLE1BQU0sMEJBQTBCLENBQUM7QUFDcEQsTUFBTSxDQUFDLE1BQU0sU0FBUyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMifQ==
@@ -4,4 +4,5 @@ export { stream };
4
4
  import * as lik from '@push.rocks/lik';
5
5
  import * as smartpromise from '@push.rocks/smartpromise';
6
6
  import * as smartrx from '@push.rocks/smartrx';
7
- export { lik, smartpromise, smartrx };
7
+ import * as webstream from '@push.rocks/webstream';
8
+ export { lik, smartpromise, smartrx, webstream };
@@ -5,5 +5,6 @@ export { stream };
5
5
  import * as lik from '@push.rocks/lik';
6
6
  import * as smartpromise from '@push.rocks/smartpromise';
7
7
  import * as smartrx from '@push.rocks/smartrx';
8
- export { lik, smartpromise, smartrx };
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJlYW0ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyZWFtLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYztBQUNkLE9BQU8sS0FBSyxNQUFNLE1BQU0sUUFBUSxDQUFDO0FBRWpDLE9BQU8sRUFBRSxNQUFNLEVBQUUsQ0FBQztBQUVsQixrQkFBa0I7QUFDbEIsT0FBTyxLQUFLLEdBQUcsTUFBTSxpQkFBaUIsQ0FBQztBQUN2QyxPQUFPLEtBQUssWUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxPQUFPLE1BQU0scUJBQXFCLENBQUM7QUFFL0MsT0FBTyxFQUFFLEdBQUcsRUFBRSxZQUFZLEVBQUUsT0FBTyxFQUFFLENBQUMifQ==
8
+ import * as webstream from '@push.rocks/webstream';
9
+ export { lik, smartpromise, smartrx, webstream };
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJlYW0ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyZWFtLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYztBQUNkLE9BQU8sS0FBSyxNQUFNLE1BQU0sUUFBUSxDQUFDO0FBRWpDLE9BQU8sRUFBRSxNQUFNLEVBQUUsQ0FBQztBQUVsQixrQkFBa0I7QUFDbEIsT0FBTyxLQUFLLEdBQUcsTUFBTSxpQkFBaUIsQ0FBQztBQUN2QyxPQUFPLEtBQUssWUFBWSxNQUFNLDBCQUEwQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxPQUFPLE1BQU0scUJBQXFCLENBQUM7QUFDL0MsT0FBTyxLQUFLLFNBQVMsTUFBTSx1QkFBdUIsQ0FBQztBQUVuRCxPQUFPLEVBQUUsR0FBRyxFQUFFLFlBQVksRUFBRSxPQUFPLEVBQUUsU0FBUyxFQUFFLENBQUMifQ==
package/npmextra.json CHANGED
@@ -6,12 +6,34 @@
6
6
  "gitzone": {
7
7
  "projectType": "npm",
8
8
  "module": {
9
- "githost": "gitlab.com",
9
+ "githost": "code.foss.global",
10
10
  "gitscope": "push.rocks",
11
11
  "gitrepo": "smartstream",
12
12
  "description": "simplifies access to node streams",
13
13
  "npmPackagename": "@push.rocks/smartstream",
14
- "license": "MIT"
14
+ "license": "MIT",
15
+ "keywords": [
16
+ "node.js",
17
+ "streams",
18
+ "stream manipulation",
19
+ "pipeline",
20
+ "data processing",
21
+ "async transformation",
22
+ "event handling",
23
+ "backpressure management",
24
+ "readable streams",
25
+ "writable streams",
26
+ "duplex streams",
27
+ "transform streams",
28
+ "file streaming",
29
+ "buffer streams",
30
+ "stream utilities",
31
+ "stream intake",
32
+ "stream output"
33
+ ]
15
34
  }
35
+ },
36
+ "tsdoc": {
37
+ "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
16
38
  }
17
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartstream",
3
- "version": "3.0.34",
3
+ "version": "3.0.35",
4
4
  "private": false,
5
5
  "description": "simplifies access to node streams",
6
6
  "main": "dist_ts/index.js",
@@ -27,7 +27,8 @@
27
27
  "dependencies": {
28
28
  "@push.rocks/lik": "^6.0.14",
29
29
  "@push.rocks/smartpromise": "^4.0.3",
30
- "@push.rocks/smartrx": "^3.0.7"
30
+ "@push.rocks/smartrx": "^3.0.7",
31
+ "@push.rocks/webstream": "^1.0.8"
31
32
  },
32
33
  "browserslist": [
33
34
  "last 1 chrome versions"
@@ -44,6 +45,25 @@
44
45
  "npmextra.json",
45
46
  "readme.md"
46
47
  ],
48
+ "keywords": [
49
+ "node.js",
50
+ "streams",
51
+ "stream manipulation",
52
+ "pipeline",
53
+ "data processing",
54
+ "async transformation",
55
+ "event handling",
56
+ "backpressure management",
57
+ "readable streams",
58
+ "writable streams",
59
+ "duplex streams",
60
+ "transform streams",
61
+ "file streaming",
62
+ "buffer streams",
63
+ "stream utilities",
64
+ "stream intake",
65
+ "stream output"
66
+ ],
47
67
  "scripts": {
48
68
  "test": "(tstest test/)",
49
69
  "build": "(tsbuild)",
@@ -0,0 +1 @@
1
+
package/readme.md CHANGED
@@ -1,54 +1,147 @@
1
- # @pushrocks/smartstream
1
+ # @push.rocks/smartstream
2
2
  simplifies access to node streams
3
3
 
4
- ## Availabililty and Links
5
- * [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartstream)
6
- * [gitlab.com (source)](https://gitlab.com/pushrocks/smartstream)
7
- * [github.com (source mirror)](https://github.com/pushrocks/smartstream)
8
- * [docs (typedoc)](https://pushrocks.gitlab.io/smartstream/)
9
-
10
- ## Status for master
11
-
12
- Status Category | Status Badge
13
- -- | --
14
- GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartstream/badges/master/pipeline.svg)](https://lossless.cloud)
15
- GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartstream/badges/master/coverage.svg)](https://lossless.cloud)
16
- npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartstream)](https://lossless.cloud)
17
- Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartstream)](https://lossless.cloud)
18
- TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
19
- node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
20
- Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
21
- PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartstream)](https://lossless.cloud)
22
- PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartstream)](https://lossless.cloud)
23
- BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartstream)](https://lossless.cloud)
24
- Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
4
+ ## Install
5
+ To install `@push.rocks/smartstream`, you can use npm or yarn as follows:
6
+
7
+ ```bash
8
+ npm install @push.rocks/smartstream --save
9
+ # OR
10
+ yarn add @push.rocks/smartstream
11
+ ```
12
+
13
+ This will add `@push.rocks/smartstream` to your project's dependencies.
25
14
 
26
15
  ## Usage
27
16
 
28
- Use TypeScript for best in class instellisense.
17
+ The `@push.rocks/smartstream` module is designed to simplify working with Node.js streams by providing a set of utilities for creating and manipulating streams. This module makes heavy use of TypeScript for improved code quality, readability, and maintenance. ESM syntax is utilized throughout the examples.
18
+
19
+ ### Importing the Module
20
+
21
+ Start by importing the module into your TypeScript file:
29
22
 
30
23
  ```typescript
31
- import { Smartstream } from 'smartstream'
32
- import * as gUglify from 'gulp-uglify'
33
-
34
- let mySmartstream = new Smartstream([
35
- gulp.src(['./file1.js','./file2.js']),
36
- gUglify(),
37
- gulp.dest('./some/output/path')
38
- ])
39
-
40
- mySmartstream.onError((err) => { /* handle error */ }) // handles all errors in stream
41
- myStream.onCustomEvent('myeventname', (args...) => { /* Do something */ }) // emit an custom event anywhere in your stream
42
- mySmartstream.run().then(() => {/* do something when stream is finished */})
24
+ import * as smartstream from '@push.rocks/smartstream';
43
25
  ```
44
26
 
45
- ## Contribution
27
+ ### Creating Basic Transform Streams
28
+
29
+ The module provides utilities for creating transform streams. For example, to create a transform stream that modifies chunks of data, you can use the `createTransformFunction` utility:
30
+
31
+ ```typescript
32
+ import { createTransformFunction } from '@push.rocks/smartstream';
33
+
34
+ const upperCaseTransform = createTransformFunction<string, string>(async (chunk) => {
35
+ return chunk.toUpperCase();
36
+ });
37
+
38
+ // Usage with pipe
39
+ readableStream
40
+ .pipe(upperCaseTransform)
41
+ .pipe(writableStream);
42
+ ```
43
+
44
+ ### Handling Backpressure with SmartDuplex
45
+
46
+ `SmartDuplex` is a powerful part of the `smartstream` module designed to handle backpressure effectively. Here's an example of how to create a `SmartDuplex` stream that processes data and respects the consumer's pace:
47
+
48
+ ```typescript
49
+ import { SmartDuplex } from '@push.rocks/smartstream';
50
+
51
+ const processDataDuplex = new SmartDuplex({
52
+ async writeFunction(chunk, { push }) {
53
+ const processedChunk = await processChunk(chunk); // Assume this is a defined asynchronous function
54
+ push(processedChunk);
55
+ }
56
+ });
57
+
58
+ sourceStream.pipe(processDataDuplex).pipe(destinationStream);
59
+ ```
60
+
61
+ ### Stream Combiners
62
+
63
+ `Smartstream` facilitates easy combining of multiple streams into a single pipeline, handling errors and cleanup automatically. Here's how you can combine multiple streams:
64
+
65
+ ```typescript
66
+ import { StreamWrapper } from '@push.rocks/smartstream';
67
+
68
+ const combinedStream = new StreamWrapper([
69
+ readStream, // Source stream
70
+ transformStream1, // Transformation
71
+ transformStream2, // Another transformation
72
+ writeStream // Destination stream
73
+ ]);
74
+
75
+ combinedStream.run()
76
+ .then(() => console.log('Processing completed.'))
77
+ .catch(err => console.error('An error occurred:', err));
78
+ ```
79
+
80
+ ### Working with StreamIntake
81
+
82
+ `StreamIntake` allows for more dynamic control of the reading process, facilitating scenarios where data is not continuously available:
83
+
84
+ ```typescript
85
+ import { StreamIntake } from '@push.rocks/smartstream';
86
+
87
+ const streamIntake = new StreamIntake<string>();
88
+
89
+ // Dynamically push data into the intake
90
+ streamIntake.pushData('Hello, World!');
91
+ streamIntake.pushData('Another message');
92
+
93
+ // Signal end when no more data is to be pushed
94
+ streamIntake.signalEnd();
95
+ ```
96
+
97
+ ### Real-world Scenario: Processing Large Files
98
+
99
+ Consider a scenario where you need to process a large CSV file, transform the data row-by-row, and then write the results to a database or another file. With `smartstream`, you could create a pipe that reads the CSV, processes each row, and handles backpressure, ensuring efficient use of resources.
100
+
101
+ ```typescript
102
+ import { SmartDuplex, createTransformFunction } from '@push.rocks/smartstream';
103
+ import fs from 'fs';
104
+ import csvParser from 'csv-parser'; // Assume this is a CSV parsing library
105
+
106
+ const csvReadTransform = createTransformFunction<any, any>(async (row) => {
107
+ // Process row
108
+ return processedRow;
109
+ });
110
+
111
+ fs.createReadStream('path/to/largeFile.csv')
112
+ .pipe(csvParser())
113
+ .pipe(csvReadTransform)
114
+ .pipe(new SmartDuplex({
115
+ async writeFunction(chunk, { push }) {
116
+ await writeToDatabase(chunk); // Assume this writes to a database
117
+ }
118
+ }))
119
+ .on('finish', () => console.log('File processed successfully.'));
120
+ ```
121
+
122
+ This example demonstrates reading a large CSV file, transforming each row with `createTransformFunction`, and using a `SmartDuplex` to manage the processed data flow efficiently, ensuring no data is lost due to backpressure issues.
123
+
124
+ ### Conclusion
125
+
126
+ `@push.rocks/smartstream` offers a robust set of tools for working with Node.js streams, providing a more intuitive and reliable way to create, manipulate, and combine streams. By leveraging TypeScript and ESM syntax, `smartstream` enables developers to build more maintainable and type-safe stream-based solutions.
127
+
128
+ For more detailed examples and documentation, visit the [GitLab Repository](https://gitlab.com/push.rocks/smartstream) or the [GitHub Mirror](https://github.com/pushrocks/smartstream).
129
+
130
+ ## License and Legal Information
131
+
132
+ This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
133
+
134
+ **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
135
+
136
+ ### Trademarks
137
+
138
+ This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
46
139
 
47
- We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
140
+ ### Company Information
48
141
 
49
- For further information read the linked docs at the top of this readme.
142
+ Task Venture Capital GmbH
143
+ Registered at District court Bremen HRB 35230 HB, Germany
50
144
 
51
- > MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
52
- | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
145
+ For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
53
146
 
54
- [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
147
+ By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartstream',
6
- version: '3.0.34',
6
+ version: '3.0.35',
7
7
  description: 'simplifies access to node streams'
8
8
  }
package/ts/index.ts CHANGED
@@ -2,4 +2,7 @@ export * from './smartstream.classes.smartduplex.js';
2
2
  export * from './smartstream.classes.streamwrapper.js';
3
3
  export * from './smartstream.classes.streamintake.js';
4
4
 
5
- export * from './smartstream.functions.js'
5
+ export * from './smartstream.functions.js';
6
+
7
+ import * as plugins from './smartstream.plugins.js';
8
+ export const webstream = plugins.webstream;
@@ -7,6 +7,7 @@ export { stream };
7
7
  import * as lik from '@push.rocks/lik';
8
8
  import * as smartpromise from '@push.rocks/smartpromise';
9
9
  import * as smartrx from '@push.rocks/smartrx';
10
+ import * as webstream from '@push.rocks/webstream';
10
11
 
11
- export { lik, smartpromise, smartrx };
12
+ export { lik, smartpromise, smartrx, webstream };
12
13