@joshuanode/n8n-nodes-cipp 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +13 -0
  2. package/dist/credentials/CippApi.credentials.js +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/nodes/Cipp/{Cipp.node.d.ts → CippApp.node.d.ts} +1 -1
  8. package/dist/nodes/Cipp/CippApp.node.d.ts.map +1 -0
  9. package/dist/nodes/Cipp/{Cipp.node.js → CippApp.node.js} +218 -62
  10. package/dist/nodes/Cipp/CippApp.node.js.map +1 -0
  11. package/dist/nodes/Cipp/cipp.svg +4 -0
  12. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.d.ts.map +1 -1
  13. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.js +1 -2
  14. package/dist/nodes/Cipp/descriptions/ConditionalAccessDescription.js.map +1 -1
  15. package/dist/nodes/Cipp/descriptions/EmailSecurityDescription.js +7 -7
  16. package/dist/nodes/Cipp/descriptions/GroupDescription.d.ts.map +1 -1
  17. package/dist/nodes/Cipp/descriptions/GroupDescription.js +19 -0
  18. package/dist/nodes/Cipp/descriptions/GroupDescription.js.map +1 -1
  19. package/dist/nodes/Cipp/descriptions/IdentityDescription.d.ts.map +1 -1
  20. package/dist/nodes/Cipp/descriptions/IdentityDescription.js +1 -2
  21. package/dist/nodes/Cipp/descriptions/IdentityDescription.js.map +1 -1
  22. package/dist/nodes/Cipp/descriptions/IntuneDescription.js +8 -8
  23. package/dist/nodes/Cipp/descriptions/MailboxDescription.d.ts.map +1 -1
  24. package/dist/nodes/Cipp/descriptions/MailboxDescription.js +1 -5
  25. package/dist/nodes/Cipp/descriptions/MailboxDescription.js.map +1 -1
  26. package/dist/nodes/Cipp/descriptions/OneDriveDescription.js +2 -2
  27. package/dist/nodes/Cipp/descriptions/OneDriveDescription.js.map +1 -1
  28. package/dist/nodes/Cipp/descriptions/PolicyDescription.js +1 -1
  29. package/dist/nodes/Cipp/descriptions/SafeLinksDescription.js +1 -1
  30. package/dist/nodes/Cipp/descriptions/SharePointDescription.js +4 -4
  31. package/dist/nodes/Cipp/descriptions/SharePointDescription.js.map +1 -1
  32. package/dist/nodes/Cipp/descriptions/ShiftDescription.d.ts.map +1 -1
  33. package/dist/nodes/Cipp/descriptions/ShiftDescription.js +2 -3
  34. package/dist/nodes/Cipp/descriptions/ShiftDescription.js.map +1 -1
  35. package/dist/nodes/Cipp/descriptions/TenantDescription.js +2 -2
  36. package/dist/nodes/Cipp/descriptions/TenantDescription.js.map +1 -1
  37. package/dist/nodes/Cipp/descriptions/UserDescription.d.ts.map +1 -1
  38. package/dist/nodes/Cipp/descriptions/UserDescription.js +19 -10
  39. package/dist/nodes/Cipp/descriptions/UserDescription.js.map +1 -1
  40. package/dist/nodes/Cipp/descriptions/V105Description.d.ts +4 -0
  41. package/dist/nodes/Cipp/descriptions/V105Description.d.ts.map +1 -0
  42. package/dist/nodes/Cipp/descriptions/V105Description.js +237 -0
  43. package/dist/nodes/Cipp/descriptions/V105Description.js.map +1 -0
  44. package/dist/nodes/Cipp/descriptions/index.d.ts.map +1 -1
  45. package/dist/nodes/Cipp/descriptions/index.js +3 -0
  46. package/dist/nodes/Cipp/descriptions/index.js.map +1 -1
  47. package/package.json +3 -3
  48. package/dist/nodes/Cipp/Cipp.node.d.ts.map +0 -1
  49. package/dist/nodes/Cipp/Cipp.node.js.map +0 -1
@@ -8,7 +8,7 @@ class Cipp {
8
8
  description = {
9
9
  displayName: 'CIPP.app',
10
10
  name: 'cippApp',
11
- icon: 'file:cipp.png',
11
+ icon: 'file:cipp.svg',
12
12
  group: ['transform'],
13
13
  version: 1,
14
14
  subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
@@ -52,6 +52,11 @@ class Cipp {
52
52
  value: 'backup',
53
53
  description: 'Manage CIPP backups',
54
54
  },
55
+ {
56
+ name: 'CIPP v10.5',
57
+ value: 'cippV105',
58
+ description: 'Use CIPP v10.5 API additions',
59
+ },
55
60
  {
56
61
  name: 'Conditional Access',
57
62
  value: 'conditionalAccess',
@@ -113,7 +118,7 @@ class Cipp {
113
118
  description: 'Manage quarantined email messages',
114
119
  },
115
120
  {
116
- name: 'Safe Links',
121
+ name: 'Safe Link',
117
122
  value: 'safeLinks',
118
123
  description: 'Manage Safe Links policies and templates',
119
124
  },
@@ -128,7 +133,7 @@ class Cipp {
128
133
  description: 'Manage SharePoint sites, quotas, and settings',
129
134
  },
130
135
  {
131
- name: 'Standards',
136
+ name: 'Standard',
132
137
  value: 'standards',
133
138
  description: 'Manage tenant standards, drift, BPA, and domain analyser',
134
139
  },
@@ -142,16 +147,16 @@ class Cipp {
142
147
  value: 'teamsShift',
143
148
  description: 'Manage Teams Shifts schedule — shifts, open shifts, groups, time off',
144
149
  },
145
- {
146
- name: 'Testing',
147
- value: 'testing',
148
- description: 'Manage test runs, test reports, and available tests',
149
- },
150
150
  {
151
151
  name: 'Tenant',
152
152
  value: 'tenant',
153
153
  description: 'List and manage tenants',
154
154
  },
155
+ {
156
+ name: 'Testing',
157
+ value: 'testing',
158
+ description: 'Manage test runs, test reports, and available tests',
159
+ },
155
160
  {
156
161
  name: 'Tool',
157
162
  value: 'tools',
@@ -188,31 +193,34 @@ class Cipp {
188
193
  const tokenUrl = `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`;
189
194
  const scope = `api://${clientId}/.default`;
190
195
  const tokenBody = `grant_type=client_credentials&client_id=${encodeURIComponent(clientId)}&client_secret=${encodeURIComponent(clientSecret)}&scope=${encodeURIComponent(scope)}`;
191
- const tokenResponse = (await this.helpers.request({
196
+ const tokenRequest = await fetch(tokenUrl, {
192
197
  method: 'POST',
193
- uri: tokenUrl,
194
198
  headers: {
195
199
  'Content-Type': 'application/x-www-form-urlencoded',
196
200
  },
197
201
  body: tokenBody,
198
- json: true,
199
- }));
200
- if (!tokenResponse.access_token) {
202
+ });
203
+ const tokenResponse = (await tokenRequest.json().catch(() => ({})));
204
+ if (!tokenRequest.ok || typeof tokenResponse.access_token !== 'string') {
201
205
  return {
202
206
  status: 'Error',
203
207
  message: 'Failed to obtain access token from Azure AD. Check your Tenant ID, Client ID, and Client Secret.',
204
208
  };
205
209
  }
206
210
  // Step 2: Test API connection with the token
207
- await this.helpers.request({
211
+ const testRequest = await fetch(`${baseUrl}/api/ListTenants`, {
208
212
  method: 'GET',
209
- uri: `${baseUrl}/api/ListTenants`,
210
213
  headers: {
211
214
  Authorization: `Bearer ${tokenResponse.access_token}`,
212
215
  Accept: 'application/json',
213
216
  },
214
- json: true,
215
217
  });
218
+ if (!testRequest.ok) {
219
+ return {
220
+ status: 'Error',
221
+ message: `CIPP API test request failed with status ${testRequest.status}.`,
222
+ };
223
+ }
216
224
  return {
217
225
  status: 'OK',
218
226
  message: 'Connection successful!',
@@ -309,6 +317,51 @@ class Cipp {
309
317
  .map((entry) => entry.trim())
310
318
  .filter(Boolean);
311
319
  };
320
+ const v105Endpoints = {
321
+ addAssignmentFilterTemplate: { method: 'POST', endpoint: '/api/AddAssignmentFilterTemplate' },
322
+ addDlpCompliancePolicy: { method: 'POST', endpoint: '/api/AddDlpCompliancePolicy' },
323
+ addEnrollment: { method: 'POST', endpoint: '/api/AddEnrollment' },
324
+ addGroupTeam: { method: 'POST', endpoint: '/api/AddGroupTeam' },
325
+ addRetentionCompliancePolicy: { method: 'POST', endpoint: '/api/AddRetentionCompliancePolicy' },
326
+ addSensitiveInfoType: { method: 'POST', endpoint: '/api/AddSensitiveInfoType' },
327
+ addSensitivityLabel: { method: 'POST', endpoint: '/api/AddSensitivityLabel' },
328
+ addUserBulk: { method: 'POST', endpoint: '/api/AddUserBulk' },
329
+ assignPolicy: { method: 'POST', endpoint: '/api/ExecAssignPolicy' },
330
+ editAssignmentFilter: { method: 'POST', endpoint: '/api/EditAssignmentFilter' },
331
+ editDlpCompliancePolicy: { method: 'POST', endpoint: '/api/EditDlpCompliancePolicy' },
332
+ editRetentionCompliancePolicy: { method: 'POST', endpoint: '/api/EditRetentionCompliancePolicy' },
333
+ editSensitiveInfoType: { method: 'POST', endpoint: '/api/EditSensitiveInfoType' },
334
+ editSensitivityLabel: { method: 'POST', endpoint: '/api/EditSensitivityLabel' },
335
+ execAssignmentFilter: { method: 'DELETE', endpoint: '/api/ExecAssignmentFilter' },
336
+ execMailboxRestore: { method: 'POST', endpoint: '/api/ExecMailboxRestore' },
337
+ execMcp: { method: 'POST', endpoint: '/api/ExecMcp' },
338
+ execSpoVersionCleanup: { method: 'POST', endpoint: '/api/ExecSPOVersionCleanup' },
339
+ listActiveSyncDevices: { method: 'GET', endpoint: '/api/ListActiveSyncDevices' },
340
+ listAndroidEnrollmentProfiles: { method: 'POST', endpoint: '/api/ListAndroidEnrollmentProfiles' },
341
+ listAppleEnrollmentProfiles: { method: 'POST', endpoint: '/api/ListAppleEnrollmentProfiles' },
342
+ listAssignmentFilterTemplates: { method: 'GET', endpoint: '/api/ListAssignmentFilterTemplates' },
343
+ listCspSku: { method: 'GET', endpoint: '/api/ListCSPsku' },
344
+ listDlpCompliancePolicy: { method: 'GET', endpoint: '/api/ListDlpCompliancePolicy' },
345
+ listHveAccounts: { method: 'GET', endpoint: '/api/ListHVEAccounts' },
346
+ listLicensesReport: { method: 'GET', endpoint: '/api/ListLicensesReport' },
347
+ listMailboxRestores: { method: 'GET', endpoint: '/api/ListMailboxRestores' },
348
+ listRetentionCompliancePolicy: { method: 'GET', endpoint: '/api/ListRetentionCompliancePolicy' },
349
+ listSensitiveInfoType: { method: 'GET', endpoint: '/api/ListSensitiveInfoType' },
350
+ listSensitivityLabel: { method: 'GET', endpoint: '/api/ListSensitivityLabel' },
351
+ listSnoozedAlerts: { method: 'GET', endpoint: '/api/ListSnoozedAlerts' },
352
+ patchUser: { method: 'PATCH', endpoint: '/api/PatchUser' },
353
+ removeAdminRole: { method: 'POST', endpoint: '/api/ExecRemoveAdminRole' },
354
+ removeAssignmentFilterTemplate: { method: 'POST', endpoint: '/api/RemoveAssignmentFilterTemplate' },
355
+ removeDlpCompliancePolicy: { method: 'POST', endpoint: '/api/RemoveDlpCompliancePolicy' },
356
+ removeEnrollmentProfile: { method: 'POST', endpoint: '/api/ExecRemoveEnrollmentProfile' },
357
+ removeRetentionCompliancePolicy: { method: 'POST', endpoint: '/api/RemoveRetentionCompliancePolicy' },
358
+ removeSensitiveInfoType: { method: 'POST', endpoint: '/api/RemoveSensitiveInfoType' },
359
+ removeSensitivityLabel: { method: 'POST', endpoint: '/api/RemoveSensitivityLabel' },
360
+ removeSnooze: { method: 'POST', endpoint: '/api/ExecRemoveSnooze' },
361
+ setCasMailbox: { method: 'POST', endpoint: '/api/ExecSetCASMailbox' },
362
+ setPackageTag: { method: 'POST', endpoint: '/api/ExecSetPackageTag' },
363
+ snoozeAlert: { method: 'POST', endpoint: '/api/ExecSnoozeAlert' },
364
+ };
312
365
  for (let i = 0; i < items.length; i++) {
313
366
  try {
314
367
  let responseData = {};
@@ -352,7 +405,9 @@ class Cipp {
352
405
  // Strip out AssignedUsers and AssignedGroups if summaryOnly is enabled
353
406
  if (licenseOptions.summaryOnly && Array.isArray(responseData)) {
354
407
  responseData = responseData.map((license) => {
355
- const { AssignedUsers, AssignedGroups, ...summary } = license;
408
+ const summary = { ...license };
409
+ delete summary.AssignedUsers;
410
+ delete summary.AssignedGroups;
356
411
  return summary;
357
412
  });
358
413
  }
@@ -463,6 +518,13 @@ class Cipp {
463
518
  if (body.setManager && typeof body.setManager === 'string') {
464
519
  body.setManager = { value: body.setManager };
465
520
  }
521
+ // CIPP's New-CIPPUser reads `password` (used verbatim if present, else random)
522
+ // and `MustChangePass`. `password` is already spread above; map the
523
+ // mustChangePassword toggle to the field name CIPP expects.
524
+ if (additionalFields.mustChangePassword !== undefined) {
525
+ body.MustChangePass = additionalFields.mustChangePassword;
526
+ delete body.mustChangePassword;
527
+ }
466
528
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddUser', body, {});
467
529
  }
468
530
  else if (operation === 'disable' || operation === 'enable') {
@@ -747,26 +809,40 @@ class Cipp {
747
809
  }
748
810
  else if (operation === 'edit') {
749
811
  const groupId = this.getNodeParameter('groupId', i);
812
+ const groupType = this.getNodeParameter('groupTypeForEdit', i, '');
750
813
  const editOptions = this.getNodeParameter('editOptions', i, {});
814
+ const splitList = (v) => v
815
+ .split(',')
816
+ .map((x) => x.trim())
817
+ .filter((x) => x !== '');
818
+ // CIPP's EditGroup reads PascalCase, singular field names and uses groupType
819
+ // to route between Graph (Microsoft 365 / Security) and Exchange Online
820
+ // (Distribution List / Mail-Enabled Security). Without the right type or
821
+ // field names the request returns 200 with an empty Results array (silent no-op).
751
822
  const body = {
752
823
  tenantFilter,
753
824
  groupId,
825
+ groupType,
754
826
  };
827
+ // AddMember resolves bare UPN strings to object IDs server-side, so a plain
828
+ // string array works for both Graph and Exchange paths.
755
829
  if (editOptions.addMembers) {
756
- body.addMembers = editOptions.addMembers.split(',').map((m) => m.trim());
757
- }
758
- if (editOptions.addOwners) {
759
- body.addOwners = editOptions.addOwners.split(',').map((o) => o.trim());
830
+ body.AddMember = splitList(editOptions.addMembers);
760
831
  }
832
+ // RemoveMember / AddOwner / RemoveOwner are keyed off `.value` server-side,
833
+ // so they must be objects.
761
834
  if (editOptions.removeMembers) {
762
- body.removeMembers = editOptions.removeMembers
763
- .split(',')
764
- .map((m) => m.trim());
835
+ body.RemoveMember = splitList(editOptions.removeMembers).map((v) => ({
836
+ value: v,
837
+ }));
838
+ }
839
+ if (editOptions.addOwners) {
840
+ body.AddOwner = splitList(editOptions.addOwners).map((v) => ({ value: v }));
765
841
  }
766
842
  if (editOptions.removeOwners) {
767
- body.removeOwners = editOptions.removeOwners
768
- .split(',')
769
- .map((o) => o.trim());
843
+ body.RemoveOwner = splitList(editOptions.removeOwners).map((v) => ({
844
+ value: v,
845
+ }));
770
846
  }
771
847
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditGroup', body, {});
772
848
  }
@@ -860,7 +936,7 @@ class Cipp {
860
936
  try {
861
937
  editData = JSON.parse(editJson);
862
938
  }
863
- catch (e) {
939
+ catch {
864
940
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
865
941
  }
866
942
  if (editData.displayName)
@@ -880,7 +956,7 @@ class Cipp {
880
956
  try {
881
957
  templateData = JSON.parse(templateJson);
882
958
  }
883
- catch (e) {
959
+ catch {
884
960
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
885
961
  }
886
962
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddCATemplate', {
@@ -938,7 +1014,7 @@ class Cipp {
938
1014
  try {
939
1015
  locationData = JSON.parse(locationJson);
940
1016
  }
941
- catch (e) {
1017
+ catch {
942
1018
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Location JSON must be valid JSON', { itemIndex: i });
943
1019
  }
944
1020
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecNamedLocation', {
@@ -1232,11 +1308,47 @@ class Cipp {
1232
1308
  else if (operation === 'editMailboxPermissions') {
1233
1309
  const userId = this.getNodeParameter('userId', i);
1234
1310
  const permissions = this.getNodeParameter('permissions', i, {});
1235
- responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEditMailboxPermissions', {
1311
+ // CIPP's ExecEditMailboxPermissions reads each permission field as
1312
+ // `($Request.body.<Field>).value`, so every recipient must be an object
1313
+ // with a `.value` property (array of them for multiple). A bare string
1314
+ // yields a null `.value` and the request silently no-ops (200 + empty Results).
1315
+ const toValueObjects = (v) => String(v)
1316
+ .split(',')
1317
+ .map((x) => x.trim())
1318
+ .filter((x) => x !== '')
1319
+ .map((value) => ({ value }));
1320
+ const body = {
1236
1321
  tenantfilter: tenantFilter,
1237
1322
  userID: userId,
1238
- ...permissions,
1239
- }, {});
1323
+ };
1324
+ // AutoMapping is not a top-level field CIPP reads; AddFullAccess always
1325
+ // automaps, AddFullAccessNoAutoMap does not. Route based on the toggle.
1326
+ const autoMapping = permissions.AutoMapping !== false;
1327
+ if (permissions.AddFullAccess) {
1328
+ const fullAccess = toValueObjects(permissions.AddFullAccess);
1329
+ if (autoMapping) {
1330
+ body.AddFullAccess = fullAccess;
1331
+ }
1332
+ else {
1333
+ body.AddFullAccessNoAutoMap = fullAccess;
1334
+ }
1335
+ }
1336
+ if (permissions.RemoveFullAccess) {
1337
+ body.RemoveFullAccess = toValueObjects(permissions.RemoveFullAccess);
1338
+ }
1339
+ if (permissions.AddSendAs) {
1340
+ body.AddSendAs = toValueObjects(permissions.AddSendAs);
1341
+ }
1342
+ if (permissions.RemoveSendAs) {
1343
+ body.RemoveSendAs = toValueObjects(permissions.RemoveSendAs);
1344
+ }
1345
+ if (permissions.AddSendOnBehalf) {
1346
+ body.AddSendOnBehalf = toValueObjects(permissions.AddSendOnBehalf);
1347
+ }
1348
+ if (permissions.RemoveSendOnBehalf) {
1349
+ body.RemoveSendOnBehalf = toValueObjects(permissions.RemoveSendOnBehalf);
1350
+ }
1351
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecEditMailboxPermissions', body, {});
1240
1352
  // ---------- Edit Calendar Permissions ----------
1241
1353
  }
1242
1354
  else if (operation === 'editCalendarPermissions') {
@@ -1973,7 +2085,7 @@ class Cipp {
1973
2085
  try {
1974
2086
  policyData = JSON.parse(policyJson);
1975
2087
  }
1976
- catch (e) {
2088
+ catch {
1977
2089
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
1978
2090
  }
1979
2091
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecNewSafeLinksPolicy', {
@@ -1989,7 +2101,7 @@ class Cipp {
1989
2101
  try {
1990
2102
  policyData = JSON.parse(policyJson);
1991
2103
  }
1992
- catch (e) {
2104
+ catch {
1993
2105
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
1994
2106
  }
1995
2107
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSafeLinksPolicy', {
@@ -2012,7 +2124,7 @@ class Cipp {
2012
2124
  try {
2013
2125
  templateData = JSON.parse(templateJson);
2014
2126
  }
2015
- catch (e) {
2127
+ catch {
2016
2128
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
2017
2129
  }
2018
2130
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSafeLinksPolicyTemplate', {
@@ -2027,7 +2139,7 @@ class Cipp {
2027
2139
  try {
2028
2140
  templateData = JSON.parse(templateJson);
2029
2141
  }
2030
- catch (e) {
2142
+ catch {
2031
2143
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
2032
2144
  }
2033
2145
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSafeLinksPolicyTemplate', {
@@ -2123,6 +2235,50 @@ class Cipp {
2123
2235
  }, {});
2124
2236
  }
2125
2237
  }
2238
+ // ==================== CIPP V10.5 ====================
2239
+ else if (resource === 'cippV105') {
2240
+ const config = v105Endpoints[operation];
2241
+ if (!config) {
2242
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported CIPP v10.5 operation: ${operation}`, { itemIndex: i });
2243
+ }
2244
+ const includeTenant = this.getNodeParameter('v105IncludeTenant', i);
2245
+ const query = parseJsonObjectPayload(this.getNodeParameter('v105QueryJson', i, '{}'), 'Query Parameters', i);
2246
+ const body = config.method === 'GET'
2247
+ ? {}
2248
+ : parseJsonObjectPayload(this.getNodeParameter('v105BodyJson', i, '{}'), 'Body', i);
2249
+ if (includeTenant) {
2250
+ const tenantValue = this.getNodeParameter('tenantFilter', i);
2251
+ const tenantFilter = (0, GenericFunctions_1.getResourceLocatorValue)(tenantValue);
2252
+ if (!tenantFilter) {
2253
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Tenant is required.', {
2254
+ itemIndex: i,
2255
+ });
2256
+ }
2257
+ if (!query.tenantFilter) {
2258
+ query.tenantFilter = tenantFilter;
2259
+ }
2260
+ if (!body.tenantFilter) {
2261
+ body.tenantFilter = tenantFilter;
2262
+ }
2263
+ }
2264
+ const options = this.getNodeParameter('v105Options', i, {});
2265
+ const maxPayloadBytes = Number(options.maxPayloadBytes ?? 262144);
2266
+ if (!Number.isFinite(maxPayloadBytes) || maxPayloadBytes <= 0) {
2267
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Max Payload Bytes must be a positive number.', { itemIndex: i });
2268
+ }
2269
+ const payloadBytes = new TextEncoder().encode(JSON.stringify(body)).length;
2270
+ if (payloadBytes > maxPayloadBytes) {
2271
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Payload is ${payloadBytes} bytes, which exceeds Max Payload Bytes (${maxPayloadBytes}).`, { itemIndex: i });
2272
+ }
2273
+ responseData = await GenericFunctions_1.cippApiRequest.call(this, config.method, config.endpoint, body, query);
2274
+ if (Array.isArray(responseData)) {
2275
+ const returnAll = this.getNodeParameter('returnAll', i, true);
2276
+ if (!returnAll) {
2277
+ const limit = this.getNodeParameter('limit', i);
2278
+ responseData = responseData.slice(0, limit);
2279
+ }
2280
+ }
2281
+ }
2126
2282
  // ==================== TOOLS ====================
2127
2283
  else if (resource === 'tools') {
2128
2284
  if (operation === 'breachAccount') {
@@ -2684,7 +2840,7 @@ class Cipp {
2684
2840
  try {
2685
2841
  policyData = JSON.parse(policyJson);
2686
2842
  }
2687
- catch (e) {
2843
+ catch {
2688
2844
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
2689
2845
  }
2690
2846
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddSpamFilter', {
@@ -2698,7 +2854,7 @@ class Cipp {
2698
2854
  try {
2699
2855
  policyData = JSON.parse(policyJson);
2700
2856
  }
2701
- catch (e) {
2857
+ catch {
2702
2858
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Policy JSON must be valid JSON', { itemIndex: i });
2703
2859
  }
2704
2860
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditSpamFilter', {
@@ -2726,7 +2882,7 @@ class Cipp {
2726
2882
  try {
2727
2883
  ruleData = JSON.parse(ruleJson);
2728
2884
  }
2729
- catch (e) {
2885
+ catch {
2730
2886
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Rule JSON must be valid JSON', { itemIndex: i });
2731
2887
  }
2732
2888
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTransportRule', {
@@ -2740,7 +2896,7 @@ class Cipp {
2740
2896
  try {
2741
2897
  ruleData = JSON.parse(ruleJson);
2742
2898
  }
2743
- catch (e) {
2899
+ catch {
2744
2900
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Rule JSON must be valid JSON', { itemIndex: i });
2745
2901
  }
2746
2902
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditTransportRule', {
@@ -2768,7 +2924,7 @@ class Cipp {
2768
2924
  try {
2769
2925
  connectorData = JSON.parse(connectorJson);
2770
2926
  }
2771
- catch (e) {
2927
+ catch {
2772
2928
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Connector JSON must be valid JSON', { itemIndex: i });
2773
2929
  }
2774
2930
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddExConnector', {
@@ -2782,7 +2938,7 @@ class Cipp {
2782
2938
  try {
2783
2939
  connectorData = JSON.parse(connectorJson);
2784
2940
  }
2785
- catch (e) {
2941
+ catch {
2786
2942
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Connector JSON must be valid JSON', { itemIndex: i });
2787
2943
  }
2788
2944
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditExConnector', {
@@ -2810,7 +2966,7 @@ class Cipp {
2810
2966
  try {
2811
2967
  filterData = JSON.parse(filterJson);
2812
2968
  }
2813
- catch (e) {
2969
+ catch {
2814
2970
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2815
2971
  }
2816
2972
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddConnectionFilter', {
@@ -2831,7 +2987,7 @@ class Cipp {
2831
2987
  try {
2832
2988
  filterData = JSON.parse(filterJson);
2833
2989
  }
2834
- catch (e) {
2990
+ catch {
2835
2991
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2836
2992
  }
2837
2993
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditAntiPhishingFilter', {
@@ -2852,7 +3008,7 @@ class Cipp {
2852
3008
  try {
2853
3009
  filterData = JSON.parse(filterJson);
2854
3010
  }
2855
- catch (e) {
3011
+ catch {
2856
3012
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
2857
3013
  }
2858
3014
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditMalwareFilter', {
@@ -2873,7 +3029,7 @@ class Cipp {
2873
3029
  try {
2874
3030
  blockListData = JSON.parse(blockListJson);
2875
3031
  }
2876
- catch (e) {
3032
+ catch {
2877
3033
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Block List JSON must be valid JSON', { itemIndex: i });
2878
3034
  }
2879
3035
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTenantAllowBlockList', {
@@ -2887,7 +3043,7 @@ class Cipp {
2887
3043
  try {
2888
3044
  blockListData = JSON.parse(blockListJson);
2889
3045
  }
2890
- catch (e) {
3046
+ catch {
2891
3047
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Block List JSON must be valid JSON', { itemIndex: i });
2892
3048
  }
2893
3049
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/RemoveTenantAllowBlockList', {
@@ -2923,7 +3079,7 @@ class Cipp {
2923
3079
  try {
2924
3080
  additionalData = JSON.parse(additionalJson);
2925
3081
  }
2926
- catch (e) {
3082
+ catch {
2927
3083
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Additional JSON must be valid JSON', { itemIndex: i });
2928
3084
  }
2929
3085
  }
@@ -2941,7 +3097,7 @@ class Cipp {
2941
3097
  try {
2942
3098
  roomData = JSON.parse(roomJson);
2943
3099
  }
2944
- catch (e) {
3100
+ catch {
2945
3101
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Room JSON must be valid JSON', { itemIndex: i });
2946
3102
  }
2947
3103
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditRoomMailbox', {
@@ -2973,7 +3129,7 @@ class Cipp {
2973
3129
  try {
2974
3130
  equipmentData = JSON.parse(equipmentJson);
2975
3131
  }
2976
- catch (e) {
3132
+ catch {
2977
3133
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Equipment JSON must be valid JSON', { itemIndex: i });
2978
3134
  }
2979
3135
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditEquipmentMailbox', {
@@ -3005,7 +3161,7 @@ class Cipp {
3005
3161
  try {
3006
3162
  roomListData = JSON.parse(roomListJson);
3007
3163
  }
3008
- catch (e) {
3164
+ catch {
3009
3165
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Room List JSON must be valid JSON', { itemIndex: i });
3010
3166
  }
3011
3167
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditRoomList', {
@@ -3051,7 +3207,7 @@ class Cipp {
3051
3207
  try {
3052
3208
  standardsData = JSON.parse(standardsJson);
3053
3209
  }
3054
- catch (e) {
3210
+ catch {
3055
3211
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Standards JSON must be valid JSON', { itemIndex: i });
3056
3212
  }
3057
3213
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddStandardsDeploy', {
@@ -3079,7 +3235,7 @@ class Cipp {
3079
3235
  try {
3080
3236
  templateData = JSON.parse(templateJson);
3081
3237
  }
3082
- catch (e) {
3238
+ catch {
3083
3239
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template JSON must be valid JSON', { itemIndex: i });
3084
3240
  }
3085
3241
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddStandardsTemplate', {
@@ -3151,7 +3307,7 @@ class Cipp {
3151
3307
  try {
3152
3308
  driftData = JSON.parse(driftJson);
3153
3309
  }
3154
- catch (e) {
3310
+ catch {
3155
3311
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Drift JSON must be valid JSON', { itemIndex: i });
3156
3312
  }
3157
3313
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecDriftClone', {
@@ -3176,7 +3332,7 @@ class Cipp {
3176
3332
  try {
3177
3333
  scriptData = JSON.parse(scriptJson);
3178
3334
  }
3179
- catch (e) {
3335
+ catch {
3180
3336
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Script JSON must be valid JSON', { itemIndex: i });
3181
3337
  }
3182
3338
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/EditIntuneScript', {
@@ -3218,7 +3374,7 @@ class Cipp {
3218
3374
  try {
3219
3375
  filterData = JSON.parse(filterJson);
3220
3376
  }
3221
- catch (e) {
3377
+ catch {
3222
3378
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Filter JSON must be valid JSON', { itemIndex: i });
3223
3379
  }
3224
3380
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddAssignmentFilter', {
@@ -3239,7 +3395,7 @@ class Cipp {
3239
3395
  try {
3240
3396
  settingData = JSON.parse(settingJson);
3241
3397
  }
3242
- catch (e) {
3398
+ catch {
3243
3399
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Setting JSON must be valid JSON', { itemIndex: i });
3244
3400
  }
3245
3401
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddIntuneReusableSetting', {
@@ -3267,7 +3423,7 @@ class Cipp {
3267
3423
  try {
3268
3424
  appData = JSON.parse(appJson);
3269
3425
  }
3270
- catch (e) {
3426
+ catch {
3271
3427
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'App JSON must be valid JSON', { itemIndex: i });
3272
3428
  }
3273
3429
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddWin32ScriptApp', {
@@ -3331,7 +3487,7 @@ class Cipp {
3331
3487
  try {
3332
3488
  testData = JSON.parse(testJson);
3333
3489
  }
3334
- catch (e) {
3490
+ catch {
3335
3491
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Test JSON must be valid JSON', { itemIndex: i });
3336
3492
  }
3337
3493
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/ExecTestRun', {
@@ -3352,7 +3508,7 @@ class Cipp {
3352
3508
  try {
3353
3509
  reportData = JSON.parse(reportJson);
3354
3510
  }
3355
- catch (e) {
3511
+ catch {
3356
3512
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Report JSON must be valid JSON', { itemIndex: i });
3357
3513
  }
3358
3514
  responseData = await GenericFunctions_1.cippApiRequest.call(this, 'POST', '/api/AddTestReport', {
@@ -3385,4 +3541,4 @@ class Cipp {
3385
3541
  }
3386
3542
  }
3387
3543
  exports.Cipp = Cipp;
3388
- //# sourceMappingURL=Cipp.node.js.map
3544
+ //# sourceMappingURL=CippApp.node.js.map