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.
Files changed (112) hide show
  1. package/dist/cjs/BaseClient.d.ts +12 -4
  2. package/dist/cjs/BaseClient.js +14 -2
  3. package/dist/cjs/Client.d.ts +3 -3
  4. package/dist/cjs/Client.js +1 -1
  5. package/dist/cjs/api/errors/ForbiddenError.js +5 -1
  6. package/dist/cjs/api/errors/NotFoundError.js +5 -1
  7. package/dist/cjs/api/errors/UnprocessableEntityError.js +5 -1
  8. package/dist/cjs/api/resources/jobs/client/Client.d.ts +5 -7
  9. package/dist/cjs/api/resources/jobs/client/Client.js +16 -74
  10. package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +2 -3
  11. package/dist/cjs/api/resources/meta/client/Client.d.ts +3 -4
  12. package/dist/cjs/api/resources/meta/client/Client.js +5 -38
  13. package/dist/cjs/api/resources/monitors/client/Client.d.ts +11 -6
  14. package/dist/cjs/api/resources/monitors/client/Client.js +28 -105
  15. package/dist/cjs/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.ts +2 -5
  16. package/dist/cjs/api/types/ListUserJobsResponseDto.d.ts +4 -0
  17. package/dist/cjs/api/types/MonitorCitation.d.ts +2 -0
  18. package/dist/cjs/api/types/MonitorListItemDto.d.ts +5 -0
  19. package/dist/cjs/api/types/PullJobResponseDto.d.ts +5 -0
  20. package/dist/cjs/api/types/Schema.d.ts +1 -1
  21. package/dist/cjs/api/types/WebhookPayload.d.ts +2 -4
  22. package/dist/cjs/auth/HeaderAuthProvider.d.ts +16 -0
  23. package/dist/cjs/auth/HeaderAuthProvider.js +71 -0
  24. package/dist/cjs/auth/index.d.ts +1 -0
  25. package/dist/cjs/auth/index.js +5 -0
  26. package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
  27. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  28. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  29. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  30. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  31. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  32. package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
  33. package/dist/cjs/core/auth/BearerToken.js +16 -0
  34. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
  35. package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
  36. package/dist/cjs/core/auth/index.d.ts +5 -0
  37. package/dist/cjs/core/auth/index.js +9 -0
  38. package/dist/cjs/core/base64.d.ts +2 -0
  39. package/dist/cjs/core/base64.js +26 -0
  40. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
  41. package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -1
  42. package/dist/cjs/core/fetcher/Fetcher.js +2 -1
  43. package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
  44. package/dist/cjs/core/fetcher/signals.d.ts +1 -1
  45. package/dist/cjs/core/index.d.ts +2 -0
  46. package/dist/cjs/core/index.js +2 -0
  47. package/dist/cjs/core/runtime/runtime.js +11 -10
  48. package/dist/cjs/errors/CatchAllApiError.js +5 -1
  49. package/dist/cjs/errors/CatchAllApiTimeoutError.js +5 -1
  50. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
  51. package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
  52. package/dist/cjs/version.d.ts +1 -1
  53. package/dist/cjs/version.js +1 -1
  54. package/dist/esm/BaseClient.d.mts +12 -4
  55. package/dist/esm/BaseClient.mjs +13 -2
  56. package/dist/esm/Client.d.mts +3 -3
  57. package/dist/esm/Client.mjs +2 -2
  58. package/dist/esm/api/errors/ForbiddenError.mjs +5 -1
  59. package/dist/esm/api/errors/NotFoundError.mjs +5 -1
  60. package/dist/esm/api/errors/UnprocessableEntityError.mjs +5 -1
  61. package/dist/esm/api/resources/jobs/client/Client.d.mts +5 -7
  62. package/dist/esm/api/resources/jobs/client/Client.mjs +18 -76
  63. package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +2 -3
  64. package/dist/esm/api/resources/meta/client/Client.d.mts +3 -4
  65. package/dist/esm/api/resources/meta/client/Client.mjs +6 -39
  66. package/dist/esm/api/resources/monitors/client/Client.d.mts +11 -6
  67. package/dist/esm/api/resources/monitors/client/Client.mjs +30 -107
  68. package/dist/esm/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.mts +2 -5
  69. package/dist/esm/api/types/ListUserJobsResponseDto.d.mts +4 -0
  70. package/dist/esm/api/types/MonitorCitation.d.mts +2 -0
  71. package/dist/esm/api/types/MonitorListItemDto.d.mts +5 -0
  72. package/dist/esm/api/types/PullJobResponseDto.d.mts +5 -0
  73. package/dist/esm/api/types/Schema.d.mts +1 -1
  74. package/dist/esm/api/types/WebhookPayload.d.mts +2 -4
  75. package/dist/esm/auth/HeaderAuthProvider.d.mts +16 -0
  76. package/dist/esm/auth/HeaderAuthProvider.mjs +34 -0
  77. package/dist/esm/auth/index.d.mts +1 -0
  78. package/dist/esm/auth/index.mjs +1 -0
  79. package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
  80. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  81. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  82. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  83. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  84. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  85. package/dist/esm/core/auth/BearerToken.d.mts +7 -0
  86. package/dist/esm/core/auth/BearerToken.mjs +13 -0
  87. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
  88. package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
  89. package/dist/esm/core/auth/index.d.mts +5 -0
  90. package/dist/esm/core/auth/index.mjs +3 -0
  91. package/dist/esm/core/base64.d.mts +2 -0
  92. package/dist/esm/core/base64.mjs +22 -0
  93. package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
  94. package/dist/esm/core/fetcher/Fetcher.d.mts +5 -1
  95. package/dist/esm/core/fetcher/Fetcher.mjs +2 -1
  96. package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
  97. package/dist/esm/core/fetcher/signals.d.mts +1 -1
  98. package/dist/esm/core/index.d.mts +2 -0
  99. package/dist/esm/core/index.mjs +2 -0
  100. package/dist/esm/core/runtime/runtime.mjs +11 -10
  101. package/dist/esm/errors/CatchAllApiError.mjs +5 -1
  102. package/dist/esm/errors/CatchAllApiTimeoutError.mjs +5 -1
  103. package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
  104. package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
  105. package/dist/esm/version.d.mts +1 -1
  106. package/dist/esm/version.mjs +1 -1
  107. package/package.json +5 -2
  108. package/reference.md +10 -5
  109. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  110. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  111. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  112. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
@@ -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,13 +56,19 @@ const CatchAllApi = __importStar(require("../../../index.js"));
55
56
  */
56
57
  class MonitorsClient {
57
58
  constructor(options = {}) {
58
- this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
59
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
59
60
  }
60
61
  /**
61
62
  * Create a monitor that runs jobs based on a reference job with a specified schedule.
62
63
  *
63
- * **Warning**: Schedule validation is limited. Invalid schedules may be parsed incorrectly.
64
- * Always test schedules before production use.
64
+ * **Schedule requirements:**
65
+ * - Minimum 24-hour interval between executions
66
+ * - Natural language format (e.g., "every day at 12 PM UTC", "every 48 hours")
67
+ *
68
+ * **Validation:**
69
+ * - Schedules below minimum frequency return error with descriptive message.
70
+ * - Invalid job IDs return 400 Bad Request.
71
+ * - Duplicate monitors (same job already monitored) return error.
65
72
  *
66
73
  * @param {CatchAllApi.CreateMonitorRequestDto} request
67
74
  * @param {MonitorsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -80,7 +87,8 @@ class MonitorsClient {
80
87
  __createMonitor(request, requestOptions) {
81
88
  return __awaiter(this, void 0, void 0, function* () {
82
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
90
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
91
+ 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);
84
92
  const _response = yield core.fetcher({
85
93
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "catchAll/monitors/create"),
86
94
  method: "POST",
@@ -110,21 +118,7 @@ class MonitorsClient {
110
118
  });
111
119
  }
112
120
  }
113
- switch (_response.error.reason) {
114
- case "non-json":
115
- throw new errors.CatchAllApiError({
116
- statusCode: _response.error.statusCode,
117
- body: _response.error.rawBody,
118
- rawResponse: _response.rawResponse,
119
- });
120
- case "timeout":
121
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/create.");
122
- case "unknown":
123
- throw new errors.CatchAllApiError({
124
- message: _response.error.errorMessage,
125
- rawResponse: _response.rawResponse,
126
- });
127
- }
121
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/create");
128
122
  });
129
123
  }
130
124
  /**
@@ -153,7 +147,8 @@ class MonitorsClient {
153
147
  if (sort != null) {
154
148
  _queryParams.sort = sort;
155
149
  }
156
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
150
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
151
+ 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);
157
152
  const _response = yield core.fetcher({
158
153
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/jobs`),
159
154
  method: "GET",
@@ -182,21 +177,7 @@ class MonitorsClient {
182
177
  });
183
178
  }
184
179
  }
185
- switch (_response.error.reason) {
186
- case "non-json":
187
- throw new errors.CatchAllApiError({
188
- statusCode: _response.error.statusCode,
189
- body: _response.error.rawBody,
190
- rawResponse: _response.rawResponse,
191
- });
192
- case "timeout":
193
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors/{monitor_id}/jobs.");
194
- case "unknown":
195
- throw new errors.CatchAllApiError({
196
- message: _response.error.errorMessage,
197
- rawResponse: _response.rawResponse,
198
- });
199
- }
180
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/monitors/{monitor_id}/jobs");
200
181
  });
201
182
  }
202
183
  /**
@@ -221,7 +202,8 @@ class MonitorsClient {
221
202
  return __awaiter(this, void 0, void 0, function* () {
222
203
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
223
204
  const { monitor_id: monitorId } = request;
224
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
205
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
206
+ 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);
225
207
  const _response = yield core.fetcher({
226
208
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/pull/${core.url.encodePathParam(monitorId)}`),
227
209
  method: "GET",
@@ -250,21 +232,7 @@ class MonitorsClient {
250
232
  });
251
233
  }
252
234
  }
253
- switch (_response.error.reason) {
254
- case "non-json":
255
- throw new errors.CatchAllApiError({
256
- statusCode: _response.error.statusCode,
257
- body: _response.error.rawBody,
258
- rawResponse: _response.rawResponse,
259
- });
260
- case "timeout":
261
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors/pull/{monitor_id}.");
262
- case "unknown":
263
- throw new errors.CatchAllApiError({
264
- message: _response.error.errorMessage,
265
- rawResponse: _response.rawResponse,
266
- });
267
- }
235
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/monitors/pull/{monitor_id}");
268
236
  });
269
237
  }
270
238
  /**
@@ -290,7 +258,8 @@ class MonitorsClient {
290
258
  return __awaiter(this, void 0, void 0, function* () {
291
259
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
292
260
  const { monitor_id: monitorId } = request;
293
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
261
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
262
+ 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);
294
263
  const _response = yield core.fetcher({
295
264
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/disable`),
296
265
  method: "POST",
@@ -321,21 +290,7 @@ class MonitorsClient {
321
290
  });
322
291
  }
323
292
  }
324
- switch (_response.error.reason) {
325
- case "non-json":
326
- throw new errors.CatchAllApiError({
327
- statusCode: _response.error.statusCode,
328
- body: _response.error.rawBody,
329
- rawResponse: _response.rawResponse,
330
- });
331
- case "timeout":
332
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/{monitor_id}/disable.");
333
- case "unknown":
334
- throw new errors.CatchAllApiError({
335
- message: _response.error.errorMessage,
336
- rawResponse: _response.rawResponse,
337
- });
338
- }
293
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/{monitor_id}/disable");
339
294
  });
340
295
  }
341
296
  /**
@@ -361,7 +316,8 @@ class MonitorsClient {
361
316
  return __awaiter(this, void 0, void 0, function* () {
362
317
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
363
318
  const { monitor_id: monitorId } = request;
364
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
319
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
320
+ 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);
365
321
  const _response = yield core.fetcher({
366
322
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/monitors/${core.url.encodePathParam(monitorId)}/enable`),
367
323
  method: "POST",
@@ -392,21 +348,7 @@ class MonitorsClient {
392
348
  });
393
349
  }
394
350
  }
395
- switch (_response.error.reason) {
396
- case "non-json":
397
- throw new errors.CatchAllApiError({
398
- statusCode: _response.error.statusCode,
399
- body: _response.error.rawBody,
400
- rawResponse: _response.rawResponse,
401
- });
402
- case "timeout":
403
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling POST /catchAll/monitors/{monitor_id}/enable.");
404
- case "unknown":
405
- throw new errors.CatchAllApiError({
406
- message: _response.error.errorMessage,
407
- rawResponse: _response.rawResponse,
408
- });
409
- }
351
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/catchAll/monitors/{monitor_id}/enable");
410
352
  });
411
353
  }
412
354
  /**
@@ -426,7 +368,8 @@ class MonitorsClient {
426
368
  __listMonitors(requestOptions) {
427
369
  return __awaiter(this, void 0, void 0, function* () {
428
370
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
429
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
371
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
372
+ 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);
430
373
  const _response = yield core.fetcher({
431
374
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, "catchAll/monitors"),
432
375
  method: "GET",
@@ -455,27 +398,7 @@ class MonitorsClient {
455
398
  });
456
399
  }
457
400
  }
458
- switch (_response.error.reason) {
459
- case "non-json":
460
- throw new errors.CatchAllApiError({
461
- statusCode: _response.error.statusCode,
462
- body: _response.error.rawBody,
463
- rawResponse: _response.rawResponse,
464
- });
465
- case "timeout":
466
- throw new errors.CatchAllApiTimeoutError("Timeout exceeded when calling GET /catchAll/monitors.");
467
- case "unknown":
468
- throw new errors.CatchAllApiError({
469
- message: _response.error.errorMessage,
470
- rawResponse: _response.rawResponse,
471
- });
472
- }
473
- });
474
- }
475
- _getCustomAuthorizationHeaders() {
476
- return __awaiter(this, void 0, void 0, function* () {
477
- const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
478
- return { "x-api-key": apiKeyValue };
401
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/catchAll/monitors");
479
402
  });
480
403
  }
481
404
  }
@@ -10,12 +10,9 @@ export interface CreateMonitorRequestDto {
10
10
  /** Job ID to use as template for scheduled runs. */
11
11
  reference_job_id: string;
12
12
  /**
13
- * Natural language schedule description. Examples:
14
- * - "every day at 12 PM UTC"
15
- * - "every Monday at 9 AM EST"
16
- * - "every 6 hours"
13
+ * Natural language schedule (e.g. 'every day at 12 AM EST').
17
14
  *
18
- * **Warning**: Schedule validation is limited. Test carefully before production.
15
+ * **Minimum frequency:** Monitors must be scheduled at least 24 hours apart.
19
16
  */
20
17
  schedule: string;
21
18
  /** Optional webhook to receive notifications when jobs complete. */
@@ -3,4 +3,8 @@ export interface ListUserJobsResponseDto {
3
3
  job_id: string;
4
4
  /** The natural language query for this job. */
5
5
  query: string;
6
+ /** Job creation timestamp in ISO 8601 format. */
7
+ created_at: string;
8
+ /** Current processing status of the job. */
9
+ status: string;
6
10
  }
@@ -3,6 +3,8 @@
3
3
  * Extends base citation with tracking information for job_id and timestamps.
4
4
  */
5
5
  export interface MonitorCitation {
6
+ /** Article identifier from News API v3 */
7
+ id: string;
6
8
  /** Article title */
7
9
  title: string;
8
10
  /** URL to the source article */
@@ -1,3 +1,4 @@
1
+ import type * as CatchAllApi from "../index.js";
1
2
  export interface MonitorListItemDto {
2
3
  /** Monitor identifier. */
3
4
  monitor_id: string;
@@ -9,8 +10,12 @@ export interface MonitorListItemDto {
9
10
  enabled: boolean;
10
11
  /** Cron expression for monitor schedule. */
11
12
  schedule?: string;
13
+ /** Natural language description of the monitor schedule. */
14
+ schedule_human_readable?: string;
12
15
  /** Timezone for schedule execution. */
13
16
  timezone?: string;
14
17
  /** The date when the monitor was created. */
15
18
  created_at?: string;
19
+ /** Webhook configuration for this monitor (if set). */
20
+ webhook?: CatchAllApi.WebhookDto;
16
21
  }
@@ -8,6 +8,11 @@ export interface PullJobResponseDto {
8
8
  context?: string;
9
9
  /** List of validation criteria applied to filter results. */
10
10
  validators?: string[];
11
+ /**
12
+ * List of extracted field names generated by the enrichment process.
13
+ * These field names appear in the `enrichment` object of each record.
14
+ */
15
+ enrichments?: string[];
11
16
  /** Job status. */
12
17
  status: string;
13
18
  /** Total time taken to process the job. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Template string to guide record summary formatting. Use placeholder syntax with brackets to indicate desired fields: [COMPANY], [REVENUE], [DATE], etc.
2
+ * Template string to guide record summary formatting. Use placeholder syntax with brackets to indicate desired fields: [COMPANY], [REVENUE], [TARGET], [AMOUNT], etc.
3
3
  *
4
4
  * When provided, the system generates a `schema_based_summary` field for each record following this template.
5
5
  */
@@ -1,10 +1,8 @@
1
1
  import type * as CatchAllApi from "../index.js";
2
2
  /**
3
- * Payload sent to webhook URL when a monitor job completes.
4
- * Content-Type: application/json
3
+ * **First execution:** The initial webhook after monitor creation includes all records from the reference job, providing immediate access to collected data.
5
4
  *
6
- * Note: Citations in webhook payloads include an additional 'id' field
7
- * (string, internal identifier) not present in API GET responses.
5
+ * **Subsequent executions:** Only new records (after deduplication) are included.
8
6
  */
9
7
  export interface WebhookPayload {
10
8
  /** Monitor identifier. */
@@ -0,0 +1,16 @@
1
+ import * as core from "../core/index.js";
2
+ export declare namespace HeaderAuthProvider {
3
+ interface AuthOptions {
4
+ apiKey?: core.Supplier<string>;
5
+ }
6
+ interface Options extends AuthOptions {
7
+ }
8
+ }
9
+ export declare class HeaderAuthProvider implements core.AuthProvider {
10
+ private readonly headerValue;
11
+ constructor(options: HeaderAuthProvider.Options);
12
+ static canCreate(options: HeaderAuthProvider.Options): boolean;
13
+ getAuthRequest(_arg?: {
14
+ endpointMetadata?: core.EndpointMetadata;
15
+ }): Promise<core.AuthRequest>;
16
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
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
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.HeaderAuthProvider = void 0;
47
+ const core = __importStar(require("../core/index.js"));
48
+ const errors = __importStar(require("../errors/index.js"));
49
+ class HeaderAuthProvider {
50
+ constructor(options) {
51
+ this.headerValue = options.apiKey;
52
+ }
53
+ static canCreate(options) {
54
+ return options.apiKey != null;
55
+ }
56
+ getAuthRequest(_arg) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const apiKey = yield core.Supplier.get(this.headerValue);
59
+ if (apiKey == null) {
60
+ throw new errors.CatchAllApiError({
61
+ message: "Please specify a apiKey by passing it in to the constructor",
62
+ });
63
+ }
64
+ const headerValue = apiKey;
65
+ return {
66
+ headers: { "x-api-key": headerValue },
67
+ };
68
+ });
69
+ }
70
+ }
71
+ exports.HeaderAuthProvider = HeaderAuthProvider;
@@ -0,0 +1 @@
1
+ export { HeaderAuthProvider } from "./HeaderAuthProvider.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderAuthProvider = void 0;
4
+ var HeaderAuthProvider_js_1 = require("./HeaderAuthProvider.js");
5
+ Object.defineProperty(exports, "HeaderAuthProvider", { enumerable: true, get: function () { return HeaderAuthProvider_js_1.HeaderAuthProvider; } });
@@ -0,0 +1,7 @@
1
+ import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js";
2
+ import type { AuthRequest } from "./AuthRequest.js";
3
+ export interface AuthProvider {
4
+ getAuthRequest(arg?: {
5
+ endpointMetadata?: EndpointMetadata;
6
+ }): Promise<AuthRequest>;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request parameters for authentication requests.
3
+ */
4
+ export interface AuthRequest {
5
+ /**
6
+ * The headers to be included in the request.
7
+ */
8
+ headers: Record<string, string>;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface BasicAuth {
2
+ username: string;
3
+ password: string;
4
+ }
5
+ export declare const BasicAuth: {
6
+ toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
+ fromAuthorizationHeader: (header: string) => BasicAuth;
8
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicAuth = void 0;
4
+ const base64_js_1 = require("../base64.js");
5
+ const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
+ exports.BasicAuth = {
7
+ toAuthorizationHeader: (basicAuth) => {
8
+ if (basicAuth == null) {
9
+ return undefined;
10
+ }
11
+ const token = (0, base64_js_1.base64Encode)(`${basicAuth.username}:${basicAuth.password}`);
12
+ return `Basic ${token}`;
13
+ },
14
+ fromAuthorizationHeader: (header) => {
15
+ const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
16
+ const decoded = (0, base64_js_1.base64Decode)(credentials);
17
+ const [username, ...passwordParts] = decoded.split(":");
18
+ const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
19
+ if (username == null || password == null) {
20
+ throw new Error("Invalid basic auth");
21
+ }
22
+ return {
23
+ username,
24
+ password,
25
+ };
26
+ },
27
+ };
@@ -0,0 +1,7 @@
1
+ export type BearerToken = string;
2
+ declare function toAuthorizationHeader(token: string | undefined): string | undefined;
3
+ export declare const BearerToken: {
4
+ toAuthorizationHeader: typeof toAuthorizationHeader;
5
+ fromAuthorizationHeader: (header: string) => BearerToken;
6
+ };
7
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BearerToken = void 0;
4
+ const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
5
+ function toAuthorizationHeader(token) {
6
+ if (token == null) {
7
+ return undefined;
8
+ }
9
+ return `Bearer ${token}`;
10
+ }
11
+ exports.BearerToken = {
12
+ toAuthorizationHeader: toAuthorizationHeader,
13
+ fromAuthorizationHeader: (header) => {
14
+ return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
15
+ },
16
+ };
@@ -0,0 +1,5 @@
1
+ import type { AuthProvider } from "./AuthProvider.js";
2
+ import type { AuthRequest } from "./AuthRequest.js";
3
+ export declare class NoOpAuthProvider implements AuthProvider {
4
+ getAuthRequest(): Promise<AuthRequest>;
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoOpAuthProvider = void 0;
4
+ class NoOpAuthProvider {
5
+ getAuthRequest() {
6
+ return Promise.resolve({ headers: {} });
7
+ }
8
+ }
9
+ exports.NoOpAuthProvider = NoOpAuthProvider;
@@ -0,0 +1,5 @@
1
+ export type { AuthProvider } from "./AuthProvider.js";
2
+ export type { AuthRequest } from "./AuthRequest.js";
3
+ export { BasicAuth } from "./BasicAuth.js";
4
+ export { BearerToken } from "./BearerToken.js";
5
+ export { NoOpAuthProvider } from "./NoOpAuthProvider.js";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
4
+ var BasicAuth_js_1 = require("./BasicAuth.js");
5
+ Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
6
+ var BearerToken_js_1 = require("./BearerToken.js");
7
+ Object.defineProperty(exports, "BearerToken", { enumerable: true, get: function () { return BearerToken_js_1.BearerToken; } });
8
+ var NoOpAuthProvider_js_1 = require("./NoOpAuthProvider.js");
9
+ Object.defineProperty(exports, "NoOpAuthProvider", { enumerable: true, get: function () { return NoOpAuthProvider_js_1.NoOpAuthProvider; } });
@@ -0,0 +1,2 @@
1
+ export declare function base64Encode(input: string): string;
2
+ export declare function base64Decode(input: string): string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.base64Encode = base64Encode;
4
+ exports.base64Decode = base64Decode;
5
+ function base64ToBytes(base64) {
6
+ const binString = atob(base64);
7
+ return Uint8Array.from(binString, (m) => m.codePointAt(0));
8
+ }
9
+ function bytesToBase64(bytes) {
10
+ const binString = String.fromCodePoint(...bytes);
11
+ return btoa(binString);
12
+ }
13
+ function base64Encode(input) {
14
+ if (typeof Buffer !== "undefined") {
15
+ return Buffer.from(input, "utf8").toString("base64");
16
+ }
17
+ const bytes = new TextEncoder().encode(input);
18
+ return bytesToBase64(bytes);
19
+ }
20
+ function base64Decode(input) {
21
+ if (typeof Buffer !== "undefined") {
22
+ return Buffer.from(input, "base64").toString("utf8");
23
+ }
24
+ const bytes = base64ToBytes(input);
25
+ return new TextDecoder().decode(bytes);
26
+ }
@@ -1,20 +1,19 @@
1
- import type { ResponseWithBody } from "./ResponseWithBody.js";
2
1
  export type BinaryResponse = {
3
2
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
4
- bodyUsed: boolean;
3
+ bodyUsed: Response["bodyUsed"];
5
4
  /**
6
5
  * Returns a ReadableStream of the response body.
7
6
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body)
8
7
  */
9
- stream: () => ReadableStream<Uint8Array>;
8
+ stream: () => Response["body"];
10
9
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
11
- arrayBuffer: () => Promise<ArrayBuffer>;
10
+ arrayBuffer: () => ReturnType<Response["arrayBuffer"]>;
12
11
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
13
- blob: () => Promise<Blob>;
12
+ blob: () => ReturnType<Response["blob"]>;
14
13
  /**
15
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
16
15
  * Some versions of the Fetch API may not support this method.
17
16
  */
18
- bytes?(): Promise<Uint8Array>;
17
+ bytes?(): ReturnType<Response["bytes"]>;
19
18
  };
20
- export declare function getBinaryResponse(response: ResponseWithBody): BinaryResponse;
19
+ export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -22,7 +22,7 @@ export declare namespace Fetcher {
22
22
  fetchFn?: typeof fetch;
23
23
  logging?: LogConfig | Logger;
24
24
  }
25
- type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
25
+ type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError;
26
26
  interface FailedStatusCodeError {
27
27
  reason: "status-code";
28
28
  statusCode: number;
@@ -33,6 +33,10 @@ export declare namespace Fetcher {
33
33
  statusCode: number;
34
34
  rawBody: string;
35
35
  }
36
+ interface BodyIsNullError {
37
+ reason: "body-is-null";
38
+ statusCode: number;
39
+ }
36
40
  interface TimeoutError {
37
41
  reason: "timeout";
38
42
  }