n8n-nodes-formbase 0.1.0 → 0.2.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/LICENSE.md +1 -1
- package/README.md +16 -13
- package/dist/credentials/FormbaseOAuth2Api.credentials.d.ts +10 -0
- package/dist/credentials/FormbaseOAuth2Api.credentials.js +40 -0
- package/dist/credentials/FormbaseOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/Formbase/FormbaseTrigger.node.js +7 -7
- package/dist/nodes/Formbase/FormbaseTrigger.node.js.map +1 -1
- package/dist/nodes/Formbase/GenericFunctions.js +7 -7
- package/dist/nodes/Formbase/GenericFunctions.js.map +1 -1
- package/dist/nodes/Formbase/constants.d.ts +2 -0
- package/dist/nodes/Formbase/constants.js +3 -1
- package/dist/nodes/Formbase/constants.js.map +1 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/credentials/FormbaseApi.credentials.d.ts +0 -10
- package/dist/credentials/FormbaseApi.credentials.js +0 -52
- package/dist/credentials/FormbaseApi.credentials.js.map +0 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# n8n-nodes-formbase
|
|
2
2
|
|
|
3
|
-
Community node for [n8n](https://n8n.io) that starts workflows when a [
|
|
3
|
+
Community node for [n8n](https://n8n.io) that starts workflows when a [formbase](https://formbase.so) form receives a submission.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Trigger on completed submissions.
|
|
8
8
|
- Trigger on abandoned submissions when partial submission tracking is enabled.
|
|
9
9
|
- Load forms dynamically from every workspace available to the credential.
|
|
10
|
-
- Register and remove
|
|
11
|
-
- Connect
|
|
10
|
+
- Register and remove formbase webhook subscriptions with the n8n workflow lifecycle.
|
|
11
|
+
- Connect through workspace-scoped OAuth 2.1 with PKCE and automatic refresh-token rotation.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -20,28 +20,31 @@ n8n-nodes-formbase
|
|
|
20
20
|
|
|
21
21
|
Community nodes must be enabled on self-hosted n8n. Installation in n8n Cloud requires a verified community node.
|
|
22
22
|
|
|
23
|
+
OAuth setup requires n8n 2.30 or newer.
|
|
24
|
+
|
|
23
25
|
## Configure credentials
|
|
24
26
|
|
|
25
|
-
1. In
|
|
26
|
-
2.
|
|
27
|
-
3.
|
|
28
|
-
4.
|
|
29
|
-
|
|
27
|
+
1. In n8n, create a **formbase OAuth2 API** credential.
|
|
28
|
+
2. Select **Connect my account**.
|
|
29
|
+
3. Sign in to formbase, choose workspace, and approve requested API access.
|
|
30
|
+
4. Select **Test**. n8n calls `me.get` to verify connection.
|
|
31
|
+
|
|
32
|
+
n8n registers its exact callback URL with formbase automatically through OAuth Dynamic Client Registration. Access tokens expire after one hour and refresh automatically. Rotating refresh token remains valid while connection is used at least once every 30 days.
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
Self-hosted n8n must use configured HTTPS public URL for OAuth callback. Loopback HTTP is supported for local development.
|
|
32
35
|
|
|
33
36
|
## Use trigger
|
|
34
37
|
|
|
35
|
-
1. Add **
|
|
38
|
+
1. Add **formbase Trigger** to a workflow.
|
|
36
39
|
2. Select form and event.
|
|
37
40
|
3. For a test execution, select **Listen for Test Event**, then submit the selected form.
|
|
38
|
-
4. Activate the workflow. n8n registers its production webhook with
|
|
41
|
+
4. Activate the workflow. n8n registers its production webhook with formbase and removes it when the workflow is deactivated or deleted.
|
|
39
42
|
|
|
40
43
|
n8n webhook URL must be publicly reachable over HTTPS. For reverse-proxy or tunnel deployments, configure n8n's `WEBHOOK_URL` so generated webhook URLs use public origin.
|
|
41
44
|
|
|
42
45
|
## Output
|
|
43
46
|
|
|
44
|
-
Each webhook produces one n8n item containing
|
|
47
|
+
Each webhook produces one n8n item containing formbase payload:
|
|
45
48
|
|
|
46
49
|
```json
|
|
47
50
|
{
|
|
@@ -75,7 +78,7 @@ Each webhook produces one n8n item containing Formbase payload:
|
|
|
75
78
|
|
|
76
79
|
`eventType` is `SUBMIT_RESPONSE` for a new completed or abandoned response and `UPDATE_RESPONSE` when an existing response changes. Use `eventId` to deduplicate retries.
|
|
77
80
|
|
|
78
|
-
Full contracts: [
|
|
81
|
+
Full contracts: [formbase API methods](https://docs.formbase.so/developers/rest-api) and [webhook reference](https://docs.formbase.so/developers/webhooks-reference).
|
|
79
82
|
|
|
80
83
|
## Develop
|
|
81
84
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class FormbaseOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string[];
|
|
5
|
+
displayName: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
documentationUrl: string;
|
|
8
|
+
properties: INodeProperties[];
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormbaseOAuth2Api = void 0;
|
|
4
|
+
const constants_1 = require("../nodes/Formbase/constants");
|
|
5
|
+
class FormbaseOAuth2Api {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.name = constants_1.FORMBASE_OAUTH2_CREDENTIAL_NAME;
|
|
8
|
+
this.extends = ['oAuth2Api'];
|
|
9
|
+
this.displayName = 'formbase OAuth2 API';
|
|
10
|
+
this.icon = { light: 'file:../nodes/Formbase/formbase.svg', dark: 'file:../nodes/Formbase/formbase.dark.svg' };
|
|
11
|
+
this.documentationUrl = 'https://github.com/formbaseso/n8n-nodes-formbase#configure-credentials';
|
|
12
|
+
this.properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Use Dynamic Client Registration',
|
|
15
|
+
name: 'useDynamicClientRegistration',
|
|
16
|
+
type: 'hidden',
|
|
17
|
+
default: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Server URL',
|
|
21
|
+
name: 'serverUrl',
|
|
22
|
+
type: 'hidden',
|
|
23
|
+
default: constants_1.FORMBASE_API_RESOURCE_URL,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
this.test = {
|
|
28
|
+
request: {
|
|
29
|
+
url: '={{$credentials.serverUrl}}',
|
|
30
|
+
method: 'POST',
|
|
31
|
+
body: {
|
|
32
|
+
method: 'me.get',
|
|
33
|
+
params: {},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.FormbaseOAuth2Api = FormbaseOAuth2Api;
|
|
40
|
+
//# sourceMappingURL=FormbaseOAuth2Api.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormbaseOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/FormbaseOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,2DAAwG;AAExG,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAG,2CAA+B,CAAA;QAEtC,YAAO,GAAG,CAAC,WAAW,CAAC,CAAA;QAGvB,gBAAW,GAAG,qBAAqB,CAAA;QAEnC,SAAI,GAAS,EAAE,KAAK,EAAE,qCAAqC,EAAE,IAAI,EAAE,0CAA0C,EAAE,CAAA;QAE/G,qBAAgB,GAAG,wEAAwE,CAAA;QAE3F,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,iCAAiC;gBAC9C,IAAI,EAAE,8BAA8B;gBACpC,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,IAAI;aACd;YACD;gBACE,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,qCAAyB;gBAClC,QAAQ,EAAE,IAAI;aACf;SACF,CAAA;QAED,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,GAAG,EAAE,6BAA6B;gBAClC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAA;IACH,CAAC;CAAA;AAtCD,8CAsCC"}
|
|
@@ -18,7 +18,7 @@ async function listWorkspaceForms(context, workspace) {
|
|
|
18
18
|
if (!result.hasMore)
|
|
19
19
|
break;
|
|
20
20
|
if (!result.nextCursor) {
|
|
21
|
-
throw new n8n_workflow_1.NodeApiError(context.getNode(), { message: '
|
|
21
|
+
throw new n8n_workflow_1.NodeApiError(context.getNode(), { message: 'formbase returned an incomplete forms page' });
|
|
22
22
|
}
|
|
23
23
|
cursor = result.nextCursor;
|
|
24
24
|
} while (cursor);
|
|
@@ -30,22 +30,22 @@ function findWebhookSubscription(subscriptions, targetUrl, eventType) {
|
|
|
30
30
|
class FormbaseTrigger {
|
|
31
31
|
constructor() {
|
|
32
32
|
this.description = {
|
|
33
|
-
displayName: '
|
|
33
|
+
displayName: 'formbase Trigger',
|
|
34
34
|
name: 'formbaseTrigger',
|
|
35
35
|
icon: { light: 'file:formbase.svg', dark: 'file:formbase.dark.svg' },
|
|
36
36
|
group: ['trigger'],
|
|
37
37
|
version: 1,
|
|
38
38
|
subtitle: '={{$parameter["event"]}}',
|
|
39
|
-
description: 'Starts the workflow when a
|
|
39
|
+
description: 'Starts the workflow when a formbase form receives a submission',
|
|
40
40
|
usableAsTool: true,
|
|
41
41
|
defaults: {
|
|
42
|
-
name: '
|
|
42
|
+
name: 'formbase Trigger',
|
|
43
43
|
},
|
|
44
44
|
inputs: [],
|
|
45
45
|
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
46
46
|
credentials: [
|
|
47
47
|
{
|
|
48
|
-
name:
|
|
48
|
+
name: constants_1.FORMBASE_OAUTH2_CREDENTIAL_NAME,
|
|
49
49
|
required: true,
|
|
50
50
|
},
|
|
51
51
|
],
|
|
@@ -58,12 +58,12 @@ class FormbaseTrigger {
|
|
|
58
58
|
},
|
|
59
59
|
],
|
|
60
60
|
triggerPanel: {
|
|
61
|
-
header: 'Listening for
|
|
61
|
+
header: 'Listening for formbase submissions',
|
|
62
62
|
executionsHelp: {
|
|
63
63
|
inactive: 'While building the workflow, click <em>Listen for Test Event</em> and submit the form once. New submissions arrive in real time after the workflow is activated.',
|
|
64
64
|
active: 'New submissions to the selected form trigger this workflow. The webhook remains registered while the workflow is active.',
|
|
65
65
|
},
|
|
66
|
-
activationHint: 'Activate the workflow to register the webhook with
|
|
66
|
+
activationHint: 'Activate the workflow to register the webhook with formbase. Deactivating removes it.',
|
|
67
67
|
},
|
|
68
68
|
properties: [
|
|
69
69
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormbaseTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Formbase/FormbaseTrigger.node.ts"],"names":[],"mappings":";;;AAUA,+CAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":"FormbaseTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Formbase/FormbaseTrigger.node.ts"],"names":[],"mappings":";;;AAUA,+CAAgE;AAEhE,2CAAiH;AACjH,yDAAuD;AA8BvD,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,KAAK,UAAU,kBAAkB,CAAC,OAA8B,EAAE,SAA2B;IAC3F,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,IAAI,MAA0B,CAAA;IAE9B,GAAG,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,MAAM,qCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE;YACnE,WAAW,EAAE,SAAS,CAAC,EAAE;YACzB,KAAK,EAAE,eAAe;YACtB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9B,CAAC,CAA8B,CAAA;QAEhC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KA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ACF,CAAA;IAQH,CAAC;IANC,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,GAAgB,IAAI,CAAC,WAAW,EAAE,CAAA;QAC5C,OAAO;YACL,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACnD,CAAA;IACH,CAAC;CACF;AA/JD,0CA+JC"}
|
|
@@ -16,30 +16,30 @@ const ERROR_CODE_TO_HTTP = {
|
|
|
16
16
|
};
|
|
17
17
|
async function formbaseApiRequest(method, params = {}) {
|
|
18
18
|
var _a, _b, _c, _d, _e, _f;
|
|
19
|
-
const credentials = await this.getCredentials(
|
|
20
|
-
const
|
|
19
|
+
const credentials = await this.getCredentials(constants_1.FORMBASE_OAUTH2_CREDENTIAL_NAME);
|
|
20
|
+
const resourceUrl = String((_a = credentials.serverUrl) !== null && _a !== void 0 ? _a : constants_1.FORMBASE_API_RESOURCE_URL).replace(/\/+$/, '');
|
|
21
21
|
const options = {
|
|
22
22
|
method: 'POST',
|
|
23
|
-
url:
|
|
23
|
+
url: resourceUrl,
|
|
24
24
|
body: { method, params },
|
|
25
25
|
json: true,
|
|
26
26
|
ignoreHttpStatusErrors: true,
|
|
27
27
|
returnFullResponse: false,
|
|
28
28
|
};
|
|
29
|
-
const response = (await this.helpers.httpRequestWithAuthentication.call(this,
|
|
29
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, constants_1.FORMBASE_OAUTH2_CREDENTIAL_NAME, options));
|
|
30
30
|
if (!response || typeof response !== 'object') {
|
|
31
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid response from
|
|
31
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid response from formbase API' });
|
|
32
32
|
}
|
|
33
33
|
if (response.ok === false) {
|
|
34
34
|
const code = (_c = (_b = response.error) === null || _b === void 0 ? void 0 : _b.code) !== null && _c !== void 0 ? _c : 'INTERNAL_ERROR';
|
|
35
|
-
const message = (_e = (_d = response.error) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : '
|
|
35
|
+
const message = (_e = (_d = response.error) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : 'formbase API error';
|
|
36
36
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message, code }, {
|
|
37
37
|
message: `${code}: ${message}`,
|
|
38
38
|
httpCode: String((_f = ERROR_CODE_TO_HTTP[code]) !== null && _f !== void 0 ? _f : 500),
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
if (response.ok !== true || !('data' in response)) {
|
|
42
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid response from
|
|
42
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid response from formbase API' });
|
|
43
43
|
}
|
|
44
44
|
return response.data;
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Formbase/GenericFunctions.ts"],"names":[],"mappings":";;AAoCA,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Formbase/GenericFunctions.ts"],"names":[],"mappings":";;AAoCA,gDA0CC;AAxED,+CAA2C;AAE3C,2CAAwF;AAgBxF,MAAM,kBAAkB,GAA2B;IACjD,gBAAgB,EAAE,GAAG;IACrB,YAAY,EAAE,GAAG;IACjB,gBAAgB,EAAE,GAAG;IACrB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,gBAAgB,EAAE,GAAG;IACrB,QAAQ,EAAE,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,cAAc,EAAE,GAAG;CACpB,CAAA;AAEM,KAAK,UAAU,kBAAkB,CAEtC,MAAc,EACd,SAAkC,EAAE;;IAEpC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,2CAA+B,CAAC,CAAA;IAC9E,MAAM,WAAW,GAAG,MAA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CAAC;QAClD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC,CAAA;IAC3F,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const DEFAULT_FORMBASE_API_URL = "https://api.formbase.so";
|
|
2
2
|
export declare const FORMBASE_API_PATH = "/api/v1";
|
|
3
|
+
export declare const FORMBASE_API_RESOURCE_URL = "https://api.formbase.so/api/v1";
|
|
4
|
+
export declare const FORMBASE_OAUTH2_CREDENTIAL_NAME = "formbaseOAuth2Api";
|
|
3
5
|
export declare const FORMBASE_WEBHOOK_EVENTS: {
|
|
4
6
|
readonly submissionCreated: "submission_created";
|
|
5
7
|
readonly submissionAbandoned: "submission_abandoned";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORMBASE_WEBHOOK_EVENTS = exports.FORMBASE_API_PATH = exports.DEFAULT_FORMBASE_API_URL = void 0;
|
|
3
|
+
exports.FORMBASE_WEBHOOK_EVENTS = exports.FORMBASE_OAUTH2_CREDENTIAL_NAME = exports.FORMBASE_API_RESOURCE_URL = exports.FORMBASE_API_PATH = exports.DEFAULT_FORMBASE_API_URL = void 0;
|
|
4
4
|
exports.DEFAULT_FORMBASE_API_URL = 'https://api.formbase.so';
|
|
5
5
|
exports.FORMBASE_API_PATH = '/api/v1';
|
|
6
|
+
exports.FORMBASE_API_RESOURCE_URL = `${exports.DEFAULT_FORMBASE_API_URL}${exports.FORMBASE_API_PATH}`;
|
|
7
|
+
exports.FORMBASE_OAUTH2_CREDENTIAL_NAME = 'formbaseOAuth2Api';
|
|
6
8
|
exports.FORMBASE_WEBHOOK_EVENTS = {
|
|
7
9
|
submissionCreated: 'submission_created',
|
|
8
10
|
submissionAbandoned: 'submission_abandoned',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../nodes/Formbase/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,yBAAyB,CAAA;AAEpD,QAAA,iBAAiB,GAAG,SAAS,CAAA;AAE7B,QAAA,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,oBAAoB;IACvC,mBAAmB,EAAE,sBAAsB;CACnC,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../nodes/Formbase/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,yBAAyB,CAAA;AAEpD,QAAA,iBAAiB,GAAG,SAAS,CAAA;AAE7B,QAAA,yBAAyB,GAAG,GAAG,gCAAwB,GAAG,yBAAiB,EAAE,CAAA;AAE7E,QAAA,+BAA+B,GAAG,mBAAmB,CAAA;AAErD,QAAA,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,oBAAoB;IACvC,mBAAmB,EAAE,sBAAsB;CACnC,CAAA"}
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-formbase",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community node for
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "n8n community node for formbase — trigger workflows from form submissions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
7
7
|
"n8n",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"n8nNodesApiVersion": 1,
|
|
42
42
|
"strict": true,
|
|
43
43
|
"credentials": [
|
|
44
|
-
"dist/credentials/
|
|
44
|
+
"dist/credentials/FormbaseOAuth2Api.credentials.js"
|
|
45
45
|
],
|
|
46
46
|
"nodes": [
|
|
47
47
|
"dist/nodes/Formbase/FormbaseTrigger.node.js"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-formbase",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community node for
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "n8n community node for formbase — trigger workflows from form submissions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
7
7
|
"n8n",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"n8nNodesApiVersion": 1,
|
|
42
42
|
"strict": true,
|
|
43
43
|
"credentials": [
|
|
44
|
-
"dist/credentials/
|
|
44
|
+
"dist/credentials/FormbaseOAuth2Api.credentials.js"
|
|
45
45
|
],
|
|
46
46
|
"nodes": [
|
|
47
47
|
"dist/nodes/Formbase/FormbaseTrigger.node.js"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export declare class FormbaseApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
icon: Icon;
|
|
6
|
-
documentationUrl: string;
|
|
7
|
-
properties: INodeProperties[];
|
|
8
|
-
authenticate: IAuthenticateGeneric;
|
|
9
|
-
test: ICredentialTestRequest;
|
|
10
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormbaseApi = void 0;
|
|
4
|
-
const constants_1 = require("../nodes/Formbase/constants");
|
|
5
|
-
class FormbaseApi {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.name = 'formbaseApi';
|
|
8
|
-
this.displayName = 'Formbase API';
|
|
9
|
-
this.icon = { light: 'file:../nodes/Formbase/formbase.svg', dark: 'file:../nodes/Formbase/formbase.dark.svg' };
|
|
10
|
-
this.documentationUrl = 'https://docs.formbase.so/developers/api-tokens';
|
|
11
|
-
this.properties = [
|
|
12
|
-
{
|
|
13
|
-
displayName: 'API Key',
|
|
14
|
-
name: 'apiKey',
|
|
15
|
-
type: 'string',
|
|
16
|
-
typeOptions: { password: true },
|
|
17
|
-
default: '',
|
|
18
|
-
required: true,
|
|
19
|
-
description: 'API token from Formbase (OAuth and API Keys). Starts with <code>fb_</code>.',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
displayName: 'API Base URL',
|
|
23
|
-
name: 'baseUrl',
|
|
24
|
-
type: 'string',
|
|
25
|
-
default: constants_1.DEFAULT_FORMBASE_API_URL,
|
|
26
|
-
required: true,
|
|
27
|
-
description: 'Formbase API origin. Keep the default unless Formbase support provides a different URL.',
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
this.authenticate = {
|
|
31
|
-
type: 'generic',
|
|
32
|
-
properties: {
|
|
33
|
-
headers: {
|
|
34
|
-
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
this.test = {
|
|
39
|
-
request: {
|
|
40
|
-
baseURL: '={{$credentials.baseUrl}}',
|
|
41
|
-
url: constants_1.FORMBASE_API_PATH,
|
|
42
|
-
method: 'POST',
|
|
43
|
-
body: {
|
|
44
|
-
method: 'me.get',
|
|
45
|
-
params: {},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.FormbaseApi = FormbaseApi;
|
|
52
|
-
//# sourceMappingURL=FormbaseApi.credentials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormbaseApi.credentials.js","sourceRoot":"","sources":["../../credentials/FormbaseApi.credentials.ts"],"names":[],"mappings":";;;AAEA,2DAAyF;AAEzF,MAAa,WAAW;IAAxB;QACE,SAAI,GAAG,aAAa,CAAA;QAEpB,gBAAW,GAAG,cAAc,CAAA;QAE5B,SAAI,GAAS,EAAE,KAAK,EAAE,qCAAqC,EAAE,IAAI,EAAE,0CAA0C,EAAE,CAAA;QAE/G,qBAAgB,GAAG,gDAAgD,CAAA;QAEnE,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,6EAA6E;aAC3F;YACD;gBACE,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oCAAwB;gBACjC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,yFAAyF;aACvG;SACF,CAAA;QAED,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,iCAAiC;iBACjD;aACF;SACF,CAAA;QAED,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,6BAAiB;gBACtB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAA;IACH,CAAC;CAAA;AAjDD,kCAiDC"}
|