@getopenpost/n8n-nodes-openpost 0.0.0 → 0.1.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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -3
  3. package/dist/credentials/OpenPostApi.credentials.d.ts +17 -0
  4. package/dist/credentials/OpenPostApi.credentials.js +52 -0
  5. package/dist/credentials/OpenPostApi.credentials.js.map +1 -0
  6. package/dist/credentials/openpost.svg +5 -0
  7. package/dist/icons/openpost.svg +5 -0
  8. package/dist/nodes/OpenPost/OpenPost.node.d.ts +4 -0
  9. package/dist/nodes/OpenPost/OpenPost.node.js +22 -0
  10. package/dist/nodes/OpenPost/OpenPost.node.js.map +1 -0
  11. package/dist/nodes/OpenPost/openpost.dark.svg +5 -0
  12. package/dist/nodes/OpenPost/openpost.svg +5 -0
  13. package/dist/nodes/OpenPost/v1/OpenPostV1.node.d.ts +13 -0
  14. package/dist/nodes/OpenPost/v1/OpenPostV1.node.js +144 -0
  15. package/dist/nodes/OpenPost/v1/OpenPostV1.node.js.map +1 -0
  16. package/dist/nodes/OpenPost/v1/actions/generated/requestMappers.d.ts +1998 -0
  17. package/dist/nodes/OpenPost/v1/actions/generated/requestMappers.js +1185 -0
  18. package/dist/nodes/OpenPost/v1/actions/generated/requestMappers.js.map +1 -0
  19. package/dist/nodes/OpenPost/v1/actions/mapper.d.ts +36 -0
  20. package/dist/nodes/OpenPost/v1/actions/mapper.js +184 -0
  21. package/dist/nodes/OpenPost/v1/actions/mapper.js.map +1 -0
  22. package/dist/nodes/OpenPost/v1/descriptions/generated/descriptions.d.ts +333 -0
  23. package/dist/nodes/OpenPost/v1/descriptions/generated/descriptions.js +1869 -0
  24. package/dist/nodes/OpenPost/v1/descriptions/generated/descriptions.js.map +1 -0
  25. package/dist/nodes/OpenPost/v1/errors.d.ts +11 -0
  26. package/dist/nodes/OpenPost/v1/errors.js +43 -0
  27. package/dist/nodes/OpenPost/v1/errors.js.map +1 -0
  28. package/dist/nodes/OpenPost/v1/media/uploadBinary.d.ts +15 -0
  29. package/dist/nodes/OpenPost/v1/media/uploadBinary.js +69 -0
  30. package/dist/nodes/OpenPost/v1/media/uploadBinary.js.map +1 -0
  31. package/dist/nodes/OpenPost/v1/methods/listSearch.d.ts +7 -0
  32. package/dist/nodes/OpenPost/v1/methods/listSearch.js +80 -0
  33. package/dist/nodes/OpenPost/v1/methods/listSearch.js.map +1 -0
  34. package/dist/nodes/OpenPost/v1/openpost.dark.svg +5 -0
  35. package/dist/nodes/OpenPost/v1/openpost.svg +5 -0
  36. package/dist/nodes/OpenPost/v1/transport/openPostApiRequest.d.ts +5 -0
  37. package/dist/nodes/OpenPost/v1/transport/openPostApiRequest.js +64 -0
  38. package/dist/nodes/OpenPost/v1/transport/openPostApiRequest.js.map +1 -0
  39. package/dist/nodes/OpenPost/v1/transport/url.d.ts +2 -0
  40. package/dist/nodes/OpenPost/v1/transport/url.js +46 -0
  41. package/dist/nodes/OpenPost/v1/transport/url.js.map +1 -0
  42. package/docs/selected-contract-report.md +37 -0
  43. package/examples/create-draft.json +63 -0
  44. package/examples/list-workspaces.json +53 -0
  45. package/icons/openpost.svg +5 -0
  46. package/package.json +61 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenPost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,58 @@
1
- # OpenPost n8n package placeholder
1
+ # @getopenpost/n8n-nodes-openpost
2
2
 
3
- This 0.0.0 package only reserves the npm name for trusted publishing.
4
- Install version 0.1.0 or newer after the GitHub release workflow publishes it.
3
+ Official n8n community node for OpenPost. The package is MIT licensed and calls the normal OpenPost `/api/v1` REST API with API tokens.
4
+
5
+ > **Release status:** version 0.1.0 is the first stable package candidate. It has not yet been published to npm or accepted as an n8n verified community node. It requires Node.js 22.22 or newer.
6
+
7
+ ## Install
8
+
9
+ After the package appears on npm, install `@getopenpost/n8n-nodes-openpost` from n8n's Community Nodes settings. The package version is independent from the OpenPost app version.
10
+
11
+ ## Credentials
12
+
13
+ Create an OpenPost API token in OpenPost settings. For write workflows, prefer a workspace-bound `api:write` token named after the n8n workflow or instance.
14
+
15
+ In n8n, set:
16
+
17
+ - **Base URL**: your OpenPost origin, for example `https://app.openpost.social`. Do not include `/api` or `/api/v1`.
18
+ - **API Token**: the OpenPost API token.
19
+
20
+ If n8n runs in Docker, `localhost` means the n8n container. Use the OpenPost Compose service name or `host.docker.internal` when needed.
21
+
22
+ ## Actions
23
+
24
+ The node exposes a curated automation surface generated from OpenPost's canonical OpenAPI `x-openpost-automation` metadata:
25
+
26
+ - Workspace: Get Many
27
+ - Account: Get Many, Get Destination Options, Get Provider Readiness
28
+ - Social Set: Get, Get Many
29
+ - Posting Schedule: Get Next Available Slot
30
+ - Media: Get Many, Upload Binary
31
+ - Publication: Create, Get, Get Many, Update, Set Renditions, Validate, Schedule, Cancel, Publish Now, Retry Failed Renditions, Get Events
32
+ - Job: Get
33
+
34
+ Create, Schedule, and Publish Now are separate operations. Creating a Publication never publishes as a hidden side effect.
35
+
36
+ ## Triggers
37
+
38
+ This release does not ship an OpenPost-specific trigger. Use n8n's Webhook or Schedule Trigger nodes where they fit. Native OpenPost triggers will follow a generic, versioned event and webhook API rather than an n8n-only endpoint.
39
+
40
+ ## Reliability and safety
41
+
42
+ - Write actions send an `Idempotency-Key`. If you leave it blank, the node uses the n8n execution ID, action, and input item index.
43
+ - Read actions retry transient network, `429`, `502`, `503`, and `504` failures.
44
+ - Write actions retry only when an idempotency key is present.
45
+ - Errors include OpenPost `X-Request-ID` when the server returns it.
46
+ - Multiple input items preserve n8n item linking and support continue-on-fail.
47
+ - Binary upload creates an OpenPost upload session, uploads bytes to the returned target with only target headers, then completes the session through authenticated OpenPost REST. The OpenPost bearer token is never sent to storage upload URLs.
48
+
49
+ ## Contract report
50
+
51
+ See [`docs/selected-contract-report.md`](docs/selected-contract-report.md) for the generated action list and known catalog metadata gaps.
52
+
53
+ ## Workflow examples
54
+
55
+ - [`examples/list-workspaces.json`](examples/list-workspaces.json) checks the connection and lists accessible workspaces.
56
+ - [`examples/create-draft.json`](examples/create-draft.json) creates a draft from each incoming item. It does not schedule or publish anything.
57
+
58
+ Import an example into n8n, select your OpenPost credential, and replace each placeholder workspace ID or input value before running it.
@@ -0,0 +1,17 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from "n8n-workflow";
2
+ export declare class OpenPostApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: "file:openpost.svg";
6
+ documentationUrl: string;
7
+ genericAuth: boolean;
8
+ supportedNodes: string[];
9
+ httpRequestNode: {
10
+ name: string;
11
+ docsUrl: string;
12
+ apiBaseUrlPlaceholder: string;
13
+ };
14
+ properties: INodeProperties[];
15
+ authenticate: IAuthenticateGeneric;
16
+ test: ICredentialTestRequest;
17
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenPostApi = void 0;
4
+ class OpenPostApi {
5
+ name = "openPostApi";
6
+ displayName = "OpenPost API";
7
+ icon = "file:openpost.svg";
8
+ documentationUrl = "https://docs.openpost.dev/development/api-tokens";
9
+ genericAuth = true;
10
+ supportedNodes = ["openPost"];
11
+ httpRequestNode = {
12
+ name: "OpenPost API",
13
+ docsUrl: "https://docs.openpost.dev/development/api-tokens",
14
+ apiBaseUrlPlaceholder: "https://app.openpost.dev/api/v1",
15
+ };
16
+ properties = [
17
+ {
18
+ displayName: "Base URL",
19
+ name: "baseUrl",
20
+ type: "string",
21
+ default: "https://app.openpost.dev",
22
+ placeholder: "https://app.openpost.dev",
23
+ required: true,
24
+ description: "OpenPost origin without /api or /api/v1. In Docker, localhost means the n8n container.",
25
+ },
26
+ {
27
+ displayName: "API Token",
28
+ name: "apiToken",
29
+ type: "string",
30
+ typeOptions: { password: true },
31
+ default: "",
32
+ required: true,
33
+ description: "Use a workspace-bound api:write token for workflows that publish or mutate data.",
34
+ },
35
+ ];
36
+ authenticate = {
37
+ type: "generic",
38
+ properties: {
39
+ headers: {
40
+ Authorization: "=Bearer {{$credentials.apiToken}}",
41
+ },
42
+ },
43
+ };
44
+ test = {
45
+ request: {
46
+ method: "GET",
47
+ url: "={{$credentials.baseUrl.replace(/\\/+$/, '') + '/api/v1/workspaces'}}",
48
+ },
49
+ };
50
+ }
51
+ exports.OpenPostApi = OpenPostApi;
52
+ //# sourceMappingURL=OpenPostApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenPostApi.credentials.js","sourceRoot":"","sources":["../../credentials/OpenPostApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IACtB,IAAI,GAAG,aAAa,CAAC;IACrB,WAAW,GAAG,cAAc,CAAC;IAC7B,IAAI,GAAG,mBAA4B,CAAC;IACpC,gBAAgB,GAAG,kDAAkD,CAAC;IACtE,WAAW,GAAG,IAAI,CAAC;IACnB,cAAc,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9B,eAAe,GAAG;QAChB,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,kDAAkD;QAC3D,qBAAqB,EAAE,iCAAiC;KACzD,CAAC;IAEF,UAAU,GAAsB;QAC9B;YACE,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,0BAA0B;YACnC,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,wFAAwF;SAC3F;QACD;YACE,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,kFAAkF;SACrF;KACF,CAAC;IAEF,YAAY,GAAyB;QACnC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,aAAa,EAAE,mCAAmC;aACnD;SACF;KACF,CAAC;IAEF,IAAI,GAA2B;QAC7B,OAAO,EAAE;YACP,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,uEAAuE;SAC7E;KACF,CAAC;CACH;AAnDD,kCAmDC"}
@@ -0,0 +1,5 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="64" height="64" rx="16" fill="#111827"/>
3
+ <path d="M18 19.5C18 16.4624 20.4624 14 23.5 14H35C43.2843 14 50 20.7157 50 29C50 37.2843 43.2843 44 35 44H29V50H18V19.5Z" fill="#F9FAFB"/>
4
+ <path d="M29 24.5H35C37.4853 24.5 39.5 26.5147 39.5 29C39.5 31.4853 37.4853 33.5 35 33.5H29V24.5Z" fill="#2563EB"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="64" height="64" rx="16" fill="#111827"/>
3
+ <path d="M18 19.5C18 16.4624 20.4624 14 23.5 14H35C43.2843 14 50 20.7157 50 29C50 37.2843 43.2843 44 35 44H29V50H18V19.5Z" fill="#F9FAFB"/>
4
+ <path d="M29 24.5H35C37.4853 24.5 39.5 26.5147 39.5 29C39.5 31.4853 37.4853 33.5 35 33.5H29V24.5Z" fill="#2563EB"/>
5
+ </svg>
@@ -0,0 +1,4 @@
1
+ import { VersionedNodeType } from "n8n-workflow";
2
+ export declare class OpenPost extends VersionedNodeType {
3
+ constructor();
4
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenPost = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const OpenPostV1_node_1 = require("./v1/OpenPostV1.node");
6
+ class OpenPost extends n8n_workflow_1.VersionedNodeType {
7
+ constructor() {
8
+ const baseDescription = {
9
+ displayName: "OpenPost",
10
+ name: "openPost",
11
+ icon: { light: "file:openpost.svg", dark: "file:openpost.dark.svg" },
12
+ group: ["output"],
13
+ description: "Publish, schedule, and inspect OpenPost Publications.",
14
+ defaultVersion: 1,
15
+ };
16
+ super({
17
+ 1: new OpenPostV1_node_1.OpenPostV1(),
18
+ }, baseDescription);
19
+ }
20
+ }
21
+ exports.OpenPost = OpenPost;
22
+ //# sourceMappingURL=OpenPost.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenPost.node.js","sourceRoot":"","sources":["../../../nodes/OpenPost/OpenPost.node.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AAEjD,0DAAkD;AAElD,MAAa,QAAS,SAAQ,gCAAiB;IAC7C;QACE,MAAM,eAAe,GAAG;YACtB,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAW;YAC7E,KAAK,EAAE,CAAC,QAAiB,CAAC;YAC1B,WAAW,EAAE,uDAAuD;YACpE,cAAc,EAAE,CAAC;SAClB,CAAC;QACF,KAAK,CACH;YACE,CAAC,EAAE,IAAI,4BAAU,EAAE;SACpB,EACD,eAAe,CAChB,CAAC;IACJ,CAAC;CACF;AAjBD,4BAiBC"}
@@ -0,0 +1,5 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="64" height="64" rx="16" fill="#111827"/>
3
+ <path d="M18 19.5C18 16.4624 20.4624 14 23.5 14H35C43.2843 14 50 20.7157 50 29C50 37.2843 43.2843 44 35 44H29V50H18V19.5Z" fill="#F9FAFB"/>
4
+ <path d="M29 24.5H35C37.4853 24.5 39.5 26.5147 39.5 29C39.5 31.4853 37.4853 33.5 35 33.5H29V24.5Z" fill="#2563EB"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="64" height="64" rx="16" fill="#111827"/>
3
+ <path d="M18 19.5C18 16.4624 20.4624 14 23.5 14H35C43.2843 14 50 20.7157 50 29C50 37.2843 43.2843 44 35 44H29V50H18V19.5Z" fill="#F9FAFB"/>
4
+ <path d="M29 24.5H35C37.4853 24.5 39.5 26.5147 39.5 29C39.5 31.4853 37.4853 33.5 35 33.5H29V24.5Z" fill="#2563EB"/>
5
+ </svg>
@@ -0,0 +1,13 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
2
+ export declare class OpenPostV1 implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ listSearch: {
6
+ searchWorkspaces(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
7
+ searchAccounts(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
8
+ searchPublications(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string, paginationToken?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
9
+ searchSocialSets(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
10
+ };
11
+ };
12
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
13
+ }
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenPostV1 = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const descriptions_1 = require("./descriptions/generated/descriptions");
6
+ const mapper_1 = require("./actions/mapper");
7
+ const errors_1 = require("./errors");
8
+ const uploadBinary_1 = require("./media/uploadBinary");
9
+ const listSearch_1 = require("./methods/listSearch");
10
+ const openPostApiRequest_1 = require("./transport/openPostApiRequest");
11
+ const url_1 = require("./transport/url");
12
+ // eslint-disable-next-line @n8n/community-nodes/node-usable-as-tool -- OpenPost write actions must not run as AI tools until confirmation and permissions are designed.
13
+ class OpenPostV1 {
14
+ description = {
15
+ displayName: "OpenPost",
16
+ name: "openPost",
17
+ icon: { light: "file:openpost.svg", dark: "file:openpost.dark.svg" },
18
+ group: ["output"],
19
+ version: 1,
20
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
21
+ description: "Publish, schedule, and inspect OpenPost Publications.",
22
+ defaults: {
23
+ name: "OpenPost",
24
+ },
25
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
26
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
27
+ credentials: [
28
+ {
29
+ name: "openPostApi",
30
+ required: true,
31
+ },
32
+ ],
33
+ properties: [
34
+ ...descriptions_1.generatedDescriptionProperties,
35
+ {
36
+ displayName: "Return All",
37
+ name: "returnAll",
38
+ type: "boolean",
39
+ default: false,
40
+ description: "Whether to return all results or only up to a given limit",
41
+ displayOptions: {
42
+ show: {
43
+ operation: ["getMany", "getEvents"],
44
+ },
45
+ },
46
+ },
47
+ ],
48
+ };
49
+ methods = {
50
+ listSearch: listSearch_1.listSearch,
51
+ };
52
+ async execute() {
53
+ const items = this.getInputData();
54
+ const credentials = await this.getCredentials("openPostApi");
55
+ const baseUrl = (0, url_1.normalizeOpenPostBaseUrl)(credentials.baseUrl);
56
+ const executionId = this.getExecutionId();
57
+ const output = [];
58
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex += 1) {
59
+ const resource = String(this.getNodeParameter("resource", itemIndex));
60
+ const operation = String(this.getNodeParameter("operation", itemIndex));
61
+ try {
62
+ if (resource === "media" && operation === "uploadBinary") {
63
+ const key = (0, mapper_1.idempotencyKey)(this.getNodeParameter("idempotencyKey", itemIndex, ""), executionId, "media.uploadBinary", itemIndex);
64
+ const result = await (0, uploadBinary_1.uploadBinaryMedia)(this, {
65
+ baseUrl,
66
+ itemIndex,
67
+ executionId,
68
+ idempotencyKey: key,
69
+ workspaceId: String((0, mapper_1.normalizeNodeValue)(this.getNodeParameter("workspaceId", itemIndex))),
70
+ binaryPropertyName: String(this.getNodeParameter("binaryPropertyName", itemIndex, "data")),
71
+ fileName: optionalString(this.getNodeParameter("fileName", itemIndex, "")),
72
+ mimeType: optionalString(this.getNodeParameter("mimeType", itemIndex, "")),
73
+ altText: optionalString(this.getNodeParameter("altText", itemIndex, "")),
74
+ retentionClass: optionalString(this.getNodeParameter("retentionClass", itemIndex, "library")),
75
+ assetKind: optionalString(this.getNodeParameter("assetKind", itemIndex, "library")),
76
+ });
77
+ output.push({ json: asDataObject(result), pairedItem: { item: itemIndex } });
78
+ continue;
79
+ }
80
+ const mapper = (0, mapper_1.findRequestMapper)(resource, operation);
81
+ let cursor = "";
82
+ let offset = 0;
83
+ let hasNextPage = true;
84
+ const seenCursors = new Set();
85
+ const returnAll = Boolean(this.getNodeParameter("returnAll", itemIndex, false));
86
+ do {
87
+ const request = (0, mapper_1.buildOpenPostRequest)({
88
+ baseUrl,
89
+ mapper,
90
+ itemIndex,
91
+ executionId,
92
+ cursor,
93
+ offset,
94
+ parameters: {
95
+ get: (name, fallback) => this.getNodeParameter(name, itemIndex, fallback),
96
+ },
97
+ });
98
+ const response = await (0, openPostApiRequest_1.openPostApiRequest)(this, request.options, {
99
+ idempotency: mapper.idempotency,
100
+ });
101
+ const results = (0, mapper_1.extractResult)(response.body, mapper.result);
102
+ for (const result of results) {
103
+ output.push({ json: asDataObject(result), pairedItem: { item: itemIndex } });
104
+ }
105
+ hasNextPage = false;
106
+ if (returnAll && mapper.pagination?.style === "cursor") {
107
+ cursor = (0, mapper_1.nextCursorFromHeaders)(response.headers, mapper.pagination.next_cursor_header);
108
+ if (cursor && seenCursors.has(cursor)) {
109
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "OpenPost returned the same pagination cursor twice");
110
+ }
111
+ if (cursor)
112
+ seenCursors.add(cursor);
113
+ hasNextPage = cursor !== "";
114
+ }
115
+ else if (returnAll && mapper.pagination?.style === "offset") {
116
+ offset += results.length;
117
+ const total = (0, mapper_1.resultTotal)(response.body, mapper.pagination.total_path);
118
+ hasNextPage = results.length > 0 && total !== undefined && offset < total;
119
+ }
120
+ } while (hasNextPage);
121
+ }
122
+ catch (error) {
123
+ if (!this.continueOnFail())
124
+ throw (0, errors_1.toOpenPostNodeError)(this.getNode(), error);
125
+ output.push({
126
+ json: { error: error instanceof Error ? error.message : String(error) },
127
+ pairedItem: { item: itemIndex },
128
+ });
129
+ }
130
+ }
131
+ return [output];
132
+ }
133
+ }
134
+ exports.OpenPostV1 = OpenPostV1;
135
+ function optionalString(value) {
136
+ const text = String((0, mapper_1.normalizeNodeValue)(value) ?? "").trim();
137
+ return text || undefined;
138
+ }
139
+ function asDataObject(value) {
140
+ if (value && typeof value === "object" && !Array.isArray(value))
141
+ return value;
142
+ return { value: value };
143
+ }
144
+ //# sourceMappingURL=OpenPostV1.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenPostV1.node.js","sourceRoot":"","sources":["../../../../nodes/OpenPost/v1/OpenPostV1.node.ts"],"names":[],"mappings":";;;AAOA,+CAAuE;AAEvE,wEAAuF;AACvF,6CAQ0B;AAC1B,qCAA+C;AAC/C,uDAAyD;AACzD,qDAAkD;AAClD,uEAAoE;AACpE,yCAA2D;AAE3D,wKAAwK;AACxK,MAAa,UAAU;IACrB,WAAW,GAAyB;QAClC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAE;QACpE,KAAK,EAAE,CAAC,QAAQ,CAAC;QACjB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,8DAA8D;QACxE,WAAW,EAAE,uDAAuD;QACpE,QAAQ,EAAE;YACR,IAAI,EAAE,UAAU;SACjB;QACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;QAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;QACnC,WAAW,EAAE;YACX;gBACE,IAAI,EAAE,aAAa;gBACnB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,UAAU,EAAE;YACV,GAAG,6CAA8B;YACjC;gBACE,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,2DAA2D;gBACxE,cAAc,EAAE;oBACd,IAAI,EAAE;wBACJ,SAAS,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;qBACpC;iBACF;aACF;SACF;KACF,CAAC;IAEF,OAAO,GAAG;QACR,UAAU,EAAV,uBAAU;KACX,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAsB,aAAa,CAAC,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