stream-protocol-toolkit 0.1.0
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/LICENSE +21 -0
- package/README.md +6 -0
- package/dist/Application/Application.d.ts +39 -0
- package/dist/Application/Application.js +156 -0
- package/dist/Application/ApplicationEventEnum.d.ts +6 -0
- package/dist/Application/ApplicationEventEnum.js +10 -0
- package/dist/Application/ApplicationEventMap.d.ts +15 -0
- package/dist/Application/ApplicationEventMap.js +2 -0
- package/dist/Application/ApplicationOptions.d.ts +12 -0
- package/dist/Application/ApplicationOptions.js +2 -0
- package/dist/Application/ApplicationState.d.ts +1 -0
- package/dist/Application/ApplicationState.js +2 -0
- package/dist/Application/ApplicationUnknownProtocolHandler.d.ts +5 -0
- package/dist/Application/ApplicationUnknownProtocolHandler.js +2 -0
- package/dist/Application/create-stream-context/CreateStreamContextInputDTO.d.ts +3 -0
- package/dist/Application/create-stream-context/CreateStreamContextInputDTO.js +2 -0
- package/dist/Application/create-stream-context/CreateStreamContextOutputDTO.d.ts +5 -0
- package/dist/Application/create-stream-context/CreateStreamContextOutputDTO.js +2 -0
- package/dist/Application/create-stream-context/index.d.ts +2 -0
- package/dist/Application/create-stream-context/index.js +2 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactory.d.ts +5 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactory.js +2 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactoryInputDTO.d.ts +2 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactoryInputDTO.js +2 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactoryOutputDTO.d.ts +4 -0
- package/dist/Application/factories/application-state-factory/ApplicationStateFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/application-state-factory/application-state-factory.d.ts +5 -0
- package/dist/Application/factories/application-state-factory/application-state-factory.js +8 -0
- package/dist/Application/factories/application-state-factory/index.d.ts +4 -0
- package/dist/Application/factories/application-state-factory/index.js +5 -0
- package/dist/Application/factories/index.d.ts +6 -0
- package/dist/Application/factories/index.js +22 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactory.d.ts +5 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactory.js +2 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactoryInputDTO.d.ts +5 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactoryInputDTO.js +2 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactoryOutputDTO.d.ts +5 -0
- package/dist/Application/factories/stream-buffer-factory/StreamBufferFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/stream-buffer-factory/index.d.ts +4 -0
- package/dist/Application/factories/stream-buffer-factory/index.js +5 -0
- package/dist/Application/factories/stream-buffer-factory/stream-buffer-factory.d.ts +5 -0
- package/dist/Application/factories/stream-buffer-factory/stream-buffer-factory.js +10 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactory.d.ts +5 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactory.js +2 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactoryInputDTO.d.ts +3 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactoryInputDTO.js +2 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactoryOutputDTO.d.ts +5 -0
- package/dist/Application/factories/stream-context-factory/StreamContextFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/stream-context-factory/index.d.ts +4 -0
- package/dist/Application/factories/stream-context-factory/index.js +5 -0
- package/dist/Application/factories/stream-context-factory/stream-context-factory.d.ts +5 -0
- package/dist/Application/factories/stream-context-factory/stream-context-factory.js +12 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactory.d.ts +5 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactory.js +2 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactoryInputDTO.d.ts +2 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactoryInputDTO.js +2 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactoryOutputDTO.d.ts +4 -0
- package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/stream-context-state-factory/index.d.ts +4 -0
- package/dist/Application/factories/stream-context-state-factory/index.js +5 -0
- package/dist/Application/factories/stream-context-state-factory/stream-context-state-factory.d.ts +5 -0
- package/dist/Application/factories/stream-context-state-factory/stream-context-state-factory.js +8 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactory.d.ts +5 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactory.js +2 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactoryInputDTO.d.ts +2 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactoryInputDTO.js +2 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactoryOutputDTO.d.ts +5 -0
- package/dist/Application/factories/stream-protocol-processor-factory/StreamProtocolProcessorFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/stream-protocol-processor-factory/index.d.ts +4 -0
- package/dist/Application/factories/stream-protocol-processor-factory/index.js +5 -0
- package/dist/Application/factories/stream-protocol-processor-factory/stream-protocol-processor-factory.d.ts +5 -0
- package/dist/Application/factories/stream-protocol-processor-factory/stream-protocol-processor-factory.js +13 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactory.d.ts +5 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactory.js +2 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactoryInputDTO.d.ts +5 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactoryInputDTO.js +2 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactoryOutputDTO.d.ts +4 -0
- package/dist/Application/factories/transform-stream-handler-factory/TransformStreamHandlerFactoryOutputDTO.js +2 -0
- package/dist/Application/factories/transform-stream-handler-factory/index.d.ts +4 -0
- package/dist/Application/factories/transform-stream-handler-factory/index.js +5 -0
- package/dist/Application/factories/transform-stream-handler-factory/transform-stream-handler-factory.d.ts +5 -0
- package/dist/Application/factories/transform-stream-handler-factory/transform-stream-handler-factory.js +65 -0
- package/dist/Application/index.d.ts +9 -0
- package/dist/Application/index.js +24 -0
- package/dist/Application/start-stream/StartStreamInputDTO.d.ts +5 -0
- package/dist/Application/start-stream/StartStreamInputDTO.js +2 -0
- package/dist/Application/start-stream/StartStreamOutputDTO.d.ts +2 -0
- package/dist/Application/start-stream/StartStreamOutputDTO.js +2 -0
- package/dist/Application/start-stream/index.d.ts +2 -0
- package/dist/Application/start-stream/index.js +2 -0
- package/dist/Protocol/Protocol.d.ts +12 -0
- package/dist/Protocol/Protocol.js +84 -0
- package/dist/Protocol/ProtocolInitValue.d.ts +4 -0
- package/dist/Protocol/ProtocolInitValue.js +2 -0
- package/dist/Protocol/ProtocolOptions.d.ts +1 -0
- package/dist/Protocol/ProtocolOptions.js +2 -0
- package/dist/Protocol/index.d.ts +3 -0
- package/dist/Protocol/index.js +5 -0
- package/dist/ProtocolHandler/ProtocolHandler.d.ts +6 -0
- package/dist/ProtocolHandler/ProtocolHandler.js +6 -0
- package/dist/ProtocolHandler/ProtocolHandlerOptions.d.ts +1 -0
- package/dist/ProtocolHandler/ProtocolHandlerOptions.js +2 -0
- package/dist/ProtocolHandler/handle/HandleInputDTO.d.ts +7 -0
- package/dist/ProtocolHandler/handle/HandleInputDTO.js +2 -0
- package/dist/ProtocolHandler/handle/HandleOutputDTO.d.ts +3 -0
- package/dist/ProtocolHandler/handle/HandleOutputDTO.js +2 -0
- package/dist/ProtocolHandler/handle/index.d.ts +2 -0
- package/dist/ProtocolHandler/handle/index.js +2 -0
- package/dist/ProtocolHandler/index.d.ts +3 -0
- package/dist/ProtocolHandler/index.js +20 -0
- package/dist/RawPacket/RawPacket.d.ts +5 -0
- package/dist/RawPacket/RawPacket.js +2 -0
- package/dist/RawPacket/RawPacketHeader.d.ts +4 -0
- package/dist/RawPacket/RawPacketHeader.js +2 -0
- package/dist/RawPacket/index.d.ts +2 -0
- package/dist/RawPacket/index.js +2 -0
- package/dist/StreamBuffer/StreamBuffer.d.ts +14 -0
- package/dist/StreamBuffer/StreamBuffer.js +59 -0
- package/dist/StreamBuffer/StreamBufferOptions.d.ts +5 -0
- package/dist/StreamBuffer/StreamBufferOptions.js +2 -0
- package/dist/StreamBuffer/index.d.ts +2 -0
- package/dist/StreamBuffer/index.js +5 -0
- package/dist/StreamContext/StreamContext.d.ts +17 -0
- package/dist/StreamContext/StreamContext.js +18 -0
- package/dist/StreamContext/StreamContextOptions.d.ts +12 -0
- package/dist/StreamContext/StreamContextOptions.js +2 -0
- package/dist/StreamContext/index.d.ts +2 -0
- package/dist/StreamContext/index.js +5 -0
- package/dist/StreamProtocolProcessor/StreamProtocolProcessor.d.ts +28 -0
- package/dist/StreamProtocolProcessor/StreamProtocolProcessor.js +137 -0
- package/dist/StreamProtocolProcessor/StreamProtocolProcessorOptions.d.ts +10 -0
- package/dist/StreamProtocolProcessor/StreamProtocolProcessorOptions.js +2 -0
- package/dist/StreamProtocolProcessor/index.d.ts +2 -0
- package/dist/StreamProtocolProcessor/index.js +5 -0
- package/dist/errors/StreamProtocolToolkitAlreadyExistsError.d.ts +3 -0
- package/dist/errors/StreamProtocolToolkitAlreadyExistsError.js +7 -0
- package/dist/errors/StreamProtocolToolkitError.d.ts +3 -0
- package/dist/errors/StreamProtocolToolkitError.js +13 -0
- package/dist/errors/StreamProtocolToolkitNotImplementedError.d.ts +3 -0
- package/dist/errors/StreamProtocolToolkitNotImplementedError.js +7 -0
- package/dist/errors/StreamProtocolToolkitTypeError.d.ts +3 -0
- package/dist/errors/StreamProtocolToolkitTypeError.js +7 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.js +11 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +25 -0
- package/dist/utils/any-signal.d.ts +1 -0
- package/dist/utils/any-signal.js +34 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/is-plain-object.d.ts +1 -0
- package/dist/utils/is-plain-object.js +13 -0
- package/dist/utils/is-readable-stream-alive.d.ts +2 -0
- package/dist/utils/is-readable-stream-alive.js +21 -0
- package/dist/utils/is-writable-stream-alive.d.ts +2 -0
- package/dist/utils/is-writable-stream-alive.js +24 -0
- package/dist/utils/read-paused-stream-chunk.d.ts +3 -0
- package/dist/utils/read-paused-stream-chunk.js +51 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Custos Dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { Protocol } from '../Protocol';
|
|
3
|
+
import type { Class } from 'utility-types';
|
|
4
|
+
import type { StreamContext } from '../StreamContext';
|
|
5
|
+
import type { ProtocolHandler } from '../ProtocolHandler';
|
|
6
|
+
import type { StreamBufferOptions } from '../StreamBuffer';
|
|
7
|
+
import type { ApplicationOptions } from './ApplicationOptions';
|
|
8
|
+
import type { ApplicationEventMap } from './ApplicationEventMap';
|
|
9
|
+
import type { StartStreamInputDTO, StartStreamOutputDTO } from './start-stream';
|
|
10
|
+
import { Readable, Writable } from 'stream';
|
|
11
|
+
import type { ApplicationUnknownProtocolHandler } from './ApplicationUnknownProtocolHandler';
|
|
12
|
+
import type { CreateStreamContextInputDTO, CreateStreamContextOutputDTO } from './create-stream-context';
|
|
13
|
+
import { StreamBufferFactory, StreamContextFactory, ApplicationStateFactory, StreamContextStateFactory, TransformStreamHandlerFactory, StreamProtocolProcessorFactory } from './factories';
|
|
14
|
+
type ProtocolRecord<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
15
|
+
protocolClass: typeof Protocol;
|
|
16
|
+
protocolHandler: ProtocolHandler<Protocol, ISTREAM, OSTREAM, AS, SCS>;
|
|
17
|
+
};
|
|
18
|
+
export declare class Application<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> {
|
|
19
|
+
readonly applicationState: AS;
|
|
20
|
+
readonly abortController: AbortController;
|
|
21
|
+
readonly streamBufferOptions?: StreamBufferOptions;
|
|
22
|
+
readonly protocols: Map<number, ProtocolRecord<ISTREAM, OSTREAM, AS, SCS>>;
|
|
23
|
+
readonly attachedStreamContexts: Set<StreamContext<ISTREAM, OSTREAM, AS, SCS>>;
|
|
24
|
+
readonly eventBus: EventEmitter<ApplicationEventMap<ISTREAM, OSTREAM, AS, SCS>>;
|
|
25
|
+
readonly streamBufferFactory: StreamBufferFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
26
|
+
readonly streamContextFactory: StreamContextFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
27
|
+
readonly applicationStateFactory: ApplicationStateFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
28
|
+
readonly streamContextStateFactory: StreamContextStateFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
29
|
+
readonly transformStreamHandlerFactory: TransformStreamHandlerFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
30
|
+
readonly streamProtocolProcessorFactory: StreamProtocolProcessorFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
31
|
+
unknownProtocolHandler?: ApplicationUnknownProtocolHandler<ISTREAM, OSTREAM, AS, SCS>;
|
|
32
|
+
constructor(options?: ApplicationOptions<ISTREAM, OSTREAM, AS, SCS>);
|
|
33
|
+
addProtocol<PROT extends Protocol>(protocol: Class<PROT>, protocolHandler: ProtocolHandler<PROT, ISTREAM, OSTREAM, AS, SCS>): this;
|
|
34
|
+
removeProtocol(opcode: number): this;
|
|
35
|
+
setUnknownProtocolHandler(handler: ApplicationUnknownProtocolHandler<ISTREAM, OSTREAM, AS, SCS> | undefined): this;
|
|
36
|
+
createStreamContext(input: CreateStreamContextInputDTO<ISTREAM, OSTREAM, AS, SCS>): CreateStreamContextOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
37
|
+
startStream(input: StartStreamInputDTO<ISTREAM, OSTREAM, AS, SCS>): Promise<StartStreamOutputDTO<ISTREAM, OSTREAM, AS, SCS>>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Application = void 0;
|
|
37
|
+
const utils = __importStar(require("../utils"));
|
|
38
|
+
const events_1 = require("events");
|
|
39
|
+
const stream_1 = require("stream");
|
|
40
|
+
const errors_1 = require("../errors");
|
|
41
|
+
const factories_1 = require("./factories");
|
|
42
|
+
class Application {
|
|
43
|
+
constructor(options) {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f;
|
|
45
|
+
this.abortController = new AbortController();
|
|
46
|
+
this.streamBufferOptions = options === null || options === void 0 ? void 0 : options.streamBufferOptions;
|
|
47
|
+
this.protocols = new Map();
|
|
48
|
+
this.eventBus = new events_1.EventEmitter();
|
|
49
|
+
this.attachedStreamContexts = new Set();
|
|
50
|
+
this.streamBufferFactory = (_a = options === null || options === void 0 ? void 0 : options.streamBufferFactory) !== null && _a !== void 0 ? _a : (factories_1.streamBufferFactory);
|
|
51
|
+
this.streamContextFactory = (_b = options === null || options === void 0 ? void 0 : options.streamContextFactory) !== null && _b !== void 0 ? _b : (factories_1.streamContextFactory);
|
|
52
|
+
this.applicationStateFactory = (_c = options === null || options === void 0 ? void 0 : options.applicationStateFactory) !== null && _c !== void 0 ? _c : (factories_1.applicationStateFactory);
|
|
53
|
+
this.streamContextStateFactory = (_d = options === null || options === void 0 ? void 0 : options.streamContextStateFactory) !== null && _d !== void 0 ? _d : (factories_1.streamContextStateFactory);
|
|
54
|
+
this.transformStreamHandlerFactory = (_e = options === null || options === void 0 ? void 0 : options.transformStreamHandlerFactory) !== null && _e !== void 0 ? _e : (factories_1.transformStreamHandlerFactory);
|
|
55
|
+
this.streamProtocolProcessorFactory = (_f = options === null || options === void 0 ? void 0 : options.streamProtocolProcessorFactory) !== null && _f !== void 0 ? _f : (factories_1.streamProtocolProcessorFactory);
|
|
56
|
+
this.applicationState = this.applicationStateFactory({
|
|
57
|
+
application: this
|
|
58
|
+
}).applicationState;
|
|
59
|
+
}
|
|
60
|
+
addProtocol(protocol, protocolHandler) {
|
|
61
|
+
const _protocol = protocol;
|
|
62
|
+
if (this.protocols.has(_protocol._opcode)) {
|
|
63
|
+
throw new errors_1.StreamProtocolToolkitAlreadyExistsError('PROTOCOL_ALREADY_REGISTERED');
|
|
64
|
+
}
|
|
65
|
+
this.protocols.set(_protocol._opcode, {
|
|
66
|
+
protocolClass: _protocol,
|
|
67
|
+
protocolHandler
|
|
68
|
+
});
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
removeProtocol(opcode) {
|
|
72
|
+
const protocol = this.protocols.get(opcode);
|
|
73
|
+
if (!protocol) {
|
|
74
|
+
throw new errors_1.StreamProtocolToolkitAlreadyExistsError('PROTOCOL_NOT_REGISTERED');
|
|
75
|
+
}
|
|
76
|
+
this.protocols.delete(opcode);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
setUnknownProtocolHandler(handler) {
|
|
80
|
+
this.unknownProtocolHandler = handler;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
createStreamContext(input) {
|
|
84
|
+
const { streamContext } = this.streamContextFactory(input);
|
|
85
|
+
setImmediate(() => {
|
|
86
|
+
this.eventBus.emit(1, streamContext);
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
streamContext
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async startStream(input) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const { streamContext } = input;
|
|
95
|
+
if (streamContext.application !== this) {
|
|
96
|
+
throw new errors_1.StreamProtocolToolkitError('STREAM_CONTEXT_BELONGS_ANOTHER_APPLICATION_INSTANCE');
|
|
97
|
+
}
|
|
98
|
+
if (this.attachedStreamContexts.has(streamContext)) {
|
|
99
|
+
throw new errors_1.StreamProtocolToolkitError('STREAM_CONTEXT_ALREADY_STARTED');
|
|
100
|
+
}
|
|
101
|
+
this.attachedStreamContexts.add(streamContext);
|
|
102
|
+
try {
|
|
103
|
+
setImmediate(() => {
|
|
104
|
+
this.eventBus.emit(2, streamContext);
|
|
105
|
+
});
|
|
106
|
+
const { transformStreamHandler } = this.transformStreamHandlerFactory({
|
|
107
|
+
streamContext
|
|
108
|
+
});
|
|
109
|
+
const inputPipe = [
|
|
110
|
+
streamContext.input,
|
|
111
|
+
...((_a = streamContext.inputTransform) !== null && _a !== void 0 ? _a : []),
|
|
112
|
+
transformStreamHandler
|
|
113
|
+
];
|
|
114
|
+
const outputPipe = [
|
|
115
|
+
transformStreamHandler
|
|
116
|
+
];
|
|
117
|
+
if (streamContext.output) {
|
|
118
|
+
outputPipe.push(...((_b = streamContext.outputTransform) !== null && _b !== void 0 ? _b : []));
|
|
119
|
+
outputPipe.push(streamContext.output);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
outputPipe.push(new stream_1.Writable({
|
|
123
|
+
write(chunk, encoding, callback) {
|
|
124
|
+
callback();
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
const abortSignal = utils.anySignal([
|
|
129
|
+
streamContext.abortController.signal,
|
|
130
|
+
streamContext.application.abortController.signal
|
|
131
|
+
]);
|
|
132
|
+
await Promise.all([
|
|
133
|
+
stream_1.promises.pipeline(inputPipe, {
|
|
134
|
+
signal: abortSignal
|
|
135
|
+
}),
|
|
136
|
+
stream_1.promises.pipeline(outputPipe, {
|
|
137
|
+
signal: abortSignal
|
|
138
|
+
})
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
streamContext.abortController.abort(e);
|
|
143
|
+
setImmediate(() => {
|
|
144
|
+
this.eventBus.emit(0, e);
|
|
145
|
+
});
|
|
146
|
+
throw e;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
this.attachedStreamContexts.delete(streamContext);
|
|
150
|
+
setImmediate(() => {
|
|
151
|
+
this.eventBus.emit(3, streamContext);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.Application = Application;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationEventEnum = void 0;
|
|
4
|
+
var ApplicationEventEnum;
|
|
5
|
+
(function (ApplicationEventEnum) {
|
|
6
|
+
ApplicationEventEnum[ApplicationEventEnum["STREAM_CONTEXT_ERROR"] = 0] = "STREAM_CONTEXT_ERROR";
|
|
7
|
+
ApplicationEventEnum[ApplicationEventEnum["STREAM_CONTEXT_CREATED"] = 1] = "STREAM_CONTEXT_CREATED";
|
|
8
|
+
ApplicationEventEnum[ApplicationEventEnum["STREAM_CONTEXT_ATTACHED"] = 2] = "STREAM_CONTEXT_ATTACHED";
|
|
9
|
+
ApplicationEventEnum[ApplicationEventEnum["STREAM_CONTEXT_DETACHED"] = 3] = "STREAM_CONTEXT_DETACHED";
|
|
10
|
+
})(ApplicationEventEnum || (exports.ApplicationEventEnum = ApplicationEventEnum = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamContext } from '../StreamContext';
|
|
3
|
+
import type { ApplicationEventEnum } from './ApplicationEventEnum';
|
|
4
|
+
export type ApplicationEventMap<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
5
|
+
[ApplicationEventEnum.STREAM_CONTEXT_ERROR]: [err: any];
|
|
6
|
+
[ApplicationEventEnum.STREAM_CONTEXT_CREATED]: [
|
|
7
|
+
streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>
|
|
8
|
+
];
|
|
9
|
+
[ApplicationEventEnum.STREAM_CONTEXT_ATTACHED]: [
|
|
10
|
+
streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>
|
|
11
|
+
];
|
|
12
|
+
[ApplicationEventEnum.STREAM_CONTEXT_DETACHED]: [
|
|
13
|
+
streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>
|
|
14
|
+
];
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamBufferOptions } from '../StreamBuffer';
|
|
3
|
+
import { StreamBufferFactory, StreamContextFactory, ApplicationStateFactory, StreamContextStateFactory, TransformStreamHandlerFactory, StreamProtocolProcessorFactory } from './factories';
|
|
4
|
+
export type ApplicationOptions<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
5
|
+
streamBufferOptions?: StreamBufferOptions;
|
|
6
|
+
streamBufferFactory?: StreamBufferFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
7
|
+
streamContextFactory?: StreamContextFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
8
|
+
applicationStateFactory?: ApplicationStateFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
9
|
+
streamContextStateFactory?: StreamContextStateFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
10
|
+
transformStreamHandlerFactory: TransformStreamHandlerFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
11
|
+
streamProtocolProcessorFactory?: StreamProtocolProcessorFactory<ISTREAM, OSTREAM, AS, SCS>;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ApplicationState<AS extends object> = AS;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Buffer } from 'buffer';
|
|
2
|
+
import type { RawPacket } from '../RawPacket';
|
|
3
|
+
import type { Readable, Writable } from 'stream';
|
|
4
|
+
import type { StreamContext } from '../StreamContext';
|
|
5
|
+
export type ApplicationUnknownProtocolHandler<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = (rawPacket: RawPacket, streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>) => Promise<Buffer | void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamContextOptions } from '../../StreamContext';
|
|
3
|
+
export type CreateStreamContextInputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = Pick<StreamContextOptions<ISTREAM, OSTREAM, AS, SCS>, 'input' | 'inputTransform' | 'output' | 'outputTransform'>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamContext } from '../../StreamContext';
|
|
3
|
+
export type CreateStreamContextOutputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
4
|
+
streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { ApplicationStateFactoryInputDTO } from './ApplicationStateFactoryInputDTO';
|
|
4
|
+
import type { ApplicationStateFactoryOutputDTO } from './ApplicationStateFactoryOutputDTO';
|
|
5
|
+
export type ApplicationStateFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = (this: Application<ISTREAM, OSTREAM, AS, SCS>, input: ApplicationStateFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>) => ApplicationStateFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { ApplicationStateFactoryInputDTO } from './ApplicationStateFactoryInputDTO';
|
|
4
|
+
import type { ApplicationStateFactoryOutputDTO } from './ApplicationStateFactoryOutputDTO';
|
|
5
|
+
export declare function applicationStateFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object>(this: Application<ISTREAM, OSTREAM, AS, SCS>, input: ApplicationStateFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>): ApplicationStateFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { applicationStateFactory } from './application-state-factory';
|
|
2
|
+
export type { ApplicationStateFactory } from './ApplicationStateFactory';
|
|
3
|
+
export type { ApplicationStateFactoryInputDTO } from './ApplicationStateFactoryInputDTO';
|
|
4
|
+
export type { ApplicationStateFactoryOutputDTO } from './ApplicationStateFactoryOutputDTO';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicationStateFactory = void 0;
|
|
4
|
+
var application_state_factory_1 = require("./application-state-factory");
|
|
5
|
+
Object.defineProperty(exports, "applicationStateFactory", { enumerable: true, get: function () { return application_state_factory_1.applicationStateFactory; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './stream-buffer-factory';
|
|
2
|
+
export * from './stream-context-factory';
|
|
3
|
+
export * from './application-state-factory';
|
|
4
|
+
export * from './stream-context-state-factory';
|
|
5
|
+
export * from './transform-stream-handler-factory';
|
|
6
|
+
export * from './stream-protocol-processor-factory';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./stream-buffer-factory"), exports);
|
|
18
|
+
__exportStar(require("./stream-context-factory"), exports);
|
|
19
|
+
__exportStar(require("./application-state-factory"), exports);
|
|
20
|
+
__exportStar(require("./stream-context-state-factory"), exports);
|
|
21
|
+
__exportStar(require("./transform-stream-handler-factory"), exports);
|
|
22
|
+
__exportStar(require("./stream-protocol-processor-factory"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamBufferFactoryInputDTO } from './StreamBufferFactoryInputDTO';
|
|
4
|
+
import type { StreamBufferFactoryOutputDTO } from './StreamBufferFactoryOutputDTO';
|
|
5
|
+
export type StreamBufferFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = (this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamBufferFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>) => StreamBufferFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamBufferOptions } from '../../../StreamBuffer';
|
|
3
|
+
export type StreamBufferFactoryInputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
4
|
+
streamBufferOptions?: StreamBufferOptions;
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamBuffer } from '../../../StreamBuffer';
|
|
3
|
+
export type StreamBufferFactoryOutputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
4
|
+
streamBuffer: StreamBuffer;
|
|
5
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { streamBufferFactory } from './stream-buffer-factory';
|
|
2
|
+
export type { StreamBufferFactory } from './StreamBufferFactory';
|
|
3
|
+
export type { StreamBufferFactoryInputDTO } from './StreamBufferFactoryInputDTO';
|
|
4
|
+
export type { StreamBufferFactoryOutputDTO } from './StreamBufferFactoryOutputDTO';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamBufferFactory = void 0;
|
|
4
|
+
var stream_buffer_factory_1 = require("./stream-buffer-factory");
|
|
5
|
+
Object.defineProperty(exports, "streamBufferFactory", { enumerable: true, get: function () { return stream_buffer_factory_1.streamBufferFactory; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamBufferFactoryInputDTO } from './StreamBufferFactoryInputDTO';
|
|
4
|
+
import type { StreamBufferFactoryOutputDTO } from './StreamBufferFactoryOutputDTO';
|
|
5
|
+
export declare function streamBufferFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object>(this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamBufferFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>): StreamBufferFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamBufferFactory = streamBufferFactory;
|
|
4
|
+
const StreamBuffer_1 = require("../../../StreamBuffer");
|
|
5
|
+
function streamBufferFactory(input) {
|
|
6
|
+
var _a;
|
|
7
|
+
return {
|
|
8
|
+
streamBuffer: new StreamBuffer_1.StreamBuffer((_a = input.streamBufferOptions) !== null && _a !== void 0 ? _a : this.streamBufferOptions)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamContextFactoryInputDTO } from './StreamContextFactoryInputDTO';
|
|
4
|
+
import type { StreamContextFactoryOutputDTO } from './StreamContextFactoryOutputDTO';
|
|
5
|
+
export type StreamContextFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = (this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamContextFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>) => StreamContextFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamContextOptions } from '../../../StreamContext';
|
|
3
|
+
export type StreamContextFactoryInputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = Omit<StreamContextOptions<ISTREAM, OSTREAM, AS, SCS>, 'streamContextState' | 'streamProtocolProcessor' | 'application'>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { StreamContext } from '../../../StreamContext';
|
|
3
|
+
export type StreamContextFactoryOutputDTO<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = {
|
|
4
|
+
streamContext: StreamContext<ISTREAM, OSTREAM, AS, SCS>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { streamContextFactory } from './stream-context-factory';
|
|
2
|
+
export type { StreamContextFactory } from './StreamContextFactory';
|
|
3
|
+
export type { StreamContextFactoryInputDTO } from './StreamContextFactoryInputDTO';
|
|
4
|
+
export type { StreamContextFactoryOutputDTO } from './StreamContextFactoryOutputDTO';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamContextFactory = void 0;
|
|
4
|
+
var stream_context_factory_1 = require("./stream-context-factory");
|
|
5
|
+
Object.defineProperty(exports, "streamContextFactory", { enumerable: true, get: function () { return stream_context_factory_1.streamContextFactory; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamContextFactoryInputDTO } from './StreamContextFactoryInputDTO';
|
|
4
|
+
import type { StreamContextFactoryOutputDTO } from './StreamContextFactoryOutputDTO';
|
|
5
|
+
export declare function streamContextFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object>(this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamContextFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>): StreamContextFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamContextFactory = streamContextFactory;
|
|
4
|
+
const StreamContext_1 = require("../../../StreamContext");
|
|
5
|
+
function streamContextFactory(input) {
|
|
6
|
+
const { streamContextState } = this.streamContextStateFactory({});
|
|
7
|
+
const { streamProtocolProcessor } = this.streamProtocolProcessorFactory({});
|
|
8
|
+
return {
|
|
9
|
+
streamContext: new StreamContext_1.StreamContext(Object.assign(Object.assign({}, input), { streamProtocolProcessor,
|
|
10
|
+
streamContextState, application: this }))
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/Application/factories/stream-context-state-factory/StreamContextStateFactory.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamContextStateFactoryInputDTO } from './StreamContextStateFactoryInputDTO';
|
|
4
|
+
import type { StreamContextStateFactoryOutputDTO } from './StreamContextStateFactoryOutputDTO';
|
|
5
|
+
export type StreamContextStateFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object> = (this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamContextStateFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>) => StreamContextStateFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { streamContextStateFactory } from './stream-context-state-factory';
|
|
2
|
+
export type { StreamContextStateFactory } from './StreamContextStateFactory';
|
|
3
|
+
export type { StreamContextStateFactoryInputDTO } from './StreamContextStateFactoryInputDTO';
|
|
4
|
+
export type { StreamContextStateFactoryOutputDTO } from './StreamContextStateFactoryOutputDTO';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamContextStateFactory = void 0;
|
|
4
|
+
var stream_context_state_factory_1 = require("./stream-context-state-factory");
|
|
5
|
+
Object.defineProperty(exports, "streamContextStateFactory", { enumerable: true, get: function () { return stream_context_state_factory_1.streamContextStateFactory; } });
|
package/dist/Application/factories/stream-context-state-factory/stream-context-state-factory.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'stream';
|
|
2
|
+
import type { Application } from '../../Application';
|
|
3
|
+
import type { StreamContextStateFactoryInputDTO } from './StreamContextStateFactoryInputDTO';
|
|
4
|
+
import type { StreamContextStateFactoryOutputDTO } from './StreamContextStateFactoryOutputDTO';
|
|
5
|
+
export declare function streamContextStateFactory<ISTREAM extends Readable, OSTREAM extends Writable, AS extends object, SCS extends object>(this: Application<ISTREAM, OSTREAM, AS, SCS>, input: StreamContextStateFactoryInputDTO<ISTREAM, OSTREAM, AS, SCS>): StreamContextStateFactoryOutputDTO<ISTREAM, OSTREAM, AS, SCS>;
|