@automate.ax/integration-contracts 0.94.1 → 0.95.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/close/api.d.ts +3 -1
- package/dist/close/api.js +5 -2
- package/dist/jobnimbus/api.d.ts +3 -1
- package/dist/jobnimbus/api.js +6 -5
- package/package.json +2 -2
- package/src/close/api.ts +5 -1
- package/src/jobnimbus/api.ts +10 -4
package/dist/close/api.d.ts
CHANGED
|
@@ -13,14 +13,16 @@ interface CloseRequestOptions<TSchema extends z.ZodType> {
|
|
|
13
13
|
/** Error returned by a rejected Close API request. */
|
|
14
14
|
export declare class CloseApiError extends Error {
|
|
15
15
|
readonly details: Encodable;
|
|
16
|
+
readonly retryAfter?: string;
|
|
16
17
|
readonly status: number;
|
|
17
18
|
/**
|
|
18
19
|
* Creates an error from a rejected Close response.
|
|
19
20
|
*
|
|
20
21
|
* @param status - HTTP response status.
|
|
21
22
|
* @param details - Codec-safe response details.
|
|
23
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
22
24
|
*/
|
|
23
|
-
constructor(status: number, details: Encodable);
|
|
25
|
+
constructor(status: number, details: Encodable, retryAfter?: string);
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Creates a minimal authenticated Close REST client.
|
package/dist/close/api.js
CHANGED
|
@@ -17,17 +17,20 @@ export const CLOSE_RESPONSE_SCHEMA = z.union([
|
|
|
17
17
|
/** Error returned by a rejected Close API request. */
|
|
18
18
|
export class CloseApiError extends Error {
|
|
19
19
|
details;
|
|
20
|
+
retryAfter;
|
|
20
21
|
status;
|
|
21
22
|
/**
|
|
22
23
|
* Creates an error from a rejected Close response.
|
|
23
24
|
*
|
|
24
25
|
* @param status - HTTP response status.
|
|
25
26
|
* @param details - Codec-safe response details.
|
|
27
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
26
28
|
*/
|
|
27
|
-
constructor(status, details) {
|
|
29
|
+
constructor(status, details, retryAfter) {
|
|
28
30
|
super(`Close API request failed (${status}).`);
|
|
29
31
|
this.name = "CloseApiError";
|
|
30
32
|
this.details = details;
|
|
33
|
+
this.retryAfter = retryAfter;
|
|
31
34
|
this.status = status;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -85,7 +88,7 @@ export function getCloseApi(secret) {
|
|
|
85
88
|
const parsed = text ? parseJson(text) : null;
|
|
86
89
|
const result = CLOSE_RESPONSE_SCHEMA.safeParse(options.responseKeyFormat === "provider" ? parsed : fromClose(parsed));
|
|
87
90
|
if (!response.ok || !result.success) {
|
|
88
|
-
throw new CloseApiError(response.status, result.success ? result.data : { response: text });
|
|
91
|
+
throw new CloseApiError(response.status, result.success ? result.data : { response: text }, response.headers.get("Retry-After") ?? undefined);
|
|
89
92
|
}
|
|
90
93
|
return options.responseSchema.parse(result.data);
|
|
91
94
|
},
|
package/dist/jobnimbus/api.d.ts
CHANGED
|
@@ -21,14 +21,16 @@ interface JobNimbusRequestOptions<TSchema extends z.ZodType> {
|
|
|
21
21
|
/** Error returned by a rejected JobNimbus API request. */
|
|
22
22
|
export declare class JobNimbusApiError extends Error {
|
|
23
23
|
readonly details: Encodable;
|
|
24
|
+
readonly retryAfter?: string;
|
|
24
25
|
readonly status: number;
|
|
25
26
|
/**
|
|
26
27
|
* Creates an error from a rejected JobNimbus response.
|
|
27
28
|
*
|
|
28
29
|
* @param status - HTTP response status.
|
|
29
30
|
* @param details - Codec-safe response details.
|
|
31
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
30
32
|
*/
|
|
31
|
-
constructor(status: number, details: Encodable);
|
|
33
|
+
constructor(status: number, details: Encodable, retryAfter?: string);
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* Creates an authenticated client for one documented JobNimbus API root.
|
package/dist/jobnimbus/api.js
CHANGED
|
@@ -20,17 +20,20 @@ export const JOB_NIMBUS_RESPONSE_SCHEMA = z.union([
|
|
|
20
20
|
/** Error returned by a rejected JobNimbus API request. */
|
|
21
21
|
export class JobNimbusApiError extends Error {
|
|
22
22
|
details;
|
|
23
|
+
retryAfter;
|
|
23
24
|
status;
|
|
24
25
|
/**
|
|
25
26
|
* Creates an error from a rejected JobNimbus response.
|
|
26
27
|
*
|
|
27
28
|
* @param status - HTTP response status.
|
|
28
29
|
* @param details - Codec-safe response details.
|
|
30
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
29
31
|
*/
|
|
30
|
-
constructor(status, details) {
|
|
32
|
+
constructor(status, details, retryAfter) {
|
|
31
33
|
super(`JobNimbus API request failed (${status}).`);
|
|
32
34
|
this.name = "JobNimbusApiError";
|
|
33
35
|
this.details = details;
|
|
36
|
+
this.retryAfter = retryAfter;
|
|
34
37
|
this.status = status;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -96,7 +99,7 @@ export function getJobNimbusApi(secret, api) {
|
|
|
96
99
|
const text = await response.text();
|
|
97
100
|
const parsed = JOB_NIMBUS_RESPONSE_SCHEMA.safeParse(fromJobNimbus(text ? parseJson(text) : null));
|
|
98
101
|
if (!response.ok || !parsed.success) {
|
|
99
|
-
throw new JobNimbusApiError(response.status, parsed.success ? parsed.data : { response: text });
|
|
102
|
+
throw new JobNimbusApiError(response.status, parsed.success ? parsed.data : { response: text }, response.headers.get("Retry-After") ?? undefined);
|
|
100
103
|
}
|
|
101
104
|
return options.responseSchema.parse(parsed.data);
|
|
102
105
|
},
|
|
@@ -112,9 +115,7 @@ export async function downloadJobNimbusFile(secret, fileId) {
|
|
|
112
115
|
const { apiKey } = JOB_NIMBUS_SECRET_SCHEMA.parse(secret);
|
|
113
116
|
const response = await fetch(new URL(encodeURIComponent(z.string().trim().min(1).parse(fileId)), "https://app.jobnimbus.com/files/"), { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
114
117
|
if (!response.ok) {
|
|
115
|
-
throw new JobNimbusApiError(response.status, {
|
|
116
|
-
response: await response.text(),
|
|
117
|
-
});
|
|
118
|
+
throw new JobNimbusApiError(response.status, { response: await response.text() }, response.headers.get("Retry-After") ?? undefined);
|
|
118
119
|
}
|
|
119
120
|
return response.blob();
|
|
120
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.1",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@automate.ax/codec": "0.
|
|
51
|
+
"@automate.ax/codec": "0.95.1",
|
|
52
52
|
"@cfworker/json-schema": "^4.1.1",
|
|
53
53
|
"@googleapis/calendar": "^15.0.0",
|
|
54
54
|
"@googleapis/forms": "^6.0.1",
|
package/src/close/api.ts
CHANGED
|
@@ -36,6 +36,7 @@ interface CloseRequestOptions<TSchema extends z.ZodType> {
|
|
|
36
36
|
/** Error returned by a rejected Close API request. */
|
|
37
37
|
export class CloseApiError extends Error {
|
|
38
38
|
readonly details: Encodable
|
|
39
|
+
readonly retryAfter?: string
|
|
39
40
|
readonly status: number
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -43,11 +44,13 @@ export class CloseApiError extends Error {
|
|
|
43
44
|
*
|
|
44
45
|
* @param status - HTTP response status.
|
|
45
46
|
* @param details - Codec-safe response details.
|
|
47
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
46
48
|
*/
|
|
47
|
-
constructor(status: number, details: Encodable) {
|
|
49
|
+
constructor(status: number, details: Encodable, retryAfter?: string) {
|
|
48
50
|
super(`Close API request failed (${status}).`)
|
|
49
51
|
this.name = "CloseApiError"
|
|
50
52
|
this.details = details
|
|
53
|
+
this.retryAfter = retryAfter
|
|
51
54
|
this.status = status
|
|
52
55
|
}
|
|
53
56
|
}
|
|
@@ -128,6 +131,7 @@ export function getCloseApi(secret: unknown) {
|
|
|
128
131
|
throw new CloseApiError(
|
|
129
132
|
response.status,
|
|
130
133
|
result.success ? result.data : { response: text },
|
|
134
|
+
response.headers.get("Retry-After") ?? undefined,
|
|
131
135
|
)
|
|
132
136
|
}
|
|
133
137
|
return options.responseSchema.parse(result.data)
|
package/src/jobnimbus/api.ts
CHANGED
|
@@ -44,6 +44,7 @@ interface JobNimbusRequestOptions<TSchema extends z.ZodType> {
|
|
|
44
44
|
/** Error returned by a rejected JobNimbus API request. */
|
|
45
45
|
export class JobNimbusApiError extends Error {
|
|
46
46
|
readonly details: Encodable
|
|
47
|
+
readonly retryAfter?: string
|
|
47
48
|
readonly status: number
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -51,11 +52,13 @@ export class JobNimbusApiError extends Error {
|
|
|
51
52
|
*
|
|
52
53
|
* @param status - HTTP response status.
|
|
53
54
|
* @param details - Codec-safe response details.
|
|
55
|
+
* @param retryAfter - Raw provider retry timing, when present.
|
|
54
56
|
*/
|
|
55
|
-
constructor(status: number, details: Encodable) {
|
|
57
|
+
constructor(status: number, details: Encodable, retryAfter?: string) {
|
|
56
58
|
super(`JobNimbus API request failed (${status}).`)
|
|
57
59
|
this.name = "JobNimbusApiError"
|
|
58
60
|
this.details = details
|
|
61
|
+
this.retryAfter = retryAfter
|
|
59
62
|
this.status = status
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -139,6 +142,7 @@ export function getJobNimbusApi(secret: unknown, api: JobNimbusApi) {
|
|
|
139
142
|
throw new JobNimbusApiError(
|
|
140
143
|
response.status,
|
|
141
144
|
parsed.success ? parsed.data : { response: text },
|
|
145
|
+
response.headers.get("Retry-After") ?? undefined,
|
|
142
146
|
)
|
|
143
147
|
}
|
|
144
148
|
return options.responseSchema.parse(parsed.data)
|
|
@@ -162,9 +166,11 @@ export async function downloadJobNimbusFile(secret: unknown, fileId: string) {
|
|
|
162
166
|
{ headers: { Authorization: `Bearer ${apiKey}` } },
|
|
163
167
|
)
|
|
164
168
|
if (!response.ok) {
|
|
165
|
-
throw new JobNimbusApiError(
|
|
166
|
-
response
|
|
167
|
-
|
|
169
|
+
throw new JobNimbusApiError(
|
|
170
|
+
response.status,
|
|
171
|
+
{ response: await response.text() },
|
|
172
|
+
response.headers.get("Retry-After") ?? undefined,
|
|
173
|
+
)
|
|
168
174
|
}
|
|
169
175
|
return response.blob()
|
|
170
176
|
}
|