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
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
|
|
1
2
|
import * as core from "./core/index.js";
|
|
2
3
|
import type * as environments from "./environments.js";
|
|
3
|
-
export
|
|
4
|
+
export type BaseClientOptions = {
|
|
4
5
|
environment?: core.Supplier<environments.CatchAllApiEnvironment | string>;
|
|
5
6
|
/** Specify a custom URL to connect the client to. */
|
|
6
7
|
baseUrl?: core.Supplier<string>;
|
|
7
|
-
apiKey?: core.Supplier<string | undefined>;
|
|
8
8
|
/** Additional headers to include in requests. */
|
|
9
9
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
10
|
/** The default maximum time to wait for a response in seconds. */
|
|
@@ -15,7 +15,7 @@ export interface BaseClientOptions {
|
|
|
15
15
|
fetch?: typeof fetch;
|
|
16
16
|
/** Configure logging for the client. */
|
|
17
17
|
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
18
|
-
}
|
|
18
|
+
} & HeaderAuthProvider.AuthOptions;
|
|
19
19
|
export interface BaseRequestOptions {
|
|
20
20
|
/** The maximum time to wait for a response in seconds. */
|
|
21
21
|
timeoutInSeconds?: number;
|
|
@@ -28,4 +28,12 @@ export interface BaseRequestOptions {
|
|
|
28
28
|
/** Additional headers to include in the request. */
|
|
29
29
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
31
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
32
|
+
logging: core.logging.Logger;
|
|
33
|
+
authProvider?: core.AuthProvider;
|
|
34
|
+
};
|
|
35
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
36
|
+
authProvider: core.AuthProvider;
|
|
37
|
+
};
|
|
38
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
39
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -35,16 +35,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.normalizeClientOptions = normalizeClientOptions;
|
|
38
|
+
exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
|
|
39
|
+
const HeaderAuthProvider_js_1 = require("./auth/HeaderAuthProvider.js");
|
|
38
40
|
const headers_js_1 = require("./core/headers.js");
|
|
39
41
|
const core = __importStar(require("./core/index.js"));
|
|
40
42
|
function normalizeClientOptions(options) {
|
|
41
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
42
44
|
"X-Fern-Language": "JavaScript",
|
|
43
45
|
"X-Fern-SDK-Name": "newscatcher-catchall-sdk",
|
|
44
|
-
"X-Fern-SDK-Version": "0.
|
|
45
|
-
"User-Agent": "newscatcher-catchall-sdk/0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.2.0",
|
|
47
|
+
"User-Agent": "newscatcher-catchall-sdk/0.2.0",
|
|
46
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
47
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
48
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
49
51
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
50
52
|
}
|
|
53
|
+
function normalizeClientOptionsWithAuth(options) {
|
|
54
|
+
var _a;
|
|
55
|
+
const normalized = normalizeClientOptions(options);
|
|
56
|
+
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
57
|
+
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider_js_1.HeaderAuthProvider(normalizedWithNoOpAuthProvider));
|
|
58
|
+
return normalized;
|
|
59
|
+
}
|
|
60
|
+
function withNoOpAuthProvider(options) {
|
|
61
|
+
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
|
|
62
|
+
}
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { JobsClient } from "./api/resources/jobs/client/Client.js";
|
|
|
2
2
|
import { MetaClient } from "./api/resources/meta/client/Client.js";
|
|
3
3
|
import { MonitorsClient } from "./api/resources/monitors/client/Client.js";
|
|
4
4
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
5
|
+
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
5
6
|
export declare namespace CatchAllApiClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
7
|
+
type Options = BaseClientOptions;
|
|
8
8
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export declare class CatchAllApiClient {
|
|
12
|
-
protected readonly _options: CatchAllApiClient.Options
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<CatchAllApiClient.Options>;
|
|
13
13
|
protected _jobs: JobsClient | undefined;
|
|
14
14
|
protected _monitors: MonitorsClient | undefined;
|
|
15
15
|
protected _meta: MetaClient | undefined;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -8,7 +8,7 @@ const Client_js_3 = require("./api/resources/monitors/client/Client.js");
|
|
|
8
8
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
9
9
|
class CatchAllApiClient {
|
|
10
10
|
constructor(options = {}) {
|
|
11
|
-
this._options = (0, BaseClient_js_1.
|
|
11
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
12
12
|
}
|
|
13
13
|
get jobs() {
|
|
14
14
|
var _a;
|
|
@@ -44,7 +44,11 @@ class ForbiddenError extends errors.CatchAllApiError {
|
|
|
44
44
|
body: body,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
exports.ForbiddenError = ForbiddenError;
|
|
@@ -44,7 +44,11 @@ class NotFoundError extends errors.CatchAllApiError {
|
|
|
44
44
|
body: body,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
exports.NotFoundError = NotFoundError;
|
|
@@ -44,7 +44,11 @@ class UnprocessableEntityError extends errors.CatchAllApiError {
|
|
|
44
44
|
body: body,
|
|
45
45
|
rawResponse: rawResponse,
|
|
46
46
|
});
|
|
47
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import * as CatchAllApi from "../../../index.js";
|
|
4
5
|
export declare namespace JobsClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ export declare namespace JobsClient {
|
|
|
11
11
|
* Operations to create, monitor, and retrieve job results.
|
|
12
12
|
*/
|
|
13
13
|
export declare class JobsClient {
|
|
14
|
-
protected readonly _options: JobsClient.Options
|
|
14
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<JobsClient.Options>;
|
|
15
15
|
constructor(options?: JobsClient.Options);
|
|
16
16
|
/**
|
|
17
17
|
* Submit a natural language query to create a new processing job.
|
|
@@ -24,9 +24,8 @@ export declare class JobsClient {
|
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* await client.jobs.createJob({
|
|
27
|
-
* query: "
|
|
28
|
-
*
|
|
29
|
-
* context: "Focus on revenue and profit margins"
|
|
27
|
+
* query: "AI company acquisitions",
|
|
28
|
+
* context: "Focus on deal size and acquiring company details"
|
|
30
29
|
* })
|
|
31
30
|
*/
|
|
32
31
|
createJob(request: CatchAllApi.SubmitRequestDto, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.SubmitResponseBody>;
|
|
@@ -73,5 +72,4 @@ export declare class JobsClient {
|
|
|
73
72
|
*/
|
|
74
73
|
getJobResults(request: CatchAllApi.GetJobResultsRequest, requestOptions?: JobsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.PullJobResponseDto>;
|
|
75
74
|
private __getJobResults;
|
|
76
|
-
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
77
75
|
}
|
|
@@ -48,6 +48,7 @@ const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
|
48
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
50
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
51
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
52
53
|
const CatchAllApi = __importStar(require("../../../index.js"));
|
|
53
54
|
/**
|
|
@@ -55,7 +56,7 @@ const CatchAllApi = __importStar(require("../../../index.js"));
|
|
|
55
56
|
*/
|
|
56
57
|
class JobsClient {
|
|
57
58
|
constructor(options = {}) {
|
|
58
|
-
this._options = (0, BaseClient_js_1.
|
|
59
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Submit a natural language query to create a new processing job.
|
|
@@ -68,9 +69,8 @@ class JobsClient {
|
|
|
68
69
|
*
|
|
69
70
|
* @example
|
|
70
71
|
* await client.jobs.createJob({
|
|
71
|
-
* query: "
|
|
72
|
-
*
|
|
73
|
-
* context: "Focus on revenue and profit margins"
|
|
72
|
+
* query: "AI company acquisitions",
|
|
73
|
+
* context: "Focus on deal size and acquiring company details"
|
|
74
74
|
* })
|
|
75
75
|
*/
|
|
76
76
|
createJob(request, requestOptions) {
|
|
@@ -79,7 +79,8 @@ class JobsClient {
|
|
|
79
79
|
__createJob(request, requestOptions) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
81
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
82
|
-
const
|
|
82
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
83
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
83
84
|
const _response = yield core.fetcher({
|
|
84
85
|
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/submit"),
|
|
85
86
|
method: "POST",
|
|
@@ -111,21 +112,7 @@ class JobsClient {
|
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
-
case "non-json":
|
|
116
|
-
throw new errors.CatchAllApiError({
|
|
117
|
-
statusCode: _response.error.statusCode,
|
|
118
|
-
body: _response.error.rawBody,
|
|
119
|
-
rawResponse: _response.rawResponse,
|
|
120
|
-
});
|
|
121
|
-
case "timeout":
|
|
122
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/submit.");
|
|
123
|
-
case "unknown":
|
|
124
|
-
throw new errors.CatchAllApiError({
|
|
125
|
-
message: _response.error.errorMessage,
|
|
126
|
-
rawResponse: _response.rawResponse,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
115
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/catchAll/submit");
|
|
129
116
|
});
|
|
130
117
|
}
|
|
131
118
|
/**
|
|
@@ -149,7 +136,8 @@ class JobsClient {
|
|
|
149
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
137
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
151
138
|
const { job_id: jobId } = request;
|
|
152
|
-
const
|
|
139
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
140
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
153
141
|
const _response = yield core.fetcher({
|
|
154
142
|
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/status/${core.url.encodePathParam(jobId)}`),
|
|
155
143
|
method: "GET",
|
|
@@ -178,21 +166,7 @@ class JobsClient {
|
|
|
178
166
|
});
|
|
179
167
|
}
|
|
180
168
|
}
|
|
181
|
-
|
|
182
|
-
case "non-json":
|
|
183
|
-
throw new errors.CatchAllApiError({
|
|
184
|
-
statusCode: _response.error.statusCode,
|
|
185
|
-
body: _response.error.rawBody,
|
|
186
|
-
rawResponse: _response.rawResponse,
|
|
187
|
-
});
|
|
188
|
-
case "timeout":
|
|
189
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/status/{job_id}.");
|
|
190
|
-
case "unknown":
|
|
191
|
-
throw new errors.CatchAllApiError({
|
|
192
|
-
message: _response.error.errorMessage,
|
|
193
|
-
rawResponse: _response.rawResponse,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
169
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/status/{job_id}");
|
|
196
170
|
});
|
|
197
171
|
}
|
|
198
172
|
/**
|
|
@@ -209,7 +183,8 @@ class JobsClient {
|
|
|
209
183
|
__getUserJobs(requestOptions) {
|
|
210
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
211
185
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
212
|
-
const
|
|
186
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
187
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
213
188
|
const _response = yield core.fetcher({
|
|
214
189
|
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/jobs/user"),
|
|
215
190
|
method: "GET",
|
|
@@ -234,21 +209,7 @@ class JobsClient {
|
|
|
234
209
|
rawResponse: _response.rawResponse,
|
|
235
210
|
});
|
|
236
211
|
}
|
|
237
|
-
|
|
238
|
-
case "non-json":
|
|
239
|
-
throw new errors.CatchAllApiError({
|
|
240
|
-
statusCode: _response.error.statusCode,
|
|
241
|
-
body: _response.error.rawBody,
|
|
242
|
-
rawResponse: _response.rawResponse,
|
|
243
|
-
});
|
|
244
|
-
case "timeout":
|
|
245
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/jobs/user.");
|
|
246
|
-
case "unknown":
|
|
247
|
-
throw new errors.CatchAllApiError({
|
|
248
|
-
message: _response.error.errorMessage,
|
|
249
|
-
rawResponse: _response.rawResponse,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
212
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/jobs/user");
|
|
252
213
|
});
|
|
253
214
|
}
|
|
254
215
|
/**
|
|
@@ -279,7 +240,8 @@ class JobsClient {
|
|
|
279
240
|
if (pageSize != null) {
|
|
280
241
|
_queryParams.page_size = pageSize.toString();
|
|
281
242
|
}
|
|
282
|
-
const
|
|
243
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
244
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
283
245
|
const _response = yield core.fetcher({
|
|
284
246
|
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/pull/${core.url.encodePathParam(jobId)}`),
|
|
285
247
|
method: "GET",
|
|
@@ -308,27 +270,7 @@ class JobsClient {
|
|
|
308
270
|
});
|
|
309
271
|
}
|
|
310
272
|
}
|
|
311
|
-
|
|
312
|
-
case "non-json":
|
|
313
|
-
throw new errors.CatchAllApiError({
|
|
314
|
-
statusCode: _response.error.statusCode,
|
|
315
|
-
body: _response.error.rawBody,
|
|
316
|
-
rawResponse: _response.rawResponse,
|
|
317
|
-
});
|
|
318
|
-
case "timeout":
|
|
319
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/pull/{job_id}.");
|
|
320
|
-
case "unknown":
|
|
321
|
-
throw new errors.CatchAllApiError({
|
|
322
|
-
message: _response.error.errorMessage,
|
|
323
|
-
rawResponse: _response.rawResponse,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
_getCustomAuthorizationHeaders() {
|
|
329
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
331
|
-
return { "x-api-key": apiKeyValue };
|
|
273
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/pull/{job_id}");
|
|
332
274
|
});
|
|
333
275
|
}
|
|
334
276
|
}
|
|
@@ -2,9 +2,8 @@ import type * as CatchAllApi from "../../../../index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* query: "
|
|
6
|
-
*
|
|
7
|
-
* context: "Focus on revenue and profit margins"
|
|
5
|
+
* query: "AI company acquisitions",
|
|
6
|
+
* context: "Focus on deal size and acquiring company details"
|
|
8
7
|
* }
|
|
9
8
|
*/
|
|
10
9
|
export interface SubmitRequestDto {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptions } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import type * as CatchAllApi from "../../../index.js";
|
|
4
5
|
export declare namespace MetaClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -11,7 +11,7 @@ export declare namespace MetaClient {
|
|
|
11
11
|
* Operations to check API health and version.
|
|
12
12
|
*/
|
|
13
13
|
export declare class MetaClient {
|
|
14
|
-
protected readonly _options: MetaClient.Options
|
|
14
|
+
protected readonly _options: NormalizedClientOptions<MetaClient.Options>;
|
|
15
15
|
constructor(options?: MetaClient.Options);
|
|
16
16
|
/**
|
|
17
17
|
* Check API availability.
|
|
@@ -33,5 +33,4 @@ export declare class MetaClient {
|
|
|
33
33
|
*/
|
|
34
34
|
getVersion(requestOptions?: MetaClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.GetVersionResponse>;
|
|
35
35
|
private __getVersion;
|
|
36
|
-
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
37
36
|
}
|
|
@@ -48,6 +48,7 @@ const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
|
48
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
50
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
51
52
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
52
53
|
/**
|
|
53
54
|
* Operations to check API health and version.
|
|
@@ -70,7 +71,7 @@ class MetaClient {
|
|
|
70
71
|
__healthCheck(requestOptions) {
|
|
71
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
73
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
73
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
74
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
74
75
|
const _response = yield core.fetcher({
|
|
75
76
|
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"),
|
|
76
77
|
method: "GET",
|
|
@@ -92,21 +93,7 @@ class MetaClient {
|
|
|
92
93
|
rawResponse: _response.rawResponse,
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
case "non-json":
|
|
97
|
-
throw new errors.CatchAllApiError({
|
|
98
|
-
statusCode: _response.error.statusCode,
|
|
99
|
-
body: _response.error.rawBody,
|
|
100
|
-
rawResponse: _response.rawResponse,
|
|
101
|
-
});
|
|
102
|
-
case "timeout":
|
|
103
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /health.");
|
|
104
|
-
case "unknown":
|
|
105
|
-
throw new errors.CatchAllApiError({
|
|
106
|
-
message: _response.error.errorMessage,
|
|
107
|
-
rawResponse: _response.rawResponse,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
96
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/health");
|
|
110
97
|
});
|
|
111
98
|
}
|
|
112
99
|
/**
|
|
@@ -123,7 +110,7 @@ class MetaClient {
|
|
|
123
110
|
__getVersion(requestOptions) {
|
|
124
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
112
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
126
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
113
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
127
114
|
const _response = yield core.fetcher({
|
|
128
115
|
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"),
|
|
129
116
|
method: "GET",
|
|
@@ -145,27 +132,7 @@ class MetaClient {
|
|
|
145
132
|
rawResponse: _response.rawResponse,
|
|
146
133
|
});
|
|
147
134
|
}
|
|
148
|
-
|
|
149
|
-
case "non-json":
|
|
150
|
-
throw new errors.CatchAllApiError({
|
|
151
|
-
statusCode: _response.error.statusCode,
|
|
152
|
-
body: _response.error.rawBody,
|
|
153
|
-
rawResponse: _response.rawResponse,
|
|
154
|
-
});
|
|
155
|
-
case "timeout":
|
|
156
|
-
throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /version.");
|
|
157
|
-
case "unknown":
|
|
158
|
-
throw new errors.CatchAllApiError({
|
|
159
|
-
message: _response.error.errorMessage,
|
|
160
|
-
rawResponse: _response.rawResponse,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
_getCustomAuthorizationHeaders() {
|
|
166
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
168
|
-
return { "x-api-key": apiKeyValue };
|
|
135
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/version");
|
|
169
136
|
});
|
|
170
137
|
}
|
|
171
138
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
2
3
|
import * as core from "../../../../core/index.js";
|
|
3
4
|
import * as CatchAllApi from "../../../index.js";
|
|
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
|
}
|