@smithy/core 3.29.8 → 3.31.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/dist-cjs/submodules/cbor/index.js +15 -13
- package/dist-cjs/submodules/retry/index.browser.js +1 -0
- package/dist-cjs/submodules/retry/index.js +1 -0
- package/dist-cjs/submodules/schema/index.js +3 -0
- package/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/dist-cjs/submodules/serde/index.js +2 -2
- package/dist-cjs/submodules/serde/index.native.js +2 -2
- package/dist-es/submodules/cbor/CborCodec.js +2 -203
- package/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +113 -0
- package/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +95 -0
- package/dist-es/submodules/cbor/codec-v2/SinglePassCborShapeDeserializer.js +609 -0
- package/dist-es/submodules/cbor/codec-v2/SinglePassCborShapeSerializer.js +611 -0
- package/dist-es/submodules/cbor/index.js +3 -1
- package/dist-es/submodules/retry/service-error-classification/constants.js +1 -0
- package/dist-es/submodules/schema/schemas/NormalizedSchema.js +3 -0
- package/dist-es/submodules/serde/value/NumericValue.js +2 -2
- package/dist-types/submodules/cbor/CborCodec.d.ts +3 -25
- package/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/dist-types/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +13 -0
- package/dist-types/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +15 -0
- package/dist-types/submodules/cbor/codec-v2/SinglePassCborShapeDeserializer.d.ts +19 -0
- package/dist-types/submodules/cbor/codec-v2/SinglePassCborShapeSerializer.d.ts +22 -0
- package/dist-types/submodules/cbor/index.d.ts +3 -1
- package/dist-types/submodules/retry/service-error-classification/constants.d.ts +1 -0
- package/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +12 -0
- package/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +3 -25
- package/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +13 -0
- package/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +15 -0
- package/dist-types/ts3.4/submodules/cbor/codec-v2/SinglePassCborShapeDeserializer.d.ts +19 -0
- package/dist-types/ts3.4/submodules/cbor/codec-v2/SinglePassCborShapeSerializer.d.ts +22 -0
- package/dist-types/ts3.4/submodules/cbor/index.d.ts +3 -1
- package/dist-types/ts3.4/submodules/retry/service-error-classification/constants.d.ts +1 -0
- package/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +12 -0
- package/package.json +2 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import type { Schema, ShapeDeserializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
|
|
7
|
+
read(schema: Schema, bytes: Uint8Array): any;
|
|
8
|
+
/**
|
|
9
|
+
* Public because it's called by the protocol implementation to deserialize errors.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
readValue(_schema: Schema, value: any): any;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
|
|
7
|
+
private value;
|
|
8
|
+
write(schema: Schema, value: unknown): void;
|
|
9
|
+
/**
|
|
10
|
+
* Recursive serializer transform that copies and prepares the user input object
|
|
11
|
+
* for CBOR serialization.
|
|
12
|
+
*/
|
|
13
|
+
serialize(schema: Schema, source: unknown): any;
|
|
14
|
+
flush(): Uint8Array;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import type { Schema, ShapeDeserializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* Single-pass CBOR deserializer that reads bytes and applies Smithy schema
|
|
5
|
+
* transformations in one traversal using module-level state.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class SinglePassCborShapeDeserializer extends SerdeContext implements ShapeDeserializer<Uint8Array> {
|
|
10
|
+
constructor();
|
|
11
|
+
read(schema: Schema, bytes: Uint8Array): any;
|
|
12
|
+
/**
|
|
13
|
+
* Deserialize a pre-decoded JS object per schema.
|
|
14
|
+
* Used by protocol error handling which passes pre-decoded objects.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
readValue(_schema: Schema, value: any): any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
|
|
5
|
+
* directly to a module-level buffer in one traversal. Eliminates the intermediate
|
|
6
|
+
* JS object tree that the multi-pass CborShapeSerializer builds.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class SinglePassCborShapeSerializer extends SerdeContext implements ShapeSerializer<Uint8Array> {
|
|
11
|
+
constructor();
|
|
12
|
+
write(schema: Schema, value: unknown): void;
|
|
13
|
+
flush(): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Advance the encoding epoch. Call between serialization batches
|
|
17
|
+
* to allow stale cache entries to be evicted.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function advanceSinglePassEncodingEpoch(): void;
|
|
22
|
+
export declare function activateCborStructIterator(): void;
|
|
@@ -2,4 +2,6 @@ export { cbor } from "./cbor";
|
|
|
2
2
|
export { tag, tagSymbol } from "./cbor-types";
|
|
3
3
|
export { buildHttpRpcRequest, checkCborResponse, dateToTag, loadSmithyRpcV2CborErrorCode, parseCborBody, parseCborErrorBody, } from "./parseCborBody";
|
|
4
4
|
export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
|
|
5
|
-
export { CborCodec
|
|
5
|
+
export { CborCodec } from "./CborCodec";
|
|
6
|
+
export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
7
|
+
export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
@@ -136,6 +136,18 @@ export declare class NormalizedSchema implements INormalizedSchema {
|
|
|
136
136
|
* This avoids the overhead of calling Object.entries(ns.getMemberSchemas()).
|
|
137
137
|
*/
|
|
138
138
|
structIterator(): Generator<[string, NormalizedSchema], undefined, undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* CBOR-optimized struct iteration. Returns a cache of parallel arrays
|
|
141
|
+
* (memberNames, memberSchemas, encodedKeys) for direct indexed iteration.
|
|
142
|
+
* Implementation is patched by the cbor submodule on load.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
structIteratorCbor(): {
|
|
147
|
+
memberNames: string[];
|
|
148
|
+
memberSchemas: NormalizedSchema[];
|
|
149
|
+
encodedKeys: Uint8Array[];
|
|
150
|
+
};
|
|
139
151
|
}
|
|
140
152
|
/**
|
|
141
153
|
* @internal
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
-
import { Codec
|
|
2
|
+
import { Codec } from "@smithy/types";
|
|
3
|
+
import { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
4
|
+
import { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
3
5
|
/**
|
|
4
6
|
* @public
|
|
5
7
|
*/
|
|
@@ -7,27 +9,3 @@ export declare class CborCodec extends SerdeContext implements Codec<Uint8Array,
|
|
|
7
9
|
createSerializer(): CborShapeSerializer;
|
|
8
10
|
createDeserializer(): CborShapeDeserializer;
|
|
9
11
|
}
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
|
|
14
|
-
private value;
|
|
15
|
-
write(schema: Schema, value: unknown): void;
|
|
16
|
-
/**
|
|
17
|
-
* Recursive serializer transform that copies and prepares the user input object
|
|
18
|
-
* for CBOR serialization.
|
|
19
|
-
*/
|
|
20
|
-
serialize(schema: Schema, source: unknown): any;
|
|
21
|
-
flush(): Uint8Array;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
|
|
27
|
-
read(schema: Schema, bytes: Uint8Array): any;
|
|
28
|
-
/**
|
|
29
|
-
* Public because it's called by the protocol implementation to deserialize errors.
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
readValue(_schema: Schema, value: any): any;
|
|
33
|
-
}
|
|
@@ -13,8 +13,8 @@ export declare class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
|
13
13
|
*/
|
|
14
14
|
protected compositeErrorRegistry: TypeRegistry;
|
|
15
15
|
private codec;
|
|
16
|
-
protected serializer: import("
|
|
17
|
-
protected deserializer: import("
|
|
16
|
+
protected serializer: import(".").CborShapeSerializer;
|
|
17
|
+
protected deserializer: import(".").CborShapeDeserializer;
|
|
18
18
|
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
19
|
defaultNamespace: string;
|
|
20
20
|
errorTypeRegistries?: TypeRegistry[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { Schema, ShapeDeserializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
|
|
7
|
+
read(schema: Schema, bytes: Uint8Array): any;
|
|
8
|
+
/**
|
|
9
|
+
* Public because it's called by the protocol implementation to deserialize errors.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
readValue(_schema: Schema, value: any): any;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
|
|
7
|
+
private value;
|
|
8
|
+
write(schema: Schema, value: unknown): void;
|
|
9
|
+
/**
|
|
10
|
+
* Recursive serializer transform that copies and prepares the user input object
|
|
11
|
+
* for CBOR serialization.
|
|
12
|
+
*/
|
|
13
|
+
serialize(schema: Schema, source: unknown): any;
|
|
14
|
+
flush(): Uint8Array;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { Schema, ShapeDeserializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* Single-pass CBOR deserializer that reads bytes and applies Smithy schema
|
|
5
|
+
* transformations in one traversal using module-level state.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class SinglePassCborShapeDeserializer extends SerdeContext implements ShapeDeserializer<Uint8Array> {
|
|
10
|
+
constructor();
|
|
11
|
+
read(schema: Schema, bytes: Uint8Array): any;
|
|
12
|
+
/**
|
|
13
|
+
* Deserialize a pre-decoded JS object per schema.
|
|
14
|
+
* Used by protocol error handling which passes pre-decoded objects.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
readValue(_schema: Schema, value: any): any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
3
|
+
/**
|
|
4
|
+
* Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
|
|
5
|
+
* directly to a module-level buffer in one traversal. Eliminates the intermediate
|
|
6
|
+
* JS object tree that the multi-pass CborShapeSerializer builds.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class SinglePassCborShapeSerializer extends SerdeContext implements ShapeSerializer<Uint8Array> {
|
|
11
|
+
constructor();
|
|
12
|
+
write(schema: Schema, value: unknown): void;
|
|
13
|
+
flush(): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Advance the encoding epoch. Call between serialization batches
|
|
17
|
+
* to allow stale cache entries to be evicted.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function advanceSinglePassEncodingEpoch(): void;
|
|
22
|
+
export declare function activateCborStructIterator(): void;
|
|
@@ -2,4 +2,6 @@ export { cbor } from "./cbor";
|
|
|
2
2
|
export { tag, tagSymbol } from "./cbor-types";
|
|
3
3
|
export { buildHttpRpcRequest, checkCborResponse, dateToTag, loadSmithyRpcV2CborErrorCode, parseCborBody, parseCborErrorBody, } from "./parseCborBody";
|
|
4
4
|
export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
|
|
5
|
-
export { CborCodec
|
|
5
|
+
export { CborCodec } from "./CborCodec";
|
|
6
|
+
export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
7
|
+
export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
@@ -139,6 +139,18 @@ export declare class NormalizedSchema implements INormalizedSchema {
|
|
|
139
139
|
string,
|
|
140
140
|
NormalizedSchema
|
|
141
141
|
], undefined, undefined>;
|
|
142
|
+
/**
|
|
143
|
+
* CBOR-optimized struct iteration. Returns a cache of parallel arrays
|
|
144
|
+
* (memberNames, memberSchemas, encodedKeys) for direct indexed iteration.
|
|
145
|
+
* Implementation is patched by the cbor submodule on load.
|
|
146
|
+
*
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
structIteratorCbor(): {
|
|
150
|
+
memberNames: string[];
|
|
151
|
+
memberSchemas: NormalizedSchema[];
|
|
152
|
+
encodedKeys: Uint8Array[];
|
|
153
|
+
};
|
|
142
154
|
}
|
|
143
155
|
/**
|
|
144
156
|
* @internal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.0",
|
|
4
4
|
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"scripts": {
|
|
221
221
|
"benchmark:cbor": "node ./scripts/cbor-perf.mjs",
|
|
222
222
|
"benchmark:checksum": "node ./scripts/checksum-perf.mjs",
|
|
223
|
+
"benchmark:schema:cbor": "node ./scripts/cbor-shape-perf.mjs",
|
|
223
224
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
224
225
|
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
|
|
225
226
|
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
|