node-autotask 0.75.0 → 0.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/MCP_TOOL_CATALOG.json +265 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +1499 -547
  5. package/dist/capabilities-data.js +1498 -546
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-VMFQ53HQ.cjs → chunk-3FZJJX5B.cjs} +3 -3
  9. package/dist/{chunk-YGJCTU7F.cjs → chunk-5MH3MPLB.cjs} +32 -30
  10. package/dist/{chunk-54CRUNXF.cjs → chunk-6VBOBCWA.cjs} +355 -24
  11. package/dist/{chunk-MCAGTC6R.js → chunk-F5Y7WBWY.js} +350 -19
  12. package/dist/{chunk-OFYXDB5G.js → chunk-G2U6NHPO.js} +3 -3
  13. package/dist/{chunk-52YS7NCR.cjs → chunk-NAI7XIX4.cjs} +199 -199
  14. package/dist/{chunk-OTDNHBJJ.js → chunk-QTFK2HAO.js} +4 -2
  15. package/dist/{chunk-JEARDPBL.js → chunk-RLXUY4VM.js} +2 -2
  16. package/dist/{index-BEuTtkQE.d.cts → index-B-vNyiD_.d.cts} +92 -1
  17. package/dist/{index-BEuTtkQE.d.ts → index-B-vNyiD_.d.ts} +92 -1
  18. package/dist/{index-BAu5alhB.d.cts → index-PLdAoAFJ.d.cts} +4 -2
  19. package/dist/{index-CNuQgQ_Z.d.ts → index-ecr6unv3.d.ts} +4 -2
  20. package/dist/index.cjs +84 -84
  21. package/dist/index.d.cts +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +4 -4
  26. package/dist/operations/index.d.ts +4 -4
  27. package/dist/operations/index.js +2 -2
  28. package/dist/pool.cjs +12 -12
  29. package/dist/pool.d.cts +1 -1
  30. package/dist/pool.d.ts +1 -1
  31. package/dist/pool.js +4 -4
  32. package/dist/resources/index.cjs +27 -27
  33. package/dist/resources/index.d.cts +2 -2
  34. package/dist/resources/index.d.ts +2 -2
  35. package/dist/resources/index.js +3 -3
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/docs/API.md +4 -2
  39. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkVMFQ53HQ_cjs = require('./chunk-VMFQ53HQ.cjs');
3
+ var chunk3FZJJX5B_cjs = require('./chunk-3FZJJX5B.cjs');
4
4
  var chunkBD4AUGCJ_cjs = require('./chunk-BD4AUGCJ.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
@@ -3249,6 +3249,22 @@ var RELATIONSHIP_MAP = {
3249
3249
  "group": "A",
3250
3250
  "parent": null,
3251
3251
  "children": [
3252
+ {
3253
+ "resource": "configuration_item_attachments",
3254
+ "apiEntity": "ConfigurationItemAttachment",
3255
+ "parentField": "configurationItemID",
3256
+ "parentSegment": "Attachments",
3257
+ "tier": "extended",
3258
+ "workflowResource": false,
3259
+ "specialOps": [],
3260
+ "searchCovers": null,
3261
+ "scopedOps": {
3262
+ "create": true,
3263
+ "query": true,
3264
+ "update": false,
3265
+ "delete": true
3266
+ }
3267
+ },
3252
3268
  {
3253
3269
  "resource": "configuration_item_billing_product_associations",
3254
3270
  "apiEntity": "ConfigurationItemBillingProductAssociations",
@@ -9775,7 +9791,24 @@ var RELATIONSHIP_MAP = {
9775
9791
  "segment": "Notes",
9776
9792
  "field": "taskID"
9777
9793
  },
9778
- "children": [],
9794
+ "children": [
9795
+ {
9796
+ "resource": "task_note_attachments",
9797
+ "apiEntity": "TaskNoteAttachment",
9798
+ "parentField": "taskNoteID",
9799
+ "parentSegment": "Attachments",
9800
+ "tier": "extended",
9801
+ "workflowResource": false,
9802
+ "specialOps": [],
9803
+ "searchCovers": null,
9804
+ "scopedOps": {
9805
+ "create": true,
9806
+ "query": true,
9807
+ "update": false,
9808
+ "delete": true
9809
+ }
9810
+ }
9811
+ ],
9779
9812
  "naturalKeys": {
9780
9813
  "hasSearch": false,
9781
9814
  "searchCovers": null,
@@ -9906,6 +9939,141 @@ var RELATIONSHIP_MAP = {
9906
9939
  },
9907
9940
  "deleteBoundary": null,
9908
9941
  "markerField": null
9942
+ },
9943
+ "task_note_attachments": {
9944
+ "resource": "task_note_attachments",
9945
+ "apiEntity": "TaskNoteAttachment",
9946
+ "kind": "entity",
9947
+ "path": "TaskNoteAttachments",
9948
+ "parentScoped": true,
9949
+ "tier": "extended",
9950
+ "workflowResource": false,
9951
+ "group": "A",
9952
+ "parent": {
9953
+ "resource": "task_notes",
9954
+ "segment": "Attachments",
9955
+ "field": "taskNoteID"
9956
+ },
9957
+ "children": [],
9958
+ "naturalKeys": {
9959
+ "hasSearch": false,
9960
+ "searchCovers": null,
9961
+ "findBy": []
9962
+ },
9963
+ "blindSurfaces": null,
9964
+ "zoneFacts": {
9965
+ "createGuidance": {
9966
+ "createOp": "task_note_attachments.create",
9967
+ "parentScoped": true,
9968
+ "liveProvenPrefix": [],
9969
+ "unproven": true,
9970
+ "blocker": {
9971
+ "kind": "unknown",
9972
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
9973
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
9974
+ "requires": {
9975
+ "allOf": [
9976
+ "attachmentType",
9977
+ "fullPath",
9978
+ "title",
9979
+ "publish",
9980
+ "data"
9981
+ ]
9982
+ }
9983
+ },
9984
+ "requiresByValue": [
9985
+ {
9986
+ "field": "attachmentType",
9987
+ "value": "FILE_ATTACHMENT",
9988
+ "requires": {
9989
+ "allOf": [
9990
+ "data"
9991
+ ]
9992
+ }
9993
+ }
9994
+ ],
9995
+ "vendorEvidence": [
9996
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskNoteAttachmentsEntity.htm",
9997
+ "https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
9998
+ "Official entity URLs table repeats TaskNotes routes, while vendored TaskNoteAttachments controllers define the actual scoped attachment routes. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
9999
+ ],
10000
+ "deleteBoundary": {
10001
+ "available": true,
10002
+ "note": null
10003
+ }
10004
+ }
10005
+ },
10006
+ "deleteBoundary": null,
10007
+ "markerField": null
10008
+ },
10009
+ "configuration_item_attachments": {
10010
+ "resource": "configuration_item_attachments",
10011
+ "apiEntity": "ConfigurationItemAttachment",
10012
+ "kind": "entity",
10013
+ "path": "ConfigurationItemAttachments",
10014
+ "parentScoped": true,
10015
+ "tier": "extended",
10016
+ "workflowResource": false,
10017
+ "group": "A",
10018
+ "parent": {
10019
+ "resource": "configuration_items",
10020
+ "segment": "Attachments",
10021
+ "field": "configurationItemID"
10022
+ },
10023
+ "children": [],
10024
+ "naturalKeys": {
10025
+ "hasSearch": false,
10026
+ "searchCovers": null,
10027
+ "findBy": []
10028
+ },
10029
+ "blindSurfaces": null,
10030
+ "zoneFacts": {
10031
+ "createGuidance": {
10032
+ "createOp": "configuration_item_attachments.create",
10033
+ "parentScoped": true,
10034
+ "liveProvenPrefix": [],
10035
+ "unproven": true,
10036
+ "blocker": {
10037
+ "kind": "unknown",
10038
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
10039
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
10040
+ "requires": {
10041
+ "allOf": [
10042
+ "attachmentType",
10043
+ "fullPath",
10044
+ "title",
10045
+ "publish",
10046
+ "data"
10047
+ ]
10048
+ }
10049
+ },
10050
+ "requiresByValue": [
10051
+ {
10052
+ "field": "attachmentType",
10053
+ "value": "FILE_ATTACHMENT",
10054
+ "requires": {
10055
+ "allOf": [
10056
+ "data"
10057
+ ]
10058
+ }
10059
+ }
10060
+ ],
10061
+ "vendorEvidence": [
10062
+ "Official ConfigurationItemAttachmentsEntity.htm and REST_Attachments.htm: required file creation inputs; ConfigurationItems parent; separate read-only configurationItemNoteID; no update or UDF metadata. Static contract only; no live create."
10063
+ ],
10064
+ "deleteBoundary": {
10065
+ "available": true,
10066
+ "note": null
10067
+ },
10068
+ "parentCompany": {
10069
+ "via": "configurationItemID",
10070
+ "resource": "configuration_items",
10071
+ "field": "companyID"
10072
+ }
10073
+ }
10074
+ },
10075
+ "deleteBoundary": null,
10076
+ "markerField": null
9909
10077
  }
9910
10078
  };
9911
10079
  var BLIND_SURFACE_STAMPS = {
@@ -11744,6 +11912,50 @@ var CREATE_GUIDANCE = {
11744
11912
  "note": null
11745
11913
  }
11746
11914
  },
11915
+ {
11916
+ "resource": "configuration_item_attachments",
11917
+ "createOp": "configuration_item_attachments.create",
11918
+ "parentScoped": true,
11919
+ "liveProvenPrefix": [],
11920
+ "unproven": true,
11921
+ "blocker": {
11922
+ "kind": "unknown",
11923
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
11924
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
11925
+ "requires": {
11926
+ "allOf": [
11927
+ "attachmentType",
11928
+ "fullPath",
11929
+ "title",
11930
+ "publish",
11931
+ "data"
11932
+ ]
11933
+ }
11934
+ },
11935
+ "vendorEvidence": [
11936
+ "Official ConfigurationItemAttachmentsEntity.htm and REST_Attachments.htm: required file creation inputs; ConfigurationItems parent; separate read-only configurationItemNoteID; no update or UDF metadata. Static contract only; no live create."
11937
+ ],
11938
+ "deleteBoundary": {
11939
+ "available": true,
11940
+ "note": null
11941
+ },
11942
+ "requiresByValue": [
11943
+ {
11944
+ "field": "attachmentType",
11945
+ "value": "FILE_ATTACHMENT",
11946
+ "requires": {
11947
+ "allOf": [
11948
+ "data"
11949
+ ]
11950
+ }
11951
+ }
11952
+ ],
11953
+ "parentCompany": {
11954
+ "via": "configurationItemID",
11955
+ "resource": "configuration_items",
11956
+ "field": "companyID"
11957
+ }
11958
+ },
11747
11959
  {
11748
11960
  "resource": "configuration_item_billing_product_associations",
11749
11961
  "createOp": "configuration_item_billing_product_associations.create",
@@ -13493,6 +13705,47 @@ var CREATE_GUIDANCE = {
13493
13705
  }
13494
13706
  ]
13495
13707
  },
13708
+ {
13709
+ "resource": "task_note_attachments",
13710
+ "createOp": "task_note_attachments.create",
13711
+ "parentScoped": true,
13712
+ "liveProvenPrefix": [],
13713
+ "unproven": true,
13714
+ "blocker": {
13715
+ "kind": "unknown",
13716
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
13717
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
13718
+ "requires": {
13719
+ "allOf": [
13720
+ "attachmentType",
13721
+ "fullPath",
13722
+ "title",
13723
+ "publish",
13724
+ "data"
13725
+ ]
13726
+ }
13727
+ },
13728
+ "vendorEvidence": [
13729
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskNoteAttachmentsEntity.htm",
13730
+ "https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
13731
+ "Official entity URLs table repeats TaskNotes routes, while vendored TaskNoteAttachments controllers define the actual scoped attachment routes. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
13732
+ ],
13733
+ "deleteBoundary": {
13734
+ "available": true,
13735
+ "note": null
13736
+ },
13737
+ "requiresByValue": [
13738
+ {
13739
+ "field": "attachmentType",
13740
+ "value": "FILE_ATTACHMENT",
13741
+ "requires": {
13742
+ "allOf": [
13743
+ "data"
13744
+ ]
13745
+ }
13746
+ }
13747
+ ]
13748
+ },
13496
13749
  {
13497
13750
  "resource": "task_notes",
13498
13751
  "createOp": "task_notes.create",
@@ -14086,7 +14339,7 @@ var CREATE_GUIDANCE = {
14086
14339
  }
14087
14340
  ],
14088
14341
  "counts": {
14089
- "total": 105,
14342
+ "total": 107,
14090
14343
  "byKind": {
14091
14344
  "ok": 41,
14092
14345
  "blind-reference": 16,
@@ -14096,7 +14349,7 @@ var CREATE_GUIDANCE = {
14096
14349
  "resource-role-pair": 2,
14097
14350
  "delete-absent": 0,
14098
14351
  "non-mutable": 0,
14099
- "unknown": 29
14352
+ "unknown": 31
14100
14353
  }
14101
14354
  }
14102
14355
  };
@@ -14829,6 +15082,12 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
14829
15082
  ],
14830
15083
  "task_attachments": [
14831
15084
  "title"
15085
+ ],
15086
+ "task_note_attachments": [
15087
+ "title"
15088
+ ],
15089
+ "configuration_item_attachments": [
15090
+ "title"
14832
15091
  ]
14833
15092
  };
14834
15093
 
@@ -16703,7 +16962,7 @@ async function capabilitySets() {
16703
16962
  const fieldOps = /* @__PURE__ */ new Map();
16704
16963
  const udfCapable = /* @__PURE__ */ new Set();
16705
16964
  const resources = /* @__PURE__ */ new Set();
16706
- for (const rec of await chunkVMFQ53HQ_cjs.loadCapabilityRecords()) {
16965
+ for (const rec of await chunk3FZJJX5B_cjs.loadCapabilityRecords()) {
16707
16966
  if (rec.resource === "operations") continue;
16708
16967
  resources.add(rec.resource);
16709
16968
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -16714,7 +16973,7 @@ async function capabilitySets() {
16714
16973
  var derivedIndexPromise = null;
16715
16974
  function derivedIndexLoad() {
16716
16975
  if (derivedIndexPromise === null) {
16717
- derivedIndexPromise = chunkVMFQ53HQ_cjs.loadCapabilityRecords().then((records) => {
16976
+ derivedIndexPromise = chunk3FZJJX5B_cjs.loadCapabilityRecords().then((records) => {
16718
16977
  const index = /* @__PURE__ */ new Map();
16719
16978
  for (const rec of records) {
16720
16979
  const declared = rec.metadata?.derivedFields;
@@ -17833,6 +18092,7 @@ var MODEL_FIELD_SETS = {
17833
18092
  "company_notes": ["id", "actionType", "assignedResourceID", "companyID", "completedDateTime", "contactID", "createDateTime", "endDateTime", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastModifiedDate", "name", "note", "opportunityID", "startDateTime", "soapParentPropertyId"],
17834
18093
  "company_site_configurations": ["id", "companyID", "locationName", "soapParentPropertyId", "userDefinedFields"],
17835
18094
  "company_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
18095
+ "configuration_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "configurationItemID", "configurationItemNoteID", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
17836
18096
  "configuration_item_billing_product_associations": ["id", "billingProductID", "configurationItemID", "effectiveDate", "expirationDate", "soapParentPropertyId"],
17837
18097
  "configuration_item_categories": ["id", "displayColorRGB", "isActive", "isClientPortalDefault", "isGlobalDefault", "name", "nickname"],
17838
18098
  "configuration_item_category_udf_associations": ["id", "configurationItemCategoryID", "isRequired", "userDefinedFieldDefinitionID", "soapParentPropertyId"],
@@ -17924,6 +18184,7 @@ var MODEL_FIELD_SETS = {
17924
18184
  "tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
17925
18185
  "tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
17926
18186
  "task_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "taskID", "taskNoteID", "timeEntryID", "title", "data", "isTaskAttachment", "parentType", "soapParentPropertyId"],
18187
+ "task_note_attachments": ["id", "isTaskAttachment", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "taskID", "taskNoteID", "title", "data", "parentType", "soapParentPropertyId"],
17927
18188
  "task_notes": ["id", "createDateTime", "creatorResourceID", "createdByContactID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "taskID", "title", "soapParentPropertyId"],
17928
18189
  "task_predecessors": ["id", "lagDays", "predecessorTaskID", "successorTaskID", "soapParentPropertyId"],
17929
18190
  "task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
@@ -17959,6 +18220,7 @@ var MODEL_DATE_FIELDS = {
17959
18220
  "company_attachments": ["attachDate"],
17960
18221
  "company_note_attachments": ["attachDate"],
17961
18222
  "company_notes": ["completedDateTime", "createDateTime", "endDateTime", "lastModifiedDate", "startDateTime"],
18223
+ "configuration_item_attachments": ["attachDate"],
17962
18224
  "configuration_item_billing_product_associations": ["effectiveDate", "expirationDate"],
17963
18225
  "configuration_item_dns_records": ["createDateTime"],
17964
18226
  "configuration_item_notes": ["createDateTime", "lastActivityDate"],
@@ -18003,6 +18265,7 @@ var MODEL_DATE_FIELDS = {
18003
18265
  "survey_results": ["completeDate", "sendDate"],
18004
18266
  "tags": ["createDateTime", "lastModifiedDateTime"],
18005
18267
  "task_attachments": ["attachDate"],
18268
+ "task_note_attachments": ["attachDate"],
18006
18269
  "task_notes": ["createDateTime", "lastActivityDate"],
18007
18270
  "tasks": ["completedDateTime", "createDateTime", "endDateTime", "lastActivityDateTime", "startDateTime"],
18008
18271
  "ticket_attachments": ["attachDate"],
@@ -20356,9 +20619,21 @@ async function findUnknownFieldNames(record, holder, lists) {
20356
20619
  return { known: resolved.known, authority: resolved.authority, unknown };
20357
20620
  }
20358
20621
 
20359
- // src/resources/special/taskAttachments.ts
20622
+ // src/resources/special/scopedAttachments.ts
20360
20623
  var WRITABLE2 = /* @__PURE__ */ new Set(["attachmentType", "contentType", "data", "fullPath", "parentAttachmentID", "publish", "taskID", "title"]);
20624
+ var FILE_WRITABLE = /* @__PURE__ */ new Set(["attachmentType", "data", "fullPath", "publish", "title"]);
20361
20625
  var NON_QUERYABLE = /* @__PURE__ */ new Set(["creatortype", "data", "filesize"]);
20626
+ var SCOPED_ATTACHMENT_PARENTS = {
20627
+ task_attachments: { field: "taskID", name: "task" },
20628
+ task_note_attachments: { field: "taskNoteID", name: "task note" },
20629
+ configuration_item_attachments: { field: "configurationItemID", name: "configuration item" }
20630
+ };
20631
+ function isScopedAttachmentResource(resource) {
20632
+ return Object.hasOwn(SCOPED_ATTACHMENT_PARENTS, resource);
20633
+ }
20634
+ function isBase64(value) {
20635
+ return value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
20636
+ }
20362
20637
  function admitTaskAttachment(data, parentId) {
20363
20638
  const parent = parseIdentifier(parentId, "parentId");
20364
20639
  const fail2 = (message) => {
@@ -20376,7 +20651,7 @@ function admitTaskAttachment(data, parentId) {
20376
20651
  }
20377
20652
  if (body.attachmentType === "FILE_ATTACHMENT") {
20378
20653
  if (typeof body.data !== "string" || body.data === "") return fail2("FILE_ATTACHMENT requires non-empty base64 data");
20379
- if (body.data.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(body.data)) fail2("FILE_ATTACHMENT data must be base64 encoded");
20654
+ if (!isBase64(body.data)) fail2("FILE_ATTACHMENT data must be base64 encoded");
20380
20655
  }
20381
20656
  if (body.taskID !== void 0) {
20382
20657
  if (typeof body.taskID !== "number") fail2("taskID must be a numeric identifier");
@@ -20387,13 +20662,33 @@ function admitTaskAttachment(data, parentId) {
20387
20662
  parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
20388
20663
  }
20389
20664
  }
20390
- function admitTaskAttachmentQuery(params) {
20391
- const fields = collectFilterFieldNames(normalizedConditions(params?.filter) ?? [], "task_attachments");
20665
+ function admitFileAttachment(resource, data, parentId) {
20666
+ parseIdentifier(parentId, "parentId");
20667
+ const fail2 = (message) => {
20668
+ throw new AutotaskConfigError(`${resource}: ${message}`);
20669
+ };
20670
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
20671
+ const body = data;
20672
+ const reference = resource === "task_note_attachments" ? "attachedByContactID" : "parentAttachmentID";
20673
+ for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference) fail2(`${field} is not a supported create field`);
20674
+ if (body.attachmentType !== "FILE_ATTACHMENT") fail2("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
20675
+ for (const field of ["fullPath", "title"]) {
20676
+ if (typeof body[field] !== "string" || body[field].trim() === "" || body[field].length > 255) fail2(`${field} is required and must be a nonblank string of at most 255 characters`);
20677
+ }
20678
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail2("publish must be an integer from current field metadata");
20679
+ if (typeof body.data !== "string" || !isBase64(body.data)) fail2("FILE_ATTACHMENT requires nonempty base64 data");
20680
+ if (body[reference] !== void 0) {
20681
+ if (typeof body[reference] !== "number") fail2(`${reference} must be a numeric identifier`);
20682
+ if (parseIdentifier(body[reference], reference) === 0) fail2(`${reference} must be positive`);
20683
+ }
20684
+ }
20685
+ function admitScopedAttachmentQuery(resource, params) {
20686
+ const fields = collectFilterFieldNames(normalizedConditions(params?.filter) ?? [], resource);
20392
20687
  for (const field of fields) {
20393
- if (NON_QUERYABLE.has(field.toLowerCase())) throw new AutotaskConfigError(`task_attachments: ${field} is not queryable`);
20688
+ if (NON_QUERYABLE.has(field.toLowerCase())) throw new AutotaskConfigError(`${resource}: ${field} is not queryable`);
20394
20689
  }
20395
20690
  }
20396
- function assertTaskAttachmentIdentity(model, parentId, id) {
20691
+ function assertScopedAttachmentIdentity(resource, model, parentId, id) {
20397
20692
  const matches = (value, expected) => {
20398
20693
  try {
20399
20694
  return parseIdentifier(value) === parseIdentifier(expected);
@@ -20401,11 +20696,12 @@ function assertTaskAttachmentIdentity(model, parentId, id) {
20401
20696
  return false;
20402
20697
  }
20403
20698
  };
20404
- if (!isRecord2(model) || !matches(model.id, id) || model.taskID != null && !matches(model.taskID, parentId)) {
20405
- throw new AutotaskError("Returned attachment identifiers contradict the requested task or attachment", {
20699
+ const { field: parentField, name: parentName } = SCOPED_ATTACHMENT_PARENTS[resource];
20700
+ if (!isRecord2(model) || !matches(model.id, id) || model[parentField] != null && !matches(model[parentField], parentId)) {
20701
+ throw new AutotaskError(`Returned attachment identifiers contradict the requested ${parentName} or attachment`, {
20406
20702
  code: "INVALID_RESPONSE",
20407
20703
  category: "server",
20408
- operation: "task_attachments.get"
20704
+ operation: `${resource}.get`
20409
20705
  });
20410
20706
  }
20411
20707
  }
@@ -20609,6 +20905,20 @@ var SIMPLE_RESOURCES = [
20609
20905
  helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
20610
20906
  opForms: { get: "global", create: "global", update: "global", delete: "global" }
20611
20907
  },
20908
+ {
20909
+ key: "configuration_item_attachments",
20910
+ accessor: "configurationItemAttachments",
20911
+ resourcePath: "/V1.0/ConfigurationItemAttachments",
20912
+ parentScopedPath: "/V1.0/ConfigurationItems/{parentId}/Attachments",
20913
+ parentPath: "/V1.0/ConfigurationItems",
20914
+ parentField: "configurationItemID",
20915
+ deletable: true,
20916
+ udfCapable: false,
20917
+ attachmentGet: true,
20918
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
20919
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
20920
+ opForms: { get: "scoped", create: "scoped", delete: "scoped" }
20921
+ },
20612
20922
  {
20613
20923
  key: "configuration_item_billing_product_associations",
20614
20924
  accessor: "configurationItemBillingProductAssociations",
@@ -21655,6 +21965,20 @@ var SIMPLE_RESOURCES = [
21655
21965
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21656
21966
  opForms: { get: "scoped", create: "scoped", delete: "scoped" }
21657
21967
  },
21968
+ {
21969
+ key: "task_note_attachments",
21970
+ accessor: "taskNoteAttachments",
21971
+ resourcePath: "/V1.0/TaskNoteAttachments",
21972
+ parentScopedPath: "/V1.0/TaskNotes/{parentId}/Attachments",
21973
+ parentPath: "/V1.0/TaskNotes",
21974
+ parentField: "taskNoteID",
21975
+ deletable: true,
21976
+ udfCapable: false,
21977
+ attachmentGet: true,
21978
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
21979
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21980
+ opForms: { get: "scoped", create: "scoped", delete: "scoped" }
21981
+ },
21658
21982
  {
21659
21983
  key: "task_notes",
21660
21984
  accessor: "taskNotes",
@@ -21943,10 +22267,10 @@ var SIMPLE_RESOURCES = [
21943
22267
  var GenericResource = class extends BaseResource {
21944
22268
  constructor(http, config, pageSize) {
21945
22269
  super(http, config, pageSize);
21946
- if (["company_attachments", "company_note_attachments", "task_attachments"].includes(config.key)) this.getUdfInfo = async () => {
22270
+ if (["company_attachments", "company_note_attachments", "configuration_item_attachments", "task_attachments", "task_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
21947
22271
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
21948
22272
  };
21949
- if (config.ops?.create === false || ["company_attachments", "task_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
22273
+ if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
21950
22274
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
21951
22275
  };
21952
22276
  if (config.key === "task_notes") {
@@ -21978,15 +22302,18 @@ var GenericResource = class extends BaseResource {
21978
22302
  }
21979
22303
  async getScopedModel(parentId, id, fresh = false) {
21980
22304
  const model = await super.getScopedModel(parentId, id, fresh);
21981
- if (this.config.key === "task_attachments") assertTaskAttachmentIdentity(model, parentId, id);
22305
+ const key = this.config.key;
22306
+ if (isScopedAttachmentResource(key)) assertScopedAttachmentIdentity(key, model, parentId, id);
21982
22307
  return model;
21983
22308
  }
21984
22309
  async fetchPage(params, page, pageSize, state2) {
21985
- if (this.config.key === "task_attachments") admitTaskAttachmentQuery(params);
22310
+ const key = this.config.key;
22311
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
21986
22312
  return super.fetchPage(params, page, pageSize, state2);
21987
22313
  }
21988
22314
  async countGlobal(params) {
21989
- if (this.config.key === "task_attachments") admitTaskAttachmentQuery(params);
22315
+ const key = this.config.key;
22316
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
21990
22317
  return super.countGlobal(params);
21991
22318
  }
21992
22319
  /** Query records with the G3 filter surface (server-side JSON filter). */
@@ -22028,7 +22355,11 @@ var GenericResource = class extends BaseResource {
22028
22355
  const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(b, parentId, true) : b;
22029
22356
  const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
22030
22357
  if (this.config.key === "task_notes") admitTaskNote(data2, parentId, true);
22031
- if (this.config.key === "task_attachments") admitTaskAttachment(data2, parentId);
22358
+ const key = this.config.key;
22359
+ if (isScopedAttachmentResource(key)) {
22360
+ if (key === "task_attachments") admitTaskAttachment(data2, parentId);
22361
+ else admitFileAttachment(key, data2, parentId);
22362
+ }
22032
22363
  if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, void 0, data2);
22033
22364
  if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
22034
22365
  return this.createScopedRaw(parentId, data2, opts2);
@@ -23819,7 +24150,7 @@ function dateBucketLabel(value, bucket) {
23819
24150
  var queryResourceKeysPromise = null;
23820
24151
  function queryResourceKeys() {
23821
24152
  if (queryResourceKeysPromise === null) {
23822
- queryResourceKeysPromise = chunkVMFQ53HQ_cjs.loadCapabilityRecords().then((records) => {
24153
+ queryResourceKeysPromise = chunk3FZJJX5B_cjs.loadCapabilityRecords().then((records) => {
23823
24154
  const s = /* @__PURE__ */ new Set();
23824
24155
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
23825
24156
  return s;
@@ -23941,7 +24272,7 @@ function parseTopAndLimit(opts, problems) {
23941
24272
  return { top, limit };
23942
24273
  }
23943
24274
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
23944
- const records = resourceKey === void 0 ? [] : await chunkVMFQ53HQ_cjs.loadCapabilityRecords();
24275
+ const records = resourceKey === void 0 ? [] : await chunk3FZJJX5B_cjs.loadCapabilityRecords();
23945
24276
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
23946
24277
  if (record === void 0) return void 0;
23947
24278
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -24586,7 +24917,7 @@ async function uiLink(client, input) {
24586
24917
  var indexPromise = null;
24587
24918
  function operationIndex() {
24588
24919
  if (indexPromise === null) {
24589
- indexPromise = chunkVMFQ53HQ_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
24920
+ indexPromise = chunk3FZJJX5B_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
24590
24921
  }
24591
24922
  return indexPromise;
24592
24923
  }