Skip to content

Commit 913e294

Browse files
MForiTC-MO
andauthored
docs: Secret object/array inputs (#1682)
Add notes about `isSecret` availability for `object`/`array` inputs. Context: apify/apify-shared-js#515 --------- Co-authored-by: Michał Olender <92638966+TC-MO@users.noreply.github.com>
1 parent 3f1dcaf commit 913e294

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

sources/platform/actors/development/actor_definition/input_schema/secret_input.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ The editor for this input field will then turn into a secret input, and when you
3737

3838
<img src={require("./images/secret-input-editor.png").default} alt="Secret input editor" style={{ width: '100%', maxWidth: '822px' }}/>
3939

40+
When you run the Actor through the API, the system automatically encrypts any input fields marked as secret before saving them to the Actor run's default key-value store.
41+
4042
:::note Type restriction
4143

42-
This is only available for `string` inputs, and the editor type is limited to `textfield` or `textarea`.
44+
This feature supports `string`, `object`, and `array` input types. Available editor types include:
45+
46+
- `hidden` (for any supported input type)
47+
- `textfield` and `textarea` (for string inputs)
48+
- `json` (for `object` and `array` inputs)
4349

4450
:::
4551

4652
## Read secret input fields
4753

48-
When you read the Actor input through `Actor.getInput()`, the encrypted fields are automatically decrypted (starting with the [`apify` package](https://www.npmjs.com/package/apify) version 3.1.0).
54+
When you read the Actor input through `Actor.getInput()`, the encrypted fields are automatically decrypted. Decryption of string fields is supported since [JavaScript SDK](http://docs.apify.loc/sdk/js/)3.1.0; support for objects and arrays was added in [JavaScript SDK](http://docs.apify.loc/sdk/js/) 3.4.2 and [Python SDK](http://docs.apify.loc/sdk/python/) 2.7.0.
4955

5056
<!-- eslint-skip -->
5157
```js

sources/platform/actors/development/actor_definition/input_schema/specification.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,16 @@ The user provides either a URL or uploads the file to a key-value store (existin
243243

244244
Properties:
245245

246-
| Property | Value | Required | Description |
247-
|----------|--------|-----------|-------------|
248-
| `editor` | One of:<br/>- `textfield`<br/>- `textarea`<br/>- `javascript`<br/>- `python`<br/>- `select`<br/>- `datepicker`<br/>- `fileupload`<br/>- `hidden` | Yes | Visual editor used for the input field. |
249-
| `pattern` | String | No | Regular expression that will be used to validate the input. If validation fails, the Actor will not run. |
250-
| `minLength` | Integer | No | Minimum length of the string. |
251-
| `maxLength` | Integer | No | Maximum length of the string. |
252-
| `enum` | [String] | Required if `editor` is `select` | Using this field, you can limit values to the given array of strings. Input will be displayed as select box. |
253-
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
254-
| `nullable` | Boolean | No | Specifies whether `null` is an allowed value. |
255-
| `isSecret` | Boolean | No | Specifies whether the input field will be stored encrypted. Only available with `textfield` and `textarea` editors. |
246+
| Property | Value | Required | Description |
247+
|----------|--------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
248+
| `editor` | One of:<br/>- `textfield`<br/>- `textarea`<br/>- `javascript`<br/>- `python`<br/>- `select`<br/>- `datepicker`<br/>- `fileupload`<br/>- `hidden` | Yes | Visual editor used for the input field. |
249+
| `pattern` | String | No | Regular expression that will be used to validate the input. If validation fails, the Actor will not run. |
250+
| `minLength` | Integer | No | Minimum length of the string. |
251+
| `maxLength` | Integer | No | Maximum length of the string. |
252+
| `enum` | [String] | Required if `editor` is `select` | Using this field, you can limit values to the given array of strings. Input will be displayed as select box. |
253+
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
254+
| `nullable` | Boolean | No | Specifies whether `null` is an allowed value. |
255+
| `isSecret` | Boolean | No | Specifies whether the input field will be stored encrypted. Only available with `textfield`, `textarea` and `hidden` editors. |
256256
| `dateType` | One of <ul><li>`absolute`</li><li>`relative`</li><li>`absoluteOrRelative`</li></ul> | No | This property, which is only available with `datepicker` editor, specifies what date format should visual editor accept (The JSON editor accepts any string without validation.).<br/><br/><ul><li>`absolute` value enables date input in `YYYY-MM-DD` format. To parse returned string regex like this can be used: `^(\d{4})-(0[1-9]\|1[0-2])-(0[1-9]\|[12]\d\|3[01])$`.</li><br/><li>`relative` value enables relative date input in <br/>`{number} {unit}` format. <br/>Supported units are: days, weeks, months, years.<br/><br/>The input is passed to the Actor as plain text (e.g., "3 weeks"). To parse it, regex like this can be used: `^(\d+)\s*(day\|week\|month\|year)s?$`.</li><br/><li>`absoluteOrRelative` value enables both absolute and relative formats and user can switch between them. It's up to Actor author to parse a determine actual used format - regexes above can be used to check whether the returned string match one of them.</li></ul><br/>Defaults to `absolute`. |
257257

258258
:::note Regex escape
@@ -393,14 +393,15 @@ Rendered input:
393393

394394
Properties:
395395

396-
| Property | Value | Required | Description |
397-
| --- | --- | --- | --- |
398-
| `editor` | One of <ul><li>`json`</li><li>`proxy`</li><li>`hidden`</li></ul> | Yes | UI editor used for input. |
399-
| `patternKey` | String | No | Regular expression that will be used <br/>to validate the keys of the object. |
400-
| `patternValue` | String | No | Regular expression that will be used <br/>to validate the values of object. |
401-
| `maxProperties` | Integer | No | Maximum number of properties <br/>the object can have. |
402-
| `minProperties` | Integer | No | Minimum number of properties <br/>the object can have. |
403-
| `nullable` | Boolean | No | Specifies whether null is <br/>an allowed value. |
396+
| Property | Value | Required | Description |
397+
| --- | --- | --- |--------------------------------------------------------------------------------------------------------------|
398+
| `editor` | One of <ul><li>`json`</li><li>`proxy`</li><li>`hidden`</li></ul> | Yes | UI editor used for input. |
399+
| `patternKey` | String | No | Regular expression that will be used <br/>to validate the keys of the object. |
400+
| `patternValue` | String | No | Regular expression that will be used <br/>to validate the values of object. |
401+
| `maxProperties` | Integer | No | Maximum number of properties <br/>the object can have. |
402+
| `minProperties` | Integer | No | Minimum number of properties <br/>the object can have. |
403+
| `nullable` | Boolean | No | Specifies whether null is <br/>an allowed value. |
404+
| `isSecret` | Boolean | No | Specifies whether the input field will be stored encrypted. Only available with `json` and `hidden` editors. |
404405

405406
### Array
406407

@@ -450,6 +451,7 @@ Properties:
450451
| `uniqueItems` | Boolean | No | Specifies whether the array <br/>should contain only unique values. |
451452
| `nullable` | Boolean | No | Specifies whether null is <br/>an allowed value. |
452453
| `items` | object | No | Specifies format of the items of the array, useful mainly for multiselect (see below) |
454+
| `isSecret` | Boolean | No | Specifies whether the input field will be stored encrypted. Only available with `json` and `hidden` editors. |
453455

454456

455457
Usage of this field is based on the selected editor:

0 commit comments

Comments
 (0)