node-autotask 0.76.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 +6 -0
  2. package/MCP_TOOL_CATALOG.json +137 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +483 -7
  5. package/dist/capabilities-data.js +482 -6
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-C4S3EKIK.cjs → chunk-3FZJJX5B.cjs} +3 -3
  9. package/dist/{chunk-55BQEFBO.cjs → chunk-5MH3MPLB.cjs} +31 -30
  10. package/dist/{chunk-Y4BH5N6R.cjs → chunk-6VBOBCWA.cjs} +186 -27
  11. package/dist/{chunk-3SFIKG2R.js → chunk-F5Y7WBWY.js} +181 -22
  12. package/dist/{chunk-ECSE6B3U.js → chunk-G2U6NHPO.js} +3 -3
  13. package/dist/{chunk-YRTOAPWD.cjs → chunk-NAI7XIX4.cjs} +199 -199
  14. package/dist/{chunk-UFK7JYYC.js → chunk-QTFK2HAO.js} +3 -2
  15. package/dist/{chunk-S7QPD6TR.js → chunk-RLXUY4VM.js} +2 -2
  16. package/dist/{index-BbAzrm2i.d.cts → index-B-vNyiD_.d.cts} +47 -1
  17. package/dist/{index-BbAzrm2i.d.ts → index-B-vNyiD_.d.ts} +47 -1
  18. package/dist/{index-MY7qYY5d.d.cts → index-PLdAoAFJ.d.cts} +3 -2
  19. package/dist/{index-CY7exGOe.d.ts → index-ecr6unv3.d.ts} +3 -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 +3 -2
  39. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { loadCapabilityRecords } from './chunk-ECSE6B3U.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",
@@ -9987,6 +10003,75 @@ var RELATIONSHIP_MAP = {
9987
10003
  },
9988
10004
  "deleteBoundary": null,
9989
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
9990
10075
  }
9991
10076
  };
9992
10077
  var BLIND_SURFACE_STAMPS = {
@@ -11825,6 +11910,50 @@ var CREATE_GUIDANCE = {
11825
11910
  "note": null
11826
11911
  }
11827
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
+ },
11828
11957
  {
11829
11958
  "resource": "configuration_item_billing_product_associations",
11830
11959
  "createOp": "configuration_item_billing_product_associations.create",
@@ -14208,7 +14337,7 @@ var CREATE_GUIDANCE = {
14208
14337
  }
14209
14338
  ],
14210
14339
  "counts": {
14211
- "total": 106,
14340
+ "total": 107,
14212
14341
  "byKind": {
14213
14342
  "ok": 41,
14214
14343
  "blind-reference": 16,
@@ -14218,7 +14347,7 @@ var CREATE_GUIDANCE = {
14218
14347
  "resource-role-pair": 2,
14219
14348
  "delete-absent": 0,
14220
14349
  "non-mutable": 0,
14221
- "unknown": 30
14350
+ "unknown": 31
14222
14351
  }
14223
14352
  }
14224
14353
  };
@@ -14954,6 +15083,9 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
14954
15083
  ],
14955
15084
  "task_note_attachments": [
14956
15085
  "title"
15086
+ ],
15087
+ "configuration_item_attachments": [
15088
+ "title"
14957
15089
  ]
14958
15090
  };
14959
15091
 
@@ -17958,6 +18090,7 @@ var MODEL_FIELD_SETS = {
17958
18090
  "company_notes": ["id", "actionType", "assignedResourceID", "companyID", "completedDateTime", "contactID", "createDateTime", "endDateTime", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastModifiedDate", "name", "note", "opportunityID", "startDateTime", "soapParentPropertyId"],
17959
18091
  "company_site_configurations": ["id", "companyID", "locationName", "soapParentPropertyId", "userDefinedFields"],
17960
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"],
17961
18094
  "configuration_item_billing_product_associations": ["id", "billingProductID", "configurationItemID", "effectiveDate", "expirationDate", "soapParentPropertyId"],
17962
18095
  "configuration_item_categories": ["id", "displayColorRGB", "isActive", "isClientPortalDefault", "isGlobalDefault", "name", "nickname"],
17963
18096
  "configuration_item_category_udf_associations": ["id", "configurationItemCategoryID", "isRequired", "userDefinedFieldDefinitionID", "soapParentPropertyId"],
@@ -18085,6 +18218,7 @@ var MODEL_DATE_FIELDS = {
18085
18218
  "company_attachments": ["attachDate"],
18086
18219
  "company_note_attachments": ["attachDate"],
18087
18220
  "company_notes": ["completedDateTime", "createDateTime", "endDateTime", "lastModifiedDate", "startDateTime"],
18221
+ "configuration_item_attachments": ["attachDate"],
18088
18222
  "configuration_item_billing_product_associations": ["effectiveDate", "expirationDate"],
18089
18223
  "configuration_item_dns_records": ["createDateTime"],
18090
18224
  "configuration_item_notes": ["createDateTime", "lastActivityDate"],
@@ -20483,10 +20617,18 @@ async function findUnknownFieldNames(record, holder, lists) {
20483
20617
  return { known: resolved.known, authority: resolved.authority, unknown };
20484
20618
  }
20485
20619
 
20486
- // src/resources/special/taskAttachments.ts
20620
+ // src/resources/special/scopedAttachments.ts
20487
20621
  var WRITABLE2 = /* @__PURE__ */ new Set(["attachmentType", "contentType", "data", "fullPath", "parentAttachmentID", "publish", "taskID", "title"]);
20488
- var NOTE_WRITABLE = /* @__PURE__ */ new Set(["attachmentType", "data", "fullPath", "publish", "title", "attachedByContactID"]);
20622
+ var FILE_WRITABLE = /* @__PURE__ */ new Set(["attachmentType", "data", "fullPath", "publish", "title"]);
20489
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
+ }
20490
20632
  function isBase64(value) {
20491
20633
  return value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
20492
20634
  }
@@ -20518,32 +20660,33 @@ function admitTaskAttachment(data, parentId) {
20518
20660
  parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
20519
20661
  }
20520
20662
  }
20521
- function admitTaskNoteAttachment(data, parentId) {
20663
+ function admitFileAttachment(resource, data, parentId) {
20522
20664
  parseIdentifier(parentId, "parentId");
20523
20665
  const fail2 = (message) => {
20524
- throw new AutotaskConfigError(`task_note_attachments: ${message}`);
20666
+ throw new AutotaskConfigError(`${resource}: ${message}`);
20525
20667
  };
20526
20668
  if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
20527
20669
  const body = data;
20528
- for (const field of Object.keys(body)) if (!NOTE_WRITABLE.has(field)) fail2(`${field} is not a supported create field`);
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`);
20529
20672
  if (body.attachmentType !== "FILE_ATTACHMENT") fail2("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
20530
20673
  for (const field of ["fullPath", "title"]) {
20531
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`);
20532
20675
  }
20533
20676
  if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail2("publish must be an integer from current field metadata");
20534
20677
  if (typeof body.data !== "string" || !isBase64(body.data)) fail2("FILE_ATTACHMENT requires nonempty base64 data");
20535
- if (body.attachedByContactID !== void 0) {
20536
- if (typeof body.attachedByContactID !== "number") fail2("attachedByContactID must be a numeric identifier");
20537
- if (parseIdentifier(body.attachedByContactID, "attachedByContactID") === 0) fail2("attachedByContactID must be positive");
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`);
20538
20681
  }
20539
20682
  }
20540
- function admitTaskAttachmentQuery(resource, params) {
20683
+ function admitScopedAttachmentQuery(resource, params) {
20541
20684
  const fields = collectFilterFieldNames(normalizedConditions(params?.filter) ?? [], resource);
20542
20685
  for (const field of fields) {
20543
20686
  if (NON_QUERYABLE.has(field.toLowerCase())) throw new AutotaskConfigError(`${resource}: ${field} is not queryable`);
20544
20687
  }
20545
20688
  }
20546
- function assertTaskAttachmentIdentity(resource, model, parentId, id) {
20689
+ function assertScopedAttachmentIdentity(resource, model, parentId, id) {
20547
20690
  const matches = (value, expected) => {
20548
20691
  try {
20549
20692
  return parseIdentifier(value) === parseIdentifier(expected);
@@ -20551,9 +20694,8 @@ function assertTaskAttachmentIdentity(resource, model, parentId, id) {
20551
20694
  return false;
20552
20695
  }
20553
20696
  };
20554
- const parentField = resource === "task_attachments" ? "taskID" : "taskNoteID";
20697
+ const { field: parentField, name: parentName } = SCOPED_ATTACHMENT_PARENTS[resource];
20555
20698
  if (!isRecord2(model) || !matches(model.id, id) || model[parentField] != null && !matches(model[parentField], parentId)) {
20556
- const parentName = resource === "task_attachments" ? "task" : "task note";
20557
20699
  throw new AutotaskError(`Returned attachment identifiers contradict the requested ${parentName} or attachment`, {
20558
20700
  code: "INVALID_RESPONSE",
20559
20701
  category: "server",
@@ -20761,6 +20903,20 @@ var SIMPLE_RESOURCES = [
20761
20903
  helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
20762
20904
  opForms: { get: "global", create: "global", update: "global", delete: "global" }
20763
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
+ },
20764
20920
  {
20765
20921
  key: "configuration_item_billing_product_associations",
20766
20922
  accessor: "configurationItemBillingProductAssociations",
@@ -22109,10 +22265,10 @@ var SIMPLE_RESOURCES = [
22109
22265
  var GenericResource = class extends BaseResource {
22110
22266
  constructor(http, config, pageSize) {
22111
22267
  super(http, config, pageSize);
22112
- if (["company_attachments", "company_note_attachments", "task_attachments", "task_note_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 () => {
22113
22269
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
22114
22270
  };
22115
- if (config.ops?.create === false || ["company_attachments", "task_attachments", "task_note_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 () => {
22116
22272
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
22117
22273
  };
22118
22274
  if (config.key === "task_notes") {
@@ -22145,17 +22301,17 @@ var GenericResource = class extends BaseResource {
22145
22301
  async getScopedModel(parentId, id, fresh = false) {
22146
22302
  const model = await super.getScopedModel(parentId, id, fresh);
22147
22303
  const key = this.config.key;
22148
- if (key === "task_attachments" || key === "task_note_attachments") assertTaskAttachmentIdentity(key, model, parentId, id);
22304
+ if (isScopedAttachmentResource(key)) assertScopedAttachmentIdentity(key, model, parentId, id);
22149
22305
  return model;
22150
22306
  }
22151
22307
  async fetchPage(params, page, pageSize, state2) {
22152
22308
  const key = this.config.key;
22153
- if (key === "task_attachments" || key === "task_note_attachments") admitTaskAttachmentQuery(key, params);
22309
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
22154
22310
  return super.fetchPage(params, page, pageSize, state2);
22155
22311
  }
22156
22312
  async countGlobal(params) {
22157
22313
  const key = this.config.key;
22158
- if (key === "task_attachments" || key === "task_note_attachments") admitTaskAttachmentQuery(key, params);
22314
+ if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
22159
22315
  return super.countGlobal(params);
22160
22316
  }
22161
22317
  /** Query records with the G3 filter surface (server-side JSON filter). */
@@ -22197,8 +22353,11 @@ var GenericResource = class extends BaseResource {
22197
22353
  const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(b, parentId, true) : b;
22198
22354
  const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
22199
22355
  if (this.config.key === "task_notes") admitTaskNote(data2, parentId, true);
22200
- if (this.config.key === "task_attachments") admitTaskAttachment(data2, parentId);
22201
- if (this.config.key === "task_note_attachments") admitTaskNoteAttachment(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
+ }
22202
22361
  if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, void 0, data2);
22203
22362
  if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
22204
22363
  return this.createScopedRaw(parentId, data2, opts2);
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "ad752908bb8c2b868f1df63ba52fd308bd4eaec8e6c9c9182f97504ad79f5ca4",
4
- "A": "ad752908bb8c2b868f1df63ba52fd308bd4eaec8e6c9c9182f97504ad79f5ca4",
5
- "operations": "ad752908bb8c2b868f1df63ba52fd308bd4eaec8e6c9c9182f97504ad79f5ca4"
3
+ "B": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42",
4
+ "A": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42",
5
+ "operations": "3b14a93bbda886bce89c87d61ba40092f9acf6a829a959f042be1c3a0744ed42"
6
6
  };
7
7
  var cached = null;
8
8
  function loadCapabilities() {