apify-client 3.0.0-beta.1 → 3.0.0-beta.3
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 +2 -2
- package/dist/apify_api_error.js +5 -9
- package/dist/apify_client.d.ts +27 -27
- package/dist/apify_client.js +86 -91
- package/dist/base/api_client.d.ts +3 -3
- package/dist/base/api_client.js +6 -10
- package/dist/base/resource_client.d.ts +1 -1
- package/dist/base/resource_client.js +14 -18
- package/dist/base/resource_collection_client.d.ts +2 -2
- package/dist/base/resource_collection_client.js +6 -10
- package/dist/body_parser.js +6 -11
- package/dist/bundle.js +35 -47
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.js +1 -2
- package/dist/http_client.d.ts +2 -2
- package/dist/http_client.js +23 -28
- package/dist/index.d.ts +32 -32
- package/dist/index.js +31 -36
- package/dist/interceptors.d.ts +1 -1
- package/dist/interceptors.js +14 -19
- package/dist/models.d.ts +3 -3
- package/dist/models.js +8 -11
- package/dist/resource_clients/actor.d.ts +13 -13
- package/dist/resource_clients/actor.js +67 -71
- package/dist/resource_clients/actor_collection.d.ts +7 -7
- package/dist/resource_clients/actor_collection.js +14 -18
- package/dist/resource_clients/actor_env_var.d.ts +3 -3
- package/dist/resource_clients/actor_env_var.js +4 -8
- package/dist/resource_clients/actor_env_var_collection.d.ts +4 -4
- package/dist/resource_clients/actor_env_var_collection.js +5 -9
- package/dist/resource_clients/actor_version.d.ts +7 -7
- package/dist/resource_clients/actor_version.js +12 -17
- package/dist/resource_clients/actor_version_collection.d.ts +4 -4
- package/dist/resource_clients/actor_version_collection.js +5 -9
- package/dist/resource_clients/build.d.ts +5 -5
- package/dist/resource_clients/build.js +11 -15
- package/dist/resource_clients/build_collection.d.ts +5 -5
- package/dist/resource_clients/build_collection.js +8 -12
- package/dist/resource_clients/dataset.d.ts +5 -5
- package/dist/resource_clients/dataset.js +72 -76
- package/dist/resource_clients/dataset_collection.d.ts +4 -4
- package/dist/resource_clients/dataset_collection.js +15 -19
- package/dist/resource_clients/key_value_store.d.ts +4 -4
- package/dist/resource_clients/key_value_store.js +57 -62
- package/dist/resource_clients/key_value_store_collection.d.ts +4 -4
- package/dist/resource_clients/key_value_store_collection.js +15 -19
- package/dist/resource_clients/log.d.ts +2 -2
- package/dist/resource_clients/log.js +15 -22
- package/dist/resource_clients/request_queue.d.ts +4 -4
- package/dist/resource_clients/request_queue.js +91 -96
- package/dist/resource_clients/request_queue_collection.d.ts +4 -4
- package/dist/resource_clients/request_queue_collection.js +13 -17
- package/dist/resource_clients/run.d.ts +8 -8
- package/dist/resource_clients/run.js +46 -50
- package/dist/resource_clients/run_collection.d.ts +4 -4
- package/dist/resource_clients/run_collection.js +13 -17
- package/dist/resource_clients/schedule.d.ts +6 -6
- package/dist/resource_clients/schedule.js +7 -12
- package/dist/resource_clients/schedule_collection.d.ts +4 -4
- package/dist/resource_clients/schedule_collection.js +10 -14
- package/dist/resource_clients/store_collection.d.ts +5 -5
- package/dist/resource_clients/store_collection.js +13 -17
- package/dist/resource_clients/task.d.ts +9 -9
- package/dist/resource_clients/task.js +44 -48
- package/dist/resource_clients/task_collection.d.ts +6 -6
- package/dist/resource_clients/task_collection.js +9 -13
- package/dist/resource_clients/user.d.ts +5 -5
- package/dist/resource_clients/user.js +8 -13
- package/dist/resource_clients/webhook.d.ts +6 -6
- package/dist/resource_clients/webhook.js +8 -12
- package/dist/resource_clients/webhook_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_collection.js +10 -14
- package/dist/resource_clients/webhook_dispatch.d.ts +5 -5
- package/dist/resource_clients/webhook_dispatch.js +3 -8
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_dispatch_collection.js +8 -12
- package/dist/statistics.js +5 -9
- package/dist/timezones.js +1 -2
- package/dist/utils.d.ts +5 -13
- package/dist/utils.js +30 -69
- package/package.json +10 -12
- package/dist/argument_validation_error.d.ts +0 -17
- package/dist/argument_validation_error.js +0 -157
- package/dist/index.mjs +0 -42
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ResourceCollectionClient = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const api_client_1 = require("./api_client");
|
|
1
|
+
import { parseDateFields, pluckData } from '../utils.js';
|
|
2
|
+
import { ApiClient } from './api_client.js';
|
|
6
3
|
/**
|
|
7
4
|
* Resource collection client.
|
|
8
5
|
* @private
|
|
9
6
|
*/
|
|
10
|
-
class ResourceCollectionClient extends
|
|
7
|
+
export class ResourceCollectionClient extends ApiClient {
|
|
11
8
|
/**
|
|
12
9
|
* @private
|
|
13
10
|
*/
|
|
@@ -17,7 +14,7 @@ class ResourceCollectionClient extends api_client_1.ApiClient {
|
|
|
17
14
|
method: 'GET',
|
|
18
15
|
params: this._params(options),
|
|
19
16
|
});
|
|
20
|
-
return
|
|
17
|
+
return parseDateFields(pluckData(response.data));
|
|
21
18
|
}
|
|
22
19
|
/**
|
|
23
20
|
* Returns async iterator to iterate through all items and Promise that can be awaited to get first page of results.
|
|
@@ -32,7 +29,7 @@ class ResourceCollectionClient extends api_client_1.ApiClient {
|
|
|
32
29
|
params: this._params(),
|
|
33
30
|
data: resource,
|
|
34
31
|
});
|
|
35
|
-
return
|
|
32
|
+
return parseDateFields(pluckData(response.data));
|
|
36
33
|
}
|
|
37
34
|
async _getOrCreate(name, resource) {
|
|
38
35
|
const response = await this.httpClient.call({
|
|
@@ -41,7 +38,6 @@ class ResourceCollectionClient extends api_client_1.ApiClient {
|
|
|
41
38
|
params: this._params({ name }),
|
|
42
39
|
data: resource,
|
|
43
40
|
});
|
|
44
|
-
return
|
|
41
|
+
return parseDateFields(pluckData(response.data));
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
exports.ResourceCollectionClient = ResourceCollectionClient;
|
package/dist/body_parser.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.maybeParseBody = maybeParseBody;
|
|
4
|
-
exports.isomorphicBufferToString = isomorphicBufferToString;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const content_type_1 = tslib_1.__importDefault(require("content-type"));
|
|
7
|
-
const utils_1 = require("./utils");
|
|
1
|
+
import contentTypeParser from 'content-type';
|
|
2
|
+
import { isNode } from './utils.js';
|
|
8
3
|
const CONTENT_TYPE_JSON = 'application/json';
|
|
9
4
|
const STRINGIFIABLE_CONTENT_TYPE_RXS = [new RegExp(`^${CONTENT_TYPE_JSON}`, 'i'), /^application\/.*xml$/i, /^text\//i];
|
|
10
5
|
/**
|
|
@@ -17,11 +12,11 @@ const STRINGIFIABLE_CONTENT_TYPE_RXS = [new RegExp(`^${CONTENT_TYPE_JSON}`, 'i')
|
|
|
17
12
|
* If the header includes a charset, the body will be stringified only
|
|
18
13
|
* if the charset represents a known encoding to Node.js or Browser.
|
|
19
14
|
*/
|
|
20
|
-
function maybeParseBody(body, contentTypeHeader) {
|
|
15
|
+
export function maybeParseBody(body, contentTypeHeader) {
|
|
21
16
|
let contentType;
|
|
22
17
|
let charset;
|
|
23
18
|
try {
|
|
24
|
-
const result =
|
|
19
|
+
const result = contentTypeParser.parse(contentTypeHeader);
|
|
25
20
|
contentType = result.type;
|
|
26
21
|
charset = result.parameters.charset;
|
|
27
22
|
}
|
|
@@ -36,7 +31,7 @@ function maybeParseBody(body, contentTypeHeader) {
|
|
|
36
31
|
const dataString = isomorphicBufferToString(body, charset);
|
|
37
32
|
return contentType === CONTENT_TYPE_JSON ? JSON.parse(dataString) : dataString;
|
|
38
33
|
}
|
|
39
|
-
function isomorphicBufferToString(buffer, encoding) {
|
|
34
|
+
export function isomorphicBufferToString(buffer, encoding) {
|
|
40
35
|
if (buffer.constructor.name !== ArrayBuffer.name) {
|
|
41
36
|
return buffer.toString(encoding);
|
|
42
37
|
}
|
|
@@ -47,7 +42,7 @@ function isomorphicBufferToString(buffer, encoding) {
|
|
|
47
42
|
function isCharsetStringifiable(charset) {
|
|
48
43
|
if (!charset)
|
|
49
44
|
return true; // hope that it's utf-8
|
|
50
|
-
if (
|
|
45
|
+
if (isNode())
|
|
51
46
|
return Buffer.isEncoding(charset);
|
|
52
47
|
const normalizedCharset = charset.toLowerCase().replace('-', '');
|
|
53
48
|
// Browsers only support decoding utf-8 buffers.
|