@atom8n/node-cli 0.17.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 +289 -0
- package/bin/n8n-node.mjs +5 -0
- package/dist/build.tsbuildinfo +1 -0
- package/dist/commands/build.d.ts +8 -0
- package/dist/commands/build.js +61 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/cloud-support.d.ts +14 -0
- package/dist/commands/cloud-support.js +136 -0
- package/dist/commands/cloud-support.js.map +1 -0
- package/dist/commands/dev/index.d.ts +10 -0
- package/dist/commands/dev/index.js +103 -0
- package/dist/commands/dev/index.js.map +1 -0
- package/dist/commands/dev/utils.d.ts +27 -0
- package/dist/commands/dev/utils.js +462 -0
- package/dist/commands/dev/utils.js.map +1 -0
- package/dist/commands/lint.d.ts +13 -0
- package/dist/commands/lint.js +124 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/new/index.d.ts +14 -0
- package/dist/commands/new/index.js +141 -0
- package/dist/commands/new/index.js.map +1 -0
- package/dist/commands/new/prompts.d.ts +3 -0
- package/dist/commands/new/prompts.js +42 -0
- package/dist/commands/new/prompts.js.map +1 -0
- package/dist/commands/new/utils.d.ts +1 -0
- package/dist/commands/new/utils.js +13 -0
- package/dist/commands/new/utils.js.map +1 -0
- package/dist/commands/prerelease.d.ts +8 -0
- package/dist/commands/prerelease.js +20 -0
- package/dist/commands/prerelease.js.map +1 -0
- package/dist/commands/release.d.ts +7 -0
- package/dist/commands/release.js +52 -0
- package/dist/commands/release.js.map +1 -0
- package/dist/configs/eslint.d.ts +3 -0
- package/dist/configs/eslint.js +65 -0
- package/dist/configs/eslint.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/template/core.d.ts +29 -0
- package/dist/template/core.js +55 -0
- package/dist/template/core.js.map +1 -0
- package/dist/template/templates/declarative/custom/ast.d.ts +17 -0
- package/dist/template/templates/declarative/custom/ast.js +110 -0
- package/dist/template/templates/declarative/custom/ast.js.map +1 -0
- package/dist/template/templates/declarative/custom/ast.ts +161 -0
- package/dist/template/templates/declarative/custom/prompts.d.ts +3 -0
- package/dist/template/templates/declarative/custom/prompts.js +80 -0
- package/dist/template/templates/declarative/custom/prompts.js.map +1 -0
- package/dist/template/templates/declarative/custom/prompts.ts +87 -0
- package/dist/template/templates/declarative/custom/template/README.md +46 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/Example.node.json +18 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/Example.node.ts +50 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/example.dark.svg +13 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/example.svg +13 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/resources/company/getAll.ts +61 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/resources/company/index.ts +34 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/create.ts +26 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/get.ts +17 -0
- package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/index.ts +60 -0
- package/dist/template/templates/declarative/custom/template/package.json +48 -0
- package/dist/template/templates/declarative/custom/template/tsconfig.json +25 -0
- package/dist/template/templates/declarative/custom/template.d.ts +2 -0
- package/dist/template/templates/declarative/custom/template.js +83 -0
- package/dist/template/templates/declarative/custom/template.js.map +1 -0
- package/dist/template/templates/declarative/custom/template.ts +121 -0
- package/dist/template/templates/declarative/custom/types.d.ts +9 -0
- package/dist/template/templates/declarative/custom/types.js +3 -0
- package/dist/template/templates/declarative/custom/types.js.map +1 -0
- package/dist/template/templates/declarative/custom/types.ts +8 -0
- package/dist/template/templates/declarative/github-issues/template/README.md +73 -0
- package/dist/template/templates/declarative/github-issues/template/credentials/GithubIssuesApi.credentials.ts +45 -0
- package/dist/template/templates/declarative/github-issues/template/credentials/GithubIssuesOAuth2Api.credentials.ts +54 -0
- package/dist/template/templates/declarative/github-issues/template/icons/github.dark.svg +3 -0
- package/dist/template/templates/declarative/github-issues/template/icons/github.svg +3 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/GithubIssues.node.json +18 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/GithubIssues.node.ts +96 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/listSearch/getIssues.ts +49 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/listSearch/getRepositories.ts +50 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/listSearch/getUsers.ts +49 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issue/create.ts +74 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issue/get.ts +14 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issue/getAll.ts +124 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issue/index.ts +75 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issueComment/getAll.ts +65 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/resources/issueComment/index.ts +47 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/shared/descriptions.ts +151 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/shared/transport.ts +32 -0
- package/dist/template/templates/declarative/github-issues/template/nodes/GithubIssues/shared/utils.ts +14 -0
- package/dist/template/templates/declarative/github-issues/template/package.json +51 -0
- package/dist/template/templates/declarative/github-issues/template/tsconfig.json +25 -0
- package/dist/template/templates/declarative/github-issues/template.d.ts +1 -0
- package/dist/template/templates/declarative/github-issues/template.js +14 -0
- package/dist/template/templates/declarative/github-issues/template.js.map +1 -0
- package/dist/template/templates/declarative/github-issues/template.ts +9 -0
- package/dist/template/templates/index.d.ts +15 -0
- package/dist/template/templates/index.js +28 -0
- package/dist/template/templates/index.js.map +1 -0
- package/dist/template/templates/index.ts +35 -0
- package/dist/template/templates/programmatic/example/template/README.md +46 -0
- package/dist/template/templates/programmatic/example/template/nodes/Example/Example.node.json +18 -0
- package/dist/template/templates/programmatic/example/template/nodes/Example/Example.node.ts +78 -0
- package/dist/template/templates/programmatic/example/template/nodes/Example/example.dark.svg +13 -0
- package/dist/template/templates/programmatic/example/template/nodes/Example/example.svg +13 -0
- package/dist/template/templates/programmatic/example/template/package.json +48 -0
- package/dist/template/templates/programmatic/example/template/tsconfig.json +25 -0
- package/dist/template/templates/programmatic/example/template.d.ts +1 -0
- package/dist/template/templates/programmatic/example/template.js +14 -0
- package/dist/template/templates/programmatic/example/template.js.map +1 -0
- package/dist/template/templates/programmatic/example/template.ts +9 -0
- package/dist/template/templates/shared/credentials/apiKey.credentials.ts +42 -0
- package/dist/template/templates/shared/credentials/basicAuth.credentials.ts +50 -0
- package/dist/template/templates/shared/credentials/bearer.credentials.ts +42 -0
- package/dist/template/templates/shared/credentials/custom.credentials.ts +48 -0
- package/dist/template/templates/shared/credentials/oauth2AuthorizationCode.credentials.ts +51 -0
- package/dist/template/templates/shared/credentials/oauth2ClientCredentials.credentials.ts +45 -0
- package/dist/template/templates/shared/default/.github/workflows/ci.yml +28 -0
- package/dist/template/templates/shared/default/.prettierrc.js +51 -0
- package/dist/template/templates/shared/default/.vscode/launch.json +12 -0
- package/dist/template/templates/shared/default/CHANGELOG.md +0 -0
- package/dist/template/templates/shared/default/eslint.config.mjs +3 -0
- package/dist/utils/ast.d.ts +11 -0
- package/dist/utils/ast.js +32 -0
- package/dist/utils/ast.js.map +1 -0
- package/dist/utils/child-process.d.ts +17 -0
- package/dist/utils/child-process.js +65 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/command-suggestions.d.ts +6 -0
- package/dist/utils/command-suggestions.js +30 -0
- package/dist/utils/command-suggestions.js.map +1 -0
- package/dist/utils/filesystem.d.ts +12 -0
- package/dist/utils/filesystem.js +105 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/git.d.ts +7 -0
- package/dist/utils/git.js +36 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/json.d.ts +1 -0
- package/dist/utils/json.js +12 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/package-manager.d.ts +4 -0
- package/dist/utils/package-manager.js +48 -0
- package/dist/utils/package-manager.js.map +1 -0
- package/dist/utils/package.d.ts +15 -0
- package/dist/utils/package.js +53 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/prompts.d.ts +5 -0
- package/dist/utils/prompts.js +65 -0
- package/dist/utils/prompts.js.map +1 -0
- package/dist/utils/validation.d.ts +3 -0
- package/dist/utils/validation.js +23 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
const showOnlyForCompanyGetMany = {
|
|
4
|
+
operation: ['getAll'],
|
|
5
|
+
resource: ['company'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const companyGetManyDescription: INodeProperties[] = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Limit',
|
|
11
|
+
name: 'limit',
|
|
12
|
+
type: 'number',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
...showOnlyForCompanyGetMany,
|
|
16
|
+
returnAll: [false],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
typeOptions: {
|
|
20
|
+
minValue: 1,
|
|
21
|
+
maxValue: 100,
|
|
22
|
+
},
|
|
23
|
+
default: 50,
|
|
24
|
+
routing: {
|
|
25
|
+
send: {
|
|
26
|
+
type: 'query',
|
|
27
|
+
property: 'limit',
|
|
28
|
+
},
|
|
29
|
+
output: {
|
|
30
|
+
maxResults: '={{$value}}',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
description: 'Max number of results to return',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Return All',
|
|
37
|
+
name: 'returnAll',
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
displayOptions: {
|
|
40
|
+
show: showOnlyForCompanyGetMany,
|
|
41
|
+
},
|
|
42
|
+
default: false,
|
|
43
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
44
|
+
routing: {
|
|
45
|
+
send: {
|
|
46
|
+
paginate: '={{ $value }}',
|
|
47
|
+
},
|
|
48
|
+
operations: {
|
|
49
|
+
pagination: {
|
|
50
|
+
type: 'offset',
|
|
51
|
+
properties: {
|
|
52
|
+
limitParameter: 'limit',
|
|
53
|
+
offsetParameter: 'offset',
|
|
54
|
+
pageSize: 100,
|
|
55
|
+
type: 'query',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
package/dist/template/templates/declarative/custom/template/nodes/Example/resources/company/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { companyGetManyDescription } from './getAll';
|
|
3
|
+
|
|
4
|
+
const showOnlyForCompanies = {
|
|
5
|
+
resource: ['company'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const companyDescription: INodeProperties[] = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Operation',
|
|
11
|
+
name: 'operation',
|
|
12
|
+
type: 'options',
|
|
13
|
+
noDataExpression: true,
|
|
14
|
+
displayOptions: {
|
|
15
|
+
show: showOnlyForCompanies,
|
|
16
|
+
},
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
name: 'Get Many',
|
|
20
|
+
value: 'getAll',
|
|
21
|
+
action: 'Get companies',
|
|
22
|
+
description: 'Get companies',
|
|
23
|
+
routing: {
|
|
24
|
+
request: {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
url: '/companies',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
default: 'getAll',
|
|
32
|
+
},
|
|
33
|
+
...companyGetManyDescription,
|
|
34
|
+
];
|
package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/create.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
const showOnlyForUserCreate = {
|
|
4
|
+
operation: ['create'],
|
|
5
|
+
resource: ['user'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const userCreateDescription: INodeProperties[] = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Name',
|
|
11
|
+
name: 'name',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: '',
|
|
14
|
+
required: true,
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: showOnlyForUserCreate,
|
|
17
|
+
},
|
|
18
|
+
description: 'The name of the user',
|
|
19
|
+
routing: {
|
|
20
|
+
send: {
|
|
21
|
+
type: 'body',
|
|
22
|
+
property: 'name',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/get.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
const showOnlyForUserGet = {
|
|
4
|
+
operation: ['get'],
|
|
5
|
+
resource: ['user'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const userGetDescription: INodeProperties[] = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'User ID',
|
|
11
|
+
name: 'userId',
|
|
12
|
+
type: 'string',
|
|
13
|
+
displayOptions: { show: showOnlyForUserGet },
|
|
14
|
+
default: '',
|
|
15
|
+
description: "The user's ID to retrieve",
|
|
16
|
+
},
|
|
17
|
+
];
|
package/dist/template/templates/declarative/custom/template/nodes/Example/resources/user/index.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { userCreateDescription } from './create';
|
|
3
|
+
import { userGetDescription } from './get';
|
|
4
|
+
|
|
5
|
+
const showOnlyForUsers = {
|
|
6
|
+
resource: ['user'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const userDescription: INodeProperties[] = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Operation',
|
|
12
|
+
name: 'operation',
|
|
13
|
+
type: 'options',
|
|
14
|
+
noDataExpression: true,
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: showOnlyForUsers,
|
|
17
|
+
},
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Get Many',
|
|
21
|
+
value: 'getAll',
|
|
22
|
+
action: 'Get users',
|
|
23
|
+
description: 'Get many users',
|
|
24
|
+
routing: {
|
|
25
|
+
request: {
|
|
26
|
+
method: 'GET',
|
|
27
|
+
url: '/users',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get',
|
|
33
|
+
value: 'get',
|
|
34
|
+
action: 'Get a user',
|
|
35
|
+
description: 'Get the data of a single user',
|
|
36
|
+
routing: {
|
|
37
|
+
request: {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
url: '=/users/{{$parameter.userId}}',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Create',
|
|
45
|
+
value: 'create',
|
|
46
|
+
action: 'Create a new user',
|
|
47
|
+
description: 'Create a new user',
|
|
48
|
+
routing: {
|
|
49
|
+
request: {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
url: '/users',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'getAll',
|
|
57
|
+
},
|
|
58
|
+
...userGetDescription,
|
|
59
|
+
...userCreateDescription,
|
|
60
|
+
];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{nodePackageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "{{user.name}}",
|
|
12
|
+
"email": "{{user.email}}"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/<...>/n8n-nodes-<...>.git"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "n8n-node build",
|
|
20
|
+
"build:watch": "tsc --watch",
|
|
21
|
+
"dev": "n8n-node dev",
|
|
22
|
+
"lint": "n8n-node lint",
|
|
23
|
+
"lint:fix": "n8n-node lint --fix",
|
|
24
|
+
"release": "n8n-node release",
|
|
25
|
+
"prepublishOnly": "n8n-node prerelease"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"n8n": {
|
|
31
|
+
"n8nNodesApiVersion": 1,
|
|
32
|
+
"strict": true,
|
|
33
|
+
"credentials": [],
|
|
34
|
+
"nodes": [
|
|
35
|
+
"dist/nodes/Example/Example.node.js"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@atom8n/node-cli": "*",
|
|
40
|
+
"eslint": "9.32.0",
|
|
41
|
+
"prettier": "3.6.2",
|
|
42
|
+
"release-it": "^19.0.4",
|
|
43
|
+
"typescript": "5.9.2"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@atom8n/n8n-workflow": "*"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"target": "es2019",
|
|
7
|
+
"lib": ["es2019", "es2020", "es2022.error"],
|
|
8
|
+
"removeComments": true,
|
|
9
|
+
"useUnknownInCatchVariables": false,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"preserveConstEnums": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"sourceMap": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"outDir": "./dist/"
|
|
23
|
+
},
|
|
24
|
+
"include": ["credentials/**/*", "nodes/**/*", "nodes/**/*.json", "package.json"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.customTemplate = void 0;
|
|
7
|
+
const change_case_1 = require("change-case");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const ast_1 = require("./ast");
|
|
10
|
+
const prompts_1 = require("./prompts");
|
|
11
|
+
const filesystem_1 = require("../../../../utils/filesystem");
|
|
12
|
+
const package_1 = require("../../../../utils/package");
|
|
13
|
+
const core_1 = require("../../../core");
|
|
14
|
+
exports.customTemplate = (0, core_1.createTemplate)({
|
|
15
|
+
name: 'Start from scratch',
|
|
16
|
+
description: 'Blank template with guided setup',
|
|
17
|
+
path: node_path_1.default.join(__dirname, 'template'),
|
|
18
|
+
prompts: async () => {
|
|
19
|
+
const baseUrl = await (0, prompts_1.baseUrlPrompt)();
|
|
20
|
+
const credentialType = await (0, prompts_1.credentialTypePrompt)();
|
|
21
|
+
if (credentialType === 'oauth2') {
|
|
22
|
+
const flow = await (0, prompts_1.oauthFlowPrompt)();
|
|
23
|
+
return { credentialType, baseUrl, flow };
|
|
24
|
+
}
|
|
25
|
+
return { credentialType, baseUrl };
|
|
26
|
+
},
|
|
27
|
+
run: async (data) => {
|
|
28
|
+
await renameNode(data, 'Example');
|
|
29
|
+
await addCredential(data);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
async function renameNode(data, oldNodeName) {
|
|
33
|
+
const { config, nodePackageName: nodeName, destinationPath } = data;
|
|
34
|
+
const newClassName = (0, change_case_1.pascalCase)(nodeName.replace('n8n-nodes-', ''));
|
|
35
|
+
const oldNodeDir = node_path_1.default.resolve(destinationPath, `nodes/${oldNodeName}`);
|
|
36
|
+
await (0, filesystem_1.renameFilesInDirectory)(oldNodeDir, oldNodeName, newClassName);
|
|
37
|
+
const newNodeDir = await (0, filesystem_1.renameDirectory)(oldNodeDir, newClassName);
|
|
38
|
+
const newNodePath = node_path_1.default.resolve(newNodeDir, `${newClassName}.node.ts`);
|
|
39
|
+
const newNodeAst = (0, ast_1.updateNodeAst)({
|
|
40
|
+
nodePath: newNodePath,
|
|
41
|
+
baseUrl: config.baseUrl,
|
|
42
|
+
className: newClassName,
|
|
43
|
+
});
|
|
44
|
+
await (0, filesystem_1.writeFileSafe)(newNodePath, newNodeAst.getFullText());
|
|
45
|
+
const nodes = [`dist/nodes/${newClassName}/${newClassName}.node.js`];
|
|
46
|
+
await (0, package_1.setNodesPackageJson)(destinationPath, nodes);
|
|
47
|
+
}
|
|
48
|
+
async function addCredential(data) {
|
|
49
|
+
const { config, destinationPath, nodePackageName } = data;
|
|
50
|
+
if (config.credentialType === 'none')
|
|
51
|
+
return;
|
|
52
|
+
const credentialTemplateName = config.credentialType === 'oauth2'
|
|
53
|
+
? config.credentialType + (0, change_case_1.pascalCase)(config.flow)
|
|
54
|
+
: config.credentialType;
|
|
55
|
+
const credentialTemplatePath = node_path_1.default.resolve(__dirname, `../../shared/credentials/${credentialTemplateName}.credentials.ts`);
|
|
56
|
+
const nodeName = nodePackageName.replace('n8n-nodes', '');
|
|
57
|
+
const repoName = nodeName;
|
|
58
|
+
const { baseUrl, credentialType } = config;
|
|
59
|
+
const credentialClassName = config.credentialType === 'oauth2'
|
|
60
|
+
? (0, change_case_1.pascalCase)(`${nodeName}-OAuth2-api`)
|
|
61
|
+
: (0, change_case_1.pascalCase)(`${nodeName}-api`);
|
|
62
|
+
const credentialName = (0, change_case_1.camelCase)(`${nodeName}${credentialType === 'oauth2' ? 'OAuth2Api' : 'Api'}`);
|
|
63
|
+
const credentialDisplayName = `${(0, change_case_1.capitalCase)(nodeName)} ${credentialType === 'oauth2' ? 'OAuth2 API' : 'API'}`;
|
|
64
|
+
const updatedCredentialAst = (0, ast_1.updateCredentialAst)({
|
|
65
|
+
repoName,
|
|
66
|
+
baseUrl,
|
|
67
|
+
credentialName,
|
|
68
|
+
credentialDisplayName,
|
|
69
|
+
credentialClassName,
|
|
70
|
+
credentialPath: credentialTemplatePath,
|
|
71
|
+
});
|
|
72
|
+
await (0, filesystem_1.writeFileSafe)(node_path_1.default.resolve(destinationPath, `credentials/${credentialClassName}.credentials.ts`), updatedCredentialAst.getFullText());
|
|
73
|
+
await (0, package_1.addCredentialPackageJson)(destinationPath, `dist/credentials/${credentialClassName}.credentials.js`);
|
|
74
|
+
for (const nodePath of await (0, package_1.getPackageJsonNodes)(destinationPath)) {
|
|
75
|
+
const srcNodePath = node_path_1.default.resolve(destinationPath, nodePath.replace(/.js$/, '.ts').replace(/^dist\//, ''));
|
|
76
|
+
const updatedNodeAst = (0, ast_1.addCredentialToNode)({
|
|
77
|
+
nodePath: srcNodePath,
|
|
78
|
+
credentialName,
|
|
79
|
+
});
|
|
80
|
+
await (0, filesystem_1.writeFileSafe)(srcNodePath, updatedNodeAst.getFullText());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/template/templates/declarative/custom/template.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { camelCase, capitalCase, pascalCase } from 'change-case';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { addCredentialToNode, updateCredentialAst, updateNodeAst } from './ast';
|
|
5
|
+
import { baseUrlPrompt, credentialTypePrompt, oauthFlowPrompt } from './prompts';
|
|
6
|
+
import type { CustomTemplateConfig } from './types';
|
|
7
|
+
import {
|
|
8
|
+
renameDirectory,
|
|
9
|
+
renameFilesInDirectory,
|
|
10
|
+
writeFileSafe,
|
|
11
|
+
} from '../../../../utils/filesystem';
|
|
12
|
+
import {
|
|
13
|
+
setNodesPackageJson,
|
|
14
|
+
addCredentialPackageJson,
|
|
15
|
+
getPackageJsonNodes,
|
|
16
|
+
} from '../../../../utils/package';
|
|
17
|
+
import { createTemplate, type TemplateData } from '../../../core';
|
|
18
|
+
|
|
19
|
+
export const customTemplate = createTemplate({
|
|
20
|
+
name: 'Start from scratch',
|
|
21
|
+
description: 'Blank template with guided setup',
|
|
22
|
+
path: path.join(__dirname, 'template'),
|
|
23
|
+
prompts: async (): Promise<CustomTemplateConfig> => {
|
|
24
|
+
const baseUrl = await baseUrlPrompt();
|
|
25
|
+
|
|
26
|
+
const credentialType = await credentialTypePrompt();
|
|
27
|
+
|
|
28
|
+
if (credentialType === 'oauth2') {
|
|
29
|
+
const flow = await oauthFlowPrompt();
|
|
30
|
+
|
|
31
|
+
return { credentialType, baseUrl, flow };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return { credentialType, baseUrl };
|
|
35
|
+
},
|
|
36
|
+
run: async (data) => {
|
|
37
|
+
await renameNode(data, 'Example');
|
|
38
|
+
await addCredential(data);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
async function renameNode(data: TemplateData<CustomTemplateConfig>, oldNodeName: string) {
|
|
43
|
+
const { config, nodePackageName: nodeName, destinationPath } = data;
|
|
44
|
+
const newClassName = pascalCase(nodeName.replace('n8n-nodes-', ''));
|
|
45
|
+
const oldNodeDir = path.resolve(destinationPath, `nodes/${oldNodeName}`);
|
|
46
|
+
|
|
47
|
+
await renameFilesInDirectory(oldNodeDir, oldNodeName, newClassName);
|
|
48
|
+
const newNodeDir = await renameDirectory(oldNodeDir, newClassName);
|
|
49
|
+
|
|
50
|
+
const newNodePath = path.resolve(newNodeDir, `${newClassName}.node.ts`);
|
|
51
|
+
const newNodeAst = updateNodeAst({
|
|
52
|
+
nodePath: newNodePath,
|
|
53
|
+
baseUrl: config.baseUrl,
|
|
54
|
+
className: newClassName,
|
|
55
|
+
});
|
|
56
|
+
await writeFileSafe(newNodePath, newNodeAst.getFullText());
|
|
57
|
+
|
|
58
|
+
const nodes = [`dist/nodes/${newClassName}/${newClassName}.node.js`];
|
|
59
|
+
await setNodesPackageJson(destinationPath, nodes);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function addCredential(data: TemplateData<CustomTemplateConfig>) {
|
|
63
|
+
const { config, destinationPath, nodePackageName } = data;
|
|
64
|
+
if (config.credentialType === 'none') return;
|
|
65
|
+
|
|
66
|
+
const credentialTemplateName =
|
|
67
|
+
config.credentialType === 'oauth2'
|
|
68
|
+
? config.credentialType + pascalCase(config.flow)
|
|
69
|
+
: config.credentialType;
|
|
70
|
+
const credentialTemplatePath = path.resolve(
|
|
71
|
+
__dirname,
|
|
72
|
+
`../../shared/credentials/${credentialTemplateName}.credentials.ts`,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const nodeName = nodePackageName.replace('n8n-nodes', '');
|
|
76
|
+
const repoName = nodeName;
|
|
77
|
+
const { baseUrl, credentialType } = config;
|
|
78
|
+
const credentialClassName =
|
|
79
|
+
config.credentialType === 'oauth2'
|
|
80
|
+
? pascalCase(`${nodeName}-OAuth2-api`)
|
|
81
|
+
: pascalCase(`${nodeName}-api`);
|
|
82
|
+
const credentialName = camelCase(
|
|
83
|
+
`${nodeName}${credentialType === 'oauth2' ? 'OAuth2Api' : 'Api'}`,
|
|
84
|
+
);
|
|
85
|
+
const credentialDisplayName = `${capitalCase(nodeName)} ${
|
|
86
|
+
credentialType === 'oauth2' ? 'OAuth2 API' : 'API'
|
|
87
|
+
}`;
|
|
88
|
+
|
|
89
|
+
const updatedCredentialAst = updateCredentialAst({
|
|
90
|
+
repoName,
|
|
91
|
+
baseUrl,
|
|
92
|
+
credentialName,
|
|
93
|
+
credentialDisplayName,
|
|
94
|
+
credentialClassName,
|
|
95
|
+
credentialPath: credentialTemplatePath,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await writeFileSafe(
|
|
99
|
+
path.resolve(destinationPath, `credentials/${credentialClassName}.credentials.ts`),
|
|
100
|
+
updatedCredentialAst.getFullText(),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
await addCredentialPackageJson(
|
|
104
|
+
destinationPath,
|
|
105
|
+
`dist/credentials/${credentialClassName}.credentials.js`,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
for (const nodePath of await getPackageJsonNodes(destinationPath)) {
|
|
109
|
+
const srcNodePath = path.resolve(
|
|
110
|
+
destinationPath,
|
|
111
|
+
nodePath.replace(/.js$/, '.ts').replace(/^dist\//, ''),
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const updatedNodeAst = addCredentialToNode({
|
|
115
|
+
nodePath: srcNodePath,
|
|
116
|
+
credentialName,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
await writeFileSafe(srcNodePath, updatedNodeAst.getFullText());
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CustomTemplateConfig = {
|
|
2
|
+
credentialType: 'apiKey' | 'bearer' | 'basicAuth' | 'custom' | 'none';
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
} | {
|
|
5
|
+
credentialType: 'oauth2';
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
flow: string;
|
|
8
|
+
};
|
|
9
|
+
export type CredentialType = CustomTemplateConfig['credentialType'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/template/templates/declarative/custom/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CustomTemplateConfig =
|
|
2
|
+
| {
|
|
3
|
+
credentialType: 'apiKey' | 'bearer' | 'basicAuth' | 'custom' | 'none';
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
}
|
|
6
|
+
| { credentialType: 'oauth2'; baseUrl: string; flow: string };
|
|
7
|
+
|
|
8
|
+
export type CredentialType = CustomTemplateConfig['credentialType'];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# {{nodePackageName}}
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you use GitHub Issues in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
6
|
+
|
|
7
|
+
[Installation](#installation)
|
|
8
|
+
[Operations](#operations)
|
|
9
|
+
[Credentials](#credentials)
|
|
10
|
+
[Compatibility](#compatibility)
|
|
11
|
+
[Usage](#usage)
|
|
12
|
+
[Resources](#resources)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
17
|
+
|
|
18
|
+
## Operations
|
|
19
|
+
|
|
20
|
+
- Issues
|
|
21
|
+
- Get an issue
|
|
22
|
+
- Get many issues in a repository
|
|
23
|
+
- Create a new issue
|
|
24
|
+
- Issue Comments
|
|
25
|
+
- Get many issue comments
|
|
26
|
+
|
|
27
|
+
## Credentials
|
|
28
|
+
|
|
29
|
+
You can use either access token or OAuth2 to use this node.
|
|
30
|
+
|
|
31
|
+
### Access token
|
|
32
|
+
|
|
33
|
+
1. Open your GitHub profile [Settings](https://github.com/settings/profile).
|
|
34
|
+
2. In the left navigation, select [Developer settings](https://github.com/settings/apps).
|
|
35
|
+
3. In the left navigation, under Personal access tokens, select Tokens (classic).
|
|
36
|
+
4. Select Generate new token > Generate new token (classic).
|
|
37
|
+
5. Enter a descriptive name for your token in the Note field, like n8n integration.
|
|
38
|
+
6. Select the Expiration you'd like for the token, or select No expiration.
|
|
39
|
+
7. Select Scopes for your token. For most of the n8n GitHub nodes, add the `repo` scope.
|
|
40
|
+
- A token without assigned scopes can only access public information.
|
|
41
|
+
8. Select Generate token.
|
|
42
|
+
9. Copy the token.
|
|
43
|
+
|
|
44
|
+
Refer to [Creating a personal access token (classic)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) for more information. Refer to Scopes for OAuth apps for more information on GitHub scopes.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
### OAuth2
|
|
49
|
+
|
|
50
|
+
If you're self-hosting n8n, create a new GitHub [OAuth app](https://docs.github.com/en/apps/oauth-apps):
|
|
51
|
+
|
|
52
|
+
1. Open your GitHub profile [Settings](https://github.com/settings/profile).
|
|
53
|
+
2. In the left navigation, select [Developer settings](https://github.com/settings/apps).
|
|
54
|
+
3. In the left navigation, select OAuth apps.
|
|
55
|
+
4. Select New OAuth App.
|
|
56
|
+
- If you haven't created an app before, you may see Register a new application instead. Select it.
|
|
57
|
+
5. Enter an Application name, like n8n integration.
|
|
58
|
+
6. Enter the Homepage URL for your app's website.
|
|
59
|
+
7. If you'd like, add the optional Application description, which GitHub displays to end-users.
|
|
60
|
+
8. From n8n, copy the OAuth Redirect URL and paste it into the GitHub Authorization callback URL.
|
|
61
|
+
9. Select Register application.
|
|
62
|
+
10. Copy the Client ID and Client Secret this generates and add them to your n8n credential.
|
|
63
|
+
|
|
64
|
+
Refer to the [GitHub Authorizing OAuth apps documentation](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps) for more information on the authorization process.
|
|
65
|
+
|
|
66
|
+
## Compatibility
|
|
67
|
+
|
|
68
|
+
Compatible with n8n@1.60.0 or later
|
|
69
|
+
|
|
70
|
+
## Resources
|
|
71
|
+
|
|
72
|
+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
73
|
+
* [GitHub API docs](https://docs.github.com/en/rest/issues)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAuthenticateGeneric,
|
|
3
|
+
Icon,
|
|
4
|
+
ICredentialTestRequest,
|
|
5
|
+
ICredentialType,
|
|
6
|
+
INodeProperties,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
|
|
9
|
+
export class GithubIssuesApi implements ICredentialType {
|
|
10
|
+
name = 'githubIssuesApi';
|
|
11
|
+
|
|
12
|
+
displayName = 'GitHub Issues API';
|
|
13
|
+
|
|
14
|
+
icon: Icon = { light: 'file:../icons/github.svg', dark: 'file:../icons/github.dark.svg' };
|
|
15
|
+
|
|
16
|
+
documentationUrl =
|
|
17
|
+
'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#deleting-a-personal-access-token';
|
|
18
|
+
|
|
19
|
+
properties: INodeProperties[] = [
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Access Token',
|
|
22
|
+
name: 'accessToken',
|
|
23
|
+
type: 'string',
|
|
24
|
+
typeOptions: { password: true },
|
|
25
|
+
default: '',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
authenticate: IAuthenticateGeneric = {
|
|
30
|
+
type: 'generic',
|
|
31
|
+
properties: {
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: '=token {{$credentials?.accessToken}}',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
test: ICredentialTestRequest = {
|
|
39
|
+
request: {
|
|
40
|
+
baseURL: 'https://api.github.com',
|
|
41
|
+
url: '/user',
|
|
42
|
+
method: 'GET',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|