newscatcher-catchall-sdk 0.1.0 → 0.2.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/cjs/BaseClient.d.ts +12 -4
- package/dist/cjs/BaseClient.js +14 -2
- package/dist/cjs/Client.d.ts +3 -3
- package/dist/cjs/Client.js +1 -1
- package/dist/cjs/api/errors/ForbiddenError.js +5 -1
- package/dist/cjs/api/errors/NotFoundError.js +5 -1
- package/dist/cjs/api/errors/UnprocessableEntityError.js +5 -1
- package/dist/cjs/api/resources/jobs/client/Client.d.ts +5 -7
- package/dist/cjs/api/resources/jobs/client/Client.js +16 -74
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +2 -3
- package/dist/cjs/api/resources/meta/client/Client.d.ts +3 -4
- package/dist/cjs/api/resources/meta/client/Client.js +5 -38
- package/dist/cjs/api/resources/monitors/client/Client.d.ts +11 -6
- package/dist/cjs/api/resources/monitors/client/Client.js +28 -105
- package/dist/cjs/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.ts +2 -5
- package/dist/cjs/api/types/ListUserJobsResponseDto.d.ts +4 -0
- package/dist/cjs/api/types/MonitorCitation.d.ts +2 -0
- package/dist/cjs/api/types/MonitorListItemDto.d.ts +5 -0
- package/dist/cjs/api/types/PullJobResponseDto.d.ts +5 -0
- package/dist/cjs/api/types/Schema.d.ts +1 -1
- package/dist/cjs/api/types/WebhookPayload.d.ts +2 -4
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +27 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +9 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
- package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
- package/dist/cjs/core/fetcher/Fetcher.js +2 -1
- package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
- package/dist/cjs/core/fetcher/signals.d.ts +1 -1
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +2 -0
- package/dist/cjs/core/runtime/runtime.js +11 -10
- package/dist/cjs/errors/CatchAllApiError.js +5 -1
- package/dist/cjs/errors/CatchAllApiTimeoutError.js +5 -1
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +12 -4
- package/dist/esm/BaseClient.mjs +13 -2
- package/dist/esm/Client.d.mts +3 -3
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
- package/dist/esm/api/errors/NotFoundError.mjs +5 -1
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +5 -1
- package/dist/esm/api/resources/jobs/client/Client.d.mts +5 -7
- package/dist/esm/api/resources/jobs/client/Client.mjs +18 -76
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +2 -3
- package/dist/esm/api/resources/meta/client/Client.d.mts +3 -4
- package/dist/esm/api/resources/meta/client/Client.mjs +6 -39
- package/dist/esm/api/resources/monitors/client/Client.d.mts +11 -6
- package/dist/esm/api/resources/monitors/client/Client.mjs +30 -107
- package/dist/esm/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.mts +2 -5
- package/dist/esm/api/types/ListUserJobsResponseDto.d.mts +4 -0
- package/dist/esm/api/types/MonitorCitation.d.mts +2 -0
- package/dist/esm/api/types/MonitorListItemDto.d.mts +5 -0
- package/dist/esm/api/types/PullJobResponseDto.d.mts +5 -0
- package/dist/esm/api/types/Schema.d.mts +1 -1
- package/dist/esm/api/types/WebhookPayload.d.mts +2 -4
- package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +24 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +3 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
- package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +2 -1
- package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
- package/dist/esm/core/fetcher/signals.d.mts +1 -1
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/runtime/runtime.mjs +11 -10
- package/dist/esm/errors/CatchAllApiError.mjs +5 -1
- package/dist/esm/errors/CatchAllApiTimeoutError.mjs +5 -1
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +5 -2
- package/reference.md +10 -5
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
|
@@ -9,9 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptions } from "../../../../BaseClient.mjs";
|
|
12
|
-
import { mergeHeaders
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
15
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
17
|
/**
|
|
17
18
|
* Operations to check API health and version.
|
|
@@ -34,7 +35,7 @@ export class MetaClient {
|
|
|
34
35
|
__healthCheck(requestOptions) {
|
|
35
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
37
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
37
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
38
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
38
39
|
const _response = yield core.fetcher({
|
|
39
40
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "health"),
|
|
40
41
|
method: "GET",
|
|
@@ -56,21 +57,7 @@ export class MetaClient {
|
|
|
56
57
|
rawResponse: _response.rawResponse,
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
case "non-json":
|
|
61
|
-
throw new errors.CatchAllApiError({
|
|
62
|
-
statusCode: _response.error.statusCode,
|
|
63
|
-
body: _response.error.rawBody,
|
|
64
|
-
rawResponse: _response.rawResponse,
|
|
65
|
-
});
|
|
66
|
-
case "timeout":
|
|
67
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /health.");
|
|
68
|
-
case "unknown":
|
|
69
|
-
throw new errors.CatchAllApiError({
|
|
70
|
-
message: _response.error.errorMessage,
|
|
71
|
-
rawResponse: _response.rawResponse,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
60
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/health");
|
|
74
61
|
});
|
|
75
62
|
}
|
|
76
63
|
/**
|
|
@@ -87,7 +74,7 @@ export class MetaClient {
|
|
|
87
74
|
__getVersion(requestOptions) {
|
|
88
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
76
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
90
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
77
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
91
78
|
const _response = yield core.fetcher({
|
|
92
79
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "version"),
|
|
93
80
|
method: "GET",
|
|
@@ -109,27 +96,7 @@ export class MetaClient {
|
|
|
109
96
|
rawResponse: _response.rawResponse,
|
|
110
97
|
});
|
|
111
98
|
}
|
|
112
|
-
|
|
113
|
-
case "non-json":
|
|
114
|
-
throw new errors.CatchAllApiError({
|
|
115
|
-
statusCode: _response.error.statusCode,
|
|
116
|
-
body: _response.error.rawBody,
|
|
117
|
-
rawResponse: _response.rawResponse,
|
|
118
|
-
});
|
|
119
|
-
case "timeout":
|
|
120
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /version.");
|
|
121
|
-
case "unknown":
|
|
122
|
-
throw new errors.CatchAllApiError({
|
|
123
|
-
message: _response.error.errorMessage,
|
|
124
|
-
rawResponse: _response.rawResponse,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
_getCustomAuthorizationHeaders() {
|
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
132
|
-
return { "x-api-key": apiKeyValue };
|
|
99
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/version");
|
|
133
100
|
});
|
|
134
101
|
}
|
|
135
102
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
2
3
|
import * as core from "../../../../core/index.mjs";
|
|
3
4
|
import * as CatchAllApi from "../../../index.mjs";
|
|
4
5
|
export declare namespace MonitorsClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -11,13 +11,19 @@ export declare namespace MonitorsClient {
|
|
|
11
11
|
* Operations to create, operate and retrieve monitor results.
|
|
12
12
|
*/
|
|
13
13
|
export declare class MonitorsClient {
|
|
14
|
-
protected readonly _options: MonitorsClient.Options
|
|
14
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<MonitorsClient.Options>;
|
|
15
15
|
constructor(options?: MonitorsClient.Options);
|
|
16
16
|
/**
|
|
17
17
|
* Create a monitor that runs jobs based on a reference job with a specified schedule.
|
|
18
18
|
*
|
|
19
|
-
* **
|
|
20
|
-
*
|
|
19
|
+
* **Schedule requirements:**
|
|
20
|
+
* - Minimum 24-hour interval between executions
|
|
21
|
+
* - Natural language format (e.g., "every day at 12 PM UTC", "every 48 hours")
|
|
22
|
+
*
|
|
23
|
+
* **Validation:**
|
|
24
|
+
* - Schedules below minimum frequency return error with descriptive message.
|
|
25
|
+
* - Invalid job IDs return 400 Bad Request.
|
|
26
|
+
* - Duplicate monitors (same job already monitored) return error.
|
|
21
27
|
*
|
|
22
28
|
* @param {CatchAllApi.CreateMonitorRequestDto} request
|
|
23
29
|
* @param {MonitorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -115,5 +121,4 @@ export declare class MonitorsClient {
|
|
|
115
121
|
*/
|
|
116
122
|
listMonitors(requestOptions?: MonitorsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.ListMonitorsResponseDto>;
|
|
117
123
|
private __listMonitors;
|
|
118
|
-
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
119
124
|
}
|
|
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import {
|
|
12
|
-
import { mergeHeaders
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
15
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
16
17
|
import * as CatchAllApi from "../../../index.mjs";
|
|
17
18
|
/**
|
|
@@ -19,13 +20,19 @@ import * as CatchAllApi from "../../../index.mjs";
|
|
|
19
20
|
*/
|
|
20
21
|
export class MonitorsClient {
|
|
21
22
|
constructor(options = {}) {
|
|
22
|
-
this._options =
|
|
23
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Create a monitor that runs jobs based on a reference job with a specified schedule.
|
|
26
27
|
*
|
|
27
|
-
* **
|
|
28
|
-
*
|
|
28
|
+
* **Schedule requirements:**
|
|
29
|
+
* - Minimum 24-hour interval between executions
|
|
30
|
+
* - Natural language format (e.g., "every day at 12 PM UTC", "every 48 hours")
|
|
31
|
+
*
|
|
32
|
+
* **Validation:**
|
|
33
|
+
* - Schedules below minimum frequency return error with descriptive message.
|
|
34
|
+
* - Invalid job IDs return 400 Bad Request.
|
|
35
|
+
* - Duplicate monitors (same job already monitored) return error.
|
|
29
36
|
*
|
|
30
37
|
* @param {CatchAllApi.CreateMonitorRequestDto} request
|
|
31
38
|
* @param {MonitorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -44,7 +51,8 @@ export class MonitorsClient {
|
|
|
44
51
|
__createMonitor(request, requestOptions) {
|
|
45
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
53
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
47
|
-
const
|
|
54
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
55
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
48
56
|
const _response = yield core.fetcher({
|
|
49
57
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "catchAll/monitors/create"),
|
|
50
58
|
method: "POST",
|
|
@@ -74,21 +82,7 @@ export class MonitorsClient {
|
|
|
74
82
|
});
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
|
-
|
|
78
|
-
case "non-json":
|
|
79
|
-
throw new errors.CatchAllApiError({
|
|
80
|
-
statusCode: _response.error.statusCode,
|
|
81
|
-
body: _response.error.rawBody,
|
|
82
|
-
rawResponse: _response.rawResponse,
|
|
83
|
-
});
|
|
84
|
-
case "timeout":
|
|
85
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/create.");
|
|
86
|
-
case "unknown":
|
|
87
|
-
throw new errors.CatchAllApiError({
|
|
88
|
-
message: _response.error.errorMessage,
|
|
89
|
-
rawResponse: _response.rawResponse,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
85
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/create");
|
|
92
86
|
});
|
|
93
87
|
}
|
|
94
88
|
/**
|
|
@@ -117,7 +111,8 @@ export class MonitorsClient {
|
|
|
117
111
|
if (sort != null) {
|
|
118
112
|
_queryParams.sort = sort;
|
|
119
113
|
}
|
|
120
|
-
const
|
|
114
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
115
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
121
116
|
const _response = yield core.fetcher({
|
|
122
117
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/jobs`),
|
|
123
118
|
method: "GET",
|
|
@@ -146,21 +141,7 @@ export class MonitorsClient {
|
|
|
146
141
|
});
|
|
147
142
|
}
|
|
148
143
|
}
|
|
149
|
-
|
|
150
|
-
case "non-json":
|
|
151
|
-
throw new errors.CatchAllApiError({
|
|
152
|
-
statusCode: _response.error.statusCode,
|
|
153
|
-
body: _response.error.rawBody,
|
|
154
|
-
rawResponse: _response.rawResponse,
|
|
155
|
-
});
|
|
156
|
-
case "timeout":
|
|
157
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors/{monitor_id}/jobs.");
|
|
158
|
-
case "unknown":
|
|
159
|
-
throw new errors.CatchAllApiError({
|
|
160
|
-
message: _response.error.errorMessage,
|
|
161
|
-
rawResponse: _response.rawResponse,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
144
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/catchAll/monitors/{monitor_id}/jobs");
|
|
164
145
|
});
|
|
165
146
|
}
|
|
166
147
|
/**
|
|
@@ -185,7 +166,8 @@ export class MonitorsClient {
|
|
|
185
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
186
167
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
187
168
|
const { monitor_id: monitorId } = request;
|
|
188
|
-
const
|
|
169
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
170
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
189
171
|
const _response = yield core.fetcher({
|
|
190
172
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/pull/${core.url.encodePathParam(monitorId)}`),
|
|
191
173
|
method: "GET",
|
|
@@ -214,21 +196,7 @@ export class MonitorsClient {
|
|
|
214
196
|
});
|
|
215
197
|
}
|
|
216
198
|
}
|
|
217
|
-
|
|
218
|
-
case "non-json":
|
|
219
|
-
throw new errors.CatchAllApiError({
|
|
220
|
-
statusCode: _response.error.statusCode,
|
|
221
|
-
body: _response.error.rawBody,
|
|
222
|
-
rawResponse: _response.rawResponse,
|
|
223
|
-
});
|
|
224
|
-
case "timeout":
|
|
225
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors/pull/{monitor_id}.");
|
|
226
|
-
case "unknown":
|
|
227
|
-
throw new errors.CatchAllApiError({
|
|
228
|
-
message: _response.error.errorMessage,
|
|
229
|
-
rawResponse: _response.rawResponse,
|
|
230
|
-
});
|
|
231
|
-
}
|
|
199
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/catchAll/monitors/pull/{monitor_id}");
|
|
232
200
|
});
|
|
233
201
|
}
|
|
234
202
|
/**
|
|
@@ -254,7 +222,8 @@ export class MonitorsClient {
|
|
|
254
222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
255
223
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
256
224
|
const { monitor_id: monitorId } = request;
|
|
257
|
-
const
|
|
225
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
226
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
258
227
|
const _response = yield core.fetcher({
|
|
259
228
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/disable`),
|
|
260
229
|
method: "POST",
|
|
@@ -285,21 +254,7 @@ export class MonitorsClient {
|
|
|
285
254
|
});
|
|
286
255
|
}
|
|
287
256
|
}
|
|
288
|
-
|
|
289
|
-
case "non-json":
|
|
290
|
-
throw new errors.CatchAllApiError({
|
|
291
|
-
statusCode: _response.error.statusCode,
|
|
292
|
-
body: _response.error.rawBody,
|
|
293
|
-
rawResponse: _response.rawResponse,
|
|
294
|
-
});
|
|
295
|
-
case "timeout":
|
|
296
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/{monitor_id}/disable.");
|
|
297
|
-
case "unknown":
|
|
298
|
-
throw new errors.CatchAllApiError({
|
|
299
|
-
message: _response.error.errorMessage,
|
|
300
|
-
rawResponse: _response.rawResponse,
|
|
301
|
-
});
|
|
302
|
-
}
|
|
257
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/{monitor_id}/disable");
|
|
303
258
|
});
|
|
304
259
|
}
|
|
305
260
|
/**
|
|
@@ -325,7 +280,8 @@ export class MonitorsClient {
|
|
|
325
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
281
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
327
282
|
const { monitor_id: monitorId } = request;
|
|
328
|
-
const
|
|
283
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
284
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
329
285
|
const _response = yield core.fetcher({
|
|
330
286
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/enable`),
|
|
331
287
|
method: "POST",
|
|
@@ -356,21 +312,7 @@ export class MonitorsClient {
|
|
|
356
312
|
});
|
|
357
313
|
}
|
|
358
314
|
}
|
|
359
|
-
|
|
360
|
-
case "non-json":
|
|
361
|
-
throw new errors.CatchAllApiError({
|
|
362
|
-
statusCode: _response.error.statusCode,
|
|
363
|
-
body: _response.error.rawBody,
|
|
364
|
-
rawResponse: _response.rawResponse,
|
|
365
|
-
});
|
|
366
|
-
case "timeout":
|
|
367
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/{monitor_id}/enable.");
|
|
368
|
-
case "unknown":
|
|
369
|
-
throw new errors.CatchAllApiError({
|
|
370
|
-
message: _response.error.errorMessage,
|
|
371
|
-
rawResponse: _response.rawResponse,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
315
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/{monitor_id}/enable");
|
|
374
316
|
});
|
|
375
317
|
}
|
|
376
318
|
/**
|
|
@@ -390,7 +332,8 @@ export class MonitorsClient {
|
|
|
390
332
|
__listMonitors(requestOptions) {
|
|
391
333
|
return __awaiter(this, void 0, void 0, function* () {
|
|
392
334
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
393
|
-
const
|
|
335
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
336
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
394
337
|
const _response = yield core.fetcher({
|
|
395
338
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "catchAll/monitors"),
|
|
396
339
|
method: "GET",
|
|
@@ -419,27 +362,7 @@ export class MonitorsClient {
|
|
|
419
362
|
});
|
|
420
363
|
}
|
|
421
364
|
}
|
|
422
|
-
|
|
423
|
-
case "non-json":
|
|
424
|
-
throw new errors.CatchAllApiError({
|
|
425
|
-
statusCode: _response.error.statusCode,
|
|
426
|
-
body: _response.error.rawBody,
|
|
427
|
-
rawResponse: _response.rawResponse,
|
|
428
|
-
});
|
|
429
|
-
case "timeout":
|
|
430
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors.");
|
|
431
|
-
case "unknown":
|
|
432
|
-
throw new errors.CatchAllApiError({
|
|
433
|
-
message: _response.error.errorMessage,
|
|
434
|
-
rawResponse: _response.rawResponse,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
_getCustomAuthorizationHeaders() {
|
|
440
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
441
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
442
|
-
return { "x-api-key": apiKeyValue };
|
|
365
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/catchAll/monitors");
|
|
443
366
|
});
|
|
444
367
|
}
|
|
445
368
|
}
|
|
@@ -10,12 +10,9 @@ export interface CreateMonitorRequestDto {
|
|
|
10
10
|
/** Job ID to use as template for scheduled runs. */
|
|
11
11
|
reference_job_id: string;
|
|
12
12
|
/**
|
|
13
|
-
* Natural language schedule
|
|
14
|
-
* - "every day at 12 PM UTC"
|
|
15
|
-
* - "every Monday at 9 AM EST"
|
|
16
|
-
* - "every 6 hours"
|
|
13
|
+
* Natural language schedule (e.g. 'every day at 12 AM EST').
|
|
17
14
|
*
|
|
18
|
-
* **
|
|
15
|
+
* **Minimum frequency:** Monitors must be scheduled at least 24 hours apart.
|
|
19
16
|
*/
|
|
20
17
|
schedule: string;
|
|
21
18
|
/** Optional webhook to receive notifications when jobs complete. */
|
|
@@ -3,4 +3,8 @@ export interface ListUserJobsResponseDto {
|
|
|
3
3
|
job_id: string;
|
|
4
4
|
/** The natural language query for this job. */
|
|
5
5
|
query: string;
|
|
6
|
+
/** Job creation timestamp in ISO 8601 format. */
|
|
7
|
+
created_at: string;
|
|
8
|
+
/** Current processing status of the job. */
|
|
9
|
+
status: string;
|
|
6
10
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as CatchAllApi from "../index.mjs";
|
|
1
2
|
export interface MonitorListItemDto {
|
|
2
3
|
/** Monitor identifier. */
|
|
3
4
|
monitor_id: string;
|
|
@@ -9,8 +10,12 @@ export interface MonitorListItemDto {
|
|
|
9
10
|
enabled: boolean;
|
|
10
11
|
/** Cron expression for monitor schedule. */
|
|
11
12
|
schedule?: string;
|
|
13
|
+
/** Natural language description of the monitor schedule. */
|
|
14
|
+
schedule_human_readable?: string;
|
|
12
15
|
/** Timezone for schedule execution. */
|
|
13
16
|
timezone?: string;
|
|
14
17
|
/** The date when the monitor was created. */
|
|
15
18
|
created_at?: string;
|
|
19
|
+
/** Webhook configuration for this monitor (if set). */
|
|
20
|
+
webhook?: CatchAllApi.WebhookDto;
|
|
16
21
|
}
|
|
@@ -8,6 +8,11 @@ export interface PullJobResponseDto {
|
|
|
8
8
|
context?: string;
|
|
9
9
|
/** List of validation criteria applied to filter results. */
|
|
10
10
|
validators?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* List of extracted field names generated by the enrichment process.
|
|
13
|
+
* These field names appear in the `enrichment` object of each record.
|
|
14
|
+
*/
|
|
15
|
+
enrichments?: string[];
|
|
11
16
|
/** Job status. */
|
|
12
17
|
status: string;
|
|
13
18
|
/** Total time taken to process the job. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Template string to guide record summary formatting. Use placeholder syntax with brackets to indicate desired fields: [COMPANY], [REVENUE], [
|
|
2
|
+
* Template string to guide record summary formatting. Use placeholder syntax with brackets to indicate desired fields: [COMPANY], [REVENUE], [TARGET], [AMOUNT], etc.
|
|
3
3
|
*
|
|
4
4
|
* When provided, the system generates a `schema_based_summary` field for each record following this template.
|
|
5
5
|
*/
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type * as CatchAllApi from "../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Content-Type: application/json
|
|
3
|
+
* **First execution:** The initial webhook after monitor creation includes all records from the reference job, providing immediate access to collected data.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
* (string, internal identifier) not present in API GET responses.
|
|
5
|
+
* **Subsequent executions:** Only new records (after deduplication) are included.
|
|
8
6
|
*/
|
|
9
7
|
export interface WebhookPayload {
|
|
10
8
|
/** Monitor identifier. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as core from "../core/index.mjs";
|
|
2
|
+
export declare namespace HeaderAuthProvider {
|
|
3
|
+
interface AuthOptions {
|
|
4
|
+
apiKey?: core.Supplier<string>;
|
|
5
|
+
}
|
|
6
|
+
interface Options extends AuthOptions {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class HeaderAuthProvider implements core.AuthProvider {
|
|
10
|
+
private readonly headerValue;
|
|
11
|
+
constructor(options: HeaderAuthProvider.Options);
|
|
12
|
+
static canCreate(options: HeaderAuthProvider.Options): boolean;
|
|
13
|
+
getAuthRequest(_arg?: {
|
|
14
|
+
endpointMetadata?: core.EndpointMetadata;
|
|
15
|
+
}): Promise<core.AuthRequest>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import * as core from "../core/index.mjs";
|
|
12
|
+
import * as errors from "../errors/index.mjs";
|
|
13
|
+
export class HeaderAuthProvider {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.headerValue = options.apiKey;
|
|
16
|
+
}
|
|
17
|
+
static canCreate(options) {
|
|
18
|
+
return options.apiKey != null;
|
|
19
|
+
}
|
|
20
|
+
getAuthRequest(_arg) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const apiKey = yield core.Supplier.get(this.headerValue);
|
|
23
|
+
if (apiKey == null) {
|
|
24
|
+
throw new errors.CatchAllApiError({
|
|
25
|
+
message: "Please specify a apiKey by passing it in to the constructor",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const headerValue = apiKey;
|
|
29
|
+
return {
|
|
30
|
+
headers: { "x-api-key": headerValue },
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HeaderAuthProvider } from "./HeaderAuthProvider.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HeaderAuthProvider } from "./HeaderAuthProvider.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { base64Decode, base64Encode } from "../base64.mjs";
|
|
2
|
+
const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
|
|
3
|
+
export const BasicAuth = {
|
|
4
|
+
toAuthorizationHeader: (basicAuth) => {
|
|
5
|
+
if (basicAuth == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`);
|
|
9
|
+
return `Basic ${token}`;
|
|
10
|
+
},
|
|
11
|
+
fromAuthorizationHeader: (header) => {
|
|
12
|
+
const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
|
|
13
|
+
const decoded = base64Decode(credentials);
|
|
14
|
+
const [username, ...passwordParts] = decoded.split(":");
|
|
15
|
+
const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
|
|
16
|
+
if (username == null || password == null) {
|
|
17
|
+
throw new Error("Invalid basic auth");
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
username,
|
|
21
|
+
password,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type BearerToken = string;
|
|
2
|
+
declare function toAuthorizationHeader(token: string | undefined): string | undefined;
|
|
3
|
+
export declare const BearerToken: {
|
|
4
|
+
toAuthorizationHeader: typeof toAuthorizationHeader;
|
|
5
|
+
fromAuthorizationHeader: (header: string) => BearerToken;
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
|
|
2
|
+
function toAuthorizationHeader(token) {
|
|
3
|
+
if (token == null) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
return `Bearer ${token}`;
|
|
7
|
+
}
|
|
8
|
+
export const BearerToken = {
|
|
9
|
+
toAuthorizationHeader: toAuthorizationHeader,
|
|
10
|
+
fromAuthorizationHeader: (header) => {
|
|
11
|
+
return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
|
|
12
|
+
},
|
|
13
|
+
};
|