n8n-nodes-pnpjs-sp 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.
@@ -0,0 +1,1064 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PnPJs = void 0;
37
+ const GenericFunctions_1 = require("./GenericFunctions");
38
+ const attachments_1 = require("./handlers/attachments");
39
+ const comments_1 = require("./handlers/comments");
40
+ const security_1 = require("./handlers/security");
41
+ const sharing_1 = require("./handlers/sharing");
42
+ const profilesSocial_1 = require("./handlers/profilesSocial");
43
+ const advanced_1 = require("./handlers/advanced");
44
+ const resourceOptions = [
45
+ { name: 'Web', value: 'web' },
46
+ { name: 'List', value: 'list' },
47
+ { name: 'List Item', value: 'listItem' },
48
+ { name: 'File', value: 'file' },
49
+ { name: 'Folder', value: 'folder' },
50
+ { name: 'User', value: 'user' },
51
+ { name: 'Group', value: 'group' },
52
+ { name: 'Site', value: 'site' },
53
+ { name: 'Attachment', value: 'attachment' },
54
+ { name: 'Comment', value: 'comment' },
55
+ { name: 'Search', value: 'search' },
56
+ { name: 'Content Type', value: 'contentType' },
57
+ { name: 'Navigation', value: 'navigation' },
58
+ { name: 'Security', value: 'security' },
59
+ { name: 'Sharing', value: 'sharing' },
60
+ { name: 'Profile', value: 'profile' },
61
+ { name: 'Features', value: 'features' },
62
+ { name: 'Recycle Bin', value: 'recycleBin' },
63
+ { name: 'Hub Sites', value: 'hubsites' },
64
+ { name: 'Subscriptions', value: 'subscriptions' },
65
+ { name: 'User Custom Actions', value: 'userCustomActions' },
66
+ { name: 'Fields', value: 'fields' },
67
+ { name: 'Forms', value: 'forms' },
68
+ { name: 'Related Items', value: 'relatedItems' },
69
+ { name: 'Column Defaults', value: 'columnDefaults' },
70
+ { name: 'Regional Settings', value: 'regionalSettings' },
71
+ { name: 'Utility', value: 'utility' },
72
+ ];
73
+ class PnPJs {
74
+ constructor() {
75
+ this.description = {
76
+ displayName: 'PnPJS SharePoint',
77
+ name: 'pnpJs',
78
+ icon: 'fa:share-alt',
79
+ group: ['transform'],
80
+ version: 1,
81
+ subtitle: '={{ $parameter["resource"] + " - " + $parameter["operation"] }}',
82
+ description: 'Access SharePoint via PnPJS - all SP modules',
83
+ defaults: {
84
+ name: 'PnPJS SharePoint',
85
+ },
86
+ inputs: ['main'],
87
+ outputs: ['main'],
88
+ credentials: [
89
+ {
90
+ name: 'pnpJsApi',
91
+ required: true,
92
+ },
93
+ ],
94
+ properties: [
95
+ {
96
+ displayName: 'Resource',
97
+ name: 'resource',
98
+ type: 'options',
99
+ noDataExpression: true,
100
+ options: resourceOptions,
101
+ default: 'list',
102
+ },
103
+ {
104
+ displayName: 'Operation',
105
+ name: 'operation',
106
+ type: 'options',
107
+ noDataExpression: true,
108
+ displayOptions: { show: { resource: ['web'] } },
109
+ options: [
110
+ { name: 'Get', value: 'get', action: 'Get web', description: 'Get web properties' },
111
+ { name: 'Update', value: 'update', action: 'Update web', description: 'Update web properties' },
112
+ { name: 'Get Subwebs', value: 'getSubwebs', action: 'Get subwebs', description: 'Get all subwebs' },
113
+ ],
114
+ default: 'get',
115
+ },
116
+ {
117
+ displayName: 'Operation',
118
+ name: 'operation',
119
+ type: 'options',
120
+ noDataExpression: true,
121
+ displayOptions: { show: { resource: ['list'] } },
122
+ options: [
123
+ { name: 'Get All', value: 'getAll', action: 'Get all lists', description: 'Get all lists' },
124
+ { name: 'Get', value: 'get', action: 'Get a list', description: 'Get a list by title or ID' },
125
+ { name: 'Create', value: 'create', action: 'Create a list', description: 'Create a new list' },
126
+ { name: 'Update', value: 'update', action: 'Update a list', description: 'Update list properties' },
127
+ { name: 'Delete', value: 'delete', action: 'Delete a list', description: 'Delete a list' },
128
+ { name: 'Get Fields', value: 'getFields', action: 'Get list fields', description: 'Get list fields' },
129
+ { name: 'Get Views', value: 'getViews', action: 'Get list views', description: 'Get list views' },
130
+ ],
131
+ default: 'getAll',
132
+ },
133
+ {
134
+ displayName: 'Operation',
135
+ name: 'operation',
136
+ type: 'options',
137
+ noDataExpression: true,
138
+ displayOptions: { show: { resource: ['listItem'] } },
139
+ options: [
140
+ { name: 'Get All', value: 'getAll', action: 'Get all list items', description: 'Get all list items' },
141
+ { name: 'Get', value: 'get', action: 'Get a list item', description: 'Get a list item by ID' },
142
+ { name: 'Create', value: 'create', action: 'Create a list item', description: 'Create a new list item' },
143
+ { name: 'Update', value: 'update', action: 'Update a list item', description: 'Update a list item' },
144
+ { name: 'Delete', value: 'delete', action: 'Delete a list item', description: 'Delete a list item' },
145
+ { name: 'Get Attachments', value: 'getAttachments', action: 'Get item attachments', description: 'Get item attachments' },
146
+ { name: 'Like', value: 'like', action: 'Like item', description: 'Like a list item' },
147
+ { name: 'Unlike', value: 'unlike', action: 'Unlike item', description: 'Unlike a list item' },
148
+ { name: 'Rate', value: 'rate', action: 'Rate item', description: 'Rate an item (1-5)' },
149
+ ],
150
+ default: 'getAll',
151
+ },
152
+ {
153
+ displayName: 'Operation',
154
+ name: 'operation',
155
+ type: 'options',
156
+ noDataExpression: true,
157
+ displayOptions: { show: { resource: ['file'] } },
158
+ options: [
159
+ { name: 'Get All', value: 'getAll', action: 'Get all files', description: 'Get files in a folder' },
160
+ { name: 'Get', value: 'get', action: 'Get a file', description: 'Get file metadata' },
161
+ { name: 'Upload', value: 'upload', action: 'Upload a file', description: 'Upload a file' },
162
+ { name: 'Delete', value: 'delete', action: 'Delete a file', description: 'Delete a file' },
163
+ { name: 'Get Content', value: 'getContent', action: 'Get file content', description: 'Get file binary content' },
164
+ ],
165
+ default: 'getAll',
166
+ },
167
+ {
168
+ displayName: 'Operation',
169
+ name: 'operation',
170
+ type: 'options',
171
+ noDataExpression: true,
172
+ displayOptions: { show: { resource: ['folder'] } },
173
+ options: [
174
+ { name: 'Get All', value: 'getAll', action: 'Get all folders', description: 'Get folders in a folder' },
175
+ { name: 'Get', value: 'get', action: 'Get a folder', description: 'Get folder by server relative URL' },
176
+ { name: 'Create', value: 'create', action: 'Create a folder', description: 'Create a new folder' },
177
+ { name: 'Delete', value: 'delete', action: 'Delete a folder', description: 'Delete a folder' },
178
+ ],
179
+ default: 'getAll',
180
+ },
181
+ {
182
+ displayName: 'Operation',
183
+ name: 'operation',
184
+ type: 'options',
185
+ noDataExpression: true,
186
+ displayOptions: { show: { resource: ['user'] } },
187
+ options: [
188
+ { name: 'Get All', value: 'getAll', action: 'Get all users', description: 'Get all site users' },
189
+ { name: 'Get', value: 'get', action: 'Get a user', description: 'Get user by ID' },
190
+ { name: 'Get By Email', value: 'getByEmail', action: 'Get user by email', description: 'Get user by email' },
191
+ { name: 'Add', value: 'add', action: 'Add a user', description: 'Add a user to the site' },
192
+ { name: 'Remove', value: 'remove', action: 'Remove a user', description: 'Remove a user from the site' },
193
+ { name: 'Get Current', value: 'getCurrent', action: 'Get current user', description: 'Get the current user' },
194
+ ],
195
+ default: 'getAll',
196
+ },
197
+ {
198
+ displayName: 'Operation',
199
+ name: 'operation',
200
+ type: 'options',
201
+ noDataExpression: true,
202
+ displayOptions: { show: { resource: ['group'] } },
203
+ options: [
204
+ { name: 'Get All', value: 'getAll', action: 'Get all groups', description: 'Get all site groups' },
205
+ { name: 'Get', value: 'get', action: 'Get a group', description: 'Get group by ID' },
206
+ { name: 'Add User', value: 'addUser', action: 'Add user to group', description: 'Add user to group' },
207
+ { name: 'Remove User', value: 'removeUser', action: 'Remove user from group', description: 'Remove user from group' },
208
+ ],
209
+ default: 'getAll',
210
+ },
211
+ {
212
+ displayName: 'Operation',
213
+ name: 'operation',
214
+ type: 'options',
215
+ noDataExpression: true,
216
+ displayOptions: { show: { resource: ['site'] } },
217
+ options: [
218
+ { name: 'Get', value: 'get', action: 'Get site', description: 'Get site collection properties' },
219
+ { name: 'Get Site Info', value: 'getSiteInfo', action: 'Get site info', description: 'Get site collection info' },
220
+ ],
221
+ default: 'get',
222
+ },
223
+ {
224
+ displayName: 'Operation',
225
+ name: 'operation',
226
+ type: 'options',
227
+ noDataExpression: true,
228
+ displayOptions: { show: { resource: ['search'] } },
229
+ options: [
230
+ { name: 'Query', value: 'query', action: 'Execute search query', description: 'Execute a search query' },
231
+ ],
232
+ default: 'query',
233
+ },
234
+ {
235
+ displayName: 'Operation',
236
+ name: 'operation',
237
+ type: 'options',
238
+ noDataExpression: true,
239
+ displayOptions: { show: { resource: ['contentType'] } },
240
+ options: [
241
+ { name: 'Get All', value: 'getAll', action: 'Get all content types', description: 'Get all content types' },
242
+ { name: 'Get', value: 'get', action: 'Get a content type', description: 'Get a content type by ID' },
243
+ ],
244
+ default: 'getAll',
245
+ },
246
+ {
247
+ displayName: 'Operation',
248
+ name: 'operation',
249
+ type: 'options',
250
+ noDataExpression: true,
251
+ displayOptions: { show: { resource: ['navigation'] } },
252
+ options: [
253
+ { name: 'Get', value: 'get', action: 'Get navigation', description: 'Get navigation nodes' },
254
+ ],
255
+ default: 'get',
256
+ },
257
+ ...attachments_1.attachmentsProperties,
258
+ ...comments_1.commentsProperties,
259
+ ...security_1.securityProperties,
260
+ ...sharing_1.sharingProperties,
261
+ ...profilesSocial_1.profilesSocialProperties,
262
+ ...advanced_1.advancedProperties,
263
+ {
264
+ displayName: 'List Identifier',
265
+ name: 'listIdentifier',
266
+ type: 'string',
267
+ default: '',
268
+ required: true,
269
+ placeholder: 'e.g. "My List" or list GUID',
270
+ displayOptions: {
271
+ show: {
272
+ resource: ['list'],
273
+ operation: ['get', 'update', 'delete', 'getFields', 'getViews'],
274
+ },
275
+ },
276
+ description: 'List title or GUID',
277
+ },
278
+ {
279
+ displayName: 'List Identifier',
280
+ name: 'listIdentifier',
281
+ type: 'string',
282
+ default: '',
283
+ required: true,
284
+ placeholder: 'e.g. "My List" or list GUID',
285
+ displayOptions: {
286
+ show: {
287
+ resource: ['listItem', 'contentType'],
288
+ operation: ['get', 'update', 'delete', 'getAll', 'create', 'getAttachments', 'like', 'unlike', 'rate'],
289
+ },
290
+ },
291
+ description: 'List title or GUID',
292
+ },
293
+ {
294
+ displayName: 'Item ID',
295
+ name: 'itemId',
296
+ type: 'number',
297
+ default: 0,
298
+ required: true,
299
+ displayOptions: { show: { resource: ['listItem'], operation: ['get', 'update', 'delete', 'getAttachments', 'like', 'unlike', 'rate'] } },
300
+ description: 'ID of the list item',
301
+ },
302
+ {
303
+ displayName: 'Rating Value (1-5)',
304
+ name: 'ratingValue',
305
+ type: 'number',
306
+ default: 3,
307
+ displayOptions: { show: { resource: ['listItem'], operation: ['rate'] } },
308
+ description: 'Rating value between 1 and 5',
309
+ },
310
+ {
311
+ displayName: 'Fields (JSON)',
312
+ name: 'fieldsJson',
313
+ type: 'string',
314
+ default: '{}',
315
+ required: true,
316
+ displayOptions: { show: { resource: ['listItem'], operation: ['create', 'update'] } },
317
+ description: 'JSON object of field name/value pairs. Example: {"Title": "New Item", "Status": "Active"}',
318
+ },
319
+ {
320
+ displayName: 'Web Properties to Update (JSON)',
321
+ name: 'webUpdateJson',
322
+ type: 'string',
323
+ default: '{}',
324
+ required: true,
325
+ displayOptions: { show: { resource: ['web'], operation: ['update'] } },
326
+ description: 'JSON object of web properties to update. Example: {"Title": "New Title"}',
327
+ },
328
+ {
329
+ displayName: 'List Title',
330
+ name: 'listTitle',
331
+ type: 'string',
332
+ default: '',
333
+ required: true,
334
+ displayOptions: { show: { resource: ['list'], operation: ['create'] } },
335
+ description: 'Title of the new list',
336
+ },
337
+ {
338
+ displayName: 'Template Type',
339
+ name: 'templateType',
340
+ type: 'options',
341
+ displayOptions: { show: { resource: ['list'], operation: ['create'] } },
342
+ options: [
343
+ { name: 'Custom List', value: 100 },
344
+ { name: 'Document Library', value: 101 },
345
+ { name: 'Links', value: 103 },
346
+ { name: 'Announcements', value: 104 },
347
+ { name: 'Contacts', value: 105 },
348
+ { name: 'Tasks', value: 107 },
349
+ { name: 'Discussion Board', value: 108 },
350
+ { name: 'Calendar', value: 106 },
351
+ { name: 'Survey', value: 102 },
352
+ { name: 'Issue Tracking', value: 1100 },
353
+ ],
354
+ default: 100,
355
+ },
356
+ {
357
+ displayName: 'List Description',
358
+ name: 'listDescription',
359
+ type: 'string',
360
+ default: '',
361
+ displayOptions: { show: { resource: ['list'], operation: ['create', 'update'] } },
362
+ description: 'Description of the list',
363
+ },
364
+ {
365
+ displayName: 'List Properties to Update (JSON)',
366
+ name: 'listUpdateJson',
367
+ type: 'string',
368
+ default: '{}',
369
+ required: true,
370
+ displayOptions: { show: { resource: ['list'], operation: ['update'] } },
371
+ description: 'JSON object of list properties to update',
372
+ },
373
+ {
374
+ displayName: 'Folder URL',
375
+ name: 'folderUrl',
376
+ type: 'string',
377
+ default: '',
378
+ required: true,
379
+ placeholder: '/sites/mysite/Shared Documents/Subfolder',
380
+ displayOptions: {
381
+ show: { resource: ['file', 'folder'], operation: ['getAll', 'upload', 'get', 'delete', 'getContent', 'create'] },
382
+ },
383
+ description: 'Server relative URL of the folder. For files, include the filename in the URL.',
384
+ },
385
+ {
386
+ displayName: 'File Name',
387
+ name: 'fileName',
388
+ type: 'string',
389
+ default: '',
390
+ required: true,
391
+ displayOptions: { show: { resource: ['file'], operation: ['upload'] } },
392
+ description: 'Name of the file to upload',
393
+ },
394
+ {
395
+ displayName: 'Binary Property',
396
+ name: 'binaryPropertyName',
397
+ type: 'string',
398
+ default: 'data',
399
+ required: true,
400
+ displayOptions: { show: { resource: ['file'], operation: ['upload'] } },
401
+ description: 'Name of the binary property containing the file data',
402
+ },
403
+ {
404
+ displayName: 'Overwrite',
405
+ name: 'overwrite',
406
+ type: 'boolean',
407
+ default: true,
408
+ displayOptions: { show: { resource: ['file'], operation: ['upload'] } },
409
+ description: 'Overwrite the file if it already exists',
410
+ },
411
+ {
412
+ displayName: 'Binary Property for Output',
413
+ name: 'binaryPropertyOutput',
414
+ type: 'string',
415
+ default: 'data',
416
+ required: true,
417
+ displayOptions: { show: { resource: ['file'], operation: ['getContent'] } },
418
+ description: 'Name of the binary property to store the file content',
419
+ },
420
+ {
421
+ displayName: 'Folder Name',
422
+ name: 'folderName',
423
+ type: 'string',
424
+ default: '',
425
+ required: true,
426
+ displayOptions: { show: { resource: ['folder'], operation: ['create'] } },
427
+ description: 'Name of the new folder',
428
+ },
429
+ {
430
+ displayName: 'User ID',
431
+ name: 'userId',
432
+ type: 'number',
433
+ default: 0,
434
+ required: true,
435
+ displayOptions: { show: { resource: ['user'], operation: ['get', 'remove'] } },
436
+ description: 'ID of the user',
437
+ },
438
+ {
439
+ displayName: 'User Email',
440
+ name: 'userEmail',
441
+ type: 'string',
442
+ default: '',
443
+ required: true,
444
+ displayOptions: { show: { resource: ['user'], operation: ['getByEmail', 'add'] } },
445
+ description: 'Email address of the user',
446
+ },
447
+ {
448
+ displayName: 'User Login Name',
449
+ name: 'userLoginName',
450
+ type: 'string',
451
+ default: '',
452
+ displayOptions: { show: { resource: ['user'], operation: ['add'] } },
453
+ description: 'Login name of the user',
454
+ },
455
+ {
456
+ displayName: 'User Title',
457
+ name: 'userTitle',
458
+ type: 'string',
459
+ default: '',
460
+ displayOptions: { show: { resource: ['user'], operation: ['add'] } },
461
+ description: 'Display name of the user',
462
+ },
463
+ {
464
+ displayName: 'Group ID',
465
+ name: 'groupId',
466
+ type: 'number',
467
+ default: 0,
468
+ required: true,
469
+ displayOptions: { show: { resource: ['group'], operation: ['get', 'addUser', 'removeUser'] } },
470
+ description: 'ID of the group',
471
+ },
472
+ {
473
+ displayName: 'User ID for Group',
474
+ name: 'groupUserId',
475
+ type: 'number',
476
+ default: 0,
477
+ required: true,
478
+ displayOptions: { show: { resource: ['group'], operation: ['addUser', 'removeUser'] } },
479
+ description: 'ID of the user to add/remove',
480
+ },
481
+ {
482
+ displayName: 'Query Text',
483
+ name: 'queryText',
484
+ type: 'string',
485
+ default: '',
486
+ required: true,
487
+ displayOptions: { show: { resource: ['search'], operation: ['query'] } },
488
+ description: 'Search query text (KQL format)',
489
+ },
490
+ {
491
+ displayName: 'Row Limit',
492
+ name: 'rowLimit',
493
+ type: 'number',
494
+ default: 10,
495
+ displayOptions: { show: { resource: ['search'], operation: ['query'] } },
496
+ description: 'Maximum number of results',
497
+ },
498
+ {
499
+ displayName: 'Select Properties',
500
+ name: 'selectProperties',
501
+ type: 'string',
502
+ default: 'Title,Path,Url,Author,LastModifiedTime',
503
+ displayOptions: { show: { resource: ['search'], operation: ['query'] } },
504
+ description: 'Comma-separated list of properties to return',
505
+ },
506
+ {
507
+ displayName: 'Content Type ID',
508
+ name: 'contentTypeId',
509
+ type: 'string',
510
+ default: '',
511
+ required: true,
512
+ displayOptions: { show: { resource: ['contentType'], operation: ['get'] } },
513
+ description: 'ID of the content type',
514
+ },
515
+ {
516
+ displayName: 'Simplify Output',
517
+ name: 'simplify',
518
+ type: 'boolean',
519
+ default: true,
520
+ displayOptions: {
521
+ show: {
522
+ resource: ['web', 'list', 'listItem', 'file', 'folder', 'user', 'group', 'site', 'search', 'contentType', 'navigation'],
523
+ },
524
+ },
525
+ description: 'Whether to simplify the output',
526
+ },
527
+ {
528
+ displayName: 'Options',
529
+ name: 'options',
530
+ type: 'collection',
531
+ placeholder: 'Add Option',
532
+ default: {},
533
+ displayOptions: {
534
+ show: { resource: ['listItem'], operation: ['getAll'] },
535
+ },
536
+ options: [
537
+ {
538
+ displayName: 'Select (columns)',
539
+ name: 'select',
540
+ type: 'string',
541
+ default: '',
542
+ placeholder: 'e.g. Title,Id,Created',
543
+ description: 'Comma-separated list of fields to return',
544
+ },
545
+ {
546
+ displayName: 'Expand',
547
+ name: 'expand',
548
+ type: 'string',
549
+ default: '',
550
+ placeholder: 'e.g. Author,Editor',
551
+ description: 'Comma-separated list of lookup fields to expand',
552
+ },
553
+ {
554
+ displayName: 'Filter',
555
+ name: 'filter',
556
+ type: 'string',
557
+ default: '',
558
+ placeholder: 'e.g. Title eq \'Test\'',
559
+ description: 'OData filter expression',
560
+ },
561
+ {
562
+ displayName: 'Order By',
563
+ name: 'orderBy',
564
+ type: 'string',
565
+ default: '',
566
+ placeholder: 'e.g. Title asc',
567
+ description: 'Order by clause',
568
+ },
569
+ {
570
+ displayName: 'Top',
571
+ name: 'top',
572
+ type: 'number',
573
+ default: 100,
574
+ description: 'Maximum number of items to return',
575
+ },
576
+ ],
577
+ },
578
+ {
579
+ displayName: 'Options',
580
+ name: 'optionsGetAll',
581
+ type: 'collection',
582
+ placeholder: 'Add Option',
583
+ default: {},
584
+ displayOptions: {
585
+ show: { resource: ['list'], operation: ['getAll'] },
586
+ },
587
+ options: [
588
+ {
589
+ displayName: 'Select (columns)',
590
+ name: 'select',
591
+ type: 'string',
592
+ default: '',
593
+ placeholder: 'e.g. Title,Id',
594
+ description: 'Comma-separated list of fields to return',
595
+ },
596
+ {
597
+ displayName: 'Filter',
598
+ name: 'filter',
599
+ type: 'string',
600
+ default: '',
601
+ description: 'OData filter expression',
602
+ },
603
+ ],
604
+ },
605
+ ],
606
+ };
607
+ }
608
+ async execute() {
609
+ const items = this.getInputData();
610
+ const returnData = [];
611
+ for (let i = 0; i < items.length; i++) {
612
+ try {
613
+ const resource = this.getNodeParameter('resource', i);
614
+ const operation = this.getNodeParameter('operation', i);
615
+ const simplify = this.getNodeParameter('simplify', i, true);
616
+ let responseData;
617
+ // Route to handler modules for specific resources
618
+ if (resource === 'attachment') {
619
+ responseData = await attachments_1.handleAttachment.call(this, operation, i, simplify);
620
+ }
621
+ else if (resource === 'comment') {
622
+ responseData = await comments_1.handleComment.call(this, operation, i, simplify);
623
+ }
624
+ else if (resource === 'security') {
625
+ responseData = await security_1.handleSecurity.call(this, operation, i, simplify);
626
+ }
627
+ else if (resource === 'sharing') {
628
+ responseData = await sharing_1.handleSharing.call(this, operation, i, simplify);
629
+ }
630
+ else if (resource === 'profile') {
631
+ responseData = await profilesSocial_1.handleProfile.call(this, operation, i, simplify);
632
+ }
633
+ else if (['features', 'recycleBin', 'hubsites', 'subscriptions', 'userCustomActions', 'fields', 'forms', 'relatedItems', 'columnDefaults', 'regionalSettings', 'utility'].includes(resource)) {
634
+ responseData = await advanced_1.handleAdvanced.call(this, resource, operation, i, simplify);
635
+ }
636
+ else if (resource === 'web') {
637
+ if (operation === 'get') {
638
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', '/web?$select=Id,Title,Description,Url,ServerRelativeUrl,Created,LastItemModifiedDate,Language');
639
+ if (simplify)
640
+ responseData = [responseData];
641
+ }
642
+ else if (operation === 'update') {
643
+ const updateJson = this.getNodeParameter('webUpdateJson', i);
644
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'MERGE', '/web', JSON.parse(updateJson));
645
+ responseData = { success: true, message: 'Web updated' };
646
+ }
647
+ else if (operation === 'getSubwebs') {
648
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', '/web/webs?$select=Title,Url,ServerRelativeUrl,Description,Created');
649
+ if (!simplify)
650
+ responseData = { results: responseData };
651
+ }
652
+ else {
653
+ throw new Error(`Operation "${operation}" not supported for web`);
654
+ }
655
+ }
656
+ else if (resource === 'list') {
657
+ if (operation === 'getAll') {
658
+ const options = this.getNodeParameter('optionsGetAll', i, {});
659
+ const opts = options;
660
+ let endpoint = '/web/lists?$select=Id,Title,Created,ItemCount,BaseTemplate,Description,LastItemModifiedDate,ParentWebUrl,RootFolder';
661
+ if (opts.select)
662
+ endpoint = `/web/lists?$select=${opts.select}`;
663
+ const qs = {};
664
+ if (opts.filter)
665
+ qs.$filter = opts.filter;
666
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', endpoint, undefined, qs);
667
+ if (!simplify)
668
+ responseData = { results: responseData };
669
+ }
670
+ else if (operation === 'get') {
671
+ const listId = this.getNodeParameter('listIdentifier', i);
672
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `${(0, GenericFunctions_1.buildListEndpoint)(listId)}?$select=Id,Title,Description,ItemCount,BaseTemplate,Created,LastItemModifiedDate,RootFolder`);
673
+ if (simplify)
674
+ responseData = [responseData];
675
+ }
676
+ else if (operation === 'create') {
677
+ const title = this.getNodeParameter('listTitle', i);
678
+ const templateType = this.getNodeParameter('templateType', i);
679
+ const description = this.getNodeParameter('listDescription', i, '');
680
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', '/web/lists', { Title: title, BaseTemplate: templateType, Description: description });
681
+ if (simplify)
682
+ responseData = [responseData];
683
+ }
684
+ else if (operation === 'update') {
685
+ const listId = this.getNodeParameter('listIdentifier', i);
686
+ const updateJson = this.getNodeParameter('listUpdateJson', i);
687
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'MERGE', (0, GenericFunctions_1.buildListEndpoint)(listId), JSON.parse(updateJson));
688
+ responseData = { success: true, message: 'List updated' };
689
+ }
690
+ else if (operation === 'delete') {
691
+ const listId = this.getNodeParameter('listIdentifier', i);
692
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', (0, GenericFunctions_1.buildListEndpoint)(listId));
693
+ responseData = { success: true, message: 'List deleted' };
694
+ }
695
+ else if (operation === 'getFields') {
696
+ const listId = this.getNodeParameter('listIdentifier', i);
697
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `${(0, GenericFunctions_1.buildListEndpoint)(listId)}/fields?$select=Title,InternalName,TypeDisplayName,Required,Hidden,FieldTypeKind`);
698
+ if (!simplify)
699
+ responseData = { results: responseData };
700
+ }
701
+ else if (operation === 'getViews') {
702
+ const listId = this.getNodeParameter('listIdentifier', i);
703
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `${(0, GenericFunctions_1.buildListEndpoint)(listId)}/views?$select=Title,Id,DefaultView,PersonalView,ViewType`);
704
+ if (!simplify)
705
+ responseData = { results: responseData };
706
+ }
707
+ else {
708
+ throw new Error(`Operation "${operation}" not supported for list`);
709
+ }
710
+ }
711
+ else if (resource === 'listItem') {
712
+ const listId = this.getNodeParameter('listIdentifier', i);
713
+ const listEndpoint = (0, GenericFunctions_1.buildListEndpoint)(listId);
714
+ if (operation === 'getAll') {
715
+ const options = this.getNodeParameter('options', i, {});
716
+ const qs = {};
717
+ const opts = options;
718
+ if (opts.expand)
719
+ qs.$expand = opts.expand;
720
+ if (opts.filter)
721
+ qs.$filter = opts.filter;
722
+ if (opts.orderBy)
723
+ qs.$orderby = opts.orderBy;
724
+ if (opts.top) {
725
+ const parts = [];
726
+ if (opts.select)
727
+ parts.push(`$select=${opts.select}`);
728
+ if (qs.$expand)
729
+ parts.push(`$expand=${qs.$expand}`);
730
+ if (qs.$filter)
731
+ parts.push(`$filter=${qs.$filter}`);
732
+ if (qs.$orderby)
733
+ parts.push(`$orderby=${qs.$orderby}`);
734
+ parts.push(`$top=${opts.top}`);
735
+ const resp = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `${listEndpoint}/items?${parts.join('&')}`);
736
+ const rd = resp;
737
+ responseData = rd.results || [resp];
738
+ }
739
+ else {
740
+ const parts = [];
741
+ if (opts.select)
742
+ parts.push(`$select=${opts.select}`);
743
+ if (qs.$expand)
744
+ parts.push(`$expand=${qs.$expand}`);
745
+ if (qs.$filter)
746
+ parts.push(`$filter=${qs.$filter}`);
747
+ if (qs.$orderby)
748
+ parts.push(`$orderby=${qs.$orderby}`);
749
+ const qStr = parts.length > 0 ? `?${parts.join('&')}` : '';
750
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `${listEndpoint}/items${qStr}`, undefined, qs);
751
+ }
752
+ }
753
+ else if (operation === 'get') {
754
+ const itemId = this.getNodeParameter('itemId', i);
755
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `${listEndpoint}/items(${itemId})`);
756
+ responseData = [responseData];
757
+ }
758
+ else if (operation === 'create') {
759
+ const fields = JSON.parse(this.getNodeParameter('fieldsJson', i));
760
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `${listEndpoint}/items`, fields);
761
+ responseData = [responseData];
762
+ }
763
+ else if (operation === 'update') {
764
+ const itemId = this.getNodeParameter('itemId', i);
765
+ const fields = JSON.parse(this.getNodeParameter('fieldsJson', i));
766
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'MERGE', `${listEndpoint}/items(${itemId})`, fields);
767
+ responseData = { success: true, message: `Item ${itemId} updated` };
768
+ }
769
+ else if (operation === 'delete') {
770
+ const itemId = this.getNodeParameter('itemId', i);
771
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', `${listEndpoint}/items(${itemId})`);
772
+ responseData = { success: true, message: `Item ${itemId} deleted` };
773
+ }
774
+ else if (operation === 'getAttachments') {
775
+ const itemId = this.getNodeParameter('itemId', i);
776
+ const resp = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `${listEndpoint}/items(${itemId})/AttachmentFiles`);
777
+ responseData = resp;
778
+ }
779
+ else if (operation === 'like') {
780
+ const itemId = this.getNodeParameter('itemId', i);
781
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `${listEndpoint}/items(${itemId})/like`);
782
+ responseData = { success: true, message: `Item ${itemId} liked` };
783
+ }
784
+ else if (operation === 'unlike') {
785
+ const itemId = this.getNodeParameter('itemId', i);
786
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `${listEndpoint}/items(${itemId})/unlike`);
787
+ responseData = { success: true, message: `Item ${itemId} unliked` };
788
+ }
789
+ else if (operation === 'rate') {
790
+ const itemId = this.getNodeParameter('itemId', i);
791
+ const ratingValue = this.getNodeParameter('ratingValue', i, 3);
792
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `${listEndpoint}/items(${itemId})/rate`, { rating: ratingValue });
793
+ responseData = { success: true, message: `Item ${itemId} rated ${ratingValue}/5` };
794
+ }
795
+ else {
796
+ throw new Error(`Operation "${operation}" not supported for listItem`);
797
+ }
798
+ }
799
+ else if (resource === 'file') {
800
+ if (operation === 'getAll') {
801
+ const folderUrl = this.getNodeParameter('folderUrl', i);
802
+ const encoded = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
803
+ const files = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `/web/getFolderByServerRelativeUrl('${encoded}')/files?$select=Name,ServerRelativeUrl,TimeCreated,TimeLastModified,Length,Title`);
804
+ responseData = files.map((f) => ({
805
+ Name: f.Name, ServerRelativeUrl: f.ServerRelativeUrl, TimeCreated: f.TimeCreated,
806
+ TimeLastModified: f.TimeLastModified, Length: f.Length, Title: f.Title,
807
+ }));
808
+ }
809
+ else if (operation === 'get') {
810
+ const fileUrl = this.getNodeParameter('folderUrl', i);
811
+ const encoded = fileUrl.split('/').map(s => encodeURIComponent(s)).join('/');
812
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/getFileByServerRelativeUrl('${encoded}')`);
813
+ responseData = [responseData];
814
+ }
815
+ else if (operation === 'upload') {
816
+ const folderUrl = this.getNodeParameter('folderUrl', i);
817
+ const fileName = this.getNodeParameter('fileName', i);
818
+ const binaryProperty = this.getNodeParameter('binaryPropertyName', i);
819
+ const overwrite = this.getNodeParameter('overwrite', i);
820
+ const binaryData = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
821
+ if (!binaryData)
822
+ throw new Error('Binary data not found');
823
+ const credentials = await this.getCredentials('pnpJsApi');
824
+ const siteUrl = credentials.siteUrl.replace(/\/+$/, '');
825
+ const { getSharePointAccessToken, getFormDigest } = await Promise.resolve().then(() => __importStar(require('./GenericFunctions')));
826
+ const accessToken = await getSharePointAccessToken.call(this);
827
+ const digest = await getFormDigest.call(this, siteUrl, accessToken);
828
+ const cleanFolder = folderUrl.replace(/\/+$/, '');
829
+ const encodedFolder = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
830
+ await this.helpers.httpRequest({
831
+ method: 'POST',
832
+ url: `${siteUrl}/_api/web/getFolderByServerRelativeUrl('${encodedFolder}')/files/add(url='${fileName}',overwrite=${overwrite})`,
833
+ headers: { Authorization: `Bearer ${accessToken}`, 'X-RequestDigest': digest },
834
+ body: binaryData,
835
+ json: false,
836
+ });
837
+ responseData = [{ Name: fileName, ServerRelativeUrl: `${cleanFolder}/${fileName}`, Status: 'Uploaded' }];
838
+ }
839
+ else if (operation === 'delete') {
840
+ const fileUrl = this.getNodeParameter('folderUrl', i);
841
+ const encoded = fileUrl.split('/').map(s => encodeURIComponent(s)).join('/');
842
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', `/web/getFileByServerRelativeUrl('${encoded}')`);
843
+ responseData = { success: true, message: 'File deleted' };
844
+ }
845
+ else if (operation === 'getContent') {
846
+ const fileUrl = this.getNodeParameter('folderUrl', i);
847
+ const binaryOutput = this.getNodeParameter('binaryPropertyOutput', i);
848
+ const encoded = fileUrl.split('/').map(s => encodeURIComponent(s)).join('/');
849
+ const credentials = await this.getCredentials('pnpJsApi');
850
+ const siteUrl = credentials.siteUrl.replace(/\/+$/, '');
851
+ const { getSharePointAccessToken } = await Promise.resolve().then(() => __importStar(require('./GenericFunctions')));
852
+ const accessToken = await getSharePointAccessToken.call(this);
853
+ const response = await this.helpers.httpRequest({
854
+ method: 'GET',
855
+ url: `${siteUrl}/_api/web/getFileByServerRelativeUrl('${encoded}')/$value`,
856
+ headers: { Authorization: `Bearer ${accessToken}` },
857
+ json: false,
858
+ });
859
+ const fileName = fileUrl.split('/').pop() || 'file';
860
+ const newItem = { json: { Name: fileName, ServerRelativeUrl: fileUrl }, binary: {} };
861
+ newItem.binary[binaryOutput] = await this.helpers.prepareBinaryData(Buffer.from(response), fileName);
862
+ returnData.push(newItem);
863
+ continue;
864
+ }
865
+ else {
866
+ throw new Error(`Operation "${operation}" not supported for file`);
867
+ }
868
+ }
869
+ else if (resource === 'folder') {
870
+ if (operation === 'getAll') {
871
+ const folderUrl = this.getNodeParameter('folderUrl', i);
872
+ const encoded = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
873
+ const folders = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', `/web/getFolderByServerRelativeUrl('${encoded}')/folders?$select=Name,ServerRelativeUrl,TimeCreated,ItemCount`);
874
+ responseData = folders.map((f) => ({
875
+ Name: f.Name, ServerRelativeUrl: f.ServerRelativeUrl, TimeCreated: f.TimeCreated, ItemCount: f.ItemCount,
876
+ }));
877
+ }
878
+ else if (operation === 'get') {
879
+ const folderUrl = this.getNodeParameter('folderUrl', i);
880
+ const encoded = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
881
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/getFolderByServerRelativeUrl('${encoded}')?$select=Name,ServerRelativeUrl,TimeCreated,ItemCount`);
882
+ responseData = [responseData];
883
+ }
884
+ else if (operation === 'create') {
885
+ const folderUrl = this.getNodeParameter('folderUrl', i);
886
+ const folderName = this.getNodeParameter('folderName', i);
887
+ const encoded = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
888
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `/web/getFolderByServerRelativeUrl('${encoded}')/folders`, { ServerRelativeUrl: folderName });
889
+ responseData = [responseData];
890
+ }
891
+ else if (operation === 'delete') {
892
+ const folderUrl = this.getNodeParameter('folderUrl', i);
893
+ const encoded = folderUrl.split('/').map(s => encodeURIComponent(s)).join('/');
894
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', `/web/getFolderByServerRelativeUrl('${encoded}')`);
895
+ responseData = { success: true, message: 'Folder deleted' };
896
+ }
897
+ else {
898
+ throw new Error(`Operation "${operation}" not supported for folder`);
899
+ }
900
+ }
901
+ else if (resource === 'user') {
902
+ if (operation === 'getAll') {
903
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', '/web/siteusers?$select=Id,Title,Email,LoginName,IsSiteAdmin');
904
+ if (!simplify)
905
+ responseData = { results: responseData };
906
+ }
907
+ else if (operation === 'get') {
908
+ const userId = this.getNodeParameter('userId', i);
909
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/siteusers(${userId})`);
910
+ if (simplify)
911
+ responseData = [responseData];
912
+ }
913
+ else if (operation === 'getByEmail') {
914
+ const email = this.getNodeParameter('userEmail', i);
915
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/siteusers/@v?$filter=Email eq '${email}'`);
916
+ if (simplify) {
917
+ const rd = responseData;
918
+ responseData = rd.results || [responseData];
919
+ }
920
+ }
921
+ else if (operation === 'getCurrent') {
922
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', '/web/currentuser?$select=Id,Title,Email,LoginName,IsSiteAdmin');
923
+ if (simplify)
924
+ responseData = [responseData];
925
+ }
926
+ else if (operation === 'add') {
927
+ const email = this.getNodeParameter('userEmail', i);
928
+ const loginName = this.getNodeParameter('userLoginName', i, '');
929
+ const title = this.getNodeParameter('userTitle', i, '');
930
+ const body = { Email: email };
931
+ if (loginName)
932
+ body.LoginName = loginName;
933
+ if (title)
934
+ body.Title = title;
935
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', '/web/siteusers', body);
936
+ if (simplify)
937
+ responseData = [responseData];
938
+ }
939
+ else if (operation === 'remove') {
940
+ const userId = this.getNodeParameter('userId', i);
941
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', `/web/siteusers(${userId})`);
942
+ responseData = { success: true, message: `User ${userId} removed` };
943
+ }
944
+ else {
945
+ throw new Error(`Operation "${operation}" not supported for user`);
946
+ }
947
+ }
948
+ else if (resource === 'group') {
949
+ if (operation === 'getAll') {
950
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', '/web/sitegroups?$select=Id,Title,Description,OwnerTitle,CanCurrentUserEditMembership');
951
+ if (!simplify)
952
+ responseData = { results: responseData };
953
+ }
954
+ else if (operation === 'get') {
955
+ const groupId = this.getNodeParameter('groupId', i);
956
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/sitegroups(${groupId})?$select=Id,Title,Description,OwnerTitle,CanCurrentUserEditMembership`);
957
+ if (simplify)
958
+ responseData = [responseData];
959
+ }
960
+ else if (operation === 'addUser') {
961
+ const groupId = this.getNodeParameter('groupId', i);
962
+ const userId = this.getNodeParameter('groupUserId', i);
963
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', `/web/sitegroups(${groupId})/users`, { Id: userId });
964
+ responseData = { success: true, message: `User ${userId} added to group ${groupId}` };
965
+ }
966
+ else if (operation === 'removeUser') {
967
+ const groupId = this.getNodeParameter('groupId', i);
968
+ const userId = this.getNodeParameter('groupUserId', i);
969
+ await GenericFunctions_1.sharePointApiRequest.call(this, 'DELETE', `/web/sitegroups(${groupId})/users/removebyid(${userId})`);
970
+ responseData = { success: true, message: `User ${userId} removed from group ${groupId}` };
971
+ }
972
+ else {
973
+ throw new Error(`Operation "${operation}" not supported for group`);
974
+ }
975
+ }
976
+ else if (resource === 'site') {
977
+ if (operation === 'get' || operation === 'getSiteInfo') {
978
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', '/site?$select=Id,Url,ServerRelativeUrl,Title,Description,Created,Classification,GroupId,HubSiteId');
979
+ if (simplify)
980
+ responseData = [responseData];
981
+ }
982
+ else {
983
+ throw new Error(`Operation "${operation}" not supported for site`);
984
+ }
985
+ }
986
+ else if (resource === 'search') {
987
+ if (operation === 'query') {
988
+ const queryText = this.getNodeParameter('queryText', i);
989
+ const rowLimit = this.getNodeParameter('rowLimit', i, 10);
990
+ const selectProperties = this.getNodeParameter('selectProperties', i, 'Title,Path,Url,Author,LastModifiedTime');
991
+ const response = await GenericFunctions_1.sharePointApiRequest.call(this, 'POST', '/search/postquery', {
992
+ request: {
993
+ Querytext: queryText,
994
+ RowLimit: rowLimit,
995
+ SelectProperties: { results: selectProperties.split(',').map(s => s.trim()) },
996
+ },
997
+ });
998
+ const respData = response;
999
+ const primary = respData.query?.PrimaryQueryResult;
1000
+ const relevant = primary?.RelevantResults;
1001
+ const table = relevant?.Table;
1002
+ const rows = table?.Rows;
1003
+ responseData = rows ? rows.map((row) => {
1004
+ const cells = row.Cells || [];
1005
+ const result = {};
1006
+ for (const cell of cells)
1007
+ result[cell.Key] = cell.Value;
1008
+ return result;
1009
+ }) : [];
1010
+ }
1011
+ else {
1012
+ throw new Error(`Operation "${operation}" not supported for search`);
1013
+ }
1014
+ }
1015
+ else if (resource === 'contentType') {
1016
+ if (operation === 'getAll') {
1017
+ const listId = this.getNodeParameter('listIdentifier', i, '');
1018
+ const endpoint = listId
1019
+ ? `${(0, GenericFunctions_1.buildListEndpoint)(listId)}/contenttypes?$select=Id,Name,Description,Group,ClientFormCustomFormatter`
1020
+ : '/web/contenttypes?$select=Id,Name,Description,Group,ClientFormCustomFormatter';
1021
+ responseData = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', endpoint);
1022
+ if (!simplify)
1023
+ responseData = { results: responseData };
1024
+ }
1025
+ else if (operation === 'get') {
1026
+ const ctId = this.getNodeParameter('contentTypeId', i);
1027
+ responseData = await GenericFunctions_1.sharePointApiRequest.call(this, 'GET', `/web/contenttypes('${ctId}')?$select=Id,Name,Description,Group,ClientFormCustomFormatter`);
1028
+ if (simplify)
1029
+ responseData = [responseData];
1030
+ }
1031
+ else {
1032
+ throw new Error(`Operation "${operation}" not supported for content type`);
1033
+ }
1034
+ }
1035
+ else if (resource === 'navigation') {
1036
+ if (operation === 'get') {
1037
+ const quickLaunch = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', '/web/navigation/quicklaunch?$select=Id,Title,Url,IsVisible,Children');
1038
+ const topNav = await GenericFunctions_1.sharePointApiRequestAllItems.call(this, 'GET', '/web/navigation/topnavigationbar?$select=Id,Title,Url,IsVisible,Children');
1039
+ responseData = simplify
1040
+ ? [{ Source: 'QuickLaunch', Nodes: quickLaunch }, { Source: 'TopNavigationBar', Nodes: topNav }]
1041
+ : { QuickLaunch: quickLaunch, TopNavigationBar: topNav };
1042
+ }
1043
+ else {
1044
+ throw new Error(`Operation "${operation}" not supported for navigation`);
1045
+ }
1046
+ }
1047
+ else {
1048
+ throw new Error(`Resource "${resource}" is not supported`);
1049
+ }
1050
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
1051
+ returnData.push(...executionData);
1052
+ }
1053
+ catch (error) {
1054
+ if (this.continueOnFail()) {
1055
+ returnData.push({ json: { error: error.message } });
1056
+ continue;
1057
+ }
1058
+ throw error;
1059
+ }
1060
+ }
1061
+ return [returnData];
1062
+ }
1063
+ }
1064
+ exports.PnPJs = PnPJs;