newscatcher-catchall-sdk 4.0.0 → 4.0.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 +1 -0
- package/dist/cjs/BaseClient.d.ts +12 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/datasets/client/Client.d.ts +5 -3
- package/dist/cjs/api/resources/datasets/client/Client.js +11 -8
- package/dist/cjs/api/resources/entities/client/Client.d.ts +8 -6
- package/dist/cjs/api/resources/entities/client/Client.js +12 -9
- package/dist/cjs/api/resources/entities/client/requests/UpdateEntityRequest.d.ts +1 -1
- package/dist/cjs/api/resources/jobs/client/Client.js +5 -4
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +4 -0
- package/dist/cjs/api/resources/monitors/client/Client.js +4 -3
- package/dist/cjs/api/resources/projects/client/Client.js +4 -3
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +25 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +78 -4
- package/dist/cjs/api/resources/webhooks/client/requests/CreateWebhookRequestDto.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/client/requests/TriggerWebhookRequest.d.ts +23 -0
- package/dist/cjs/api/resources/webhooks/client/requests/TriggerWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequestDto.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/CompanyAttributes.d.ts +0 -2
- package/dist/cjs/api/types/CreateEntityRequest.d.ts +4 -2
- package/dist/cjs/api/types/DatasetResponse.d.ts +15 -0
- package/dist/cjs/api/types/FormatterConfigDto.d.ts +15 -0
- package/dist/cjs/api/types/FormatterConfigDto.js +3 -0
- package/dist/cjs/api/types/InitializeResponseDto.d.ts +6 -1
- package/dist/cjs/api/types/WebhookResponseDto.d.ts +2 -2
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/core/file/file.js +3 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +3 -0
- package/dist/cjs/core/requestBody.d.ts +12 -0
- package/dist/cjs/core/requestBody.js +26 -0
- package/dist/cjs/core/url/qs.js +2 -2
- package/dist/cjs/errors/CatchAllApiError.d.ts +1 -0
- package/dist/cjs/errors/CatchAllApiError.js +4 -0
- package/dist/cjs/errors/CatchAllApiTimeoutError.d.ts +2 -2
- package/dist/cjs/errors/CatchAllApiTimeoutError.js +39 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +12 -0
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/datasets/client/Client.d.mts +5 -3
- package/dist/esm/api/resources/datasets/client/Client.mjs +11 -8
- package/dist/esm/api/resources/entities/client/Client.d.mts +8 -6
- package/dist/esm/api/resources/entities/client/Client.mjs +12 -9
- package/dist/esm/api/resources/entities/client/requests/UpdateEntityRequest.d.mts +1 -1
- package/dist/esm/api/resources/jobs/client/Client.mjs +5 -4
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +4 -0
- package/dist/esm/api/resources/monitors/client/Client.mjs +4 -3
- package/dist/esm/api/resources/projects/client/Client.mjs +4 -3
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +25 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +78 -4
- package/dist/esm/api/resources/webhooks/client/requests/CreateWebhookRequestDto.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/client/requests/TriggerWebhookRequest.d.mts +23 -0
- package/dist/esm/api/resources/webhooks/client/requests/TriggerWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequestDto.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/CompanyAttributes.d.mts +0 -2
- package/dist/esm/api/types/CreateEntityRequest.d.mts +4 -2
- package/dist/esm/api/types/DatasetResponse.d.mts +15 -0
- package/dist/esm/api/types/FormatterConfigDto.d.mts +15 -0
- package/dist/esm/api/types/FormatterConfigDto.mjs +2 -0
- package/dist/esm/api/types/InitializeResponseDto.d.mts +6 -1
- package/dist/esm/api/types/WebhookResponseDto.d.mts +2 -2
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/core/file/file.mjs +3 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +3 -0
- package/dist/esm/core/requestBody.d.mts +12 -0
- package/dist/esm/core/requestBody.mjs +23 -0
- package/dist/esm/core/url/qs.mjs +2 -2
- package/dist/esm/errors/CatchAllApiError.d.mts +1 -0
- package/dist/esm/errors/CatchAllApiError.mjs +4 -0
- package/dist/esm/errors/CatchAllApiTimeoutError.d.mts +2 -2
- package/dist/esm/errors/CatchAllApiTimeoutError.mjs +6 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +86 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as CatchAllApi from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* resource_type: "job",
|
|
6
|
+
* resource_id: "3fec5b07-8786-46d7-9486-d43ff67eccd4",
|
|
7
|
+
* webhook_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
8
|
+
* job_id: "3fec5b07-8786-46d7-9486-d43ff67eccd4"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface TriggerWebhookRequest {
|
|
12
|
+
resource_type: CatchAllApi.MappableResourceType;
|
|
13
|
+
/** Unique resource identifier. */
|
|
14
|
+
resource_id: string;
|
|
15
|
+
/** Identifier of the webhook to trigger. Must be assigned to the resource. */
|
|
16
|
+
webhook_id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specific job run to deliver. Optional for `job` resources; for
|
|
19
|
+
* `monitor` and `monitor_group` resources, selects a past run to replay.
|
|
20
|
+
* When omitted, the latest available results are delivered.
|
|
21
|
+
*/
|
|
22
|
+
job_id?: string;
|
|
23
|
+
}
|
|
@@ -23,8 +23,8 @@ export interface UpdateWebhookRequestDto {
|
|
|
23
23
|
params?: Record<string, string>;
|
|
24
24
|
/** Updated authentication configuration. Replaces existing auth entirely. */
|
|
25
25
|
auth?: CatchAllApi.UpdateWebhookRequestDtoAuth;
|
|
26
|
-
/** Updated formatter
|
|
27
|
-
formatter_config?:
|
|
26
|
+
/** Updated custom payload formatter. Set only when `type` is `custom`. */
|
|
27
|
+
formatter_config?: CatchAllApi.FormatterConfigDto | null;
|
|
28
28
|
/** Set to `false` to disable delivery without deleting the webhook. */
|
|
29
29
|
is_active?: boolean;
|
|
30
30
|
}
|
|
@@ -8,4 +8,5 @@ export type { ListWebhooksForResourceRequest } from "./ListWebhooksForResourceRe
|
|
|
8
8
|
export type { ListWebhooksRequest } from "./ListWebhooksRequest.js";
|
|
9
9
|
export type { RemoveWebhookResourceRequest } from "./RemoveWebhookResourceRequest.js";
|
|
10
10
|
export type { TestWebhookRequestDto } from "./TestWebhookRequestDto.js";
|
|
11
|
+
export type { TriggerWebhookRequest } from "./TriggerWebhookRequest.js";
|
|
11
12
|
export type { UpdateWebhookRequestDto } from "./UpdateWebhookRequestDto.js";
|
|
@@ -8,8 +8,6 @@ export interface CompanyAttributes {
|
|
|
8
8
|
* The most reliable identifier — strongly recommended when available.
|
|
9
9
|
*/
|
|
10
10
|
domain?: (string | null) | undefined;
|
|
11
|
-
/** Detailed description of the company used for matching. */
|
|
12
|
-
description?: (string | null) | undefined;
|
|
13
11
|
/** Names of key people associated with the company (founders, executives, etc.). Improves matching for articles that mention people rather than the company name. */
|
|
14
12
|
key_persons?: (string[] | null) | undefined;
|
|
15
13
|
/** Alternative names, abbreviations, or aliases. Helps resolve common variations of the company name. */
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type * as CatchAllApi from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* Request body for creating a single entity.
|
|
3
|
+
* Request body for creating a single entity. The `name` field is required.
|
|
4
|
+
* You must also provide at least one of: a top-level `description` or a `domain`
|
|
5
|
+
* inside `additional_attributes.company_attributes`.
|
|
4
6
|
* The more fields you provide, the better the matching quality.
|
|
5
7
|
*/
|
|
6
8
|
export interface CreateEntityRequest {
|
|
7
9
|
/** The company or person name. Required and must be non-empty. */
|
|
8
10
|
name: string;
|
|
9
11
|
entity_type?: CatchAllApi.EntityType | undefined;
|
|
10
|
-
/** Free-text description of the entity used for disambiguation when similar names exist. */
|
|
12
|
+
/** Free-text description of the entity used for disambiguation when similar names exist. See [Writing effective descriptions](https://www.newscatcherapi.com/docs/web-search-api/concepts/company-search#writing-effective-descriptions) for guidance on improving matching quality. */
|
|
11
13
|
description?: string | undefined;
|
|
12
14
|
/** Optional external identifier for this entity. Free-form string, not enforced as unique. Use it to store your own CRM, data warehouse, or internal database ID so you can join CatchAll results back to your systems. */
|
|
13
15
|
external_entity_id?: string | undefined;
|
|
@@ -10,6 +10,21 @@ export interface DatasetResponse {
|
|
|
10
10
|
description?: (string | null) | undefined;
|
|
11
11
|
/** Total number of entities in this dataset. */
|
|
12
12
|
entity_count?: number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Count of entities grouped by processing status. Keys are status values
|
|
15
|
+
* (`ready`, `pending`, `enriching`, `failed`); values are entity counts.
|
|
16
|
+
*/
|
|
17
|
+
entity_status_breakdown?: Record<string, number> | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Overall health score of the dataset, from 0 to 100. Reflects how many
|
|
20
|
+
* entities have sufficient identifying information for reliable matching.
|
|
21
|
+
*/
|
|
22
|
+
health_score?: number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Health scores broken down by entity type. Keys are entity types
|
|
25
|
+
* (e.g. `company`); values are scores from 0 to 100.
|
|
26
|
+
*/
|
|
27
|
+
health_breakdown?: Record<string, number> | undefined;
|
|
13
28
|
latest_status?: CatchAllApi.DatasetStatus | undefined;
|
|
14
29
|
/** ID of the user who created this dataset. */
|
|
15
30
|
created_by_user_id?: string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom payload formatter for `custom` webhooks. A Liquid template is
|
|
3
|
+
* rendered at dispatch time to build a fully tailored request body — trim or
|
|
4
|
+
* rename fields, apply conditional logic, or emit non-JSON formats.
|
|
5
|
+
*/
|
|
6
|
+
export interface FormatterConfigDto {
|
|
7
|
+
/** Liquid template string rendered at dispatch time. Maximum 10 KB. */
|
|
8
|
+
template: string;
|
|
9
|
+
/**
|
|
10
|
+
* Content-Type of the rendered output. Supported values: `application/json`,
|
|
11
|
+
* `application/ld+json`, `text/html`, `text/plain`, `text/xml`,
|
|
12
|
+
* `application/xml`, `text/csv`.
|
|
13
|
+
*/
|
|
14
|
+
content_type?: string | undefined;
|
|
15
|
+
}
|
|
@@ -4,7 +4,12 @@ export interface InitializeResponseDto {
|
|
|
4
4
|
query: string;
|
|
5
5
|
/** Echo of the context from the request. Null if not provided. */
|
|
6
6
|
context?: (string | null) | undefined;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Suggested validators for filtering relevant web pages. When the job is
|
|
9
|
+
* submitted, the system may inject additional validators during the `analyzing`
|
|
10
|
+
* stage — check the returned `validators[]` in the job status to see the
|
|
11
|
+
* complete applied set.
|
|
12
|
+
*/
|
|
8
13
|
validators: CatchAllApi.ValidatorSchema[];
|
|
9
14
|
/** Suggested enrichment fields for data extraction. */
|
|
10
15
|
enrichments: CatchAllApi.EnrichmentSchema[];
|
|
@@ -13,8 +13,8 @@ export interface WebhookResponseDto {
|
|
|
13
13
|
headers?: Record<string, string> | undefined;
|
|
14
14
|
/** Query parameters appended to the webhook URL. */
|
|
15
15
|
params?: Record<string, string> | undefined;
|
|
16
|
-
/** Custom payload
|
|
17
|
-
formatter_config?: (
|
|
16
|
+
/** Custom payload formatter. Set only when `type` is `custom`. */
|
|
17
|
+
formatter_config?: (CatchAllApi.FormatterConfigDto | null) | undefined;
|
|
18
18
|
/** True if the webhook is active; false otherwise. */
|
|
19
19
|
is_active: boolean;
|
|
20
20
|
/** Organization that owns this webhook. */
|
|
@@ -45,6 +45,7 @@ export * from "./EntitySummary.js";
|
|
|
45
45
|
export * from "./EntityType.js";
|
|
46
46
|
export * from "./EntityValidationErrorBody.js";
|
|
47
47
|
export * from "./Error_.js";
|
|
48
|
+
export * from "./FormatterConfigDto.js";
|
|
48
49
|
export * from "./GetPlanLimitsResponseDto.js";
|
|
49
50
|
export * from "./GetWebhookResponseDto.js";
|
|
50
51
|
export * from "./HttpMethod.js";
|
|
@@ -61,6 +61,7 @@ __exportStar(require("./EntitySummary.js"), exports);
|
|
|
61
61
|
__exportStar(require("./EntityType.js"), exports);
|
|
62
62
|
__exportStar(require("./EntityValidationErrorBody.js"), exports);
|
|
63
63
|
__exportStar(require("./Error_.js"), exports);
|
|
64
|
+
__exportStar(require("./FormatterConfigDto.js"), exports);
|
|
64
65
|
__exportStar(require("./GetPlanLimitsResponseDto.js"), exports);
|
|
65
66
|
__exportStar(require("./GetWebhookResponseDto.js"), exports);
|
|
66
67
|
__exportStar(require("./HttpMethod.js"), exports);
|
|
@@ -78,6 +78,9 @@ function toMultipartDataPart(file) {
|
|
|
78
78
|
function getFileWithMetadata(file_1) {
|
|
79
79
|
return __awaiter(this, arguments, void 0, function* (file, { noSniffFileSize } = {}) {
|
|
80
80
|
var _a, _b, _c, _d, _e;
|
|
81
|
+
if (file == null) {
|
|
82
|
+
throw new Error(`Expected file to be a Blob, Buffer, ReadableStream, or an object with a "path" or "data" property, but received ${file === null ? "null" : "undefined"}.`);
|
|
83
|
+
}
|
|
81
84
|
if (isFileLike(file)) {
|
|
82
85
|
return getFileWithMetadata({
|
|
83
86
|
data: file,
|
|
@@ -73,6 +73,9 @@ class FormDataWrapper {
|
|
|
73
73
|
}
|
|
74
74
|
appendFile(key, value) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
if (value == null) {
|
|
77
|
+
throw new Error(`File upload for "${key}" received ${value === null ? "null" : "undefined"}. The generated code should not call appendFile with null/undefined — check that optional file fields are guarded before this call.`);
|
|
78
|
+
}
|
|
76
79
|
const { data, filename, contentType } = yield (0, index_js_1.toMultipartDataPart)(value);
|
|
77
80
|
const blob = yield convertToBlob(data, contentType);
|
|
78
81
|
if (filename) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
|
|
3
|
+
* on top of the request body. Caller-supplied properties win over the endpoint body. When no
|
|
4
|
+
* additional body parameters are provided, the original body is returned unchanged so serialization
|
|
5
|
+
* is unaffected.
|
|
6
|
+
*
|
|
7
|
+
* The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
|
|
8
|
+
* the additional parameters become the body; when the body is an array or a primitive JSON value it
|
|
9
|
+
* is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
|
|
10
|
+
* SDK, which only merges additional body parameters into mapping bodies.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mergeAdditionalBodyParameters(body: unknown, additionalBodyParameters: Record<string, unknown> | undefined): unknown;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeAdditionalBodyParameters = mergeAdditionalBodyParameters;
|
|
4
|
+
/**
|
|
5
|
+
* Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
|
|
6
|
+
* on top of the request body. Caller-supplied properties win over the endpoint body. When no
|
|
7
|
+
* additional body parameters are provided, the original body is returned unchanged so serialization
|
|
8
|
+
* is unaffected.
|
|
9
|
+
*
|
|
10
|
+
* The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
|
|
11
|
+
* the additional parameters become the body; when the body is an array or a primitive JSON value it
|
|
12
|
+
* is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
|
|
13
|
+
* SDK, which only merges additional body parameters into mapping bodies.
|
|
14
|
+
*/
|
|
15
|
+
function mergeAdditionalBodyParameters(body, additionalBodyParameters) {
|
|
16
|
+
if (additionalBodyParameters == null) {
|
|
17
|
+
return body;
|
|
18
|
+
}
|
|
19
|
+
if (body == null) {
|
|
20
|
+
return Object.assign({}, additionalBodyParameters);
|
|
21
|
+
}
|
|
22
|
+
if (typeof body === "object" && !Array.isArray(body)) {
|
|
23
|
+
return Object.assign(Object.assign({}, body), additionalBodyParameters);
|
|
24
|
+
}
|
|
25
|
+
return body;
|
|
26
|
+
}
|
package/dist/cjs/core/url/qs.js
CHANGED
|
@@ -19,7 +19,7 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
19
19
|
const parts = [];
|
|
20
20
|
for (const [key, value] of Object.entries(obj)) {
|
|
21
21
|
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
22
|
-
if (value
|
|
22
|
+
if (value == null) {
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
25
|
if (Array.isArray(value)) {
|
|
@@ -39,7 +39,7 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
39
39
|
else {
|
|
40
40
|
for (let i = 0; i < value.length; i++) {
|
|
41
41
|
const item = value[i];
|
|
42
|
-
if (item
|
|
42
|
+
if (item == null) {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
45
|
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
@@ -18,6 +18,10 @@ class CatchAllApiError extends Error {
|
|
|
18
18
|
this.cause = cause;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
get requestId() {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
return (_c = (_b = (_a = this.rawResponse) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get("x-request-id")) !== null && _c !== void 0 ? _c : undefined;
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
exports.CatchAllApiError = CatchAllApiError;
|
|
23
27
|
function buildMessage({ message, statusCode, body, }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as errors from "./index.js";
|
|
2
|
+
export declare class CatchAllApiTimeoutError extends errors.CatchAllApiError {
|
|
3
3
|
constructor(message: string, opts?: {
|
|
4
4
|
cause?: unknown;
|
|
5
5
|
});
|
|
@@ -1,18 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.CatchAllApiTimeoutError = void 0;
|
|
5
|
-
|
|
38
|
+
const errors = __importStar(require("./index.js"));
|
|
39
|
+
class CatchAllApiTimeoutError extends errors.CatchAllApiError {
|
|
6
40
|
constructor(message, opts) {
|
|
7
|
-
super(
|
|
41
|
+
super({
|
|
42
|
+
message: message,
|
|
43
|
+
cause: opts === null || opts === void 0 ? void 0 : opts.cause,
|
|
44
|
+
});
|
|
8
45
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
46
|
if (Error.captureStackTrace) {
|
|
10
47
|
Error.captureStackTrace(this, this.constructor);
|
|
11
48
|
}
|
|
12
49
|
this.name = "CatchAllApiTimeoutError";
|
|
13
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
|
|
14
|
-
this.cause = opts.cause;
|
|
15
|
-
}
|
|
16
50
|
}
|
|
17
51
|
}
|
|
18
52
|
exports.CatchAllApiTimeoutError = CatchAllApiTimeoutError;
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.0.
|
|
1
|
+
export declare const SDK_VERSION = "4.0.1";
|
package/dist/cjs/version.js
CHANGED
|
@@ -16,6 +16,11 @@ export type BaseClientOptions = {
|
|
|
16
16
|
fetch?: typeof fetch;
|
|
17
17
|
/** Configure logging for the client. */
|
|
18
18
|
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
19
|
+
/** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
20
|
+
stream?: {
|
|
21
|
+
reconnectionEnabled?: boolean;
|
|
22
|
+
maxReconnectionAttempts?: number;
|
|
23
|
+
};
|
|
19
24
|
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
|
|
20
25
|
auth?: AuthOption;
|
|
21
26
|
} & HeaderAuthProvider.AuthOptions;
|
|
@@ -28,8 +33,15 @@ export interface BaseRequestOptions {
|
|
|
28
33
|
abortSignal?: AbortSignal;
|
|
29
34
|
/** Additional query string parameters to include in the request. */
|
|
30
35
|
queryParams?: Record<string, unknown>;
|
|
36
|
+
/** A dictionary containing additional parameters to spread into the request's body. */
|
|
37
|
+
additionalBodyParameters?: Record<string, unknown>;
|
|
31
38
|
/** Additional headers to include in the request. */
|
|
32
39
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
40
|
+
/** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
41
|
+
stream?: {
|
|
42
|
+
reconnectionEnabled?: boolean;
|
|
43
|
+
maxReconnectionAttempts?: number;
|
|
44
|
+
};
|
|
33
45
|
}
|
|
34
46
|
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
35
47
|
logging: core.logging.Logger;
|
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": "4.0.
|
|
10
|
-
"User-Agent": "newscatcher-catchall-sdk/4.0.
|
|
9
|
+
"X-Fern-SDK-Version": "4.0.1",
|
|
10
|
+
"User-Agent": "newscatcher-catchall-sdk/4.0.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);
|
|
@@ -34,7 +34,9 @@ export declare class DatasetsClient {
|
|
|
34
34
|
listDatasets(request?: CatchAllApi.ListDatasetsRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetListResponse>;
|
|
35
35
|
private __listDatasets;
|
|
36
36
|
/**
|
|
37
|
-
* Creates a new dataset from a list of existing entity IDs.
|
|
37
|
+
* Creates a new dataset from a list of existing entity IDs. The optional `description` field here describes the dataset itself — it is separate from the entity-level `description` used for matching.
|
|
38
|
+
*
|
|
39
|
+
* Entities must be created before adding them to a dataset. Each entity requires a `name` plus at least one of: a `description` or a `domain`. Use [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) or [Create entities batch](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entities-batch) to create entities first.
|
|
38
40
|
*
|
|
39
41
|
* If any of the provided entity IDs do not exist or do not belong to
|
|
40
42
|
* your organization, the request fails with `400`. All entity IDs must
|
|
@@ -60,12 +62,12 @@ export declare class DatasetsClient {
|
|
|
60
62
|
createDataset(request: CatchAllApi.CreateDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetResponse>;
|
|
61
63
|
private __createDataset;
|
|
62
64
|
/**
|
|
63
|
-
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity.
|
|
65
|
+
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a `name` plus at least one of: a `description` or a `domain`; all other columns are optional. Note: `description` in the CSV is the entity's matching description — it is separate from the dataset-level `description` field in the form data.
|
|
64
66
|
*
|
|
65
67
|
* **CSV format:**
|
|
66
68
|
* ```csv
|
|
67
69
|
* name,description,domain,alternative_names,key_persons
|
|
68
|
-
* NewsCatcher,"
|
|
70
|
+
* NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
|
|
69
71
|
* OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
|
|
70
72
|
* ```
|
|
71
73
|
*
|
|
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
23
23
|
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
24
24
|
import * as core from "../../../../core/index.mjs";
|
|
25
|
+
import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.mjs";
|
|
25
26
|
import * as environments from "../../../../environments.mjs";
|
|
26
27
|
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
27
28
|
import * as errors from "../../../../errors/index.mjs";
|
|
@@ -104,7 +105,9 @@ export class DatasetsClient {
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
|
-
* Creates a new dataset from a list of existing entity IDs.
|
|
108
|
+
* Creates a new dataset from a list of existing entity IDs. The optional `description` field here describes the dataset itself — it is separate from the entity-level `description` used for matching.
|
|
109
|
+
*
|
|
110
|
+
* Entities must be created before adding them to a dataset. Each entity requires a `name` plus at least one of: a `description` or a `domain`. Use [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) or [Create entities batch](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entities-batch) to create entities first.
|
|
108
111
|
*
|
|
109
112
|
* If any of the provided entity IDs do not exist or do not belong to
|
|
110
113
|
* your organization, the request fails with `400`. All entity IDs must
|
|
@@ -142,7 +145,7 @@ export class DatasetsClient {
|
|
|
142
145
|
contentType: "application/json",
|
|
143
146
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
144
147
|
requestType: "json",
|
|
145
|
-
body: request,
|
|
148
|
+
body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
146
149
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
147
150
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
148
151
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -172,12 +175,12 @@ export class DatasetsClient {
|
|
|
172
175
|
});
|
|
173
176
|
}
|
|
174
177
|
/**
|
|
175
|
-
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity.
|
|
178
|
+
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a `name` plus at least one of: a `description` or a `domain`; all other columns are optional. Note: `description` in the CSV is the entity's matching description — it is separate from the dataset-level `description` field in the form data.
|
|
176
179
|
*
|
|
177
180
|
* **CSV format:**
|
|
178
181
|
* ```csv
|
|
179
182
|
* name,description,domain,alternative_names,key_persons
|
|
180
|
-
* NewsCatcher,"
|
|
183
|
+
* NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
|
|
181
184
|
* OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
|
|
182
185
|
* ```
|
|
183
186
|
*
|
|
@@ -390,7 +393,7 @@ export class DatasetsClient {
|
|
|
390
393
|
contentType: "application/json",
|
|
391
394
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
392
395
|
requestType: "json",
|
|
393
|
-
body: _body,
|
|
396
|
+
body: mergeAdditionalBodyParameters(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
394
397
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
395
398
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
396
399
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -453,7 +456,7 @@ export class DatasetsClient {
|
|
|
453
456
|
contentType: "application/json",
|
|
454
457
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
455
458
|
requestType: "json",
|
|
456
|
-
body: _body,
|
|
459
|
+
body: mergeAdditionalBodyParameters(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
457
460
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
458
461
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
459
462
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -516,7 +519,7 @@ export class DatasetsClient {
|
|
|
516
519
|
contentType: "application/json",
|
|
517
520
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
518
521
|
requestType: "json",
|
|
519
|
-
body: _body,
|
|
522
|
+
body: mergeAdditionalBodyParameters(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
520
523
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
521
524
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
522
525
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -583,7 +586,7 @@ export class DatasetsClient {
|
|
|
583
586
|
contentType: "application/json",
|
|
584
587
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
585
588
|
requestType: "json",
|
|
586
|
-
body: _body,
|
|
589
|
+
body: mergeAdditionalBodyParameters(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
587
590
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
588
591
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
589
592
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -35,10 +35,10 @@ export declare class EntitiesClient {
|
|
|
35
35
|
/**
|
|
36
36
|
* Creates a new company entity and begins background enrichment.
|
|
37
37
|
*
|
|
38
|
+
* Each entity requires a `name` plus at least one of: a `description` or a `domain`. Providing both is recommended — `domain` is the highest-signal identifier because it is unambiguous; a well-written `description` is the best alternative when no domain is available.
|
|
39
|
+
*
|
|
38
40
|
* The entity status starts as `pending` and transitions to `ready` once
|
|
39
|
-
* enrichment completes.
|
|
40
|
-
* possible — `domain` is the highest-signal field because it is
|
|
41
|
-
* unambiguous.
|
|
41
|
+
* enrichment completes.
|
|
42
42
|
*
|
|
43
43
|
* @param {CatchAllApi.CreateEntityRequest} request
|
|
44
44
|
* @param {EntitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -50,12 +50,12 @@ export declare class EntitiesClient {
|
|
|
50
50
|
* await client.entities.createEntity({
|
|
51
51
|
* name: "NewsCatcher",
|
|
52
52
|
* entity_type: "company",
|
|
53
|
-
* description: "
|
|
53
|
+
* description: "NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",
|
|
54
54
|
* additional_attributes: {
|
|
55
55
|
* company_attributes: {
|
|
56
56
|
* domain: "newscatcherapi.com",
|
|
57
57
|
* key_persons: ["Artem Bugara", "Maksym Sugonyaka"],
|
|
58
|
-
* alternative_names: ["
|
|
58
|
+
* alternative_names: ["NewsCatcher CatchAll", "NewsCatcher API"]
|
|
59
59
|
* }
|
|
60
60
|
* }
|
|
61
61
|
* })
|
|
@@ -65,6 +65,8 @@ export declare class EntitiesClient {
|
|
|
65
65
|
/**
|
|
66
66
|
* Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others.
|
|
67
67
|
*
|
|
68
|
+
* Each entity requires a `name` plus at least one of: a `description` or a `domain`. See [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) for the full field reference.
|
|
69
|
+
*
|
|
68
70
|
* Returns an array of `{id, status}` objects in the same order as the input array.
|
|
69
71
|
*
|
|
70
72
|
* @param {CatchAllApi.CreateEntitiesBatchRequest} request
|
|
@@ -150,7 +152,7 @@ export declare class EntitiesClient {
|
|
|
150
152
|
* description: "Updated description",
|
|
151
153
|
* additional_attributes: {
|
|
152
154
|
* company_attributes: {
|
|
153
|
-
* alternative_names: ["
|
|
155
|
+
* alternative_names: ["NewsCatcher CatchAll", "NewsCatcher API", "NCA"]
|
|
154
156
|
* }
|
|
155
157
|
* }
|
|
156
158
|
* })
|