@azure/core-client 1.3.3-alpha.20211026.1 → 1.4.0-alpha.20211206.10
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/CHANGELOG.md +10 -1
- package/README.md +1 -1
- package/dist/index.js +81 -1
- package/dist/index.js.map +1 -1
- package/dist-esm/src/authorizeRequestOnClaimChallenge.js +70 -0
- package/dist-esm/src/authorizeRequestOnClaimChallenge.js.map +1 -0
- package/dist-esm/src/base64.browser.js +7 -0
- package/dist-esm/src/base64.browser.js.map +1 -1
- package/dist-esm/src/base64.js +8 -0
- package/dist-esm/src/base64.js.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/interfaces.js.map +1 -1
- package/dist-esm/src/urlHelpers.js +4 -1
- package/dist-esm/src/urlHelpers.js.map +1 -1
- package/package.json +3 -2
- package/types/3.1/core-client.d.ts +205 -2
- package/types/latest/core-client.d.ts +206 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbortSignalLike } from '@azure/abort-controller';
|
|
2
|
+
import { AuthorizeRequestOnChallengeOptions } from '@azure/core-rest-pipeline';
|
|
2
3
|
import { HttpClient } from '@azure/core-rest-pipeline';
|
|
3
4
|
import { HttpMethods } from '@azure/core-rest-pipeline';
|
|
4
5
|
import { InternalPipelineOptions } from '@azure/core-rest-pipeline';
|
|
@@ -10,6 +11,36 @@ import { PipelineRequest } from '@azure/core-rest-pipeline';
|
|
|
10
11
|
import { PipelineResponse } from '@azure/core-rest-pipeline';
|
|
11
12
|
import { TokenCredential } from '@azure/core-auth';
|
|
12
13
|
import { TransferProgressEvent } from '@azure/core-rest-pipeline';
|
|
14
|
+
/**
|
|
15
|
+
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
|
16
|
+
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
|
17
|
+
*
|
|
18
|
+
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
22
|
+
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
|
23
|
+
*
|
|
24
|
+
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
|
25
|
+
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
|
30
|
+
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
|
31
|
+
*
|
|
32
|
+
* Example challenge with claims:
|
|
33
|
+
*
|
|
34
|
+
* ```
|
|
35
|
+
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
|
36
|
+
* error_description="User session has been revoked",
|
|
37
|
+
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* The base definition of a mapper. Can be used for XML and plain JavaScript objects.
|
|
43
|
+
*/
|
|
13
44
|
export declare interface BaseMapper {
|
|
14
45
|
/**
|
|
15
46
|
* Name for the xml element
|
|
@@ -81,17 +112,46 @@ export declare interface CommonClientOptions extends PipelineOptions {
|
|
|
81
112
|
*/
|
|
82
113
|
allowInsecureConnection?: boolean;
|
|
83
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A mapper composed of other mappers.
|
|
117
|
+
*/
|
|
84
118
|
export declare interface CompositeMapper extends BaseMapper {
|
|
119
|
+
/**
|
|
120
|
+
* The type descriptor of the `CompositeMapper`.
|
|
121
|
+
*/
|
|
85
122
|
type: CompositeMapperType;
|
|
86
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Helps build a mapper that describes how to map a set of properties of an object based on other mappers.
|
|
126
|
+
*
|
|
127
|
+
* Only one of the following properties should be present: `className`, `modelProperties` and `additionalProperties`.
|
|
128
|
+
*/
|
|
87
129
|
export declare interface CompositeMapperType {
|
|
130
|
+
/**
|
|
131
|
+
* Name of the composite mapper type.
|
|
132
|
+
*/
|
|
88
133
|
name: "Composite";
|
|
134
|
+
/**
|
|
135
|
+
* Use `className` to reference another type definition.
|
|
136
|
+
*/
|
|
89
137
|
className?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Use `modelProperties` when the reference to the other type has been resolved.
|
|
140
|
+
*/
|
|
90
141
|
modelProperties?: {
|
|
91
142
|
[propertyName: string]: Mapper;
|
|
92
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Used when a model has `additionalProperties: true`. Allows the generic processing of unnamed model properties on the response object.
|
|
146
|
+
*/
|
|
93
147
|
additionalProperties?: Mapper;
|
|
148
|
+
/**
|
|
149
|
+
* The name of the top-most parent scheme, the one that has no parents.
|
|
150
|
+
*/
|
|
94
151
|
uberParent?: string;
|
|
152
|
+
/**
|
|
153
|
+
* A polymorphic discriminator.
|
|
154
|
+
*/
|
|
95
155
|
polymorphicDiscriminator?: PolymorphicDiscriminator;
|
|
96
156
|
}
|
|
97
157
|
/**
|
|
@@ -151,19 +211,52 @@ export declare interface DeserializationPolicyOptions {
|
|
|
151
211
|
*/
|
|
152
212
|
serializerOptions?: SerializerOptions;
|
|
153
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* A mapper describing plain JavaScript objects used as key/value pairs.
|
|
216
|
+
*/
|
|
154
217
|
export declare interface DictionaryMapper extends BaseMapper {
|
|
218
|
+
/**
|
|
219
|
+
* The type descriptor of the `DictionaryMapper`.
|
|
220
|
+
*/
|
|
155
221
|
type: DictionaryMapperType;
|
|
222
|
+
/**
|
|
223
|
+
* Optionally, a prefix to add to the header collection.
|
|
224
|
+
*/
|
|
156
225
|
headerCollectionPrefix?: string;
|
|
157
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Helps build a mapper that describes how to parse a dictionary of mapped values.
|
|
229
|
+
*/
|
|
158
230
|
export declare interface DictionaryMapperType {
|
|
231
|
+
/**
|
|
232
|
+
* Name of the sequence type mapper.
|
|
233
|
+
*/
|
|
159
234
|
name: "Dictionary";
|
|
235
|
+
/**
|
|
236
|
+
* The mapper to use to map the value of each property in the dictionary.
|
|
237
|
+
*/
|
|
160
238
|
value: Mapper;
|
|
161
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* A mapper describing an enum value.
|
|
242
|
+
*/
|
|
162
243
|
export declare interface EnumMapper extends BaseMapper {
|
|
244
|
+
/**
|
|
245
|
+
* The type descriptor of the `EnumMapper`.
|
|
246
|
+
*/
|
|
163
247
|
type: EnumMapperType;
|
|
164
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Helps build a mapper that describes how to parse an enum value.
|
|
251
|
+
*/
|
|
165
252
|
export declare interface EnumMapperType {
|
|
253
|
+
/**
|
|
254
|
+
* Name of the enum type mapper.
|
|
255
|
+
*/
|
|
166
256
|
name: "Enum";
|
|
257
|
+
/**
|
|
258
|
+
* Values allowed by this mapper.
|
|
259
|
+
*/
|
|
167
260
|
allowedValues: any[];
|
|
168
261
|
}
|
|
169
262
|
/**
|
|
@@ -208,20 +301,63 @@ export declare interface InternalClientPipelineOptions extends InternalPipelineO
|
|
|
208
301
|
*/
|
|
209
302
|
serializationOptions?: SerializationPolicyOptions;
|
|
210
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Mappers are definitions of the data models used in the library.
|
|
306
|
+
* These data models are part of the Operation or Client definitions in the responses or parameters.
|
|
307
|
+
*/
|
|
211
308
|
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;
|
|
309
|
+
/**
|
|
310
|
+
* Description of various value constraints such as integer ranges and string regex.
|
|
311
|
+
*/
|
|
212
312
|
export declare interface MapperConstraints {
|
|
313
|
+
/**
|
|
314
|
+
* The value should be less than or equal to the `InclusiveMaximum` value.
|
|
315
|
+
*/
|
|
213
316
|
InclusiveMaximum?: number;
|
|
317
|
+
/**
|
|
318
|
+
* The value should be less than the `ExclusiveMaximum` value.
|
|
319
|
+
*/
|
|
214
320
|
ExclusiveMaximum?: number;
|
|
321
|
+
/**
|
|
322
|
+
* The value should be greater than or equal to the `InclusiveMinimum` value.
|
|
323
|
+
*/
|
|
215
324
|
InclusiveMinimum?: number;
|
|
325
|
+
/**
|
|
326
|
+
* The value should be greater than the `InclusiveMinimum` value.
|
|
327
|
+
*/
|
|
216
328
|
ExclusiveMinimum?: number;
|
|
329
|
+
/**
|
|
330
|
+
* The length should be smaller than the `MaxLength`.
|
|
331
|
+
*/
|
|
217
332
|
MaxLength?: number;
|
|
333
|
+
/**
|
|
334
|
+
* The length should be bigger than the `MinLength`.
|
|
335
|
+
*/
|
|
218
336
|
MinLength?: number;
|
|
337
|
+
/**
|
|
338
|
+
* The value must match the pattern.
|
|
339
|
+
*/
|
|
219
340
|
Pattern?: RegExp;
|
|
341
|
+
/**
|
|
342
|
+
* The value must contain fewer items than the MaxItems value.
|
|
343
|
+
*/
|
|
220
344
|
MaxItems?: number;
|
|
345
|
+
/**
|
|
346
|
+
* The value must contain more items than the `MinItems` value.
|
|
347
|
+
*/
|
|
221
348
|
MinItems?: number;
|
|
349
|
+
/**
|
|
350
|
+
* The value must contain only unique items.
|
|
351
|
+
*/
|
|
222
352
|
UniqueItems?: true;
|
|
353
|
+
/**
|
|
354
|
+
* The value should be exactly divisible by the `MultipleOf` value.
|
|
355
|
+
*/
|
|
223
356
|
MultipleOf?: number;
|
|
224
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Type of the mapper. Includes known mappers.
|
|
360
|
+
*/
|
|
225
361
|
export declare type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;
|
|
226
362
|
/**
|
|
227
363
|
* Known types of Mappers
|
|
@@ -472,9 +608,25 @@ export declare interface OperationURLParameter extends OperationParameter {
|
|
|
472
608
|
export declare type ParameterPath = string | string[] | {
|
|
473
609
|
[propertyName: string]: ParameterPath;
|
|
474
610
|
};
|
|
611
|
+
/**
|
|
612
|
+
* Used to disambiguate discriminated type unions.
|
|
613
|
+
* For example, if response can have many shapes but also includes a 'kind' field (or similar),
|
|
614
|
+
* that field can be used to determine how to deserialize the response to the correct type.
|
|
615
|
+
*/
|
|
475
616
|
export declare interface PolymorphicDiscriminator {
|
|
617
|
+
/**
|
|
618
|
+
* Name of the discriminant property in the original JSON payload, e.g. `@odata.kind`.
|
|
619
|
+
*/
|
|
476
620
|
serializedName: string;
|
|
621
|
+
/**
|
|
622
|
+
* Name to use on the resulting object instead of the original property name.
|
|
623
|
+
* Useful since the JSON property could be difficult to work with.
|
|
624
|
+
* For example: For a field received as `@odata.kind`, the final object could instead include a property simply named `kind`.
|
|
625
|
+
*/
|
|
477
626
|
clientName: string;
|
|
627
|
+
/**
|
|
628
|
+
* It may contain any other property.
|
|
629
|
+
*/
|
|
478
630
|
[key: string]: string;
|
|
479
631
|
}
|
|
480
632
|
/**
|
|
@@ -487,11 +639,26 @@ export declare type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "M
|
|
|
487
639
|
* May be called multiple times.
|
|
488
640
|
*/
|
|
489
641
|
export declare type RawResponseCallback = (rawResponse: FullOperationResponse, flatResponse: unknown) => void;
|
|
642
|
+
/**
|
|
643
|
+
* A mapper describing arrays.
|
|
644
|
+
*/
|
|
490
645
|
export declare interface SequenceMapper extends BaseMapper {
|
|
646
|
+
/**
|
|
647
|
+
* The type descriptor of the `SequenceMapper`.
|
|
648
|
+
*/
|
|
491
649
|
type: SequenceMapperType;
|
|
492
650
|
}
|
|
651
|
+
/**
|
|
652
|
+
* Helps build a mapper that describes how to parse a sequence of mapped values.
|
|
653
|
+
*/
|
|
493
654
|
export declare interface SequenceMapperType {
|
|
655
|
+
/**
|
|
656
|
+
* Name of the sequence type mapper.
|
|
657
|
+
*/
|
|
494
658
|
name: "Sequence";
|
|
659
|
+
/**
|
|
660
|
+
* The mapper to use to map each one of the properties of the sequence.
|
|
661
|
+
*/
|
|
495
662
|
element: Mapper;
|
|
496
663
|
}
|
|
497
664
|
/**
|
|
@@ -518,16 +685,46 @@ export declare interface SerializationPolicyOptions {
|
|
|
518
685
|
}
|
|
519
686
|
/**
|
|
520
687
|
* Used to map raw response objects to final shapes.
|
|
521
|
-
*
|
|
522
|
-
*
|
|
688
|
+
* Helps packing and unpacking Dates and other encoded types that are not intrinsic to JSON.
|
|
689
|
+
* Also allows pulling values from headers, as well as inserting default values and constants.
|
|
523
690
|
*/
|
|
524
691
|
export declare interface Serializer {
|
|
692
|
+
/**
|
|
693
|
+
* The provided model mapper.
|
|
694
|
+
*/
|
|
525
695
|
readonly modelMappers: {
|
|
526
696
|
[key: string]: any;
|
|
527
697
|
};
|
|
698
|
+
/**
|
|
699
|
+
* Whether the contents are XML or not.
|
|
700
|
+
*/
|
|
528
701
|
readonly isXML: boolean;
|
|
702
|
+
/**
|
|
703
|
+
* Validates constraints, if any. This function will throw if the provided value does not respect those constraints.
|
|
704
|
+
* @param mapper - The definition of data models.
|
|
705
|
+
* @param value - The value.
|
|
706
|
+
* @param objectName - Name of the object. Used in the error messages.
|
|
707
|
+
*/
|
|
529
708
|
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
|
|
709
|
+
/**
|
|
710
|
+
* Serialize the given object based on its metadata defined in the mapper.
|
|
711
|
+
*
|
|
712
|
+
* @param mapper - The mapper which defines the metadata of the serializable object.
|
|
713
|
+
* @param object - A valid Javascript object to be serialized.
|
|
714
|
+
* @param objectName - Name of the serialized object.
|
|
715
|
+
* @param options - additional options to deserialization.
|
|
716
|
+
* @returns A valid serialized Javascript object.
|
|
717
|
+
*/
|
|
530
718
|
serialize(mapper: Mapper, object: any, objectName?: string, options?: SerializerOptions): any;
|
|
719
|
+
/**
|
|
720
|
+
* Deserialize the given object based on its metadata defined in the mapper.
|
|
721
|
+
*
|
|
722
|
+
* @param mapper - The mapper which defines the metadata of the serializable object.
|
|
723
|
+
* @param responseBody - A valid Javascript entity to be deserialized.
|
|
724
|
+
* @param objectName - Name of the deserialized object.
|
|
725
|
+
* @param options - Controls behavior of XML parser and builder.
|
|
726
|
+
* @returns A valid deserialized Javascript object.
|
|
727
|
+
*/
|
|
531
728
|
deserialize(mapper: Mapper, responseBody: any, objectName: string, options?: SerializerOptions): any;
|
|
532
729
|
}
|
|
533
730
|
/**
|
|
@@ -610,7 +807,13 @@ export declare interface ServiceClientOptions extends CommonClientOptions {
|
|
|
610
807
|
*/
|
|
611
808
|
pipeline?: Pipeline;
|
|
612
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* The type of a simple mapper.
|
|
812
|
+
*/
|
|
613
813
|
export declare interface SimpleMapperType {
|
|
814
|
+
/**
|
|
815
|
+
* Name of the type of the property.
|
|
816
|
+
*/
|
|
614
817
|
name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
|
|
615
818
|
}
|
|
616
819
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbortSignalLike } from '@azure/abort-controller';
|
|
2
|
+
import { AuthorizeRequestOnChallengeOptions } from '@azure/core-rest-pipeline';
|
|
2
3
|
import { HttpClient } from '@azure/core-rest-pipeline';
|
|
3
4
|
import { HttpMethods } from '@azure/core-rest-pipeline';
|
|
4
5
|
import { InternalPipelineOptions } from '@azure/core-rest-pipeline';
|
|
@@ -11,6 +12,37 @@ import { PipelineResponse } from '@azure/core-rest-pipeline';
|
|
|
11
12
|
import { TokenCredential } from '@azure/core-auth';
|
|
12
13
|
import { TransferProgressEvent } from '@azure/core-rest-pipeline';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
|
|
17
|
+
* [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
|
|
18
|
+
*
|
|
19
|
+
* Call the `bearerTokenAuthenticationPolicy` with the following options:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
23
|
+
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
|
|
24
|
+
*
|
|
25
|
+
* const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
|
|
26
|
+
* authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Once provided, the `bearerTokenAuthenticationPolicy` policy will internally handle Continuous Access Evaluation (CAE) challenges.
|
|
31
|
+
* When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
|
|
32
|
+
*
|
|
33
|
+
* Example challenge with claims:
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
|
|
37
|
+
* error_description="User session has been revoked",
|
|
38
|
+
* claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The base definition of a mapper. Can be used for XML and plain JavaScript objects.
|
|
45
|
+
*/
|
|
14
46
|
export declare interface BaseMapper {
|
|
15
47
|
/**
|
|
16
48
|
* Name for the xml element
|
|
@@ -84,18 +116,47 @@ export declare interface CommonClientOptions extends PipelineOptions {
|
|
|
84
116
|
allowInsecureConnection?: boolean;
|
|
85
117
|
}
|
|
86
118
|
|
|
119
|
+
/**
|
|
120
|
+
* A mapper composed of other mappers.
|
|
121
|
+
*/
|
|
87
122
|
export declare interface CompositeMapper extends BaseMapper {
|
|
123
|
+
/**
|
|
124
|
+
* The type descriptor of the `CompositeMapper`.
|
|
125
|
+
*/
|
|
88
126
|
type: CompositeMapperType;
|
|
89
127
|
}
|
|
90
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Helps build a mapper that describes how to map a set of properties of an object based on other mappers.
|
|
131
|
+
*
|
|
132
|
+
* Only one of the following properties should be present: `className`, `modelProperties` and `additionalProperties`.
|
|
133
|
+
*/
|
|
91
134
|
export declare interface CompositeMapperType {
|
|
135
|
+
/**
|
|
136
|
+
* Name of the composite mapper type.
|
|
137
|
+
*/
|
|
92
138
|
name: "Composite";
|
|
139
|
+
/**
|
|
140
|
+
* Use `className` to reference another type definition.
|
|
141
|
+
*/
|
|
93
142
|
className?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Use `modelProperties` when the reference to the other type has been resolved.
|
|
145
|
+
*/
|
|
94
146
|
modelProperties?: {
|
|
95
147
|
[propertyName: string]: Mapper;
|
|
96
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Used when a model has `additionalProperties: true`. Allows the generic processing of unnamed model properties on the response object.
|
|
151
|
+
*/
|
|
97
152
|
additionalProperties?: Mapper;
|
|
153
|
+
/**
|
|
154
|
+
* The name of the top-most parent scheme, the one that has no parents.
|
|
155
|
+
*/
|
|
98
156
|
uberParent?: string;
|
|
157
|
+
/**
|
|
158
|
+
* A polymorphic discriminator.
|
|
159
|
+
*/
|
|
99
160
|
polymorphicDiscriminator?: PolymorphicDiscriminator;
|
|
100
161
|
}
|
|
101
162
|
|
|
@@ -162,22 +223,55 @@ export declare interface DeserializationPolicyOptions {
|
|
|
162
223
|
serializerOptions?: SerializerOptions;
|
|
163
224
|
}
|
|
164
225
|
|
|
226
|
+
/**
|
|
227
|
+
* A mapper describing plain JavaScript objects used as key/value pairs.
|
|
228
|
+
*/
|
|
165
229
|
export declare interface DictionaryMapper extends BaseMapper {
|
|
230
|
+
/**
|
|
231
|
+
* The type descriptor of the `DictionaryMapper`.
|
|
232
|
+
*/
|
|
166
233
|
type: DictionaryMapperType;
|
|
234
|
+
/**
|
|
235
|
+
* Optionally, a prefix to add to the header collection.
|
|
236
|
+
*/
|
|
167
237
|
headerCollectionPrefix?: string;
|
|
168
238
|
}
|
|
169
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Helps build a mapper that describes how to parse a dictionary of mapped values.
|
|
242
|
+
*/
|
|
170
243
|
export declare interface DictionaryMapperType {
|
|
244
|
+
/**
|
|
245
|
+
* Name of the sequence type mapper.
|
|
246
|
+
*/
|
|
171
247
|
name: "Dictionary";
|
|
248
|
+
/**
|
|
249
|
+
* The mapper to use to map the value of each property in the dictionary.
|
|
250
|
+
*/
|
|
172
251
|
value: Mapper;
|
|
173
252
|
}
|
|
174
253
|
|
|
254
|
+
/**
|
|
255
|
+
* A mapper describing an enum value.
|
|
256
|
+
*/
|
|
175
257
|
export declare interface EnumMapper extends BaseMapper {
|
|
258
|
+
/**
|
|
259
|
+
* The type descriptor of the `EnumMapper`.
|
|
260
|
+
*/
|
|
176
261
|
type: EnumMapperType;
|
|
177
262
|
}
|
|
178
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Helps build a mapper that describes how to parse an enum value.
|
|
266
|
+
*/
|
|
179
267
|
export declare interface EnumMapperType {
|
|
268
|
+
/**
|
|
269
|
+
* Name of the enum type mapper.
|
|
270
|
+
*/
|
|
180
271
|
name: "Enum";
|
|
272
|
+
/**
|
|
273
|
+
* Values allowed by this mapper.
|
|
274
|
+
*/
|
|
181
275
|
allowedValues: any[];
|
|
182
276
|
}
|
|
183
277
|
|
|
@@ -225,22 +319,65 @@ export declare interface InternalClientPipelineOptions extends InternalPipelineO
|
|
|
225
319
|
serializationOptions?: SerializationPolicyOptions;
|
|
226
320
|
}
|
|
227
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Mappers are definitions of the data models used in the library.
|
|
324
|
+
* These data models are part of the Operation or Client definitions in the responses or parameters.
|
|
325
|
+
*/
|
|
228
326
|
export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;
|
|
229
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Description of various value constraints such as integer ranges and string regex.
|
|
330
|
+
*/
|
|
230
331
|
export declare interface MapperConstraints {
|
|
332
|
+
/**
|
|
333
|
+
* The value should be less than or equal to the `InclusiveMaximum` value.
|
|
334
|
+
*/
|
|
231
335
|
InclusiveMaximum?: number;
|
|
336
|
+
/**
|
|
337
|
+
* The value should be less than the `ExclusiveMaximum` value.
|
|
338
|
+
*/
|
|
232
339
|
ExclusiveMaximum?: number;
|
|
340
|
+
/**
|
|
341
|
+
* The value should be greater than or equal to the `InclusiveMinimum` value.
|
|
342
|
+
*/
|
|
233
343
|
InclusiveMinimum?: number;
|
|
344
|
+
/**
|
|
345
|
+
* The value should be greater than the `InclusiveMinimum` value.
|
|
346
|
+
*/
|
|
234
347
|
ExclusiveMinimum?: number;
|
|
348
|
+
/**
|
|
349
|
+
* The length should be smaller than the `MaxLength`.
|
|
350
|
+
*/
|
|
235
351
|
MaxLength?: number;
|
|
352
|
+
/**
|
|
353
|
+
* The length should be bigger than the `MinLength`.
|
|
354
|
+
*/
|
|
236
355
|
MinLength?: number;
|
|
356
|
+
/**
|
|
357
|
+
* The value must match the pattern.
|
|
358
|
+
*/
|
|
237
359
|
Pattern?: RegExp;
|
|
360
|
+
/**
|
|
361
|
+
* The value must contain fewer items than the MaxItems value.
|
|
362
|
+
*/
|
|
238
363
|
MaxItems?: number;
|
|
364
|
+
/**
|
|
365
|
+
* The value must contain more items than the `MinItems` value.
|
|
366
|
+
*/
|
|
239
367
|
MinItems?: number;
|
|
368
|
+
/**
|
|
369
|
+
* The value must contain only unique items.
|
|
370
|
+
*/
|
|
240
371
|
UniqueItems?: true;
|
|
372
|
+
/**
|
|
373
|
+
* The value should be exactly divisible by the `MultipleOf` value.
|
|
374
|
+
*/
|
|
241
375
|
MultipleOf?: number;
|
|
242
376
|
}
|
|
243
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Type of the mapper. Includes known mappers.
|
|
380
|
+
*/
|
|
244
381
|
export declare type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;
|
|
245
382
|
|
|
246
383
|
/**
|
|
@@ -504,9 +641,25 @@ export declare type ParameterPath = string | string[] | {
|
|
|
504
641
|
[propertyName: string]: ParameterPath;
|
|
505
642
|
};
|
|
506
643
|
|
|
644
|
+
/**
|
|
645
|
+
* Used to disambiguate discriminated type unions.
|
|
646
|
+
* For example, if response can have many shapes but also includes a 'kind' field (or similar),
|
|
647
|
+
* that field can be used to determine how to deserialize the response to the correct type.
|
|
648
|
+
*/
|
|
507
649
|
export declare interface PolymorphicDiscriminator {
|
|
650
|
+
/**
|
|
651
|
+
* Name of the discriminant property in the original JSON payload, e.g. `@odata.kind`.
|
|
652
|
+
*/
|
|
508
653
|
serializedName: string;
|
|
654
|
+
/**
|
|
655
|
+
* Name to use on the resulting object instead of the original property name.
|
|
656
|
+
* Useful since the JSON property could be difficult to work with.
|
|
657
|
+
* For example: For a field received as `@odata.kind`, the final object could instead include a property simply named `kind`.
|
|
658
|
+
*/
|
|
509
659
|
clientName: string;
|
|
660
|
+
/**
|
|
661
|
+
* It may contain any other property.
|
|
662
|
+
*/
|
|
510
663
|
[key: string]: string;
|
|
511
664
|
}
|
|
512
665
|
|
|
@@ -522,12 +675,27 @@ export declare type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "M
|
|
|
522
675
|
*/
|
|
523
676
|
export declare type RawResponseCallback = (rawResponse: FullOperationResponse, flatResponse: unknown) => void;
|
|
524
677
|
|
|
678
|
+
/**
|
|
679
|
+
* A mapper describing arrays.
|
|
680
|
+
*/
|
|
525
681
|
export declare interface SequenceMapper extends BaseMapper {
|
|
682
|
+
/**
|
|
683
|
+
* The type descriptor of the `SequenceMapper`.
|
|
684
|
+
*/
|
|
526
685
|
type: SequenceMapperType;
|
|
527
686
|
}
|
|
528
687
|
|
|
688
|
+
/**
|
|
689
|
+
* Helps build a mapper that describes how to parse a sequence of mapped values.
|
|
690
|
+
*/
|
|
529
691
|
export declare interface SequenceMapperType {
|
|
692
|
+
/**
|
|
693
|
+
* Name of the sequence type mapper.
|
|
694
|
+
*/
|
|
530
695
|
name: "Sequence";
|
|
696
|
+
/**
|
|
697
|
+
* The mapper to use to map each one of the properties of the sequence.
|
|
698
|
+
*/
|
|
531
699
|
element: Mapper;
|
|
532
700
|
}
|
|
533
701
|
|
|
@@ -558,16 +726,46 @@ export declare interface SerializationPolicyOptions {
|
|
|
558
726
|
|
|
559
727
|
/**
|
|
560
728
|
* Used to map raw response objects to final shapes.
|
|
561
|
-
*
|
|
562
|
-
*
|
|
729
|
+
* Helps packing and unpacking Dates and other encoded types that are not intrinsic to JSON.
|
|
730
|
+
* Also allows pulling values from headers, as well as inserting default values and constants.
|
|
563
731
|
*/
|
|
564
732
|
export declare interface Serializer {
|
|
733
|
+
/**
|
|
734
|
+
* The provided model mapper.
|
|
735
|
+
*/
|
|
565
736
|
readonly modelMappers: {
|
|
566
737
|
[key: string]: any;
|
|
567
738
|
};
|
|
739
|
+
/**
|
|
740
|
+
* Whether the contents are XML or not.
|
|
741
|
+
*/
|
|
568
742
|
readonly isXML: boolean;
|
|
743
|
+
/**
|
|
744
|
+
* Validates constraints, if any. This function will throw if the provided value does not respect those constraints.
|
|
745
|
+
* @param mapper - The definition of data models.
|
|
746
|
+
* @param value - The value.
|
|
747
|
+
* @param objectName - Name of the object. Used in the error messages.
|
|
748
|
+
*/
|
|
569
749
|
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
|
|
750
|
+
/**
|
|
751
|
+
* Serialize the given object based on its metadata defined in the mapper.
|
|
752
|
+
*
|
|
753
|
+
* @param mapper - The mapper which defines the metadata of the serializable object.
|
|
754
|
+
* @param object - A valid Javascript object to be serialized.
|
|
755
|
+
* @param objectName - Name of the serialized object.
|
|
756
|
+
* @param options - additional options to deserialization.
|
|
757
|
+
* @returns A valid serialized Javascript object.
|
|
758
|
+
*/
|
|
570
759
|
serialize(mapper: Mapper, object: any, objectName?: string, options?: SerializerOptions): any;
|
|
760
|
+
/**
|
|
761
|
+
* Deserialize the given object based on its metadata defined in the mapper.
|
|
762
|
+
*
|
|
763
|
+
* @param mapper - The mapper which defines the metadata of the serializable object.
|
|
764
|
+
* @param responseBody - A valid Javascript entity to be deserialized.
|
|
765
|
+
* @param objectName - Name of the deserialized object.
|
|
766
|
+
* @param options - Controls behavior of XML parser and builder.
|
|
767
|
+
* @returns A valid deserialized Javascript object.
|
|
768
|
+
*/
|
|
571
769
|
deserialize(mapper: Mapper, responseBody: any, objectName: string, options?: SerializerOptions): any;
|
|
572
770
|
}
|
|
573
771
|
|
|
@@ -654,7 +852,13 @@ export declare interface ServiceClientOptions extends CommonClientOptions {
|
|
|
654
852
|
pipeline?: Pipeline;
|
|
655
853
|
}
|
|
656
854
|
|
|
855
|
+
/**
|
|
856
|
+
* The type of a simple mapper.
|
|
857
|
+
*/
|
|
657
858
|
export declare interface SimpleMapperType {
|
|
859
|
+
/**
|
|
860
|
+
* Name of the type of the property.
|
|
861
|
+
*/
|
|
658
862
|
name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
|
|
659
863
|
}
|
|
660
864
|
|