n8n-nodes-planvortex 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 (70) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +115 -0
  3. package/dist/credentials/PlanVortexOAuth2Api.credentials.d.ts +13 -0
  4. package/dist/credentials/PlanVortexOAuth2Api.credentials.js +62 -0
  5. package/dist/credentials/PlanVortexOAuth2Api.credentials.js.map +1 -0
  6. package/dist/credentials/planvortex.dark.svg +13 -0
  7. package/dist/credentials/planvortex.svg +13 -0
  8. package/dist/nodes/PlanVortex/PlanVortex.node.d.ts +15 -0
  9. package/dist/nodes/PlanVortex/PlanVortex.node.js +133 -0
  10. package/dist/nodes/PlanVortex/PlanVortex.node.js.map +1 -0
  11. package/dist/nodes/PlanVortex/PlanVortex.node.json +18 -0
  12. package/dist/nodes/PlanVortex/methods/loadOptions.d.ts +6 -0
  13. package/dist/nodes/PlanVortex/methods/loadOptions.js +63 -0
  14. package/dist/nodes/PlanVortex/methods/loadOptions.js.map +1 -0
  15. package/dist/nodes/PlanVortex/planvortex.dark.svg +13 -0
  16. package/dist/nodes/PlanVortex/planvortex.svg +13 -0
  17. package/dist/nodes/PlanVortex/resources/account/connectLink.d.ts +4 -0
  18. package/dist/nodes/PlanVortex/resources/account/connectLink.js +44 -0
  19. package/dist/nodes/PlanVortex/resources/account/connectLink.js.map +1 -0
  20. package/dist/nodes/PlanVortex/resources/account/getAll.d.ts +4 -0
  21. package/dist/nodes/PlanVortex/resources/account/getAll.js +82 -0
  22. package/dist/nodes/PlanVortex/resources/account/getAll.js.map +1 -0
  23. package/dist/nodes/PlanVortex/resources/account/index.d.ts +3 -0
  24. package/dist/nodes/PlanVortex/resources/account/index.js +36 -0
  25. package/dist/nodes/PlanVortex/resources/account/index.js.map +1 -0
  26. package/dist/nodes/PlanVortex/resources/comment/getAll.d.ts +4 -0
  27. package/dist/nodes/PlanVortex/resources/comment/getAll.js +111 -0
  28. package/dist/nodes/PlanVortex/resources/comment/getAll.js.map +1 -0
  29. package/dist/nodes/PlanVortex/resources/comment/index.d.ts +3 -0
  30. package/dist/nodes/PlanVortex/resources/comment/index.js +36 -0
  31. package/dist/nodes/PlanVortex/resources/comment/index.js.map +1 -0
  32. package/dist/nodes/PlanVortex/resources/comment/reply.d.ts +4 -0
  33. package/dist/nodes/PlanVortex/resources/comment/reply.js +39 -0
  34. package/dist/nodes/PlanVortex/resources/comment/reply.js.map +1 -0
  35. package/dist/nodes/PlanVortex/resources/common.d.ts +2 -0
  36. package/dist/nodes/PlanVortex/resources/common.js +20 -0
  37. package/dist/nodes/PlanVortex/resources/common.js.map +1 -0
  38. package/dist/nodes/PlanVortex/resources/helpers.d.ts +11 -0
  39. package/dist/nodes/PlanVortex/resources/helpers.js +56 -0
  40. package/dist/nodes/PlanVortex/resources/helpers.js.map +1 -0
  41. package/dist/nodes/PlanVortex/resources/media/index.d.ts +3 -0
  42. package/dist/nodes/PlanVortex/resources/media/index.js +26 -0
  43. package/dist/nodes/PlanVortex/resources/media/index.js.map +1 -0
  44. package/dist/nodes/PlanVortex/resources/media/upload.d.ts +4 -0
  45. package/dist/nodes/PlanVortex/resources/media/upload.js +54 -0
  46. package/dist/nodes/PlanVortex/resources/media/upload.js.map +1 -0
  47. package/dist/nodes/PlanVortex/resources/publication/create.d.ts +4 -0
  48. package/dist/nodes/PlanVortex/resources/publication/create.js +143 -0
  49. package/dist/nodes/PlanVortex/resources/publication/create.js.map +1 -0
  50. package/dist/nodes/PlanVortex/resources/publication/index.d.ts +3 -0
  51. package/dist/nodes/PlanVortex/resources/publication/index.js +26 -0
  52. package/dist/nodes/PlanVortex/resources/publication/index.js.map +1 -0
  53. package/dist/nodes/PlanVortex/resources/socialNetwork/getCapabilities.d.ts +2 -0
  54. package/dist/nodes/PlanVortex/resources/socialNetwork/getCapabilities.js +13 -0
  55. package/dist/nodes/PlanVortex/resources/socialNetwork/getCapabilities.js.map +1 -0
  56. package/dist/nodes/PlanVortex/resources/socialNetwork/index.d.ts +3 -0
  57. package/dist/nodes/PlanVortex/resources/socialNetwork/index.js +25 -0
  58. package/dist/nodes/PlanVortex/resources/socialNetwork/index.js.map +1 -0
  59. package/dist/nodes/PlanVortex/transport/errors.d.ts +11 -0
  60. package/dist/nodes/PlanVortex/transport/errors.generated.d.ts +12 -0
  61. package/dist/nodes/PlanVortex/transport/errors.generated.js +54 -0
  62. package/dist/nodes/PlanVortex/transport/errors.generated.js.map +1 -0
  63. package/dist/nodes/PlanVortex/transport/errors.js +106 -0
  64. package/dist/nodes/PlanVortex/transport/errors.js.map +1 -0
  65. package/dist/nodes/PlanVortex/transport/index.d.ts +5 -0
  66. package/dist/nodes/PlanVortex/transport/index.js +110 -0
  67. package/dist/nodes/PlanVortex/transport/index.js.map +1 -0
  68. package/dist/package.json +81 -0
  69. package/dist/tsconfig.tsbuildinfo +1 -0
  70. package/package.json +81 -0
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccounts = exports.accountGetManyDescription = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const helpers_1 = require("../helpers");
6
+ const showOnlyForAccountGetMany = {
7
+ resource: ['account'],
8
+ operation: ['getAll'],
9
+ };
10
+ exports.accountGetManyDescription = [
11
+ {
12
+ displayName: 'Return All',
13
+ name: 'returnAll',
14
+ type: 'boolean',
15
+ default: false,
16
+ displayOptions: { show: showOnlyForAccountGetMany },
17
+ description: 'Whether to return all results or only up to a given limit',
18
+ },
19
+ {
20
+ displayName: 'Limit',
21
+ name: 'limit',
22
+ type: 'number',
23
+ typeOptions: { minValue: 1 },
24
+ default: 50,
25
+ displayOptions: {
26
+ show: { ...showOnlyForAccountGetMany, returnAll: [false] },
27
+ },
28
+ description: 'Max number of results to return',
29
+ },
30
+ {
31
+ displayName: 'Filters',
32
+ name: 'filters',
33
+ type: 'collection',
34
+ placeholder: 'Add Filter',
35
+ default: {},
36
+ displayOptions: { show: showOnlyForAccountGetMany },
37
+ options: [
38
+ {
39
+ displayName: 'Capability',
40
+ name: 'capability',
41
+ type: 'options',
42
+ default: 'publications',
43
+ options: [
44
+ { name: 'Comments', value: 'comments' },
45
+ { name: 'Messages', value: 'messages' },
46
+ { name: 'Persistent Menu', value: 'persistent_menu' },
47
+ { name: 'Products', value: 'products' },
48
+ { name: 'Publications', value: 'publications' },
49
+ { name: 'Webhooks', value: 'webhooks' },
50
+ ],
51
+ description: 'Only accounts whose network can do this. It is the matrix of GET /social_capabilities applied by the server, which is how a workflow asks for the accounts it can publish with without keeping its own table of what each network does.',
52
+ },
53
+ {
54
+ displayName: 'Name',
55
+ name: 'name',
56
+ type: 'string',
57
+ default: '',
58
+ description: "Free-text search over the account's name and username",
59
+ },
60
+ {
61
+ displayName: 'Social Network Names or IDs',
62
+ name: 'social_network',
63
+ type: 'multiOptions',
64
+ typeOptions: { loadOptionsMethod: 'getSocialNetworks' },
65
+ default: [],
66
+ description: 'Only accounts of these networks. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
67
+ },
68
+ ],
69
+ },
70
+ ];
71
+ const getAccounts = async function (index) {
72
+ const organizationId = (0, helpers_1.getOrganizationId)(this, index);
73
+ const returnAll = this.getNodeParameter('returnAll', index, false);
74
+ const filters = this.getNodeParameter('filters', index, {});
75
+ const qs = { ...filters };
76
+ if (Array.isArray(qs.social_network) && qs.social_network.length === 0) {
77
+ delete qs.social_network;
78
+ }
79
+ return await transport_1.planVortexApiRequestAllItems.call(this, `/organizations/${organizationId}/accounts`, 'accounts', qs, returnAll ? undefined : this.getNodeParameter('limit', index, 50));
80
+ };
81
+ exports.getAccounts = getAccounts;
82
+ //# sourceMappingURL=getAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAll.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/account/getAll.ts"],"names":[],"mappings":";;;AACA,+CAA+D;AAC/D,wCAAsE;AAEtE,MAAM,yBA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AAA,WAAW,eAiBtB"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const accountOperations: INodeProperties[];
3
+ export declare const accountFields: INodeProperties[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.accountFields = exports.accountOperations = void 0;
4
+ const connectLink_1 = require("./connectLink");
5
+ const getAll_1 = require("./getAll");
6
+ exports.accountOperations = [
7
+ {
8
+ displayName: 'Operation',
9
+ name: 'operation',
10
+ type: 'options',
11
+ noDataExpression: true,
12
+ displayOptions: {
13
+ show: { resource: ['account'] },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Create Connect Link',
18
+ value: 'connectLink',
19
+ action: 'Create a connect link',
20
+ description: 'Get a single-use link for a person to connect one of their social accounts',
21
+ },
22
+ {
23
+ name: 'Get Many',
24
+ value: 'getAll',
25
+ action: 'Get many accounts',
26
+ description: 'Get many accounts',
27
+ },
28
+ ],
29
+ default: 'getAll',
30
+ },
31
+ ];
32
+ exports.accountFields = [
33
+ ...getAll_1.accountGetManyDescription,
34
+ ...connectLink_1.accountConnectLinkDescription,
35
+ ];
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/account/index.ts"],"names":[],"mappings":";;;AACA,+CAA8D;AAC9D,qCAAqD;AAExC,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;SAC/B;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,aAAa;gBACpB,MAAM,EAAE,uBAAuB;gBAC/B,WAAW,EAAE,4EAA4E;aACzF;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,mBAAmB;gBAC3B,WAAW,EAAE,mBAAmB;aAChC;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC/C,GAAG,kCAAyB;IAC5B,GAAG,2CAA6B;CAChC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../helpers';
3
+ export declare const commentGetManyDescription: INodeProperties[];
4
+ export declare const getComments: OperationHandler;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComments = exports.commentGetManyDescription = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const helpers_1 = require("../helpers");
6
+ const showOnlyForCommentGetMany = {
7
+ resource: ['comment'],
8
+ operation: ['getAll'],
9
+ };
10
+ exports.commentGetManyDescription = [
11
+ {
12
+ displayName: 'Return All',
13
+ name: 'returnAll',
14
+ type: 'boolean',
15
+ default: false,
16
+ displayOptions: { show: showOnlyForCommentGetMany },
17
+ description: 'Whether to return all results or only up to a given limit',
18
+ },
19
+ {
20
+ displayName: 'Limit',
21
+ name: 'limit',
22
+ type: 'number',
23
+ typeOptions: { minValue: 1 },
24
+ default: 50,
25
+ displayOptions: {
26
+ show: { ...showOnlyForCommentGetMany, returnAll: [false] },
27
+ },
28
+ description: 'Max number of results to return',
29
+ },
30
+ {
31
+ displayName: 'Filters',
32
+ name: 'filters',
33
+ type: 'collection',
34
+ placeholder: 'Add Filter',
35
+ default: {},
36
+ displayOptions: { show: showOnlyForCommentGetMany },
37
+ options: [
38
+ {
39
+ displayName: 'Account Name or ID',
40
+ name: 'id_account',
41
+ type: 'options',
42
+ typeOptions: {
43
+ loadOptionsMethod: 'getAccounts',
44
+ loadOptionsDependsOn: ['organizationId'],
45
+ },
46
+ default: '',
47
+ description: 'Only comments on this connected account. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
48
+ },
49
+ {
50
+ displayName: 'Publication ID',
51
+ name: 'id_publication',
52
+ type: 'string',
53
+ default: '',
54
+ description: 'Only comments on this publication of yours. A review never matches it: a review hangs off the business listing and has no publication behind it.',
55
+ },
56
+ {
57
+ displayName: 'Rating',
58
+ name: 'rating',
59
+ type: 'multiOptions',
60
+ default: [],
61
+ options: [
62
+ { name: '1 Star', value: 1 },
63
+ { name: '2 Stars', value: 2 },
64
+ { name: '3 Stars', value: 3 },
65
+ { name: '4 Stars', value: 4 },
66
+ { name: '5 Stars', value: 5 },
67
+ ],
68
+ description: 'Only reviews with these star ratings. This is the filter that makes a review inbox useful — show me the one and two star ones first — and because only review networks carry a rating, it leaves every ordinary comment out.',
69
+ },
70
+ {
71
+ displayName: 'Search',
72
+ name: 'search',
73
+ type: 'string',
74
+ default: '',
75
+ description: 'Case-insensitive substring match on the comment text',
76
+ },
77
+ {
78
+ displayName: 'Social Network Names or IDs',
79
+ name: 'social_network',
80
+ type: 'multiOptions',
81
+ typeOptions: { loadOptionsMethod: 'getCommentNetworks' },
82
+ default: [],
83
+ description: 'Only comments from these networks. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
84
+ },
85
+ {
86
+ displayName: 'Unread Only',
87
+ name: 'unread',
88
+ type: 'boolean',
89
+ default: true,
90
+ description: 'Whether to return only the comments nobody has marked as read yet',
91
+ },
92
+ ],
93
+ },
94
+ ];
95
+ const getComments = async function (index) {
96
+ const organizationId = (0, helpers_1.getOrganizationId)(this, index);
97
+ const returnAll = this.getNodeParameter('returnAll', index, false);
98
+ const filters = this.getNodeParameter('filters', index, {});
99
+ const qs = { ...filters };
100
+ for (const key of ['social_network', 'rating']) {
101
+ if (Array.isArray(qs[key]) && qs[key].length === 0) {
102
+ delete qs[key];
103
+ }
104
+ }
105
+ if (qs.unread === false) {
106
+ delete qs.unread;
107
+ }
108
+ return await transport_1.planVortexApiRequestAllItems.call(this, `/organizations/${organizationId}/comments`, 'comments', qs, returnAll ? undefined : this.getNodeParameter('limit', index, 50));
109
+ };
110
+ exports.getComments = getComments;
111
+ //# sourceMappingURL=getAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAll.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/comment/getAll.ts"],"names":[],"mappings":";;;AACA,+CAA+D;AAC/D,wCAAsE;AAEtE,MAAM,yBAAyB,GAAG;IACjC,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;CACrB,CAAC;AAEW,QAAA,yBAAyB,GAAsB;IAC3D;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;QACnD,WAAW,EAAE,2DAA2D;KACxE;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;QAC5B,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,GAAG,yBAAyB,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE;SAC1D;QACD,WAAW,EAAE,iCAAiC;KAC9C;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;QACnD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,oBAAoB;gBACjC,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE;oBACZ,iBAAiB,EAAE,aAAa;oBAChC,oBAAoB,EA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AK,WAAiB,KAAK;IACvE,MAAM,cAAc,GAAG,IAAA,2BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAY,CAAC;IAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAgB,CAAC;IAE3E,MAAM,EAAE,GAAgB,EAAE,GAAG,OAAO,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAK,EAAE,CAAC,GAAG,CAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACF,CAAC;IAGD,IAAI,EAAE,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC,MAAM,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,wCAA4B,CAAC,IAAI,CAC7C,IAAI,EACJ,kBAAkB,cAAc,WAAW,EAC3C,UAAU,EACV,EAAE,EACF,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAY,CAC7E,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,WAAW,eAwBtB"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const commentOperations: INodeProperties[];
3
+ export declare const commentFields: INodeProperties[];
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commentFields = exports.commentOperations = void 0;
4
+ const getAll_1 = require("./getAll");
5
+ const reply_1 = require("./reply");
6
+ exports.commentOperations = [
7
+ {
8
+ displayName: 'Operation',
9
+ name: 'operation',
10
+ type: 'options',
11
+ noDataExpression: true,
12
+ displayOptions: {
13
+ show: { resource: ['comment'] },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Get Many',
18
+ value: 'getAll',
19
+ action: 'Get many comments',
20
+ description: 'Get many comments',
21
+ },
22
+ {
23
+ name: 'Reply',
24
+ value: 'reply',
25
+ action: 'Reply to a comment',
26
+ description: 'Publish a public reply to a comment or a review',
27
+ },
28
+ ],
29
+ default: 'getAll',
30
+ },
31
+ ];
32
+ exports.commentFields = [
33
+ ...getAll_1.commentGetManyDescription,
34
+ ...reply_1.commentReplyDescription,
35
+ ];
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/comment/index.ts"],"names":[],"mappings":";;;AACA,qCAAqD;AACrD,mCAAkD;AAErC,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE;SAC/B;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,mBAAmB;gBAC3B,WAAW,EAAE,mBAAmB;aAChC;YACD;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,oBAAoB;gBAC5B,WAAW,EAAE,iDAAiD;aAC9D;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC/C,GAAG,kCAAyB;IAC5B,GAAG,+BAAuB;CAC1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../helpers';
3
+ export declare const commentReplyDescription: INodeProperties[];
4
+ export declare const replyToComment: OperationHandler;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replyToComment = exports.commentReplyDescription = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const helpers_1 = require("../helpers");
6
+ const showOnlyForCommentReply = {
7
+ resource: ['comment'],
8
+ operation: ['reply'],
9
+ };
10
+ exports.commentReplyDescription = [
11
+ {
12
+ displayName: 'Comment ID',
13
+ name: 'commentId',
14
+ type: 'string',
15
+ default: '',
16
+ required: true,
17
+ displayOptions: { show: showOnlyForCommentReply },
18
+ description: "PlanVortex's own ID for the comment, the _id field of the Get Many operation — not the ID the social network gave it",
19
+ },
20
+ {
21
+ displayName: 'Text',
22
+ name: 'text',
23
+ type: 'string',
24
+ typeOptions: { rows: 3 },
25
+ default: '',
26
+ required: true,
27
+ displayOptions: { show: showOnlyForCommentReply },
28
+ description: "The public reply. It cannot be empty and it has to fit the network's own comment limit, which is not the same as its limit for a post.",
29
+ },
30
+ ];
31
+ const replyToComment = async function (index) {
32
+ const organizationId = (0, helpers_1.getOrganizationId)(this, index);
33
+ const commentId = (0, helpers_1.getRequiredId)(this, index, 'commentId', 'comment', 'A reply hangs off the comment it answers.');
34
+ const text = this.getNodeParameter('text', index, '');
35
+ const response = (await transport_1.planVortexApiRequest.call(this, 'POST', `/organizations/${organizationId}/comments/${commentId}/reply`, { text }));
36
+ return [response !== null && response !== void 0 ? response : {}];
37
+ };
38
+ exports.replyToComment = replyToComment;
39
+ //# sourceMappingURL=reply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/comment/reply.ts"],"names":[],"mappings":";;;AACA,+CAAuD;AACvD,wCAAqF;AAErF,MAAM,uBAAuB,GAAG;IAC/B,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,S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@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.organizationIdProperty = void 0;
4
+ exports.organizationIdProperty = {
5
+ displayName: 'Organization Name or ID',
6
+ name: 'organizationId',
7
+ type: 'options',
8
+ typeOptions: {
9
+ loadOptionsMethod: 'getOrganizations',
10
+ },
11
+ default: '',
12
+ required: true,
13
+ displayOptions: {
14
+ hide: {
15
+ resource: ['socialNetwork'],
16
+ },
17
+ },
18
+ description: 'The PlanVortex organization this operation works on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
19
+ };
20
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../nodes/PlanVortex/resources/common.ts"],"names":[],"mappings":";;;AAgBa,QAAA,sBAAsB,GAAoB;IACtD,WAAW,EAAE,yBAAyB;IACtC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE;QACZ,iBAAiB,EAAE,kBAAkB;KACrC;IACD,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE;QACf,IAAI,EAAE;YACL,QAAQ,EAAE,CAAC,eAAe,CAAC;SAC3B;KACD;IACD,WAAW,EAAE,sKAAsK;CACnL,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
2
+ export type OperationHandler = (this: IExecuteFunctions, index: number, run: RunState) => Promise<IDataObject[]>;
3
+ export interface RunState {
4
+ accounts: Map<string, IDataObject>;
5
+ }
6
+ export declare function newRunState(): RunState;
7
+ export declare function getOrganizationId(context: IExecuteFunctions, index: number): string;
8
+ export declare function getRequiredId(context: IExecuteFunctions, index: number, parameter: string, label: string, why: string): string;
9
+ export declare function getAccountOnce(context: IExecuteFunctions, index: number, organizationId: string, accountId: string, run: RunState): Promise<IDataObject>;
10
+ export declare function splitIds(value: string): string[];
11
+ export declare function networkLabel(network: string): string;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newRunState = newRunState;
4
+ exports.getOrganizationId = getOrganizationId;
5
+ exports.getRequiredId = getRequiredId;
6
+ exports.getAccountOnce = getAccountOnce;
7
+ exports.splitIds = splitIds;
8
+ exports.networkLabel = networkLabel;
9
+ const n8n_workflow_1 = require("n8n-workflow");
10
+ const transport_1 = require("../transport");
11
+ function newRunState() {
12
+ return { accounts: new Map() };
13
+ }
14
+ function getOrganizationId(context, index) {
15
+ return getRequiredId(context, index, 'organizationId', 'organization', 'Every PlanVortex resource belongs to an organization.');
16
+ }
17
+ function getRequiredId(context, index, parameter, label, why) {
18
+ var _a;
19
+ const value = String((_a = context.getNodeParameter(parameter, index, '')) !== null && _a !== void 0 ? _a : '').trim();
20
+ if (value === '') {
21
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), `No ${label} was selected`, {
22
+ description: `${why} Pick one from the list, or pass its id with an expression.`,
23
+ itemIndex: index,
24
+ });
25
+ }
26
+ return value;
27
+ }
28
+ async function getAccountOnce(context, index, organizationId, accountId, run) {
29
+ const key = `${organizationId}:${accountId}`;
30
+ const cached = run.accounts.get(key);
31
+ if (cached !== undefined)
32
+ return cached;
33
+ const response = (await transport_1.planVortexApiRequest.call(context, 'GET', `/organizations/${organizationId}/accounts/${accountId}`));
34
+ const account = response === null || response === void 0 ? void 0 : response.account;
35
+ if (account === undefined) {
36
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'That account does not exist', {
37
+ description: `No account with id ${accountId} belongs to organization ${organizationId}.`,
38
+ itemIndex: index,
39
+ });
40
+ }
41
+ run.accounts.set(key, account);
42
+ return account;
43
+ }
44
+ function splitIds(value) {
45
+ return value
46
+ .split(',')
47
+ .map((id) => id.trim())
48
+ .filter((id) => id !== '');
49
+ }
50
+ function networkLabel(network) {
51
+ return network
52
+ .split('_')
53
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
54
+ .join(' ');
55
+ }
56
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../nodes/PlanVortex/resources/helpers.ts"],"names":[],"mappings":";;AA6BA,kCAEC;AAQD,8CAQC;AAQD,sCAeC;AAUD,wCA2BC;AAUD,4BAKC;AAGD,oCAKC;AAjID,+CAAkD;AAClD,4CAAoD;AA2BpD,SAAgB,WAAW;IAC1B,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAChC,CAAC;AAQD,SAAgB,iBAAiB,CAAC,OAA0B,EAAE,KAAa;IAC1E,OAAO,aAAa,CACnB,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,cAAc,EACd,uDAAuD,CACvD,CAAC;AACH,CAAC;AAQD,SAAgB,aAAa,CAC5B,OAA0B,EAC1B,KAAa,EACb,SAAiB,EACjB,KAAa,EACb,GAAW;;IAEX,MAAM,KAAK,GAAG,MAAM,CAAC,MAAA,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClF,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,iCAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,MAAM,KAAK,eAAe,EAAE;YAC3E,WAAW,EAAE,GAAG,GAAG,6DAA6D;YAChF,SAAS,EAAE,KAAK;SAChB,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAUM,KAAK,UAAU,cAAc,CACnC,OAA0B,EAC1B,KAAa,EACb,cAAsB,EACtB,SAAiB,EACjB,GAAa;IAEb,MAAM,GAAG,GAAG,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC;IAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC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mediaFields: INodeProperties[];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mediaFields = exports.mediaOperations = void 0;
4
+ const upload_1 = require("./upload");
5
+ exports.mediaOperations = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: {
12
+ show: { resource: ['media'] },
13
+ },
14
+ options: [
15
+ {
16
+ name: 'Upload',
17
+ value: 'upload',
18
+ action: 'Upload a file',
19
+ description: "Add an image or a video to the organization's library, to attach to a post",
20
+ },
21
+ ],
22
+ default: 'upload',
23
+ },
24
+ ];
25
+ exports.mediaFields = [...upload_1.mediaUploadDescription];
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/media/index.ts"],"names":[],"mappings":";;;AACA,qCAAkD;AAErC,QAAA,eAAe,GAAsB;IACjD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;SAC7B;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,eAAe;gBACvB,WAAW,EAAE,4EAA4E;aACzF;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,WAAW,GAAsB,CAAC,GAAG,+BAAsB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../helpers';
3
+ export declare const mediaUploadDescription: INodeProperties[];
4
+ export declare const uploadMedia: OperationHandler;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadMedia = exports.mediaUploadDescription = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const helpers_1 = require("../helpers");
6
+ const showOnlyForMediaUpload = {
7
+ resource: ['media'],
8
+ operation: ['upload'],
9
+ };
10
+ exports.mediaUploadDescription = [
11
+ {
12
+ displayName: 'Input Binary Field',
13
+ name: 'binaryPropertyName',
14
+ type: 'string',
15
+ default: 'data',
16
+ required: true,
17
+ displayOptions: { show: showOnlyForMediaUpload },
18
+ hint: 'The name of the input field containing the file to upload',
19
+ description: 'Which binary field of the incoming item holds the file. Nodes that download or read a file put it in a field called data unless they were told otherwise.',
20
+ },
21
+ {
22
+ displayName: 'Options',
23
+ name: 'options',
24
+ type: 'collection',
25
+ placeholder: 'Add Option',
26
+ default: {},
27
+ displayOptions: { show: showOnlyForMediaUpload },
28
+ options: [
29
+ {
30
+ displayName: 'File Name',
31
+ name: 'fileName',
32
+ type: 'string',
33
+ default: '',
34
+ description: 'Overrides the name the file travels with. PlanVortex decides what kind of file it is from the content type, and derives that from the name when the source did not declare one, so a name without an extension is worth fixing here.',
35
+ },
36
+ ],
37
+ },
38
+ ];
39
+ const uploadMedia = async function (index) {
40
+ var _a, _b, _c;
41
+ const organizationId = (0, helpers_1.getOrganizationId)(this, index);
42
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', index, 'data');
43
+ const options = this.getNodeParameter('options', index, {});
44
+ const binary = this.helpers.assertBinaryData(index, binaryPropertyName);
45
+ const buffer = await this.helpers.getBinaryDataBuffer(index, binaryPropertyName);
46
+ const fileName = String((_b = (_a = options.fileName) !== null && _a !== void 0 ? _a : binary.fileName) !== null && _b !== void 0 ? _b : 'file');
47
+ const mimeType = binary.mimeType || 'application/octet-stream';
48
+ const form = new FormData();
49
+ form.append('file', new Blob([new Uint8Array(buffer)], { type: mimeType }), fileName);
50
+ const response = (await transport_1.planVortexApiRequest.call(this, 'POST', `/organizations/${organizationId}/uploads`, undefined, undefined, { body: form, json: false }));
51
+ return [(_c = response === null || response === void 0 ? void 0 : response.upload) !== null && _c !== void 0 ? _c : {}];
52
+ };
53
+ exports.uploadMedia = uploadMedia;
54
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../../nodes/PlanVortex/resources/media/upload.ts"],"names":[],"mappings":";;;AACA,+CAAuD;AACvD,wCAAsE;AAEtE,MAAM,sBAAsB,GAAG;IAC9B,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,SAAS,EAAE,CAAC,QAAQ,CAAC;CACrB,CAAC;AAEW,QAAA,sBAAsB,GAAsB;IACxD;QACC,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;QAChD,IAAI,EAAE,2DAA2D;QACjE,WAAW,EACV,2JAA2J;KAC5J;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;QAChD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,sOAAsO;aACvO;SACD;KACD;CACD,CAAC;AAiBK,MAAM,WAAW,GAAqB,KAAK,WAAiB,KAAK;;IACvE,MAAM,cAAc,GAAG,IAAA,2BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,KAAK,EAAE,MAAM,CAAW,CAAC;IAChG,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAgB,CAAC;IAE3E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,MAAM,CAAC,QAAQ,mCAAI,MAAM,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,0BAA0B,CAAC;IAE/D,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEtF,MAAM,QAAQ,GAAG,CAAC,MAAM,gCAAoB,CAAC,IAAI,CAChD,IAAI,EACJ,MAAM,EACN,kBAAkB,cAAc,UAAU,EAC1C,SAAS,EACT,SAAS,EACT,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAC3B,CAA6B,CAAC;IAE/B,OAAO,CAAC,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC;AAvBW,QAAA,WAAW,eAuBtB"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../helpers';
3
+ export declare const publicationCreateDescription: INodeProperties[];
4
+ export declare const createPublication: OperationHandler;