@typespec/ts-http-runtime 1.0.0-alpha.20241125.6 → 1.0.0-alpha.20241128.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/ts-http-runtime.d.ts +0 -2280
|
@@ -1,2280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a function that returns a promise that can be aborted.
|
|
3
|
-
*/
|
|
4
|
-
export declare type AbortablePromiseBuilder<T> = (abortOptions: {
|
|
5
|
-
abortSignal?: AbortSignalLike;
|
|
6
|
-
}) => Promise<T>;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This error is thrown when an asynchronous operation has been aborted.
|
|
10
|
-
* Check for this error by testing the `name` that the name property of the
|
|
11
|
-
* error matches `"AbortError"`.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts snippet:abort_error
|
|
15
|
-
* import { AbortError } from "@typespec/ts-http-runtime";
|
|
16
|
-
*
|
|
17
|
-
* async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise<void> {
|
|
18
|
-
* if (options.abortSignal.aborted) {
|
|
19
|
-
* throw new AbortError();
|
|
20
|
-
* }
|
|
21
|
-
* // do async work
|
|
22
|
-
* }
|
|
23
|
-
* const controller = new AbortController();
|
|
24
|
-
* controller.abort();
|
|
25
|
-
* try {
|
|
26
|
-
* doAsyncWork({ abortSignal: controller.signal });
|
|
27
|
-
* } catch (e) {
|
|
28
|
-
* if (e instanceof Error && e.name === "AbortError") {
|
|
29
|
-
* // handle abort error here.
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare class AbortError extends Error {
|
|
35
|
-
constructor(message?: string);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Options related to abort controller.
|
|
40
|
-
*/
|
|
41
|
-
export declare interface AbortOptions {
|
|
42
|
-
/**
|
|
43
|
-
* The abortSignal associated with containing operation.
|
|
44
|
-
*/
|
|
45
|
-
abortSignal?: AbortSignalLike;
|
|
46
|
-
/**
|
|
47
|
-
* The abort error message associated with containing operation.
|
|
48
|
-
*/
|
|
49
|
-
abortErrorMsg?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Allows the request to be aborted upon firing of the "abort" event.
|
|
54
|
-
* Compatible with the browser built-in AbortSignal and common polyfills.
|
|
55
|
-
*/
|
|
56
|
-
export declare interface AbortSignalLike {
|
|
57
|
-
/**
|
|
58
|
-
* Indicates if the signal has already been aborted.
|
|
59
|
-
*/
|
|
60
|
-
readonly aborted: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Add new "abort" event listener, only support "abort" event.
|
|
63
|
-
*/
|
|
64
|
-
addEventListener(type: "abort", listener: (this: AbortSignalLike, ev: any) => any, options?: any): void;
|
|
65
|
-
/**
|
|
66
|
-
* Remove "abort" event listener, only support "abort" event.
|
|
67
|
-
*/
|
|
68
|
-
removeEventListener(type: "abort", listener: (this: AbortSignalLike, ev: any) => any, options?: any): void;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Represents an access token with an expiration time.
|
|
73
|
-
*/
|
|
74
|
-
export declare interface AccessToken {
|
|
75
|
-
/**
|
|
76
|
-
* The access token returned by the authentication service.
|
|
77
|
-
*/
|
|
78
|
-
token: string;
|
|
79
|
-
/**
|
|
80
|
-
* The access token's expiration timestamp in milliseconds, UNIX epoch time.
|
|
81
|
-
*/
|
|
82
|
-
expiresOnTimestamp: number;
|
|
83
|
-
/**
|
|
84
|
-
* The timestamp when the access token should be refreshed, in milliseconds, UNIX epoch time.
|
|
85
|
-
*/
|
|
86
|
-
refreshAfterTimestamp?: number;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Adds a credential policy to the pipeline if a credential is provided. If none is provided, no policy is added.
|
|
91
|
-
*/
|
|
92
|
-
export declare function addCredentialPipelinePolicy(pipeline: Pipeline, endpoint: string, options?: AddCredentialPipelinePolicyOptions): void;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Optional parameters for adding a credential policy to the pipeline.
|
|
96
|
-
*/
|
|
97
|
-
export declare interface AddCredentialPipelinePolicyOptions {
|
|
98
|
-
/**
|
|
99
|
-
* Options related to the client.
|
|
100
|
-
*/
|
|
101
|
-
clientOptions?: ClientOptions;
|
|
102
|
-
/**
|
|
103
|
-
* The credential to use.
|
|
104
|
-
*/
|
|
105
|
-
credential?: TokenCredential | KeyCredential;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Represents options you can pass to {@link TracingSpan.addEvent}.
|
|
110
|
-
*/
|
|
111
|
-
export declare interface AddEventOptions {
|
|
112
|
-
/**
|
|
113
|
-
* A set of attributes to attach to the event.
|
|
114
|
-
*/
|
|
115
|
-
attributes?: Record<string, unknown>;
|
|
116
|
-
/**
|
|
117
|
-
* The start time of the event.
|
|
118
|
-
*/
|
|
119
|
-
startTime?: Date;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Used to configure additional policies added to the pipeline at construction.
|
|
124
|
-
*/
|
|
125
|
-
export declare interface AdditionalPolicyConfig {
|
|
126
|
-
/**
|
|
127
|
-
* A policy to be added.
|
|
128
|
-
*/
|
|
129
|
-
policy: PipelinePolicy;
|
|
130
|
-
/**
|
|
131
|
-
* Determines if this policy be applied before or after retry logic.
|
|
132
|
-
* Only use `perRetry` if you need to modify the request again
|
|
133
|
-
* each time the operation is retried due to retryable service
|
|
134
|
-
* issues.
|
|
135
|
-
*/
|
|
136
|
-
position: "perCall" | "perRetry";
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Options when adding a policy to the pipeline.
|
|
141
|
-
* Used to express dependencies on other policies.
|
|
142
|
-
*/
|
|
143
|
-
export declare interface AddPipelineOptions {
|
|
144
|
-
/**
|
|
145
|
-
* Policies that this policy must come before.
|
|
146
|
-
*/
|
|
147
|
-
beforePolicies?: string[];
|
|
148
|
-
/**
|
|
149
|
-
* Policies that this policy must come after.
|
|
150
|
-
*/
|
|
151
|
-
afterPolicies?: string[];
|
|
152
|
-
/**
|
|
153
|
-
* The phase that this policy must come after.
|
|
154
|
-
*/
|
|
155
|
-
afterPhase?: PipelinePhase;
|
|
156
|
-
/**
|
|
157
|
-
* The phase this policy belongs to.
|
|
158
|
-
*/
|
|
159
|
-
phase?: PipelinePhase;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* An interface compatible with NodeJS's `http.Agent`.
|
|
164
|
-
* We want to avoid publicly re-exporting the actual interface,
|
|
165
|
-
* since it might vary across runtime versions.
|
|
166
|
-
*/
|
|
167
|
-
export declare interface Agent {
|
|
168
|
-
/**
|
|
169
|
-
* Destroy any sockets that are currently in use by the agent.
|
|
170
|
-
*/
|
|
171
|
-
destroy(): void;
|
|
172
|
-
/**
|
|
173
|
-
* For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.
|
|
174
|
-
*/
|
|
175
|
-
maxFreeSockets: number;
|
|
176
|
-
/**
|
|
177
|
-
* Determines how many concurrent sockets the agent can have open per origin.
|
|
178
|
-
*/
|
|
179
|
-
maxSockets: number;
|
|
180
|
-
/**
|
|
181
|
-
* An object which contains queues of requests that have not yet been assigned to sockets.
|
|
182
|
-
*/
|
|
183
|
-
requests: unknown;
|
|
184
|
-
/**
|
|
185
|
-
* An object which contains arrays of sockets currently in use by the agent.
|
|
186
|
-
*/
|
|
187
|
-
sockets: unknown;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Options sent to the authorizeRequestOnChallenge callback
|
|
192
|
-
*/
|
|
193
|
-
export declare interface AuthorizeRequestOnChallengeOptions {
|
|
194
|
-
/**
|
|
195
|
-
* The scopes for which the bearer token applies.
|
|
196
|
-
*/
|
|
197
|
-
scopes: string[];
|
|
198
|
-
/**
|
|
199
|
-
* Function that retrieves either a cached access token or a new access token.
|
|
200
|
-
*/
|
|
201
|
-
getAccessToken: (scopes: string[], options: GetTokenOptions) => Promise<AccessToken | null>;
|
|
202
|
-
/**
|
|
203
|
-
* Request that the policy is trying to fulfill.
|
|
204
|
-
*/
|
|
205
|
-
request: PipelineRequest;
|
|
206
|
-
/**
|
|
207
|
-
* Response containing the challenge.
|
|
208
|
-
*/
|
|
209
|
-
response: PipelineResponse;
|
|
210
|
-
/**
|
|
211
|
-
* A logger, if one was sent through the HTTP pipeline.
|
|
212
|
-
*/
|
|
213
|
-
logger?: TypeSpecRuntimeLogger;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Options sent to the authorizeRequest callback
|
|
218
|
-
*/
|
|
219
|
-
export declare interface AuthorizeRequestOptions {
|
|
220
|
-
/**
|
|
221
|
-
* The scopes for which the bearer token applies.
|
|
222
|
-
*/
|
|
223
|
-
scopes: string[];
|
|
224
|
-
/**
|
|
225
|
-
* Function that retrieves either a cached access token or a new access token.
|
|
226
|
-
*/
|
|
227
|
-
getAccessToken: (scopes: string[], options: GetTokenOptions) => Promise<AccessToken | null>;
|
|
228
|
-
/**
|
|
229
|
-
* Request that the policy is trying to fulfill.
|
|
230
|
-
*/
|
|
231
|
-
request: PipelineRequest;
|
|
232
|
-
/**
|
|
233
|
-
* A logger, if one was sent through the HTTP pipeline.
|
|
234
|
-
*/
|
|
235
|
-
logger?: TypeSpecRuntimeLogger;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* A policy that can request a token from a TokenCredential implementation and
|
|
240
|
-
* then apply it to the Authorization header of a request as a Bearer token.
|
|
241
|
-
*/
|
|
242
|
-
export declare function bearerTokenAuthenticationPolicy(options: BearerTokenAuthenticationPolicyOptions): PipelinePolicy;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* The programmatic identifier of the bearerTokenAuthenticationPolicy.
|
|
246
|
-
*/
|
|
247
|
-
export declare const bearerTokenAuthenticationPolicyName = "bearerTokenAuthenticationPolicy";
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Options to configure the bearerTokenAuthenticationPolicy
|
|
251
|
-
*/
|
|
252
|
-
export declare interface BearerTokenAuthenticationPolicyOptions {
|
|
253
|
-
/**
|
|
254
|
-
* The TokenCredential implementation that can supply the bearer token.
|
|
255
|
-
*/
|
|
256
|
-
credential?: TokenCredential;
|
|
257
|
-
/**
|
|
258
|
-
* The scopes for which the bearer token applies.
|
|
259
|
-
*/
|
|
260
|
-
scopes: string | string[];
|
|
261
|
-
/**
|
|
262
|
-
* Allows for the processing of [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation) challenges.
|
|
263
|
-
* If provided, it must contain at least the `authorizeRequestOnChallenge` method.
|
|
264
|
-
* If provided, after a request is sent, if it has a challenge, it can be processed to re-send the original request with the relevant challenge information.
|
|
265
|
-
*/
|
|
266
|
-
challengeCallbacks?: ChallengeCallbacks;
|
|
267
|
-
/**
|
|
268
|
-
* A logger can be sent for debugging purposes.
|
|
269
|
-
*/
|
|
270
|
-
logger?: TypeSpecRuntimeLogger;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* A part of the request body in a multipart request.
|
|
275
|
-
*/
|
|
276
|
-
export declare interface BodyPart {
|
|
277
|
-
/**
|
|
278
|
-
* The headers for this part of the multipart request.
|
|
279
|
-
*/
|
|
280
|
-
headers: HttpHeaders;
|
|
281
|
-
/**
|
|
282
|
-
* The body of this part of the multipart request.
|
|
283
|
-
*/
|
|
284
|
-
body: ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream)) | ReadableStream<Uint8Array> | NodeJS.ReadableStream | Uint8Array | Blob;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Calculates the delay interval for retry attempts using exponential delay with jitter.
|
|
289
|
-
* @param retryAttempt - The current retry attempt number.
|
|
290
|
-
* @param config - The exponential retry configuration.
|
|
291
|
-
* @returns An object containing the calculated retry delay.
|
|
292
|
-
*/
|
|
293
|
-
export declare function calculateRetryDelay(retryAttempt: number, config: {
|
|
294
|
-
retryDelayInMs: number;
|
|
295
|
-
maxRetryDelayInMs: number;
|
|
296
|
-
}): {
|
|
297
|
-
retryAfterInMs: number;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
|
|
302
|
-
*/
|
|
303
|
-
export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
|
|
304
|
-
abortSignal?: AbortSignalLike;
|
|
305
|
-
}): Promise<T[number]>;
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Options to override the processing of [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation) challenges.
|
|
309
|
-
*/
|
|
310
|
-
export declare interface ChallengeCallbacks {
|
|
311
|
-
/**
|
|
312
|
-
* Allows for the authorization of the main request of this policy before it's sent.
|
|
313
|
-
*/
|
|
314
|
-
authorizeRequest?(options: AuthorizeRequestOptions): Promise<void>;
|
|
315
|
-
/**
|
|
316
|
-
* Allows to handle authentication challenges and to re-authorize the request.
|
|
317
|
-
* The response containing the challenge is `options.response`.
|
|
318
|
-
* If this method returns true, the underlying request will be sent once again.
|
|
319
|
-
* The request may be modified before being sent.
|
|
320
|
-
*/
|
|
321
|
-
authorizeRequestOnChallenge?(options: AuthorizeRequestOnChallengeOptions): Promise<boolean>;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Shape of a Rest Level Client
|
|
326
|
-
*/
|
|
327
|
-
export declare interface Client {
|
|
328
|
-
/**
|
|
329
|
-
* The pipeline used by this client to make requests
|
|
330
|
-
*/
|
|
331
|
-
pipeline: Pipeline;
|
|
332
|
-
/**
|
|
333
|
-
* This method will be used to send request that would check the path to provide
|
|
334
|
-
* strong types. When used by the codegen this type gets overridden with the generated
|
|
335
|
-
* types. For example:
|
|
336
|
-
* ```typescript snippet:path_example
|
|
337
|
-
* import { Client } from "@typespec/ts-http-runtime";
|
|
338
|
-
*
|
|
339
|
-
* type MyClient = Client & {
|
|
340
|
-
* path: Routes;
|
|
341
|
-
* };
|
|
342
|
-
* ```
|
|
343
|
-
*/
|
|
344
|
-
path: Function;
|
|
345
|
-
/**
|
|
346
|
-
* This method allows arbitrary paths and doesn't provide strong types
|
|
347
|
-
*/
|
|
348
|
-
pathUnchecked: PathUnchecked;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* General options that a Rest Level Client can take
|
|
353
|
-
*/
|
|
354
|
-
export declare type ClientOptions = PipelineOptions & {
|
|
355
|
-
/**
|
|
356
|
-
* Credentials information
|
|
357
|
-
*/
|
|
358
|
-
credentials?: {
|
|
359
|
-
/**
|
|
360
|
-
* Authentication scopes for AAD
|
|
361
|
-
*/
|
|
362
|
-
scopes?: string[];
|
|
363
|
-
/**
|
|
364
|
-
* Heder name for Client Secret authentication
|
|
365
|
-
*/
|
|
366
|
-
apiKeyHeaderName?: string;
|
|
367
|
-
};
|
|
368
|
-
/**
|
|
369
|
-
* Endpoint for the client
|
|
370
|
-
*/
|
|
371
|
-
endpoint?: string;
|
|
372
|
-
/**
|
|
373
|
-
* Options for setting a custom apiVersion.
|
|
374
|
-
*/
|
|
375
|
-
apiVersion?: string;
|
|
376
|
-
/**
|
|
377
|
-
* Option to allow calling http (insecure) endpoints
|
|
378
|
-
*/
|
|
379
|
-
allowInsecureConnection?: boolean;
|
|
380
|
-
/**
|
|
381
|
-
* Additional policies to include in the HTTP pipeline.
|
|
382
|
-
*/
|
|
383
|
-
additionalPolicies?: AdditionalPolicyConfig[];
|
|
384
|
-
/**
|
|
385
|
-
* Specify a custom HttpClient when making requests.
|
|
386
|
-
*/
|
|
387
|
-
httpClient?: HttpClient;
|
|
388
|
-
/**
|
|
389
|
-
* Options to configure request/response logging.
|
|
390
|
-
*/
|
|
391
|
-
loggingOptions?: LogPolicyOptions;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Generates a SHA-256 hash.
|
|
396
|
-
* @param content - The data to be included in the hash.
|
|
397
|
-
* @param encoding - The textual encoding to use for the returned hash.
|
|
398
|
-
*/
|
|
399
|
-
export declare function computeSha256Hash(content: string, encoding: "base64" | "hex"): Promise<string>;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Generates a SHA-256 HMAC signature.
|
|
403
|
-
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
|
404
|
-
* @param stringToSign - The data to be signed.
|
|
405
|
-
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
|
406
|
-
*/
|
|
407
|
-
export declare function computeSha256Hmac(key: string, stringToSign: string, encoding: "base64" | "hex"): Promise<string>;
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Creates an abortable promise.
|
|
411
|
-
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
|
|
412
|
-
* @param options - The options for the abortable promise.
|
|
413
|
-
* @returns A promise that can be aborted.
|
|
414
|
-
*/
|
|
415
|
-
export declare function createAbortablePromise<T>(buildPromise: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, options?: CreateAbortablePromiseOptions): Promise<T>;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Options for the createAbortablePromise function.
|
|
419
|
-
*/
|
|
420
|
-
export declare interface CreateAbortablePromiseOptions extends AbortOptions {
|
|
421
|
-
/** A function to be called if the promise was aborted */
|
|
422
|
-
cleanupBeforeAbort?: () => void;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Create the correct HttpClient for the current environment.
|
|
427
|
-
*/
|
|
428
|
-
export declare function createDefaultHttpClient(): HttpClient;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Creates a totally empty pipeline.
|
|
432
|
-
* Useful for testing or creating a custom one.
|
|
433
|
-
*/
|
|
434
|
-
export declare function createEmptyPipeline(): Pipeline;
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Create an object that implements the File interface. This object is intended to be
|
|
438
|
-
* passed into RequestBodyType.formData, and is not guaranteed to work as expected in
|
|
439
|
-
* other situations.
|
|
440
|
-
*
|
|
441
|
-
* Use this function create a File object for use in RequestBodyType.formData in environments where the global File object is unavailable.
|
|
442
|
-
*
|
|
443
|
-
* @param content - the content of the file as a Uint8Array in memory.
|
|
444
|
-
* @param name - the name of the file.
|
|
445
|
-
* @param options - optional metadata about the file, e.g. file name, file size, MIME type.
|
|
446
|
-
*/
|
|
447
|
-
export declare function createFile(content: Uint8Array, name: string, options?: CreateFileOptions): File;
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Create an object that implements the File interface. This object is intended to be
|
|
451
|
-
* passed into RequestBodyType.formData, and is not guaranteed to work as expected in
|
|
452
|
-
* other situations.
|
|
453
|
-
*
|
|
454
|
-
* Use this function to:
|
|
455
|
-
* - Create a File object for use in RequestBodyType.formData in environments where the
|
|
456
|
-
* global File object is unavailable.
|
|
457
|
-
* - Create a File-like object from a readable stream without reading the stream into memory.
|
|
458
|
-
*
|
|
459
|
-
* @param stream - the content of the file as a callback returning a stream. When a File object made using createFile is
|
|
460
|
-
* passed in a request's form data map, the stream will not be read into memory
|
|
461
|
-
* and instead will be streamed when the request is made. In the event of a retry, the
|
|
462
|
-
* stream needs to be read again, so this callback SHOULD return a fresh stream if possible.
|
|
463
|
-
* @param name - the name of the file.
|
|
464
|
-
* @param options - optional metadata about the file, e.g. file name, file size, MIME type.
|
|
465
|
-
*/
|
|
466
|
-
export declare function createFileFromStream(stream: () => ReadableStream<Uint8Array> | NodeJS.ReadableStream, name: string, options?: CreateFileFromStreamOptions): File;
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Extra options for createFile when a stream is being passed in.
|
|
470
|
-
*/
|
|
471
|
-
export declare interface CreateFileFromStreamOptions extends CreateFileOptions {
|
|
472
|
-
/**
|
|
473
|
-
* Size of the file represented by the stream in bytes.
|
|
474
|
-
*
|
|
475
|
-
* This will be used by the pipeline when calculating the Content-Length header
|
|
476
|
-
* for the overall request.
|
|
477
|
-
*/
|
|
478
|
-
size?: number;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Options passed into createFile specifying metadata about the file.
|
|
483
|
-
*/
|
|
484
|
-
export declare interface CreateFileOptions {
|
|
485
|
-
/**
|
|
486
|
-
* The MIME type of the file.
|
|
487
|
-
*/
|
|
488
|
-
type?: string;
|
|
489
|
-
/**
|
|
490
|
-
* Last modified time of the file as a UNIX timestamp.
|
|
491
|
-
* This will default to the current date.
|
|
492
|
-
*/
|
|
493
|
-
lastModified?: number;
|
|
494
|
-
/**
|
|
495
|
-
* relative path of this file when uploading a directory.
|
|
496
|
-
*/
|
|
497
|
-
webkitRelativePath?: string;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Creates an object that satisfies the `HttpHeaders` interface.
|
|
502
|
-
* @param rawHeaders - A simple object representing initial headers
|
|
503
|
-
*/
|
|
504
|
-
export declare function createHttpHeaders(rawHeaders?: RawHttpHeadersInput): HttpHeaders;
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Create a new pipeline with a default set of customizable policies.
|
|
508
|
-
* @param options - Options to configure a custom pipeline.
|
|
509
|
-
*/
|
|
510
|
-
export declare function createPipelineFromOptions(options: InternalPipelineOptions): Pipeline;
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Creates a new pipeline request with the given options.
|
|
514
|
-
* This method is to allow for the easy setting of default values and not required.
|
|
515
|
-
* @param options - The options to create the request with.
|
|
516
|
-
*/
|
|
517
|
-
export declare function createPipelineRequest(options: PipelineRequestOptions): PipelineRequest;
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Creates a rest error from a PathUnchecked response
|
|
521
|
-
*/
|
|
522
|
-
export declare function createRestError(response: PathUncheckedResponse): RestError;
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Creates a rest error from an error message and a PathUnchecked response
|
|
526
|
-
*/
|
|
527
|
-
export declare function createRestError(message: string, response: PathUncheckedResponse): RestError;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Creates a new tracing client.
|
|
531
|
-
*
|
|
532
|
-
* @param options - Options used to configure the tracing client.
|
|
533
|
-
* @returns - An instance of {@link TracingClient}.
|
|
534
|
-
*/
|
|
535
|
-
export declare function createTracingClient(options: TracingClientOptions): TracingClient;
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* A log function that can be dynamically enabled and redirected.
|
|
539
|
-
*/
|
|
540
|
-
export declare interface Debugger {
|
|
541
|
-
/**
|
|
542
|
-
* Logs the given arguments to the `log` method.
|
|
543
|
-
*/
|
|
544
|
-
(...args: any[]): void;
|
|
545
|
-
/**
|
|
546
|
-
* True if this logger is active and logging.
|
|
547
|
-
*/
|
|
548
|
-
enabled: boolean;
|
|
549
|
-
/**
|
|
550
|
-
* Used to cleanup/remove this logger.
|
|
551
|
-
*/
|
|
552
|
-
destroy: () => boolean;
|
|
553
|
-
/**
|
|
554
|
-
* The current log method. Can be overridden to redirect output.
|
|
555
|
-
*/
|
|
556
|
-
log: (...args: any[]) => void;
|
|
557
|
-
/**
|
|
558
|
-
* The namespace of this logger.
|
|
559
|
-
*/
|
|
560
|
-
namespace: string;
|
|
561
|
-
/**
|
|
562
|
-
* Extends this logger with a child namespace.
|
|
563
|
-
* Namespaces are separated with a ':' character.
|
|
564
|
-
*/
|
|
565
|
-
extend: (namespace: string) => Debugger;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* A policy to enable response decompression according to Accept-Encoding header
|
|
570
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
|
|
571
|
-
*/
|
|
572
|
-
export declare function decompressResponsePolicy(): PipelinePolicy;
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* The programmatic identifier of the decompressResponsePolicy.
|
|
576
|
-
*/
|
|
577
|
-
export declare const decompressResponsePolicyName = "decompressResponsePolicy";
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* A policy that retries according to three strategies:
|
|
581
|
-
* - When the server sends a 429 response with a Retry-After header.
|
|
582
|
-
* - When there are errors in the underlying transport layer (e.g. DNS lookup failures).
|
|
583
|
-
* - Or otherwise if the outgoing request fails, it will retry with an exponentially increasing delay.
|
|
584
|
-
*/
|
|
585
|
-
export declare function defaultRetryPolicy(options?: DefaultRetryPolicyOptions): PipelinePolicy;
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Options that control how to retry failed requests.
|
|
589
|
-
*/
|
|
590
|
-
export declare interface DefaultRetryPolicyOptions extends PipelineRetryOptions {
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
|
595
|
-
* @param timeInMs - The number of milliseconds to be delayed.
|
|
596
|
-
* @param options - The options for delay - currently abort options
|
|
597
|
-
* @returns Promise that is resolved after timeInMs
|
|
598
|
-
*/
|
|
599
|
-
export declare function delay(timeInMs: number, options?: DelayOptions_2): Promise<void>;
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Options for support abort functionality for the delay method
|
|
603
|
-
*/
|
|
604
|
-
declare interface DelayOptions_2 extends AbortOptions {
|
|
605
|
-
}
|
|
606
|
-
export { DelayOptions_2 as DelayOptions }
|
|
607
|
-
|
|
608
|
-
/** The supported character encoding type */
|
|
609
|
-
export declare type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
|
|
610
|
-
|
|
611
|
-
/** The error object. */
|
|
612
|
-
export declare interface ErrorModel {
|
|
613
|
-
/** One of a server-defined set of error codes. */
|
|
614
|
-
code: string;
|
|
615
|
-
/** A human-readable representation of the error. */
|
|
616
|
-
message: string;
|
|
617
|
-
/** The target of the error. */
|
|
618
|
-
target?: string;
|
|
619
|
-
/** An array of details about specific errors that led to this reported error. */
|
|
620
|
-
details: Array<ErrorModel>;
|
|
621
|
-
/** An object containing more specific information than the current object about the error. */
|
|
622
|
-
innererror?: InnerError;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/** A response containing error details. */
|
|
626
|
-
export declare interface ErrorResponse {
|
|
627
|
-
/** The error object. */
|
|
628
|
-
error: ErrorModel;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* A simple object that provides form data, as if from a browser form.
|
|
633
|
-
*/
|
|
634
|
-
export declare type FormDataMap = {
|
|
635
|
-
[key: string]: FormDataValue | FormDataValue[];
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* A policy that encodes FormData on the request into the body.
|
|
640
|
-
*/
|
|
641
|
-
export declare function formDataPolicy(): PipelinePolicy;
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* The programmatic identifier of the formDataPolicy.
|
|
645
|
-
*/
|
|
646
|
-
export declare const formDataPolicyName = "formDataPolicy";
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Each form data entry can be a string, Blob, or a File. If you wish to pass a file with a name but do not have
|
|
650
|
-
* access to the File class, you can use the createFile helper to create one.
|
|
651
|
-
*/
|
|
652
|
-
export declare type FormDataValue = string | Blob | File;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Wrapper object for http request and response. Deserialized object is stored in
|
|
656
|
-
* the `parsedBody` property when the response body is received in JSON.
|
|
657
|
-
*/
|
|
658
|
-
export declare interface FullOperationResponse extends PipelineResponse {
|
|
659
|
-
/**
|
|
660
|
-
* The raw HTTP response headers.
|
|
661
|
-
*/
|
|
662
|
-
rawHeaders?: RawHttpHeaders;
|
|
663
|
-
/**
|
|
664
|
-
* The response body as parsed JSON.
|
|
665
|
-
*/
|
|
666
|
-
parsedBody?: RequestBodyType;
|
|
667
|
-
/**
|
|
668
|
-
* The request that generated the response.
|
|
669
|
-
*/
|
|
670
|
-
request: PipelineRequest;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* Creates a client with a default pipeline
|
|
675
|
-
* @param endpoint - Base endpoint for the client
|
|
676
|
-
* @param options - Client options
|
|
677
|
-
*/
|
|
678
|
-
export declare function getClient(endpoint: string, options?: ClientOptions): Client;
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Creates a client with a default pipeline
|
|
682
|
-
* @param endpoint - Base endpoint for the client
|
|
683
|
-
* @param credentials - Credentials to authenticate the requests
|
|
684
|
-
* @param options - Client options
|
|
685
|
-
*/
|
|
686
|
-
export declare function getClient(endpoint: string, credentials?: TokenCredential | KeyCredential, options?: ClientOptions): Client;
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.
|
|
690
|
-
* If no argument is given, it attempts to parse a proxy URL from the environment
|
|
691
|
-
* variables `HTTPS_PROXY` or `HTTP_PROXY`.
|
|
692
|
-
* @param proxyUrl - The url of the proxy to use. May contain authentication information.
|
|
693
|
-
* @deprecated - Internally this method is no longer necessary when setting proxy information.
|
|
694
|
-
*/
|
|
695
|
-
export declare function getDefaultProxySettings(proxyUrl?: string): ProxySettings | undefined;
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* Given what is thought to be an error object, return the message if possible.
|
|
699
|
-
* If the message is missing, returns a stringified version of the input.
|
|
700
|
-
* @param e - Something thrown from a try block
|
|
701
|
-
* @returns The error message or a string of the input
|
|
702
|
-
*/
|
|
703
|
-
export declare function getErrorMessage(e: unknown): string;
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Returns a random integer value between a lower and upper bound,
|
|
707
|
-
* inclusive of both bounds.
|
|
708
|
-
* Note that this uses Math.random and isn't secure. If you need to use
|
|
709
|
-
* this for any kind of security purpose, find a better source of random.
|
|
710
|
-
* @param min - The smallest integer value allowed.
|
|
711
|
-
* @param max - The largest integer value allowed.
|
|
712
|
-
*/
|
|
713
|
-
export declare function getRandomIntegerInclusive(min: number, max: number): number;
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Defines options for TokenCredential.getToken.
|
|
717
|
-
*/
|
|
718
|
-
export declare interface GetTokenOptions {
|
|
719
|
-
/**
|
|
720
|
-
* The signal which can be used to abort requests.
|
|
721
|
-
*/
|
|
722
|
-
abortSignal?: AbortSignalLike;
|
|
723
|
-
/**
|
|
724
|
-
* Options used when creating and sending HTTP requests for this operation.
|
|
725
|
-
*/
|
|
726
|
-
requestOptions?: {
|
|
727
|
-
/**
|
|
728
|
-
* The number of milliseconds a request can take before automatically being terminated.
|
|
729
|
-
*/
|
|
730
|
-
timeout?: number;
|
|
731
|
-
};
|
|
732
|
-
/**
|
|
733
|
-
* Options used when tracing is enabled.
|
|
734
|
-
*/
|
|
735
|
-
tracingOptions?: {
|
|
736
|
-
/**
|
|
737
|
-
* Tracing Context for the current request.
|
|
738
|
-
*/
|
|
739
|
-
tracingContext?: TracingContext;
|
|
740
|
-
};
|
|
741
|
-
/**
|
|
742
|
-
* Claim details to perform the Continuous Access Evaluation authentication flow
|
|
743
|
-
*/
|
|
744
|
-
claims?: string;
|
|
745
|
-
/**
|
|
746
|
-
* Indicates whether to enable the Continuous Access Evaluation authentication flow
|
|
747
|
-
*/
|
|
748
|
-
enableCae?: boolean;
|
|
749
|
-
/**
|
|
750
|
-
* Allows specifying a tenantId. Useful to handle challenges that provide tenant Id hints.
|
|
751
|
-
*/
|
|
752
|
-
tenantId?: string;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Http Response which body is a NodeJS stream object
|
|
757
|
-
*/
|
|
758
|
-
export declare type HttpBrowserStreamResponse = HttpResponse & {
|
|
759
|
-
/**
|
|
760
|
-
* Streamable body
|
|
761
|
-
*/
|
|
762
|
-
body?: ReadableStream<Uint8Array>;
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* The required interface for a client that makes HTTP requests
|
|
767
|
-
* on behalf of a pipeline.
|
|
768
|
-
*/
|
|
769
|
-
export declare interface HttpClient {
|
|
770
|
-
/**
|
|
771
|
-
* The method that makes the request and returns a response.
|
|
772
|
-
*/
|
|
773
|
-
sendRequest: SendRequest;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* Represents a set of HTTP headers on a request/response.
|
|
778
|
-
* Header names are treated as case insensitive.
|
|
779
|
-
*/
|
|
780
|
-
export declare interface HttpHeaders extends Iterable<[string, string]> {
|
|
781
|
-
/**
|
|
782
|
-
* Returns the value of a specific header or undefined if not set.
|
|
783
|
-
* @param name - The name of the header to retrieve.
|
|
784
|
-
*/
|
|
785
|
-
get(name: string): string | undefined;
|
|
786
|
-
/**
|
|
787
|
-
* Returns true if the specified header exists.
|
|
788
|
-
* @param name - The name of the header to check.
|
|
789
|
-
*/
|
|
790
|
-
has(name: string): boolean;
|
|
791
|
-
/**
|
|
792
|
-
* Sets a specific header with a given value.
|
|
793
|
-
* @param name - The name of the header to set.
|
|
794
|
-
* @param value - The value to use for the header.
|
|
795
|
-
*/
|
|
796
|
-
set(name: string, value: string | number | boolean): void;
|
|
797
|
-
/**
|
|
798
|
-
* Removes a specific header from the collection.
|
|
799
|
-
* @param name - The name of the header to delete.
|
|
800
|
-
*/
|
|
801
|
-
delete(name: string): void;
|
|
802
|
-
/**
|
|
803
|
-
* Accesses a raw JS object that acts as a simple map
|
|
804
|
-
* of header names to values.
|
|
805
|
-
*/
|
|
806
|
-
toJSON(options?: {
|
|
807
|
-
preserveCase?: boolean;
|
|
808
|
-
}): RawHttpHeaders;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Supported HTTP methods to use when making requests.
|
|
813
|
-
*/
|
|
814
|
-
export declare type HttpMethods = "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Http Response which body is a NodeJS stream object
|
|
818
|
-
*/
|
|
819
|
-
export declare type HttpNodeStreamResponse = HttpResponse & {
|
|
820
|
-
/**
|
|
821
|
-
* Streamable body
|
|
822
|
-
*/
|
|
823
|
-
body?: NodeJS.ReadableStream;
|
|
824
|
-
};
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Represents the shape of an HttpResponse
|
|
828
|
-
*/
|
|
829
|
-
export declare type HttpResponse = {
|
|
830
|
-
/**
|
|
831
|
-
* The request that generated this response.
|
|
832
|
-
*/
|
|
833
|
-
request: PipelineRequest;
|
|
834
|
-
/**
|
|
835
|
-
* The HTTP response headers.
|
|
836
|
-
*/
|
|
837
|
-
headers: RawHttpHeaders;
|
|
838
|
-
/**
|
|
839
|
-
* Parsed body
|
|
840
|
-
*/
|
|
841
|
-
body: unknown;
|
|
842
|
-
/**
|
|
843
|
-
* The HTTP status code of the response.
|
|
844
|
-
*/
|
|
845
|
-
status: string;
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
/** An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. */
|
|
849
|
-
export declare interface InnerError {
|
|
850
|
-
/** One of a server-defined set of error codes. */
|
|
851
|
-
code: string;
|
|
852
|
-
/** Inner error. */
|
|
853
|
-
innererror?: InnerError;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Represents an implementation agnostic instrumenter.
|
|
858
|
-
*/
|
|
859
|
-
export declare interface Instrumenter {
|
|
860
|
-
/**
|
|
861
|
-
* Creates a new {@link TracingSpan} with the given name and options and sets it on a new context.
|
|
862
|
-
* @param name - The name of the span. By convention this should be `${className}.${methodName}`.
|
|
863
|
-
* @param spanOptions - The options to use when creating the span.
|
|
864
|
-
*
|
|
865
|
-
* @returns A {@link TracingSpan} that can be used to end the span, and the context this span has been set on.
|
|
866
|
-
*/
|
|
867
|
-
startSpan(name: string, spanOptions: InstrumenterSpanOptions): {
|
|
868
|
-
span: TracingSpan;
|
|
869
|
-
tracingContext: TracingContext;
|
|
870
|
-
};
|
|
871
|
-
/**
|
|
872
|
-
* Wraps a callback with an active context and calls the callback.
|
|
873
|
-
* Depending on the implementation, this may set the globally available active context.
|
|
874
|
-
*
|
|
875
|
-
* @param context - The {@link TracingContext} to use as the active context in the scope of the callback.
|
|
876
|
-
* @param callback - The callback to be invoked with the given context set as the globally active context.
|
|
877
|
-
* @param callbackArgs - The callback arguments.
|
|
878
|
-
*/
|
|
879
|
-
withContext<CallbackArgs extends unknown[], Callback extends (...args: CallbackArgs) => ReturnType<Callback>>(context: TracingContext, callback: Callback, ...callbackArgs: CallbackArgs): ReturnType<Callback>;
|
|
880
|
-
/**
|
|
881
|
-
* Provides an implementation-specific method to parse a {@link https://www.w3.org/TR/trace-context/#traceparent-header}
|
|
882
|
-
* into a {@link TracingSpanContext} which can be used to link non-parented spans together.
|
|
883
|
-
*/
|
|
884
|
-
parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;
|
|
885
|
-
/**
|
|
886
|
-
* Provides an implementation-specific method to serialize a {@link TracingSpan} to a set of headers.
|
|
887
|
-
* @param tracingContext - The context containing the span to serialize.
|
|
888
|
-
*/
|
|
889
|
-
createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Options passed to {@link Instrumenter.startSpan} as a superset of {@link TracingSpanOptions}.
|
|
894
|
-
*/
|
|
895
|
-
export declare interface InstrumenterSpanOptions extends TracingSpanOptions {
|
|
896
|
-
/** The name of the package invoking this trace. */
|
|
897
|
-
packageName: string;
|
|
898
|
-
/** The version of the package invoking this trace. */
|
|
899
|
-
packageVersion?: string;
|
|
900
|
-
/** The current tracing context. Defaults to an implementation-specific "active" context. */
|
|
901
|
-
tracingContext?: TracingContext;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/**
|
|
905
|
-
* Defines options that are used to configure internal options of
|
|
906
|
-
* the HTTP pipeline for an SDK client.
|
|
907
|
-
*/
|
|
908
|
-
export declare interface InternalPipelineOptions extends PipelineOptions {
|
|
909
|
-
/**
|
|
910
|
-
* Options to configure request/response logging.
|
|
911
|
-
*/
|
|
912
|
-
loggingOptions?: LogPolicyOptions;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
/**
|
|
916
|
-
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
917
|
-
*/
|
|
918
|
-
export declare const isBrowser: boolean;
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
922
|
-
*/
|
|
923
|
-
export declare const isBun: boolean;
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Helper TypeGuard that checks if something is defined or not.
|
|
927
|
-
* @param thing - Anything
|
|
928
|
-
*/
|
|
929
|
-
export declare function isDefined<T>(thing: T | undefined | null): thing is T;
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* A constant that indicates whether the environment the code is running is Deno.
|
|
933
|
-
*/
|
|
934
|
-
export declare const isDeno: boolean;
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Typeguard for an error object shape (has name and message)
|
|
938
|
-
* @param e - Something caught by a catch clause.
|
|
939
|
-
*/
|
|
940
|
-
export declare function isError(e: unknown): e is Error;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* Tests an object to determine whether it implements KeyCredential.
|
|
944
|
-
*
|
|
945
|
-
* @param credential - The assumed KeyCredential to be tested.
|
|
946
|
-
*/
|
|
947
|
-
export declare function isKeyCredential(credential: unknown): credential is KeyCredential;
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
|
951
|
-
* @deprecated Use `isNodeLike` instead.
|
|
952
|
-
*/
|
|
953
|
-
export declare const isNode: boolean;
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* A constant that indicates whether the environment the code is running is a Node.js compatible environment.
|
|
957
|
-
*/
|
|
958
|
-
export declare const isNodeLike: boolean;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
962
|
-
*/
|
|
963
|
-
export declare const isNodeRuntime: boolean;
|
|
964
|
-
|
|
965
|
-
/**
|
|
966
|
-
* Helper to determine when an input is a generic JS object.
|
|
967
|
-
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
|
968
|
-
*/
|
|
969
|
-
export declare function isObject(input: unknown): input is UnknownObject;
|
|
970
|
-
|
|
971
|
-
/**
|
|
972
|
-
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
|
973
|
-
* @param thing - Anything.
|
|
974
|
-
* @param properties - The name of the properties that should appear in the object.
|
|
975
|
-
*/
|
|
976
|
-
export declare function isObjectWithProperties<Thing, PropertyName extends string>(thing: Thing, properties: PropertyName[]): thing is Thing & Record<PropertyName, unknown>;
|
|
977
|
-
|
|
978
|
-
/**
|
|
979
|
-
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
980
|
-
*/
|
|
981
|
-
export declare const isReactNative: boolean;
|
|
982
|
-
|
|
983
|
-
/**
|
|
984
|
-
* Typeguard for RestError
|
|
985
|
-
* @param e - Something caught by a catch clause.
|
|
986
|
-
*/
|
|
987
|
-
export declare function isRestError(e: unknown): e is RestError;
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
991
|
-
*/
|
|
992
|
-
export declare const isWebWorker: boolean;
|
|
993
|
-
|
|
994
|
-
/**
|
|
995
|
-
* Represents a credential defined by a static API key.
|
|
996
|
-
*/
|
|
997
|
-
export declare interface KeyCredential {
|
|
998
|
-
/**
|
|
999
|
-
* The value of the API key represented as a string
|
|
1000
|
-
*/
|
|
1001
|
-
readonly key: string;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* An interface compatible with NodeJS's `tls.KeyObject`.
|
|
1006
|
-
* We want to avoid publicly re-exporting the actual interface,
|
|
1007
|
-
* since it might vary across runtime versions.
|
|
1008
|
-
*/
|
|
1009
|
-
export declare interface KeyObject {
|
|
1010
|
-
/**
|
|
1011
|
-
* Private keys in PEM format.
|
|
1012
|
-
*/
|
|
1013
|
-
pem: string | Buffer;
|
|
1014
|
-
/**
|
|
1015
|
-
* Optional passphrase.
|
|
1016
|
-
*/
|
|
1017
|
-
passphrase?: string | undefined;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* A policy that logs all requests and responses.
|
|
1022
|
-
* @param options - Options to configure logPolicy.
|
|
1023
|
-
*/
|
|
1024
|
-
export declare function logPolicy(options?: LogPolicyOptions): PipelinePolicy;
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
* The programmatic identifier of the logPolicy.
|
|
1028
|
-
*/
|
|
1029
|
-
export declare const logPolicyName = "logPolicy";
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
* Options to configure the logPolicy.
|
|
1033
|
-
*/
|
|
1034
|
-
export declare interface LogPolicyOptions {
|
|
1035
|
-
/**
|
|
1036
|
-
* Header names whose values will be logged when logging is enabled.
|
|
1037
|
-
* Defaults include a list of well-known safe headers. Any headers
|
|
1038
|
-
* specified in this field will be added to that list. Any other values will
|
|
1039
|
-
* be written to logs as "REDACTED".
|
|
1040
|
-
*/
|
|
1041
|
-
additionalAllowedHeaderNames?: string[];
|
|
1042
|
-
/**
|
|
1043
|
-
* Query string names whose values will be logged when logging is enabled. By default no
|
|
1044
|
-
* query string values are logged.
|
|
1045
|
-
*/
|
|
1046
|
-
additionalAllowedQueryParameters?: string[];
|
|
1047
|
-
/**
|
|
1048
|
-
* The log function to use for writing pipeline logs.
|
|
1049
|
-
* Defaults to core-http's built-in logger.
|
|
1050
|
-
* Compatible with the `debug` library.
|
|
1051
|
-
*/
|
|
1052
|
-
logger?: Debugger;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Pipeline policy for multipart requests
|
|
1057
|
-
*/
|
|
1058
|
-
export declare function multipartPolicy(): PipelinePolicy;
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Name of multipart policy
|
|
1062
|
-
*/
|
|
1063
|
-
export declare const multipartPolicyName = "multipartPolicy";
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
* A request body consisting of multiple parts.
|
|
1067
|
-
*/
|
|
1068
|
-
export declare interface MultipartRequestBody {
|
|
1069
|
-
/**
|
|
1070
|
-
* The parts of the request body.
|
|
1071
|
-
*/
|
|
1072
|
-
parts: BodyPart[];
|
|
1073
|
-
/**
|
|
1074
|
-
* The boundary separating each part of the request body.
|
|
1075
|
-
* If not specified, a random boundary will be generated.
|
|
1076
|
-
*
|
|
1077
|
-
* When specified, '--' will be prepended to the boundary in the request to ensure the boundary follows the specification.
|
|
1078
|
-
*/
|
|
1079
|
-
boundary?: string;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Helper TypeGuard that checks if the input is an object with the specified property.
|
|
1084
|
-
* @param thing - Any object.
|
|
1085
|
-
* @param property - The name of the property that should appear in the object.
|
|
1086
|
-
*/
|
|
1087
|
-
export declare function objectHasProperty<Thing, PropertyName extends string>(thing: Thing, property: PropertyName): thing is Thing & Record<PropertyName, unknown>;
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* The base options type for all operations.
|
|
1091
|
-
*/
|
|
1092
|
-
export declare interface OperationOptions {
|
|
1093
|
-
/**
|
|
1094
|
-
* The signal which can be used to abort requests.
|
|
1095
|
-
*/
|
|
1096
|
-
abortSignal?: AbortSignalLike;
|
|
1097
|
-
/**
|
|
1098
|
-
* Options used when creating and sending HTTP requests for this operation.
|
|
1099
|
-
*/
|
|
1100
|
-
requestOptions?: OperationRequestOptions;
|
|
1101
|
-
/**
|
|
1102
|
-
* Options used when tracing is enabled.
|
|
1103
|
-
*/
|
|
1104
|
-
tracingOptions?: OperationTracingOptions;
|
|
1105
|
-
/**
|
|
1106
|
-
* A function to be called each time a response is received from the server
|
|
1107
|
-
* while performing the requested operation.
|
|
1108
|
-
* May be called multiple times.
|
|
1109
|
-
*/
|
|
1110
|
-
onResponse?: RawResponseCallback;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
/**
|
|
1114
|
-
* Helper function to convert OperationOptions to RequestParameters
|
|
1115
|
-
* @param options - the options that are used by Modular layer to send the request
|
|
1116
|
-
* @returns the result of the conversion in RequestParameters of RLC layer
|
|
1117
|
-
*/
|
|
1118
|
-
export declare function operationOptionsToRequestParameters(options: OperationOptions): RequestParameters;
|
|
1119
|
-
|
|
1120
|
-
/**
|
|
1121
|
-
* Options used when creating and sending HTTP requests for this operation.
|
|
1122
|
-
*/
|
|
1123
|
-
export declare interface OperationRequestOptions {
|
|
1124
|
-
/**
|
|
1125
|
-
* User defined custom request headers that
|
|
1126
|
-
* will be applied before the request is sent.
|
|
1127
|
-
*/
|
|
1128
|
-
headers?: RawHttpHeadersInput;
|
|
1129
|
-
/**
|
|
1130
|
-
* The number of milliseconds a request can take before automatically being terminated.
|
|
1131
|
-
*/
|
|
1132
|
-
timeout?: number;
|
|
1133
|
-
/**
|
|
1134
|
-
* Callback which fires upon upload progress.
|
|
1135
|
-
*/
|
|
1136
|
-
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
|
1137
|
-
/**
|
|
1138
|
-
* Callback which fires upon download progress.
|
|
1139
|
-
*/
|
|
1140
|
-
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
|
1141
|
-
/**
|
|
1142
|
-
* Set to true if the request is sent over HTTP instead of HTTPS
|
|
1143
|
-
*/
|
|
1144
|
-
allowInsecureConnection?: boolean;
|
|
1145
|
-
/**
|
|
1146
|
-
* Set to true if you want to skip encoding the path parameters
|
|
1147
|
-
*/
|
|
1148
|
-
skipUrlEncoding?: boolean;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* Tracing options to set on an operation.
|
|
1153
|
-
*/
|
|
1154
|
-
export declare interface OperationTracingOptions {
|
|
1155
|
-
/** The context to use for created Tracing Spans. */
|
|
1156
|
-
tracingContext?: TracingContext;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
/**
|
|
1160
|
-
* A utility type for when we know a TracingContext has been set
|
|
1161
|
-
* as part of an operation's options.
|
|
1162
|
-
*/
|
|
1163
|
-
export declare type OptionsWithTracingContext<Options extends {
|
|
1164
|
-
tracingOptions?: OperationTracingOptions;
|
|
1165
|
-
}> = Options & {
|
|
1166
|
-
tracingOptions: {
|
|
1167
|
-
tracingContext: TracingContext;
|
|
1168
|
-
};
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
/**
|
|
1172
|
-
* Helper type used to detect parameters in a path template
|
|
1173
|
-
* text surrounded by \{\} will be considered a path parameter
|
|
1174
|
-
*/
|
|
1175
|
-
export declare type PathParameters<TRoute extends string> = TRoute extends `${infer _Head}/{${infer _Param}}${infer Tail}` ? [
|
|
1176
|
-
pathParameter: string | number | PathParameterWithOptions,
|
|
1177
|
-
...pathParameters: PathParameters<Tail>
|
|
1178
|
-
] : [
|
|
1179
|
-
];
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* An object that can be passed as a path parameter, allowing for additional options to be set relating to how the parameter is encoded.
|
|
1183
|
-
*/
|
|
1184
|
-
export declare interface PathParameterWithOptions {
|
|
1185
|
-
/**
|
|
1186
|
-
* The value of the parameter.
|
|
1187
|
-
*/
|
|
1188
|
-
value: string | number;
|
|
1189
|
-
/**
|
|
1190
|
-
* Whether to allow for reserved characters in the value. If set to true, special characters such as '/' in the parameter's value will not be URL encoded.
|
|
1191
|
-
* Defaults to false.
|
|
1192
|
-
*/
|
|
1193
|
-
allowReserved?: boolean;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* Defines the signature for pathUnchecked.
|
|
1198
|
-
*/
|
|
1199
|
-
export declare type PathUnchecked = <TPath extends string>(path: TPath, ...args: PathParameters<TPath>) => ResourceMethods<StreamableMethod>;
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* Type to use with pathUnchecked, overrides the body type to any to allow flexibility
|
|
1203
|
-
*/
|
|
1204
|
-
export declare type PathUncheckedResponse = HttpResponse & {
|
|
1205
|
-
body: any;
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
/**
|
|
1209
|
-
* Represents a pipeline for making a HTTP request to a URL.
|
|
1210
|
-
* Pipelines can have multiple policies to manage manipulating each request
|
|
1211
|
-
* before and after it is made to the server.
|
|
1212
|
-
*/
|
|
1213
|
-
export declare interface Pipeline {
|
|
1214
|
-
/**
|
|
1215
|
-
* Add a new policy to the pipeline.
|
|
1216
|
-
* @param policy - A policy that manipulates a request.
|
|
1217
|
-
* @param options - A set of options for when the policy should run.
|
|
1218
|
-
*/
|
|
1219
|
-
addPolicy(policy: PipelinePolicy, options?: AddPipelineOptions): void;
|
|
1220
|
-
/**
|
|
1221
|
-
* Remove a policy from the pipeline.
|
|
1222
|
-
* @param options - Options that let you specify which policies to remove.
|
|
1223
|
-
*/
|
|
1224
|
-
removePolicy(options: {
|
|
1225
|
-
name?: string;
|
|
1226
|
-
phase?: PipelinePhase;
|
|
1227
|
-
}): PipelinePolicy[];
|
|
1228
|
-
/**
|
|
1229
|
-
* Uses the pipeline to make a HTTP request.
|
|
1230
|
-
* @param httpClient - The HttpClient that actually performs the request.
|
|
1231
|
-
* @param request - The request to be made.
|
|
1232
|
-
*/
|
|
1233
|
-
sendRequest(httpClient: HttpClient, request: PipelineRequest): Promise<PipelineResponse>;
|
|
1234
|
-
/**
|
|
1235
|
-
* Returns the current set of policies in the pipeline in the order in which
|
|
1236
|
-
* they will be applied to the request. Later in the list is closer to when
|
|
1237
|
-
* the request is performed.
|
|
1238
|
-
*/
|
|
1239
|
-
getOrderedPolicies(): PipelinePolicy[];
|
|
1240
|
-
/**
|
|
1241
|
-
* Duplicates this pipeline to allow for modifying an existing one without mutating it.
|
|
1242
|
-
*/
|
|
1243
|
-
clone(): Pipeline;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Defines options that are used to configure the HTTP pipeline for
|
|
1248
|
-
* an SDK client.
|
|
1249
|
-
*/
|
|
1250
|
-
export declare interface PipelineOptions {
|
|
1251
|
-
/**
|
|
1252
|
-
* Options that control how to retry failed requests.
|
|
1253
|
-
*/
|
|
1254
|
-
retryOptions?: PipelineRetryOptions;
|
|
1255
|
-
/**
|
|
1256
|
-
* Options to configure a proxy for outgoing requests.
|
|
1257
|
-
*/
|
|
1258
|
-
proxyOptions?: ProxySettings;
|
|
1259
|
-
/** Options for configuring TLS authentication */
|
|
1260
|
-
tlsOptions?: TlsSettings;
|
|
1261
|
-
/**
|
|
1262
|
-
* Options for how redirect responses are handled.
|
|
1263
|
-
*/
|
|
1264
|
-
redirectOptions?: RedirectPolicyOptions;
|
|
1265
|
-
/**
|
|
1266
|
-
* Options for adding user agent details to outgoing requests.
|
|
1267
|
-
*/
|
|
1268
|
-
userAgentOptions?: UserAgentPolicyOptions;
|
|
1269
|
-
/**
|
|
1270
|
-
* Options for setting common telemetry and tracing info to outgoing requests.
|
|
1271
|
-
*/
|
|
1272
|
-
telemetryOptions?: TelemetryOptions;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
* Policies are executed in phases.
|
|
1277
|
-
* The execution order is:
|
|
1278
|
-
* 1. Serialize Phase
|
|
1279
|
-
* 2. Policies not in a phase
|
|
1280
|
-
* 3. Deserialize Phase
|
|
1281
|
-
* 4. Retry Phase
|
|
1282
|
-
* 5. Sign Phase
|
|
1283
|
-
*/
|
|
1284
|
-
export declare type PipelinePhase = "Deserialize" | "Serialize" | "Retry" | "Sign";
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* A pipeline policy manipulates a request as it travels through the pipeline.
|
|
1288
|
-
* It is conceptually a middleware that is allowed to modify the request before
|
|
1289
|
-
* it is made as well as the response when it is received.
|
|
1290
|
-
*/
|
|
1291
|
-
export declare interface PipelinePolicy {
|
|
1292
|
-
/**
|
|
1293
|
-
* The policy name. Must be a unique string in the pipeline.
|
|
1294
|
-
*/
|
|
1295
|
-
name: string;
|
|
1296
|
-
/**
|
|
1297
|
-
* The main method to implement that manipulates a request/response.
|
|
1298
|
-
* @param request - The request being performed.
|
|
1299
|
-
* @param next - The next policy in the pipeline. Must be called to continue the pipeline.
|
|
1300
|
-
*/
|
|
1301
|
-
sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse>;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
* Metadata about a request being made by the pipeline.
|
|
1306
|
-
*/
|
|
1307
|
-
export declare interface PipelineRequest {
|
|
1308
|
-
/**
|
|
1309
|
-
* The URL to make the request to.
|
|
1310
|
-
*/
|
|
1311
|
-
url: string;
|
|
1312
|
-
/**
|
|
1313
|
-
* The HTTP method to use when making the request.
|
|
1314
|
-
*/
|
|
1315
|
-
method: HttpMethods;
|
|
1316
|
-
/**
|
|
1317
|
-
* The HTTP headers to use when making the request.
|
|
1318
|
-
*/
|
|
1319
|
-
headers: HttpHeaders;
|
|
1320
|
-
/**
|
|
1321
|
-
* The number of milliseconds a request can take before automatically being terminated.
|
|
1322
|
-
* If the request is terminated, an `AbortError` is thrown.
|
|
1323
|
-
* Defaults to 0, which disables the timeout.
|
|
1324
|
-
*/
|
|
1325
|
-
timeout: number;
|
|
1326
|
-
/**
|
|
1327
|
-
* Indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.
|
|
1328
|
-
* Defaults to false.
|
|
1329
|
-
*/
|
|
1330
|
-
withCredentials: boolean;
|
|
1331
|
-
/**
|
|
1332
|
-
* A unique identifier for the request. Used for logging and tracing.
|
|
1333
|
-
*/
|
|
1334
|
-
requestId: string;
|
|
1335
|
-
/**
|
|
1336
|
-
* The HTTP body content (if any)
|
|
1337
|
-
*/
|
|
1338
|
-
body?: RequestBodyType;
|
|
1339
|
-
/**
|
|
1340
|
-
* Body for a multipart request.
|
|
1341
|
-
*/
|
|
1342
|
-
multipartBody?: MultipartRequestBody;
|
|
1343
|
-
/**
|
|
1344
|
-
* To simulate a browser form post
|
|
1345
|
-
*/
|
|
1346
|
-
formData?: FormDataMap;
|
|
1347
|
-
/**
|
|
1348
|
-
* A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.
|
|
1349
|
-
* When streamResponseStatusCodes contains the value Number.POSITIVE_INFINITY any status would be treated as a stream.
|
|
1350
|
-
*/
|
|
1351
|
-
streamResponseStatusCodes?: Set<number>;
|
|
1352
|
-
/**
|
|
1353
|
-
* Proxy configuration.
|
|
1354
|
-
*/
|
|
1355
|
-
proxySettings?: ProxySettings;
|
|
1356
|
-
/**
|
|
1357
|
-
* If the connection should not be reused.
|
|
1358
|
-
*/
|
|
1359
|
-
disableKeepAlive?: boolean;
|
|
1360
|
-
/**
|
|
1361
|
-
* Used to abort the request later.
|
|
1362
|
-
*/
|
|
1363
|
-
abortSignal?: AbortSignalLike;
|
|
1364
|
-
/**
|
|
1365
|
-
* Tracing options to use for any created Spans.
|
|
1366
|
-
*/
|
|
1367
|
-
tracingOptions?: OperationTracingOptions;
|
|
1368
|
-
/**
|
|
1369
|
-
* Callback which fires upon upload progress.
|
|
1370
|
-
*/
|
|
1371
|
-
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
|
1372
|
-
/** Callback which fires upon download progress. */
|
|
1373
|
-
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
|
1374
|
-
/** Set to true if the request is sent over HTTP instead of HTTPS */
|
|
1375
|
-
allowInsecureConnection?: boolean;
|
|
1376
|
-
/**
|
|
1377
|
-
* NODEJS ONLY
|
|
1378
|
-
*
|
|
1379
|
-
* A Node-only option to provide a custom `http.Agent`/`https.Agent`.
|
|
1380
|
-
* Does nothing when running in the browser.
|
|
1381
|
-
*/
|
|
1382
|
-
agent?: Agent;
|
|
1383
|
-
/**
|
|
1384
|
-
* BROWSER ONLY
|
|
1385
|
-
*
|
|
1386
|
-
* A browser only option to enable browser Streams. If this option is set and a response is a stream
|
|
1387
|
-
* the response will have a property `browserStream` instead of `blobBody` which will be undefined.
|
|
1388
|
-
*
|
|
1389
|
-
* Default value is false
|
|
1390
|
-
*/
|
|
1391
|
-
enableBrowserStreams?: boolean;
|
|
1392
|
-
/** Settings for configuring TLS authentication */
|
|
1393
|
-
tlsSettings?: TlsSettings;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
/**
|
|
1397
|
-
* Settings to initialize a request.
|
|
1398
|
-
* Almost equivalent to Partial<PipelineRequest>, but url is mandatory.
|
|
1399
|
-
*/
|
|
1400
|
-
export declare interface PipelineRequestOptions {
|
|
1401
|
-
/**
|
|
1402
|
-
* The URL to make the request to.
|
|
1403
|
-
*/
|
|
1404
|
-
url: string;
|
|
1405
|
-
/**
|
|
1406
|
-
* The HTTP method to use when making the request.
|
|
1407
|
-
*/
|
|
1408
|
-
method?: HttpMethods;
|
|
1409
|
-
/**
|
|
1410
|
-
* The HTTP headers to use when making the request.
|
|
1411
|
-
*/
|
|
1412
|
-
headers?: HttpHeaders;
|
|
1413
|
-
/**
|
|
1414
|
-
* The number of milliseconds a request can take before automatically being terminated.
|
|
1415
|
-
* If the request is terminated, an `AbortError` is thrown.
|
|
1416
|
-
* Defaults to 0, which disables the timeout.
|
|
1417
|
-
*/
|
|
1418
|
-
timeout?: number;
|
|
1419
|
-
/**
|
|
1420
|
-
* If credentials (cookies) should be sent along during an XHR.
|
|
1421
|
-
* Defaults to false.
|
|
1422
|
-
*/
|
|
1423
|
-
withCredentials?: boolean;
|
|
1424
|
-
/**
|
|
1425
|
-
* A unique identifier for the request. Used for logging and tracing.
|
|
1426
|
-
*/
|
|
1427
|
-
requestId?: string;
|
|
1428
|
-
/**
|
|
1429
|
-
* The HTTP body content (if any)
|
|
1430
|
-
*/
|
|
1431
|
-
body?: RequestBodyType;
|
|
1432
|
-
/**
|
|
1433
|
-
* Body for a multipart request.
|
|
1434
|
-
*/
|
|
1435
|
-
multipartBody?: MultipartRequestBody;
|
|
1436
|
-
/**
|
|
1437
|
-
* To simulate a browser form post
|
|
1438
|
-
*/
|
|
1439
|
-
formData?: FormDataMap;
|
|
1440
|
-
/**
|
|
1441
|
-
* A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.
|
|
1442
|
-
*/
|
|
1443
|
-
streamResponseStatusCodes?: Set<number>;
|
|
1444
|
-
/**
|
|
1445
|
-
* BROWSER ONLY
|
|
1446
|
-
*
|
|
1447
|
-
* A browser only option to enable use of the Streams API. If this option is set and streaming is used
|
|
1448
|
-
* (see `streamResponseStatusCodes`), the response will have a property `browserStream` instead of
|
|
1449
|
-
* `blobBody` which will be undefined.
|
|
1450
|
-
*
|
|
1451
|
-
* Default value is false
|
|
1452
|
-
*/
|
|
1453
|
-
enableBrowserStreams?: boolean;
|
|
1454
|
-
/**
|
|
1455
|
-
* Proxy configuration.
|
|
1456
|
-
*/
|
|
1457
|
-
proxySettings?: ProxySettings;
|
|
1458
|
-
/**
|
|
1459
|
-
* If the connection should not be reused.
|
|
1460
|
-
*/
|
|
1461
|
-
disableKeepAlive?: boolean;
|
|
1462
|
-
/**
|
|
1463
|
-
* Used to abort the request later.
|
|
1464
|
-
*/
|
|
1465
|
-
abortSignal?: AbortSignalLike;
|
|
1466
|
-
/**
|
|
1467
|
-
* Options used to create a span when tracing is enabled.
|
|
1468
|
-
*/
|
|
1469
|
-
tracingOptions?: OperationTracingOptions;
|
|
1470
|
-
/**
|
|
1471
|
-
* Callback which fires upon upload progress.
|
|
1472
|
-
*/
|
|
1473
|
-
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
|
1474
|
-
/** Callback which fires upon download progress. */
|
|
1475
|
-
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
|
1476
|
-
/** Set to true if the request is sent over HTTP instead of HTTPS */
|
|
1477
|
-
allowInsecureConnection?: boolean;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* Metadata about a response received by the pipeline.
|
|
1482
|
-
*/
|
|
1483
|
-
export declare interface PipelineResponse {
|
|
1484
|
-
/**
|
|
1485
|
-
* The request that generated this response.
|
|
1486
|
-
*/
|
|
1487
|
-
request: PipelineRequest;
|
|
1488
|
-
/**
|
|
1489
|
-
* The HTTP status code of the response.
|
|
1490
|
-
*/
|
|
1491
|
-
status: number;
|
|
1492
|
-
/**
|
|
1493
|
-
* The HTTP response headers.
|
|
1494
|
-
*/
|
|
1495
|
-
headers: HttpHeaders;
|
|
1496
|
-
/**
|
|
1497
|
-
* The response body as text (string format)
|
|
1498
|
-
*/
|
|
1499
|
-
bodyAsText?: string | null;
|
|
1500
|
-
/**
|
|
1501
|
-
* BROWSER ONLY
|
|
1502
|
-
*
|
|
1503
|
-
* The response body as a browser Blob.
|
|
1504
|
-
* Always undefined in node.js.
|
|
1505
|
-
*/
|
|
1506
|
-
blobBody?: Promise<Blob>;
|
|
1507
|
-
/**
|
|
1508
|
-
* BROWSER ONLY
|
|
1509
|
-
*
|
|
1510
|
-
* The response body as a browser ReadableStream.
|
|
1511
|
-
* Always undefined in node.js.
|
|
1512
|
-
*/
|
|
1513
|
-
browserStreamBody?: ReadableStream<Uint8Array>;
|
|
1514
|
-
/**
|
|
1515
|
-
* NODEJS ONLY
|
|
1516
|
-
*
|
|
1517
|
-
* The response body as a node.js Readable stream.
|
|
1518
|
-
* Always undefined in the browser.
|
|
1519
|
-
*/
|
|
1520
|
-
readableStreamBody?: NodeJS.ReadableStream;
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
/**
|
|
1524
|
-
* Options that control how to retry failed requests.
|
|
1525
|
-
*/
|
|
1526
|
-
export declare interface PipelineRetryOptions {
|
|
1527
|
-
/**
|
|
1528
|
-
* The maximum number of retry attempts. Defaults to 3.
|
|
1529
|
-
*/
|
|
1530
|
-
maxRetries?: number;
|
|
1531
|
-
/**
|
|
1532
|
-
* The amount of delay in milliseconds between retry attempts. Defaults to 1000
|
|
1533
|
-
* (1 second). The delay increases exponentially with each retry up to a maximum
|
|
1534
|
-
* specified by maxRetryDelayInMs.
|
|
1535
|
-
*/
|
|
1536
|
-
retryDelayInMs?: number;
|
|
1537
|
-
/**
|
|
1538
|
-
* The maximum delay in milliseconds allowed before retrying an operation. Defaults
|
|
1539
|
-
* to 64000 (64 seconds).
|
|
1540
|
-
*/
|
|
1541
|
-
maxRetryDelayInMs?: number;
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
/**
|
|
1545
|
-
* A policy that allows one to apply proxy settings to all requests.
|
|
1546
|
-
* If not passed static settings, they will be retrieved from the HTTPS_PROXY
|
|
1547
|
-
* or HTTP_PROXY environment variables.
|
|
1548
|
-
* @param proxySettings - ProxySettings to use on each request.
|
|
1549
|
-
* @param options - additional settings, for example, custom NO_PROXY patterns
|
|
1550
|
-
*/
|
|
1551
|
-
export declare function proxyPolicy(proxySettings?: ProxySettings, options?: {
|
|
1552
|
-
/** a list of patterns to override those loaded from NO_PROXY environment variable. */
|
|
1553
|
-
customNoProxyList?: string[];
|
|
1554
|
-
}): PipelinePolicy;
|
|
1555
|
-
|
|
1556
|
-
/**
|
|
1557
|
-
* The programmatic identifier of the proxyPolicy.
|
|
1558
|
-
*/
|
|
1559
|
-
export declare const proxyPolicyName = "proxyPolicy";
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* Options to configure a proxy for outgoing requests (Node.js only).
|
|
1563
|
-
*/
|
|
1564
|
-
export declare interface ProxySettings {
|
|
1565
|
-
/**
|
|
1566
|
-
* The proxy's host address.
|
|
1567
|
-
*/
|
|
1568
|
-
host: string;
|
|
1569
|
-
/**
|
|
1570
|
-
* The proxy host's port.
|
|
1571
|
-
*/
|
|
1572
|
-
port: number;
|
|
1573
|
-
/**
|
|
1574
|
-
* The user name to authenticate with the proxy, if required.
|
|
1575
|
-
*/
|
|
1576
|
-
username?: string;
|
|
1577
|
-
/**
|
|
1578
|
-
* The password to authenticate with the proxy, if required.
|
|
1579
|
-
*/
|
|
1580
|
-
password?: string;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
/**
|
|
1584
|
-
* An interface compatible with NodeJS's `tls.PxfObject`.
|
|
1585
|
-
* We want to avoid publicly re-exporting the actual interface,
|
|
1586
|
-
* since it might vary across runtime versions.
|
|
1587
|
-
*/
|
|
1588
|
-
export declare interface PxfObject {
|
|
1589
|
-
/**
|
|
1590
|
-
* PFX or PKCS12 encoded private key and certificate chain.
|
|
1591
|
-
*/
|
|
1592
|
-
buf: string | Buffer;
|
|
1593
|
-
/**
|
|
1594
|
-
* Optional passphrase.
|
|
1595
|
-
*/
|
|
1596
|
-
passphrase?: string | undefined;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
* Generated Universally Unique Identifier
|
|
1601
|
-
*
|
|
1602
|
-
* @returns RFC4122 v4 UUID.
|
|
1603
|
-
*/
|
|
1604
|
-
export declare function randomUUID(): string;
|
|
1605
|
-
|
|
1606
|
-
/**
|
|
1607
|
-
* A HttpHeaders collection represented as a simple JSON object.
|
|
1608
|
-
*/
|
|
1609
|
-
export declare type RawHttpHeaders = {
|
|
1610
|
-
[headerName: string]: string;
|
|
1611
|
-
};
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1614
|
-
* A HttpHeaders collection for input, represented as a simple JSON object.
|
|
1615
|
-
*/
|
|
1616
|
-
export declare type RawHttpHeadersInput = Record<string, string | number | boolean>;
|
|
1617
|
-
|
|
1618
|
-
/**
|
|
1619
|
-
* A function to be called each time a response is received from the server
|
|
1620
|
-
* while performing the requested operation.
|
|
1621
|
-
* May be called multiple times.
|
|
1622
|
-
*/
|
|
1623
|
-
export declare type RawResponseCallback = (rawResponse: FullOperationResponse, error?: unknown) => void;
|
|
1624
|
-
|
|
1625
|
-
/**
|
|
1626
|
-
* A policy to follow Location headers from the server in order
|
|
1627
|
-
* to support server-side redirection.
|
|
1628
|
-
* In the browser, this policy is not used.
|
|
1629
|
-
* @param options - Options to control policy behavior.
|
|
1630
|
-
*/
|
|
1631
|
-
export declare function redirectPolicy(options?: RedirectPolicyOptions): PipelinePolicy;
|
|
1632
|
-
|
|
1633
|
-
/**
|
|
1634
|
-
* The programmatic identifier of the redirectPolicy.
|
|
1635
|
-
*/
|
|
1636
|
-
export declare const redirectPolicyName = "redirectPolicy";
|
|
1637
|
-
|
|
1638
|
-
/**
|
|
1639
|
-
* Options for how redirect responses are handled.
|
|
1640
|
-
*/
|
|
1641
|
-
export declare interface RedirectPolicyOptions {
|
|
1642
|
-
/**
|
|
1643
|
-
* The maximum number of times the redirect URL will be tried before
|
|
1644
|
-
* failing. Defaults to 20.
|
|
1645
|
-
*/
|
|
1646
|
-
maxRetries?: number;
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* Types of bodies supported on the request.
|
|
1651
|
-
* NodeJS.ReadableStream and () =\> NodeJS.ReadableStream is Node only.
|
|
1652
|
-
* Blob, ReadableStream<Uint8Array>, and () =\> ReadableStream<Uint8Array> are browser only.
|
|
1653
|
-
*/
|
|
1654
|
-
export declare type RequestBodyType = NodeJS.ReadableStream | (() => NodeJS.ReadableStream) | ReadableStream<Uint8Array> | (() => ReadableStream<Uint8Array>) | Blob | ArrayBuffer | ArrayBufferView | FormData | string | null;
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Shape of the default request parameters, this may be overridden by the specific
|
|
1658
|
-
* request types to provide strong types
|
|
1659
|
-
*/
|
|
1660
|
-
export declare type RequestParameters = {
|
|
1661
|
-
/**
|
|
1662
|
-
* Headers to send along with the request
|
|
1663
|
-
*/
|
|
1664
|
-
headers?: RawHttpHeadersInput;
|
|
1665
|
-
/**
|
|
1666
|
-
* Sets the accept header to send to the service
|
|
1667
|
-
* defaults to 'application/json'. If also a header "accept" is set
|
|
1668
|
-
* this property will take precedence.
|
|
1669
|
-
*/
|
|
1670
|
-
accept?: string;
|
|
1671
|
-
/**
|
|
1672
|
-
* Body to send with the request
|
|
1673
|
-
*/
|
|
1674
|
-
body?: unknown;
|
|
1675
|
-
/**
|
|
1676
|
-
* Query parameters to send with the request
|
|
1677
|
-
*/
|
|
1678
|
-
queryParameters?: Record<string, unknown>;
|
|
1679
|
-
/**
|
|
1680
|
-
* Set an explicit content-type to send with the request. If also a header "content-type" is set
|
|
1681
|
-
* this property will take precedence.
|
|
1682
|
-
*/
|
|
1683
|
-
contentType?: string;
|
|
1684
|
-
/** Set to true if the request is sent over HTTP instead of HTTPS */
|
|
1685
|
-
allowInsecureConnection?: boolean;
|
|
1686
|
-
/** Set to true if you want to skip encoding the path parameters */
|
|
1687
|
-
skipUrlEncoding?: boolean;
|
|
1688
|
-
/**
|
|
1689
|
-
* Path parameters for custom the base url
|
|
1690
|
-
*/
|
|
1691
|
-
pathParameters?: Record<string, any>;
|
|
1692
|
-
/**
|
|
1693
|
-
* The number of milliseconds a request can take before automatically being terminated.
|
|
1694
|
-
*/
|
|
1695
|
-
timeout?: number;
|
|
1696
|
-
/**
|
|
1697
|
-
* Callback which fires upon upload progress.
|
|
1698
|
-
*/
|
|
1699
|
-
onUploadProgress?: (progress: TransferProgressEvent) => void;
|
|
1700
|
-
/**
|
|
1701
|
-
* Callback which fires upon download progress.
|
|
1702
|
-
*/
|
|
1703
|
-
onDownloadProgress?: (progress: TransferProgressEvent) => void;
|
|
1704
|
-
/**
|
|
1705
|
-
* The signal which can be used to abort requests.
|
|
1706
|
-
*/
|
|
1707
|
-
abortSignal?: AbortSignalLike;
|
|
1708
|
-
/**
|
|
1709
|
-
* Options used when tracing is enabled.
|
|
1710
|
-
*/
|
|
1711
|
-
tracingOptions?: OperationTracingOptions;
|
|
1712
|
-
/**
|
|
1713
|
-
* A function to be called each time a response is received from the server
|
|
1714
|
-
* while performing the requested operation.
|
|
1715
|
-
* May be called multiple times.
|
|
1716
|
-
*/
|
|
1717
|
-
onResponse?: RawResponseCallback;
|
|
1718
|
-
};
|
|
1719
|
-
|
|
1720
|
-
/**
|
|
1721
|
-
* A narrower version of TypeScript 4.5's Awaited type which Recursively
|
|
1722
|
-
* unwraps the "awaited type", emulating the behavior of `await`.
|
|
1723
|
-
*/
|
|
1724
|
-
export declare type Resolved<T> = T extends {
|
|
1725
|
-
then(onfulfilled: infer F): any;
|
|
1726
|
-
} ? F extends (value: infer V) => any ? Resolved<V> : never : T;
|
|
1727
|
-
|
|
1728
|
-
/**
|
|
1729
|
-
* Defines the methods that can be called on a resource
|
|
1730
|
-
*/
|
|
1731
|
-
export declare interface ResourceMethods<TResponse = PromiseLike<PathUncheckedResponse>> {
|
|
1732
|
-
/**
|
|
1733
|
-
* Definition of the GET HTTP method for a resource
|
|
1734
|
-
*/
|
|
1735
|
-
get: (options?: RequestParameters) => TResponse;
|
|
1736
|
-
/**
|
|
1737
|
-
* Definition of the POST HTTP method for a resource
|
|
1738
|
-
*/
|
|
1739
|
-
post: (options?: RequestParameters) => TResponse;
|
|
1740
|
-
/**
|
|
1741
|
-
* Definition of the PUT HTTP method for a resource
|
|
1742
|
-
*/
|
|
1743
|
-
put: (options?: RequestParameters) => TResponse;
|
|
1744
|
-
/**
|
|
1745
|
-
* Definition of the PATCH HTTP method for a resource
|
|
1746
|
-
*/
|
|
1747
|
-
patch: (options?: RequestParameters) => TResponse;
|
|
1748
|
-
/**
|
|
1749
|
-
* Definition of the DELETE HTTP method for a resource
|
|
1750
|
-
*/
|
|
1751
|
-
delete: (options?: RequestParameters) => TResponse;
|
|
1752
|
-
/**
|
|
1753
|
-
* Definition of the HEAD HTTP method for a resource
|
|
1754
|
-
*/
|
|
1755
|
-
head: (options?: RequestParameters) => TResponse;
|
|
1756
|
-
/**
|
|
1757
|
-
* Definition of the OPTIONS HTTP method for a resource
|
|
1758
|
-
*/
|
|
1759
|
-
options: (options?: RequestParameters) => TResponse;
|
|
1760
|
-
/**
|
|
1761
|
-
* Definition of the TRACE HTTP method for a resource
|
|
1762
|
-
*/
|
|
1763
|
-
trace: (options?: RequestParameters) => TResponse;
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
/**
|
|
1767
|
-
* A custom error type for failed pipeline requests.
|
|
1768
|
-
*/
|
|
1769
|
-
export declare class RestError extends Error {
|
|
1770
|
-
/**
|
|
1771
|
-
* Something went wrong when making the request.
|
|
1772
|
-
* This means the actual request failed for some reason,
|
|
1773
|
-
* such as a DNS issue or the connection being lost.
|
|
1774
|
-
*/
|
|
1775
|
-
static readonly REQUEST_SEND_ERROR: string;
|
|
1776
|
-
/**
|
|
1777
|
-
* This means that parsing the response from the server failed.
|
|
1778
|
-
* It may have been malformed.
|
|
1779
|
-
*/
|
|
1780
|
-
static readonly PARSE_ERROR: string;
|
|
1781
|
-
/**
|
|
1782
|
-
* The code of the error itself (use statics on RestError if possible.)
|
|
1783
|
-
*/
|
|
1784
|
-
code?: string;
|
|
1785
|
-
/**
|
|
1786
|
-
* The HTTP status code of the request (if applicable.)
|
|
1787
|
-
*/
|
|
1788
|
-
statusCode?: number;
|
|
1789
|
-
/**
|
|
1790
|
-
* The request that was made.
|
|
1791
|
-
* This property is non-enumerable.
|
|
1792
|
-
*/
|
|
1793
|
-
request?: PipelineRequest;
|
|
1794
|
-
/**
|
|
1795
|
-
* The response received (if any.)
|
|
1796
|
-
* This property is non-enumerable.
|
|
1797
|
-
*/
|
|
1798
|
-
response?: PipelineResponse;
|
|
1799
|
-
/**
|
|
1800
|
-
* Bonus property set by the throw site.
|
|
1801
|
-
*/
|
|
1802
|
-
details?: unknown;
|
|
1803
|
-
constructor(message: string, options?: RestErrorOptions);
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
/**
|
|
1807
|
-
* The options supported by RestError.
|
|
1808
|
-
*/
|
|
1809
|
-
export declare interface RestErrorOptions {
|
|
1810
|
-
/**
|
|
1811
|
-
* The code of the error itself (use statics on RestError if possible.)
|
|
1812
|
-
*/
|
|
1813
|
-
code?: string;
|
|
1814
|
-
/**
|
|
1815
|
-
* The HTTP status code of the request (if applicable.)
|
|
1816
|
-
*/
|
|
1817
|
-
statusCode?: number;
|
|
1818
|
-
/**
|
|
1819
|
-
* The request that was made.
|
|
1820
|
-
*/
|
|
1821
|
-
request?: PipelineRequest;
|
|
1822
|
-
/**
|
|
1823
|
-
* The response received (if any.)
|
|
1824
|
-
*/
|
|
1825
|
-
response?: PipelineResponse;
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
/**
|
|
1829
|
-
* A simple interface for making a pipeline request and receiving a response.
|
|
1830
|
-
*/
|
|
1831
|
-
export declare type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;
|
|
1832
|
-
|
|
1833
|
-
/**
|
|
1834
|
-
* Represents the statuses that can be passed to {@link TracingSpan.setStatus}.
|
|
1835
|
-
*
|
|
1836
|
-
* By default, all spans will be created with status "unset".
|
|
1837
|
-
*/
|
|
1838
|
-
export declare type SpanStatus = SpanStatusSuccess | SpanStatusError;
|
|
1839
|
-
|
|
1840
|
-
/**
|
|
1841
|
-
* Status representing an error that can be sent to {@link TracingSpan.setStatus}
|
|
1842
|
-
*/
|
|
1843
|
-
export declare type SpanStatusError = {
|
|
1844
|
-
status: "error";
|
|
1845
|
-
error?: Error | string;
|
|
1846
|
-
};
|
|
1847
|
-
|
|
1848
|
-
/**
|
|
1849
|
-
* Status representing a successful operation that can be sent to {@link TracingSpan.setStatus}
|
|
1850
|
-
*/
|
|
1851
|
-
export declare type SpanStatusSuccess = {
|
|
1852
|
-
status: "success";
|
|
1853
|
-
};
|
|
1854
|
-
|
|
1855
|
-
/**
|
|
1856
|
-
* Defines the type for a method that supports getting the response body as
|
|
1857
|
-
* a raw stream
|
|
1858
|
-
*/
|
|
1859
|
-
export declare type StreamableMethod<TResponse = PathUncheckedResponse> = PromiseLike<TResponse> & {
|
|
1860
|
-
asNodeStream: () => Promise<HttpNodeStreamResponse>;
|
|
1861
|
-
asBrowserStream: () => Promise<HttpBrowserStreamResponse>;
|
|
1862
|
-
};
|
|
1863
|
-
|
|
1864
|
-
/**
|
|
1865
|
-
* The helper that transforms string to specific character encoded bytes array.
|
|
1866
|
-
* @param value - the string to be converted
|
|
1867
|
-
* @param format - the format we use to decode the value
|
|
1868
|
-
* @returns a uint8array
|
|
1869
|
-
*/
|
|
1870
|
-
export declare function stringToUint8Array(value: string, format: EncodingType): Uint8Array;
|
|
1871
|
-
|
|
1872
|
-
/**
|
|
1873
|
-
* Defines options that are used to configure common telemetry and tracing info
|
|
1874
|
-
*/
|
|
1875
|
-
export declare interface TelemetryOptions {
|
|
1876
|
-
/**
|
|
1877
|
-
* The name of the header to pass the request ID to.
|
|
1878
|
-
*/
|
|
1879
|
-
clientRequestIdHeaderName?: string;
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
/**
|
|
1883
|
-
* Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.
|
|
1884
|
-
*/
|
|
1885
|
-
export declare function tlsPolicy(tlsSettings?: TlsSettings): PipelinePolicy;
|
|
1886
|
-
|
|
1887
|
-
/**
|
|
1888
|
-
* Name of the TLS Policy
|
|
1889
|
-
*/
|
|
1890
|
-
export declare const tlsPolicyName = "tlsPolicy";
|
|
1891
|
-
|
|
1892
|
-
/**
|
|
1893
|
-
* Represents a certificate for TLS authentication.
|
|
1894
|
-
*/
|
|
1895
|
-
export declare interface TlsSettings {
|
|
1896
|
-
/**
|
|
1897
|
-
* Optionally override the trusted CA certificates. Default is to trust
|
|
1898
|
-
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
|
|
1899
|
-
* replaced when CAs are explicitly specified using this option.
|
|
1900
|
-
*/
|
|
1901
|
-
ca?: string | Buffer | Array<string | Buffer> | undefined;
|
|
1902
|
-
/**
|
|
1903
|
-
* Cert chains in PEM format. One cert chain should be provided per
|
|
1904
|
-
* private key. Each cert chain should consist of the PEM formatted
|
|
1905
|
-
* certificate for a provided private key, followed by the PEM
|
|
1906
|
-
* formatted intermediate certificates (if any), in order, and not
|
|
1907
|
-
* including the root CA (the root CA must be pre-known to the peer,
|
|
1908
|
-
* see ca). When providing multiple cert chains, they do not have to
|
|
1909
|
-
* be in the same order as their private keys in key. If the
|
|
1910
|
-
* intermediate certificates are not provided, the peer will not be
|
|
1911
|
-
* able to validate the certificate, and the handshake will fail.
|
|
1912
|
-
*/
|
|
1913
|
-
cert?: string | Buffer | Array<string | Buffer> | undefined;
|
|
1914
|
-
/**
|
|
1915
|
-
* Private keys in PEM format. PEM allows the option of private keys
|
|
1916
|
-
* being encrypted. Encrypted keys will be decrypted with
|
|
1917
|
-
* options.passphrase. Multiple keys using different algorithms can be
|
|
1918
|
-
* provided either as an array of unencrypted key strings or buffers,
|
|
1919
|
-
* or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.
|
|
1920
|
-
* The object form can only occur in an array.object.passphrase is optional.
|
|
1921
|
-
* Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
|
|
1922
|
-
*/
|
|
1923
|
-
key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
|
|
1924
|
-
/**
|
|
1925
|
-
* Shared passphrase used for a single private key and/or a PFX.
|
|
1926
|
-
*/
|
|
1927
|
-
passphrase?: string | undefined;
|
|
1928
|
-
/**
|
|
1929
|
-
* PFX or PKCS12 encoded private key and certificate chain. pfx is an
|
|
1930
|
-
* alternative to providing key and cert individually. PFX is usually
|
|
1931
|
-
* encrypted, if it is, passphrase will be used to decrypt it. Multiple
|
|
1932
|
-
* PFX can be provided either as an array of unencrypted PFX buffers,
|
|
1933
|
-
* or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.
|
|
1934
|
-
* The object form can only occur in an array.object.passphrase is optional.
|
|
1935
|
-
* Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
|
|
1936
|
-
*/
|
|
1937
|
-
pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
/**
|
|
1941
|
-
* Represents a credential capable of providing an authentication token.
|
|
1942
|
-
*/
|
|
1943
|
-
export declare interface TokenCredential {
|
|
1944
|
-
/**
|
|
1945
|
-
* Gets the token provided by this credential.
|
|
1946
|
-
*
|
|
1947
|
-
* This method is called automatically by Azure SDK client libraries. You may call this method
|
|
1948
|
-
* directly, but you must also handle token caching and token refreshing.
|
|
1949
|
-
*
|
|
1950
|
-
* @param scopes - The list of scopes for which the token will have access.
|
|
1951
|
-
* @param options - The options used to configure any requests this
|
|
1952
|
-
* TokenCredential implementation might make.
|
|
1953
|
-
*/
|
|
1954
|
-
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
/**
|
|
1958
|
-
* Represents a client that can integrate with the currently configured {@link Instrumenter}.
|
|
1959
|
-
*
|
|
1960
|
-
* Create an instance using {@link createTracingClient}.
|
|
1961
|
-
*/
|
|
1962
|
-
export declare interface TracingClient {
|
|
1963
|
-
/**
|
|
1964
|
-
* Wraps a callback in a tracing span, calls the callback, and closes the span.
|
|
1965
|
-
*
|
|
1966
|
-
* This is the primary interface for using Tracing and will handle error recording as well as setting the status on the span.
|
|
1967
|
-
*
|
|
1968
|
-
* Both synchronous and asynchronous functions will be awaited in order to reflect the result of the callback on the span.
|
|
1969
|
-
*
|
|
1970
|
-
* Example:
|
|
1971
|
-
*
|
|
1972
|
-
* ```ts snippet:with_span_example
|
|
1973
|
-
* import { createTracingClient } from "@typespec/ts-http-runtime";
|
|
1974
|
-
*
|
|
1975
|
-
* const tracingClient = createTracingClient({
|
|
1976
|
-
* namespace: "test.namespace",
|
|
1977
|
-
* packageName: "test-package",
|
|
1978
|
-
* packageVersion: "1.0.0",
|
|
1979
|
-
* });
|
|
1980
|
-
* const options = {};
|
|
1981
|
-
* const myOperationResult = await tracingClient.withSpan(
|
|
1982
|
-
* "myClassName.myOperationName",
|
|
1983
|
-
* options,
|
|
1984
|
-
* (updatedOptions) => {
|
|
1985
|
-
* // Do something with the updated options.
|
|
1986
|
-
* return "myOperationResult";
|
|
1987
|
-
* },
|
|
1988
|
-
* );
|
|
1989
|
-
* ```
|
|
1990
|
-
* @param name - The name of the span. By convention this should be `${className}.${methodName}`.
|
|
1991
|
-
* @param operationOptions - The original options passed to the method. The callback will receive these options with the newly created {@link TracingContext}.
|
|
1992
|
-
* @param callback - The callback to be invoked with the updated options and newly created {@link TracingSpan}.
|
|
1993
|
-
*/
|
|
1994
|
-
withSpan<Options extends {
|
|
1995
|
-
tracingOptions?: OperationTracingOptions;
|
|
1996
|
-
}, Callback extends (updatedOptions: Options, span: Omit<TracingSpan, "end">) => ReturnType<Callback>>(name: string, operationOptions: Options, callback: Callback, spanOptions?: TracingSpanOptions): Promise<Resolved<ReturnType<Callback>>>;
|
|
1997
|
-
/**
|
|
1998
|
-
* Starts a given span but does not set it as the active span.
|
|
1999
|
-
*
|
|
2000
|
-
* You must end the span using {@link TracingSpan.end}.
|
|
2001
|
-
*
|
|
2002
|
-
* Most of the time you will want to use {@link withSpan} instead.
|
|
2003
|
-
*
|
|
2004
|
-
* @param name - The name of the span. By convention this should be `${className}.${methodName}`.
|
|
2005
|
-
* @param operationOptions - The original operation options.
|
|
2006
|
-
* @param spanOptions - The options to use when creating the span.
|
|
2007
|
-
*
|
|
2008
|
-
* @returns A {@link TracingSpan} and the updated operation options.
|
|
2009
|
-
*/
|
|
2010
|
-
startSpan<Options extends {
|
|
2011
|
-
tracingOptions?: OperationTracingOptions;
|
|
2012
|
-
}>(name: string, operationOptions?: Options, spanOptions?: TracingSpanOptions): {
|
|
2013
|
-
span: TracingSpan;
|
|
2014
|
-
updatedOptions: OptionsWithTracingContext<Options>;
|
|
2015
|
-
};
|
|
2016
|
-
/**
|
|
2017
|
-
* Wraps a callback with an active context and calls the callback.
|
|
2018
|
-
* Depending on the implementation, this may set the globally available active context.
|
|
2019
|
-
*
|
|
2020
|
-
* Useful when you want to leave the boundaries of the SDK (make a request or callback to user code) and are unable to use the {@link withSpan} API.
|
|
2021
|
-
*
|
|
2022
|
-
* @param context - The {@link TracingContext} to use as the active context in the scope of the callback.
|
|
2023
|
-
* @param callback - The callback to be invoked with the given context set as the globally active context.
|
|
2024
|
-
* @param callbackArgs - The callback arguments.
|
|
2025
|
-
*/
|
|
2026
|
-
withContext<CallbackArgs extends unknown[], Callback extends (...args: CallbackArgs) => ReturnType<Callback>>(context: TracingContext, callback: Callback, ...callbackArgs: CallbackArgs): ReturnType<Callback>;
|
|
2027
|
-
/**
|
|
2028
|
-
* Parses a traceparent header value into a {@link TracingSpanContext}.
|
|
2029
|
-
*
|
|
2030
|
-
* @param traceparentHeader - The traceparent header to parse.
|
|
2031
|
-
* @returns An implementation-specific identifier for the span.
|
|
2032
|
-
*/
|
|
2033
|
-
parseTraceparentHeader(traceparentHeader: string): TracingContext | undefined;
|
|
2034
|
-
/**
|
|
2035
|
-
* Creates a set of request headers to propagate tracing information to a backend.
|
|
2036
|
-
*
|
|
2037
|
-
* @param tracingContext - The context containing the span to propagate.
|
|
2038
|
-
* @returns The set of headers to add to a request.
|
|
2039
|
-
*/
|
|
2040
|
-
createRequestHeaders(tracingContext?: TracingContext): Record<string, string>;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
/**
|
|
2044
|
-
* Options that can be passed to {@link createTracingClient}
|
|
2045
|
-
*/
|
|
2046
|
-
export declare interface TracingClientOptions {
|
|
2047
|
-
/** The value of the az.namespace tracing attribute on newly created spans. */
|
|
2048
|
-
namespace: string;
|
|
2049
|
-
/** The name of the package invoking this trace. */
|
|
2050
|
-
packageName: string;
|
|
2051
|
-
/** An optional version of the package invoking this trace. */
|
|
2052
|
-
packageVersion?: string;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
/** An immutable context bag of tracing values for the current operation. */
|
|
2056
|
-
export declare interface TracingContext {
|
|
2057
|
-
/**
|
|
2058
|
-
* Sets a given object on a context.
|
|
2059
|
-
* @param key - The key of the given context value.
|
|
2060
|
-
* @param value - The value to set on the context.
|
|
2061
|
-
*
|
|
2062
|
-
* @returns - A new context with the given value set.
|
|
2063
|
-
*/
|
|
2064
|
-
setValue(key: symbol, value: unknown): TracingContext;
|
|
2065
|
-
/**
|
|
2066
|
-
* Gets an object from the context if it exists.
|
|
2067
|
-
* @param key - The key of the given context value.
|
|
2068
|
-
*
|
|
2069
|
-
* @returns - The value of the given context value if it exists, otherwise `undefined`.
|
|
2070
|
-
*/
|
|
2071
|
-
getValue(key: symbol): unknown;
|
|
2072
|
-
/**
|
|
2073
|
-
* Deletes an object from the context if it exists.
|
|
2074
|
-
* @param key - The key of the given context value to delete.
|
|
2075
|
-
*/
|
|
2076
|
-
deleteValue(key: symbol): TracingContext;
|
|
2077
|
-
}
|
|
2078
|
-
|
|
2079
|
-
/**
|
|
2080
|
-
* A simple policy to create OpenTelemetry Spans for each request made by the pipeline
|
|
2081
|
-
* that has SpanOptions with a parent.
|
|
2082
|
-
* Requests made without a parent Span will not be recorded.
|
|
2083
|
-
* @param options - Options to configure the telemetry logged by the tracing policy.
|
|
2084
|
-
*/
|
|
2085
|
-
export declare function tracingPolicy(options?: TracingPolicyOptions): PipelinePolicy;
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
* The programmatic identifier of the tracingPolicy.
|
|
2089
|
-
*/
|
|
2090
|
-
export declare const tracingPolicyName = "tracingPolicy";
|
|
2091
|
-
|
|
2092
|
-
/**
|
|
2093
|
-
* Options to configure the tracing policy.
|
|
2094
|
-
*/
|
|
2095
|
-
export declare interface TracingPolicyOptions {
|
|
2096
|
-
/**
|
|
2097
|
-
* String prefix to add to the user agent logged as metadata
|
|
2098
|
-
* on the generated Span.
|
|
2099
|
-
* Defaults to an empty string.
|
|
2100
|
-
*/
|
|
2101
|
-
userAgentPrefix?: string;
|
|
2102
|
-
/**
|
|
2103
|
-
* Query string names whose values will be logged when logging is enabled. By default no
|
|
2104
|
-
* query string values are logged.
|
|
2105
|
-
*/
|
|
2106
|
-
additionalAllowedQueryParameters?: string[];
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
/**
|
|
2110
|
-
* Represents an implementation agnostic tracing span.
|
|
2111
|
-
*/
|
|
2112
|
-
export declare interface TracingSpan {
|
|
2113
|
-
/**
|
|
2114
|
-
* Sets the status of the span. When an error is provided, it will be recorded on the span as well.
|
|
2115
|
-
*
|
|
2116
|
-
* @param status - The {@link SpanStatus} to set on the span.
|
|
2117
|
-
*/
|
|
2118
|
-
setStatus(status: SpanStatus): void;
|
|
2119
|
-
/**
|
|
2120
|
-
* Sets a given attribute on a span.
|
|
2121
|
-
*
|
|
2122
|
-
* @param name - The attribute's name.
|
|
2123
|
-
* @param value - The attribute's value to set. May be any non-nullish value.
|
|
2124
|
-
*/
|
|
2125
|
-
setAttribute(name: string, value: unknown): void;
|
|
2126
|
-
/**
|
|
2127
|
-
* Ends the span.
|
|
2128
|
-
*/
|
|
2129
|
-
end(): void;
|
|
2130
|
-
/**
|
|
2131
|
-
* Records an exception on a {@link TracingSpan} without modifying its status.
|
|
2132
|
-
*
|
|
2133
|
-
* When recording an unhandled exception that should fail the span, please use {@link TracingSpan.setStatus} instead.
|
|
2134
|
-
*
|
|
2135
|
-
* @param exception - The exception to record on the span.
|
|
2136
|
-
*
|
|
2137
|
-
*/
|
|
2138
|
-
recordException(exception: Error | string): void;
|
|
2139
|
-
/**
|
|
2140
|
-
* Returns true if this {@link TracingSpan} is recording information.
|
|
2141
|
-
*
|
|
2142
|
-
* Depending on the span implementation, this may return false if the span is not being sampled.
|
|
2143
|
-
*/
|
|
2144
|
-
isRecording(): boolean;
|
|
2145
|
-
/**
|
|
2146
|
-
* Adds an event to the span.
|
|
2147
|
-
*/
|
|
2148
|
-
addEvent?(name: string, options?: AddEventOptions): void;
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
/** The kind of span. */
|
|
2152
|
-
export declare type TracingSpanKind = "client" | "server" | "producer" | "consumer" | "internal";
|
|
2153
|
-
|
|
2154
|
-
/** A pointer from the current {@link TracingSpan} to another span in the same or a different trace. */
|
|
2155
|
-
export declare interface TracingSpanLink {
|
|
2156
|
-
/** The {@link TracingContext} containing the span context to link to. */
|
|
2157
|
-
tracingContext: TracingContext;
|
|
2158
|
-
/** A set of attributes on the link. */
|
|
2159
|
-
attributes?: {
|
|
2160
|
-
[key: string]: unknown;
|
|
2161
|
-
};
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
/** Options used to configure the newly created span. */
|
|
2165
|
-
export declare interface TracingSpanOptions {
|
|
2166
|
-
/** The kind of span. Implementations should default this to "client". */
|
|
2167
|
-
spanKind?: TracingSpanKind;
|
|
2168
|
-
/** A collection of {@link TracingSpanLink} to link to this span. */
|
|
2169
|
-
spanLinks?: TracingSpanLink[];
|
|
2170
|
-
/** Initial set of attributes to set on a span. */
|
|
2171
|
-
spanAttributes?: {
|
|
2172
|
-
[key: string]: unknown;
|
|
2173
|
-
};
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
/**
|
|
2177
|
-
* Fired in response to upload or download progress.
|
|
2178
|
-
*/
|
|
2179
|
-
export declare type TransferProgressEvent = {
|
|
2180
|
-
/**
|
|
2181
|
-
* The number of bytes loaded so far.
|
|
2182
|
-
*/
|
|
2183
|
-
loadedBytes: number;
|
|
2184
|
-
};
|
|
2185
|
-
|
|
2186
|
-
/**
|
|
2187
|
-
* An TypeSpecRuntimeClientLogger is a function that can log to an appropriate severity level.
|
|
2188
|
-
*/
|
|
2189
|
-
export declare type TypeSpecRuntimeClientLogger = Debugger;
|
|
2190
|
-
|
|
2191
|
-
/**
|
|
2192
|
-
* The TypeSpecRuntimeLogger provides a mechanism for overriding where logs are output to.
|
|
2193
|
-
* By default, logs are sent to stderr.
|
|
2194
|
-
* Override the `log` method to redirect logs to another location.
|
|
2195
|
-
*/
|
|
2196
|
-
export declare const TypeSpecRuntimeLogger: TypeSpecRuntimeClientLogger;
|
|
2197
|
-
|
|
2198
|
-
/**
|
|
2199
|
-
* Defines the methods available on the SDK-facing logger.
|
|
2200
|
-
*/
|
|
2201
|
-
export declare interface TypeSpecRuntimeLogger {
|
|
2202
|
-
/**
|
|
2203
|
-
* Used for failures the program is unlikely to recover from,
|
|
2204
|
-
* such as Out of Memory.
|
|
2205
|
-
*/
|
|
2206
|
-
error: Debugger;
|
|
2207
|
-
/**
|
|
2208
|
-
* Used when a function fails to perform its intended task.
|
|
2209
|
-
* Usually this means the function will throw an exception.
|
|
2210
|
-
* Not used for self-healing events (e.g. automatic retry)
|
|
2211
|
-
*/
|
|
2212
|
-
warning: Debugger;
|
|
2213
|
-
/**
|
|
2214
|
-
* Used when a function operates normally.
|
|
2215
|
-
*/
|
|
2216
|
-
info: Debugger;
|
|
2217
|
-
/**
|
|
2218
|
-
* Used for detailed troubleshooting scenarios. This is
|
|
2219
|
-
* intended for use by developers / system administrators
|
|
2220
|
-
* for diagnosing specific failures.
|
|
2221
|
-
*/
|
|
2222
|
-
verbose: Debugger;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
/**
|
|
2226
|
-
* The log levels supported by the logger.
|
|
2227
|
-
* The log levels in order of most verbose to least verbose are:
|
|
2228
|
-
* - verbose
|
|
2229
|
-
* - info
|
|
2230
|
-
* - warning
|
|
2231
|
-
* - error
|
|
2232
|
-
*/
|
|
2233
|
-
export declare type TypeSpecRuntimeLogLevel = "verbose" | "info" | "warning" | "error";
|
|
2234
|
-
|
|
2235
|
-
/**
|
|
2236
|
-
* The helper that transforms bytes with specific character encoding into string
|
|
2237
|
-
* @param bytes - the uint8array bytes
|
|
2238
|
-
* @param format - the format we use to encode the byte
|
|
2239
|
-
* @returns a string of the encoded string
|
|
2240
|
-
*/
|
|
2241
|
-
export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
|
|
2242
|
-
|
|
2243
|
-
/**
|
|
2244
|
-
* A generic shape for a plain JS object.
|
|
2245
|
-
*/
|
|
2246
|
-
export declare type UnknownObject = {
|
|
2247
|
-
[s: string]: unknown;
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
/**
|
|
2251
|
-
* Extends the Azure SDK with support for a given instrumenter implementation.
|
|
2252
|
-
*
|
|
2253
|
-
* @param instrumenter - The instrumenter implementation to use.
|
|
2254
|
-
*/
|
|
2255
|
-
export declare function useInstrumenter(instrumenter: Instrumenter): void;
|
|
2256
|
-
|
|
2257
|
-
/**
|
|
2258
|
-
* A policy that sets the User-Agent header (or equivalent) to reflect
|
|
2259
|
-
* the library version.
|
|
2260
|
-
* @param options - Options to customize the user agent value.
|
|
2261
|
-
*/
|
|
2262
|
-
export declare function userAgentPolicy(options?: UserAgentPolicyOptions): PipelinePolicy;
|
|
2263
|
-
|
|
2264
|
-
/**
|
|
2265
|
-
* The programmatic identifier of the userAgentPolicy.
|
|
2266
|
-
*/
|
|
2267
|
-
export declare const userAgentPolicyName = "userAgentPolicy";
|
|
2268
|
-
|
|
2269
|
-
/**
|
|
2270
|
-
* Options for adding user agent details to outgoing requests.
|
|
2271
|
-
*/
|
|
2272
|
-
export declare interface UserAgentPolicyOptions {
|
|
2273
|
-
/**
|
|
2274
|
-
* String prefix to add to the user agent for outgoing requests.
|
|
2275
|
-
* Defaults to an empty string.
|
|
2276
|
-
*/
|
|
2277
|
-
userAgentPrefix?: string;
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
export { }
|