n8n-nodes-pocketbase 0.3.2 → 1.0.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/dist/credentials/PocketBaseApi.credentials.d.ts +6 -1
- package/dist/credentials/PocketBaseApi.credentials.js +54 -7
- package/dist/credentials/PocketBaseApi.credentials.js.map +1 -1
- package/dist/nodes/PocketBase/GenericFunctions.d.ts +6 -0
- package/dist/nodes/PocketBase/GenericFunctions.js +42 -0
- package/dist/nodes/PocketBase/GenericFunctions.js.map +1 -0
- package/dist/nodes/PocketBase/LoadOptions.d.ts +28 -0
- package/dist/nodes/PocketBase/LoadOptions.js +88 -0
- package/dist/nodes/PocketBase/LoadOptions.js.map +1 -0
- package/dist/nodes/PocketBase/PocketBase.node.d.ts +9 -2
- package/dist/nodes/PocketBase/PocketBase.node.js +215 -147
- package/dist/nodes/PocketBase/PocketBase.node.js.map +1 -1
- package/dist/nodes/PocketBase/PocketBase.node.json +1 -1
- package/dist/nodes/PocketBase/RequestBodyFunctions.d.ts +2 -0
- package/dist/nodes/PocketBase/RequestBodyFunctions.js +52 -0
- package/dist/nodes/PocketBase/RequestBodyFunctions.js.map +1 -0
- package/dist/package.json +18 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -22
- package/dist/nodes/PocketBaseSend/PocketBaseSend.node.d.ts +0 -5
- package/dist/nodes/PocketBaseSend/PocketBaseSend.node.js +0 -90
- package/dist/nodes/PocketBaseSend/PocketBaseSend.node.js.map +0 -1
- package/dist/nodes/PocketBaseSend/PocketBaseSend.node.json +0 -23
- /package/dist/{nodes/PocketBaseSend → credentials}/pocketbase.svg +0 -0
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
1
|
+
import { IAuthenticate, IconFile, ICredentialDataDecryptedObject, ICredentialTestRequest, ICredentialType, IHttpRequestHelper, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
export declare class PocketBaseApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
documentationUrl: string;
|
|
6
6
|
properties: INodeProperties[];
|
|
7
7
|
test: ICredentialTestRequest;
|
|
8
|
+
preAuthentication(this: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject): Promise<{
|
|
9
|
+
token: string;
|
|
10
|
+
}>;
|
|
11
|
+
authenticate: IAuthenticate;
|
|
12
|
+
icon: IconFile;
|
|
8
13
|
}
|
|
@@ -12,7 +12,7 @@ class PocketBaseApi {
|
|
|
12
12
|
name: 'url',
|
|
13
13
|
type: 'string',
|
|
14
14
|
default: '',
|
|
15
|
-
required: true
|
|
15
|
+
required: true,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
displayName: 'User collection name',
|
|
@@ -20,14 +20,14 @@ class PocketBaseApi {
|
|
|
20
20
|
name: 'userCollection',
|
|
21
21
|
type: 'string',
|
|
22
22
|
default: '_superusers',
|
|
23
|
-
required: true
|
|
23
|
+
required: true,
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
displayName: 'Username',
|
|
27
27
|
name: 'username',
|
|
28
28
|
type: 'string',
|
|
29
29
|
default: '',
|
|
30
|
-
required: true
|
|
30
|
+
required: true,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
displayName: 'Password',
|
|
@@ -37,8 +37,18 @@ class PocketBaseApi {
|
|
|
37
37
|
password: true,
|
|
38
38
|
},
|
|
39
39
|
default: '',
|
|
40
|
-
required: true
|
|
41
|
-
}
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Session Token',
|
|
44
|
+
name: 'token',
|
|
45
|
+
type: 'hidden',
|
|
46
|
+
typeOptions: {
|
|
47
|
+
expirable: true,
|
|
48
|
+
password: true,
|
|
49
|
+
},
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
42
52
|
];
|
|
43
53
|
this.test = {
|
|
44
54
|
request: {
|
|
@@ -48,9 +58,46 @@ class PocketBaseApi {
|
|
|
48
58
|
body: {
|
|
49
59
|
identity: '={{$credentials?.username}}',
|
|
50
60
|
password: '={{$credentials?.password}}',
|
|
51
|
-
}
|
|
52
|
-
}
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
rules: [
|
|
64
|
+
{
|
|
65
|
+
type: 'responseCode',
|
|
66
|
+
properties: {
|
|
67
|
+
value: 200,
|
|
68
|
+
message: 'Test',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'responseCode',
|
|
73
|
+
properties: {
|
|
74
|
+
value: 400,
|
|
75
|
+
message: 'An error occurred during login',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
this.authenticate = {
|
|
81
|
+
type: 'generic',
|
|
82
|
+
properties: {
|
|
83
|
+
headers: {
|
|
84
|
+
Authorization: '={{ $credentials.token }}',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
53
87
|
};
|
|
88
|
+
this.icon = 'file:pocketbase.svg';
|
|
89
|
+
}
|
|
90
|
+
async preAuthentication(credentials) {
|
|
91
|
+
const { username, password, url, userCollection } = credentials;
|
|
92
|
+
const { token } = (await this.helpers.httpRequest({
|
|
93
|
+
method: 'POST',
|
|
94
|
+
url: `${url.endsWith('/') ? url.slice(0, -1) : url}/api/collections/${userCollection}/auth-with-password`,
|
|
95
|
+
body: {
|
|
96
|
+
identity: username,
|
|
97
|
+
password,
|
|
98
|
+
},
|
|
99
|
+
}));
|
|
100
|
+
return { token };
|
|
54
101
|
}
|
|
55
102
|
}
|
|
56
103
|
exports.PocketBaseApi = PocketBaseApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PocketBaseApi.credentials.js","sourceRoot":"","sources":["../../credentials/PocketBaseApi.credentials.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PocketBaseApi.credent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;YACD,KAAK,EAAE;gBACN;oBACC,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACX,KAAK,EAAE,GAAG;wBACV,OAAO,EAAE,MAAM;qBACf;iBACD;gBACD;oBACC,IAAI,EAAE,cAAc;oBACpB,UAAU,EAAE;wBACX,KAAK,EAAE,GAAG;wBACV,OAAO,EAAE,gCAAgC;qBACzC;iBACD;aACD;SACD,CAAC;QAgBF,iBAAY,GAAkB;YAC7B,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,2BAA2B;iBAC1C;aACD;SACD,CAAC;QAEF,SAAI,GAAG,qBAAiC,CAAC;IAC1C,CAAC;IAxBA,KAAK,CAAC,iBAAiB,CAA2B,WAA2C;QAC5F,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,WAAqC,CAAC;QAE1F,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACjD,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAoB,cAAc,qBAAqB;YACzG,IAAI,EAAE;gBACL,QAAQ,EAAE,QAAQ;gBAClB,QAAQ;aACR;SACD,CAAC,CAAsB,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,CAAC;IAClB,CAAC;CAYD;AAtGD,sCAsGC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DeclarativeRestApiSettings, IExecutePaginationFunctions, IExecuteSingleFunctions, IHttpRequestOptions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function recordViewPreSendAction(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
3
|
+
export declare function recordViewPostReceiveAction(this: IExecuteSingleFunctions, items: INodeExecutionData[]): Promise<INodeExecutionData[]>;
|
|
4
|
+
export declare function recordUpdatePreSendAction(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
5
|
+
export declare function recordCreatePreSendAction(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
6
|
+
export declare function pagination(this: IExecutePaginationFunctions, requestOptions: DeclarativeRestApiSettings.ResultOptions): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordViewPreSendAction = recordViewPreSendAction;
|
|
4
|
+
exports.recordViewPostReceiveAction = recordViewPostReceiveAction;
|
|
5
|
+
exports.recordUpdatePreSendAction = recordUpdatePreSendAction;
|
|
6
|
+
exports.recordCreatePreSendAction = recordCreatePreSendAction;
|
|
7
|
+
exports.pagination = pagination;
|
|
8
|
+
const RequestBodyFunctions_1 = require("./RequestBodyFunctions");
|
|
9
|
+
async function recordViewPreSendAction(requestOptions) {
|
|
10
|
+
this.logger.info(`Request URL: ${requestOptions.url} | ${JSON.stringify(requestOptions.qs)}`);
|
|
11
|
+
return requestOptions;
|
|
12
|
+
}
|
|
13
|
+
async function recordViewPostReceiveAction(items) {
|
|
14
|
+
return items;
|
|
15
|
+
}
|
|
16
|
+
async function recordUpdatePreSendAction(requestOptions) {
|
|
17
|
+
return await RequestBodyFunctions_1.prepareRequestBody.call(this, requestOptions);
|
|
18
|
+
}
|
|
19
|
+
async function recordCreatePreSendAction(requestOptions) {
|
|
20
|
+
return await RequestBodyFunctions_1.prepareRequestBody.call(this, requestOptions);
|
|
21
|
+
}
|
|
22
|
+
async function pagination(requestOptions) {
|
|
23
|
+
var _a;
|
|
24
|
+
var _b;
|
|
25
|
+
const allIsActive = this.getNodeParameter('parameters.allElements', false);
|
|
26
|
+
let executions = [];
|
|
27
|
+
let page = this.getNodeParameter('parameters.page', 1);
|
|
28
|
+
let totalPages = page + 1;
|
|
29
|
+
(_a = (_b = requestOptions.options).qs) !== null && _a !== void 0 ? _a : (_b.qs = {});
|
|
30
|
+
do {
|
|
31
|
+
requestOptions.options.qs.page = page;
|
|
32
|
+
const responseData = await this.makeRoutingRequest(requestOptions);
|
|
33
|
+
page = responseData[0].json.page;
|
|
34
|
+
if (allIsActive) {
|
|
35
|
+
totalPages = responseData[0].json.totalPages;
|
|
36
|
+
}
|
|
37
|
+
executions = executions.concat(responseData[0].json.items.map((item) => ({ json: item })));
|
|
38
|
+
page++;
|
|
39
|
+
} while (page < totalPages);
|
|
40
|
+
return executions;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/PocketBase/GenericFunctions.ts"],"names":[],"mappings":";;AAUA,0DAMC;AAED,kEAKC;AAED,8DAKC;AAED,8DAKC;AAED,gCAwBC;AAvDD,iEAA4D;AAErD,KAAK,UAAU,uBAAuB,CAE5C,cAAmC;IAEnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,cAAc,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9F,OAAO,cAAc,CAAC;AACvB,CAAC;AAEM,KAAK,UAAU,2BAA2B,CAEhD,KAA2B;IAE3B,OAAO,KAAK,CAAC;AACd,CAAC;AAEM,KAAK,UAAU,yBAAyB,CAE9C,cAAmC;IAEnC,OAAO,MAAM,yCAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC;AAEM,KAAK,UAAU,yBAAyB,CAE9C,cAAmC;IAEnC,OAAO,MAAM,yCAAkB,CAAC,IAAI,CAAC,I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+
id: string;
|
|
6
|
+
max?: number | string;
|
|
7
|
+
min?: number | string;
|
|
8
|
+
name: string;
|
|
9
|
+
pattern?: string;
|
|
10
|
+
presentable: boolean;
|
|
11
|
+
primaryKey?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
system: boolean;
|
|
14
|
+
type: string;
|
|
15
|
+
maxSelect?: number;
|
|
16
|
+
values?: string[];
|
|
17
|
+
onCreate?: boolean;
|
|
18
|
+
onUpdate?: boolean;
|
|
19
|
+
cascadeDelete?: boolean;
|
|
20
|
+
collectionId?: string;
|
|
21
|
+
minSelect?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const LoadOptions: {
|
|
24
|
+
getCollections(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
25
|
+
getFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
26
|
+
getRelations(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
27
|
+
getRows(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoadOptions = void 0;
|
|
4
|
+
async function loadPocketBaseFields(collectionName = null) {
|
|
5
|
+
const { url } = await this.getCredentials('pocketBaseApi');
|
|
6
|
+
const resource = collectionName
|
|
7
|
+
? collectionName
|
|
8
|
+
: this.getNodeParameter('resource');
|
|
9
|
+
const { fields } = await this.helpers.httpRequestWithAuthentication.call(this, 'pocketBaseApi', {
|
|
10
|
+
url: `${url}/api/collections/${resource}`,
|
|
11
|
+
method: 'GET',
|
|
12
|
+
});
|
|
13
|
+
return fields;
|
|
14
|
+
}
|
|
15
|
+
exports.LoadOptions = {
|
|
16
|
+
async getCollections() {
|
|
17
|
+
const returnData = [];
|
|
18
|
+
const { url } = await this.getCredentials('pocketBaseApi');
|
|
19
|
+
const { items } = await this.helpers.httpRequestWithAuthentication.call(this, 'pocketBaseApi', {
|
|
20
|
+
url: `${url}/api/collections`,
|
|
21
|
+
method: 'GET',
|
|
22
|
+
});
|
|
23
|
+
items.forEach(({ name }) => {
|
|
24
|
+
returnData.push({
|
|
25
|
+
name,
|
|
26
|
+
value: name,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
return returnData;
|
|
30
|
+
},
|
|
31
|
+
async getFields() {
|
|
32
|
+
const returnData = [];
|
|
33
|
+
const fields = await loadPocketBaseFields.call(this);
|
|
34
|
+
fields.forEach(({ name, type }) => {
|
|
35
|
+
if (type === 'relation') {
|
|
36
|
+
returnData.push({
|
|
37
|
+
name: `All fields from relation '${name}'`,
|
|
38
|
+
value: `expand.${name}.*`
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
returnData.push({
|
|
43
|
+
name,
|
|
44
|
+
value: name,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return returnData;
|
|
48
|
+
},
|
|
49
|
+
async getRelations() {
|
|
50
|
+
const returnData = [];
|
|
51
|
+
const fields = await loadPocketBaseFields.call(this);
|
|
52
|
+
fields.forEach(({ name, type }) => {
|
|
53
|
+
if (type !== 'relation') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
returnData.push({
|
|
57
|
+
name,
|
|
58
|
+
value: name,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return returnData;
|
|
62
|
+
},
|
|
63
|
+
async getRows() {
|
|
64
|
+
const returnData = [];
|
|
65
|
+
const { url } = await this.getCredentials('pocketBaseApi');
|
|
66
|
+
const resource = this.getNodeParameter('resource');
|
|
67
|
+
const { items } = await this.helpers.httpRequestWithAuthentication.call(this, 'pocketBaseApi', {
|
|
68
|
+
url: `${url}/api/collections/${resource}/records?sort=-created`,
|
|
69
|
+
method: 'GET',
|
|
70
|
+
});
|
|
71
|
+
items.forEach(({ id, ...data }) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const name = (_b = (_a = Object.entries(data).filter(([key]) => {
|
|
74
|
+
return key === 'name';
|
|
75
|
+
})) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[1];
|
|
76
|
+
const shortColumns = Object.fromEntries(Object.entries(data).filter(([, column]) => {
|
|
77
|
+
const serialized = JSON.stringify(column);
|
|
78
|
+
return serialized.length <= 20 && serialized.length > 2;
|
|
79
|
+
}));
|
|
80
|
+
returnData.push({
|
|
81
|
+
name: name ? name : JSON.stringify(shortColumns).substring(1, 100),
|
|
82
|
+
value: id,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return returnData;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=LoadOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadOptions.js","sourceRoot":"","sources":["../../../nodes/PocketBase/LoadOptions.ts"],"names":[],"mappings":";;;AAwBA,KAAK,UAAU,oBAAoB,CAElC,iBAAgC,IAAI;IAEpC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,cAAc;QAC9B,CAAC,CAAC,cAAc;QAChB,CAAC,CAAE,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAuB,CAAC;IAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE;QAC/F,GAAG,EAAE,GAAG,GAAG,oBAAoB,QAAQ,EAAE;QACzC,MAAM,EAAE,KAAK;KACb,CAAC,CAAC;IAEH,OAAO,MAA2B,CAAC;AACpC,CAAC;AAEY,QAAA,WAAW,GAAG;IAC1B,KAAK,CAAC,cAAc;QACnB,MAAM,UAAU,GAA2B,EAAE,CAAC;QAC9C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,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AC;YACzD,CAAC,CAAC,CACF,CAAC;YAEF,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;gBAClE,KAAK,EAAE,EAAE;aACT,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
export declare class PocketBase implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
|
-
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getCollections(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
7
|
+
getFields(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
8
|
+
getRelations(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
9
|
+
getRows(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
5
12
|
}
|