first commit
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules/
|
||||
|
||||
dist/
|
||||
|
||||
.vscode/
|
||||
51
.prettierrc.js
Normal file
51
.prettierrc.js
Normal file
@@ -0,0 +1,51 @@
|
||||
module.exports = {
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#semicolons
|
||||
*/
|
||||
semi: true,
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#trailing-commas
|
||||
*/
|
||||
trailingComma: 'all',
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#bracket-spacing
|
||||
*/
|
||||
bracketSpacing: true,
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#tabs
|
||||
*/
|
||||
useTabs: true,
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#tab-width
|
||||
*/
|
||||
tabWidth: 2,
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
|
||||
*/
|
||||
arrowParens: 'always',
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#quotes
|
||||
*/
|
||||
singleQuote: true,
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#quote-props
|
||||
*/
|
||||
quoteProps: 'as-needed',
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#end-of-line
|
||||
*/
|
||||
endOfLine: 'lf',
|
||||
|
||||
/**
|
||||
* https://prettier.io/docs/en/options.html#print-width
|
||||
*/
|
||||
printWidth: 100,
|
||||
};
|
||||
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
46
README.md
Normal file
46
README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# n8n-nodes-gwezz-oceanengine
|
||||
|
||||
This is an n8n community node. It lets you use _app/service name_ in your n8n workflows.
|
||||
|
||||
_App/service name_ is _one or two sentences describing the service this node integrates with_.
|
||||
|
||||
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
||||
|
||||
[Installation](#installation)
|
||||
[Operations](#operations)
|
||||
[Credentials](#credentials)
|
||||
[Compatibility](#compatibility)
|
||||
[Usage](#usage)
|
||||
[Resources](#resources)
|
||||
[Version history](#version-history)
|
||||
|
||||
## Installation
|
||||
|
||||
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
||||
|
||||
## Operations
|
||||
|
||||
_List the operations supported by your node._
|
||||
|
||||
## Credentials
|
||||
|
||||
_If users need to authenticate with the app/service, provide details here. You should include prerequisites (such as signing up with the service), available authentication methods, and how to set them up._
|
||||
|
||||
## Compatibility
|
||||
|
||||
_State the minimum n8n version, as well as which versions you test against. You can also include any known version incompatibility issues._
|
||||
|
||||
## Usage
|
||||
|
||||
_This is an optional section. Use it to help users with any difficult or confusing aspects of the node._
|
||||
|
||||
_By the time users are looking for community nodes, they probably already know n8n basics. But if you expect new users, you can link to the [Try it out](https://docs.n8n.io/try-it-out/) documentation to help them get started._
|
||||
|
||||
## Resources
|
||||
|
||||
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
||||
* _Link to app/service documentation._
|
||||
|
||||
## Version history
|
||||
|
||||
_This is another optional section. If your node has multiple versions, include a short description of available versions and what changed, as well as any compatibility impact._
|
||||
51
credentials/GwezzOceanengineOAuth2Api.credentials.ts
Normal file
51
credentials/GwezzOceanengineOAuth2Api.credentials.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export class GwezzOceanengineOAuth2Api implements ICredentialType {
|
||||
name = 'gwezzOceanengineOAuth2Api';
|
||||
|
||||
extends = ['oAuth2Api'];
|
||||
|
||||
displayName = 'Gwezz Oceanengine OAuth2 API';
|
||||
|
||||
// Link to your community node's README
|
||||
documentationUrl = 'https://github.com/org/-gwezz-oceanengine?tab=readme-ov-file#credentials';
|
||||
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Grant Type',
|
||||
name: 'grantType',
|
||||
type: 'hidden',
|
||||
default: 'authorizationCode',
|
||||
},
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden',
|
||||
default: 'https://api.example.com/oauth/authorize',
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden',
|
||||
default: 'https://api.example.com/oauth/token',
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden',
|
||||
default: 'users:read users:write companies:read',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden',
|
||||
default: 'header',
|
||||
},
|
||||
];
|
||||
}
|
||||
3
eslint.config.mjs
Normal file
3
eslint.config.mjs
Normal file
@@ -0,0 +1,3 @@
|
||||
import { config } from '@n8n/node-cli/eslint';
|
||||
|
||||
export default config;
|
||||
18
nodes/GwezzOceanengine/GwezzOceanengine.node.json
Normal file
18
nodes/GwezzOceanengine/GwezzOceanengine.node.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-gwezz-oceanengine",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Development", "Developer Tools"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://github.com/org/repo?tab=readme-ov-file#credentials"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://github.com/org/repo?tab=readme-ov-file"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
50
nodes/GwezzOceanengine/GwezzOceanengine.node.ts
Normal file
50
nodes/GwezzOceanengine/GwezzOceanengine.node.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { NodeConnectionType, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
||||
import { userDescription } from './resources/user';
|
||||
import { companyDescription } from './resources/company';
|
||||
|
||||
export class GwezzOceanengine implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Gwezz Oceanengine',
|
||||
name: 'gwezzOceanengine',
|
||||
icon: { light: 'file:gwezzOceanengine.svg', dark: 'file:gwezzOceanengine.dark.svg' },
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Interact with the Gwezz Oceanengine API',
|
||||
defaults: {
|
||||
name: 'Gwezz Oceanengine',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionType.Main],
|
||||
credentials: [{ name: 'gwezzOceanengineOAuth2Api', required: true }],
|
||||
requestDefaults: {
|
||||
baseURL: 'https://api.oceanengine.com/open_api/v3.0',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
{
|
||||
name: 'Company',
|
||||
value: 'company',
|
||||
},
|
||||
],
|
||||
default: 'user',
|
||||
},
|
||||
...userDescription,
|
||||
...companyDescription,
|
||||
],
|
||||
};
|
||||
}
|
||||
13
nodes/GwezzOceanengine/gwezzOceanengine.dark.svg
Normal file
13
nodes/GwezzOceanengine/gwezzOceanengine.dark.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="aquamarine"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
||||
<rect x="9" y="9" width="6" height="6"></rect>
|
||||
<line x1="9" y1="1" x2="9" y2="4"></line>
|
||||
<line x1="15" y1="1" x2="15" y2="4"></line>
|
||||
<line x1="9" y1="20" x2="9" y2="23"></line>
|
||||
<line x1="15" y1="20" x2="15" y2="23"></line>
|
||||
<line x1="20" y1="9" x2="23" y2="9"></line>
|
||||
<line x1="20" y1="14" x2="23" y2="14"></line>
|
||||
<line x1="1" y1="9" x2="4" y2="9"></line>
|
||||
<line x1="1" y1="14" x2="4" y2="14"></line>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 698 B |
13
nodes/GwezzOceanengine/gwezzOceanengine.svg
Normal file
13
nodes/GwezzOceanengine/gwezzOceanengine.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
||||
<rect x="9" y="9" width="6" height="6"></rect>
|
||||
<line x1="9" y1="1" x2="9" y2="4"></line>
|
||||
<line x1="15" y1="1" x2="15" y2="4"></line>
|
||||
<line x1="9" y1="20" x2="9" y2="23"></line>
|
||||
<line x1="15" y1="20" x2="15" y2="23"></line>
|
||||
<line x1="20" y1="9" x2="23" y2="9"></line>
|
||||
<line x1="20" y1="14" x2="23" y2="14"></line>
|
||||
<line x1="1" y1="9" x2="4" y2="9"></line>
|
||||
<line x1="1" y1="14" x2="4" y2="14"></line>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 696 B |
61
nodes/GwezzOceanengine/resources/company/getAll.ts
Normal file
61
nodes/GwezzOceanengine/resources/company/getAll.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForCompanyGetMany = {
|
||||
operation: ['getAll'],
|
||||
resource: ['company'],
|
||||
};
|
||||
|
||||
export const companyGetManyDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
...showOnlyForCompanyGetMany,
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 50,
|
||||
routing: {
|
||||
send: {
|
||||
type: 'query',
|
||||
property: 'limit',
|
||||
},
|
||||
output: {
|
||||
maxResults: '={{$value}}',
|
||||
},
|
||||
},
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: showOnlyForCompanyGetMany,
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
routing: {
|
||||
send: {
|
||||
paginate: '={{ $value }}',
|
||||
},
|
||||
operations: {
|
||||
pagination: {
|
||||
type: 'offset',
|
||||
properties: {
|
||||
limitParameter: 'limit',
|
||||
offsetParameter: 'offset',
|
||||
pageSize: 100,
|
||||
type: 'query',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
34
nodes/GwezzOceanengine/resources/company/index.ts
Normal file
34
nodes/GwezzOceanengine/resources/company/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { companyGetManyDescription } from './getAll';
|
||||
|
||||
const showOnlyForCompanies = {
|
||||
resource: ['company'],
|
||||
};
|
||||
|
||||
export const companyDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForCompanies,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get companies',
|
||||
description: 'Get companies',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/companies',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...companyGetManyDescription,
|
||||
];
|
||||
26
nodes/GwezzOceanengine/resources/user/create.ts
Normal file
26
nodes/GwezzOceanengine/resources/user/create.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForUserCreate = {
|
||||
operation: ['create'],
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userCreateDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForUserCreate,
|
||||
},
|
||||
description: 'The name of the user',
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'name',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
17
nodes/GwezzOceanengine/resources/user/get.ts
Normal file
17
nodes/GwezzOceanengine/resources/user/get.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const showOnlyForUserGet = {
|
||||
operation: ['get'],
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userGetDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
displayOptions: { show: showOnlyForUserGet },
|
||||
default: '',
|
||||
description: "The user's ID to retrieve",
|
||||
},
|
||||
];
|
||||
60
nodes/GwezzOceanengine/resources/user/index.ts
Normal file
60
nodes/GwezzOceanengine/resources/user/index.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { userCreateDescription } from './create';
|
||||
import { userGetDescription } from './get';
|
||||
|
||||
const showOnlyForUsers = {
|
||||
resource: ['user'],
|
||||
};
|
||||
|
||||
export const userDescription: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: showOnlyForUsers,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
action: 'Get users',
|
||||
description: 'Get many users',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/users',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
action: 'Get a user',
|
||||
description: 'Get the data of a single user',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/users/{{$parameter.userId}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
action: 'Create a new user',
|
||||
description: 'Create a new user',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: '/users',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...userGetDescription,
|
||||
...userCreateDescription,
|
||||
];
|
||||
7226
package-lock.json
generated
Normal file
7226
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
package.json
Normal file
39
package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "n8n-nodes-gwezz-oceanengine",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"license": "MIT",
|
||||
"homepage": "",
|
||||
"keywords": ["n8n-community-node-package"],
|
||||
"author": { "name": "sshelgwezz", "email": "sshelgwezz@foxmail.com" },
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/<...>/n8n-nodes-<...>.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "n8n-node build",
|
||||
"build:watch": "tsc --watch",
|
||||
"dev": "n8n-node dev",
|
||||
"lint": "n8n-node lint",
|
||||
"lint:fix": "n8n-node lint --fix",
|
||||
"release": "n8n-node release",
|
||||
"prepublishOnly": "n8n-node prerelease"
|
||||
},
|
||||
"files": ["dist"],
|
||||
"n8n": {
|
||||
"n8nNodesApiVersion": 1,
|
||||
"strict": true,
|
||||
"credentials": [
|
||||
"dist/credentials/GwezzOceanengineOAuth2Api.credentials.js"
|
||||
],
|
||||
"nodes": ["dist/nodes/GwezzOceanengine/GwezzOceanengine.node.js"]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@n8n/node-cli": "*",
|
||||
"eslint": "9.32.0",
|
||||
"prettier": "3.6.2",
|
||||
"release-it": "^19.0.4",
|
||||
"typescript": "5.9.2"
|
||||
},
|
||||
"peerDependencies": { "n8n-workflow": "*" }
|
||||
}
|
||||
26
tsconfig.json
Normal file
26
tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"ignoreDeprecations": "6.0",
|
||||
"target": "es2019",
|
||||
"lib": ["es2019", "es2020", "es2022.error"],
|
||||
"removeComments": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"strictNullChecks": true,
|
||||
"preserveConstEnums": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"incremental": true,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "./dist/"
|
||||
},
|
||||
"include": ["credentials/**/*", "nodes/**/*", "nodes/**/*.json", "package.json"]
|
||||
}
|
||||
Reference in New Issue
Block a user