apify-client 2.23.5-beta.19 → 2.23.5-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +57 -4
- package/dist/bundle.js.map +1 -1
- package/dist/resource_clients/actor.d.ts +48 -0
- package/dist/resource_clients/actor.js +54 -3
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -13419,9 +13419,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13419
13419
|
params: this._params(params),
|
|
13420
13420
|
// Apify internal property. Tells the request serialization interceptor
|
|
13421
13421
|
// to stringify functions to JSON, instead of omitting them.
|
|
13422
|
-
// TODO: remove this ts-expect-error once we migrate HttpClient to TS and define Apify
|
|
13423
|
-
// extension of Axios configs
|
|
13424
|
-
// @ts-expect-error Apify extension
|
|
13425
13422
|
stringifyFunctions: true
|
|
13426
13423
|
};
|
|
13427
13424
|
if (options.contentType) {
|
|
@@ -13501,6 +13498,62 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13501
13498
|
await streamedLog?.stop();
|
|
13502
13499
|
});
|
|
13503
13500
|
}
|
|
13501
|
+
/**
|
|
13502
|
+
* Validates the provided input for the Actor against its input schema.
|
|
13503
|
+
*
|
|
13504
|
+
* Sends the input to the API, which validates it against the Actor's input schema without
|
|
13505
|
+
* starting a run. If the input is valid, the method resolves with `true`. If the input is
|
|
13506
|
+
* invalid, the API responds with an error that is thrown as an `ApifyApiError` describing the
|
|
13507
|
+
* validation problem.
|
|
13508
|
+
*
|
|
13509
|
+
* @param input - Input to validate against the Actor's input schema. Can be any JSON-serializable
|
|
13510
|
+
* value (object, array, string, number). If `contentType` is specified in options,
|
|
13511
|
+
* input should be a string or Buffer.
|
|
13512
|
+
* @param options - Validation options
|
|
13513
|
+
* @param options.build - Tag or number of the build whose input schema the input is validated against
|
|
13514
|
+
* (e.g., `'latest'` or `'1.2.345'`). If not provided, uses the default build.
|
|
13515
|
+
* @param options.contentType - Content type of the input. If specified, input must be a string or Buffer.
|
|
13516
|
+
* @returns `true` if the input is valid. Invalid input causes the underlying API call to throw an `ApifyApiError`.
|
|
13517
|
+
* @see https://docs.apify.com/api/v2/act-input-validate-post
|
|
13518
|
+
*
|
|
13519
|
+
* @example
|
|
13520
|
+
* ```javascript
|
|
13521
|
+
* // Validate input against the default build's input schema
|
|
13522
|
+
* const isValid = await client.actor('my-actor').validateInput({ url: 'https://example.com' });
|
|
13523
|
+
*
|
|
13524
|
+
* // Validate against a specific build
|
|
13525
|
+
* const isValid = await client.actor('my-actor').validateInput(
|
|
13526
|
+
* { url: 'https://example.com' },
|
|
13527
|
+
* { build: 'beta' },
|
|
13528
|
+
* );
|
|
13529
|
+
* ```
|
|
13530
|
+
*/ async validateInput(input) {
|
|
13531
|
+
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
13532
|
+
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
13533
|
+
// then it will process input as a buffer.
|
|
13534
|
+
ow__rspack_import_11_default()(options, ow__rspack_import_11_default().object.exactShape({
|
|
13535
|
+
build: (ow__rspack_import_11_default().optional.string),
|
|
13536
|
+
contentType: (ow__rspack_import_11_default().optional.string)
|
|
13537
|
+
}));
|
|
13538
|
+
const request = {
|
|
13539
|
+
url: this._url('validate-input'),
|
|
13540
|
+
method: 'POST',
|
|
13541
|
+
data: input,
|
|
13542
|
+
params: this._params({
|
|
13543
|
+
build: options.build
|
|
13544
|
+
}),
|
|
13545
|
+
// Apify internal property. Tells the request serialization interceptor
|
|
13546
|
+
// to stringify functions to JSON, instead of omitting them.
|
|
13547
|
+
stringifyFunctions: true
|
|
13548
|
+
};
|
|
13549
|
+
if (options.contentType) {
|
|
13550
|
+
request.headers = {
|
|
13551
|
+
'content-type': options.contentType
|
|
13552
|
+
};
|
|
13553
|
+
}
|
|
13554
|
+
const response = await this.httpClient.call(request);
|
|
13555
|
+
return response.data.valid;
|
|
13556
|
+
}
|
|
13504
13557
|
/**
|
|
13505
13558
|
* Builds the Actor.
|
|
13506
13559
|
*
|
|
@@ -18031,7 +18084,7 @@ function isStream(value) {
|
|
|
18031
18084
|
function getVersionData() {
|
|
18032
18085
|
if (true) {
|
|
18033
18086
|
return {
|
|
18034
|
-
version: "2.23.5-beta.
|
|
18087
|
+
version: "2.23.5-beta.20"
|
|
18035
18088
|
};
|
|
18036
18089
|
}
|
|
18037
18090
|
// eslint-disable-next-line
|