@azure/core-rest-pipeline 1.20.1-alpha.20250603.2 → 1.20.1-alpha.20250605.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ export { createPipelineFromOptions, type TelemetryOptions, type InternalPipeline
17
17
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
18
18
  export { createHttpHeaders } from "./httpHeaders.js";
19
19
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
20
- export { RestError, type RestErrorOptions, isRestError } from "./restError.js";
20
+ export { RestError, type RestErrorOptions, type RestErrorConstructor, isRestError, } from "./restError.js";
21
21
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
22
22
  export { exponentialRetryPolicy, type ExponentialRetryPolicyOptions, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
23
23
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -5,7 +5,7 @@ export { createPipelineFromOptions, } from "./createPipelineFromOptions.js";
5
5
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
6
6
  export { createHttpHeaders } from "./httpHeaders.js";
7
7
  export { createPipelineRequest } from "./pipelineRequest.js";
8
- export { RestError, isRestError } from "./restError.js";
8
+ export { RestError, isRestError, } from "./restError.js";
9
9
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
10
10
  export { exponentialRetryPolicy, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
11
11
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport { RestError, type RestErrorOptions, isRestError } from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,SAAS,EAGT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n RestError,\n type RestErrorOptions,\n type RestErrorConstructor,\n isRestError,\n} from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
@@ -23,18 +23,31 @@ export interface RestErrorOptions {
23
23
  /**
24
24
  * A custom error type for failed pipeline requests.
25
25
  */
26
- export declare class RestError extends Error {
26
+ export interface RestErrorConstructor {
27
27
  /**
28
28
  * Something went wrong when making the request.
29
29
  * This means the actual request failed for some reason,
30
30
  * such as a DNS issue or the connection being lost.
31
31
  */
32
- static readonly REQUEST_SEND_ERROR: string;
32
+ readonly REQUEST_SEND_ERROR: string;
33
33
  /**
34
34
  * This means that parsing the response from the server failed.
35
35
  * It may have been malformed.
36
36
  */
37
- static readonly PARSE_ERROR: string;
37
+ readonly PARSE_ERROR: string;
38
+ /**
39
+ * Prototype of RestError
40
+ */
41
+ readonly prototype: RestError;
42
+ /**
43
+ * Construct a new RestError.
44
+ */
45
+ new (message: string, options?: RestErrorOptions): RestError;
46
+ }
47
+ /**
48
+ * A custom error type for failed pipeline requests.
49
+ */
50
+ export interface RestError extends Error {
38
51
  /**
39
52
  * The code of the error itself (use statics on RestError if possible.)
40
53
  */
@@ -57,8 +70,11 @@ export declare class RestError extends Error {
57
70
  * Bonus property set by the throw site.
58
71
  */
59
72
  details?: unknown;
60
- constructor(message: string, options?: RestErrorOptions);
61
73
  }
74
+ /**
75
+ * A custom error type for failed pipeline requests.
76
+ */
77
+ export declare const RestError: RestErrorConstructor;
62
78
  /**
63
79
  * Typeguard for RestError
64
80
  * @param e - Something caught by a catch clause.
@@ -4,28 +4,8 @@ import { RestError as TspRestError, isRestError as tspIsRestError, } from "@type
4
4
  /**
5
5
  * A custom error type for failed pipeline requests.
6
6
  */
7
- export class RestError extends Error {
8
- constructor(message, options = {}) {
9
- super(message);
10
- // what is this??
11
- // it turns out that you can return from a constructor and it causes
12
- // calling `new` to return the value you return.
13
- // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,
14
- // even though the constructor signatures (through RestErrorOptions) are slightly different.
15
- return new TspRestError(message, options);
16
- }
17
- }
18
- /**
19
- * Something went wrong when making the request.
20
- * This means the actual request failed for some reason,
21
- * such as a DNS issue or the connection being lost.
22
- */
23
- RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
24
- /**
25
- * This means that parsing the response from the server failed.
26
- * It may have been malformed.
27
- */
28
- RestError.PARSE_ERROR = "PARSE_ERROR";
7
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
8
+ export const RestError = TspRestError;
29
9
  /**
30
10
  * Typeguard for RestError
31
11
  * @param e - Something caught by a catch clause.
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AAwBnC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,iBAAiB;QACjB,oEAAoE;QACpE,gDAAgD;QAChD,+IAA+I;QAC/I,4FAA4F;QAC5F,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,OAA8B,CAAC,CAAC;IACnE,CAAC;;AA5CD;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAqCtD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport type { RestErrorOptions as TspRestErrorOptions } from \"@typespec/ts-http-runtime\";\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n\n // what is this??\n // it turns out that you can return from a constructor and it causes\n // calling `new` to return the value you return.\n // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,\n // even though the constructor signatures (through RestErrorOptions) are slightly different.\n return new TspRestError(message, options as TspRestErrorOptions);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
1
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AA+EnC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAyB,YAAoC,CAAC;AAEpF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestErrorConstructor {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n readonly REQUEST_SEND_ERROR: string;\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n readonly PARSE_ERROR: string;\n\n /**\n * Prototype of RestError\n */\n readonly prototype: RestError;\n\n /**\n * Construct a new RestError.\n */\n new (message: string, options?: RestErrorOptions): RestError;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestError extends Error {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n details?: unknown;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const RestError: RestErrorConstructor = TspRestError as RestErrorConstructor;\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
@@ -17,7 +17,7 @@ export { createPipelineFromOptions, type TelemetryOptions, type InternalPipeline
17
17
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
18
18
  export { createHttpHeaders } from "./httpHeaders.js";
19
19
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
20
- export { RestError, type RestErrorOptions, isRestError } from "./restError.js";
20
+ export { RestError, type RestErrorOptions, type RestErrorConstructor, isRestError, } from "./restError.js";
21
21
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
22
22
  export { exponentialRetryPolicy, type ExponentialRetryPolicyOptions, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
23
23
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgClC,6CAMuB;AADrB,kHAAA,mBAAmB,OAAA;AAErB,+EAKwC;AAJtC,yIAAA,yBAAyB,OAAA;AAK3B,+DAAiE;AAAxD,+HAAA,uBAAuB,OAAA;AAChC,mDAAqD;AAA5C,mHAAA,iBAAiB,OAAA;AAC1B,2DAA0F;AAAjF,2HAAA,qBAAqB,OAAA;AAC9B,+CAA+E;AAAtE,yGAAA,SAAS,OAAA;AAAyB,2GAAA,WAAW,OAAA;AACtD,sFAGgD;AAF9C,uIAAA,wBAAwB,OAAA;AACxB,2IAAA,4BAA4B,OAAA;AAE9B,kFAI8C;AAH5C,mIAAA,sBAAsB,OAAA;AAEtB,uIAAA,0BAA0B,OAAA;AAE5B,sFAGgD;AAF9C,uIAAA,wBAAwB,OAAA;AACxB,2IAAA,4BAA4B,OAAA;AAE9B,wDAA0F;AAAjF,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AACjC,oEAAqF;AAA5E,qHAAA,eAAe,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AAC7C,4DAAkG;AAAzF,6GAAA,WAAW,OAAA;AAAE,iHAAA,eAAe,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAC9D,kEAIsC;AAHpC,mHAAA,cAAc,OAAA;AACd,uHAAA,kBAAkB,OAAA;AAGpB,kFAI8C;AAH5C,mIAAA,sBAAsB,OAAA;AAEtB,uIAAA,0BAA0B,OAAA;AAE5B,gFAI6C;AAH3C,iIAAA,qBAAqB,OAAA;AACrB,qIAAA,yBAAyB,OAAA;AAG3B,4DAMmC;AALjC,6GAAA,WAAW,OAAA;AAMb,gEAIqC;AAHnC,iHAAA,aAAa,OAAA;AACb,qHAAA,iBAAiB,OAAA;AAGnB,0EAG0C;AAFxC,2HAAA,kBAAkB,OAAA;AAGpB,oEAIuC;AAHrC,qHAAA,eAAe,OAAA;AACf,yHAAA,mBAAmB,OAAA;AAGrB,wDAAmE;AAA1D,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AACjC,kEAAkF;AAAzE,mHAAA,cAAc,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAC3C,oGAOuD;AANrD,qJAAA,+BAA+B,OAAA;AAE/B,yJAAA,mCAAmC,OAAA;AAKrC,8DAA4E;AAAnE,+GAAA,YAAY,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AACvC,4GAI2D;AAHzD,6JAAA,mCAAmC,OAAA;AAEnC,iKAAA,uCAAuC,OAAA;AAEzC,4DAAyE;AAAhE,6GAAA,WAAW,OAAA;AAAE,iHAAA,eAAe,OAAA;AACrC,0CAKwB;AAJtB,qGAAA,UAAU,OAAA;AACV,+GAAA,oBAAoB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport { RestError, type RestErrorOptions, isRestError } from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgClC,6CAMuB;AADrB,kHAAA,mBAAmB,OAAA;AAErB,+EAKwC;AAJtC,yIAAA,yBAAyB,OAAA;AAK3B,+DAAiE;AAAxD,+HAAA,uBAAuB,OAAA;AAChC,mDAAqD;AAA5C,mHAAA,iBAAiB,OAAA;AAC1B,2DAA0F;AAAjF,2HAAA,qBAAqB,OAAA;AAC9B,+CAKwB;AAJtB,yGAAA,SAAS,OAAA;AAGT,2GAAA,WAAW,OAAA;AAEb,sFAGgD;AAF9C,uIAAA,wBAAwB,OAAA;AACxB,2IAAA,4BAA4B,OAAA;AAE9B,kFAI8C;AAH5C,mIAAA,sBAAsB,OAAA;AAEtB,uIAAA,0BAA0B,OAAA;AAE5B,sFAGgD;AAF9C,uIAAA,wBAAwB,OAAA;AACxB,2IAAA,4BAA4B,OAAA;AAE9B,wDAA0F;AAAjF,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AACjC,oEAAqF;AAA5E,qHAAA,eAAe,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AAC7C,4DAAkG;AAAzF,6GAAA,WAAW,OAAA;AAAE,iHAAA,eAAe,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAC9D,kEAIsC;AAHpC,mHAAA,cAAc,OAAA;AACd,uHAAA,kBAAkB,OAAA;AAGpB,kFAI8C;AAH5C,mIAAA,sBAAsB,OAAA;AAEtB,uIAAA,0BAA0B,OAAA;AAE5B,gFAI6C;AAH3C,iIAAA,qBAAqB,OAAA;AACrB,qIAAA,yBAAyB,OAAA;AAG3B,4DAMmC;AALjC,6GAAA,WAAW,OAAA;AAMb,gEAIqC;AAHnC,iHAAA,aAAa,OAAA;AACb,qHAAA,iBAAiB,OAAA;AAGnB,0EAG0C;AAFxC,2HAAA,kBAAkB,OAAA;AAGpB,oEAIuC;AAHrC,qHAAA,eAAe,OAAA;AACf,yHAAA,mBAAmB,OAAA;AAGrB,wDAAmE;AAA1D,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AACjC,kEAAkF;AAAzE,mHAAA,cAAc,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAC3C,oGAOuD;AANrD,qJAAA,+BAA+B,OAAA;AAE/B,yJAAA,mCAAmC,OAAA;AAKrC,8DAA4E;AAAnE,+GAAA,YAAY,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AACvC,4GAI2D;AAHzD,6JAAA,mCAAmC,OAAA;AAEnC,iKAAA,uCAAuC,OAAA;AAEzC,4DAAyE;AAAhE,6GAAA,WAAW,OAAA;AAAE,iHAAA,eAAe,OAAA;AACrC,0CAKwB;AAJtB,qGAAA,UAAU,OAAA;AACV,+GAAA,oBAAoB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n RestError,\n type RestErrorOptions,\n type RestErrorConstructor,\n isRestError,\n} from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
@@ -23,18 +23,31 @@ export interface RestErrorOptions {
23
23
  /**
24
24
  * A custom error type for failed pipeline requests.
25
25
  */
26
- export declare class RestError extends Error {
26
+ export interface RestErrorConstructor {
27
27
  /**
28
28
  * Something went wrong when making the request.
29
29
  * This means the actual request failed for some reason,
30
30
  * such as a DNS issue or the connection being lost.
31
31
  */
32
- static readonly REQUEST_SEND_ERROR: string;
32
+ readonly REQUEST_SEND_ERROR: string;
33
33
  /**
34
34
  * This means that parsing the response from the server failed.
35
35
  * It may have been malformed.
36
36
  */
37
- static readonly PARSE_ERROR: string;
37
+ readonly PARSE_ERROR: string;
38
+ /**
39
+ * Prototype of RestError
40
+ */
41
+ readonly prototype: RestError;
42
+ /**
43
+ * Construct a new RestError.
44
+ */
45
+ new (message: string, options?: RestErrorOptions): RestError;
46
+ }
47
+ /**
48
+ * A custom error type for failed pipeline requests.
49
+ */
50
+ export interface RestError extends Error {
38
51
  /**
39
52
  * The code of the error itself (use statics on RestError if possible.)
40
53
  */
@@ -57,8 +70,11 @@ export declare class RestError extends Error {
57
70
  * Bonus property set by the throw site.
58
71
  */
59
72
  details?: unknown;
60
- constructor(message: string, options?: RestErrorOptions);
61
73
  }
74
+ /**
75
+ * A custom error type for failed pipeline requests.
76
+ */
77
+ export declare const RestError: RestErrorConstructor;
62
78
  /**
63
79
  * Typeguard for RestError
64
80
  * @param e - Something caught by a catch clause.
@@ -8,29 +8,8 @@ const ts_http_runtime_1 = require("@typespec/ts-http-runtime");
8
8
  /**
9
9
  * A custom error type for failed pipeline requests.
10
10
  */
11
- class RestError extends Error {
12
- constructor(message, options = {}) {
13
- super(message);
14
- // what is this??
15
- // it turns out that you can return from a constructor and it causes
16
- // calling `new` to return the value you return.
17
- // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,
18
- // even though the constructor signatures (through RestErrorOptions) are slightly different.
19
- return new ts_http_runtime_1.RestError(message, options);
20
- }
21
- }
22
- exports.RestError = RestError;
23
- /**
24
- * Something went wrong when making the request.
25
- * This means the actual request failed for some reason,
26
- * such as a DNS issue or the connection being lost.
27
- */
28
- RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
29
- /**
30
- * This means that parsing the response from the server failed.
31
- * It may have been malformed.
32
- */
33
- RestError.PARSE_ERROR = "PARSE_ERROR";
11
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
12
+ exports.RestError = ts_http_runtime_1.RestError;
34
13
  /**
35
14
  * Typeguard for RestError
36
15
  * @param e - Something caught by a catch clause.
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAuFlC,kCAEC;AApFD,+DAGmC;AAwBnC;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,iBAAiB;QACjB,oEAAoE;QACpE,gDAAgD;QAChD,+IAA+I;QAC/I,4FAA4F;QAC5F,OAAO,IAAI,2BAAY,CAAC,OAAO,EAAE,OAA8B,CAAC,CAAC;IACnE,CAAC;;AA7CH,8BA8CC;AA7CC;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAqCtD;;;GAGG;AACH,SAAgB,WAAW,CAAC,CAAU;IACpC,OAAO,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport type { RestErrorOptions as TspRestErrorOptions } from \"@typespec/ts-http-runtime\";\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n\n // what is this??\n // it turns out that you can return from a constructor and it causes\n // calling `new` to return the value you return.\n // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,\n // even though the constructor signatures (through RestErrorOptions) are slightly different.\n return new TspRestError(message, options as TspRestErrorOptions);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
1
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgGlC,kCAEC;AA9FD,+DAGmC;AA+EnC;;GAEG;AACH,2DAA2D;AAC9C,QAAA,SAAS,GAAyB,2BAAoC,CAAC;AAEpF;;;GAGG;AACH,SAAgB,WAAW,CAAC,CAAU;IACpC,OAAO,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestErrorConstructor {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n readonly REQUEST_SEND_ERROR: string;\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n readonly PARSE_ERROR: string;\n\n /**\n * Prototype of RestError\n */\n readonly prototype: RestError;\n\n /**\n * Construct a new RestError.\n */\n new (message: string, options?: RestErrorOptions): RestError;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestError extends Error {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n details?: unknown;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const RestError: RestErrorConstructor = TspRestError as RestErrorConstructor;\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
@@ -17,7 +17,7 @@ export { createPipelineFromOptions, type TelemetryOptions, type InternalPipeline
17
17
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
18
18
  export { createHttpHeaders } from "./httpHeaders.js";
19
19
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
20
- export { RestError, type RestErrorOptions, isRestError } from "./restError.js";
20
+ export { RestError, type RestErrorOptions, type RestErrorConstructor, isRestError, } from "./restError.js";
21
21
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
22
22
  export { exponentialRetryPolicy, type ExponentialRetryPolicyOptions, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
23
23
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { createPipelineFromOptions, } from "./createPipelineFromOptions.js";
5
5
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
6
6
  export { createHttpHeaders } from "./httpHeaders.js";
7
7
  export { createPipelineRequest } from "./pipelineRequest.js";
8
- export { RestError, isRestError } from "./restError.js";
8
+ export { RestError, isRestError, } from "./restError.js";
9
9
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
10
10
  export { exponentialRetryPolicy, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
11
11
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport { RestError, type RestErrorOptions, isRestError } from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,SAAS,EAGT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n RestError,\n type RestErrorOptions,\n type RestErrorConstructor,\n isRestError,\n} from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
@@ -23,18 +23,31 @@ export interface RestErrorOptions {
23
23
  /**
24
24
  * A custom error type for failed pipeline requests.
25
25
  */
26
- export declare class RestError extends Error {
26
+ export interface RestErrorConstructor {
27
27
  /**
28
28
  * Something went wrong when making the request.
29
29
  * This means the actual request failed for some reason,
30
30
  * such as a DNS issue or the connection being lost.
31
31
  */
32
- static readonly REQUEST_SEND_ERROR: string;
32
+ readonly REQUEST_SEND_ERROR: string;
33
33
  /**
34
34
  * This means that parsing the response from the server failed.
35
35
  * It may have been malformed.
36
36
  */
37
- static readonly PARSE_ERROR: string;
37
+ readonly PARSE_ERROR: string;
38
+ /**
39
+ * Prototype of RestError
40
+ */
41
+ readonly prototype: RestError;
42
+ /**
43
+ * Construct a new RestError.
44
+ */
45
+ new (message: string, options?: RestErrorOptions): RestError;
46
+ }
47
+ /**
48
+ * A custom error type for failed pipeline requests.
49
+ */
50
+ export interface RestError extends Error {
38
51
  /**
39
52
  * The code of the error itself (use statics on RestError if possible.)
40
53
  */
@@ -57,8 +70,11 @@ export declare class RestError extends Error {
57
70
  * Bonus property set by the throw site.
58
71
  */
59
72
  details?: unknown;
60
- constructor(message: string, options?: RestErrorOptions);
61
73
  }
74
+ /**
75
+ * A custom error type for failed pipeline requests.
76
+ */
77
+ export declare const RestError: RestErrorConstructor;
62
78
  /**
63
79
  * Typeguard for RestError
64
80
  * @param e - Something caught by a catch clause.
@@ -4,28 +4,8 @@ import { RestError as TspRestError, isRestError as tspIsRestError, } from "@type
4
4
  /**
5
5
  * A custom error type for failed pipeline requests.
6
6
  */
7
- export class RestError extends Error {
8
- constructor(message, options = {}) {
9
- super(message);
10
- // what is this??
11
- // it turns out that you can return from a constructor and it causes
12
- // calling `new` to return the value you return.
13
- // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,
14
- // even though the constructor signatures (through RestErrorOptions) are slightly different.
15
- return new TspRestError(message, options);
16
- }
17
- }
18
- /**
19
- * Something went wrong when making the request.
20
- * This means the actual request failed for some reason,
21
- * such as a DNS issue or the connection being lost.
22
- */
23
- RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
24
- /**
25
- * This means that parsing the response from the server failed.
26
- * It may have been malformed.
27
- */
28
- RestError.PARSE_ERROR = "PARSE_ERROR";
7
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
8
+ export const RestError = TspRestError;
29
9
  /**
30
10
  * Typeguard for RestError
31
11
  * @param e - Something caught by a catch clause.
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AAwBnC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,iBAAiB;QACjB,oEAAoE;QACpE,gDAAgD;QAChD,+IAA+I;QAC/I,4FAA4F;QAC5F,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,OAA8B,CAAC,CAAC;IACnE,CAAC;;AA5CD;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAqCtD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport type { RestErrorOptions as TspRestErrorOptions } from \"@typespec/ts-http-runtime\";\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n\n // what is this??\n // it turns out that you can return from a constructor and it causes\n // calling `new` to return the value you return.\n // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,\n // even though the constructor signatures (through RestErrorOptions) are slightly different.\n return new TspRestError(message, options as TspRestErrorOptions);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
1
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AA+EnC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAyB,YAAoC,CAAC;AAEpF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestErrorConstructor {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n readonly REQUEST_SEND_ERROR: string;\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n readonly PARSE_ERROR: string;\n\n /**\n * Prototype of RestError\n */\n readonly prototype: RestError;\n\n /**\n * Construct a new RestError.\n */\n new (message: string, options?: RestErrorOptions): RestError;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestError extends Error {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n details?: unknown;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const RestError: RestErrorConstructor = TspRestError as RestErrorConstructor;\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
@@ -17,7 +17,7 @@ export { createPipelineFromOptions, type TelemetryOptions, type InternalPipeline
17
17
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
18
18
  export { createHttpHeaders } from "./httpHeaders.js";
19
19
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
20
- export { RestError, type RestErrorOptions, isRestError } from "./restError.js";
20
+ export { RestError, type RestErrorOptions, type RestErrorConstructor, isRestError, } from "./restError.js";
21
21
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
22
22
  export { exponentialRetryPolicy, type ExponentialRetryPolicyOptions, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
23
23
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -5,7 +5,7 @@ export { createPipelineFromOptions, } from "./createPipelineFromOptions.js";
5
5
  export { createDefaultHttpClient } from "./defaultHttpClient.js";
6
6
  export { createHttpHeaders } from "./httpHeaders.js";
7
7
  export { createPipelineRequest } from "./pipelineRequest.js";
8
- export { RestError, isRestError } from "./restError.js";
8
+ export { RestError, isRestError, } from "./restError.js";
9
9
  export { decompressResponsePolicy, decompressResponsePolicyName, } from "./policies/decompressResponsePolicy.js";
10
10
  export { exponentialRetryPolicy, exponentialRetryPolicyName, } from "./policies/exponentialRetryPolicy.js";
11
11
  export { setClientRequestIdPolicy, setClientRequestIdPolicyName, } from "./policies/setClientRequestIdPolicy.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport { RestError, type RestErrorOptions, isRestError } from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgClC,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,SAAS,EAGT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,GAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,WAAW,GAKZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,GAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,+BAA+B,EAE/B,mCAAmC,GAIpC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,mCAAmC,EAEnC,uCAAuC,GACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport type { HttpMethods } from \"@azure/core-util\";\nexport type {\n Agent,\n BodyPart,\n FormDataMap,\n FormDataValue,\n HttpClient,\n HttpHeaders,\n KeyObject,\n MultipartRequestBody,\n PipelineRequest,\n PipelineResponse,\n PipelineRetryOptions,\n ProxySettings,\n PxfObject,\n RawHttpHeaders,\n RawHttpHeadersInput,\n RequestBodyType,\n SendRequest,\n TlsSettings,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nexport {\n type AddPolicyOptions as AddPipelineOptions,\n type PipelinePhase,\n type PipelinePolicy,\n type Pipeline,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport {\n createPipelineFromOptions,\n type TelemetryOptions,\n type InternalPipelineOptions,\n type PipelineOptions,\n} from \"./createPipelineFromOptions.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n RestError,\n type RestErrorOptions,\n type RestErrorConstructor,\n isRestError,\n} from \"./restError.js\";\nexport {\n decompressResponsePolicy,\n decompressResponsePolicyName,\n} from \"./policies/decompressResponsePolicy.js\";\nexport {\n exponentialRetryPolicy,\n type ExponentialRetryPolicyOptions,\n exponentialRetryPolicyName,\n} from \"./policies/exponentialRetryPolicy.js\";\nexport {\n setClientRequestIdPolicy,\n setClientRequestIdPolicyName,\n} from \"./policies/setClientRequestIdPolicy.js\";\nexport { logPolicy, logPolicyName, type LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\nexport { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from \"./policies/proxyPolicy.js\";\nexport {\n redirectPolicy,\n redirectPolicyName,\n type RedirectPolicyOptions,\n} from \"./policies/redirectPolicy.js\";\nexport {\n systemErrorRetryPolicy,\n type SystemErrorRetryPolicyOptions,\n systemErrorRetryPolicyName,\n} from \"./policies/systemErrorRetryPolicy.js\";\nexport {\n throttlingRetryPolicy,\n throttlingRetryPolicyName,\n type ThrottlingRetryPolicyOptions,\n} from \"./policies/throttlingRetryPolicy.js\";\nexport {\n retryPolicy,\n type RetryPolicyOptions,\n type RetryStrategy,\n type RetryInformation,\n type RetryModifiers,\n} from \"./policies/retryPolicy.js\";\nexport {\n tracingPolicy,\n tracingPolicyName,\n type TracingPolicyOptions,\n} from \"./policies/tracingPolicy.js\";\nexport {\n defaultRetryPolicy,\n type DefaultRetryPolicyOptions,\n} from \"./policies/defaultRetryPolicy.js\";\nexport {\n userAgentPolicy,\n userAgentPolicyName,\n type UserAgentPolicyOptions,\n} from \"./policies/userAgentPolicy.js\";\nexport { tlsPolicy, tlsPolicyName } from \"./policies/tlsPolicy.js\";\nexport { formDataPolicy, formDataPolicyName } from \"./policies/formDataPolicy.js\";\nexport {\n bearerTokenAuthenticationPolicy,\n type BearerTokenAuthenticationPolicyOptions,\n bearerTokenAuthenticationPolicyName,\n type ChallengeCallbacks,\n type AuthorizeRequestOptions,\n type AuthorizeRequestOnChallengeOptions,\n} from \"./policies/bearerTokenAuthenticationPolicy.js\";\nexport { ndJsonPolicy, ndJsonPolicyName } from \"./policies/ndJsonPolicy.js\";\nexport {\n auxiliaryAuthenticationHeaderPolicy,\n type AuxiliaryAuthenticationHeaderPolicyOptions,\n auxiliaryAuthenticationHeaderPolicyName,\n} from \"./policies/auxiliaryAuthenticationHeaderPolicy.js\";\nexport { agentPolicy, agentPolicyName } from \"./policies/agentPolicy.js\";\nexport {\n createFile,\n createFileFromStream,\n type CreateFileOptions,\n type CreateFileFromStreamOptions,\n} from \"./util/file.js\";\n"]}
@@ -23,18 +23,31 @@ export interface RestErrorOptions {
23
23
  /**
24
24
  * A custom error type for failed pipeline requests.
25
25
  */
26
- export declare class RestError extends Error {
26
+ export interface RestErrorConstructor {
27
27
  /**
28
28
  * Something went wrong when making the request.
29
29
  * This means the actual request failed for some reason,
30
30
  * such as a DNS issue or the connection being lost.
31
31
  */
32
- static readonly REQUEST_SEND_ERROR: string;
32
+ readonly REQUEST_SEND_ERROR: string;
33
33
  /**
34
34
  * This means that parsing the response from the server failed.
35
35
  * It may have been malformed.
36
36
  */
37
- static readonly PARSE_ERROR: string;
37
+ readonly PARSE_ERROR: string;
38
+ /**
39
+ * Prototype of RestError
40
+ */
41
+ readonly prototype: RestError;
42
+ /**
43
+ * Construct a new RestError.
44
+ */
45
+ new (message: string, options?: RestErrorOptions): RestError;
46
+ }
47
+ /**
48
+ * A custom error type for failed pipeline requests.
49
+ */
50
+ export interface RestError extends Error {
38
51
  /**
39
52
  * The code of the error itself (use statics on RestError if possible.)
40
53
  */
@@ -57,8 +70,11 @@ export declare class RestError extends Error {
57
70
  * Bonus property set by the throw site.
58
71
  */
59
72
  details?: unknown;
60
- constructor(message: string, options?: RestErrorOptions);
61
73
  }
74
+ /**
75
+ * A custom error type for failed pipeline requests.
76
+ */
77
+ export declare const RestError: RestErrorConstructor;
62
78
  /**
63
79
  * Typeguard for RestError
64
80
  * @param e - Something caught by a catch clause.
@@ -4,28 +4,8 @@ import { RestError as TspRestError, isRestError as tspIsRestError, } from "@type
4
4
  /**
5
5
  * A custom error type for failed pipeline requests.
6
6
  */
7
- export class RestError extends Error {
8
- constructor(message, options = {}) {
9
- super(message);
10
- // what is this??
11
- // it turns out that you can return from a constructor and it causes
12
- // calling `new` to return the value you return.
13
- // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,
14
- // even though the constructor signatures (through RestErrorOptions) are slightly different.
15
- return new TspRestError(message, options);
16
- }
17
- }
18
- /**
19
- * Something went wrong when making the request.
20
- * This means the actual request failed for some reason,
21
- * such as a DNS issue or the connection being lost.
22
- */
23
- RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
24
- /**
25
- * This means that parsing the response from the server failed.
26
- * It may have been malformed.
27
- */
28
- RestError.PARSE_ERROR = "PARSE_ERROR";
7
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
8
+ export const RestError = TspRestError;
29
9
  /**
30
10
  * Typeguard for RestError
31
11
  * @param e - Something caught by a catch clause.
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AAwBnC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,iBAAiB;QACjB,oEAAoE;QACpE,gDAAgD;QAChD,+IAA+I;QAC/I,4FAA4F;QAC5F,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,OAA8B,CAAC,CAAC;IACnE,CAAC;;AA5CD;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAqCtD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport type { RestErrorOptions as TspRestErrorOptions } from \"@typespec/ts-http-runtime\";\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n\n // what is this??\n // it turns out that you can return from a constructor and it causes\n // calling `new` to return the value you return.\n // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,\n // even though the constructor signatures (through RestErrorOptions) are slightly different.\n return new TspRestError(message, options as TspRestErrorOptions);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
1
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,WAAW,IAAI,cAAc,GAC9B,MAAM,2BAA2B,CAAC;AA+EnC;;GAEG;AACH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAyB,YAAoC,CAAC;AAEpF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\n\nimport {\n RestError as TspRestError,\n isRestError as tspIsRestError,\n} from \"@typespec/ts-http-runtime\";\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestErrorConstructor {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n readonly REQUEST_SEND_ERROR: string;\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n readonly PARSE_ERROR: string;\n\n /**\n * Prototype of RestError\n */\n readonly prototype: RestError;\n\n /**\n * Construct a new RestError.\n */\n new (message: string, options?: RestErrorOptions): RestError;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport interface RestError extends Error {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n details?: unknown;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const RestError: RestErrorConstructor = TspRestError as RestErrorConstructor;\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n return tspIsRestError(e);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/core-rest-pipeline",
3
- "version": "1.20.1-alpha.20250603.2",
3
+ "version": "1.20.1-alpha.20250605.3",
4
4
  "description": "Isomorphic client library for making HTTP requests in node.js and browser.",
5
5
  "sdk-type": "client",
6
6
  "type": "module",