@smithy/core 3.31.0 → 3.31.1
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 +1552 -330
- package/dist-cjs/submodules/schema/index.js +0 -3
- package/dist-es/submodules/cbor/CborCodec.js +4 -4
- package/dist-es/submodules/cbor/cbor-encode.js +1 -1
- package/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +8 -0
- package/dist-es/submodules/cbor/codec-v2/{SinglePassCborShapeDeserializer.js → CborShapeDeserializer2.js} +23 -11
- package/dist-es/submodules/cbor/codec-v2/{SinglePassCborShapeSerializer.js → CborShapeSerializer2.js} +8 -17
- package/dist-es/submodules/cbor/index.js +2 -0
- package/dist-es/submodules/schema/schemas/NormalizedSchema.js +0 -3
- package/dist-types/submodules/cbor/CborCodec.d.ts +4 -4
- package/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/dist-types/submodules/cbor/codec-v2/{SinglePassCborShapeDeserializer.d.ts → CborShapeDeserializer2.d.ts} +1 -2
- package/dist-types/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +35 -0
- package/dist-types/submodules/cbor/index.d.ts +2 -0
- package/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +0 -12
- package/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +4 -4
- package/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/dist-types/ts3.4/submodules/cbor/codec-v2/{SinglePassCborShapeDeserializer.d.ts → CborShapeDeserializer2.d.ts} +1 -2
- package/dist-types/ts3.4/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +35 -0
- package/dist-types/ts3.4/submodules/cbor/index.d.ts +2 -0
- package/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +0 -12
- package/package.json +1 -1
- package/dist-types/submodules/cbor/codec-v2/SinglePassCborShapeSerializer.d.ts +0 -22
- package/dist-types/ts3.4/submodules/cbor/codec-v2/SinglePassCborShapeSerializer.d.ts +0 -22
|
@@ -529,9 +529,6 @@ class NormalizedSchema {
|
|
|
529
529
|
}
|
|
530
530
|
struct[anno.it] = it;
|
|
531
531
|
}
|
|
532
|
-
structIteratorCbor() {
|
|
533
|
-
throw new Error("@smithy/core/schema - structIteratorCbor not loaded.");
|
|
534
|
-
}
|
|
535
532
|
}
|
|
536
533
|
function member(memberSchema, memberName) {
|
|
537
534
|
if (memberSchema instanceof NormalizedSchema) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
3
|
+
import { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
4
4
|
export class CborCodec extends SerdeContext {
|
|
5
5
|
createSerializer() {
|
|
6
|
-
const serializer = new
|
|
6
|
+
const serializer = new CborShapeSerializer2();
|
|
7
7
|
serializer.setSerdeContext(this.serdeContext);
|
|
8
8
|
return serializer;
|
|
9
9
|
}
|
|
10
10
|
createDeserializer() {
|
|
11
|
-
const deserializer = new
|
|
11
|
+
const deserializer = new CborShapeDeserializer2();
|
|
12
12
|
deserializer.setSerdeContext(this.serdeContext);
|
|
13
13
|
return deserializer;
|
|
14
14
|
}
|
|
@@ -59,7 +59,7 @@ export function encode(_input) {
|
|
|
59
59
|
ensureSpace(64);
|
|
60
60
|
}
|
|
61
61
|
if (typeof input === "number") {
|
|
62
|
-
if (Number.isInteger(input)) {
|
|
62
|
+
if (Number.isInteger(input) && input >= -0x20000000000000 && input <= 0x1fffffffffffff) {
|
|
63
63
|
const nonNegative = input >= 0;
|
|
64
64
|
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
65
65
|
const value = nonNegative ? input : -input - 1;
|
|
@@ -76,6 +76,14 @@ export class CborShapeSerializer extends SerdeContext {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
else if (ns.isDocumentSchema()) {
|
|
79
|
+
if (Array.isArray(sourceObject)) {
|
|
80
|
+
const newArray = [];
|
|
81
|
+
let i = 0;
|
|
82
|
+
for (const item of sourceObject) {
|
|
83
|
+
newArray[i++] = this.serialize(ns.getValueSchema(), item);
|
|
84
|
+
}
|
|
85
|
+
return newArray;
|
|
86
|
+
}
|
|
79
87
|
for (const key in sourceObject) {
|
|
80
88
|
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
81
89
|
}
|
|
@@ -2,12 +2,8 @@ import { SerdeContext } from "@smithy/core/protocols";
|
|
|
2
2
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
3
|
import { NumericValue, _parseEpochTimestamp, nv } from "@smithy/core/serde";
|
|
4
4
|
import { extendedFloat16, extendedFloat32, extendedFloat64, extendedOneByte, majorList, majorMap, majorNegativeInt64, majorSpecial, majorTag, majorUint64, majorUnstructuredByteString, majorUtf8String, minorIndefinite, specialFalse, specialNull, specialTrue, specialUndefined, } from "../cbor-types";
|
|
5
|
-
import {
|
|
6
|
-
export class
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
activateCborStructIterator();
|
|
10
|
-
}
|
|
5
|
+
import { loadCborStructIterator } from "./CborShapeSerializer2";
|
|
6
|
+
export class CborShapeDeserializer2 extends SerdeContext {
|
|
11
7
|
read(schema, bytes) {
|
|
12
8
|
payload = bytes;
|
|
13
9
|
isBuffer = USE_BUFFER && bytes instanceof Buffer;
|
|
@@ -74,7 +70,8 @@ function readList(ns) {
|
|
|
74
70
|
function readMap(ns) {
|
|
75
71
|
const count = decodeCount();
|
|
76
72
|
if (ns.isStructSchema()) {
|
|
77
|
-
|
|
73
|
+
const startPos = pos;
|
|
74
|
+
return readStruct(ns, count, startPos);
|
|
78
75
|
}
|
|
79
76
|
const valueSchema = ns.isMapSchema() ? ns.getValueSchema() : ns;
|
|
80
77
|
const map = {};
|
|
@@ -84,15 +81,16 @@ function readMap(ns) {
|
|
|
84
81
|
}
|
|
85
82
|
return map;
|
|
86
83
|
}
|
|
87
|
-
function readStruct(ns, count) {
|
|
84
|
+
function readStruct(ns, count, startPos) {
|
|
88
85
|
const isUnion = ns.isUnionSchema();
|
|
89
|
-
const cache = ns
|
|
86
|
+
const cache = loadCborStructIterator(ns);
|
|
90
87
|
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
91
88
|
const z = encodedKeys.length;
|
|
92
89
|
const result = {};
|
|
93
90
|
let unknownKey;
|
|
94
91
|
let unknownValue;
|
|
95
92
|
let unknownCount = 0;
|
|
93
|
+
let hasType = false;
|
|
96
94
|
let hint = 0;
|
|
97
95
|
for (let i = 0; i < count; ++i) {
|
|
98
96
|
const matchIdx = matchStructKey(encodedKeys, z, hint);
|
|
@@ -109,7 +107,10 @@ function readStruct(ns, count) {
|
|
|
109
107
|
else {
|
|
110
108
|
const key = readUtf8String();
|
|
111
109
|
const val = readValue(NormalizedSchema.of(15));
|
|
112
|
-
if (key
|
|
110
|
+
if (key === "__type" && typeof val === "string") {
|
|
111
|
+
hasType = true;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
113
114
|
unknownKey = key;
|
|
114
115
|
unknownValue = val;
|
|
115
116
|
++unknownCount;
|
|
@@ -126,6 +127,17 @@ function readStruct(ns, count) {
|
|
|
126
127
|
result.$unknown = [unknownKey, unknownValue];
|
|
127
128
|
}
|
|
128
129
|
}
|
|
130
|
+
else if (hasType) {
|
|
131
|
+
pos = startPos;
|
|
132
|
+
const docSchema = NormalizedSchema.of(15);
|
|
133
|
+
for (let i = 0; i < count; ++i) {
|
|
134
|
+
const key = readUtf8String();
|
|
135
|
+
const val = readValue(docSchema);
|
|
136
|
+
if (!(key in result)) {
|
|
137
|
+
result[key] = val;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
129
141
|
return result;
|
|
130
142
|
}
|
|
131
143
|
function readTag(ns) {
|
|
@@ -245,7 +257,7 @@ function readListIndefinite(ns) {
|
|
|
245
257
|
function readMapIndefinite(ns) {
|
|
246
258
|
pos += 1;
|
|
247
259
|
if (ns.isStructSchema()) {
|
|
248
|
-
const cache = ns
|
|
260
|
+
const cache = loadCborStructIterator(ns);
|
|
249
261
|
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
250
262
|
const z = encodedKeys.length;
|
|
251
263
|
const isUnion = ns.isUnionSchema();
|
|
@@ -2,11 +2,7 @@ import { SerdeContext } from "@smithy/core/protocols";
|
|
|
2
2
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
3
|
import { NumericValue, fromBase64, generateIdempotencyToken } from "@smithy/core/serde";
|
|
4
4
|
import { extendedFloat16, extendedFloat32, extendedFloat64, majorList, majorMap, majorNegativeInt64, majorSpecial, majorTag, majorUint64, majorUnstructuredByteString, majorUtf8String, specialFalse, specialNull, specialTrue, tagSymbol, } from "../cbor-types";
|
|
5
|
-
export class
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
activateCborStructIterator();
|
|
9
|
-
}
|
|
5
|
+
export class CborShapeSerializer2 extends SerdeContext {
|
|
10
6
|
write(schema, value) {
|
|
11
7
|
cursor = 0;
|
|
12
8
|
const ns = NormalizedSchema.of(schema);
|
|
@@ -24,13 +20,8 @@ export function advanceSinglePassEncodingEpoch() {
|
|
|
24
20
|
encodeCacheEpoch = (encodeCacheEpoch + 1) & 0xffff;
|
|
25
21
|
encodeCacheSaturated = false;
|
|
26
22
|
}
|
|
27
|
-
export function activateCborStructIterator() {
|
|
28
|
-
NormalizedSchema.prototype.structIteratorCbor = function () {
|
|
29
|
-
return loadCborStructIterator(this);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
23
|
const CBOR_STRUCT_CACHE = Symbol.for("@smithy/cbor-struct-cache");
|
|
33
|
-
function loadCborStructIterator(ns) {
|
|
24
|
+
export function loadCborStructIterator(ns) {
|
|
34
25
|
const schema = ns.getSchema();
|
|
35
26
|
const existing = schema[CBOR_STRUCT_CACHE];
|
|
36
27
|
if (existing) {
|
|
@@ -104,15 +95,15 @@ function writeValue(ns, value, container, serdeContext) {
|
|
|
104
95
|
writeString(generateIdempotencyToken());
|
|
105
96
|
return;
|
|
106
97
|
}
|
|
107
|
-
if (value === undefined) {
|
|
108
|
-
ensure(1);
|
|
109
|
-
buf[cursor++] = (majorSpecial << 5) | specialNull;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
98
|
ensure(1);
|
|
113
99
|
buf[cursor++] = (majorSpecial << 5) | specialNull;
|
|
114
100
|
return;
|
|
115
101
|
}
|
|
102
|
+
if (ns.isUnitSchema()) {
|
|
103
|
+
ensure(1);
|
|
104
|
+
encodeHeader(majorMap, 0);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
116
107
|
const isObject = typeof value === "object";
|
|
117
108
|
if (isObject) {
|
|
118
109
|
if (ns.isBlobSchema()) {
|
|
@@ -231,7 +222,7 @@ function writeStruct(ns, value, serdeContext) {
|
|
|
231
222
|
}
|
|
232
223
|
return;
|
|
233
224
|
}
|
|
234
|
-
const cache = ns
|
|
225
|
+
const cache = loadCborStructIterator(ns);
|
|
235
226
|
const { memberNames, memberSchemas, encodedKeys } = cache;
|
|
236
227
|
const z = memberNames.length;
|
|
237
228
|
let headerSize;
|
|
@@ -5,3 +5,5 @@ export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
|
|
|
5
5
|
export { CborCodec } from "./CborCodec";
|
|
6
6
|
export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
7
7
|
export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
8
|
+
export { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
9
|
+
export { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
@@ -288,9 +288,6 @@ export class NormalizedSchema {
|
|
|
288
288
|
}
|
|
289
289
|
struct[anno.it] = it;
|
|
290
290
|
}
|
|
291
|
-
structIteratorCbor() {
|
|
292
|
-
throw new Error("@smithy/core/schema - structIteratorCbor not loaded.");
|
|
293
|
-
}
|
|
294
291
|
}
|
|
295
292
|
function member(memberSchema, memberName) {
|
|
296
293
|
if (memberSchema instanceof NormalizedSchema) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
2
|
import type { Codec } from "@smithy/types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
4
|
+
import { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class CborCodec extends SerdeContext implements Codec<Uint8Array, Uint8Array> {
|
|
9
|
-
createSerializer():
|
|
10
|
-
createDeserializer():
|
|
9
|
+
createSerializer(): CborShapeSerializer2;
|
|
10
|
+
createDeserializer(): CborShapeDeserializer2;
|
|
11
11
|
}
|
|
@@ -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(".").CborShapeSerializer2;
|
|
17
|
+
protected deserializer: import(".").CborShapeDeserializer2;
|
|
18
18
|
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
19
|
defaultNamespace: string;
|
|
20
20
|
errorTypeRegistries?: TypeRegistry[];
|
|
@@ -6,8 +6,7 @@ import type { Schema, ShapeDeserializer } from "@smithy/types";
|
|
|
6
6
|
*
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
10
|
-
constructor();
|
|
9
|
+
export declare class CborShapeDeserializer2 extends SerdeContext implements ShapeDeserializer<Uint8Array> {
|
|
11
10
|
read(schema: Schema, bytes: Uint8Array): any;
|
|
12
11
|
/**
|
|
13
12
|
* Deserialize a pre-decoded JS object per schema.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
|
+
import type { Schema, ShapeSerializer } from "@smithy/types";
|
|
4
|
+
/**
|
|
5
|
+
* Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
|
|
6
|
+
* directly to a module-level buffer in one traversal. Eliminates the intermediate
|
|
7
|
+
* JS object tree that the multi-pass CborShapeSerializer builds.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class CborShapeSerializer2 extends SerdeContext implements ShapeSerializer<Uint8Array> {
|
|
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
|
+
/**
|
|
23
|
+
* Cached CBOR struct iteration data: parallel arrays for direct indexed access.
|
|
24
|
+
*/
|
|
25
|
+
export interface CborStructCache {
|
|
26
|
+
memberNames: string[];
|
|
27
|
+
memberSchemas: NormalizedSchema[];
|
|
28
|
+
encodedKeys: Uint8Array[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds or retrieves the CBOR-specific struct cache for a given NormalizedSchema.
|
|
32
|
+
* On first call, iterates structIterator() to populate NormalizedSchema's own cache,
|
|
33
|
+
* then builds pre-encoded CBOR key bytes for each member.
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadCborStructIterator(ns: NormalizedSchema): CborStructCache;
|
|
@@ -5,3 +5,5 @@ export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
|
|
|
5
5
|
export { CborCodec } from "./CborCodec";
|
|
6
6
|
export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
7
7
|
export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
8
|
+
export { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
9
|
+
export { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
@@ -136,18 +136,6 @@ 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
|
-
};
|
|
151
139
|
}
|
|
152
140
|
/**
|
|
153
141
|
* @internal
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
2
|
import { Codec } from "@smithy/types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
4
|
+
import { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class CborCodec extends SerdeContext implements Codec<Uint8Array, Uint8Array> {
|
|
9
|
-
createSerializer():
|
|
10
|
-
createDeserializer():
|
|
9
|
+
createSerializer(): CborShapeSerializer2;
|
|
10
|
+
createDeserializer(): CborShapeDeserializer2;
|
|
11
11
|
}
|
|
@@ -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(".").CborShapeSerializer2;
|
|
17
|
+
protected deserializer: import(".").CborShapeDeserializer2;
|
|
18
18
|
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
19
|
defaultNamespace: string;
|
|
20
20
|
errorTypeRegistries?: TypeRegistry[];
|
|
@@ -6,8 +6,7 @@ import { Schema, ShapeDeserializer } from "@smithy/types";
|
|
|
6
6
|
*
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
10
|
-
constructor();
|
|
9
|
+
export declare class CborShapeDeserializer2 extends SerdeContext implements ShapeDeserializer<Uint8Array> {
|
|
11
10
|
read(schema: Schema, bytes: Uint8Array): any;
|
|
12
11
|
/**
|
|
13
12
|
* Deserialize a pre-decoded JS object per schema.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SerdeContext } from "@smithy/core/protocols";
|
|
2
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
3
|
+
import { Schema, ShapeSerializer } from "@smithy/types";
|
|
4
|
+
/**
|
|
5
|
+
* Single-pass CBOR serializer that walks the Smithy schema and writes CBOR bytes
|
|
6
|
+
* directly to a module-level buffer in one traversal. Eliminates the intermediate
|
|
7
|
+
* JS object tree that the multi-pass CborShapeSerializer builds.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class CborShapeSerializer2 extends SerdeContext implements ShapeSerializer<Uint8Array> {
|
|
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
|
+
/**
|
|
23
|
+
* Cached CBOR struct iteration data: parallel arrays for direct indexed access.
|
|
24
|
+
*/
|
|
25
|
+
export interface CborStructCache {
|
|
26
|
+
memberNames: string[];
|
|
27
|
+
memberSchemas: NormalizedSchema[];
|
|
28
|
+
encodedKeys: Uint8Array[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds or retrieves the CBOR-specific struct cache for a given NormalizedSchema.
|
|
32
|
+
* On first call, iterates structIterator() to populate NormalizedSchema's own cache,
|
|
33
|
+
* then builds pre-encoded CBOR key bytes for each member.
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadCborStructIterator(ns: NormalizedSchema): CborStructCache;
|
|
@@ -5,3 +5,5 @@ export { SmithyRpcV2CborProtocol } from "./SmithyRpcV2CborProtocol";
|
|
|
5
5
|
export { CborCodec } from "./CborCodec";
|
|
6
6
|
export { CborShapeSerializer } from "./codec-v1/CborShapeSerializer";
|
|
7
7
|
export { CborShapeDeserializer } from "./codec-v1/CborShapeDeserializer";
|
|
8
|
+
export { CborShapeSerializer2 } from "./codec-v2/CborShapeSerializer2";
|
|
9
|
+
export { CborShapeDeserializer2 } from "./codec-v2/CborShapeDeserializer2";
|
|
@@ -139,18 +139,6 @@ 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
|
-
};
|
|
154
142
|
}
|
|
155
143
|
/**
|
|
156
144
|
* @internal
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|