apify-client 3.0.0-beta.1 → 3.0.0-beta.100
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 +21 -5
- package/dist/apify_api_error.d.ts +64 -22
- package/dist/apify_api_error.js +100 -30
- package/dist/apify_client.d.ts +150 -35
- package/dist/apify_client.js +198 -118
- package/dist/apify_client_error.d.ts +10 -0
- package/dist/apify_client_error.js +10 -0
- package/dist/base/api_client.d.ts +9 -9
- package/dist/base/api_client.js +41 -45
- package/dist/base/resource_client.d.ts +24 -10
- package/dist/base/resource_client.js +78 -48
- package/dist/base/resource_collection_client.d.ts +15 -6
- package/dist/base/resource_collection_client.js +40 -21
- package/dist/body_parser.d.ts +3 -4
- package/dist/body_parser.js +20 -32
- package/dist/bundle.js +47 -52
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +3363 -1185
- package/dist/generated/api.js +1 -2
- package/dist/generated/schemas.d.ts +8146 -0
- package/dist/generated/schemas.js +1866 -0
- package/dist/http_clients/axios.d.ts +61 -0
- package/dist/http_clients/axios.js +119 -0
- package/dist/http_clients/base.d.ts +391 -0
- package/dist/http_clients/base.js +650 -0
- package/dist/http_clients/index.d.ts +4 -0
- package/dist/http_clients/index.js +2 -0
- package/dist/http_compressors/base.d.ts +40 -0
- package/dist/http_compressors/base.js +9 -0
- package/dist/http_compressors/brotli.d.ts +33 -0
- package/dist/http_compressors/brotli.js +39 -0
- package/dist/http_compressors/gzip.d.ts +33 -0
- package/dist/http_compressors/gzip.js +39 -0
- package/dist/http_compressors/index.d.ts +8 -0
- package/dist/http_compressors/index.js +3 -0
- package/dist/http_compressors/resolve.d.ts +24 -0
- package/dist/http_compressors/resolve.js +30 -0
- package/dist/http_compressors/zstd.d.ts +34 -0
- package/dist/http_compressors/zstd.js +43 -0
- package/dist/index.d.ts +38 -32
- package/dist/index.js +36 -36
- package/dist/invalid_response_body_error.d.ts +14 -0
- package/dist/invalid_response_body_error.js +18 -0
- package/dist/lazy_schema.d.ts +8 -0
- package/dist/lazy_schema.js +11 -0
- package/dist/models.d.ts +196 -278
- package/dist/models.js +14 -15
- package/dist/resource_clients/actor.d.ts +115 -45
- package/dist/resource_clients/actor.js +187 -116
- package/dist/resource_clients/actor_collection.d.ts +21 -17
- package/dist/resource_clients/actor_collection.js +26 -21
- package/dist/resource_clients/actor_env_var.d.ts +13 -6
- package/dist/resource_clients/actor_env_var.js +21 -14
- package/dist/resource_clients/actor_env_var_collection.d.ts +18 -22
- package/dist/resource_clients/actor_env_var_collection.js +23 -20
- package/dist/resource_clients/actor_server.d.ts +149 -0
- package/dist/resource_clients/actor_server.js +199 -0
- package/dist/resource_clients/actor_version.d.ts +30 -10
- package/dist/resource_clients/actor_version.js +29 -23
- package/dist/resource_clients/actor_version_collection.d.ts +20 -21
- package/dist/resource_clients/actor_version_collection.js +25 -20
- package/dist/resource_clients/build.d.ts +24 -11
- package/dist/resource_clients/build.js +43 -26
- package/dist/resource_clients/build_collection.d.ts +10 -8
- package/dist/resource_clients/build_collection.js +13 -13
- package/dist/resource_clients/dataset.d.ts +87 -40
- package/dist/resource_clients/dataset.js +159 -175
- package/dist/resource_clients/dataset_collection.d.ts +13 -9
- package/dist/resource_clients/dataset_collection.js +29 -21
- package/dist/resource_clients/key_value_store.d.ts +110 -28
- package/dist/resource_clients/key_value_store.js +177 -99
- package/dist/resource_clients/key_value_store_collection.d.ts +13 -9
- package/dist/resource_clients/key_value_store_collection.js +29 -21
- package/dist/resource_clients/log.d.ts +42 -23
- package/dist/resource_clients/log.js +156 -85
- package/dist/resource_clients/request_queue.d.ts +77 -38
- package/dist/resource_clients/request_queue.js +251 -172
- package/dist/resource_clients/request_queue_collection.d.ts +12 -8
- package/dist/resource_clients/request_queue_collection.js +23 -20
- package/dist/resource_clients/run.d.ts +134 -34
- package/dist/resource_clients/run.js +225 -84
- package/dist/resource_clients/run_collection.d.ts +8 -6
- package/dist/resource_clients/run_collection.js +18 -18
- package/dist/resource_clients/schedule.d.ts +20 -11
- package/dist/resource_clients/schedule.js +36 -30
- package/dist/resource_clients/schedule_collection.d.ts +10 -6
- package/dist/resource_clients/schedule_collection.js +20 -17
- package/dist/resource_clients/store_collection.d.ts +9 -7
- package/dist/resource_clients/store_collection.js +18 -18
- package/dist/resource_clients/task.d.ts +44 -21
- package/dist/resource_clients/task.js +116 -86
- package/dist/resource_clients/task_collection.d.ts +13 -9
- package/dist/resource_clients/task_collection.js +19 -16
- package/dist/resource_clients/user.d.ts +22 -13
- package/dist/resource_clients/user.js +46 -47
- package/dist/resource_clients/webhook.d.ts +21 -12
- package/dist/resource_clients/webhook.js +35 -30
- package/dist/resource_clients/webhook_collection.d.ts +11 -7
- package/dist/resource_clients/webhook_collection.js +20 -17
- package/dist/resource_clients/webhook_dispatch.d.ts +9 -6
- package/dist/resource_clients/webhook_dispatch.js +11 -10
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +7 -5
- package/dist/resource_clients/webhook_dispatch_collection.js +13 -13
- package/dist/response_validation_error.d.ts +27 -0
- package/dist/response_validation_error.js +38 -0
- package/dist/runtime/node.d.ts +6 -0
- package/dist/runtime/node.js +87 -0
- package/dist/runtime/types.d.ts +60 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/web.d.ts +5 -0
- package/dist/runtime/web.js +21 -0
- package/dist/schemas.d.ts +381 -0
- package/dist/schemas.js +37 -0
- package/dist/statistics.d.ts +1 -6
- package/dist/statistics.js +7 -11
- package/dist/timeouts.d.ts +84 -0
- package/dist/timeouts.js +37 -0
- package/dist/timezones.d.ts +1 -1
- package/dist/timezones.js +1 -2
- package/dist/utils.d.ts +99 -70
- package/dist/utils.js +251 -229
- package/dist/wait_for_resources.d.ts +8 -0
- package/dist/wait_for_resources.js +39 -0
- package/package.json +48 -47
- package/dist/argument_validation_error.d.ts +0 -17
- package/dist/argument_validation_error.js +0 -157
- package/dist/http_client.d.ts +0 -88
- package/dist/http_client.js +0 -260
- package/dist/index.mjs +0 -42
- package/dist/interceptors.d.ts +0 -19
- package/dist/interceptors.js +0 -110
package/dist/index.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import mod from "./index.js";
|
|
2
|
-
|
|
3
|
-
export default mod;
|
|
4
|
-
export const ActorClient = mod.ActorClient;
|
|
5
|
-
export const ActorCollectionClient = mod.ActorCollectionClient;
|
|
6
|
-
export const ActorEnvVarClient = mod.ActorEnvVarClient;
|
|
7
|
-
export const ActorEnvVarCollectionClient = mod.ActorEnvVarCollectionClient;
|
|
8
|
-
export const ActorListSortBy = mod.ActorListSortBy;
|
|
9
|
-
export const ActorSourceType = mod.ActorSourceType;
|
|
10
|
-
export const ActorVersionClient = mod.ActorVersionClient;
|
|
11
|
-
export const ActorVersionCollectionClient = mod.ActorVersionCollectionClient;
|
|
12
|
-
export const ApifyApiError = mod.ApifyApiError;
|
|
13
|
-
export const ApifyClient = mod.ApifyClient;
|
|
14
|
-
export const ArgumentValidationError = mod.ArgumentValidationError;
|
|
15
|
-
export const BuildClient = mod.BuildClient;
|
|
16
|
-
export const BuildCollectionClient = mod.BuildCollectionClient;
|
|
17
|
-
export const DatasetClient = mod.DatasetClient;
|
|
18
|
-
export const DatasetCollectionClient = mod.DatasetCollectionClient;
|
|
19
|
-
export const DownloadItemsFormat = mod.DownloadItemsFormat;
|
|
20
|
-
export const InvalidResponseBodyError = mod.InvalidResponseBodyError;
|
|
21
|
-
export const KeyValueStoreClient = mod.KeyValueStoreClient;
|
|
22
|
-
export const KeyValueStoreCollectionClient = mod.KeyValueStoreCollectionClient;
|
|
23
|
-
export const LogClient = mod.LogClient;
|
|
24
|
-
export const LoggerActorRedirect = mod.LoggerActorRedirect;
|
|
25
|
-
export const PlatformFeature = mod.PlatformFeature;
|
|
26
|
-
export const RequestQueueClient = mod.RequestQueueClient;
|
|
27
|
-
export const RequestQueueCollectionClient = mod.RequestQueueCollectionClient;
|
|
28
|
-
export const RunClient = mod.RunClient;
|
|
29
|
-
export const RunCollectionClient = mod.RunCollectionClient;
|
|
30
|
-
export const ScheduleActions = mod.ScheduleActions;
|
|
31
|
-
export const ScheduleClient = mod.ScheduleClient;
|
|
32
|
-
export const ScheduleCollectionClient = mod.ScheduleCollectionClient;
|
|
33
|
-
export const StoreCollectionClient = mod.StoreCollectionClient;
|
|
34
|
-
export const StreamedLog = mod.StreamedLog;
|
|
35
|
-
export const TaskClient = mod.TaskClient;
|
|
36
|
-
export const TaskCollectionClient = mod.TaskCollectionClient;
|
|
37
|
-
export const UserClient = mod.UserClient;
|
|
38
|
-
export const WebhookClient = mod.WebhookClient;
|
|
39
|
-
export const WebhookCollectionClient = mod.WebhookCollectionClient;
|
|
40
|
-
export const WebhookDispatchClient = mod.WebhookDispatchClient;
|
|
41
|
-
export const WebhookDispatchCollectionClient = mod.WebhookDispatchCollectionClient;
|
|
42
|
-
export const WebhookDispatchStatus = mod.WebhookDispatchStatus;
|
package/dist/interceptors.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AxiosInterceptorManager, AxiosResponse } from 'axios';
|
|
2
|
-
import type { ApifyRequestConfig, ApifyResponse } from './http_client';
|
|
3
|
-
/**
|
|
4
|
-
* This error exists for the quite common situation, where only a partial JSON response is received and
|
|
5
|
-
* an attempt to parse the JSON throws an error. In most cases this can be resolved by retrying the
|
|
6
|
-
* request. We do that by identifying this error in HttpClient.
|
|
7
|
-
*
|
|
8
|
-
* The properties mimic AxiosError for easier integration in HttpClient error handling.
|
|
9
|
-
*/
|
|
10
|
-
export declare class InvalidResponseBodyError extends Error {
|
|
11
|
-
code: string;
|
|
12
|
-
response: AxiosResponse;
|
|
13
|
-
cause: Error;
|
|
14
|
-
constructor(response: AxiosResponse, cause: Error);
|
|
15
|
-
}
|
|
16
|
-
export type RequestInterceptorFunction = Parameters<AxiosInterceptorManager<ApifyRequestConfig>['use']>[0];
|
|
17
|
-
export type ResponseInterceptorFunction = Parameters<AxiosInterceptorManager<ApifyResponse>['use']>[0];
|
|
18
|
-
export declare const requestInterceptors: RequestInterceptorFunction[];
|
|
19
|
-
export declare const responseInterceptors: ResponseInterceptorFunction[];
|
package/dist/interceptors.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.responseInterceptors = exports.requestInterceptors = exports.InvalidResponseBodyError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const axios_1 = tslib_1.__importStar(require("axios"));
|
|
6
|
-
const content_type_1 = tslib_1.__importDefault(require("content-type"));
|
|
7
|
-
const body_parser_1 = require("./body_parser");
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
/**
|
|
10
|
-
* This error exists for the quite common situation, where only a partial JSON response is received and
|
|
11
|
-
* an attempt to parse the JSON throws an error. In most cases this can be resolved by retrying the
|
|
12
|
-
* request. We do that by identifying this error in HttpClient.
|
|
13
|
-
*
|
|
14
|
-
* The properties mimic AxiosError for easier integration in HttpClient error handling.
|
|
15
|
-
*/
|
|
16
|
-
class InvalidResponseBodyError extends Error {
|
|
17
|
-
code;
|
|
18
|
-
response;
|
|
19
|
-
constructor(response, cause) {
|
|
20
|
-
super(`Response body could not be parsed.\nCause:${cause.message}`);
|
|
21
|
-
this.name = this.constructor.name;
|
|
22
|
-
this.code = 'invalid-response-body';
|
|
23
|
-
this.response = response;
|
|
24
|
-
this.cause = cause;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.InvalidResponseBodyError = InvalidResponseBodyError;
|
|
28
|
-
function serializeRequest(config) {
|
|
29
|
-
const [defaultTransform] = axios_1.default.defaults.transformRequest;
|
|
30
|
-
// The function not only serializes data, but it also adds correct headers.
|
|
31
|
-
const data = defaultTransform(config.data, config.headers);
|
|
32
|
-
// Actor inputs can include functions and we don't want to omit those,
|
|
33
|
-
// because it's convenient for users. JSON.stringify removes them.
|
|
34
|
-
// It's a bit inefficient that we serialize the JSON twice, but I feel
|
|
35
|
-
// it's a small price to pay. The axios default transform does a lot
|
|
36
|
-
// of body type checks and we would have to copy all of them to the resource clients.
|
|
37
|
-
if (config.stringifyFunctions) {
|
|
38
|
-
const contentTypeHeader = config.headers?.['Content-Type'] || config.headers?.['content-type'];
|
|
39
|
-
try {
|
|
40
|
-
const { type } = content_type_1.default.parse(contentTypeHeader);
|
|
41
|
-
if (type === 'application/json' && typeof config.data === 'object') {
|
|
42
|
-
config.data = stringifyWithFunctions(config.data);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
config.data = data;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
config.data = data;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
config.data = data;
|
|
54
|
-
}
|
|
55
|
-
return config;
|
|
56
|
-
}
|
|
57
|
-
function ensureHeadersPrototype(config) {
|
|
58
|
-
if (config.headers && !(config.headers instanceof axios_1.AxiosHeaders)) {
|
|
59
|
-
Object.setPrototypeOf(config.headers, axios_1.AxiosHeaders.prototype);
|
|
60
|
-
}
|
|
61
|
-
return config;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* JSON.stringify() that serializes functions to string instead
|
|
65
|
-
* of replacing them with null or removing them.
|
|
66
|
-
*/
|
|
67
|
-
function stringifyWithFunctions(obj) {
|
|
68
|
-
return JSON.stringify(obj, (_key, value) => {
|
|
69
|
-
return typeof value === 'function' ? value.toString() : value;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
async function maybeCompressRequest(config) {
|
|
73
|
-
if (config.headers?.['content-encoding'])
|
|
74
|
-
return config;
|
|
75
|
-
const maybeCompressed = await (0, utils_1.maybeCompressValue)(config.data);
|
|
76
|
-
if (maybeCompressed) {
|
|
77
|
-
config.headers ??= {};
|
|
78
|
-
config.headers['content-encoding'] = maybeCompressed.encoding;
|
|
79
|
-
config.data = maybeCompressed.data;
|
|
80
|
-
}
|
|
81
|
-
return config;
|
|
82
|
-
}
|
|
83
|
-
function parseResponseData(response) {
|
|
84
|
-
if (!response.data || // Nothing to do here.
|
|
85
|
-
response.config.responseType !== 'arraybuffer' || // We don't want to parse custom response types.
|
|
86
|
-
response.config.forceBuffer // Apify custom property to prevent parsing of buffer.
|
|
87
|
-
) {
|
|
88
|
-
return response;
|
|
89
|
-
}
|
|
90
|
-
const isBufferEmpty = (0, utils_1.isNode)() ? !response.data.length : !response.data.byteLength;
|
|
91
|
-
if (isBufferEmpty) {
|
|
92
|
-
// undefined is better than an empty buffer
|
|
93
|
-
response.data = undefined;
|
|
94
|
-
return response;
|
|
95
|
-
}
|
|
96
|
-
const contentTypeHeader = response.headers['content-type'];
|
|
97
|
-
try {
|
|
98
|
-
response.data = (0, body_parser_1.maybeParseBody)(response.data, contentTypeHeader);
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
throw new InvalidResponseBodyError(response, err);
|
|
102
|
-
}
|
|
103
|
-
return response;
|
|
104
|
-
}
|
|
105
|
-
exports.requestInterceptors = [
|
|
106
|
-
maybeCompressRequest,
|
|
107
|
-
serializeRequest,
|
|
108
|
-
ensureHeadersPrototype,
|
|
109
|
-
];
|
|
110
|
-
exports.responseInterceptors = [parseResponseData];
|