0.0.10 • Published 14 days ago

@jameender/apify-schema v0.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
14 days ago

Syntax

You should create a type named Input in your main.ts

The Typescript type definition should get picked up automatically, and then you can annotate the rest with JSDoc, like so

interface Input {
  /**
  * @name Name
  * @description Name of the Account
  * @prefill "John"
  */
  name: string

  /**
  * @name Role
  * @description Role of the account
  */
  role: 'admin' | 'normal'
}

const {
  // It can do defaults like so!
  role = 'admin'
} = (await Actor.getInput<Input>())!

Result:

{
    "type": "object",
    "properties": {
        "name": {
            "title": "Name",
            "description": "Name of the Account",
            "editor": "textfield",
            "prefill": "John",
            "type": "string"
        },
        "role": {
            "type": "string",
            "editor": "select",
            "title": "Role",
            "description": "Role of the account",
            "default": "admin",
            "enum": [
                "admin",
                "normal"
            ]
        }
    },
    "required": []
}

Usage

tsx ./index.ts print <folder_with_main.ts>

Or you can get help with

tsx ./index.ts help print
0.0.10

14 days ago

0.0.9

14 days ago

0.0.8

14 days ago

0.0.7

15 days ago

0.0.6

15 days ago

0.0.5

19 days ago

0.0.4

19 days ago

0.0.3

19 days ago

0.0.2

19 days ago

0.0.1

19 days ago