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,4 +1,4 @@
1
- import { loadCapabilityRecords } from './chunk-OFYXDB5G.js';
1
+ import { loadCapabilityRecords } from './chunk-G2U6NHPO.js';
2
2
  import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-7NKB4UXV.js';
3
3
  import { randomUUID, createHash } from 'crypto';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
@@ -3247,6 +3247,22 @@ var RELATIONSHIP_MAP = {
3247
3247
  "group": "A",
3248
3248
  "parent": null,
3249
3249
  "children": [
3250
+ {
3251
+ "resource": "configuration_item_attachments",
3252
+ "apiEntity": "ConfigurationItemAttachment",
3253
+ "parentField": "configurationItemID",
3254
+ "parentSegment": "Attachments",
3255
+ "tier": "extended",
3256
+ "workflowResource": false,
3257
+ "specialOps": [],
3258
+ "searchCovers": null,
3259
+ "scopedOps": {
3260
+ "create": true,
3261
+ "query": true,
3262
+ "update": false,
3263
+ "delete": true
3264
+ }
3265
+ },
3250
3266
  {
3251
3267
  "resource": "configuration_item_billing_product_associations",
3252
3268
  "apiEntity": "ConfigurationItemBillingProductAssociations",
@@ -9773,7 +9789,24 @@ var RELATIONSHIP_MAP = {
9773
9789
  "segment": "Notes",
9774
9790
  "field": "taskID"
9775
9791
  },
9776
- "children": [],
9792
+ "children": [
9793
+ {
9794
+ "resource": "task_note_attachments",
9795
+ "apiEntity": "TaskNoteAttachment",
9796
+ "parentField": "taskNoteID",
9797
+ "parentSegment": "Attachments",
9798
+ "tier": "extended",
9799
+ "workflowResource": false,
9800
+ "specialOps": [],
9801
+ "searchCovers": null,
9802
+ "scopedOps": {
9803
+ "create": true,
9804
+ "query": true,
9805
+ "update": false,
9806
+ "delete": true
9807
+ }
9808
+ }
9809
+ ],
9777
9810
  "naturalKeys": {
9778
9811
  "hasSearch": false,
9779
9812
  "searchCovers": null,
@@ -9904,6 +9937,141 @@ var RELATIONSHIP_MAP = {
9904
9937
  },
9905
9938
  "deleteBoundary": null,
9906
9939
  "markerField": null
9940
+ },
9941
+ "task_note_attachments": {
9942
+ "resource": "task_note_attachments",
9943
+ "apiEntity": "TaskNoteAttachment",
9944
+ "kind": "entity",
9945
+ "path": "TaskNoteAttachments",
9946
+ "parentScoped": true,
9947
+ "tier": "extended",
9948
+ "workflowResource": false,
9949
+ "group": "A",
9950
+ "parent": {
9951
+ "resource": "task_notes",
9952
+ "segment": "Attachments",
9953
+ "field": "taskNoteID"
9954
+ },
9955
+ "children": [],
9956
+ "naturalKeys": {
9957
+ "hasSearch": false,
9958
+ "searchCovers": null,
9959
+ "findBy": []
9960
+ },
9961
+ "blindSurfaces": null,
9962
+ "zoneFacts": {
9963
+ "createGuidance": {
9964
+ "createOp": "task_note_attachments.create",
9965
+ "parentScoped": true,
9966
+ "liveProvenPrefix": [],
9967
+ "unproven": true,
9968
+ "blocker": {
9969
+ "kind": "unknown",
9970
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
9971
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
9972
+ "requires": {
9973
+ "allOf": [
9974
+ "attachmentType",
9975
+ "fullPath",
9976
+ "title",
9977
+ "publish",
9978
+ "data"
9979
+ ]
9980
+ }
9981
+ },
9982
+ "requiresByValue": [
9983
+ {
9984
+ "field": "attachmentType",
9985
+ "value": "FILE_ATTACHMENT",
9986
+ "requires": {
9987
+ "allOf": [
9988
+ "data"
9989
+ ]
9990
+ }
9991
+ }
9992
+ ],
9993
+ "vendorEvidence": [
9994
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskNoteAttachmentsEntity.htm",
9995
+ "https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
9996
+ "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."
9997
+ ],
9998
+ "deleteBoundary": {
9999
+ "available": true,
10000
+ "note": null
10001
+ }
10002
+ }
10003
+ },
10004
+ "deleteBoundary": null,
10005
+ "markerField": null
10006
+ },
10007
+ "configuration_item_attachments": {
10008
+ "resource": "configuration_item_attachments",
10009
+ "apiEntity": "ConfigurationItemAttachment",
10010
+ "kind": "entity",
10011
+ "path": "ConfigurationItemAttachments",
10012
+ "parentScoped": true,
10013
+ "tier": "extended",
10014
+ "workflowResource": false,
10015
+ "group": "A",
10016
+ "parent": {
10017
+ "resource": "configuration_items",
10018
+ "segment": "Attachments",
10019
+ "field": "configurationItemID"
10020
+ },
10021
+ "children": [],
10022
+ "naturalKeys": {
10023
+ "hasSearch": false,
10024
+ "searchCovers": null,
10025
+ "findBy": []
10026
+ },
10027
+ "blindSurfaces": null,
10028
+ "zoneFacts": {
10029
+ "createGuidance": {
10030
+ "createOp": "configuration_item_attachments.create",
10031
+ "parentScoped": true,
10032
+ "liveProvenPrefix": [],
10033
+ "unproven": true,
10034
+ "blocker": {
10035
+ "kind": "unknown",
10036
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
10037
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
10038
+ "requires": {
10039
+ "allOf": [
10040
+ "attachmentType",
10041
+ "fullPath",
10042
+ "title",
10043
+ "publish",
10044
+ "data"
10045
+ ]
10046
+ }
10047
+ },
10048
+ "requiresByValue": [
10049
+ {
10050
+ "field": "attachmentType",
10051
+ "value": "FILE_ATTACHMENT",
10052
+ "requires": {
10053
+ "allOf": [
10054
+ "data"
10055
+ ]
10056
+ }
10057
+ }
10058
+ ],
10059
+ "vendorEvidence": [
10060
+ "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."
10061
+ ],
10062
+ "deleteBoundary": {
10063
+ "available": true,
10064
+ "note": null
10065
+ },
10066
+ "parentCompany": {
10067
+ "via": "configurationItemID",
10068
+ "resource": "configuration_items",
10069
+ "field": "companyID"
10070
+ }
10071
+ }
10072
+ },
10073
+ "deleteBoundary": null,
10074
+ "markerField": null
9907
10075
  }
9908
10076
  };
9909
10077
  var BLIND_SURFACE_STAMPS = {
@@ -11742,6 +11910,50 @@ var CREATE_GUIDANCE = {
11742
11910
  "note": null
11743
11911
  }
11744
11912
  },
11913
+ {
11914
+ "resource": "configuration_item_attachments",
11915
+ "createOp": "configuration_item_attachments.create",
11916
+ "parentScoped": true,
11917
+ "liveProvenPrefix": [],
11918
+ "unproven": true,
11919
+ "blocker": {
11920
+ "kind": "unknown",
11921
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
11922
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
11923
+ "requires": {
11924
+ "allOf": [
11925
+ "attachmentType",
11926
+ "fullPath",
11927
+ "title",
11928
+ "publish",
11929
+ "data"
11930
+ ]
11931
+ }
11932
+ },
11933
+ "vendorEvidence": [
11934
+ "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."
11935
+ ],
11936
+ "deleteBoundary": {
11937
+ "available": true,
11938
+ "note": null
11939
+ },
11940
+ "requiresByValue": [
11941
+ {
11942
+ "field": "attachmentType",
11943
+ "value": "FILE_ATTACHMENT",
11944
+ "requires": {
11945
+ "allOf": [
11946
+ "data"
11947
+ ]
11948
+ }
11949
+ }
11950
+ ],
11951
+ "parentCompany": {
11952
+ "via": "configurationItemID",
11953
+ "resource": "configuration_items",
11954
+ "field": "companyID"
11955
+ }
11956
+ },
11745
11957
  {
11746
11958
  "resource": "configuration_item_billing_product_associations",
11747
11959
  "createOp": "configuration_item_billing_product_associations.create",
@@ -13491,6 +13703,47 @@ var CREATE_GUIDANCE = {
13491
13703
  }
13492
13704
  ]
13493
13705
  },
13706
+ {
13707
+ "resource": "task_note_attachments",
13708
+ "createOp": "task_note_attachments.create",
13709
+ "parentScoped": true,
13710
+ "liveProvenPrefix": [],
13711
+ "unproven": true,
13712
+ "blocker": {
13713
+ "kind": "unknown",
13714
+ "message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
13715
+ "remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
13716
+ "requires": {
13717
+ "allOf": [
13718
+ "attachmentType",
13719
+ "fullPath",
13720
+ "title",
13721
+ "publish",
13722
+ "data"
13723
+ ]
13724
+ }
13725
+ },
13726
+ "vendorEvidence": [
13727
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskNoteAttachmentsEntity.htm",
13728
+ "https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
13729
+ "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."
13730
+ ],
13731
+ "deleteBoundary": {
13732
+ "available": true,
13733
+ "note": null
13734
+ },
13735
+ "requiresByValue": [
13736
+ {
13737
+ "field": "attachmentType",
13738
+ "value": "FILE_ATTACHMENT",
13739
+ "requires": {
13740
+ "allOf": [
13741
+ "data"
13742
+ ]
13743
+ }
13744
+ }
13745
+ ]
13746
+ },
13494
13747
  {
13495
13748
  "resource": "task_notes",
13496
13749
  "createOp": "task_notes.create",
@@ -14084,7 +14337,7 @@ var CREATE_GUIDANCE = {
14084
14337
  }
14085
14338
  ],
14086
14339
  "counts": {
14087
- "total": 105,
14340
+ "total": 107,
14088
14341
  "byKind": {
14089
14342
  "ok": 41,
14090
14343
  "blind-reference": 16,
@@ -14094,7 +14347,7 @@ var CREATE_GUIDANCE = {
14094
14347
  "resource-role-pair": 2,
14095
14348
  "delete-absent": 0,
14096
14349
  "non-mutable": 0,
14097
- "unknown": 29
14350
+ "unknown": 31
14098
14351
  }
14099
14352
  }
14100
14353
  };
@@ -14827,6 +15080,12 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
14827
15080
  ],
14828
15081
  "task_attachments": [
14829
15082
  "title"
15083
+ ],
15084
+ "task_note_attachments": [
15085
+ "title"
15086
+ ],
15087
+ "configuration_item_attachments": [
15088
+ "title"
14830
15089
  ]
14831
15090
  };
14832
15091
 
@@ -17831,6 +18090,7 @@ var MODEL_FIELD_SETS = {
17831
18090
  "company_notes": ["id", "actionType", "assignedResourceID", "companyID", "completedDateTime", "contactID", "createDateTime", "endDateTime", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastModifiedDate", "name", "note", "opportunityID", "startDateTime", "soapParentPropertyId"],
17832
18091
  "company_site_configurations": ["id", "companyID", "locationName", "soapParentPropertyId", "userDefinedFields"],
17833
18092
  "company_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
18093
+ "configuration_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "configurationItemID", "configurationItemNoteID", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
17834
18094
  "configuration_item_billing_product_associations": ["id", "billingProductID", "configurationItemID", "effectiveDate", "expirationDate", "soapParentPropertyId"],
17835
18095
  "configuration_item_categories": ["id", "displayColorRGB", "isActive", "isClientPortalDefault", "isGlobalDefault", "name", "nickname"],
17836
18096
  "configuration_item_category_udf_associations": ["id", "configurationItemCategoryID", "isRequired", "userDefinedFieldDefinitionID", "soapParentPropertyId"],
@@ -17922,6 +18182,7 @@ var MODEL_FIELD_SETS = {
17922
18182
  "tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
17923
18183
  "tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
17924
18184
  "task_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "taskID", "taskNoteID", "timeEntryID", "title", "data", "isTaskAttachment", "parentType", "soapParentPropertyId"],
18185
+ "task_note_attachments": ["id", "isTaskAttachment", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "taskID", "taskNoteID", "title", "data", "parentType", "soapParentPropertyId"],
17925
18186
  "task_notes": ["id", "createDateTime", "creatorResourceID", "createdByContactID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "taskID", "title", "soapParentPropertyId"],
17926
18187
  "task_predecessors": ["id", "lagDays", "predecessorTaskID", "successorTaskID", "soapParentPropertyId"],
17927
18188
  "task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
@@ -17957,6 +18218,7 @@ var MODEL_DATE_FIELDS = {
17957
18218
  "company_attachments": ["attachDate"],
17958
18219
  "company_note_attachments": ["attachDate"],
17959
18220
  "company_notes": ["completedDateTime", "createDateTime", "endDateTime", "lastModifiedDate", "startDateTime"],
18221
+ "configuration_item_attachments": ["attachDate"],
17960
18222
  "configuration_item_billing_product_associations": ["effectiveDate", "expirationDate"],
17961
18223
  "configuration_item_dns_records": ["createDateTime"],
17962
18224
  "configuration_item_notes": ["createDateTime", "lastActivityDate"],
@@ -18001,6 +18263,7 @@ var MODEL_DATE_FIELDS = {
18001
18263
  "survey_results": ["completeDate", "sendDate"],
18002
18264
  "tags": ["createDateTime", "lastModifiedDateTime"],
18003
18265
  "task_attachments": ["attachDate"],
18266
+ "task_note_attachments": ["attachDate"],
18004
18267
  "task_notes": ["createDateTime", "lastActivityDate"],
18005
18268
  "tasks": ["completedDateTime", "createDateTime", "endDateTime", "lastActivityDateTime", "startDateTime"],
18006
18269
  "ticket_attachments": ["attachDate"],
@@ -20354,9 +20617,21 @@ async function findUnknownFieldNames(record, holder, lists) {
20354
20617
  return { known: resolved.known, authority: resolved.authority, unknown };
20355
20618
  }
20356
20619
 
20357
- // src/resources/special/taskAttachments.ts
20620
+ // src/resources/special/scopedAttachments.ts
20358
20621
  var WRITABLE2 = /* @__PURE__ */ new Set(["attachmentType", "contentType", "data", "fullPath", "parentAttachmentID", "publish", "taskID", "title"]);
20622
+ var FILE_WRITABLE = /* @__PURE__ */ new Set(["attachmentType", "data", "fullPath", "publish", "title"]);
20359
20623
  var NON_QUERYABLE = /* @__PURE__ */ new Set(["creatortype", "data", "filesize"]);
20624
+ var SCOPED_ATTACHMENT_PARENTS = {
20625
+ task_attachments: { field: "taskID", name: "task" },
20626
+ task_note_attachments: { field: "taskNoteID", name: "task note" },
20627
+ configuration_item_attachments: { field: "configurationItemID", name: "configuration item" }
20628
+ };
20629
+ function isScopedAttachmentResource(resource) {
20630
+ return Object.hasOwn(SCOPED_ATTACHMENT_PARENTS, resource);
20631
+ }
20632
+ function isBase64(value) {
20633
+ return value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
20634
+ }
20360
20635
  function admitTaskAttachment(data, parentId) {
20361
20636
  const parent = parseIdentifier(parentId, "parentId");
20362
20637
  const fail2 = (message) => {
@@ -20374,7 +20649,7 @@ function admitTaskAttachment(data, parentId) {
20374
20649
  }
20375
20650
  if (body.attachmentType === "FILE_ATTACHMENT") {
20376
20651
  if (typeof body.data !== "string" || body.data === "") return fail2("FILE_ATTACHMENT requires non-empty base64 data");
20377
- if (body.data.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(body.data)) fail2("FILE_ATTACHMENT data must be base64 encoded");
20652
+ if (!isBase64(body.data)) fail2("FILE_ATTACHMENT data must be base64 encoded");
20378
20653
  }
20379
20654
  if (body.taskID !== void 0) {
20380
20655
  if (typeof body.taskID !== "number") fail2("taskID must be a numeric identifier");
@@ -20385,13 +20660,33 @@ function admitTaskAttachment(data, parentId) {
20385
20660
  parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
20386
20661
  }
20387
20662
  }
20388
- function admitTaskAttachmentQuery(params) {
20389
- const fields = collectFilterFieldNames(normalizedConditions(params?.filter) ?? [], "task_attachments");
20663
+ function admitFileAttachment(resource, data, parentId) {
20664
+ parseIdentifier(parentId, "parentId");
20665
+ const fail2 = (message) => {
20666
+ throw new AutotaskConfigError(`${resource}: ${message}`);
20667
+ };
20668
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
20669
+ const body = data;
20670
+ const reference = resource === "task_note_attachments" ? "attachedByContactID" : "parentAttachmentID";
20671
+ for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference) fail2(`${field} is not a supported create field`);
20672
+ if (body.attachmentType !== "FILE_ATTACHMENT") fail2("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
20673
+ for (const field of ["fullPath", "title"]) {
20674
+ 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`);
20675
+ }
20676
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail2("publish must be an integer from current field metadata");
20677
+ if (typeof body.data !== "string" || !isBase64(body.data)) fail2("FILE_ATTACHMENT requires nonempty base64 data");
20678
+ if (body[reference] !== void 0) {
20679
+ if (typeof body[reference] !== "number") fail2(`${reference} must be a numeric identifier`);
20680
+ if (parseIdentifier(body[reference], reference) === 0) fail2(`${reference} must be positive`);
20681
+ }
20682
+ }
20683
+ function admitScopedAttachmentQuery(resource, params) {
20684
+ const fields = collectFilterFieldNames(normalizedConditions(params?.filter) ?? [], resource);
20390
20685
  for (const field of fields) {
20391
- if (NON_QUERYABLE.has(field.toLowerCase())) throw new AutotaskConfigError(`task_attachments: ${field} is not queryable`);
20686
+ if (NON_QUERYABLE.has(field.toLowerCase())) throw new AutotaskConfigError(`${resource}: ${field} is not queryable`);
20392
20687
  }
20393
20688
  }
20394
- function assertTaskAttachmentIdentity(model, parentId, id) {
20689
+ function assertScopedAttachmentIdentity(resource, model, parentId, id) {
20395
20690
  const matches = (value, expected) => {
20396
20691
  try {
20397
20692
  return parseIdentifier(value) === parseIdentifier(expected);
@@ -20399,11 +20694,12 @@ function assertTaskAttachmentIdentity(model, parentId, id) {
20399
20694
  return false;
20400
20695
  }
20401
20696
  };
20402
- if (!isRecord2(model) || !matches(model.id, id) || model.taskID != null && !matches(model.taskID, parentId)) {
20403
- throw new AutotaskError("Returned attachment identifiers contradict the requested task or attachment", {
20697
+ const { field: parentField, name: parentName } = SCOPED_ATTACHMENT_PARENTS[resource];
20698
+ if (!isRecord2(model) || !matches(model.id, id) || model[parentField] != null && !matches(model[parentField], parentId)) {
20699
+ throw new AutotaskError(`Returned attachment identifiers contradict the requested ${parentName} or attachment`, {
20404
20700
  code: "INVALID_RESPONSE",
20405
20701
  category: "server",
20406
- operation: "task_attachments.get"
20702
+ operation: `${resource}.get`
20407
20703
  });
20408
20704
  }
20409
20705
  }
@@ -20607,6 +20903,20 @@ var SIMPLE_RESOURCES = [
20607
20903
  helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
20608
20904
  opForms: { get: "global", create: "global", update: "global", delete: "global" }
20609
20905
  },
20906
+ {
20907
+ key: "configuration_item_attachments",
20908
+ accessor: "configurationItemAttachments",
20909
+ resourcePath: "/V1.0/ConfigurationItemAttachments",
20910
+ parentScopedPath: "/V1.0/ConfigurationItems/{parentId}/Attachments",
20911
+ parentPath: "/V1.0/ConfigurationItems",
20912
+ parentField: "configurationItemID",
20913
+ deletable: true,
20914
+ udfCapable: false,
20915
+ attachmentGet: true,
20916
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
20917
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
20918
+ opForms: { get: "scoped", create: "scoped", delete: "scoped" }
20919
+ },
20610
20920
  {
20611
20921
  key: "configuration_item_billing_product_associations",
20612
20922
  accessor: "configurationItemBillingProductAssociations",
@@ -21653,6 +21963,20 @@ var SIMPLE_RESOURCES = [
21653
21963
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21654
21964
  opForms: { get: "scoped", create: "scoped", delete: "scoped" }
21655
21965
  },
21966
+ {
21967
+ key: "task_note_attachments",
21968
+ accessor: "taskNoteAttachments",
21969
+ resourcePath: "/V1.0/TaskNoteAttachments",
21970
+ parentScopedPath: "/V1.0/TaskNotes/{parentId}/Attachments",
21971
+ parentPath: "/V1.0/TaskNotes",
21972
+ parentField: "taskNoteID",
21973
+ deletable: true,
21974
+ udfCapable: false,
21975
+ attachmentGet: true,
21976
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
21977
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21978
+ opForms: { get: "scoped", create: "scoped", delete: "scoped" }
21979
+ },
21656
21980
  {
21657
21981
  key: "task_notes",
21658
21982
  accessor: "taskNotes",
@@ -21941,10 +22265,10 @@ var SIMPLE_RESOURCES = [
21941
22265
  var GenericResource = class extends BaseResource {
21942
22266
  constructor(http, config, pageSize) {
21943
22267
  super(http, config, pageSize);
21944
- if (["company_attachments", "company_note_attachments", "task_attachments"].includes(config.key)) this.getUdfInfo = async () => {
22268
+ if (["company_attachments", "company_note_attachments", "configuration_item_attachments", "task_attachments", "task_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
21945
22269
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
21946
22270
  };
21947
- if (config.ops?.create === false || ["company_attachments", "task_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
22271
+ if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
21948
22272
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
21949
22273
  };
21950
22274
  if (config.key === "task_notes") {
@@ -21976,15 +22300,18 @@ var GenericResource = class extends BaseResource {
21976
22300
  }
21977
22301
  async getScopedModel(parentId, id, fresh = false) {
21978
22302
  const model = await super.getScopedModel(parentId, id, fresh);
21979
- if (this.config.key === "task_attachments") assertTaskAttachmentIdentity(model, parentId, id);
22303
+ const key = this.config.key;
22304
+ if (isScopedAttachmentResource(key)) assertScopedAttachmentIdentity(key, model, parentId, id);
21980
22305
  return model;
21981
22306
  }
21982
22307
  async fetchPage(params, page, pageSize, state2) {
21983
- if (this.config.key === "task_attachments") admitTaskAttachmentQuery(params);
22308
+ const key = this.config.key;
22309
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
21984
22310
  return super.fetchPage(params, page, pageSize, state2);
21985
22311
  }
21986
22312
  async countGlobal(params) {
21987
- if (this.config.key === "task_attachments") admitTaskAttachmentQuery(params);
22313
+ const key = this.config.key;
22314
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
21988
22315
  return super.countGlobal(params);
21989
22316
  }
21990
22317
  /** Query records with the G3 filter surface (server-side JSON filter). */
@@ -22026,7 +22353,11 @@ var GenericResource = class extends BaseResource {
22026
22353
  const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(b, parentId, true) : b;
22027
22354
  const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
22028
22355
  if (this.config.key === "task_notes") admitTaskNote(data2, parentId, true);
22029
- if (this.config.key === "task_attachments") admitTaskAttachment(data2, parentId);
22356
+ const key = this.config.key;
22357
+ if (isScopedAttachmentResource(key)) {
22358
+ if (key === "task_attachments") admitTaskAttachment(data2, parentId);
22359
+ else admitFileAttachment(key, data2, parentId);
22360
+ }
22030
22361
  if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, void 0, data2);
22031
22362
  if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
22032
22363
  return this.createScopedRaw(parentId, data2, opts2);
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "3732a92572dcff19995b19cf9ba1dec6156153313f5d54704d1cca885d1aff45",
4
- "A": "3732a92572dcff19995b19cf9ba1dec6156153313f5d54704d1cca885d1aff45",
5
- "operations": "3732a92572dcff19995b19cf9ba1dec6156153313f5d54704d1cca885d1aff45"
3
+ "B": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42",
4
+ "A": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42",
5
+ "operations": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42"
6
6
  };
7
7
  var cached = null;
8
8
  function loadCapabilities() {