@seamapi/http 1.0.0-rc.3 → 1.0.0-rc.4
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/README.md +11 -10
- package/dist/connect.cjs +7 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +5 -0
- package/lib/seam/connect/api-error-types.d.ts +3 -0
- package/lib/seam/connect/seam-http-error.d.ts +2 -0
- package/lib/seam/connect/seam-http-error.js +18 -0
- package/lib/seam/connect/seam-http-error.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/seam/connect/api-error-types.ts +1 -0
- package/src/lib/seam/connect/seam-http-error.ts +6 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.d.cts
CHANGED
|
@@ -2054,6 +2054,9 @@ interface ApiError {
|
|
|
2054
2054
|
type: string;
|
|
2055
2055
|
message: string;
|
|
2056
2056
|
data?: unknown;
|
|
2057
|
+
validation_errors?: Record<string, {
|
|
2058
|
+
_errors: string[];
|
|
2059
|
+
}>;
|
|
2057
2060
|
}
|
|
2058
2061
|
|
|
2059
2062
|
declare class SeamHttpApiError extends Error {
|
|
@@ -2071,8 +2074,10 @@ declare class SeamHttpUnauthorizedError extends SeamHttpApiError {
|
|
|
2071
2074
|
}
|
|
2072
2075
|
declare const isSeamHttpUnauthorizedError: (error: unknown) => error is SeamHttpUnauthorizedError;
|
|
2073
2076
|
declare class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
2077
|
+
#private;
|
|
2074
2078
|
code: 'invalid_input';
|
|
2075
2079
|
constructor(error: ApiError, statusCode: number, requestId: string);
|
|
2080
|
+
getValidationErrorMessages(paramName: string): string[];
|
|
2076
2081
|
}
|
|
2077
2082
|
declare const isSeamHttpInvalidInputError: (error: unknown) => error is SeamHttpInvalidInputError;
|
|
2078
2083
|
|
|
@@ -14,7 +14,9 @@ export declare class SeamHttpUnauthorizedError extends SeamHttpApiError {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const isSeamHttpUnauthorizedError: (error: unknown) => error is SeamHttpUnauthorizedError;
|
|
16
16
|
export declare class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
17
|
+
#private;
|
|
17
18
|
code: 'invalid_input';
|
|
18
19
|
constructor(error: ApiError, statusCode: number, requestId: string);
|
|
20
|
+
getValidationErrorMessages(paramName: string): string[];
|
|
19
21
|
}
|
|
20
22
|
export declare const isSeamHttpInvalidInputError: (error: unknown) => error is SeamHttpInvalidInputError;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _SeamHttpInvalidInputError_validationErrors;
|
|
1
13
|
export class SeamHttpApiError extends Error {
|
|
2
14
|
constructor(error, statusCode, requestId) {
|
|
3
15
|
const { type, message, data } = error;
|
|
@@ -30,10 +42,16 @@ export const isSeamHttpUnauthorizedError = (error) => {
|
|
|
30
42
|
export class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
31
43
|
constructor(error, statusCode, requestId) {
|
|
32
44
|
super(error, statusCode, requestId);
|
|
45
|
+
_SeamHttpInvalidInputError_validationErrors.set(this, void 0);
|
|
33
46
|
this.name = this.constructor.name;
|
|
34
47
|
this.code = 'invalid_input';
|
|
48
|
+
__classPrivateFieldSet(this, _SeamHttpInvalidInputError_validationErrors, error.validation_errors ?? {}, "f");
|
|
49
|
+
}
|
|
50
|
+
getValidationErrorMessages(paramName) {
|
|
51
|
+
return __classPrivateFieldGet(this, _SeamHttpInvalidInputError_validationErrors, "f")[paramName]?._errors ?? [];
|
|
35
52
|
}
|
|
36
53
|
}
|
|
54
|
+
_SeamHttpInvalidInputError_validationErrors = new WeakMap();
|
|
37
55
|
export const isSeamHttpInvalidInputError = (error) => {
|
|
38
56
|
return error instanceof SeamHttpInvalidInputError;
|
|
39
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seam-http-error.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/seam-http-error.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAMzC,YAAY,KAAe,EAAE,UAAkB,EAAE,SAAiB;QAChE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;QACrC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,IAAI,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAc,EACa,EAAE;IAC7B,OAAO,KAAK,YAAY,gBAAgB,CAAA;AAC1C,CAAC,CAAA;AAED,MAAM,OAAO,y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version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiJavascriptHttpVersion = "1.0.0-rc.
|
|
1
|
+
declare const seamapiJavascriptHttpVersion = "1.0.0-rc.4";
|
|
2
2
|
export default seamapiJavascriptHttpVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -46,11 +46,17 @@ export const isSeamHttpUnauthorizedError = (
|
|
|
46
46
|
|
|
47
47
|
export class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
48
48
|
override code: 'invalid_input'
|
|
49
|
+
readonly #validationErrors: NonNullable<ApiError['validation_errors']>
|
|
49
50
|
|
|
50
51
|
constructor(error: ApiError, statusCode: number, requestId: string) {
|
|
51
52
|
super(error, statusCode, requestId)
|
|
52
53
|
this.name = this.constructor.name
|
|
53
54
|
this.code = 'invalid_input'
|
|
55
|
+
this.#validationErrors = error.validation_errors ?? {}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getValidationErrorMessages(paramName: string): string[] {
|
|
59
|
+
return this.#validationErrors[paramName]?._errors ?? []
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
package/src/lib/version.ts
CHANGED