n8n-nodes-craft-daily-notes 1.0.23 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/CraftDocumentsApi.credentials.d.ts +9 -0
- package/dist/credentials/CraftDocumentsApi.credentials.js +31 -0
- package/dist/credentials/CraftDocumentsApi.credentials.js.map +1 -0
- package/dist/nodes/CraftDailyNotes/resources/block/insert.js +7 -43
- package/dist/nodes/CraftDailyNotes/resources/block/insert.js.map +1 -1
- package/dist/nodes/CraftDailyNotes/resources/collection/addItems.js +33 -7
- package/dist/nodes/CraftDailyNotes/resources/collection/addItems.js.map +1 -1
- package/dist/nodes/CraftDailyNotes/resources/collection/deleteItems.js +1 -1
- package/dist/nodes/CraftDailyNotes/resources/collection/deleteItems.js.map +1 -1
- package/dist/nodes/CraftDailyNotes/resources/collection/updateItems.js +40 -7
- package/dist/nodes/CraftDailyNotes/resources/collection/updateItems.js.map +1 -1
- package/dist/nodes/CraftDocuments/CraftDocuments.node.d.ts +12 -0
- package/dist/nodes/CraftDocuments/CraftDocuments.node.js +83 -0
- package/dist/nodes/CraftDocuments/CraftDocuments.node.js.map +1 -0
- package/dist/nodes/CraftDocuments/CraftDocuments.node.json +22 -0
- package/dist/nodes/CraftDocuments/loadOptions/getCollections.d.ts +2 -0
- package/dist/nodes/CraftDocuments/loadOptions/getCollections.js +18 -0
- package/dist/nodes/CraftDocuments/loadOptions/getCollections.js.map +1 -0
- package/dist/nodes/CraftDocuments/loadOptions/getDocuments.d.ts +2 -0
- package/dist/nodes/CraftDocuments/loadOptions/getDocuments.js +18 -0
- package/dist/nodes/CraftDocuments/loadOptions/getDocuments.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/delete.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/delete.js +24 -0
- package/dist/nodes/CraftDocuments/resources/block/delete.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/get.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/get.js +91 -0
- package/dist/nodes/CraftDocuments/resources/block/get.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/index.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/index.js +104 -0
- package/dist/nodes/CraftDocuments/resources/block/index.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/insert.d.ts +3 -0
- package/dist/nodes/CraftDocuments/resources/block/insert.js +117 -0
- package/dist/nodes/CraftDocuments/resources/block/insert.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/move.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/move.js +81 -0
- package/dist/nodes/CraftDocuments/resources/block/move.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/search.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/search.js +96 -0
- package/dist/nodes/CraftDocuments/resources/block/search.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/block/update.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/block/update.js +85 -0
- package/dist/nodes/CraftDocuments/resources/block/update.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/addItems.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/addItems.js +60 -0
- package/dist/nodes/CraftDocuments/resources/collection/addItems.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/deleteItems.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/deleteItems.js +36 -0
- package/dist/nodes/CraftDocuments/resources/collection/deleteItems.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/getItems.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/getItems.js +37 -0
- package/dist/nodes/CraftDocuments/resources/collection/getItems.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/getSchema.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/getSchema.js +45 -0
- package/dist/nodes/CraftDocuments/resources/collection/getSchema.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/index.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/index.js +101 -0
- package/dist/nodes/CraftDocuments/resources/collection/index.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/list.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/list.js +60 -0
- package/dist/nodes/CraftDocuments/resources/collection/list.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/collection/updateItems.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/collection/updateItems.js +67 -0
- package/dist/nodes/CraftDocuments/resources/collection/updateItems.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/document/index.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/document/index.js +31 -0
- package/dist/nodes/CraftDocuments/resources/document/index.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/document/list.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/document/list.js +15 -0
- package/dist/nodes/CraftDocuments/resources/document/list.js.map +1 -0
- package/dist/nodes/CraftDocuments/resources/search/index.d.ts +2 -0
- package/dist/nodes/CraftDocuments/resources/search/index.js +110 -0
- package/dist/nodes/CraftDocuments/resources/search/index.js.map +1 -0
- package/dist/nodes/CraftDocuments/shared/transport.d.ts +2 -0
- package/dist/nodes/CraftDocuments/shared/transport.js +20 -0
- package/dist/nodes/CraftDocuments/shared/transport.js.map +1 -0
- package/dist/package.json +11 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -6
- package/dist/nodes/CraftDailyNotes/shared/blockBuilder.d.ts +0 -18
- package/dist/nodes/CraftDailyNotes/shared/blockBuilder.js +0 -191
- package/dist/nodes/CraftDailyNotes/shared/blockBuilder.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class CraftDocumentsApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CraftDocumentsApi = void 0;
|
|
4
|
+
class CraftDocumentsApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'craftDocumentsApi';
|
|
7
|
+
this.displayName = 'Craft Documents API';
|
|
8
|
+
this.icon = { light: 'file:../icons/craft.svg', dark: 'file:../icons/craft.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://www.craft.do/s/hLrMZpKFfYRWPT';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API URL',
|
|
13
|
+
name: 'apiUrl',
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
placeholder: 'https://connect.craft.do/links/YOUR_ID/api/v1',
|
|
18
|
+
description: 'Your Connect API URL from Craft. Go to Settings → Connect → Collections & Docs to get this URL.',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
this.test = {
|
|
22
|
+
request: {
|
|
23
|
+
baseURL: '={{$credentials.apiUrl}}',
|
|
24
|
+
url: '/documents',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.CraftDocumentsApi = CraftDocumentsApi;
|
|
31
|
+
//# sourceMappingURL=CraftDocumentsApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CraftDocumentsApi.credentials.js","sourceRoot":"","sources":["../../credentials/CraftDocumentsApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,iBAAiB;IAA9B;QACC,SAAI,GAAG,mBAAmB,CAAC;QAE3B,gBAAW,GAAG,qBAAqB,CAAC;QAEpC,SAAI,GAAS,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,8BAA8B,EAAE,CAAC;QAExF,qBAAgB,GAAG,uCAAuC,CAAC;QAE3D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+CAA+C;gBAC5D,WAAW,EACV,iGAAiG;aAClG;SACD,CAAC;QAOF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,0BAA0B;gBACnC,GAAG,EAAE,YAAY;gBACjB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAlCD,8CAkCC"}
|
|
@@ -24,51 +24,21 @@ function buildPositionObject(context) {
|
|
|
24
24
|
return position;
|
|
25
25
|
}
|
|
26
26
|
async function blockInsertPreSend(requestOptions) {
|
|
27
|
-
const DEBUG_MODE = false;
|
|
28
|
-
const debugInfo = [];
|
|
29
|
-
debugInfo.push('=== CRAFT INSERT v1.0.20 DEBUG ===');
|
|
30
|
-
debugInfo.push(`requestOptions.body BEFORE: ${JSON.stringify(requestOptions.body)}`);
|
|
31
|
-
debugInfo.push(`requestOptions.method: ${requestOptions.method}`);
|
|
32
|
-
debugInfo.push(`requestOptions.url: ${requestOptions.url}`);
|
|
33
27
|
const position = buildPositionObject(this);
|
|
34
|
-
debugInfo.push(`Position: ${JSON.stringify(position)}`);
|
|
35
28
|
let markdownContent = '';
|
|
36
|
-
let rawValueType = 'unknown';
|
|
37
29
|
try {
|
|
38
30
|
const rawValue = this.getNodeParameter('markdownContent', '');
|
|
39
|
-
|
|
40
|
-
debugInfo.push(`markdownContent type: ${rawValueType}`);
|
|
41
|
-
debugInfo.push(`markdownContent isArray: ${Array.isArray(rawValue)}`);
|
|
42
|
-
if (rawValue === null || rawValue === undefined) {
|
|
43
|
-
markdownContent = '';
|
|
44
|
-
debugInfo.push('markdownContent: NULL/UNDEFINED');
|
|
45
|
-
}
|
|
46
|
-
else if (typeof rawValue === 'string') {
|
|
31
|
+
if (typeof rawValue === 'string') {
|
|
47
32
|
markdownContent = rawValue;
|
|
48
|
-
debugInfo.push(`markdownContent length: ${rawValue.length}`);
|
|
49
|
-
debugInfo.push(`markdownContent first 300 chars: ${rawValue.substring(0, 300)}`);
|
|
50
|
-
}
|
|
51
|
-
else if (Array.isArray(rawValue)) {
|
|
52
|
-
debugInfo.push(`WARNING: ARRAY with ${rawValue.length} items`);
|
|
53
|
-
debugInfo.push(`Array contents: ${JSON.stringify(rawValue).substring(0, 500)}`);
|
|
54
|
-
markdownContent = rawValue.join('\n');
|
|
55
33
|
}
|
|
56
|
-
else if (
|
|
57
|
-
debugInfo.push(`WARNING: OBJECT`);
|
|
58
|
-
debugInfo.push(`Object contents: ${JSON.stringify(rawValue).substring(0, 500)}`);
|
|
59
|
-
markdownContent = JSON.stringify(rawValue);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
34
|
+
else if (rawValue) {
|
|
62
35
|
markdownContent = String(rawValue);
|
|
63
36
|
}
|
|
64
37
|
}
|
|
65
|
-
catch
|
|
66
|
-
debugInfo.push(`ERROR: ${error}`);
|
|
38
|
+
catch {
|
|
67
39
|
markdownContent = '';
|
|
68
40
|
}
|
|
69
|
-
|
|
70
|
-
debugInfo.push(`Final content length: ${markdownContent.length}`);
|
|
71
|
-
const bodyObject = {
|
|
41
|
+
const requestBody = {
|
|
72
42
|
blocks: [
|
|
73
43
|
{
|
|
74
44
|
type: 'text',
|
|
@@ -78,19 +48,13 @@ async function blockInsertPreSend(requestOptions) {
|
|
|
78
48
|
position: {
|
|
79
49
|
position: String(position.position || 'end'),
|
|
80
50
|
date: String(position.date || 'today'),
|
|
81
|
-
...(position.referenceBlockId ? { referenceBlockId: String(position.referenceBlockId) } : {}),
|
|
82
51
|
},
|
|
83
52
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
debugInfo.push(`JSON body length: ${jsonBody.length}`);
|
|
87
|
-
debugInfo.push(`JSON body first 800 chars: ${jsonBody.substring(0, 800)}`);
|
|
88
|
-
if (DEBUG_MODE) {
|
|
89
|
-
throw new Error('DEBUG INFO (this is intentional):\n\n' + debugInfo.join('\n'));
|
|
53
|
+
if (position.referenceBlockId) {
|
|
54
|
+
requestBody.position.referenceBlockId = String(position.referenceBlockId);
|
|
90
55
|
}
|
|
91
|
-
requestOptions.body =
|
|
56
|
+
requestOptions.body = JSON.stringify(requestBody);
|
|
92
57
|
requestOptions.headers = {
|
|
93
|
-
...requestOptions.headers,
|
|
94
58
|
'Content-Type': 'application/json',
|
|
95
59
|
'Accept': 'application/json',
|
|
96
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/block/insert.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/block/insert.ts"],"names":[],"mappings":";;;AAmDA,gDAkDC;AAvFD,MAAM,sBAAsB,GAAG,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAK9E,SAAS,mBAAmB,CAAC,OAAgC;IAC5D,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,GAAG,OAAO,CAAC;IACzB,IAAI,gBAAgB,GAAG,EAAE,CAAC;IAE1B,IAAI,CAAC;QACJ,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAW,CAAC;QACzE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAW,CAAC;QACvE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,EAAE,CAAW,C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E,EAAE,IAAI,EAAE,sBAAsB,EAAE;KAChD;IAGD;QACC,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,kEAAkE;QAC/E,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,GAAG,sBAAsB;gBACzB,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;aACjC;SACD;KACD;CACD,CAAC"}
|
|
@@ -16,17 +16,43 @@ exports.collectionAddItemsDescription = [
|
|
|
16
16
|
displayOptions: { show: showOnlyForCollectionAddItems },
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
displayName: 'Items
|
|
20
|
-
name: '
|
|
21
|
-
type: '
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
displayName: 'Items',
|
|
20
|
+
name: 'items',
|
|
21
|
+
type: 'fixedCollection',
|
|
22
|
+
typeOptions: {
|
|
23
|
+
multipleValues: true,
|
|
24
|
+
},
|
|
25
|
+
default: {},
|
|
26
|
+
placeholder: 'Add Item',
|
|
25
27
|
displayOptions: { show: showOnlyForCollectionAddItems },
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
name: 'itemValues',
|
|
31
|
+
displayName: 'Item',
|
|
32
|
+
values: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Title',
|
|
35
|
+
name: 'title',
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: '',
|
|
38
|
+
required: true,
|
|
39
|
+
description: 'The title for the new item',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Properties (JSON)',
|
|
43
|
+
name: 'properties',
|
|
44
|
+
type: 'json',
|
|
45
|
+
default: '{}',
|
|
46
|
+
description: 'Additional properties for the item as JSON object. Use "Get Schema" to see available fields.',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
26
51
|
routing: {
|
|
27
52
|
send: {
|
|
28
53
|
type: 'body',
|
|
29
|
-
|
|
54
|
+
property: 'items',
|
|
55
|
+
value: '={{ $value.itemValues ? $value.itemValues.map(item => ({ title: item.title, properties: typeof item.properties === "string" ? JSON.parse(item.properties || "{}") : (item.properties || {}) })) : [] }}',
|
|
30
56
|
},
|
|
31
57
|
},
|
|
32
58
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/addItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,6BAA6B,GAAG,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAE/E,QAAA,6BAA6B,GAAsB;IAE/D;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE;KACvD;IAGD;QACC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"addItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/addItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,6BAA6B,GAAG,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAE/E,QAAA,6BAA6B,GAAsB;IAE/D;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE;KACvD;IAGD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE;YACZ,cAAc,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,UAAU;QACvB,cAAc,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE;QACvD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,MAAM;gBACnB,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,4BAA4B;qBACzC;oBACD;wBACC,WAAW,EAAE,mBAAmB;wBAChC,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,8FAA8F;qBAC3G;iBACD;aACD;SACD;QACD,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,OAAO;gBACjB,KAAK,EACJ,yMAAyM;aAC1M;SACD;KACD;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/deleteItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,gCAAgC,GAAG,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAErF,QAAA,gCAAgC,GAAsB;IAElE;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;KAC1D;IAGD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"deleteItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/deleteItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,gCAAgC,GAAG,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAErF,QAAA,gCAAgC,GAAsB;IAElE;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;KAC1D;IAGD;QACC,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iCAAiC;QAC9C,WAAW,EACV,iHAAiH;QAClH,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;QAC1D,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,aAAa;gBACvB,KAAK,EACJ,6FAA6F;aAC9F;SACD;KACD;CACD,CAAC"}
|
|
@@ -16,17 +16,50 @@ exports.collectionUpdateItemsDescription = [
|
|
|
16
16
|
displayOptions: { show: showOnlyForCollectionUpdateItems },
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
displayName: 'Items to Update
|
|
20
|
-
name: '
|
|
21
|
-
type: '
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
displayName: 'Items to Update',
|
|
20
|
+
name: 'itemsToUpdate',
|
|
21
|
+
type: 'fixedCollection',
|
|
22
|
+
typeOptions: {
|
|
23
|
+
multipleValues: true,
|
|
24
|
+
},
|
|
25
|
+
default: {},
|
|
26
|
+
placeholder: 'Add Item',
|
|
25
27
|
displayOptions: { show: showOnlyForCollectionUpdateItems },
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
name: 'itemValues',
|
|
31
|
+
displayName: 'Item',
|
|
32
|
+
values: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Item ID',
|
|
35
|
+
name: 'id',
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: '',
|
|
38
|
+
required: true,
|
|
39
|
+
description: 'The ID of the item to update',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Title',
|
|
43
|
+
name: 'title',
|
|
44
|
+
type: 'string',
|
|
45
|
+
default: '',
|
|
46
|
+
description: 'New title for the item (leave empty to keep current)',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Properties (JSON)',
|
|
50
|
+
name: 'properties',
|
|
51
|
+
type: 'json',
|
|
52
|
+
default: '{}',
|
|
53
|
+
description: 'Updated properties for the item as JSON object',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
26
58
|
routing: {
|
|
27
59
|
send: {
|
|
28
60
|
type: 'body',
|
|
29
|
-
|
|
61
|
+
property: 'itemsToUpdate',
|
|
62
|
+
value: '={{ $value.itemValues ? $value.itemValues.map(item => { const obj = { id: item.id }; if (item.title) obj.title = item.title; obj.properties = typeof item.properties === "string" ? JSON.parse(item.properties || "{}") : (item.properties || {}); return obj; }) : [] }}',
|
|
30
63
|
},
|
|
31
64
|
},
|
|
32
65
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/updateItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,gCAAgC,GAAG,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAErF,QAAA,gCAAgC,GAAsB;IAElE;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;KAC1D;IAGD;QACC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"updateItems.js","sourceRoot":"","sources":["../../../../../nodes/CraftDailyNotes/resources/collection/updateItems.ts"],"names":[],"mappings":";;;AAMA,MAAM,gCAAgC,GAAG,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAErF,QAAA,gCAAgC,GAAsB;IAElE;QACC,WAAW,EAAE,uBAAuB;QACpC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACZ,iBAAiB,EAAE,gBAAgB;SACnC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,4JAA4J;QACzK,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;KAC1D;IAGD;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE;YACZ,cAAc,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,UAAU;QACvB,cAAc,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE;QAC1D,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,MAAM;gBACnB,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,SAAS;wBACtB,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,8BAA8B;qBAC3C;oBACD;wBACC,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,sDAAsD;qBACnE;oBACD;wBACC,WAAW,EAAE,mBAAmB;wBAChC,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,gDAAgD;qBAC7D;iBACD;aACD;SACD;QACD,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,eAAe;gBACzB,KAAK,EACJ,2QAA2Q;aAC5Q;SACD;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import { getDocuments } from './loadOptions/getDocuments';
|
|
3
|
+
import { getCollections } from './loadOptions/getCollections';
|
|
4
|
+
export declare class CraftDocuments implements INodeType {
|
|
5
|
+
description: INodeTypeDescription;
|
|
6
|
+
methods: {
|
|
7
|
+
loadOptions: {
|
|
8
|
+
getDocuments: typeof getDocuments;
|
|
9
|
+
getCollections: typeof getCollections;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CraftDocuments = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const document_1 = require("./resources/document");
|
|
6
|
+
const block_1 = require("./resources/block");
|
|
7
|
+
const collection_1 = require("./resources/collection");
|
|
8
|
+
const search_1 = require("./resources/search");
|
|
9
|
+
const getDocuments_1 = require("./loadOptions/getDocuments");
|
|
10
|
+
const getCollections_1 = require("./loadOptions/getCollections");
|
|
11
|
+
class CraftDocuments {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.description = {
|
|
14
|
+
displayName: 'Craft Documents',
|
|
15
|
+
name: 'craftDocuments',
|
|
16
|
+
icon: { light: 'file:../../icons/craft.svg', dark: 'file:../../icons/craft.dark.svg' },
|
|
17
|
+
group: ['transform'],
|
|
18
|
+
version: 1,
|
|
19
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
20
|
+
description: 'Interact with Craft Multi-Document API - manage documents, blocks, collections, and search',
|
|
21
|
+
defaults: { name: 'Craft Documents' },
|
|
22
|
+
usableAsTool: true,
|
|
23
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
24
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
25
|
+
credentials: [
|
|
26
|
+
{
|
|
27
|
+
name: 'craftDocumentsApi',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
requestDefaults: {
|
|
32
|
+
baseURL: '={{$credentials.apiUrl}}',
|
|
33
|
+
headers: {
|
|
34
|
+
Accept: 'application/json',
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
properties: [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Resource',
|
|
41
|
+
name: 'resource',
|
|
42
|
+
type: 'options',
|
|
43
|
+
noDataExpression: true,
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'Document',
|
|
47
|
+
value: 'document',
|
|
48
|
+
description: 'List and manage documents',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Block',
|
|
52
|
+
value: 'block',
|
|
53
|
+
description: 'Manage content blocks in documents',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Collection',
|
|
57
|
+
value: 'collection',
|
|
58
|
+
description: 'Manage collections (database-like structures)',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Search',
|
|
62
|
+
value: 'search',
|
|
63
|
+
description: 'Search across documents',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
default: 'document',
|
|
67
|
+
},
|
|
68
|
+
...document_1.documentDescription,
|
|
69
|
+
...block_1.blockDescription,
|
|
70
|
+
...collection_1.collectionDescription,
|
|
71
|
+
...search_1.searchDescription,
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
this.methods = {
|
|
75
|
+
loadOptions: {
|
|
76
|
+
getDocuments: getDocuments_1.getDocuments,
|
|
77
|
+
getCollections: getCollections_1.getCollections,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.CraftDocuments = CraftDocuments;
|
|
83
|
+
//# sourceMappingURL=CraftDocuments.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CraftDocuments.node.js","sourceRoot":"","sources":["../../../nodes/CraftDocuments/CraftDocuments.node.ts"],"names":[],"mappings":";;;AAYA,+CAAmD;AAGnD,mDAA2D;AAC3D,6CAAqD;AACrD,uDAA+D;AAC/D,+CAAuD;AAGvD,6DAA0D;AAC1D,iEAA8D;AAE9D,MAAa,cAAc;IAA3B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE;YACtF,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,4FAA4F;Y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
+
"node": "n8n-nodes-craft-daily-notes.craftDocuments",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Productivity"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://www.craft.do/s/hLrMZpKFfYRWPT"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://www.craft.do/s/hLrMZpKFfYRWPT"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"alias": ["craft", "documents", "collections", "notes", "knowledge base"],
|
|
19
|
+
"subcategories": {
|
|
20
|
+
"Productivity": ["Notes & Documents"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCollections = getCollections;
|
|
4
|
+
const transport_1 = require("../shared/transport");
|
|
5
|
+
async function getCollections() {
|
|
6
|
+
const response = (await transport_1.craftApiRequest.call(this, 'GET', '/collections'));
|
|
7
|
+
if (!(response === null || response === void 0 ? void 0 : response.items) || !Array.isArray(response.items)) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return response.items.map((collection) => ({
|
|
11
|
+
name: collection.name || `Collection ${collection.key}`,
|
|
12
|
+
value: collection.key,
|
|
13
|
+
description: collection.documentId
|
|
14
|
+
? `In document: ${collection.documentId}`
|
|
15
|
+
: `ID: ${collection.key}`,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=getCollections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCollections.js","sourceRoot":"","sources":["../../../../nodes/CraftDocuments/loadOptions/getCollections.ts"],"names":[],"mappings":";;AAyBA,wCAoBC;AAxCD,mDAAsD;AAoB/C,KAAK,UAAU,cAAc;IAGnC,MAAM,QAAQ,GAAG,CAAC,MAAM,2BAAe,CAAC,IAAI,CAC3C,IAAI,EACJ,KAAK,EACL,cAAc,CACd,CAAmC,CAAC;IAErC,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,cAAc,UAAU,CAAC,GAAG,EAAE;QACvD,KAAK,EAAE,UAAU,CAAC,GAAG;QACrB,WAAW,EAAE,UAAU,CAAC,UAAU;YACjC,CAAC,CAAC,gBAAgB,UAAU,CAAC,UAAU,EAAE;YACzC,CAAC,CAAC,OAAO,UAAU,CAAC,GAAG,EAAE;KAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDocuments = getDocuments;
|
|
4
|
+
const transport_1 = require("../shared/transport");
|
|
5
|
+
async function getDocuments() {
|
|
6
|
+
const response = (await transport_1.craftApiRequest.call(this, 'GET', '/documents'));
|
|
7
|
+
if (!(response === null || response === void 0 ? void 0 : response.items) || !Array.isArray(response.items)) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return response.items
|
|
11
|
+
.filter((doc) => !doc.isDeleted)
|
|
12
|
+
.map((doc) => ({
|
|
13
|
+
name: doc.title || `Document ${doc.id}`,
|
|
14
|
+
value: doc.id,
|
|
15
|
+
description: `ID: ${doc.id}`,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=getDocuments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDocuments.js","sourceRoot":"","sources":["../../../../nodes/CraftDocuments/loadOptions/getDocuments.ts"],"names":[],"mappings":";;AAqBA,oCAqBC;AArCD,mDAAsD;AAgB/C,KAAK,UAAU,YAAY;IAGjC,MAAM,QAAQ,GAAG,CAAC,MAAM,2BAAe,CAAC,IAAI,CAC3C,IAAI,EACJ,KAAK,EACL,YAAY,CACZ,CAAiC,CAAC;IAEnC,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,EAAE,CAAC;IACX,CAAC;IAGD,OAAO,QAAQ,CAAC,KAAK;SACnB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;SAC/B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,YAAY,GAAG,CAAC,EAAE,EAAE;QACvC,KAAK,EAAE,GAAG,CAAC,EAAE;QACb,WAAW,EAAE,OAAO,GAAG,CAAC,EAAE,EAAE;KAC5B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blockDeleteDescription = void 0;
|
|
4
|
+
const showOnlyForBlockDelete = { operation: ['delete'], resource: ['block'] };
|
|
5
|
+
exports.blockDeleteDescription = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Block IDs',
|
|
8
|
+
name: 'blockIds',
|
|
9
|
+
type: 'string',
|
|
10
|
+
default: '',
|
|
11
|
+
required: true,
|
|
12
|
+
placeholder: 'ID1, ID2, ID3 or ["ID1", "ID2"]',
|
|
13
|
+
description: 'Block IDs to delete. Provide as comma-separated values or JSON array.',
|
|
14
|
+
displayOptions: { show: showOnlyForBlockDelete },
|
|
15
|
+
routing: {
|
|
16
|
+
send: {
|
|
17
|
+
type: 'body',
|
|
18
|
+
property: 'blockIds',
|
|
19
|
+
value: '={{ $value.startsWith("[") ? JSON.parse($value) : $value.split(",").map(id => id.trim()) }}',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../nodes/CraftDocuments/resources/block/delete.ts"],"names":[],"mappings":";;;AAQA,MAAM,sBAAsB,GAAG,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAEjE,QAAA,sBAAsB,GAAsB;IAExD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iCAAiC;QAC9C,WAAW,EACV,uEAAuE;QACxE,cAAc,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;QAChD,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,UAAU;gBACpB,KAAK,EACJ,6FAA6F;aAC9F;SACD;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blockGetDescription = void 0;
|
|
4
|
+
const showOnlyForBlockGet = { operation: ['get'], resource: ['block'] };
|
|
5
|
+
exports.blockGetDescription = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Document or Block ID',
|
|
8
|
+
name: 'blockId',
|
|
9
|
+
type: 'string',
|
|
10
|
+
default: '',
|
|
11
|
+
required: true,
|
|
12
|
+
placeholder: 'doc-123 or block-uuid',
|
|
13
|
+
description: 'The ID of the document or block to fetch. Use "List Documents" to discover available document IDs.',
|
|
14
|
+
displayOptions: { show: showOnlyForBlockGet },
|
|
15
|
+
routing: {
|
|
16
|
+
send: {
|
|
17
|
+
type: 'query',
|
|
18
|
+
property: 'id',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Max Depth',
|
|
24
|
+
name: 'maxDepth',
|
|
25
|
+
type: 'number',
|
|
26
|
+
typeOptions: {
|
|
27
|
+
minValue: -1,
|
|
28
|
+
maxValue: 10,
|
|
29
|
+
},
|
|
30
|
+
default: -1,
|
|
31
|
+
description: 'Maximum depth of nested content to fetch. -1 for all descendants, 0 for only the block itself.',
|
|
32
|
+
displayOptions: { show: showOnlyForBlockGet },
|
|
33
|
+
routing: {
|
|
34
|
+
send: {
|
|
35
|
+
type: 'query',
|
|
36
|
+
property: 'maxDepth',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Response Format',
|
|
42
|
+
name: 'responseFormat',
|
|
43
|
+
type: 'options',
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'JSON (Structured)',
|
|
47
|
+
value: 'json',
|
|
48
|
+
description: 'Returns structured block data with IDs and properties',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Markdown (Text)',
|
|
52
|
+
value: 'markdown',
|
|
53
|
+
description: 'Returns rendered markdown content',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'json',
|
|
57
|
+
description: 'Format of the response',
|
|
58
|
+
displayOptions: { show: showOnlyForBlockGet },
|
|
59
|
+
routing: {
|
|
60
|
+
request: {
|
|
61
|
+
headers: {
|
|
62
|
+
Accept: '={{ $value === "markdown" ? "text/markdown" : "application/json" }}',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Additional Options',
|
|
69
|
+
name: 'additionalOptions',
|
|
70
|
+
type: 'collection',
|
|
71
|
+
placeholder: 'Add Option',
|
|
72
|
+
default: {},
|
|
73
|
+
displayOptions: { show: showOnlyForBlockGet },
|
|
74
|
+
options: [
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Fetch Metadata',
|
|
77
|
+
name: 'fetchMetadata',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
default: false,
|
|
80
|
+
description: 'Whether to include metadata (comments, timestamps, authors) for the blocks',
|
|
81
|
+
routing: {
|
|
82
|
+
send: {
|
|
83
|
+
type: 'query',
|
|
84
|
+
property: 'fetchMetadata',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../nodes/CraftDocuments/resources/block/get.ts"],"names":[],"mappings":";;;AAQA,MAAM,mBAAmB,GAAG,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAE3D,QAAA,mBAAmB,GAAsB;IAErD;QACC,WAAW,EAAE,sBAAsB;QACnC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,oGAAoG;QACjH,cAAc,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;QAC7C,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI;aACd;SACD;KACD;IAGD;QACC,W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