@azure/core-client 1.4.0-alpha.20211123.3 → 1.4.0-alpha.20220106.3

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.
@@ -40,6 +40,9 @@ import { TransferProgressEvent } from '@azure/core-rest-pipeline';
40
40
  */
41
41
  export declare function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
42
42
 
43
+ /**
44
+ * The base definition of a mapper. Can be used for XML and plain JavaScript objects.
45
+ */
43
46
  export declare interface BaseMapper {
44
47
  /**
45
48
  * Name for the xml element
@@ -113,18 +116,47 @@ export declare interface CommonClientOptions extends PipelineOptions {
113
116
  allowInsecureConnection?: boolean;
114
117
  }
115
118
 
119
+ /**
120
+ * A mapper composed of other mappers.
121
+ */
116
122
  export declare interface CompositeMapper extends BaseMapper {
123
+ /**
124
+ * The type descriptor of the `CompositeMapper`.
125
+ */
117
126
  type: CompositeMapperType;
118
127
  }
119
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
+ */
120
134
  export declare interface CompositeMapperType {
135
+ /**
136
+ * Name of the composite mapper type.
137
+ */
121
138
  name: "Composite";
139
+ /**
140
+ * Use `className` to reference another type definition.
141
+ */
122
142
  className?: string;
143
+ /**
144
+ * Use `modelProperties` when the reference to the other type has been resolved.
145
+ */
123
146
  modelProperties?: {
124
147
  [propertyName: string]: Mapper;
125
148
  };
149
+ /**
150
+ * Used when a model has `additionalProperties: true`. Allows the generic processing of unnamed model properties on the response object.
151
+ */
126
152
  additionalProperties?: Mapper;
153
+ /**
154
+ * The name of the top-most parent scheme, the one that has no parents.
155
+ */
127
156
  uberParent?: string;
157
+ /**
158
+ * A polymorphic discriminator.
159
+ */
128
160
  polymorphicDiscriminator?: PolymorphicDiscriminator;
129
161
  }
130
162
 
@@ -191,22 +223,55 @@ export declare interface DeserializationPolicyOptions {
191
223
  serializerOptions?: SerializerOptions;
192
224
  }
193
225
 
226
+ /**
227
+ * A mapper describing plain JavaScript objects used as key/value pairs.
228
+ */
194
229
  export declare interface DictionaryMapper extends BaseMapper {
230
+ /**
231
+ * The type descriptor of the `DictionaryMapper`.
232
+ */
195
233
  type: DictionaryMapperType;
234
+ /**
235
+ * Optionally, a prefix to add to the header collection.
236
+ */
196
237
  headerCollectionPrefix?: string;
197
238
  }
198
239
 
240
+ /**
241
+ * Helps build a mapper that describes how to parse a dictionary of mapped values.
242
+ */
199
243
  export declare interface DictionaryMapperType {
244
+ /**
245
+ * Name of the sequence type mapper.
246
+ */
200
247
  name: "Dictionary";
248
+ /**
249
+ * The mapper to use to map the value of each property in the dictionary.
250
+ */
201
251
  value: Mapper;
202
252
  }
203
253
 
254
+ /**
255
+ * A mapper describing an enum value.
256
+ */
204
257
  export declare interface EnumMapper extends BaseMapper {
258
+ /**
259
+ * The type descriptor of the `EnumMapper`.
260
+ */
205
261
  type: EnumMapperType;
206
262
  }
207
263
 
264
+ /**
265
+ * Helps build a mapper that describes how to parse an enum value.
266
+ */
208
267
  export declare interface EnumMapperType {
268
+ /**
269
+ * Name of the enum type mapper.
270
+ */
209
271
  name: "Enum";
272
+ /**
273
+ * Values allowed by this mapper.
274
+ */
210
275
  allowedValues: any[];
211
276
  }
212
277
 
@@ -254,22 +319,65 @@ export declare interface InternalClientPipelineOptions extends InternalPipelineO
254
319
  serializationOptions?: SerializationPolicyOptions;
255
320
  }
256
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
+ */
257
326
  export declare type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;
258
327
 
328
+ /**
329
+ * Description of various value constraints such as integer ranges and string regex.
330
+ */
259
331
  export declare interface MapperConstraints {
332
+ /**
333
+ * The value should be less than or equal to the `InclusiveMaximum` value.
334
+ */
260
335
  InclusiveMaximum?: number;
336
+ /**
337
+ * The value should be less than the `ExclusiveMaximum` value.
338
+ */
261
339
  ExclusiveMaximum?: number;
340
+ /**
341
+ * The value should be greater than or equal to the `InclusiveMinimum` value.
342
+ */
262
343
  InclusiveMinimum?: number;
344
+ /**
345
+ * The value should be greater than the `InclusiveMinimum` value.
346
+ */
263
347
  ExclusiveMinimum?: number;
348
+ /**
349
+ * The length should be smaller than the `MaxLength`.
350
+ */
264
351
  MaxLength?: number;
352
+ /**
353
+ * The length should be bigger than the `MinLength`.
354
+ */
265
355
  MinLength?: number;
356
+ /**
357
+ * The value must match the pattern.
358
+ */
266
359
  Pattern?: RegExp;
360
+ /**
361
+ * The value must contain fewer items than the MaxItems value.
362
+ */
267
363
  MaxItems?: number;
364
+ /**
365
+ * The value must contain more items than the `MinItems` value.
366
+ */
268
367
  MinItems?: number;
368
+ /**
369
+ * The value must contain only unique items.
370
+ */
269
371
  UniqueItems?: true;
372
+ /**
373
+ * The value should be exactly divisible by the `MultipleOf` value.
374
+ */
270
375
  MultipleOf?: number;
271
376
  }
272
377
 
378
+ /**
379
+ * Type of the mapper. Includes known mappers.
380
+ */
273
381
  export declare type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;
274
382
 
275
383
  /**
@@ -533,9 +641,25 @@ export declare type ParameterPath = string | string[] | {
533
641
  [propertyName: string]: ParameterPath;
534
642
  };
535
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
+ */
536
649
  export declare interface PolymorphicDiscriminator {
650
+ /**
651
+ * Name of the discriminant property in the original JSON payload, e.g. `@odata.kind`.
652
+ */
537
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
+ */
538
659
  clientName: string;
660
+ /**
661
+ * It may contain any other property.
662
+ */
539
663
  [key: string]: string;
540
664
  }
541
665
 
@@ -551,12 +675,27 @@ export declare type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "M
551
675
  */
552
676
  export declare type RawResponseCallback = (rawResponse: FullOperationResponse, flatResponse: unknown) => void;
553
677
 
678
+ /**
679
+ * A mapper describing arrays.
680
+ */
554
681
  export declare interface SequenceMapper extends BaseMapper {
682
+ /**
683
+ * The type descriptor of the `SequenceMapper`.
684
+ */
555
685
  type: SequenceMapperType;
556
686
  }
557
687
 
688
+ /**
689
+ * Helps build a mapper that describes how to parse a sequence of mapped values.
690
+ */
558
691
  export declare interface SequenceMapperType {
692
+ /**
693
+ * Name of the sequence type mapper.
694
+ */
559
695
  name: "Sequence";
696
+ /**
697
+ * The mapper to use to map each one of the properties of the sequence.
698
+ */
560
699
  element: Mapper;
561
700
  }
562
701
 
@@ -587,16 +726,46 @@ export declare interface SerializationPolicyOptions {
587
726
 
588
727
  /**
589
728
  * Used to map raw response objects to final shapes.
590
- * Mostly useful for unpacking/packing Dates and other encoded types that
591
- * are not intrinsic to JSON.
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.
592
731
  */
593
732
  export declare interface Serializer {
733
+ /**
734
+ * The provided model mapper.
735
+ */
594
736
  readonly modelMappers: {
595
737
  [key: string]: any;
596
738
  };
739
+ /**
740
+ * Whether the contents are XML or not.
741
+ */
597
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
+ */
598
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
+ */
599
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
+ */
600
769
  deserialize(mapper: Mapper, responseBody: any, objectName: string, options?: SerializerOptions): any;
601
770
  }
602
771
 
@@ -683,7 +852,13 @@ export declare interface ServiceClientOptions extends CommonClientOptions {
683
852
  pipeline?: Pipeline;
684
853
  }
685
854
 
855
+ /**
856
+ * The type of a simple mapper.
857
+ */
686
858
  export declare interface SimpleMapperType {
859
+ /**
860
+ * Name of the type of the property.
861
+ */
687
862
  name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
688
863
  }
689
864