n8n-nodes-base 2.36.2 → 2.37.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/cjs/build.tsbuildinfo +1 -1
- package/dist/credentials/TypeformOAuth2Api.credentials.d.ts.map +1 -1
- package/dist/credentials/TypeformOAuth2Api.credentials.js +32 -2
- package/dist/credentials/TypeformOAuth2Api.credentials.js.map +1 -1
- package/dist/known/credentials.json +2 -0
- package/dist/node-definitions/.nodes-hash +1 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/googleAnalytics/v2/resource_report/operation_get.ts +2 -2
- package/dist/node-definitions/nodes/n8n-nodes-base/grist/v1.schema.js +6 -4
- package/dist/node-definitions/nodes/n8n-nodes-base/grist/v1.ts +28 -4
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftOutlook/v2/resource_event/operation_create.ts +2 -2
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/index.ts +3 -1
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/index.schema.js +24 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/index.ts +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/index.schema.js +24 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/index.ts +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_download.schema.js +26 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_download.ts +49 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_update.schema.js +28 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_update.ts +59 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_upload.schema.js +26 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_file/operation_upload.ts +46 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/index.schema.js +30 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/index.ts +27 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_create.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_create.ts +47 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_delete.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_delete.ts +43 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_get.schema.js +26 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_get.ts +48 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_get_all.schema.js +29 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_get_all.ts +68 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_update.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_update.ts +47 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_upsert.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_item/operation_upsert.ts +47 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/index.schema.js +22 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/index.ts +15 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/operation_get.schema.js +25 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/operation_get.ts +41 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/operation_get_all.schema.js +26 -0
- package/dist/node-definitions/nodes/n8n-nodes-base/microsoftSharePoint/v2/resource_list/operation_get_all.ts +45 -0
- package/dist/nodes/Confluence/actions/attachment/getMany.operation.d.ts +32 -0
- package/dist/nodes/Confluence/actions/attachment/getMany.operation.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/attachment/getMany.operation.js +98 -0
- package/dist/nodes/Confluence/actions/attachment/getMany.operation.js.map +1 -0
- package/dist/nodes/Confluence/actions/attachment/index.d.ts +5 -0
- package/dist/nodes/Confluence/actions/attachment/index.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/attachment/index.js +62 -0
- package/dist/nodes/Confluence/actions/attachment/index.js.map +1 -0
- package/dist/nodes/Confluence/actions/common.d.ts +7 -0
- package/dist/nodes/Confluence/actions/common.d.ts.map +1 -1
- package/dist/nodes/Confluence/actions/common.js +25 -2
- package/dist/nodes/Confluence/actions/common.js.map +1 -1
- package/dist/nodes/Confluence/actions/description.d.ts.map +1 -1
- package/dist/nodes/Confluence/actions/description.js +6 -0
- package/dist/nodes/Confluence/actions/description.js.map +1 -1
- package/dist/nodes/Confluence/actions/page/append.operation.d.ts +6 -0
- package/dist/nodes/Confluence/actions/page/append.operation.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/page/append.operation.js +85 -0
- package/dist/nodes/Confluence/actions/page/append.operation.js.map +1 -0
- package/dist/nodes/Confluence/actions/page/bodyEnvelope.d.ts +4 -1
- package/dist/nodes/Confluence/actions/page/bodyEnvelope.d.ts.map +1 -1
- package/dist/nodes/Confluence/actions/page/bodyEnvelope.js +28 -7
- package/dist/nodes/Confluence/actions/page/bodyEnvelope.js.map +1 -1
- package/dist/nodes/Confluence/actions/page/delete.operation.d.ts +5 -0
- package/dist/nodes/Confluence/actions/page/delete.operation.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/page/delete.operation.js +82 -0
- package/dist/nodes/Confluence/actions/page/delete.operation.js.map +1 -0
- package/dist/nodes/Confluence/actions/page/index.d.ts +4 -1
- package/dist/nodes/Confluence/actions/page/index.d.ts.map +1 -1
- package/dist/nodes/Confluence/actions/page/index.js +28 -1
- package/dist/nodes/Confluence/actions/page/index.js.map +1 -1
- package/dist/nodes/Confluence/actions/page/pageWrite.d.ts +17 -0
- package/dist/nodes/Confluence/actions/page/pageWrite.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/page/pageWrite.js +70 -0
- package/dist/nodes/Confluence/actions/page/pageWrite.js.map +1 -0
- package/dist/nodes/Confluence/actions/page/update.operation.d.ts +5 -0
- package/dist/nodes/Confluence/actions/page/update.operation.d.ts.map +1 -0
- package/dist/nodes/Confluence/actions/page/update.operation.js +72 -0
- package/dist/nodes/Confluence/actions/page/update.operation.js.map +1 -0
- package/dist/nodes/Confluence/actions/router.d.ts +2 -0
- package/dist/nodes/Confluence/actions/router.d.ts.map +1 -1
- package/dist/nodes/Confluence/actions/router.js +15 -1
- package/dist/nodes/Confluence/actions/router.js.map +1 -1
- package/dist/nodes/Confluence/transport/index.d.ts +6 -0
- package/dist/nodes/Confluence/transport/index.d.ts.map +1 -1
- package/dist/nodes/Confluence/transport/index.js +86 -10
- package/dist/nodes/Confluence/transport/index.js.map +1 -1
- package/dist/nodes/Files/ExtractFromFile/actions/moveTo.operation.d.ts.map +1 -1
- package/dist/nodes/Files/ExtractFromFile/actions/moveTo.operation.js +2 -2
- package/dist/nodes/Files/ExtractFromFile/actions/moveTo.operation.js.map +1 -1
- package/dist/nodes/Files/ExtractFromFile/actions/parseIcsCalendar.d.ts +3 -0
- package/dist/nodes/Files/ExtractFromFile/actions/parseIcsCalendar.d.ts.map +1 -0
- package/dist/nodes/Files/ExtractFromFile/actions/parseIcsCalendar.js +10 -0
- package/dist/nodes/Files/ExtractFromFile/actions/parseIcsCalendar.js.map +1 -0
- package/dist/nodes/Form/Form.node.d.ts.map +1 -1
- package/dist/nodes/Form/Form.node.js +8 -0
- package/dist/nodes/Form/Form.node.js.map +1 -1
- package/dist/nodes/Form/interfaces.d.ts +1 -0
- package/dist/nodes/Form/interfaces.d.ts.map +1 -1
- package/dist/nodes/Form/interfaces.js.map +1 -1
- package/dist/nodes/Form/utils/formCompletionUtils.d.ts.map +1 -1
- package/dist/nodes/Form/utils/formCompletionUtils.js +8 -1
- package/dist/nodes/Form/utils/formCompletionUtils.js.map +1 -1
- package/dist/nodes/Form/utils/formNodeUtils.d.ts.map +1 -1
- package/dist/nodes/Form/utils/formNodeUtils.js +14 -3
- package/dist/nodes/Form/utils/formNodeUtils.js.map +1 -1
- package/dist/nodes/Form/utils/utils.d.ts +49 -9
- package/dist/nodes/Form/utils/utils.d.ts.map +1 -1
- package/dist/nodes/Form/utils/utils.js +309 -69
- package/dist/nodes/Form/utils/utils.js.map +1 -1
- package/dist/nodes/Form/v2/FormTriggerV2.node.d.ts +1 -1
- package/dist/nodes/Form/v2/FormTriggerV2.node.d.ts.map +1 -1
- package/dist/nodes/Form/v2/FormTriggerV2.node.js +0 -1
- package/dist/nodes/Form/v2/FormTriggerV2.node.js.map +1 -1
- package/dist/nodes/Google/Calendar/GoogleCalendar.node.d.ts.map +1 -1
- package/dist/nodes/Google/Calendar/GoogleCalendar.node.js +7 -0
- package/dist/nodes/Google/Calendar/GoogleCalendar.node.js.map +1 -1
- package/dist/nodes/Google/Drive/GoogleDriveTrigger.node.d.ts.map +1 -1
- package/dist/nodes/Google/Drive/GoogleDriveTrigger.node.js +82 -7
- package/dist/nodes/Google/Drive/GoogleDriveTrigger.node.js.map +1 -1
- package/dist/nodes/Google/Drive/v2/actions/file/download.operation.js +1 -1
- package/dist/nodes/Google/Drive/v2/actions/file/download.operation.js.map +1 -1
- package/dist/nodes/Grist/Grist.node.d.ts.map +1 -1
- package/dist/nodes/Grist/Grist.node.js +60 -2
- package/dist/nodes/Grist/Grist.node.js.map +1 -1
- package/dist/nodes/Grist/OperationDescription.d.ts.map +1 -1
- package/dist/nodes/Grist/OperationDescription.js +83 -3
- package/dist/nodes/Grist/OperationDescription.js.map +1 -1
- package/dist/nodes/Grist/types.d.ts +10 -0
- package/dist/nodes/Grist/types.d.ts.map +1 -1
- package/dist/nodes/MessageAnAgent/MessageAnAgent.node.d.ts.map +1 -1
- package/dist/nodes/MessageAnAgent/MessageAnAgent.node.js +5 -3
- package/dist/nodes/MessageAnAgent/MessageAnAgent.node.js.map +1 -1
- package/dist/nodes/MessageAnAgent/shared.d.ts.map +1 -1
- package/dist/nodes/MessageAnAgent/shared.js +146 -4
- package/dist/nodes/MessageAnAgent/shared.js.map +1 -1
- package/dist/nodes/MessageAnAgent/v2/MessageAnAgentV2.node.d.ts.map +1 -1
- package/dist/nodes/MessageAnAgent/v2/MessageAnAgentV2.node.js +4 -3
- package/dist/nodes/MessageAnAgent/v2/MessageAnAgentV2.node.js.map +1 -1
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.d.ts.map +1 -1
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js +3 -8
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js.map +1 -1
- package/dist/nodes/MongoDb/GenericFunctions.d.ts +1 -0
- package/dist/nodes/MongoDb/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/MongoDb/GenericFunctions.js +15 -2
- package/dist/nodes/MongoDb/GenericFunctions.js.map +1 -1
- package/dist/nodes/MongoDb/MongoDb.node.d.ts.map +1 -1
- package/dist/nodes/MongoDb/MongoDb.node.js +32 -19
- package/dist/nodes/MongoDb/MongoDb.node.js.map +1 -1
- package/dist/nodes/PagerDuty/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/PagerDuty/GenericFunctions.js +5 -2
- package/dist/nodes/PagerDuty/GenericFunctions.js.map +1 -1
- package/dist/nodes/Transform/Aggregate/Aggregate.node.d.ts.map +1 -1
- package/dist/nodes/Transform/Aggregate/Aggregate.node.js +1 -4
- package/dist/nodes/Transform/Aggregate/Aggregate.node.js.map +1 -1
- package/dist/nodes/Transform/SplitOut/utils.d.ts.map +1 -1
- package/dist/nodes/Transform/SplitOut/utils.js +2 -4
- package/dist/nodes/Transform/SplitOut/utils.js.map +1 -1
- package/dist/nodes/Transform/utils/utils.d.ts +6 -0
- package/dist/nodes/Transform/utils/utils.d.ts.map +1 -1
- package/dist/nodes/Transform/utils/utils.js +15 -1
- package/dist/nodes/Transform/utils/utils.js.map +1 -1
- package/dist/nodes/Wait/Wait.node.d.ts +1 -1
- package/dist/types/credentials.json +3 -3
- package/dist/types/nodes.json +9 -8
- package/package.json +13 -13
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = exports.description = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const transport_1 = require("../../transport");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const showOnDelete = { resource: ['page'], operation: ['delete'] };
|
|
8
|
+
exports.description = [
|
|
9
|
+
{
|
|
10
|
+
displayName: "Deleting a page does not delete its child pages — they move up to the deleted page's parent",
|
|
11
|
+
name: 'deleteChildrenNotice',
|
|
12
|
+
type: 'notice',
|
|
13
|
+
default: '',
|
|
14
|
+
displayOptions: { show: showOnDelete },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
...common_1.optionalSpaceRLC,
|
|
18
|
+
description: 'Limits page selection and By Title lookups to one space. Leave empty or pick "All Spaces" to search across all spaces.',
|
|
19
|
+
displayOptions: { show: showOnDelete },
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
...common_1.pageRLC,
|
|
23
|
+
description: 'The page to delete',
|
|
24
|
+
displayOptions: { show: showOnDelete },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Permanently Delete (Purge)',
|
|
28
|
+
name: 'purge',
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: false,
|
|
31
|
+
description: "Whether to permanently delete the page instead of moving it to trash. This cannot be undone and requires admin permission in the page's space.",
|
|
32
|
+
displayOptions: { show: showOnDelete },
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const execute = async function (itemIndex) {
|
|
36
|
+
const purge = this.getNodeParameter('purge', itemIndex, false);
|
|
37
|
+
const pageId = await common_1.resolvePageId.call(this, itemIndex);
|
|
38
|
+
const endpoint = `/wiki/api/v2/pages/${encodeURIComponent(pageId)}`;
|
|
39
|
+
try {
|
|
40
|
+
await transport_1.confluenceApiRequest.call(this, 'DELETE', endpoint);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
// The OAuth scope is only the ceiling — deleting also needs the space-level permission
|
|
44
|
+
if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '403') {
|
|
45
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Confluence refused to delete the page', {
|
|
46
|
+
itemIndex,
|
|
47
|
+
description: 'The connected user needs the "Delete pages" permission in the page\'s space; no OAuth scope change can grant it.',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const notFound = error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '404';
|
|
51
|
+
// Confluence masks permission failures on this endpoint as 404
|
|
52
|
+
if (notFound && !purge) {
|
|
53
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Confluence could not delete the page', {
|
|
54
|
+
itemIndex,
|
|
55
|
+
description: 'The page may not exist or may already be in the trash, the connected user may lack view or "Delete pages" permission in the page\'s space (Confluence reports permission failures as "not found"), or the page is an unsaved draft.',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// A page that is already in the trash 404s on the plain DELETE; when purging,
|
|
59
|
+
// continue so the purge request still runs (a missing page 404s again there)
|
|
60
|
+
if (!notFound) {
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// The API only purges pages that are already trashed, so purge is a second request
|
|
65
|
+
if (purge) {
|
|
66
|
+
try {
|
|
67
|
+
await transport_1.confluenceApiRequest.call(this, 'DELETE', endpoint, {}, { purge: true });
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '403') {
|
|
71
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The page was moved to trash, but could not be purged', {
|
|
72
|
+
itemIndex,
|
|
73
|
+
description: 'Permanently deleting a page requires admin permission in its space. The page remains in the trash and can be restored from the Confluence UI.',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { deleted: true, pageId, purged: purge };
|
|
80
|
+
};
|
|
81
|
+
exports.execute = execute;
|
|
82
|
+
//# sourceMappingURL=delete.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.operation.js","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/delete.operation.ts"],"names":[],"mappings":";;;AACA,+CAAgE;AAEhE,+CAAuD;AACvD,sCAAqE;AAGrE,MAAM,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;AAEtD,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EACV,6FAA6F;QAC9F,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;KACtC;IACD;QACC,GAAG,yBAAgB;QACnB,WAAW,EACV,wHAAwH;QACzH,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;KACtC;IACD;QACC,GAAG,gBAAO;QACV,WAAW,EAAE,oBAAoB;QACjC,cAAc,EAAE,EAAE,IAAI,EAAE,YAA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CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,mFAAmF;IACnF,IAAI,KAAK,EAAE,CAAC;QACX,IAAI,CAAC;YACJ,MAAM,gCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,KAAK,YAAY,2BAAY,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;gBAC/D,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,sDAAsD,EACtD;oBACC,SAAS;oBACT,WAAW,EACV,+IAA+I;iBAChJ,CACD,CAAC;YACH,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC,CAAC;AAxDW,QAAA,OAAO,GAAP,OAAO,CAwDlB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import * as append from './append.operation';
|
|
2
3
|
import * as create from './create.operation';
|
|
4
|
+
import * as del from './delete.operation';
|
|
3
5
|
import * as get from './get.operation';
|
|
4
|
-
|
|
6
|
+
import * as update from './update.operation';
|
|
7
|
+
export { append, create, del as delete, get, update };
|
|
5
8
|
export declare const description: INodeProperties[];
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AAEtD,eAAO,MAAM,WAAW,EAAE,eAAe,EAkDxC,CAAC"}
|
|
@@ -33,11 +33,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.description = exports.get = exports.create = void 0;
|
|
36
|
+
exports.description = exports.update = exports.get = exports.delete = exports.create = exports.append = void 0;
|
|
37
|
+
const append = __importStar(require("./append.operation"));
|
|
38
|
+
exports.append = append;
|
|
37
39
|
const create = __importStar(require("./create.operation"));
|
|
38
40
|
exports.create = create;
|
|
41
|
+
const del = __importStar(require("./delete.operation"));
|
|
42
|
+
exports.delete = del;
|
|
39
43
|
const get = __importStar(require("./get.operation"));
|
|
40
44
|
exports.get = get;
|
|
45
|
+
const update = __importStar(require("./update.operation"));
|
|
46
|
+
exports.update = update;
|
|
41
47
|
exports.description = [
|
|
42
48
|
{
|
|
43
49
|
displayName: 'Operation',
|
|
@@ -50,22 +56,43 @@ exports.description = [
|
|
|
50
56
|
},
|
|
51
57
|
},
|
|
52
58
|
options: [
|
|
59
|
+
{
|
|
60
|
+
name: 'Append',
|
|
61
|
+
value: 'append',
|
|
62
|
+
description: 'Append content to the bottom of an existing page',
|
|
63
|
+
action: 'Append content to a page',
|
|
64
|
+
},
|
|
53
65
|
{
|
|
54
66
|
name: 'Create',
|
|
55
67
|
value: 'create',
|
|
56
68
|
description: 'Create a new page in a space',
|
|
57
69
|
action: 'Create a page',
|
|
58
70
|
},
|
|
71
|
+
{
|
|
72
|
+
name: 'Delete',
|
|
73
|
+
value: 'delete',
|
|
74
|
+
description: 'Move a page to trash, or permanently delete it',
|
|
75
|
+
action: 'Delete a page',
|
|
76
|
+
},
|
|
59
77
|
{
|
|
60
78
|
name: 'Get',
|
|
61
79
|
value: 'get',
|
|
62
80
|
description: 'Retrieve a page, optionally with its full sub-tree',
|
|
63
81
|
action: 'Get a page',
|
|
64
82
|
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Update',
|
|
85
|
+
value: 'update',
|
|
86
|
+
description: 'Replace the title and body of an existing page',
|
|
87
|
+
action: 'Update a page',
|
|
88
|
+
},
|
|
65
89
|
],
|
|
66
90
|
default: 'create',
|
|
67
91
|
},
|
|
92
|
+
...append.description,
|
|
68
93
|
...create.description,
|
|
94
|
+
...del.description,
|
|
69
95
|
...get.description,
|
|
96
|
+
...update.description,
|
|
70
97
|
];
|
|
71
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,MAAM,+CAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,MAAM,+CAA2B;QAMpC,MAAM;AALf,MAAY,MAAM,+CAA2B;QAK5B,MAAM;AAJvB,MAAY,GAAG,+CAA2B;QAIV,MAAM;AAHtC,MAAY,GAAG,4CAAwB;QAGC,GAAG;AAF3C,MAAY,MAAM,+CAA2B;QAEA,MAAM;AAEtC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kDAAkD;gBAC/D,MAAM,EAAE,0BAA0B;aAClC;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,8BAA8B;gBAC3C,MAAM,EAAE,eAAe;aACvB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,gDAAgD;gBAC7D,MAAM,EAAE,eAAe;aACvB;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,oDAAoD;gBACjE,MAAM,EAAE,YAAY;aACpB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,gDAAgD;gBAC7D,MAAM,EAAE,eAAe;aACvB;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;IACD,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,GAAG,CAAC,WAAW;IAClB,GAAG,GAAG,CAAC,WAAW;IAClB,GAAG,MAAM,CAAC,WAAW;CACrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { ConfluenceBodyEnvelope } from './bodyEnvelope';
|
|
3
|
+
/**
|
|
4
|
+
* Shared fetch → modify → PUT machinery for the Update and Append operations.
|
|
5
|
+
* Confluence uses optimistic locking: every PUT must carry
|
|
6
|
+
* `version.number = current + 1`, so both operations read the page first and
|
|
7
|
+
* a stale number (someone edited in between) surfaces as a 409.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConfluencePageSnapshot {
|
|
10
|
+
status: 'current' | 'draft';
|
|
11
|
+
title: string;
|
|
12
|
+
versionNumber: number;
|
|
13
|
+
bodyValue: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function fetchPageForWrite(this: IExecuteFunctions, itemIndex: number, pageId: string, bodyFormat?: ConfluenceBodyEnvelope['representation']): Promise<ConfluencePageSnapshot>;
|
|
16
|
+
export declare function putPage(this: IExecuteFunctions, itemIndex: number, pageId: string, snapshot: ConfluencePageSnapshot, title: string, body: ConfluenceBodyEnvelope, status?: ConfluencePageSnapshot['status']): Promise<IDataObject>;
|
|
17
|
+
//# sourceMappingURL=pageWrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageWrite.d.ts","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/pageWrite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;;;;GAKG;AAEH,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,iBAAiB,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,GACnD,OAAO,CAAC,sBAAsB,CAAC,CA0DjC;AAED,wBAAsB,OAAO,CAC5B,IAAI,EAAE,iBAAiB,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,sBAAsB,EAC5B,MAAM,GAAE,sBAAsB,CAAC,QAAQ,CAAmB,GACxD,OAAO,CAAC,WAAW,CAAC,CA8BtB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchPageForWrite = fetchPageForWrite;
|
|
4
|
+
exports.putPage = putPage;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const transport_1 = require("../../transport");
|
|
7
|
+
async function fetchPageForWrite(itemIndex, pageId, bodyFormat) {
|
|
8
|
+
const qs = {};
|
|
9
|
+
if (bodyFormat !== undefined)
|
|
10
|
+
qs['body-format'] = bodyFormat;
|
|
11
|
+
const page = await transport_1.confluenceApiRequest.call(this, 'GET', `/wiki/api/v2/pages/${encodeURIComponent(pageId)}`, {}, qs);
|
|
12
|
+
const status = typeof page.status === 'string' ? page.status : 'unknown';
|
|
13
|
+
if (status !== 'current' && status !== 'draft') {
|
|
14
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The page cannot be changed because its status is "${status}"`, {
|
|
15
|
+
itemIndex,
|
|
16
|
+
description: 'Only pages with "current" or "draft" status can be written to. Restore the page in Confluence first, then run this operation again.',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const versionNumber = page.version?.number;
|
|
20
|
+
if (typeof versionNumber !== 'number') {
|
|
21
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not read the current version of the page', {
|
|
22
|
+
itemIndex,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
let bodyValue = '';
|
|
26
|
+
if (bodyFormat !== undefined) {
|
|
27
|
+
const bodyEnvelope = page.body?.[bodyFormat];
|
|
28
|
+
// Empty pages still return value: '' — a missing value must not be
|
|
29
|
+
// mistaken for one, or the write would overwrite the page
|
|
30
|
+
if (typeof bodyEnvelope?.value !== 'string') {
|
|
31
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not read the current content of the page', {
|
|
32
|
+
itemIndex,
|
|
33
|
+
description: `The API response did not include the page body in the "${bodyFormat}" format. The page was not changed.`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
bodyValue = bodyEnvelope.value;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
status,
|
|
40
|
+
title: typeof page.title === 'string' ? page.title : '',
|
|
41
|
+
versionNumber,
|
|
42
|
+
bodyValue,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function putPage(itemIndex, pageId, snapshot, title, body, status = snapshot.status) {
|
|
46
|
+
const payload = {
|
|
47
|
+
id: pageId,
|
|
48
|
+
status,
|
|
49
|
+
title,
|
|
50
|
+
body,
|
|
51
|
+
// Drafts are single-version and require version 1; only published-to-published
|
|
52
|
+
// writes increment. See https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-put
|
|
53
|
+
version: {
|
|
54
|
+
number: status === 'draft' || snapshot.status === 'draft' ? 1 : snapshot.versionNumber + 1,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
try {
|
|
58
|
+
return await transport_1.confluenceApiRequest.call(this, 'PUT', `/wiki/api/v2/pages/${encodeURIComponent(pageId)}`, payload);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode === '409') {
|
|
62
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The page was modified concurrently', {
|
|
63
|
+
itemIndex,
|
|
64
|
+
description: 'Someone else changed the page between this operation reading it and saving it. Nothing was overwritten — run the node again to apply the change to the latest version of the page.',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=pageWrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageWrite.js","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/pageWrite.ts"],"names":[],"mappings":";;;;AACA,+CAAgE;AAGhE,+CAAuD;AAgBhD,KAAK,4BAEX,SAAiB,EACjB,MAAc,EACd,UAAqD;IAErD,MAAM,EAAE,GAAgB,EAAE,CAAC;IAC3B,IAAI,UAAU,KAAK,SAAS;QAAE,EAAE,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;IAE7D,MAAM,IAAI,GAAG,MAAM,gCAAoB,CAAC,IAAI,CAC3C,IAAI,EACJ,KAAK,EACL,sBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAClD,EAAE,EACF,EAAE,CACF,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QAChD,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,qDAAqD,MAAM,GAAG,EAC9D;YACC,SAAS;YACT,WAAW,EACV,qIAAqI;SACtI,CACD,CAAC;IACH,CAAC;IAED,MAAM,aAAa,GAAI,IAAI,CAAC,OAAmC,EAAE,MAAM,CAAC;IACxE,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,gDAAgD,EAAE;YAC9F,SAAS;SACT,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QA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AAC;YAC/D,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,oCAAoC,EAAE;gBAClF,SAAS;gBACT,WAAW,EACV,oLAAoL;aACrL,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.d.ts","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/update.operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,cAAc,CAAC;AAMvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIrD,eAAO,MAAM,WAAW,EAAE,eAAe,EA+CxC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,mBAmCrB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = exports.description = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const bodyEnvelope_1 = require("./bodyEnvelope");
|
|
6
|
+
const pageWrite_1 = require("./pageWrite");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const showOnUpdate = { resource: ['page'], operation: ['update'] };
|
|
9
|
+
exports.description = [
|
|
10
|
+
{
|
|
11
|
+
...common_1.optionalSpaceRLC,
|
|
12
|
+
description: 'Limits page selection and By Title lookups to one space. Leave empty or pick "All Spaces" to search across all spaces.',
|
|
13
|
+
displayOptions: { show: showOnUpdate },
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
...common_1.pageRLC,
|
|
17
|
+
description: 'The page to update',
|
|
18
|
+
displayOptions: { show: showOnUpdate },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'New Title',
|
|
22
|
+
name: 'title',
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: '',
|
|
25
|
+
placeholder: 'e.g. Weekly Report',
|
|
26
|
+
description: 'The new title of the page. Leave empty to keep the current title.',
|
|
27
|
+
displayOptions: { show: showOnUpdate },
|
|
28
|
+
},
|
|
29
|
+
...(0, bodyEnvelope_1.bodyProperties)(['update'], 'Leave empty to keep the current page content'),
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Status',
|
|
32
|
+
name: 'status',
|
|
33
|
+
type: 'options',
|
|
34
|
+
default: 'keep',
|
|
35
|
+
description: 'Whether the page is published or a draft after the update',
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
name: 'Draft',
|
|
39
|
+
value: 'draft',
|
|
40
|
+
description: 'Save the update as a draft. Replaces any existing draft of the page.',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Keep Current Status',
|
|
44
|
+
value: 'keep',
|
|
45
|
+
description: 'A published page stays published, a draft stays a draft',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Published',
|
|
49
|
+
value: 'current',
|
|
50
|
+
description: 'Publish the page; use this to publish a page created as a draft',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
displayOptions: { show: showOnUpdate },
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
const execute = async function (itemIndex) {
|
|
57
|
+
const body = (0, bodyEnvelope_1.readBodyEnvelopeIfProvided)(this, itemIndex);
|
|
58
|
+
const rawTitle = this.getNodeParameter('title', itemIndex, '');
|
|
59
|
+
// An empty title means "keep the current one", so an object from an
|
|
60
|
+
// expression must fail loudly instead of silently keeping the old title
|
|
61
|
+
if (rawTitle !== null && typeof rawTitle === 'object') {
|
|
62
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'New Title must be text', { itemIndex });
|
|
63
|
+
}
|
|
64
|
+
const title = rawTitle === null || rawTitle === undefined ? '' : String(rawTitle).trim();
|
|
65
|
+
const pageId = await common_1.resolvePageId.call(this, itemIndex);
|
|
66
|
+
const page = await pageWrite_1.fetchPageForWrite.call(this, itemIndex, pageId, body === undefined ? 'storage' : undefined);
|
|
67
|
+
const statusChoice = this.getNodeParameter('status', itemIndex, 'keep');
|
|
68
|
+
const status = statusChoice === 'current' || statusChoice === 'draft' ? statusChoice : page.status;
|
|
69
|
+
return await pageWrite_1.putPage.call(this, itemIndex, pageId, page, title === '' ? page.title : title, body ?? { representation: 'storage', value: page.bodyValue }, status);
|
|
70
|
+
};
|
|
71
|
+
exports.execute = execute;
|
|
72
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../nodes/Confluence/actions/page/update.operation.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAElD,iDAA4E;AAC5E,2CAAyD;AACzD,sCAAqE;AAGrE,MAAM,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;AAEtD,QAAA,WAAW,GAAsB;IAC7C;QACC,GAAG,yBAAgB;QACnB,WAAW,EACV,wHAAwH;QACzH,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;KACtC;IACD;QACC,GAAG,gBAAO;QACV,WAAW,EAAE,oBAAoB;QACjC,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;KACtC;IACD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,oBAAoB;QACjC,WAAW,EAAE,mEAAmE;QAChF,cAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;KACtC;IACD,GAAG,IAAA,6BAAc,EAAC,CAAC,QAAQ,CAAC,EAAE,8CAA8C,CAAC;IAC7E;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MA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AC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,MAAM,GACX,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAErF,OAAO,MAAM,mBAAO,CAAC,IAAI,CACxB,IAAI,EACJ,SAAS,EACT,MAAM,EACN,IAAI,EACJ,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EACjC,IAAI,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,EAC5D,MAAM,CACN,CAAC;AACH,CAAC,CAAC;AAnCW,QAAA,OAAO,GAAP,OAAO,CAmClB"}
|
|
@@ -4,5 +4,7 @@ import type { IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-wor
|
|
|
4
4
|
* `<resource>.<operation>.execute.call(this, i)` once per item.
|
|
5
5
|
*/
|
|
6
6
|
export type ConfluenceOperation = (this: IExecuteFunctions, itemIndex: number) => Promise<IDataObject | IDataObject[]>;
|
|
7
|
+
/** Variant for operations that emit their own execution items (e.g. binary output). */
|
|
8
|
+
export type ConfluenceBinaryOperation = (this: IExecuteFunctions, itemIndex: number) => Promise<INodeExecutionData[]>;
|
|
7
9
|
export declare function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
8
10
|
//# sourceMappingURL=router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../nodes/Confluence/actions/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../nodes/Confluence/actions/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CACjC,IAAI,EAAE,iBAAiB,EACvB,SAAS,EAAE,MAAM,KACb,OAAO,CAAC,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC;AAE1C,uFAAuF;AACvF,MAAM,MAAM,yBAAyB,GAAG,CACvC,IAAI,EAAE,iBAAiB,EACvB,SAAS,EAAE,MAAM,KACb,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAEnC,wBAAsB,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CA0DrF"}
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.router = router;
|
|
37
37
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
38
|
+
const attachment = __importStar(require("./attachment"));
|
|
38
39
|
const page = __importStar(require("./page"));
|
|
39
40
|
async function router() {
|
|
40
41
|
const items = this.getInputData();
|
|
@@ -44,17 +45,30 @@ async function router() {
|
|
|
44
45
|
for (let i = 0; i < items.length; i++) {
|
|
45
46
|
try {
|
|
46
47
|
let responseData;
|
|
48
|
+
let responseItems;
|
|
47
49
|
switch (`${resource}:${operation}`) {
|
|
50
|
+
case 'attachment:getMany':
|
|
51
|
+
responseItems = await attachment.getMany.execute.call(this, i);
|
|
52
|
+
break;
|
|
53
|
+
case 'page:append':
|
|
54
|
+
responseData = await page.append.execute.call(this, i);
|
|
55
|
+
break;
|
|
48
56
|
case 'page:create':
|
|
49
57
|
responseData = await page.create.execute.call(this, i);
|
|
50
58
|
break;
|
|
59
|
+
case 'page:delete':
|
|
60
|
+
responseData = await page.delete.execute.call(this, i);
|
|
61
|
+
break;
|
|
51
62
|
case 'page:get':
|
|
52
63
|
responseData = await page.get.execute.call(this, i);
|
|
53
64
|
break;
|
|
65
|
+
case 'page:update':
|
|
66
|
+
responseData = await page.update.execute.call(this, i);
|
|
67
|
+
break;
|
|
54
68
|
default:
|
|
55
69
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${resource}:${operation}" is not supported`);
|
|
56
70
|
}
|
|
57
|
-
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
71
|
+
const executionData = this.helpers.constructExecutionMetaData(responseItems ?? this.helpers.returnJsonArray(responseData ?? []), { itemData: { item: i } });
|
|
58
72
|
returnData.push.apply(returnData, executionData);
|
|
59
73
|
}
|
|
60
74
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../nodes/Confluence/actions/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAkD;AAElD,MAAY,IAAI,mCAAe;
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../nodes/Confluence/actions/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAkD;AAElD,MAAY,UAAU,yCAAqB;AAC3C,MAAY,IAAI,mCAAe;AAiBxB,KAAK;IACX,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5D,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EA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EACjE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CACzB,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CACxD,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAChD,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CACzB,CAAC;gBACF,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAC7C,SAAS;YACV,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
2
|
export declare const CONFLUENCE_CREDENTIAL_NAME = "confluenceCloudOAuth2Api";
|
|
3
3
|
export declare function confluenceApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject>;
|
|
4
|
+
/**
|
|
5
|
+
* Fetches a binary resource (e.g. an attachment's server-relative `downloadLink`)
|
|
6
|
+
* through the gateway and returns its raw bytes. Same base-URL concatenation rule
|
|
7
|
+
* as `confluenceApiRequest`: the endpoint can never change the host.
|
|
8
|
+
*/
|
|
9
|
+
export declare function confluenceApiRequestBinary(this: IExecuteFunctions, endpoint: string): Promise<Buffer>;
|
|
4
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../nodes/Confluence/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAEnB,qBAAqB,EAErB,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../nodes/Confluence/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAEnB,qBAAqB,EAErB,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAuErE,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,EAC/C,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,WAAgB,EACtB,EAAE,GAAE,WAAgB,GAClB,OAAO,CAAC,WAAW,CAAC,CAoCtB;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAwCjB"}
|
|
@@ -2,9 +2,59 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CONFLUENCE_CREDENTIAL_NAME = void 0;
|
|
4
4
|
exports.confluenceApiRequest = confluenceApiRequest;
|
|
5
|
+
exports.confluenceApiRequestBinary = confluenceApiRequestBinary;
|
|
5
6
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
7
|
const atlassian_1 = require("../../../utils/atlassian");
|
|
7
8
|
exports.CONFLUENCE_CREDENTIAL_NAME = 'confluenceCloudOAuth2Api';
|
|
9
|
+
function extractApiMessage(body) {
|
|
10
|
+
if (typeof body !== 'object' || body === null)
|
|
11
|
+
return undefined;
|
|
12
|
+
const data = body;
|
|
13
|
+
const { errors: v2Errors, message: v1Message } = data;
|
|
14
|
+
const first = Array.isArray(v2Errors)
|
|
15
|
+
? v2Errors[0]
|
|
16
|
+
: undefined;
|
|
17
|
+
if (typeof first?.title === 'string' && first.title !== '') {
|
|
18
|
+
return {
|
|
19
|
+
message: first.title,
|
|
20
|
+
description: typeof first.detail === 'string' && first.detail !== '' ? first.detail : undefined,
|
|
21
|
+
data,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (typeof v1Message === 'string' && v1Message !== '')
|
|
25
|
+
return { message: v1Message, data };
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
// NodeApiError's constructor short-circuits on re-wrap (returns the same
|
|
29
|
+
// instance, dropping any option overrides), so enrichment needs a fresh error.
|
|
30
|
+
function toConfluenceApiError(error) {
|
|
31
|
+
const wrapped = error instanceof n8n_workflow_1.NodeApiError ? error : undefined;
|
|
32
|
+
const body = wrapped ? wrapped.context.data : error.response?.data;
|
|
33
|
+
const extracted = extractApiMessage(body);
|
|
34
|
+
if (extracted !== undefined) {
|
|
35
|
+
let httpCode;
|
|
36
|
+
if (wrapped) {
|
|
37
|
+
httpCode = wrapped.httpCode ?? undefined;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const status = error.response?.status;
|
|
41
|
+
httpCode =
|
|
42
|
+
typeof status === 'number' || typeof status === 'string' ? String(status) : undefined;
|
|
43
|
+
}
|
|
44
|
+
const sanitizedError = { message: extracted.message };
|
|
45
|
+
const fresh = new n8n_workflow_1.NodeApiError(this.getNode(), sanitizedError, {
|
|
46
|
+
message: extracted.message,
|
|
47
|
+
description: extracted.description,
|
|
48
|
+
httpCode,
|
|
49
|
+
});
|
|
50
|
+
// Keep the raw response body visible in the NDV's error-data pane
|
|
51
|
+
fresh.context.data = extracted.data;
|
|
52
|
+
return fresh;
|
|
53
|
+
}
|
|
54
|
+
if (wrapped)
|
|
55
|
+
return wrapped;
|
|
56
|
+
return new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
57
|
+
}
|
|
8
58
|
async function confluenceApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
9
59
|
const credentials = await this.getCredentials(exports.CONFLUENCE_CREDENTIAL_NAME);
|
|
10
60
|
// Keyed `domain` for backwards compatibility with Jira credentials; labeled "Site URL" in the UI
|
|
@@ -26,16 +76,42 @@ async function confluenceApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
|
26
76
|
return await this.helpers.httpRequestWithAuthentication.call(this, exports.CONFLUENCE_CREDENTIAL_NAME, options);
|
|
27
77
|
}
|
|
28
78
|
catch (error) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
79
|
+
throw toConfluenceApiError.call(this, error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fetches a binary resource (e.g. an attachment's server-relative `downloadLink`)
|
|
84
|
+
* through the gateway and returns its raw bytes. Same base-URL concatenation rule
|
|
85
|
+
* as `confluenceApiRequest`: the endpoint can never change the host.
|
|
86
|
+
*/
|
|
87
|
+
async function confluenceApiRequestBinary(endpoint) {
|
|
88
|
+
const credentials = await this.getCredentials(exports.CONFLUENCE_CREDENTIAL_NAME);
|
|
89
|
+
const siteUrl = credentials.domain;
|
|
90
|
+
if (typeof siteUrl !== 'string' || siteUrl === '') {
|
|
91
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The Confluence credential is missing the Site URL field');
|
|
92
|
+
}
|
|
93
|
+
const cloudId = await atlassian_1.getAtlassianCloudId.call(this, exports.CONFLUENCE_CREDENTIAL_NAME, siteUrl, 'confluence');
|
|
94
|
+
// Downloads 302 to the Atlassian media host, which authenticates the hop via its
|
|
95
|
+
// own signed token in the redirect URL; the OAuth header must not follow cross-origin.
|
|
96
|
+
const options = {
|
|
97
|
+
method: 'GET',
|
|
98
|
+
url: `${(0, atlassian_1.getAtlassianApiBaseUrl)('confluence', cloudId)}${endpoint}`,
|
|
99
|
+
encoding: 'arraybuffer',
|
|
100
|
+
sendCredentialsOnCrossOriginRedirect: false,
|
|
101
|
+
};
|
|
102
|
+
let data;
|
|
103
|
+
try {
|
|
104
|
+
data = await this.helpers.httpRequestWithAuthentication.call(this, exports.CONFLUENCE_CREDENTIAL_NAME, options);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
throw toConfluenceApiError.call(this, error);
|
|
39
108
|
}
|
|
109
|
+
if (Buffer.isBuffer(data))
|
|
110
|
+
return data;
|
|
111
|
+
if (data instanceof ArrayBuffer)
|
|
112
|
+
return Buffer.from(data);
|
|
113
|
+
if (typeof data === 'string')
|
|
114
|
+
return Buffer.from(data);
|
|
115
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Confluence returned an unexpected binary response');
|
|
40
116
|
}
|
|
41
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/Confluence/transport/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/Confluence/transport/index.ts"],"names":[],"mappings":";;;;;AAQA,+CAAgE;AAEhE,gDAA+E;AAElE,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AAYrE,SAAS,iBAAiB,CAAC,IAAa;IACvC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,IAAI,GAAG,IAAmB,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAA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B,CAAC,IAAI,CAC3D,IAAI,EACJ,QAAA,0BAA0B,EAC1B,OAAO,CACP,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,IAAI,YAAY,WAAW;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,mDAAmD,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveTo.operation.d.ts","sourceRoot":"","sources":["../../../../../nodes/Files/ExtractFromFile/actions/moveTo.operation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEX,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAEf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"moveTo.operation.d.ts","sourceRoot":"","sources":["../../../../../nodes/Files/ExtractFromFile/actions/moveTo.operation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEX,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAEf,MAAM,cAAc,CAAC;AActB,eAAO,MAAM,UAAU,EAAE,eAAe,EAwEvC,CAAC;AAQF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAE5E,wBAAsB,OAAO,CAC5B,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,SAAS,EAAE,MAAM,iCA2FjB"}
|
|
@@ -9,9 +9,9 @@ const iconv_lite_1 = __importDefault(require("iconv-lite"));
|
|
|
9
9
|
const set_1 = __importDefault(require("lodash/set"));
|
|
10
10
|
const unset_1 = __importDefault(require("lodash/unset"));
|
|
11
11
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
12
|
-
const ts_ics_1 = require("ts-ics");
|
|
13
12
|
const descriptions_1 = require("../../../../utils/descriptions");
|
|
14
13
|
const utilities_1 = require("../../../../utils/utilities");
|
|
14
|
+
const parseIcsCalendar_1 = require("./parseIcsCalendar");
|
|
15
15
|
exports.properties = [
|
|
16
16
|
{
|
|
17
17
|
displayName: 'Input Binary Field',
|
|
@@ -128,7 +128,7 @@ async function execute(items, operation) {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
if (operation === 'fromIcs') {
|
|
131
|
-
convertedValue = (0,
|
|
131
|
+
convertedValue = (0, parseIcsCalendar_1.parseIcsCalendar)(convertedValue);
|
|
132
132
|
}
|
|
133
133
|
const destinationKey = this.getNodeParameter('destinationKey', itemIndex, '');
|
|
134
134
|
(0, set_1.default)(newItem.json, destinationKey, convertedValue);
|