move archive and add more methods & vars info

This commit is contained in:
Deborah Barnard 2022-08-31 13:31:46 +01:00
parent 31ece89614
commit 98490fb8d9
7 changed files with 31 additions and 59 deletions

View File

@ -0,0 +1,12 @@
# $workflow
Gives information about the current workflow.
```js
// Boolean. Whether the workflow is active (true) or not (false)
{{$workflow.active}}
// Number. The workflow ID.
{{$workflow.id}}
// String. The workflow name.
{{$workflow.name}}
```

View File

@ -11,10 +11,10 @@ For usage examples, refer to [Expressions examples](/code-examples/expressions/m
| ------ | ----------- | ------------ |
| `$binary` | Shorthand for `$input.item.binary`. Incoming binary data from a node | Expressions editor |
| `$data` | Incoming raw data from a node. | Both |
| `$input.item` | The paired item. [TODO: explain what this is] | Expressions editor |
| `$input.all()` | | Both |
| `$input.first()` | | Both |
| `$input.last()` | | Both |
| `$input.item` | The paired item. This is the input item that the previous node used to produce this item. Refer to [Item linking](/data/data-item-linking/) for more information on paired items and item linking. | Expressions editor |
| `$input.all()` | All input items. | Both |
| `$input.first()` | First input item. | Both |
| `$input.last()` | Last input item. | Both |
| `$input.params` | | Both |
| `$input.context` | | Both |
| `$json` | Shorthand for `$input.item.json`. Incoming JSON data from a node | Expressions editor |
@ -25,14 +25,20 @@ For usage examples, refer to [Expressions examples](/code-examples/expressions/m
| Method | Description | Availability |
| ------ | ----------- | ------------ |
| `$("<node-name>").all(branchIndex?, runIndex?)` | Returns all items from a given node. Replaces `$items`. | Both |
| `$("<node-name>").first(branchIndex?, runIndex?)` | | Both |
| `$("<node-name>").last(branchIndex?, run Index?)` | | Both |
| `$("<node-name>").item` | The paired item. [TODO: explain what this is]. | Expressions editor |
| `$("<node-name>").itemAt(itemIndex, branchIndex?, runIndex?)` | [TODO: is this in? not working in expr] Returns an item at a given index. Replaces `$item()`. | Both |
| `$("<node-name>").itemMatching(currentNodeinputIndex)` | [TODO: not yet implemented?] | Both |
| `$("<node-name>").first(branchIndex?, runIndex?)` | The first item output by the given node | Both |
| `$("<node-name>").last(branchIndex?, run Index?)` | The last item output by the given node. | Both |
| `$("<node-name>").item` | The paired item. This is the input item that the previous node used to produce this item. Refer to [Item linking](/data/data-item-linking/) for more information on paired items and item linking. | Expressions editor |
| `$("<node-name>").params` | | |
| `$("<node-name>").context` | | |
<!-- possibly not live yet?
| `$("<node-name>").itemAt(itemIndex, branchIndex?, runIndex?)` | [TODO: is this in? not working in expr] Returns an item at a given index. Replaces `$item()`. | Both |
| `$("<node-name>").itemMatching(currentNodeinputIndex)` | [TODO: not yet implemented?] | Both |
-->
## Working with data
| Method | Description | Availability |
@ -53,7 +59,7 @@ This includes:
| Method | Description | Availability |
| ------ | ----------- | ------------ |
| `$env` | Contains [environment variables](/hosting/environment-variables/). | Both |
| `$execution.id` | | Both |
| `$execution.id` | The unique ID of the current workflow execution. | Both |
| `$execution.mode` | | Both |
| `$execution.resumeUrl` | The webhook URL to call to resume a waiting workflow. | Both |
| `$parameters` | Parameters of the current node. | |
@ -62,6 +68,6 @@ This includes:
| `$prevNode.outputIndex` | Note that `$prevNode` always takes the first input. This is important when using it in a node with multiple inputs, such as the Merge node. | Both |
| `$prevNode.runIndex` | Note that `$prevNode` always takes the first input. This is important when using it in a node with multiple inputs, such as the Merge node. | Both |
| `$runIndex` | How many times n8n has executed the node. Zero-based (the first run is 0, the second is 1, and so on). | Both |
| `$workflow.active` | | Both |
| `$workflow.id` | | Both |
| `$workflow.name` | | Both |
| `$workflow.active` | Whether the workflow is active (true) or not (false). | Both |
| `$workflow.id` | The workflow ID. | Both |
| `$workflow.name` | The workflow name. | Both |

View File

@ -581,4 +581,3 @@ Once you have created the node and want to contribute to n8n, please check the [
* [Deploy your node](/integrations/creating-nodes/deploy/).
* View an example of a programmatic node: n8n's [Mattermost node](https://github.com/n8n-io/n8n/tree/master/packages/nodes-base/nodes/Mattermost){:target=_blank .external-link}.
* Learn about [node versioning](/integrations/creating-nodes/build/reference/node-versioning/).
* Make sure you understand key concepts: [item linking](/data/data-item-linking/item-linking-scenarios/) and [data structures](/data/data-structure/).

View File

@ -1,45 +0,0 @@
## [TODO: in com nodes release]
<div class="n8n-new-features" markdown>
#### Simplify authentication setup for node creators
This release introduces a simpler way of handling authorization when building a node. All credentials should now contain an `authenticate` property that dictates how the credential is used in a request.
n8n has also simplified authentication types: instead of specifying an authentication type and using the correct interface, you can now set the type as `"generic"`, and use the `IAuthenticateGeneric` interface.
You can use this approach for any authentication method where data is sent in the header, body, or query string. This includes methods like bearer and basic auth. You can't use this approach for more complex authentication types that require multiple calls, or for methods that don't pass authentication data. This includes OAuth.
For an example of the new authentication syntax, refer to n8n's [Asana node](https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/credentials/AsanaApi.credentials.ts){:target=_blank .external-link}.
```js
// in AsanaApi.credentials.ts
import {
IAuthenticateGeneric,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class AsanaApi implements ICredentialType {
name = 'asanaApi';
displayName = 'Asana API';
documentationUrl = 'asana';
properties: INodeProperties[] = [
{
displayName: 'Access Token',
name: 'accessToken',
type: 'string',
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.accessToken}}',
},
},
};
}
```
</div>