aspi 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -2
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,9 @@ __export(index_exports, {
|
|
|
28
28
|
getHttpErrorStatus: () => getHttpErrorStatus,
|
|
29
29
|
httpErrors: () => httpErrors,
|
|
30
30
|
isAspiError: () => isAspiError,
|
|
31
|
-
isCustomError: () => isCustomError
|
|
31
|
+
isCustomError: () => isCustomError,
|
|
32
|
+
isJSONParseError: () => isJSONParseError,
|
|
33
|
+
isParseError: () => isParseError
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(index_exports);
|
|
34
36
|
|
|
@@ -108,6 +110,12 @@ var isAspiError = (error) => {
|
|
|
108
110
|
var isCustomError = (error) => {
|
|
109
111
|
return error instanceof CustomError;
|
|
110
112
|
};
|
|
113
|
+
var isParseError = (error) => {
|
|
114
|
+
return error instanceof CustomError && error.tag === "parseError";
|
|
115
|
+
};
|
|
116
|
+
var isJSONParseError = (error) => {
|
|
117
|
+
return error instanceof CustomError && error.tag === "jsonParseError";
|
|
118
|
+
};
|
|
111
119
|
|
|
112
120
|
// src/result.ts
|
|
113
121
|
var result_exports = {};
|
|
@@ -1929,5 +1937,7 @@ var Aspi = class {
|
|
|
1929
1937
|
getHttpErrorStatus,
|
|
1930
1938
|
httpErrors,
|
|
1931
1939
|
isAspiError,
|
|
1932
|
-
isCustomError
|
|
1940
|
+
isCustomError,
|
|
1941
|
+
isJSONParseError,
|
|
1942
|
+
isParseError
|
|
1933
1943
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -363,8 +363,15 @@ interface JSONParseError extends CustomError<'jsonParseError', {
|
|
|
363
363
|
message: string;
|
|
364
364
|
}> {
|
|
365
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Type alias for a schema validation parse error.
|
|
368
|
+
* Emitted when either the request body schema or the response schema fails validation.
|
|
369
|
+
*/
|
|
370
|
+
type ParseError = CustomError<'parseError', unknown>;
|
|
366
371
|
declare const isAspiError: <TReq extends AspiRequestInit>(error: unknown) => error is AspiError<TReq>;
|
|
367
372
|
declare const isCustomError: <Tag extends string, A>(error: unknown) => error is CustomError<Tag, A>;
|
|
373
|
+
declare const isParseError: (error: unknown) => error is ParseError;
|
|
374
|
+
declare const isJSONParseError: (error: unknown) => error is JSONParseError;
|
|
368
375
|
|
|
369
376
|
/**
|
|
370
377
|
* Arguments passed to a capability factory.
|
|
@@ -1998,4 +2005,4 @@ declare class Aspi<TRequest extends AspiRequestInit = AspiRequestInit, Opts exte
|
|
|
1998
2005
|
useCapability(capability: Capability<TRequest>): this;
|
|
1999
2006
|
}
|
|
2000
2007
|
|
|
2001
|
-
export { Aspi, type AspiConfigBase, AspiError, type AspiPlainResponse, type AspiRequest, type AspiRequestInit, type AspiRequestInitWithoutBodyAndMethod, type AspiResponse, type AspiResultOk, type AspiRetryConfig, type BaseURL, type Capability, type CapabilityArgs, CustomError, type CustomErrorCb, type ErrorCallbacks, type HttpErrorCodes, type HttpErrorStatus, type HttpMethods, type JSONParseError, type Merge, type Prettify, Request, type RequestOptions, type RequestTransformer, result as Result, getHttpErrorStatus, httpErrors, isAspiError, isCustomError };
|
|
2008
|
+
export { Aspi, type AspiConfigBase, AspiError, type AspiPlainResponse, type AspiRequest, type AspiRequestInit, type AspiRequestInitWithoutBodyAndMethod, type AspiResponse, type AspiResultOk, type AspiRetryConfig, type BaseURL, type Capability, type CapabilityArgs, CustomError, type CustomErrorCb, type ErrorCallbacks, type HttpErrorCodes, type HttpErrorStatus, type HttpMethods, type JSONParseError, type Merge, type ParseError, type Prettify, Request, type RequestOptions, type RequestTransformer, result as Result, getHttpErrorStatus, httpErrors, isAspiError, isCustomError, isJSONParseError, isParseError };
|
package/dist/index.d.ts
CHANGED
|
@@ -363,8 +363,15 @@ interface JSONParseError extends CustomError<'jsonParseError', {
|
|
|
363
363
|
message: string;
|
|
364
364
|
}> {
|
|
365
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Type alias for a schema validation parse error.
|
|
368
|
+
* Emitted when either the request body schema or the response schema fails validation.
|
|
369
|
+
*/
|
|
370
|
+
type ParseError = CustomError<'parseError', unknown>;
|
|
366
371
|
declare const isAspiError: <TReq extends AspiRequestInit>(error: unknown) => error is AspiError<TReq>;
|
|
367
372
|
declare const isCustomError: <Tag extends string, A>(error: unknown) => error is CustomError<Tag, A>;
|
|
373
|
+
declare const isParseError: (error: unknown) => error is ParseError;
|
|
374
|
+
declare const isJSONParseError: (error: unknown) => error is JSONParseError;
|
|
368
375
|
|
|
369
376
|
/**
|
|
370
377
|
* Arguments passed to a capability factory.
|
|
@@ -1998,4 +2005,4 @@ declare class Aspi<TRequest extends AspiRequestInit = AspiRequestInit, Opts exte
|
|
|
1998
2005
|
useCapability(capability: Capability<TRequest>): this;
|
|
1999
2006
|
}
|
|
2000
2007
|
|
|
2001
|
-
export { Aspi, type AspiConfigBase, AspiError, type AspiPlainResponse, type AspiRequest, type AspiRequestInit, type AspiRequestInitWithoutBodyAndMethod, type AspiResponse, type AspiResultOk, type AspiRetryConfig, type BaseURL, type Capability, type CapabilityArgs, CustomError, type CustomErrorCb, type ErrorCallbacks, type HttpErrorCodes, type HttpErrorStatus, type HttpMethods, type JSONParseError, type Merge, type Prettify, Request, type RequestOptions, type RequestTransformer, result as Result, getHttpErrorStatus, httpErrors, isAspiError, isCustomError };
|
|
2008
|
+
export { Aspi, type AspiConfigBase, AspiError, type AspiPlainResponse, type AspiRequest, type AspiRequestInit, type AspiRequestInitWithoutBodyAndMethod, type AspiResponse, type AspiResultOk, type AspiRetryConfig, type BaseURL, type Capability, type CapabilityArgs, CustomError, type CustomErrorCb, type ErrorCallbacks, type HttpErrorCodes, type HttpErrorStatus, type HttpMethods, type JSONParseError, type Merge, type ParseError, type Prettify, Request, type RequestOptions, type RequestTransformer, result as Result, getHttpErrorStatus, httpErrors, isAspiError, isCustomError, isJSONParseError, isParseError };
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,12 @@ var isAspiError = (error) => {
|
|
|
80
80
|
var isCustomError = (error) => {
|
|
81
81
|
return error instanceof CustomError;
|
|
82
82
|
};
|
|
83
|
+
var isParseError = (error) => {
|
|
84
|
+
return error instanceof CustomError && error.tag === "parseError";
|
|
85
|
+
};
|
|
86
|
+
var isJSONParseError = (error) => {
|
|
87
|
+
return error instanceof CustomError && error.tag === "jsonParseError";
|
|
88
|
+
};
|
|
83
89
|
|
|
84
90
|
// src/result.ts
|
|
85
91
|
var result_exports = {};
|
|
@@ -1900,5 +1906,7 @@ export {
|
|
|
1900
1906
|
getHttpErrorStatus,
|
|
1901
1907
|
httpErrors,
|
|
1902
1908
|
isAspiError,
|
|
1903
|
-
isCustomError
|
|
1909
|
+
isCustomError,
|
|
1910
|
+
isJSONParseError,
|
|
1911
|
+
isParseError
|
|
1904
1912
|
};
|
package/package.json
CHANGED