@smithy/eventstream-serde-universal 1.0.1 → 1.0.2
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-types/ts3.4/EventStreamMarshaller.d.ts +23 -0
- package/dist-types/ts3.4/fixtures/MockEventMessageSource.fixture.d.ts +21 -0
- package/dist-types/ts3.4/fixtures/event.fixture.d.ts +17 -0
- package/dist-types/ts3.4/getChunkedStream.d.ts +4 -0
- package/dist-types/ts3.4/getUnmarshalledStream.d.ts +18 -0
- package/dist-types/ts3.4/index.d.ts +8 -0
- package/dist-types/ts3.4/provider.d.ts +3 -0
- package/package.json +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Decoder, Encoder, EventStreamMarshaller as IEventStreamMarshaller, Message } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface EventStreamMarshaller extends IEventStreamMarshaller {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface EventStreamMarshallerOptions {
|
|
11
|
+
utf8Encoder: Encoder;
|
|
12
|
+
utf8Decoder: Decoder;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare class EventStreamMarshaller {
|
|
18
|
+
private readonly eventStreamCodec;
|
|
19
|
+
private readonly utfEncoder;
|
|
20
|
+
constructor({ utf8Encoder, utf8Decoder }: EventStreamMarshallerOptions);
|
|
21
|
+
deserialize<T>(body: AsyncIterable<Uint8Array>, deserializer: (input: Record<string, Message>) => Promise<T>): AsyncIterable<T>;
|
|
22
|
+
serialize<T>(inputStream: AsyncIterable<T>, serializer: (event: T) => Message): AsyncIterable<Uint8Array>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable, ReadableOptions } from "stream";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface MockEventMessageSourceOptions extends ReadableOptions {
|
|
7
|
+
messages: Array<Buffer>;
|
|
8
|
+
emitSize: number;
|
|
9
|
+
throwError?: Error;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare class MockEventMessageSource extends Readable {
|
|
15
|
+
private readonly data;
|
|
16
|
+
private readonly emitSize;
|
|
17
|
+
private readonly throwError?;
|
|
18
|
+
private readCount;
|
|
19
|
+
constructor(options: MockEventMessageSourceOptions);
|
|
20
|
+
_read(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const recordEventMessage: Buffer;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const statsEventMessage: Buffer;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const endEventMessage: Buffer;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const exception: Buffer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventStreamCodec } from "@smithy/eventstream-codec";
|
|
2
|
+
import { Encoder, Message } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type UnmarshalledStreamOptions<T> = {
|
|
7
|
+
eventStreamCodec: EventStreamCodec;
|
|
8
|
+
deserializer: (input: Record<string, Message>) => Promise<T>;
|
|
9
|
+
toUtf8: Encoder;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function getUnmarshalledStream<T extends Record<string, any>>(source: AsyncIterable<Uint8Array>, options: UnmarshalledStreamOptions<T>): AsyncIterable<T>;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMessageUnmarshaller<T extends Record<string, any>>(deserializer: (input: Record<string, Message>) => Promise<T>, toUtf8: Encoder): (input: Message) => Promise<T | undefined>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/eventstream-serde-universal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
5
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@smithy/eventstream-codec": "^1.0.
|
|
26
|
-
"@smithy/types": "^1.1.
|
|
25
|
+
"@smithy/eventstream-codec": "^1.0.2",
|
|
26
|
+
"@smithy/types": "^1.1.1",
|
|
27
27
|
"tslib": "^2.5.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@smithy/util-utf8": "^1.0.
|
|
30
|
+
"@smithy/util-utf8": "^1.0.2",
|
|
31
31
|
"@tsconfig/recommended": "1.0.1",
|
|
32
32
|
"@types/node": "^14.14.31",
|
|
33
33
|
"concurrently": "7.0.0",
|