@jjrawlins/cdk-iam-policy-builder-helper 0.0.56 → 0.0.57

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.
Files changed (96) hide show
  1. package/.jsii +2 -2
  2. package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
  3. package/cdk-iam-policy-builder-helper/version +1 -1
  4. package/node_modules/@smithy/abort-controller/package.json +2 -2
  5. package/node_modules/@smithy/config-resolver/package.json +4 -4
  6. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +3 -15
  7. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +16 -14
  8. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +161 -138
  9. package/node_modules/@smithy/core/dist-es/index.js +1 -1
  10. package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +4 -15
  11. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -2
  12. package/node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js +6 -0
  13. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
  14. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +3 -5
  15. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js +3 -2
  16. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +3 -5
  17. package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +4 -4
  18. package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +5 -1
  19. package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +5 -1
  20. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +24 -6
  21. package/node_modules/@smithy/core/dist-types/index.d.ts +1 -1
  22. package/node_modules/@smithy/core/dist-types/submodules/cbor/CborCodec.d.ts +5 -10
  23. package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +5 -2
  24. package/node_modules/@smithy/core/dist-types/submodules/protocols/SerdeContext.d.ts +8 -0
  25. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +1 -0
  26. package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +3 -4
  27. package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +5 -2
  28. package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +5 -2
  29. package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/ToStringShapeSerializer.d.ts +3 -4
  30. package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +4 -4
  31. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +22 -1
  32. package/node_modules/@smithy/core/dist-types/ts3.4/index.d.ts +1 -1
  33. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +5 -10
  34. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +5 -2
  35. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/SerdeContext.d.ts +8 -0
  36. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
  37. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +3 -4
  38. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +5 -2
  39. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +5 -2
  40. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/ToStringShapeSerializer.d.ts +3 -4
  41. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +4 -4
  42. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +22 -1
  43. package/node_modules/@smithy/core/package.json +7 -7
  44. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  45. package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
  46. package/node_modules/@smithy/hash-node/package.json +2 -2
  47. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  48. package/node_modules/@smithy/middleware-content-length/package.json +3 -3
  49. package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
  50. package/node_modules/@smithy/middleware-retry/package.json +8 -8
  51. package/node_modules/@smithy/middleware-serde/package.json +3 -3
  52. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  53. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  54. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +30 -6
  55. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +7 -3
  56. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +1 -1
  57. package/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
  58. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +2 -3
  59. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
  60. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
  61. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  62. package/node_modules/@smithy/property-provider/package.json +2 -2
  63. package/node_modules/@smithy/protocol-http/package.json +2 -2
  64. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  65. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  66. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  67. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  68. package/node_modules/@smithy/signature-v4/package.json +4 -4
  69. package/node_modules/@smithy/smithy-client/dist-cjs/index.js +5 -4
  70. package/node_modules/@smithy/smithy-client/dist-es/command.js +5 -4
  71. package/node_modules/@smithy/smithy-client/dist-types/command.d.ts +3 -3
  72. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/command.d.ts +3 -3
  73. package/node_modules/@smithy/smithy-client/package.json +7 -7
  74. package/node_modules/@smithy/types/dist-es/index.js +1 -0
  75. package/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
  76. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +17 -10
  77. package/node_modules/@smithy/types/dist-types/index.d.ts +1 -0
  78. package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +2 -1
  79. package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +82 -0
  80. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +17 -10
  81. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +1 -0
  82. package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +2 -1
  83. package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +101 -0
  84. package/node_modules/@smithy/types/package.json +1 -1
  85. package/node_modules/@smithy/url-parser/package.json +3 -3
  86. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  87. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  88. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  89. package/node_modules/@smithy/util-middleware/package.json +2 -2
  90. package/node_modules/@smithy/util-retry/package.json +3 -3
  91. package/node_modules/@smithy/util-stream/package.json +4 -4
  92. package/node_modules/@smithy/util-waiter/package.json +3 -3
  93. package/package.json +2 -2
  94. /package/node_modules/@smithy/core/dist-es/{protocols → request-builder}/requestBuilder.js +0 -0
  95. /package/node_modules/@smithy/core/dist-types/{protocols → request-builder}/requestBuilder.d.ts +0 -0
  96. /package/node_modules/@smithy/core/dist-types/ts3.4/{protocols → request-builder}/requestBuilder.d.ts +0 -0
@@ -1,17 +1,15 @@
1
1
  import { NormalizedSchema } from "@smithy/core/schema";
2
2
  import { dateToUtcString, LazyJsonString, quoteHeader } from "@smithy/core/serde";
3
3
  import { toBase64 } from "@smithy/util-base64";
4
+ import { SerdeContext } from "../SerdeContext";
4
5
  import { determineTimestampFormat } from "./determineTimestampFormat";
5
- export class ToStringShapeSerializer {
6
+ export class ToStringShapeSerializer extends SerdeContext {
6
7
  settings;
7
8
  stringBuffer = "";
8
- serdeContext = undefined;
9
9
  constructor(settings) {
10
+ super();
10
11
  this.settings = settings;
11
12
  }
12
- setSerdeContext(serdeContext) {
13
- this.serdeContext = serdeContext;
14
- }
15
13
  write(schema, value) {
16
14
  const ns = NormalizedSchema.of(schema);
17
15
  switch (typeof value) {
@@ -25,11 +25,11 @@ export class TypeRegistry {
25
25
  }
26
26
  return this.schemas.get(id);
27
27
  }
28
- registerError(errorSchema, ctor) {
29
- this.exceptions.set(errorSchema, ctor);
28
+ registerError(es, ctor) {
29
+ this.exceptions.set(es, ctor);
30
30
  }
31
- getErrorCtor(errorSchema) {
32
- return this.exceptions.get(errorSchema);
31
+ getErrorCtor(es) {
32
+ return this.exceptions.get(es);
33
33
  }
34
34
  getBaseException() {
35
35
  for (const [id, schema] of this.schemas.entries()) {
@@ -1,8 +1,12 @@
1
1
  import { HttpResponse } from "@smithy/protocol-http";
2
2
  import { getSmithyContext } from "@smithy/util-middleware";
3
+ import { hydrate, isStaticSchema } from "../schemas/NormalizedSchema";
3
4
  export const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
4
5
  const { response } = await next(args);
5
- const { operationSchema } = getSmithyContext(context);
6
+ let { operationSchema } = getSmithyContext(context);
7
+ if (isStaticSchema(operationSchema)) {
8
+ operationSchema = hydrate(operationSchema);
9
+ }
6
10
  try {
7
11
  const parsed = await config.protocol.deserializeResponse(operationSchema, {
8
12
  ...config,
@@ -1,6 +1,10 @@
1
1
  import { getSmithyContext } from "@smithy/util-middleware";
2
+ import { hydrate, isStaticSchema } from "../schemas/NormalizedSchema";
2
3
  export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
3
- const { operationSchema } = getSmithyContext(context);
4
+ let { operationSchema } = getSmithyContext(context);
5
+ if (isStaticSchema(operationSchema)) {
6
+ operationSchema = hydrate(operationSchema);
7
+ }
4
8
  const endpoint = context.endpointV2?.url && config.urlParser
5
9
  ? async () => config.urlParser(context.endpointV2.url)
6
10
  : config.endpoint;
@@ -1,8 +1,11 @@
1
1
  import { deref } from "../deref";
2
- import { ListSchema } from "./ListSchema";
3
- import { MapSchema } from "./MapSchema";
2
+ import { error } from "./ErrorSchema";
3
+ import { list, ListSchema } from "./ListSchema";
4
+ import { map, MapSchema } from "./MapSchema";
5
+ import { op } from "./OperationSchema";
4
6
  import { Schema } from "./Schema";
5
- import { StructureSchema } from "./StructureSchema";
7
+ import { sim } from "./SimpleSchema";
8
+ import { struct, StructureSchema } from "./StructureSchema";
6
9
  import { translateTraits } from "./translateTraits";
7
10
  export class NormalizedSchema {
8
11
  ref;
@@ -22,12 +25,14 @@ export class NormalizedSchema {
22
25
  let _ref = ref;
23
26
  let schema = ref;
24
27
  this._isMemberSchema = false;
25
- while (Array.isArray(_ref)) {
28
+ while (isMemberSchema(_ref)) {
26
29
  traitStack.push(_ref[1]);
27
30
  _ref = _ref[0];
28
31
  schema = deref(_ref);
29
32
  this._isMemberSchema = true;
30
33
  }
34
+ if (isStaticSchema(schema))
35
+ schema = hydrate(schema);
31
36
  if (traitStack.length > 0) {
32
37
  this.memberTraits = {};
33
38
  for (let i = traitStack.length - 1; i >= 0; --i) {
@@ -66,7 +71,7 @@ export class NormalizedSchema {
66
71
  if (sc instanceof NormalizedSchema) {
67
72
  return sc;
68
73
  }
69
- if (Array.isArray(sc)) {
74
+ if (isMemberSchema(sc)) {
70
75
  const [ns, traits] = sc;
71
76
  if (ns instanceof NormalizedSchema) {
72
77
  Object.assign(ns.getMergedTraits(), translateTraits(traits));
@@ -191,7 +196,7 @@ export class NormalizedSchema {
191
196
  if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
192
197
  const i = struct.memberNames.indexOf(memberName);
193
198
  const memberSchema = struct.memberList[i];
194
- return member(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
199
+ return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
195
200
  }
196
201
  if (this.isDocumentSchema()) {
197
202
  return member([15, 0], memberName);
@@ -241,3 +246,16 @@ function member(memberSchema, memberName) {
241
246
  const internalCtorAccess = NormalizedSchema;
242
247
  return new internalCtorAccess(memberSchema, memberName);
243
248
  }
249
+ export function hydrate(ss) {
250
+ const [id, ...rest] = ss;
251
+ return {
252
+ [0]: sim,
253
+ [1]: list,
254
+ [2]: map,
255
+ [3]: struct,
256
+ [-3]: error,
257
+ [9]: op,
258
+ }[id].call(null, ...rest);
259
+ }
260
+ const isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
261
+ export const isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
@@ -3,6 +3,6 @@ export * from "./middleware-http-auth-scheme";
3
3
  export * from "./middleware-http-signing";
4
4
  export * from "./normalizeProvider";
5
5
  export { createPaginator } from "./pagination/createPaginator";
6
- export * from "./protocols/requestBuilder";
6
+ export * from "./request-builder/requestBuilder";
7
7
  export * from "./setFeature";
8
8
  export * from "./util-identity-and-auth";
@@ -1,20 +1,17 @@
1
- import type { Codec, Schema, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import type { Codec, Schema, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
2
3
  /**
3
4
  * @alpha
4
5
  */
5
- export declare class CborCodec implements Codec<Uint8Array, Uint8Array> {
6
- private serdeContext?;
6
+ export declare class CborCodec extends SerdeContext implements Codec<Uint8Array, Uint8Array> {
7
7
  createSerializer(): CborShapeSerializer;
8
8
  createDeserializer(): CborShapeDeserializer;
9
- setSerdeContext(serdeContext: SerdeFunctions): void;
10
9
  }
11
10
  /**
12
11
  * @alpha
13
12
  */
14
- export declare class CborShapeSerializer implements ShapeSerializer {
15
- private serdeContext?;
13
+ export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
16
14
  private value;
17
- setSerdeContext(serdeContext: SerdeFunctions): void;
18
15
  write(schema: Schema, value: unknown): void;
19
16
  /**
20
17
  * Recursive serializer transform that copies and prepares the user input object
@@ -26,9 +23,7 @@ export declare class CborShapeSerializer implements ShapeSerializer {
26
23
  /**
27
24
  * @alpha
28
25
  */
29
- export declare class CborShapeDeserializer implements ShapeDeserializer {
30
- private serdeContext?;
31
- setSerdeContext(serdeContext: SerdeFunctions): void;
26
+ export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
32
27
  read(schema: Schema, bytes: Uint8Array): any;
33
28
  /**
34
29
  * Public because it's called by the protocol implementation to deserialize errors.
@@ -1,18 +1,18 @@
1
1
  import type { EventStreamSerde } from "@smithy/core/event-streams";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import type { ClientProtocol, Codec, Endpoint, EndpointBearer, EndpointV2, EventStreamMarshaller, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, Schema, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
4
+ import { SerdeContext } from "./SerdeContext";
4
5
  /**
5
6
  * Abstract base for HTTP-based client protocols.
6
7
  *
7
8
  * @alpha
8
9
  */
9
- export declare abstract class HttpProtocol implements ClientProtocol<IHttpRequest, IHttpResponse> {
10
+ export declare abstract class HttpProtocol extends SerdeContext implements ClientProtocol<IHttpRequest, IHttpResponse> {
10
11
  readonly options: {
11
12
  defaultNamespace: string;
12
13
  };
13
14
  protected abstract serializer: ShapeSerializer<string | Uint8Array>;
14
15
  protected abstract deserializer: ShapeDeserializer<string | Uint8Array>;
15
- protected serdeContext?: SerdeFunctions;
16
16
  protected constructor(options: {
17
17
  defaultNamespace: string;
18
18
  });
@@ -20,6 +20,9 @@ export declare abstract class HttpProtocol implements ClientProtocol<IHttpReques
20
20
  abstract getPayloadCodec(): Codec<any, any>;
21
21
  getRequestType(): new (...args: any[]) => IHttpRequest;
22
22
  getResponseType(): new (...args: any[]) => IHttpResponse;
23
+ /**
24
+ * @override
25
+ */
23
26
  setSerdeContext(serdeContext: SerdeFunctions): void;
24
27
  abstract serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
25
28
  updateServiceEndpoint(request: IHttpRequest, endpoint: EndpointV2 | Endpoint): IHttpRequest;
@@ -0,0 +1,8 @@
1
+ import type { ConfigurableSerdeContext, SerdeFunctions } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare abstract class SerdeContext implements ConfigurableSerdeContext {
6
+ protected serdeContext?: SerdeFunctions;
7
+ setSerdeContext(serdeContext: SerdeFunctions): void;
8
+ }
@@ -10,3 +10,4 @@ export * from "./serde/HttpInterceptingShapeDeserializer";
10
10
  export * from "./serde/HttpInterceptingShapeSerializer";
11
11
  export * from "./serde/ToStringShapeSerializer";
12
12
  export * from "./serde/determineTimestampFormat";
13
+ export * from "./SerdeContext";
@@ -1,14 +1,13 @@
1
- import type { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@smithy/types";
1
+ import type { CodecSettings, Schema, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * This deserializer reads strings.
4
5
  *
5
6
  * @alpha
6
7
  */
7
- export declare class FromStringShapeDeserializer implements ShapeDeserializer<string> {
8
+ export declare class FromStringShapeDeserializer extends SerdeContext implements ShapeDeserializer<string> {
8
9
  private settings;
9
- private serdeContext;
10
10
  constructor(settings: CodecSettings);
11
- setSerdeContext(serdeContext: SerdeFunctions): void;
12
11
  read(_schema: Schema, data: string): any;
13
12
  private base64ToUtf8;
14
13
  }
@@ -1,4 +1,5 @@
1
1
  import type { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * This deserializer is a dispatcher that decides whether to use a string deserializer
4
5
  * or a codec deserializer based on HTTP traits.
@@ -8,11 +9,13 @@ import type { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@
8
9
  *
9
10
  * @alpha
10
11
  */
11
- export declare class HttpInterceptingShapeDeserializer<CodecShapeDeserializer extends ShapeDeserializer<any>> implements ShapeDeserializer<string | Uint8Array> {
12
+ export declare class HttpInterceptingShapeDeserializer<CodecShapeDeserializer extends ShapeDeserializer<any>> extends SerdeContext implements ShapeDeserializer<string | Uint8Array> {
12
13
  private codecDeserializer;
13
14
  private stringDeserializer;
14
- private serdeContext;
15
15
  constructor(codecDeserializer: CodecShapeDeserializer, codecSettings: CodecSettings);
16
+ /**
17
+ * @override
18
+ */
16
19
  setSerdeContext(serdeContext: SerdeFunctions): void;
17
20
  read(schema: Schema, data: string | Uint8Array): any | Promise<any>;
18
21
  }
@@ -1,4 +1,4 @@
1
- import type { CodecSettings, Schema as ISchema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
1
+ import type { CodecSettings, ConfigurableSerdeContext, Schema as ISchema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
2
2
  import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
3
3
  /**
4
4
  * This serializer decides whether to dispatch to a string serializer or a codec serializer
@@ -9,11 +9,14 @@ import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
9
9
  *
10
10
  * @alpha
11
11
  */
12
- export declare class HttpInterceptingShapeSerializer<CodecShapeSerializer extends ShapeSerializer<string | Uint8Array>> implements ShapeSerializer<string | Uint8Array> {
12
+ export declare class HttpInterceptingShapeSerializer<CodecShapeSerializer extends ShapeSerializer<string | Uint8Array>> implements ShapeSerializer<string | Uint8Array>, ConfigurableSerdeContext {
13
13
  private codecSerializer;
14
14
  private stringSerializer;
15
15
  private buffer;
16
16
  constructor(codecSerializer: CodecShapeSerializer, codecSettings: CodecSettings, stringSerializer?: ToStringShapeSerializer);
17
+ /**
18
+ * @override
19
+ */
17
20
  setSerdeContext(serdeContext: SerdeFunctions): void;
18
21
  write(schema: ISchema, value: unknown): void;
19
22
  flush(): string | Uint8Array;
@@ -1,15 +1,14 @@
1
- import type { CodecSettings, Schema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
1
+ import type { CodecSettings, Schema, ShapeSerializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * Serializes a shape to string.
4
5
  *
5
6
  * @alpha
6
7
  */
7
- export declare class ToStringShapeSerializer implements ShapeSerializer<string> {
8
+ export declare class ToStringShapeSerializer extends SerdeContext implements ShapeSerializer<string> {
8
9
  private settings;
9
10
  private stringBuffer;
10
- private serdeContext;
11
11
  constructor(settings: CodecSettings);
12
- setSerdeContext(serdeContext: SerdeFunctions): void;
13
12
  write(schema: Schema, value: unknown): void;
14
13
  flush(): string;
15
14
  }
@@ -1,4 +1,4 @@
1
- import type { Schema as ISchema } from "@smithy/types";
1
+ import type { Schema as ISchema, StaticErrorSchema } from "@smithy/types";
2
2
  import type { ErrorSchema } from "./schemas/ErrorSchema";
3
3
  /**
4
4
  * A way to look up schema by their ShapeId values.
@@ -31,12 +31,12 @@ export declare class TypeRegistry {
31
31
  /**
32
32
  * Associates an error schema with its constructor.
33
33
  */
34
- registerError(errorSchema: ErrorSchema, ctor: any): void;
34
+ registerError(es: ErrorSchema | StaticErrorSchema, ctor: any): void;
35
35
  /**
36
- * @param errorSchema - query.
36
+ * @param es - query.
37
37
  * @returns Error constructor that extends the service's base exception.
38
38
  */
39
- getErrorCtor(errorSchema: ErrorSchema): any;
39
+ getErrorCtor(es: ErrorSchema | StaticErrorSchema): any;
40
40
  /**
41
41
  * The smithy-typescript code generator generates a synthetic (i.e. unmodeled) base exception,
42
42
  * because generated SDKs before the introduction of schemas have the notion of a ServiceBaseException, which
@@ -1,4 +1,10 @@
1
- import type { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject } from "@smithy/types";
1
+ import type { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject, StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticSchema, StaticSimpleSchema, StaticStructureSchema } from "@smithy/types";
2
+ import type { ErrorSchema } from "./ErrorSchema";
3
+ import { ListSchema } from "./ListSchema";
4
+ import { MapSchema } from "./MapSchema";
5
+ import type { OperationSchema } from "./OperationSchema";
6
+ import type { SimpleSchema } from "./SimpleSchema";
7
+ import { StructureSchema } from "./StructureSchema";
2
8
  /**
3
9
  * Wraps both class instances, numeric sentinel values, and member schema pairs.
4
10
  * Presents a consistent interface for interacting with polymorphic schema representations.
@@ -121,3 +127,18 @@ export declare class NormalizedSchema implements INormalizedSchema {
121
127
  */
122
128
  structIterator(): Generator<[string, NormalizedSchema], undefined, undefined>;
123
129
  }
130
+ /**
131
+ * @internal
132
+ * @returns a class instance version of a static schema.
133
+ */
134
+ export declare function hydrate(ss: StaticSimpleSchema): SimpleSchema;
135
+ export declare function hydrate(ss: StaticListSchema): ListSchema;
136
+ export declare function hydrate(ss: StaticMapSchema): MapSchema;
137
+ export declare function hydrate(ss: StaticStructureSchema): StructureSchema;
138
+ export declare function hydrate(ss: StaticErrorSchema): ErrorSchema;
139
+ export declare function hydrate(ss: StaticOperationSchema): OperationSchema;
140
+ export declare function hydrate(ss: StaticSchema): SimpleSchema | ListSchema | MapSchema | StructureSchema | ErrorSchema | OperationSchema;
141
+ /**
142
+ * @internal
143
+ */
144
+ export declare const isStaticSchema: (sc: SchemaRef) => sc is StaticSchema;
@@ -3,6 +3,6 @@ export * from "./middleware-http-auth-scheme";
3
3
  export * from "./middleware-http-signing";
4
4
  export * from "./normalizeProvider";
5
5
  export { createPaginator } from "./pagination/createPaginator";
6
- export * from "./protocols/requestBuilder";
6
+ export * from "./request-builder/requestBuilder";
7
7
  export * from "./setFeature";
8
8
  export * from "./util-identity-and-auth";
@@ -1,20 +1,17 @@
1
- import { Codec, Schema, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
1
+ import { SerdeContext } from "@smithy/core/protocols";
2
+ import { Codec, Schema, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
2
3
  /**
3
4
  * @alpha
4
5
  */
5
- export declare class CborCodec implements Codec<Uint8Array, Uint8Array> {
6
- private serdeContext?;
6
+ export declare class CborCodec extends SerdeContext implements Codec<Uint8Array, Uint8Array> {
7
7
  createSerializer(): CborShapeSerializer;
8
8
  createDeserializer(): CborShapeDeserializer;
9
- setSerdeContext(serdeContext: SerdeFunctions): void;
10
9
  }
11
10
  /**
12
11
  * @alpha
13
12
  */
14
- export declare class CborShapeSerializer implements ShapeSerializer {
15
- private serdeContext?;
13
+ export declare class CborShapeSerializer extends SerdeContext implements ShapeSerializer {
16
14
  private value;
17
- setSerdeContext(serdeContext: SerdeFunctions): void;
18
15
  write(schema: Schema, value: unknown): void;
19
16
  /**
20
17
  * Recursive serializer transform that copies and prepares the user input object
@@ -26,9 +23,7 @@ export declare class CborShapeSerializer implements ShapeSerializer {
26
23
  /**
27
24
  * @alpha
28
25
  */
29
- export declare class CborShapeDeserializer implements ShapeDeserializer {
30
- private serdeContext?;
31
- setSerdeContext(serdeContext: SerdeFunctions): void;
26
+ export declare class CborShapeDeserializer extends SerdeContext implements ShapeDeserializer {
32
27
  read(schema: Schema, bytes: Uint8Array): any;
33
28
  /**
34
29
  * Public because it's called by the protocol implementation to deserialize errors.
@@ -1,18 +1,18 @@
1
1
  import { EventStreamSerde } from "@smithy/core/event-streams";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { ClientProtocol, Codec, Endpoint, EndpointBearer, EndpointV2, EventStreamMarshaller, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, Schema, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
4
+ import { SerdeContext } from "./SerdeContext";
4
5
  /**
5
6
  * Abstract base for HTTP-based client protocols.
6
7
  *
7
8
  * @alpha
8
9
  */
9
- export declare abstract class HttpProtocol implements ClientProtocol<IHttpRequest, IHttpResponse> {
10
+ export declare abstract class HttpProtocol extends SerdeContext implements ClientProtocol<IHttpRequest, IHttpResponse> {
10
11
  readonly options: {
11
12
  defaultNamespace: string;
12
13
  };
13
14
  protected abstract serializer: ShapeSerializer<string | Uint8Array>;
14
15
  protected abstract deserializer: ShapeDeserializer<string | Uint8Array>;
15
- protected serdeContext?: SerdeFunctions;
16
16
  protected constructor(options: {
17
17
  defaultNamespace: string;
18
18
  });
@@ -20,6 +20,9 @@ export declare abstract class HttpProtocol implements ClientProtocol<IHttpReques
20
20
  abstract getPayloadCodec(): Codec<any, any>;
21
21
  getRequestType(): new (...args: any[]) => IHttpRequest;
22
22
  getResponseType(): new (...args: any[]) => IHttpResponse;
23
+ /**
24
+ * @override
25
+ */
23
26
  setSerdeContext(serdeContext: SerdeFunctions): void;
24
27
  abstract serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
25
28
  updateServiceEndpoint(request: IHttpRequest, endpoint: EndpointV2 | Endpoint): IHttpRequest;
@@ -0,0 +1,8 @@
1
+ import { ConfigurableSerdeContext, SerdeFunctions } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare abstract class SerdeContext implements ConfigurableSerdeContext {
6
+ protected serdeContext?: SerdeFunctions;
7
+ setSerdeContext(serdeContext: SerdeFunctions): void;
8
+ }
@@ -10,3 +10,4 @@ export * from "./serde/HttpInterceptingShapeDeserializer";
10
10
  export * from "./serde/HttpInterceptingShapeSerializer";
11
11
  export * from "./serde/ToStringShapeSerializer";
12
12
  export * from "./serde/determineTimestampFormat";
13
+ export * from "./SerdeContext";
@@ -1,14 +1,13 @@
1
- import { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@smithy/types";
1
+ import { CodecSettings, Schema, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * This deserializer reads strings.
4
5
  *
5
6
  * @alpha
6
7
  */
7
- export declare class FromStringShapeDeserializer implements ShapeDeserializer<string> {
8
+ export declare class FromStringShapeDeserializer extends SerdeContext implements ShapeDeserializer<string> {
8
9
  private settings;
9
- private serdeContext;
10
10
  constructor(settings: CodecSettings);
11
- setSerdeContext(serdeContext: SerdeFunctions): void;
12
11
  read(_schema: Schema, data: string): any;
13
12
  private base64ToUtf8;
14
13
  }
@@ -1,4 +1,5 @@
1
1
  import { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * This deserializer is a dispatcher that decides whether to use a string deserializer
4
5
  * or a codec deserializer based on HTTP traits.
@@ -8,11 +9,13 @@ import { CodecSettings, Schema, SerdeFunctions, ShapeDeserializer } from "@smith
8
9
  *
9
10
  * @alpha
10
11
  */
11
- export declare class HttpInterceptingShapeDeserializer<CodecShapeDeserializer extends ShapeDeserializer<any>> implements ShapeDeserializer<string | Uint8Array> {
12
+ export declare class HttpInterceptingShapeDeserializer<CodecShapeDeserializer extends ShapeDeserializer<any>> extends SerdeContext implements ShapeDeserializer<string | Uint8Array> {
12
13
  private codecDeserializer;
13
14
  private stringDeserializer;
14
- private serdeContext;
15
15
  constructor(codecDeserializer: CodecShapeDeserializer, codecSettings: CodecSettings);
16
+ /**
17
+ * @override
18
+ */
16
19
  setSerdeContext(serdeContext: SerdeFunctions): void;
17
20
  read(schema: Schema, data: string | Uint8Array): any | Promise<any>;
18
21
  }
@@ -1,4 +1,4 @@
1
- import { CodecSettings, Schema as ISchema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
1
+ import { CodecSettings, ConfigurableSerdeContext, Schema as ISchema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
2
2
  import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
3
3
  /**
4
4
  * This serializer decides whether to dispatch to a string serializer or a codec serializer
@@ -9,11 +9,14 @@ import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
9
9
  *
10
10
  * @alpha
11
11
  */
12
- export declare class HttpInterceptingShapeSerializer<CodecShapeSerializer extends ShapeSerializer<string | Uint8Array>> implements ShapeSerializer<string | Uint8Array> {
12
+ export declare class HttpInterceptingShapeSerializer<CodecShapeSerializer extends ShapeSerializer<string | Uint8Array>> implements ShapeSerializer<string | Uint8Array>, ConfigurableSerdeContext {
13
13
  private codecSerializer;
14
14
  private stringSerializer;
15
15
  private buffer;
16
16
  constructor(codecSerializer: CodecShapeSerializer, codecSettings: CodecSettings, stringSerializer?: ToStringShapeSerializer);
17
+ /**
18
+ * @override
19
+ */
17
20
  setSerdeContext(serdeContext: SerdeFunctions): void;
18
21
  write(schema: ISchema, value: unknown): void;
19
22
  flush(): string | Uint8Array;
@@ -1,15 +1,14 @@
1
- import { CodecSettings, Schema, SerdeFunctions, ShapeSerializer } from "@smithy/types";
1
+ import { CodecSettings, Schema, ShapeSerializer } from "@smithy/types";
2
+ import { SerdeContext } from "../SerdeContext";
2
3
  /**
3
4
  * Serializes a shape to string.
4
5
  *
5
6
  * @alpha
6
7
  */
7
- export declare class ToStringShapeSerializer implements ShapeSerializer<string> {
8
+ export declare class ToStringShapeSerializer extends SerdeContext implements ShapeSerializer<string> {
8
9
  private settings;
9
10
  private stringBuffer;
10
- private serdeContext;
11
11
  constructor(settings: CodecSettings);
12
- setSerdeContext(serdeContext: SerdeFunctions): void;
13
12
  write(schema: Schema, value: unknown): void;
14
13
  flush(): string;
15
14
  }
@@ -1,4 +1,4 @@
1
- import { Schema as ISchema } from "@smithy/types";
1
+ import { Schema as ISchema, StaticErrorSchema } from "@smithy/types";
2
2
  import { ErrorSchema } from "./schemas/ErrorSchema";
3
3
  /**
4
4
  * A way to look up schema by their ShapeId values.
@@ -31,12 +31,12 @@ export declare class TypeRegistry {
31
31
  /**
32
32
  * Associates an error schema with its constructor.
33
33
  */
34
- registerError(errorSchema: ErrorSchema, ctor: any): void;
34
+ registerError(es: ErrorSchema | StaticErrorSchema, ctor: any): void;
35
35
  /**
36
- * @param errorSchema - query.
36
+ * @param es - query.
37
37
  * @returns Error constructor that extends the service's base exception.
38
38
  */
39
- getErrorCtor(errorSchema: ErrorSchema): any;
39
+ getErrorCtor(es: ErrorSchema | StaticErrorSchema): any;
40
40
  /**
41
41
  * The smithy-typescript code generator generates a synthetic (i.e. unmodeled) base exception,
42
42
  * because generated SDKs before the introduction of schemas have the notion of a ServiceBaseException, which
@@ -1,4 +1,10 @@
1
- import { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject } from "@smithy/types";
1
+ import { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject, StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticSchema, StaticSimpleSchema, StaticStructureSchema } from "@smithy/types";
2
+ import { ErrorSchema } from "./ErrorSchema";
3
+ import { ListSchema } from "./ListSchema";
4
+ import { MapSchema } from "./MapSchema";
5
+ import { OperationSchema } from "./OperationSchema";
6
+ import { SimpleSchema } from "./SimpleSchema";
7
+ import { StructureSchema } from "./StructureSchema";
2
8
  /**
3
9
  * Wraps both class instances, numeric sentinel values, and member schema pairs.
4
10
  * Presents a consistent interface for interacting with polymorphic schema representations.
@@ -124,3 +130,18 @@ export declare class NormalizedSchema implements INormalizedSchema {
124
130
  NormalizedSchema
125
131
  ], undefined, undefined>;
126
132
  }
133
+ /**
134
+ * @internal
135
+ * @returns a class instance version of a static schema.
136
+ */
137
+ export declare function hydrate(ss: StaticSimpleSchema): SimpleSchema;
138
+ export declare function hydrate(ss: StaticListSchema): ListSchema;
139
+ export declare function hydrate(ss: StaticMapSchema): MapSchema;
140
+ export declare function hydrate(ss: StaticStructureSchema): StructureSchema;
141
+ export declare function hydrate(ss: StaticErrorSchema): ErrorSchema;
142
+ export declare function hydrate(ss: StaticOperationSchema): OperationSchema;
143
+ export declare function hydrate(ss: StaticSchema): SimpleSchema | ListSchema | MapSchema | StructureSchema | ErrorSchema | OperationSchema;
144
+ /**
145
+ * @internal
146
+ */
147
+ export declare const isStaticSchema: (sc: SchemaRef) => sc is StaticSchema;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "scripts": {
5
5
  "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline core",
@@ -77,13 +77,13 @@
77
77
  "license": "Apache-2.0",
78
78
  "sideEffects": false,
79
79
  "dependencies": {
80
- "@smithy/middleware-serde": "^4.2.0",
81
- "@smithy/protocol-http": "^5.3.0",
82
- "@smithy/types": "^4.6.0",
80
+ "@smithy/middleware-serde": "^4.2.1",
81
+ "@smithy/protocol-http": "^5.3.1",
82
+ "@smithy/types": "^4.7.0",
83
83
  "@smithy/util-base64": "^4.3.0",
84
84
  "@smithy/util-body-length-browser": "^4.2.0",
85
- "@smithy/util-middleware": "^4.2.0",
86
- "@smithy/util-stream": "^4.5.0",
85
+ "@smithy/util-middleware": "^4.2.1",
86
+ "@smithy/util-stream": "^4.5.1",
87
87
  "@smithy/util-utf8": "^4.2.0",
88
88
  "@smithy/uuid": "^1.1.0",
89
89
  "tslib": "^2.6.2"
@@ -118,7 +118,7 @@
118
118
  "directory": "packages/core"
119
119
  },
120
120
  "devDependencies": {
121
- "@smithy/eventstream-serde-node": "^4.2.0",
121
+ "@smithy/eventstream-serde-node": "^4.2.1",
122
122
  "@types/node": "^18.11.9",
123
123
  "concurrently": "7.0.0",
124
124
  "downlevel-dts": "0.10.1",