@smithy/core 3.3.3 → 3.5.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.
Files changed (116) hide show
  1. package/dist-cjs/submodules/cbor/index.js +212 -2
  2. package/dist-cjs/submodules/protocols/index.js +667 -2
  3. package/dist-cjs/submodules/schema/index.js +771 -0
  4. package/dist-cjs/submodules/serde/index.js +680 -2
  5. package/dist-es/submodules/cbor/CborCodec.js +136 -0
  6. package/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +74 -0
  7. package/dist-es/submodules/cbor/index.js +3 -1
  8. package/dist-es/submodules/cbor/parseCborBody.js +3 -2
  9. package/dist-es/submodules/protocols/HttpBindingProtocol.js +183 -0
  10. package/dist-es/submodules/protocols/HttpProtocol.js +164 -0
  11. package/dist-es/submodules/protocols/RpcProtocol.js +68 -0
  12. package/dist-es/submodules/protocols/index.js +7 -0
  13. package/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +64 -0
  14. package/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js +38 -0
  15. package/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js +30 -0
  16. package/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +87 -0
  17. package/dist-es/submodules/protocols/serde/determineTimestampFormat.js +20 -0
  18. package/dist-es/submodules/schema/TypeRegistry.js +49 -0
  19. package/dist-es/submodules/schema/deref.js +6 -0
  20. package/dist-es/submodules/schema/index.js +12 -0
  21. package/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js +23 -0
  22. package/dist-es/submodules/schema/middleware/schema-middleware-types.js +1 -0
  23. package/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +60 -0
  24. package/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +16 -0
  25. package/dist-es/submodules/schema/schemas/ErrorSchema.js +17 -0
  26. package/dist-es/submodules/schema/schemas/ListSchema.js +15 -0
  27. package/dist-es/submodules/schema/schemas/MapSchema.js +16 -0
  28. package/dist-es/submodules/schema/schemas/NormalizedSchema.js +291 -0
  29. package/dist-es/submodules/schema/schemas/OperationSchema.js +16 -0
  30. package/dist-es/submodules/schema/schemas/Schema.js +6 -0
  31. package/dist-es/submodules/schema/schemas/SimpleSchema.js +15 -0
  32. package/dist-es/submodules/schema/schemas/StructureSchema.js +22 -0
  33. package/dist-es/submodules/schema/schemas/sentinels.js +16 -0
  34. package/dist-es/submodules/serde/copyDocumentWithTransform.js +53 -0
  35. package/dist-es/submodules/serde/date-utils.js +190 -0
  36. package/dist-es/submodules/serde/index.js +7 -0
  37. package/dist-es/submodules/serde/lazy-json.js +24 -0
  38. package/dist-es/submodules/serde/parse-utils.js +230 -0
  39. package/dist-es/submodules/serde/quote-header.js +6 -0
  40. package/dist-es/submodules/serde/split-every.js +27 -0
  41. package/dist-es/submodules/serde/split-header.js +37 -0
  42. package/dist-types/submodules/cbor/CborCodec.d.ts +29 -0
  43. package/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +22 -0
  44. package/dist-types/submodules/cbor/index.d.ts +3 -1
  45. package/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +15 -0
  46. package/dist-types/submodules/protocols/HttpProtocol.d.ts +29 -0
  47. package/dist-types/submodules/protocols/RpcProtocol.d.ts +11 -0
  48. package/dist-types/submodules/protocols/index.d.ts +7 -0
  49. package/dist-types/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +14 -0
  50. package/dist-types/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +18 -0
  51. package/dist-types/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +20 -0
  52. package/dist-types/submodules/protocols/serde/ToStringShapeSerializer.d.ts +15 -0
  53. package/dist-types/submodules/protocols/serde/determineTimestampFormat.d.ts +9 -0
  54. package/dist-types/submodules/schema/TypeRegistry.d.ts +55 -0
  55. package/dist-types/submodules/schema/deref.d.ts +6 -0
  56. package/dist-types/submodules/schema/index.d.ts +12 -0
  57. package/dist-types/submodules/schema/middleware/getSchemaSerdePlugin.d.ts +14 -0
  58. package/dist-types/submodules/schema/middleware/schema-middleware-types.d.ts +8 -0
  59. package/dist-types/submodules/schema/middleware/schemaDeserializationMiddleware.d.ts +9 -0
  60. package/dist-types/submodules/schema/middleware/schemaSerializationMiddleware.d.ts +6 -0
  61. package/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +38 -0
  62. package/dist-types/submodules/schema/schemas/ListSchema.d.ts +20 -0
  63. package/dist-types/submodules/schema/schemas/MapSchema.d.ts +25 -0
  64. package/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +122 -0
  65. package/dist-types/submodules/schema/schemas/OperationSchema.d.ts +20 -0
  66. package/dist-types/submodules/schema/schemas/Schema.d.ts +11 -0
  67. package/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +20 -0
  68. package/dist-types/submodules/schema/schemas/StructureSchema.d.ts +21 -0
  69. package/dist-types/submodules/schema/schemas/sentinels.d.ts +21 -0
  70. package/dist-types/submodules/serde/copyDocumentWithTransform.d.ts +5 -0
  71. package/dist-types/submodules/serde/date-utils.d.ts +73 -0
  72. package/dist-types/submodules/serde/index.d.ts +7 -0
  73. package/dist-types/submodules/serde/lazy-json.d.ts +45 -0
  74. package/dist-types/submodules/serde/parse-utils.d.ts +270 -0
  75. package/dist-types/submodules/serde/quote-header.d.ts +6 -0
  76. package/dist-types/submodules/serde/split-every.d.ts +11 -0
  77. package/dist-types/submodules/serde/split-header.d.ts +5 -0
  78. package/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +29 -0
  79. package/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +22 -0
  80. package/dist-types/ts3.4/submodules/cbor/index.d.ts +3 -1
  81. package/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts +15 -0
  82. package/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +29 -0
  83. package/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +11 -0
  84. package/dist-types/ts3.4/submodules/protocols/index.d.ts +7 -0
  85. package/dist-types/ts3.4/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +14 -0
  86. package/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +18 -0
  87. package/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +20 -0
  88. package/dist-types/ts3.4/submodules/protocols/serde/ToStringShapeSerializer.d.ts +15 -0
  89. package/dist-types/ts3.4/submodules/protocols/serde/determineTimestampFormat.d.ts +9 -0
  90. package/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +55 -0
  91. package/dist-types/ts3.4/submodules/schema/deref.d.ts +6 -0
  92. package/dist-types/ts3.4/submodules/schema/index.d.ts +12 -0
  93. package/dist-types/ts3.4/submodules/schema/middleware/getSchemaSerdePlugin.d.ts +14 -0
  94. package/dist-types/ts3.4/submodules/schema/middleware/schema-middleware-types.d.ts +11 -0
  95. package/dist-types/ts3.4/submodules/schema/middleware/schemaDeserializationMiddleware.d.ts +9 -0
  96. package/dist-types/ts3.4/submodules/schema/middleware/schemaSerializationMiddleware.d.ts +6 -0
  97. package/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +38 -0
  98. package/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +20 -0
  99. package/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +25 -0
  100. package/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +125 -0
  101. package/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +20 -0
  102. package/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +11 -0
  103. package/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +20 -0
  104. package/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +24 -0
  105. package/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +21 -0
  106. package/dist-types/ts3.4/submodules/serde/copyDocumentWithTransform.d.ts +5 -0
  107. package/dist-types/ts3.4/submodules/serde/date-utils.d.ts +73 -0
  108. package/dist-types/ts3.4/submodules/serde/index.d.ts +7 -0
  109. package/dist-types/ts3.4/submodules/serde/lazy-json.d.ts +45 -0
  110. package/dist-types/ts3.4/submodules/serde/parse-utils.d.ts +270 -0
  111. package/dist-types/ts3.4/submodules/serde/quote-header.d.ts +6 -0
  112. package/dist-types/ts3.4/submodules/serde/split-every.d.ts +11 -0
  113. package/dist-types/ts3.4/submodules/serde/split-header.d.ts +5 -0
  114. package/package.json +18 -7
  115. package/schema.d.ts +7 -0
  116. package/schema.js +6 -0
@@ -0,0 +1,38 @@
1
+ import { SchemaRef, SchemaTraits } from "@smithy/types";
2
+ import { StructureSchema } from "./StructureSchema";
3
+ /**
4
+ * A schema for a structure shape having the error trait. These represent enumerated operation errors.
5
+ * Because Smithy-TS SDKs use classes for exceptions, whereas plain objects are used for all other data,
6
+ * and have an existing notion of a XYZServiceBaseException, the ErrorSchema differs from a StructureSchema
7
+ * by additionally holding the class reference for the corresponding ServiceException class.
8
+ *
9
+ * @alpha
10
+ */
11
+ export declare class ErrorSchema extends StructureSchema {
12
+ name: string;
13
+ traits: SchemaTraits;
14
+ memberNames: string[];
15
+ memberList: SchemaRef[];
16
+ /**
17
+ * Constructor for a modeled service exception class that extends Error.
18
+ */
19
+ ctor: any;
20
+ constructor(name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[],
21
+ /**
22
+ * Constructor for a modeled service exception class that extends Error.
23
+ */
24
+ ctor: any);
25
+ }
26
+ /**
27
+ * Factory for ErrorSchema, to reduce codegen output and register the schema.
28
+ *
29
+ * @internal
30
+ *
31
+ * @param namespace - shapeId namespace.
32
+ * @param name - shapeId name.
33
+ * @param traits - shape level serde traits.
34
+ * @param memberNames - list of member names.
35
+ * @param memberList - list of schemaRef corresponding to each
36
+ * @param ctor - class reference for the existing Error extending class.
37
+ */
38
+ export declare function error(namespace: string, name: string, traits: SchemaTraits | undefined, memberNames: string[], memberList: SchemaRef[], ctor: any): ErrorSchema;
@@ -0,0 +1,20 @@
1
+ import { ListSchema as IListSchema, SchemaRef, SchemaTraits } from "@smithy/types";
2
+ import { Schema } from "./Schema";
3
+ /**
4
+ * A schema with a single member schema.
5
+ * The deprecated Set type may be represented as a list.
6
+ *
7
+ * @alpha
8
+ */
9
+ export declare class ListSchema extends Schema implements IListSchema {
10
+ name: string;
11
+ traits: SchemaTraits;
12
+ valueSchema: SchemaRef;
13
+ constructor(name: string, traits: SchemaTraits, valueSchema: SchemaRef);
14
+ }
15
+ /**
16
+ * Factory for ListSchema.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function list(namespace: string, name: string, traits: SchemaTraits | undefined, valueSchema: SchemaRef): ListSchema;
@@ -0,0 +1,25 @@
1
+ import { MapSchema as IMapSchema, SchemaRef, SchemaTraits } from "@smithy/types";
2
+ import { Schema } from "./Schema";
3
+ /**
4
+ * A schema with a key schema and value schema.
5
+ * @alpha
6
+ */
7
+ export declare class MapSchema extends Schema implements IMapSchema {
8
+ name: string;
9
+ traits: SchemaTraits;
10
+ /**
11
+ * This is expected to be StringSchema, but may have traits.
12
+ */
13
+ keySchema: SchemaRef;
14
+ valueSchema: SchemaRef;
15
+ constructor(name: string, traits: SchemaTraits,
16
+ /**
17
+ * This is expected to be StringSchema, but may have traits.
18
+ */
19
+ keySchema: SchemaRef, valueSchema: SchemaRef);
20
+ }
21
+ /**
22
+ * Factory for MapSchema.
23
+ * @internal
24
+ */
25
+ export declare function map(namespace: string, name: string, traits: SchemaTraits | undefined, keySchema: SchemaRef, valueSchema: SchemaRef): MapSchema;
@@ -0,0 +1,125 @@
1
+ import { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraits, SchemaTraitsObject } from "@smithy/types";
2
+ /**
3
+ * Wraps both class instances, numeric sentinel values, and member schema pairs.
4
+ * Presents a consistent interface for interacting with polymorphic schema representations.
5
+ *
6
+ * @alpha
7
+ */
8
+ export declare class NormalizedSchema implements INormalizedSchema {
9
+ private readonly ref;
10
+ private memberName?;
11
+ private readonly name;
12
+ private readonly traits;
13
+ private _isMemberSchema;
14
+ private schema;
15
+ private memberTraits;
16
+ private normalizedTraits?;
17
+ /**
18
+ * @param ref - a polymorphic SchemaRef to be dereferenced/normalized.
19
+ * @param memberName - optional memberName if this NormalizedSchema should be considered a member schema.
20
+ */
21
+ constructor(ref: SchemaRef, memberName?: string | undefined);
22
+ /**
23
+ * Static constructor that attempts to avoid wrapping a NormalizedSchema within another.
24
+ */
25
+ static of(ref: SchemaRef, memberName?: string): NormalizedSchema;
26
+ /**
27
+ * @param indicator - numeric indicator for preset trait combination.
28
+ * @returns equivalent trait object.
29
+ */
30
+ static translateTraits(indicator: SchemaTraits): SchemaTraitsObject;
31
+ /**
32
+ * Creates a normalized member schema from the given schema and member name.
33
+ */
34
+ private static memberFrom;
35
+ /**
36
+ * @returns the underlying non-normalized schema.
37
+ */
38
+ getSchema(): Exclude<ISchema, MemberSchema | INormalizedSchema>;
39
+ /**
40
+ * @param withNamespace - qualifies the name.
41
+ * @returns e.g. `MyShape` or `com.namespace#MyShape`.
42
+ */
43
+ getName(withNamespace?: boolean): string | undefined;
44
+ /**
45
+ * @returns the member name if the schema is a member schema.
46
+ * @throws Error when the schema isn't a member schema.
47
+ */
48
+ getMemberName(): string;
49
+ isMemberSchema(): boolean;
50
+ isUnitSchema(): boolean;
51
+ /**
52
+ * boolean methods on this class help control flow in shape serialization and deserialization.
53
+ */
54
+ isListSchema(): boolean;
55
+ isMapSchema(): boolean;
56
+ isDocumentSchema(): boolean;
57
+ isStructSchema(): boolean;
58
+ isBlobSchema(): boolean;
59
+ isTimestampSchema(): boolean;
60
+ isStringSchema(): boolean;
61
+ isBooleanSchema(): boolean;
62
+ isNumericSchema(): boolean;
63
+ isBigIntegerSchema(): boolean;
64
+ isBigDecimalSchema(): boolean;
65
+ isStreaming(): boolean;
66
+ /**
67
+ * @returns own traits merged with member traits, where member traits of the same trait key take priority.
68
+ * This method is cached.
69
+ */
70
+ getMergedTraits(): SchemaTraitsObject;
71
+ /**
72
+ * @returns only the member traits. If the schema is not a member, this returns empty.
73
+ */
74
+ getMemberTraits(): SchemaTraitsObject;
75
+ /**
76
+ * @returns only the traits inherent to the shape or member target shape if this schema is a member.
77
+ * If there are any member traits they are excluded.
78
+ */
79
+ getOwnTraits(): SchemaTraitsObject;
80
+ /**
81
+ * @returns the map's key's schema. Returns a dummy Document schema if this schema is a Document.
82
+ *
83
+ * @throws Error if the schema is not a Map or Document.
84
+ */
85
+ getKeySchema(): NormalizedSchema;
86
+ /**
87
+ * @returns the schema of the map's value or list's member.
88
+ * Returns a dummy Document schema if this schema is a Document.
89
+ *
90
+ * @throws Error if the schema is not a Map, List, nor Document.
91
+ */
92
+ getValueSchema(): NormalizedSchema;
93
+ /**
94
+ * @returns the NormalizedSchema for the given member name. The returned instance will return true for `isMemberSchema()`
95
+ * and will have the member name given.
96
+ * @param member - which member to retrieve and wrap.
97
+ *
98
+ * @throws Error if member does not exist or the schema is neither a document nor structure.
99
+ * Note that errors are assumed to be structures and unions are considered structures for these purposes.
100
+ */
101
+ getMemberSchema(member: string): NormalizedSchema;
102
+ /**
103
+ * This can be used for checking the members as a hashmap.
104
+ * Prefer the structIterator method for iteration.
105
+ *
106
+ * This does NOT return list and map members, it is only for structures.
107
+ *
108
+ * @returns a map of member names to member schemas (normalized).
109
+ */
110
+ getMemberSchemas(): Record<string, NormalizedSchema>;
111
+ /**
112
+ * Allows iteration over members of a structure schema.
113
+ * Each yield is a pair of the member name and member schema.
114
+ *
115
+ * This avoids the overhead of calling Object.entries(ns.getMemberSchemas()).
116
+ */
117
+ structIterator(): Generator<[
118
+ string,
119
+ NormalizedSchema
120
+ ], undefined, undefined>;
121
+ /**
122
+ * @returns a last-resort human-readable name for the schema if it has no other identifiers.
123
+ */
124
+ private getSchemaName;
125
+ }
@@ -0,0 +1,20 @@
1
+ import { OperationSchema as IOperationSchema, SchemaRef, SchemaTraits } from "@smithy/types";
2
+ import { Schema } from "./Schema";
3
+ /**
4
+ * This is used as a reference container for the input/output pair of schema, and for trait
5
+ * detection on the operation that may affect client protocol logic.
6
+ *
7
+ * @alpha
8
+ */
9
+ export declare class OperationSchema extends Schema implements IOperationSchema {
10
+ name: string;
11
+ traits: SchemaTraits;
12
+ input: SchemaRef;
13
+ output: SchemaRef;
14
+ constructor(name: string, traits: SchemaTraits, input: SchemaRef, output: SchemaRef);
15
+ }
16
+ /**
17
+ * Factory for OperationSchema.
18
+ * @internal
19
+ */
20
+ export declare function op(namespace: string, name: string, traits: SchemaTraits | undefined, input: SchemaRef, output: SchemaRef): OperationSchema;
@@ -0,0 +1,11 @@
1
+ import { SchemaTraits, TraitsSchema } from "@smithy/types";
2
+ /**
3
+ * Abstract base for class-based Schema except NormalizedSchema.
4
+ *
5
+ * @alpha
6
+ */
7
+ export declare abstract class Schema implements TraitsSchema {
8
+ name: string;
9
+ traits: SchemaTraits;
10
+ protected constructor(name: string, traits: SchemaTraits);
11
+ }
@@ -0,0 +1,20 @@
1
+ import { SchemaRef, SchemaTraits, TraitsSchema } from "@smithy/types";
2
+ import { Schema } from "./Schema";
3
+ /**
4
+ * Although numeric values exist for most simple schema, this class is used for cases where traits are
5
+ * attached to those schema, since a single number cannot easily represent both a schema and its traits.
6
+ *
7
+ * @alpha
8
+ */
9
+ export declare class SimpleSchema extends Schema implements TraitsSchema {
10
+ name: string;
11
+ schemaRef: SchemaRef;
12
+ traits: SchemaTraits;
13
+ constructor(name: string, schemaRef: SchemaRef, traits: SchemaTraits);
14
+ }
15
+ /**
16
+ * Factory for simple schema class objects.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function sim(namespace: string, name: string, schemaRef: SchemaRef, traits: SchemaTraits): SimpleSchema;
@@ -0,0 +1,24 @@
1
+ import { SchemaRef, SchemaTraits, StructureSchema as IStructureSchema } from "@smithy/types";
2
+ import { Schema } from "./Schema";
3
+ /**
4
+ * A structure schema has a known list of members. This is also used for unions.
5
+ *
6
+ * @alpha
7
+ */
8
+ export declare class StructureSchema extends Schema implements IStructureSchema {
9
+ name: string;
10
+ traits: SchemaTraits;
11
+ memberNames: string[];
12
+ memberList: SchemaRef[];
13
+ members: Record<string, [
14
+ SchemaRef,
15
+ SchemaTraits
16
+ ]>;
17
+ constructor(name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[]);
18
+ }
19
+ /**
20
+ * Factory for StructureSchema.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function struct(namespace: string, name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[]): StructureSchema;
@@ -0,0 +1,21 @@
1
+ import { BigDecimalSchema, BigIntegerSchema, BlobSchema, BooleanSchema, DocumentSchema, ListSchemaModifier, MapSchemaModifier, NumericSchema, StreamingBlobSchema, StringSchema, TimestampDateTimeSchema, TimestampDefaultSchema, TimestampEpochSecondsSchema, TimestampHttpDateSchema } from "@smithy/types";
2
+ /**
3
+ * Schema sentinel runtime values.
4
+ * @alpha
5
+ */
6
+ export declare const SCHEMA: {
7
+ BLOB: BlobSchema;
8
+ STREAMING_BLOB: StreamingBlobSchema;
9
+ BOOLEAN: BooleanSchema;
10
+ STRING: StringSchema;
11
+ NUMERIC: NumericSchema;
12
+ BIG_INTEGER: BigIntegerSchema;
13
+ BIG_DECIMAL: BigDecimalSchema;
14
+ DOCUMENT: DocumentSchema;
15
+ TIMESTAMP_DEFAULT: TimestampDefaultSchema;
16
+ TIMESTAMP_DATE_TIME: TimestampDateTimeSchema;
17
+ TIMESTAMP_HTTP_DATE: TimestampHttpDateSchema;
18
+ TIMESTAMP_EPOCH_SECONDS: TimestampEpochSecondsSchema;
19
+ LIST_MODIFIER: ListSchemaModifier;
20
+ MAP_MODIFIER: MapSchemaModifier;
21
+ };
@@ -0,0 +1,5 @@
1
+ import { SchemaRef } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const copyDocumentWithTransform: (source: any, schemaRef: SchemaRef, transform?: (_: any, schemaRef: SchemaRef) => any) => any;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Builds a proper UTC HttpDate timestamp from a Date object
5
+ * since not all environments will have this as the expected
6
+ * format.
7
+ *
8
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString}
9
+ * - Prior to ECMAScript 2018, the format of the return value
10
+ * - varied according to the platform. The most common return
11
+ * - value was an RFC-1123 formatted date stamp, which is a
12
+ * - slightly updated version of RFC-822 date stamps.
13
+ */
14
+ export declare function dateToUtcString(date: Date): string;
15
+ /**
16
+ * @internal
17
+ *
18
+ * Parses a value into a Date. Returns undefined if the input is null or
19
+ * undefined, throws an error if the input is not a string that can be parsed
20
+ * as an RFC 3339 date.
21
+ *
22
+ * Input strings must conform to RFC3339 section 5.6, and cannot have a UTC
23
+ * offset. Fractional precision is supported.
24
+ *
25
+ * @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
26
+ *
27
+ * @param value - the value to parse
28
+ * @returns a Date or undefined
29
+ */
30
+ export declare const parseRfc3339DateTime: (value: unknown) => Date | undefined;
31
+ /**
32
+ * @internal
33
+ *
34
+ * Parses a value into a Date. Returns undefined if the input is null or
35
+ * undefined, throws an error if the input is not a string that can be parsed
36
+ * as an RFC 3339 date.
37
+ *
38
+ * Input strings must conform to RFC3339 section 5.6, and can have a UTC
39
+ * offset. Fractional precision is supported.
40
+ *
41
+ * @see {@link https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14}
42
+ *
43
+ * @param value - the value to parse
44
+ * @returns a Date or undefined
45
+ */
46
+ export declare const parseRfc3339DateTimeWithOffset: (value: unknown) => Date | undefined;
47
+ /**
48
+ * @internal
49
+ *
50
+ * Parses a value into a Date. Returns undefined if the input is null or
51
+ * undefined, throws an error if the input is not a string that can be parsed
52
+ * as an RFC 7231 IMF-fixdate or obs-date.
53
+ *
54
+ * Input strings must conform to RFC7231 section 7.1.1.1. Fractional seconds are supported.
55
+ *
56
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7231.html#section-7.1.1.1}
57
+ *
58
+ * @param value - the value to parse
59
+ * @returns a Date or undefined
60
+ */
61
+ export declare const parseRfc7231DateTime: (value: unknown) => Date | undefined;
62
+ /**
63
+ * @internal
64
+ *
65
+ * Parses a value into a Date. Returns undefined if the input is null or
66
+ * undefined, throws an error if the input is not a number or a parseable string.
67
+ *
68
+ * Input strings must be an integer or floating point number. Fractional seconds are supported.
69
+ *
70
+ * @param value - the value to parse
71
+ * @returns a Date or undefined
72
+ */
73
+ export declare const parseEpochTimestamp: (value: unknown) => Date | undefined;
@@ -1 +1,8 @@
1
+ export * from "./copyDocumentWithTransform";
2
+ export * from "./date-utils";
3
+ export * from "./lazy-json";
4
+ export * from "./parse-utils";
5
+ export * from "./quote-header";
6
+ export * from "./split-every";
7
+ export * from "./split-header";
1
8
  export * from "./value/NumericValue";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @public
3
+ *
4
+ * A model field with this type means that you may provide a JavaScript
5
+ * object in lieu of a JSON string, and it will be serialized to JSON
6
+ * automatically before being sent in a request.
7
+ *
8
+ * For responses, you will receive a "LazyJsonString", which is a boxed String object
9
+ * with additional mixin methods.
10
+ * To get the string value, call `.toString()`, or to get the JSON object value,
11
+ * call `.deserializeJSON()` or parse it yourself.
12
+ */
13
+ export type AutomaticJsonStringConversion = Parameters<typeof JSON.stringify>[0] | LazyJsonString;
14
+ /**
15
+ * @internal
16
+ */
17
+ export interface LazyJsonString extends String {
18
+ /**
19
+ * @returns the JSON parsing of the string value.
20
+ */
21
+ deserializeJSON(): any;
22
+ /**
23
+ * @returns the original string value rather than a JSON.stringified value.
24
+ */
25
+ toJSON(): string;
26
+ }
27
+ /**
28
+ * @internal
29
+ *
30
+ * Extension of the native String class in the previous implementation
31
+ * has negative global performance impact on method dispatch for strings,
32
+ * and is generally discouraged.
33
+ *
34
+ * This current implementation may look strange, but is necessary to preserve the interface and
35
+ * behavior of extending the String class.
36
+ */
37
+ export declare const LazyJsonString: {
38
+ new (s: string): LazyJsonString;
39
+ (s: string): LazyJsonString;
40
+ from(s: any): LazyJsonString;
41
+ /**
42
+ * @deprecated use #from.
43
+ */
44
+ fromObject(s: any): LazyJsonString;
45
+ };