newscatcher-catchall-sdk 1.0.0 → 1.3.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/README.md +41 -25
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +12 -0
- package/dist/cjs/Client.js +67 -0
- package/dist/cjs/api/resources/jobs/client/Client.d.ts +14 -17
- package/dist/cjs/api/resources/jobs/client/Client.js +13 -19
- package/dist/cjs/api/resources/jobs/client/requests/ContinueRequestDto.d.ts +3 -3
- package/dist/cjs/api/resources/jobs/client/requests/GetJobResultsRequest.d.ts +2 -2
- package/dist/cjs/api/resources/jobs/client/requests/GetJobStatusRequest.d.ts +2 -2
- package/dist/cjs/api/resources/jobs/client/requests/InitializeRequestDto.d.ts +2 -1
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +26 -6
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.js +14 -0
- package/dist/cjs/api/resources/jobs/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/jobs/client/requests/index.js +3 -0
- package/dist/cjs/api/resources/jobs/exports.d.ts +2 -0
- package/dist/cjs/api/resources/jobs/exports.js +21 -0
- package/dist/cjs/api/resources/meta/client/Client.d.ts +15 -3
- package/dist/cjs/api/resources/meta/client/Client.js +49 -1
- package/dist/cjs/api/resources/meta/exports.d.ts +2 -0
- package/dist/cjs/api/resources/meta/exports.js +21 -0
- package/dist/cjs/api/resources/meta/types/GetVersionResponse.d.ts +1 -1
- package/dist/cjs/api/resources/meta/types/HealthCheckResponse.d.ts +1 -1
- package/dist/cjs/api/resources/monitors/client/Client.d.ts +23 -37
- package/dist/cjs/api/resources/monitors/client/Client.js +35 -41
- package/dist/cjs/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.ts +23 -6
- package/dist/cjs/api/resources/monitors/client/requests/EnableMonitorRequestDto.d.ts +17 -0
- package/dist/cjs/api/resources/monitors/client/requests/ListMonitorsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/monitors/client/requests/UpdateMonitorRequestDto.d.ts +2 -0
- package/dist/cjs/api/resources/monitors/client/requests/index.d.ts +2 -1
- package/dist/cjs/api/resources/monitors/exports.d.ts +2 -0
- package/dist/cjs/api/resources/monitors/exports.js +21 -0
- package/dist/cjs/api/types/BaseRecord.d.ts +38 -0
- package/dist/cjs/api/types/BaseRecord.js +16 -0
- package/dist/cjs/api/types/Citation.d.ts +3 -3
- package/dist/cjs/api/types/CompanyEnrichmentOutput.d.ts +29 -0
- package/dist/cjs/api/types/CompanyEnrichmentOutput.js +16 -0
- package/dist/cjs/api/types/ContinueResponseDto.d.ts +2 -2
- package/dist/cjs/api/types/CreateMonitorResponseDto.d.ts +1 -1
- package/dist/cjs/api/types/EndDate.d.ts +4 -2
- package/dist/cjs/api/types/EnrichmentType.d.ts +1 -3
- package/dist/cjs/api/types/EnrichmentType.js +1 -3
- package/dist/cjs/api/types/Error_.d.ts +1 -1
- package/dist/cjs/api/types/GetPlanLimitsResponseDto.d.ts +5 -0
- package/dist/cjs/api/types/InitializeResponseDto.d.ts +8 -9
- package/dist/cjs/api/types/JobStep.d.ts +2 -2
- package/dist/cjs/api/types/Limit.d.ts +1 -1
- package/dist/cjs/api/types/ListMonitorsResponseDto.d.ts +7 -1
- package/dist/cjs/api/types/MonitorCitation.d.ts +3 -8
- package/dist/cjs/api/types/MonitorListItemDto.d.ts +10 -8
- package/dist/cjs/api/types/MonitorRecord.d.ts +4 -14
- package/dist/cjs/api/types/PlanFeature.d.ts +12 -0
- package/dist/cjs/api/types/PlanFeature.js +3 -0
- package/dist/{esm/api/types/JobStatus.d.mts → cjs/api/types/PublicJobStatus.d.ts} +4 -4
- package/dist/cjs/api/types/{JobStatus.js → PublicJobStatus.js} +4 -4
- package/dist/cjs/api/types/PullJobResponseDto.d.ts +34 -25
- package/dist/cjs/api/types/PullJobResponseDto.js +9 -0
- package/dist/cjs/api/types/PullMonitorResponseDto.d.ts +12 -12
- package/dist/cjs/api/types/Query.d.ts +1 -1
- package/dist/cjs/api/types/Record_.d.ts +2 -12
- package/dist/cjs/api/types/ReferenceJob.d.ts +3 -3
- package/dist/cjs/api/types/StartDate.d.ts +4 -2
- package/dist/cjs/api/types/StatusResponseDto.d.ts +2 -2
- package/dist/cjs/api/types/{SubmitResponseBody.d.ts → SubmitResponseDto.d.ts} +1 -1
- package/dist/cjs/api/types/SubmitResponseDto.js +3 -0
- package/dist/cjs/api/types/UserJob.d.ts +13 -1
- package/dist/cjs/api/types/UserJob.js +9 -0
- package/dist/cjs/api/types/ValidationErrorDetail.d.ts +3 -3
- package/dist/cjs/api/types/ValidationErrorResponse.d.ts +1 -1
- package/dist/cjs/api/types/ValidatorSchema.d.ts +3 -3
- package/dist/cjs/api/types/WebhookDto.d.ts +4 -4
- package/dist/cjs/api/types/WebhookPayload.d.ts +9 -9
- package/dist/cjs/api/types/index.d.ts +6 -3
- package/dist/cjs/api/types/index.js +6 -3
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/Fetcher.js +8 -2
- package/dist/cjs/core/fetcher/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/index.js +3 -1
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
- package/dist/cjs/core/fetcher/makeRequest.js +30 -9
- package/dist/cjs/core/runtime/runtime.js +8 -7
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +12 -0
- package/dist/esm/Client.mjs +34 -0
- package/dist/esm/api/resources/jobs/client/Client.d.mts +14 -17
- package/dist/esm/api/resources/jobs/client/Client.mjs +13 -19
- package/dist/esm/api/resources/jobs/client/requests/ContinueRequestDto.d.mts +3 -3
- package/dist/esm/api/resources/jobs/client/requests/GetJobResultsRequest.d.mts +2 -2
- package/dist/esm/api/resources/jobs/client/requests/GetJobStatusRequest.d.mts +2 -2
- package/dist/esm/api/resources/jobs/client/requests/InitializeRequestDto.d.mts +2 -1
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +26 -6
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.mjs +13 -1
- package/dist/esm/api/resources/jobs/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/jobs/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/jobs/exports.d.mts +2 -0
- package/dist/esm/api/resources/jobs/exports.mjs +3 -0
- package/dist/esm/api/resources/meta/client/Client.d.mts +15 -3
- package/dist/esm/api/resources/meta/client/Client.mjs +50 -2
- package/dist/esm/api/resources/meta/exports.d.mts +2 -0
- package/dist/esm/api/resources/meta/exports.mjs +3 -0
- package/dist/esm/api/resources/meta/types/GetVersionResponse.d.mts +1 -1
- package/dist/esm/api/resources/meta/types/HealthCheckResponse.d.mts +1 -1
- package/dist/esm/api/resources/monitors/client/Client.d.mts +23 -37
- package/dist/esm/api/resources/monitors/client/Client.mjs +35 -41
- package/dist/esm/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.mts +23 -6
- package/dist/esm/api/resources/monitors/client/requests/EnableMonitorRequestDto.d.mts +17 -0
- package/dist/esm/api/resources/monitors/client/requests/ListMonitorsRequest.d.mts +10 -0
- package/dist/esm/api/resources/monitors/client/requests/UpdateMonitorRequestDto.d.mts +2 -0
- package/dist/esm/api/resources/monitors/client/requests/index.d.mts +2 -1
- package/dist/esm/api/resources/monitors/exports.d.mts +2 -0
- package/dist/esm/api/resources/monitors/exports.mjs +3 -0
- package/dist/esm/api/types/BaseRecord.d.mts +38 -0
- package/dist/esm/api/types/BaseRecord.mjs +13 -0
- package/dist/esm/api/types/Citation.d.mts +3 -3
- package/dist/esm/api/types/CompanyEnrichmentOutput.d.mts +29 -0
- package/dist/esm/api/types/CompanyEnrichmentOutput.mjs +13 -0
- package/dist/esm/api/types/ContinueResponseDto.d.mts +2 -2
- package/dist/esm/api/types/CreateMonitorResponseDto.d.mts +1 -1
- package/dist/esm/api/types/EndDate.d.mts +4 -2
- package/dist/esm/api/types/EnrichmentType.d.mts +1 -3
- package/dist/esm/api/types/EnrichmentType.mjs +1 -3
- package/dist/esm/api/types/Error_.d.mts +1 -1
- package/dist/esm/api/types/GetPlanLimitsResponseDto.d.mts +5 -0
- package/dist/esm/api/types/InitializeResponseDto.d.mts +8 -9
- package/dist/esm/api/types/JobStep.d.mts +2 -2
- package/dist/esm/api/types/Limit.d.mts +1 -1
- package/dist/esm/api/types/ListMonitorsResponseDto.d.mts +7 -1
- package/dist/esm/api/types/MonitorCitation.d.mts +3 -8
- package/dist/esm/api/types/MonitorListItemDto.d.mts +10 -8
- package/dist/esm/api/types/MonitorRecord.d.mts +4 -14
- package/dist/esm/api/types/PlanFeature.d.mts +12 -0
- package/dist/esm/api/types/PlanFeature.mjs +2 -0
- package/dist/{cjs/api/types/JobStatus.d.ts → esm/api/types/PublicJobStatus.d.mts} +4 -4
- package/dist/esm/api/types/{JobStatus.mjs → PublicJobStatus.mjs} +3 -3
- package/dist/esm/api/types/PullJobResponseDto.d.mts +34 -25
- package/dist/esm/api/types/PullJobResponseDto.mjs +8 -1
- package/dist/esm/api/types/PullMonitorResponseDto.d.mts +12 -12
- package/dist/esm/api/types/Query.d.mts +1 -1
- package/dist/esm/api/types/Record_.d.mts +2 -12
- package/dist/esm/api/types/ReferenceJob.d.mts +3 -3
- package/dist/esm/api/types/StartDate.d.mts +4 -2
- package/dist/esm/api/types/StatusResponseDto.d.mts +2 -2
- package/dist/esm/api/types/{SubmitResponseBody.d.mts → SubmitResponseDto.d.mts} +1 -1
- package/dist/esm/api/types/SubmitResponseDto.mjs +2 -0
- package/dist/esm/api/types/UserJob.d.mts +13 -1
- package/dist/esm/api/types/UserJob.mjs +8 -1
- package/dist/esm/api/types/ValidationErrorDetail.d.mts +3 -3
- package/dist/esm/api/types/ValidationErrorResponse.d.mts +1 -1
- package/dist/esm/api/types/ValidatorSchema.d.mts +3 -3
- package/dist/esm/api/types/WebhookDto.d.mts +4 -4
- package/dist/esm/api/types/WebhookPayload.d.mts +9 -9
- package/dist/esm/api/types/index.d.mts +6 -3
- package/dist/esm/api/types/index.mjs +6 -3
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +8 -2
- package/dist/esm/core/fetcher/index.d.mts +2 -0
- package/dist/esm/core/fetcher/index.mjs +1 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
- package/dist/esm/core/runtime/runtime.mjs +8 -7
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +37 -4
- package/reference.md +99 -53
- package/dist/cjs/api/resources/monitors/client/requests/EnableMonitorRequest.d.ts +0 -10
- package/dist/cjs/api/types/Schema.d.ts +0 -6
- package/dist/esm/api/resources/monitors/client/requests/EnableMonitorRequest.d.mts +0 -10
- package/dist/esm/api/types/Schema.d.mts +0 -6
- /package/dist/cjs/api/resources/monitors/client/requests/{EnableMonitorRequest.js → EnableMonitorRequestDto.js} +0 -0
- /package/dist/cjs/api/{types/Schema.js → resources/monitors/client/requests/ListMonitorsRequest.js} +0 -0
- /package/dist/cjs/api/types/{SubmitResponseBody.js → GetPlanLimitsResponseDto.js} +0 -0
- /package/dist/esm/api/resources/monitors/client/requests/{EnableMonitorRequest.mjs → EnableMonitorRequestDto.mjs} +0 -0
- /package/dist/esm/api/{types/Schema.mjs → resources/monitors/client/requests/ListMonitorsRequest.mjs} +0 -0
- /package/dist/esm/api/types/{SubmitResponseBody.mjs → GetPlanLimitsResponseDto.mjs} +0 -0
|
@@ -6,21 +6,21 @@ import type * as CatchAllApi from "../index.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export interface WebhookPayload {
|
|
8
8
|
/** Monitor identifier. */
|
|
9
|
-
monitor_id?: string;
|
|
9
|
+
monitor_id?: string | undefined;
|
|
10
10
|
/** Reference job used as template for this monitor. */
|
|
11
|
-
reference_job_id?: string;
|
|
11
|
+
reference_job_id?: string | undefined;
|
|
12
12
|
/** Job ID of the most recent execution. */
|
|
13
|
-
latest_job_id?: string;
|
|
13
|
+
latest_job_id?: string | undefined;
|
|
14
14
|
/** Number of new records from latest job (after deduplication). */
|
|
15
|
-
records_count?: number;
|
|
15
|
+
records_count?: number | undefined;
|
|
16
16
|
/** Total number of jobs executed by this monitor. */
|
|
17
|
-
jobs_processed?: number;
|
|
17
|
+
jobs_processed?: number | undefined;
|
|
18
18
|
/** The date when the webhook was triggered in ISO 8601 format with UTC timezone. */
|
|
19
|
-
updated_at?: string;
|
|
19
|
+
updated_at?: string | undefined;
|
|
20
20
|
/** Cron expression defining the monitor schedule. */
|
|
21
|
-
cron_expression?: string;
|
|
21
|
+
cron_expression?: string | undefined;
|
|
22
22
|
/** Timezone for schedule execution. */
|
|
23
|
-
timezone?: string;
|
|
23
|
+
timezone?: string | undefined;
|
|
24
24
|
/** Array of new records from the latest job execution (includes monitor-specific fields like added_on, updated_on). */
|
|
25
|
-
records?: CatchAllApi.MonitorRecord[];
|
|
25
|
+
records?: CatchAllApi.MonitorRecord[] | undefined;
|
|
26
26
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./BaseRecord.js";
|
|
1
2
|
export * from "./Citation.js";
|
|
3
|
+
export * from "./CompanyEnrichmentOutput.js";
|
|
2
4
|
export * from "./Context.js";
|
|
3
5
|
export * from "./ContinueResponseDto.js";
|
|
4
6
|
export * from "./CreateMonitorResponseDto.js";
|
|
@@ -6,8 +8,8 @@ export * from "./EndDate.js";
|
|
|
6
8
|
export * from "./EnrichmentSchema.js";
|
|
7
9
|
export * from "./EnrichmentType.js";
|
|
8
10
|
export * from "./Error_.js";
|
|
11
|
+
export * from "./GetPlanLimitsResponseDto.js";
|
|
9
12
|
export * from "./InitializeResponseDto.js";
|
|
10
|
-
export * from "./JobStatus.js";
|
|
11
13
|
export * from "./JobStep.js";
|
|
12
14
|
export * from "./Limit.js";
|
|
13
15
|
export * from "./ListMonitorsResponseDto.js";
|
|
@@ -16,15 +18,16 @@ export * from "./MonitorCitation.js";
|
|
|
16
18
|
export * from "./MonitorJobItem.js";
|
|
17
19
|
export * from "./MonitorListItemDto.js";
|
|
18
20
|
export * from "./MonitorRecord.js";
|
|
21
|
+
export * from "./PlanFeature.js";
|
|
22
|
+
export * from "./PublicJobStatus.js";
|
|
19
23
|
export * from "./PullJobResponseDto.js";
|
|
20
24
|
export * from "./PullMonitorResponseDto.js";
|
|
21
25
|
export * from "./Query.js";
|
|
22
26
|
export * from "./Record_.js";
|
|
23
27
|
export * from "./ReferenceJob.js";
|
|
24
|
-
export * from "./Schema.js";
|
|
25
28
|
export * from "./StartDate.js";
|
|
26
29
|
export * from "./StatusResponseDto.js";
|
|
27
|
-
export * from "./
|
|
30
|
+
export * from "./SubmitResponseDto.js";
|
|
28
31
|
export * from "./UpdateMonitorResponseDto.js";
|
|
29
32
|
export * from "./UserJob.js";
|
|
30
33
|
export * from "./ValidationErrorDetail.js";
|
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BaseRecord.js"), exports);
|
|
17
18
|
__exportStar(require("./Citation.js"), exports);
|
|
19
|
+
__exportStar(require("./CompanyEnrichmentOutput.js"), exports);
|
|
18
20
|
__exportStar(require("./Context.js"), exports);
|
|
19
21
|
__exportStar(require("./ContinueResponseDto.js"), exports);
|
|
20
22
|
__exportStar(require("./CreateMonitorResponseDto.js"), exports);
|
|
@@ -22,8 +24,8 @@ __exportStar(require("./EndDate.js"), exports);
|
|
|
22
24
|
__exportStar(require("./EnrichmentSchema.js"), exports);
|
|
23
25
|
__exportStar(require("./EnrichmentType.js"), exports);
|
|
24
26
|
__exportStar(require("./Error_.js"), exports);
|
|
27
|
+
__exportStar(require("./GetPlanLimitsResponseDto.js"), exports);
|
|
25
28
|
__exportStar(require("./InitializeResponseDto.js"), exports);
|
|
26
|
-
__exportStar(require("./JobStatus.js"), exports);
|
|
27
29
|
__exportStar(require("./JobStep.js"), exports);
|
|
28
30
|
__exportStar(require("./Limit.js"), exports);
|
|
29
31
|
__exportStar(require("./ListMonitorsResponseDto.js"), exports);
|
|
@@ -32,15 +34,16 @@ __exportStar(require("./MonitorCitation.js"), exports);
|
|
|
32
34
|
__exportStar(require("./MonitorJobItem.js"), exports);
|
|
33
35
|
__exportStar(require("./MonitorListItemDto.js"), exports);
|
|
34
36
|
__exportStar(require("./MonitorRecord.js"), exports);
|
|
37
|
+
__exportStar(require("./PlanFeature.js"), exports);
|
|
38
|
+
__exportStar(require("./PublicJobStatus.js"), exports);
|
|
35
39
|
__exportStar(require("./PullJobResponseDto.js"), exports);
|
|
36
40
|
__exportStar(require("./PullMonitorResponseDto.js"), exports);
|
|
37
41
|
__exportStar(require("./Query.js"), exports);
|
|
38
42
|
__exportStar(require("./Record_.js"), exports);
|
|
39
43
|
__exportStar(require("./ReferenceJob.js"), exports);
|
|
40
|
-
__exportStar(require("./Schema.js"), exports);
|
|
41
44
|
__exportStar(require("./StartDate.js"), exports);
|
|
42
45
|
__exportStar(require("./StatusResponseDto.js"), exports);
|
|
43
|
-
__exportStar(require("./
|
|
46
|
+
__exportStar(require("./SubmitResponseDto.js"), exports);
|
|
44
47
|
__exportStar(require("./UpdateMonitorResponseDto.js"), exports);
|
|
45
48
|
__exportStar(require("./UserJob.js"), exports);
|
|
46
49
|
__exportStar(require("./ValidationErrorDetail.js"), exports);
|
|
@@ -14,6 +14,6 @@ export type BinaryResponse = {
|
|
|
14
14
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
15
15
|
* Some versions of the Fetch API may not support this method.
|
|
16
16
|
*/
|
|
17
|
-
bytes?():
|
|
17
|
+
bytes?(): Promise<Uint8Array>;
|
|
18
18
|
};
|
|
19
19
|
export declare function getBinaryResponse(response: Response): BinaryResponse;
|
|
@@ -156,7 +156,13 @@ function getHeaders(args) {
|
|
|
156
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
157
|
var _a;
|
|
158
158
|
const newHeaders = new Headers_js_1.Headers();
|
|
159
|
-
newHeaders.set("Accept", args.responseType === "json"
|
|
159
|
+
newHeaders.set("Accept", args.responseType === "json"
|
|
160
|
+
? "application/json"
|
|
161
|
+
: args.responseType === "text"
|
|
162
|
+
? "text/plain"
|
|
163
|
+
: args.responseType === "sse"
|
|
164
|
+
? "text/event-stream"
|
|
165
|
+
: "*/*");
|
|
160
166
|
if (args.body !== undefined && args.contentType != null) {
|
|
161
167
|
newHeaders.set("Content-Type", args.contentType);
|
|
162
168
|
}
|
|
@@ -200,7 +206,7 @@ function fetcherImpl(args) {
|
|
|
200
206
|
}
|
|
201
207
|
try {
|
|
202
208
|
const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
209
|
+
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex, args.responseType === "streaming" || args.responseType === "sse");
|
|
204
210
|
}), args.maxRetries);
|
|
205
211
|
if (response.status >= 200 && response.status < 400) {
|
|
206
212
|
if (logger.isDebug()) {
|
|
@@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js";
|
|
|
6
6
|
export { fetcher } from "./Fetcher.js";
|
|
7
7
|
export { getHeader } from "./getHeader.js";
|
|
8
8
|
export { HttpResponsePromise } from "./HttpResponsePromise.js";
|
|
9
|
+
export type { PassthroughRequest } from "./makePassthroughRequest.js";
|
|
10
|
+
export { makePassthroughRequest } from "./makePassthroughRequest.js";
|
|
9
11
|
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
10
12
|
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
11
13
|
export { Supplier } from "./Supplier.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
3
|
+
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.makePassthroughRequest = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
4
4
|
var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
5
5
|
Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
|
|
6
6
|
var Fetcher_js_1 = require("./Fetcher.js");
|
|
@@ -9,6 +9,8 @@ var getHeader_js_1 = require("./getHeader.js");
|
|
|
9
9
|
Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
|
|
10
10
|
var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
|
|
11
11
|
Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
|
|
12
|
+
var makePassthroughRequest_js_1 = require("./makePassthroughRequest.js");
|
|
13
|
+
Object.defineProperty(exports, "makePassthroughRequest", { enumerable: true, get: function () { return makePassthroughRequest_js_1.makePassthroughRequest; } });
|
|
12
14
|
var RawResponse_js_1 = require("./RawResponse.js");
|
|
13
15
|
Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
|
|
14
16
|
Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type LogConfig, type Logger } from "../logging/logger.js";
|
|
2
|
+
import { Supplier } from "./Supplier.js";
|
|
3
|
+
export declare namespace PassthroughRequest {
|
|
4
|
+
/**
|
|
5
|
+
* Per-request options that can override the SDK client defaults.
|
|
6
|
+
*/
|
|
7
|
+
interface RequestOptions {
|
|
8
|
+
/** Override the default timeout for this request (in seconds). */
|
|
9
|
+
timeoutInSeconds?: number;
|
|
10
|
+
/** Override the default number of retries for this request. */
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
/** Additional headers to include in this request. */
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
/** Abort signal for this request. */
|
|
15
|
+
abortSignal?: AbortSignal;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* SDK client configuration used by the passthrough fetch method.
|
|
19
|
+
*/
|
|
20
|
+
interface ClientOptions {
|
|
21
|
+
/** The base URL or environment for the client. */
|
|
22
|
+
environment?: Supplier<string>;
|
|
23
|
+
/** Override the base URL. */
|
|
24
|
+
baseUrl?: Supplier<string>;
|
|
25
|
+
/** Default headers to include in requests. */
|
|
26
|
+
headers?: Record<string, unknown>;
|
|
27
|
+
/** Default maximum time to wait for a response in seconds. */
|
|
28
|
+
timeoutInSeconds?: number;
|
|
29
|
+
/** Default number of times to retry the request. Defaults to 2. */
|
|
30
|
+
maxRetries?: number;
|
|
31
|
+
/** A custom fetch function. */
|
|
32
|
+
fetch?: typeof fetch;
|
|
33
|
+
/** Logging configuration. */
|
|
34
|
+
logging?: LogConfig | Logger;
|
|
35
|
+
/** A function that returns auth headers. */
|
|
36
|
+
getAuthHeaders?: () => Promise<Record<string, string>>;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
|
|
41
|
+
* while mimicking the standard `fetch` API.
|
|
42
|
+
*
|
|
43
|
+
* @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
|
|
44
|
+
* @param init - Standard RequestInit options (method, headers, body, signal, etc.)
|
|
45
|
+
* @param clientOptions - SDK client options (auth, default headers, logging, etc.)
|
|
46
|
+
* @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
|
|
47
|
+
* @returns A standard Response object.
|
|
48
|
+
*/
|
|
49
|
+
export declare function makePassthroughRequest(input: Request | string | URL, init: RequestInit | undefined, clientOptions: PassthroughRequest.ClientOptions, requestOptions?: PassthroughRequest.RequestOptions): Promise<Response>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.makePassthroughRequest = makePassthroughRequest;
|
|
13
|
+
const logger_js_1 = require("../logging/logger.js");
|
|
14
|
+
const join_js_1 = require("../url/join.js");
|
|
15
|
+
const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
16
|
+
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
17
|
+
const makeRequest_js_1 = require("./makeRequest.js");
|
|
18
|
+
const requestWithRetries_js_1 = require("./requestWithRetries.js");
|
|
19
|
+
const Supplier_js_1 = require("./Supplier.js");
|
|
20
|
+
/**
|
|
21
|
+
* Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
|
|
22
|
+
* while mimicking the standard `fetch` API.
|
|
23
|
+
*
|
|
24
|
+
* @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
|
|
25
|
+
* @param init - Standard RequestInit options (method, headers, body, signal, etc.)
|
|
26
|
+
* @param clientOptions - SDK client options (auth, default headers, logging, etc.)
|
|
27
|
+
* @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
|
|
28
|
+
* @returns A standard Response object.
|
|
29
|
+
*/
|
|
30
|
+
function makePassthroughRequest(input, init, clientOptions, requestOptions) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
33
|
+
const logger = (0, logger_js_1.createLogger)(clientOptions.logging);
|
|
34
|
+
// Extract URL and default init properties from Request object if provided
|
|
35
|
+
let url;
|
|
36
|
+
let effectiveInit = init;
|
|
37
|
+
if (input instanceof Request) {
|
|
38
|
+
url = input.url;
|
|
39
|
+
// If no explicit init provided, extract properties from the Request object
|
|
40
|
+
if (init == null) {
|
|
41
|
+
effectiveInit = {
|
|
42
|
+
method: input.method,
|
|
43
|
+
headers: Object.fromEntries(input.headers.entries()),
|
|
44
|
+
body: input.body,
|
|
45
|
+
signal: input.signal,
|
|
46
|
+
credentials: input.credentials,
|
|
47
|
+
cache: input.cache,
|
|
48
|
+
redirect: input.redirect,
|
|
49
|
+
referrer: input.referrer,
|
|
50
|
+
integrity: input.integrity,
|
|
51
|
+
mode: input.mode,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
url = input instanceof URL ? input.toString() : input;
|
|
57
|
+
}
|
|
58
|
+
// Resolve the base URL
|
|
59
|
+
const baseUrl = (_a = (clientOptions.baseUrl != null ? yield Supplier_js_1.Supplier.get(clientOptions.baseUrl) : undefined)) !== null && _a !== void 0 ? _a : (clientOptions.environment != null ? yield Supplier_js_1.Supplier.get(clientOptions.environment) : undefined);
|
|
60
|
+
// Determine the full URL
|
|
61
|
+
let fullUrl;
|
|
62
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
63
|
+
fullUrl = url;
|
|
64
|
+
}
|
|
65
|
+
else if (baseUrl != null) {
|
|
66
|
+
fullUrl = (0, join_js_1.join)(baseUrl, url);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
fullUrl = url;
|
|
70
|
+
}
|
|
71
|
+
// Merge headers: SDK default headers -> auth headers -> user-provided headers
|
|
72
|
+
const mergedHeaders = {};
|
|
73
|
+
// Apply SDK default headers (resolve suppliers)
|
|
74
|
+
if (clientOptions.headers != null) {
|
|
75
|
+
for (const [key, value] of Object.entries(clientOptions.headers)) {
|
|
76
|
+
const resolved = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: {} });
|
|
77
|
+
if (resolved != null) {
|
|
78
|
+
mergedHeaders[key.toLowerCase()] = `${resolved}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Apply auth headers
|
|
83
|
+
if (clientOptions.getAuthHeaders != null) {
|
|
84
|
+
const authHeaders = yield clientOptions.getAuthHeaders();
|
|
85
|
+
for (const [key, value] of Object.entries(authHeaders)) {
|
|
86
|
+
mergedHeaders[key.toLowerCase()] = value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Apply user-provided headers from init
|
|
90
|
+
if ((effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.headers) != null) {
|
|
91
|
+
const initHeaders = effectiveInit.headers instanceof Headers
|
|
92
|
+
? Object.fromEntries(effectiveInit.headers.entries())
|
|
93
|
+
: Array.isArray(effectiveInit.headers)
|
|
94
|
+
? Object.fromEntries(effectiveInit.headers)
|
|
95
|
+
: effectiveInit.headers;
|
|
96
|
+
for (const [key, value] of Object.entries(initHeaders)) {
|
|
97
|
+
if (value != null) {
|
|
98
|
+
mergedHeaders[key.toLowerCase()] = value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Apply per-request option headers (highest priority)
|
|
103
|
+
if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) != null) {
|
|
104
|
+
for (const [key, value] of Object.entries(requestOptions.headers)) {
|
|
105
|
+
mergedHeaders[key.toLowerCase()] = value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const method = (_b = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.method) !== null && _b !== void 0 ? _b : "GET";
|
|
109
|
+
const body = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.body;
|
|
110
|
+
const timeoutInSeconds = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : clientOptions.timeoutInSeconds;
|
|
111
|
+
const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined;
|
|
112
|
+
const maxRetries = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _d !== void 0 ? _d : clientOptions.maxRetries;
|
|
113
|
+
const abortSignal = (_f = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal) !== null && _e !== void 0 ? _e : effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.signal) !== null && _f !== void 0 ? _f : undefined;
|
|
114
|
+
const fetchFn = (_g = clientOptions.fetch) !== null && _g !== void 0 ? _g : (yield (0, getFetchFn_js_1.getFetchFn)());
|
|
115
|
+
if (logger.isDebug()) {
|
|
116
|
+
logger.debug("Making passthrough HTTP request", {
|
|
117
|
+
method,
|
|
118
|
+
url: fullUrl,
|
|
119
|
+
hasBody: body != null,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
return (0, makeRequest_js_1.makeRequest)(fetchFn, fullUrl, method, mergedHeaders, body !== null && body !== void 0 ? body : undefined, timeoutMs, abortSignal, (effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.credentials) === "include", undefined, // duplex
|
|
124
|
+
false);
|
|
125
|
+
}), maxRetries);
|
|
126
|
+
if (logger.isDebug()) {
|
|
127
|
+
logger.debug("Passthrough HTTP request completed", {
|
|
128
|
+
method,
|
|
129
|
+
url: fullUrl,
|
|
130
|
+
statusCode: response.status,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return response;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function isCacheNoStoreSupported(): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resetCacheNoStoreSupported(): void;
|
|
6
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Headers | Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half", disableCache?: boolean) => Promise<Response>;
|
|
@@ -10,8 +10,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.makeRequest = void 0;
|
|
13
|
+
exports.isCacheNoStoreSupported = isCacheNoStoreSupported;
|
|
14
|
+
exports.resetCacheNoStoreSupported = resetCacheNoStoreSupported;
|
|
13
15
|
const signals_js_1 = require("./signals.js");
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Cached result of checking whether the current runtime supports
|
|
18
|
+
* the `cache` option in `Request`. Some runtimes (e.g. Cloudflare Workers)
|
|
19
|
+
* throw a TypeError when this option is used.
|
|
20
|
+
*/
|
|
21
|
+
let _cacheNoStoreSupported;
|
|
22
|
+
function isCacheNoStoreSupported() {
|
|
23
|
+
if (_cacheNoStoreSupported != null) {
|
|
24
|
+
return _cacheNoStoreSupported;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
new Request("http://localhost", { cache: "no-store" });
|
|
28
|
+
_cacheNoStoreSupported = true;
|
|
29
|
+
}
|
|
30
|
+
catch (_a) {
|
|
31
|
+
_cacheNoStoreSupported = false;
|
|
32
|
+
}
|
|
33
|
+
return _cacheNoStoreSupported;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only.
|
|
37
|
+
*/
|
|
38
|
+
function resetCacheNoStoreSupported() {
|
|
39
|
+
_cacheNoStoreSupported = undefined;
|
|
40
|
+
}
|
|
41
|
+
const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex, disableCache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
42
|
const signals = [];
|
|
16
43
|
let timeoutAbortId;
|
|
17
44
|
if (timeoutMs != null) {
|
|
@@ -23,15 +50,9 @@ const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abor
|
|
|
23
50
|
signals.push(abortSignal);
|
|
24
51
|
}
|
|
25
52
|
const newSignals = (0, signals_js_1.anySignal)(signals);
|
|
26
|
-
const response = yield fetchFn(url, {
|
|
27
|
-
method: method,
|
|
28
|
-
headers,
|
|
29
|
-
body: requestBody,
|
|
30
|
-
signal: newSignals,
|
|
31
|
-
credentials: withCredentials ? "include" : undefined,
|
|
53
|
+
const response = yield fetchFn(url, Object.assign({ method: method, headers, body: requestBody, signal: newSignals, credentials: withCredentials ? "include" : undefined,
|
|
32
54
|
// @ts-ignore
|
|
33
|
-
duplex,
|
|
34
|
-
});
|
|
55
|
+
duplex }, (disableCache && isCacheNoStoreSupported() ? { cache: "no-store" } : {})));
|
|
35
56
|
if (timeoutAbortId != null) {
|
|
36
57
|
clearTimeout(timeoutAbortId);
|
|
37
58
|
}
|
|
@@ -84,17 +84,18 @@ function evaluateRuntime() {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
87
|
+
*
|
|
88
|
+
* We assign `process` to a local variable first to avoid being flagged by
|
|
89
|
+
* bundlers that perform static analysis on `process.versions` (e.g. Next.js
|
|
90
|
+
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
87
91
|
*/
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
!!process.version &&
|
|
91
|
-
"versions" in process &&
|
|
92
|
-
!!((_e = process.versions) === null || _e === void 0 ? void 0 : _e.node);
|
|
92
|
+
const _process = typeof process !== "undefined" ? process : undefined;
|
|
93
|
+
const isNode = typeof _process !== "undefined" && typeof ((_e = _process.versions) === null || _e === void 0 ? void 0 : _e.node) === "string";
|
|
93
94
|
if (isNode) {
|
|
94
95
|
return {
|
|
95
96
|
type: "node",
|
|
96
|
-
version:
|
|
97
|
-
parsedVersion: Number(
|
|
97
|
+
version: _process.versions.node,
|
|
98
|
+
parsedVersion: Number(_process.versions.node.split(".")[0]),
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
return {
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.3.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "newscatcher-catchall-sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "1.
|
|
10
|
-
"User-Agent": "newscatcher-catchall-sdk/1.
|
|
9
|
+
"X-Fern-SDK-Version": "1.3.1",
|
|
10
|
+
"User-Agent": "newscatcher-catchall-sdk/1.3.1",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { MetaClient } from "./api/resources/meta/client/Client.mjs";
|
|
|
3
3
|
import { MonitorsClient } from "./api/resources/monitors/client/Client.mjs";
|
|
4
4
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
5
5
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
6
|
+
import * as core from "./core/index.mjs";
|
|
6
7
|
export declare namespace CatchAllApiClient {
|
|
7
8
|
type Options = BaseClientOptions;
|
|
8
9
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -17,4 +18,15 @@ export declare class CatchAllApiClient {
|
|
|
17
18
|
get jobs(): JobsClient;
|
|
18
19
|
get monitors(): MonitorsClient;
|
|
19
20
|
get meta(): MetaClient;
|
|
21
|
+
/**
|
|
22
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
23
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
24
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
25
|
+
*
|
|
26
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
27
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
28
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
29
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
30
|
+
*/
|
|
31
|
+
fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
|
|
20
32
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
import { JobsClient } from "./api/resources/jobs/client/Client.mjs";
|
|
3
12
|
import { MetaClient } from "./api/resources/meta/client/Client.mjs";
|
|
4
13
|
import { MonitorsClient } from "./api/resources/monitors/client/Client.mjs";
|
|
5
14
|
import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
15
|
+
import * as core from "./core/index.mjs";
|
|
6
16
|
export class CatchAllApiClient {
|
|
7
17
|
constructor(options = {}) {
|
|
8
18
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
@@ -19,4 +29,28 @@ export class CatchAllApiClient {
|
|
|
19
29
|
var _a;
|
|
20
30
|
return ((_a = this._meta) !== null && _a !== void 0 ? _a : (this._meta = new MetaClient(this._options)));
|
|
21
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
34
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
35
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
36
|
+
*
|
|
37
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
38
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
39
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
40
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
41
|
+
*/
|
|
42
|
+
fetch(input, init, requestOptions) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var _a;
|
|
45
|
+
return core.makePassthroughRequest(input, init, {
|
|
46
|
+
baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
|
|
47
|
+
headers: this._options.headers,
|
|
48
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
49
|
+
maxRetries: this._options.maxRetries,
|
|
50
|
+
fetch: this._options.fetch,
|
|
51
|
+
logging: this._options.logging,
|
|
52
|
+
getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
|
|
53
|
+
}, requestOptions);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
22
56
|
}
|
|
@@ -14,9 +14,7 @@ export declare class JobsClient {
|
|
|
14
14
|
protected readonly _options: NormalizedClientOptionsWithAuth<JobsClient.Options>;
|
|
15
15
|
constructor(options?: JobsClient.Options);
|
|
16
16
|
/**
|
|
17
|
-
* Get suggested validators, enrichments, and date ranges for a query
|
|
18
|
-
*
|
|
19
|
-
* Returns LLM-generated suggestions based on query analysis and validates against plan limits.
|
|
17
|
+
* Get suggested validators, enrichments, and date ranges for a query.
|
|
20
18
|
*
|
|
21
19
|
* @param {CatchAllApi.InitializeRequestDto} request
|
|
22
20
|
* @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -26,16 +24,14 @@ export declare class JobsClient {
|
|
|
26
24
|
*
|
|
27
25
|
* @example
|
|
28
26
|
* await client.jobs.initialize({
|
|
29
|
-
* query: "
|
|
27
|
+
* query: "Series B funding rounds for SaaS startups",
|
|
28
|
+
* context: "Focus on funding amount and company name"
|
|
30
29
|
* })
|
|
31
30
|
*/
|
|
32
31
|
initialize(request: CatchAllApi.InitializeRequestDto, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.InitializeResponseDto>;
|
|
33
32
|
private __initialize;
|
|
34
33
|
/**
|
|
35
|
-
* Submit a
|
|
36
|
-
*
|
|
37
|
-
* Optionally specify context, date ranges, limit, custom validators, and enrichments.
|
|
38
|
-
* If dates exceed plan limits, returns 400 error.
|
|
34
|
+
* Submit a query to create a new processing job.
|
|
39
35
|
*
|
|
40
36
|
* @param {CatchAllApi.SubmitRequestDto} request
|
|
41
37
|
* @param {JobsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -46,14 +42,15 @@ export declare class JobsClient {
|
|
|
46
42
|
*
|
|
47
43
|
* @example
|
|
48
44
|
* await client.jobs.createJob({
|
|
49
|
-
* query: "
|
|
50
|
-
* context: "Focus on
|
|
45
|
+
* query: "Series B funding rounds for SaaS startups",
|
|
46
|
+
* context: "Focus on funding amount and company name",
|
|
51
47
|
* limit: 10,
|
|
52
|
-
* start_date: "2026-
|
|
53
|
-
* end_date: "2026-02-
|
|
48
|
+
* start_date: "2026-02-18T00:00:00Z",
|
|
49
|
+
* end_date: "2026-02-23T00:00:00Z",
|
|
50
|
+
* mode: "base"
|
|
54
51
|
* })
|
|
55
52
|
*/
|
|
56
|
-
createJob(request: CatchAllApi.SubmitRequestDto, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.
|
|
53
|
+
createJob(request: CatchAllApi.SubmitRequestDto, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.SubmitResponseDto>;
|
|
57
54
|
private __createJob;
|
|
58
55
|
/**
|
|
59
56
|
* Continue an existing job to process more records beyond the initial limit.
|
|
@@ -67,7 +64,7 @@ export declare class JobsClient {
|
|
|
67
64
|
*
|
|
68
65
|
* @example
|
|
69
66
|
* await client.jobs.continueJob({
|
|
70
|
-
* job_id: "
|
|
67
|
+
* job_id: "5f0c9087-85cb-4917-b3c7-e5a5eff73a0c",
|
|
71
68
|
* new_limit: 100
|
|
72
69
|
* })
|
|
73
70
|
*/
|
|
@@ -84,7 +81,7 @@ export declare class JobsClient {
|
|
|
84
81
|
*
|
|
85
82
|
* @example
|
|
86
83
|
* await client.jobs.getJobStatus({
|
|
87
|
-
* job_id: "
|
|
84
|
+
* job_id: "5f0c9087-85cb-4917-b3c7-e5a5eff73a0c"
|
|
88
85
|
* })
|
|
89
86
|
*/
|
|
90
87
|
getJobStatus(request: CatchAllApi.GetJobStatusRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.StatusResponseDto>;
|
|
@@ -100,7 +97,7 @@ export declare class JobsClient {
|
|
|
100
97
|
* @example
|
|
101
98
|
* await client.jobs.getUserJobs()
|
|
102
99
|
*/
|
|
103
|
-
getUserJobs(request?: CatchAllApi.GetUserJobsRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.ListUserJobsResponseDto
|
|
100
|
+
getUserJobs(request?: CatchAllApi.GetUserJobsRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.ListUserJobsResponseDto>;
|
|
104
101
|
private __getUserJobs;
|
|
105
102
|
/**
|
|
106
103
|
* Retrieve the final results for a completed job.
|
|
@@ -113,7 +110,7 @@ export declare class JobsClient {
|
|
|
113
110
|
*
|
|
114
111
|
* @example
|
|
115
112
|
* await client.jobs.getJobResults({
|
|
116
|
-
* job_id: "
|
|
113
|
+
* job_id: "5f0c9087-85cb-4917-b3c7-e5a5eff73a0c"
|
|
117
114
|
* })
|
|
118
115
|
*/
|
|
119
116
|
getJobResults(request: CatchAllApi.GetJobResultsRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.PullJobResponseDto>;
|