@chez14org/n8n-nodes-facebook-page 0.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.
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "@chez14org/n8n-nodes-facebook-page-api",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Marketing", "Development"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://gitlab.com/chez14org/n8n-nodes/facebook-page-api#credentials"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://gitlab.com/chez14org/n8n-nodes/facebook-page-api"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,36 @@
1
+ import { type INode } from 'n8n-workflow';
2
+ export declare const GRAPH_BASE_URL = "https://graph.facebook.com";
3
+ export type AuthenticationType = 'oAuth2' | 'accessToken';
4
+ export interface NameValuePair {
5
+ name: string;
6
+ value: string;
7
+ }
8
+ export interface PairsParameter {
9
+ parameters?: NameValuePair[];
10
+ }
11
+ export declare function buildGraphUrl(value: unknown, node: INode, itemIndex?: number): string;
12
+ export declare function pairsToObject(pairs: PairsParameter | undefined): Record<string, string>;
13
+ export declare function withAccessToken(qs: Record<string, string>, token: string): Record<string, string>;
14
+ export declare function buildPageTokenRequest(pageId: string): {
15
+ method: "GET";
16
+ url: string;
17
+ qs: {
18
+ fields: string;
19
+ };
20
+ json: boolean;
21
+ };
22
+ export declare function extractPageToken(response: unknown): string | undefined;
23
+ export interface BuildBodyInput {
24
+ sendBody: boolean;
25
+ contentType: 'json' | 'form-urlencoded';
26
+ jsonBody?: unknown;
27
+ pairs?: PairsParameter;
28
+ method: string;
29
+ }
30
+ export interface BuiltBody {
31
+ body?: Record<string, unknown> | string;
32
+ headers: Record<string, string>;
33
+ json: boolean;
34
+ }
35
+ export declare function buildBody(input: BuildBodyInput): BuiltBody;
36
+ export declare function normalizePageId(value: unknown): string;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GRAPH_BASE_URL = void 0;
4
+ exports.buildGraphUrl = buildGraphUrl;
5
+ exports.pairsToObject = pairsToObject;
6
+ exports.withAccessToken = withAccessToken;
7
+ exports.buildPageTokenRequest = buildPageTokenRequest;
8
+ exports.extractPageToken = extractPageToken;
9
+ exports.buildBody = buildBody;
10
+ exports.normalizePageId = normalizePageId;
11
+ const n8n_workflow_1 = require("n8n-workflow");
12
+ exports.GRAPH_BASE_URL = 'https://graph.facebook.com';
13
+ function nonEmptyString(value) {
14
+ if (typeof value === 'string' && value.trim().length > 0) {
15
+ return value;
16
+ }
17
+ return undefined;
18
+ }
19
+ function buildGraphUrl(value, node, itemIndex) {
20
+ let path = '';
21
+ if (typeof value === 'string') {
22
+ path = value.trim();
23
+ }
24
+ if (!path) {
25
+ throw new n8n_workflow_1.NodeOperationError(node, 'Path is required', { itemIndex });
26
+ }
27
+ if (/^https?:\/\//i.test(path)) {
28
+ throw new n8n_workflow_1.NodeOperationError(node, `"${path}" is a full URL. Enter only the path, e.g. /v25.0/me/feed; the node adds ${exports.GRAPH_BASE_URL}`, { itemIndex });
29
+ }
30
+ return `${exports.GRAPH_BASE_URL}/${path.replace(/^\/+/, '')}`;
31
+ }
32
+ function pairsToObject(pairs) {
33
+ var _a;
34
+ const result = {};
35
+ for (const pair of (_a = pairs === null || pairs === void 0 ? void 0 : pairs.parameters) !== null && _a !== void 0 ? _a : []) {
36
+ if (!pair.name) {
37
+ continue;
38
+ }
39
+ result[pair.name] = pair.value;
40
+ }
41
+ return result;
42
+ }
43
+ function withAccessToken(qs, token) {
44
+ return { ...qs, access_token: token };
45
+ }
46
+ function buildPageTokenRequest(pageId) {
47
+ return {
48
+ method: 'GET',
49
+ url: `${exports.GRAPH_BASE_URL}/${encodeURIComponent(pageId)}`,
50
+ qs: { fields: 'access_token' },
51
+ json: true,
52
+ };
53
+ }
54
+ function extractPageToken(response) {
55
+ const token = response === null || response === void 0 ? void 0 : response.access_token;
56
+ return nonEmptyString(token);
57
+ }
58
+ function parseJson(text) {
59
+ if (text.trim().length === 0) {
60
+ return undefined;
61
+ }
62
+ return JSON.parse(text);
63
+ }
64
+ function buildBody(input) {
65
+ if (!input.sendBody || input.method === 'GET' || input.method === 'HEAD') {
66
+ return { headers: {}, json: true };
67
+ }
68
+ if (input.contentType === 'form-urlencoded') {
69
+ return {
70
+ body: new URLSearchParams(pairsToObject(input.pairs)).toString(),
71
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
72
+ json: true,
73
+ };
74
+ }
75
+ let parsed = input.jsonBody;
76
+ if (typeof parsed === 'string') {
77
+ parsed = parseJson(parsed);
78
+ }
79
+ return {
80
+ body: parsed,
81
+ headers: { 'content-type': 'application/json' },
82
+ json: true,
83
+ };
84
+ }
85
+ function normalizePageId(value) {
86
+ var _a, _b;
87
+ return (_b = (_a = nonEmptyString(value)) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
88
+ }
89
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../nodes/FacebookPageApi/helpers.ts"],"names":[],"mappings":";;;AA2BA,sCAgBC;AAGD,sCASC;AAGD,0CAEC;AAMD,sDAOC;AAGD,4CAGC;AAwBD,8BAoBC;AAGD,0CAEC;AAhID,+CAA8D;AAGjD,QAAA,cAAc,GAAG,4BAA4B,CAAC;AAa3D,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,SAAgB,aAAa,CAAC,KAAc,EAAE,IAAW,EAAE,SAAkB;IAC3E,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,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C,OAAO,MAAA,MAAA,cAAc,CAAC,KAAK,CAAC,0CAAE,IAAI,EAAE,mCAAI,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@chez14org/n8n-nodes-facebook-page",
3
+ "version": "0.0.0",
4
+ "description": "n8n community node for the Facebook Graph API with Page access token support.",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "packageManager": "pnpm@12.8.2",
8
+ "homepage": "https://gitlab.com/chez14org/n8n-nodes/facebook-page-api",
9
+ "keywords": [
10
+ "n8n-community-node-package",
11
+ "facebook",
12
+ "facebook-page",
13
+ "meta",
14
+ "oauth2"
15
+ ],
16
+ "author": {
17
+ "name": "Gunawan Christianto",
18
+ "email": "chris@christianto.net"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://gitlab.com/chez14org/n8n-nodes/facebook-page-api.git"
23
+ },
24
+ "scripts": {
25
+ "build": "n8n-node build",
26
+ "build:watch": "tsc --watch",
27
+ "dev": "n8n-node dev",
28
+ "lint": "n8n-node lint",
29
+ "lint:fix": "n8n-node lint --fix",
30
+ "lint:publish": "publint --strict",
31
+ "release": "n8n-node release",
32
+ "test": "vitest run",
33
+ "test:coverage": "vitest run --coverage",
34
+ "test:watch": "vitest"
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "sideEffects": false,
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "provenance": true
43
+ },
44
+ "n8n": {
45
+ "n8nNodesApiVersion": 1,
46
+ "strict": false,
47
+ "credentials": [
48
+ "dist/credentials/Ch14FacebookOAuth2Api.credentials.js",
49
+ "dist/credentials/Ch14FacebookAccessTokenApi.credentials.js"
50
+ ],
51
+ "nodes": [
52
+ "dist/nodes/FacebookPageApi/FacebookPageApi.node.js"
53
+ ]
54
+ },
55
+ "devDependencies": {
56
+ "@eslint/js": "^9.39.5",
57
+ "@n8n/node-cli": "^0.41.2",
58
+ "@net.christianto/eslint-config": "^1.0.0",
59
+ "@vitest/coverage-v8": "^4.1.11",
60
+ "eslint": "9.32.0",
61
+ "eslint-config-prettier": "^10.1.8",
62
+ "eslint-plugin-n": "^18.4.1",
63
+ "eslint-plugin-package-json": "^1.10.1",
64
+ "globals": "^17.13.0",
65
+ "n8n-workflow": "*",
66
+ "prettier": "3.6.2",
67
+ "publint": "^0.3.25",
68
+ "release-it": "^21.1.0",
69
+ "typescript": "5.9.2",
70
+ "typescript-eslint": "^8.71.1",
71
+ "vitest": "^4.1.11"
72
+ },
73
+ "peerDependencies": {
74
+ "n8n-workflow": "*"
75
+ }
76
+ }