@zerodot/apify 0.0.0-stage → 1.1.0

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 CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @zerodot/apify
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run Apify Actors and tasks, get runs, dataset items, and key-value store records, fetch web pages, and start a workflow when a run of an Actor or task ends. Use it for web scraping and data extraction.
4
+
5
+ ## Install
6
+
7
+ In zerodot, go to **System > Nodes** and install **Apify**.
8
+
9
+ Manual: install `@zerodot/apify` where the web app and the worker run, and add it to `ZERODOT_NODE_PACKAGES`.
10
+
11
+ ## Nodes
12
+
13
+ ### Apify (`apify.api`)
14
+
15
+ - **Actor**: run, run and get dataset, send Server Actor request, web fetch, get last run
16
+ - **Actor Run**: get, get many, get many for Actor, abort
17
+ - **Actor Task**: run, run and get dataset
18
+ - **Dataset**: get items
19
+ - **Key-Value Store**: get record
20
+
21
+ Set **Authentication** to **API Key** or **OAuth2**, then pick the credential of that type.
22
+
23
+ An Actor, a task, a run, a dataset, or a store is set by its ID. For an Actor or a task, `username~name` works too. For an Actor, a task, or a run, you can also paste a URL from Apify Console, and the node takes the ID from it.
24
+
25
+ - **Run** (Actor) starts the Actor with **Input JSON**. The input is a JSON object. Fields that you leave out use the defaults of the input schema of the Actor. **Wait for Finish** is on by default: the node reads the run until it ends (it can succeed or fail) and gives the run. When it is off, the node gives the run right after the start. The node waits at most the timeout of the run plus 5 minutes, or 24 hours when the run has no timeout.
26
+ - **Run and Get Dataset** always waits. It fails when the run does not end with the status `SUCCEEDED`. When it succeeds, it gives the items of the default dataset of the run, one item for each dataset item.
27
+ - **Timeout**, **Memory**, **Maximum Cost per Run (USD)**, and **Build Tag** go to the run. **Memory** is 1024 MB by default. For an Actor, the node looks up the build number of the **Build Tag** (or of the default build) before it starts the run.
28
+ - **Actor Task** has **Use Custom Body**. Off: the task runs with its saved input. On: **Input JSON** replaces the fields of the saved input.
29
+ - **Send Server Actor Request** sends one HTTP request to the server of an Actor that has a server interface (standby mode), without a run. Set **Method**, **Path**, **Query Parameters**, and **Body**. The node never sends this request twice, because it can cost money. The answer is `{ status, contentType, body }`. A binary answer is not supported. The token goes only to hosts that end with `.apify.actor`.
30
+ - **Web Fetch** gets one URL through the Web Fetch Actor. **Formats** are markdown (default), HTML, text, links, and raw. **Headers** are optional. The answer is the answer of the Actor.
31
+ - **Get Last Run** gets the last run of an Actor, with the **Status** filter (`SUCCEEDED` by default).
32
+ - **Get Many** (all runs of the account) and **Get Many for Actor** have **Offset**, **Limit** (50 by default), **Desc** (on by default, newest first), and **Status**. **Get Many** uses `SUCCEEDED` when **Status** is empty. **Get Many for Actor** uses all statuses.
33
+ - **Abort** stops a run. **Graceful** gives the Actor time to finish its current work.
34
+ - **Get Items** reads a dataset with **Offset**, **Limit**, and the **Fields** and **Omit** options (field names with commas between).
35
+ - **Get Record** gets the record of a key. JSON and text go in `data`. Other types go in the binary data `data`. The output also has `storeId`, `recordKey`, and `contentType`.
36
+
37
+ The node tries a call again after HTTP 429 and 5xx, with waits of 1, 2, 4, and 8 seconds (5 tries). It also tries a GET again after a network error. It never tries a POST again after a network error, so one run does not start two times. When Apify gives an error, the node fails with its message. An Actor that needs a permission approval gives the link to approve it.
38
+
39
+ Not in this node: the lists to pick an Actor or a store, and the input fields from the input schema of an Actor. Set the ID and write the input as JSON.
40
+
41
+ ### Apify Trigger (`trigger.apify`)
42
+
43
+ Starts a run when a run of an Actor or a task ends. Set **Resource to Watch** (**Actor** or **Task**), the **Actor** or the **Saved Tasks Name or ID**, and the **Event Type**:
44
+
45
+ - **Succeeded** (default), **Failed**, **Timed Out**, **Aborted**
46
+ - **Any**: all four events
47
+
48
+ When the workflow is published, the trigger makes the webhook at Apify (`POST /v2/webhooks`) with the Actor or task as the condition. When the workflow stops, the trigger removes the webhook. You do not set anything in Apify Console. The address of the trigger must be reachable from the internet.
49
+
50
+ The output is the body that Apify sends: `{ userId, createdAt, eventType, eventData, resource }`. `resource` is the run. The trigger ignores an event that you did not select.
51
+
52
+ Apify has no signature for webhooks. The address of the trigger has a secret token, so keep the address private.
53
+
54
+ ## Credential
55
+
56
+ - **Apify API key** (`apify.apiKey`): `apiKey` is an API token from **Apify Console > Settings > API & Integrations**. The token is secret. The **Test** button calls `GET /v2/users/me`.
57
+ - **Apify OAuth2** (`apify.oauth2`): sign in with an Apify account (authorization code with PKCE, scopes `profile` and `full_api_access`). It needs the `clientId` of an OAuth app. zerodot keeps and refreshes the tokens.
58
+
59
+ ## License
60
+
61
+ AGPL-3.0-only
package/apify.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M86.0214 0H147.727C148.982 0 150 1.01753 150 2.27273V96.5744C150 98.8332 147.062 99.7089 145.826 97.8188L84.1196 3.51714C83.1305 2.00559 84.215 0 86.0214 0Z" fill="#246DFF"/>
3
+ <path d="M63.9786 0H2.27273C1.01753 0 0 1.01753 0 2.27273V96.5744C0 98.8332 2.93774 99.7089 4.1745 97.8188L65.8804 3.51714C66.8695 2.00559 65.785 0 63.9786 0Z" fill="#20A34E"/>
4
+ <path d="M73.9429 75.5012L3.84485 146.126C2.42137 147.56 3.43724 150 5.45792 150H144.6C146.612 150 147.632 147.578 146.225 146.139L77.1811 75.5135C76.2942 74.6063 74.8365 74.6008 73.9429 75.5012Z" fill="#F86606"/>
5
+ </svg>