node-autotask 0.84.0 → 0.85.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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/MCP_TOOL_CATALOG.json +4 -4
  3. package/capabilities.json +179 -162
  4. package/dist/capabilities-data.js +178 -161
  5. package/dist/capabilities.cjs +4 -4
  6. package/dist/capabilities.js +1 -1
  7. package/dist/{chunk-4NLWSHCB.cjs → chunk-7GNZT7Y7.cjs} +22 -11
  8. package/dist/{chunk-Z56J7TFC.js → chunk-EPJG7M5C.js} +42 -7
  9. package/dist/{chunk-HASLVFC7.js → chunk-GTTAPAGP.js} +3 -3
  10. package/dist/{chunk-RWBOJ5WK.js → chunk-HF5YG4TV.js} +2 -2
  11. package/dist/{chunk-MVGGHMOB.cjs → chunk-JCKYM7FD.cjs} +3 -3
  12. package/dist/{chunk-36RXJUSA.cjs → chunk-JV6MX2U3.cjs} +237 -202
  13. package/dist/{chunk-AWK7FIZD.js → chunk-L6YCH2I4.js} +17 -6
  14. package/dist/{chunk-SNILYCAV.cjs → chunk-PBOH2OHJ.cjs} +30 -30
  15. package/dist/{index-BZItfp_H.d.cts → index-CCW_EpLg.d.cts} +140 -140
  16. package/dist/{index-BZItfp_H.d.ts → index-CCW_EpLg.d.ts} +140 -140
  17. package/dist/{index-DdvYwR2w.d.cts → index-DkyNXWyt.d.cts} +17 -4
  18. package/dist/{index-f1c_EdAt.d.ts → index-rWcPjRpX.d.ts} +17 -4
  19. package/dist/index.cjs +84 -84
  20. package/dist/index.d.cts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +5 -5
  23. package/dist/operations/index.cjs +51 -51
  24. package/dist/operations/index.d.cts +4 -4
  25. package/dist/operations/index.d.ts +4 -4
  26. package/dist/operations/index.js +2 -2
  27. package/dist/pool.cjs +12 -12
  28. package/dist/pool.d.cts +1 -1
  29. package/dist/pool.d.ts +1 -1
  30. package/dist/pool.js +4 -4
  31. package/dist/resources/index.cjs +27 -27
  32. package/dist/resources/index.d.cts +2 -2
  33. package/dist/resources/index.d.ts +2 -2
  34. package/dist/resources/index.js +3 -3
  35. package/dist/types/index.d.cts +1 -1
  36. package/dist/types/index.d.ts +1 -1
  37. package/docs/VENDOR-QUIRKS.md +3 -1
  38. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkMVGGHMOB_cjs = require('./chunk-MVGGHMOB.cjs');
3
+ var chunkJCKYM7FD_cjs = require('./chunk-JCKYM7FD.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "CAPABILITY_PLAN_HASHES", {
8
8
  enumerable: true,
9
- get: function () { return chunkMVGGHMOB_cjs.CAPABILITY_PLAN_HASHES; }
9
+ get: function () { return chunkJCKYM7FD_cjs.CAPABILITY_PLAN_HASHES; }
10
10
  });
11
11
  Object.defineProperty(exports, "loadCapabilities", {
12
12
  enumerable: true,
13
- get: function () { return chunkMVGGHMOB_cjs.loadCapabilities; }
13
+ get: function () { return chunkJCKYM7FD_cjs.loadCapabilities; }
14
14
  });
15
15
  Object.defineProperty(exports, "loadCapabilityRecords", {
16
16
  enumerable: true,
17
- get: function () { return chunkMVGGHMOB_cjs.loadCapabilityRecords; }
17
+ get: function () { return chunkJCKYM7FD_cjs.loadCapabilityRecords; }
18
18
  });
@@ -1 +1 @@
1
- export { CAPABILITY_PLAN_HASHES, loadCapabilities, loadCapabilityRecords } from './chunk-HASLVFC7.js';
1
+ export { CAPABILITY_PLAN_HASHES, loadCapabilities, loadCapabilityRecords } from './chunk-GTTAPAGP.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkMVGGHMOB_cjs = require('./chunk-MVGGHMOB.cjs');
3
+ var chunkJCKYM7FD_cjs = require('./chunk-JCKYM7FD.cjs');
4
4
  var chunkBD4AUGCJ_cjs = require('./chunk-BD4AUGCJ.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
@@ -18066,7 +18066,7 @@ async function capabilitySets() {
18066
18066
  const fieldOps = /* @__PURE__ */ new Map();
18067
18067
  const udfCapable = /* @__PURE__ */ new Set();
18068
18068
  const resources = /* @__PURE__ */ new Set();
18069
- for (const rec of await chunkMVGGHMOB_cjs.loadCapabilityRecords()) {
18069
+ for (const rec of await chunkJCKYM7FD_cjs.loadCapabilityRecords()) {
18070
18070
  if (rec.resource === "operations") continue;
18071
18071
  resources.add(rec.resource);
18072
18072
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -18077,7 +18077,7 @@ async function capabilitySets() {
18077
18077
  var derivedIndexPromise = null;
18078
18078
  function derivedIndexLoad() {
18079
18079
  if (derivedIndexPromise === null) {
18080
- derivedIndexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
18080
+ derivedIndexPromise = chunkJCKYM7FD_cjs.loadCapabilityRecords().then((records) => {
18081
18081
  const index = /* @__PURE__ */ new Map();
18082
18082
  for (const rec of records) {
18083
18083
  const declared = rec.metadata?.derivedFields;
@@ -18866,21 +18866,27 @@ var FK_TABLE_PATH = {
18866
18866
  billingCode: "/V1.0/BillingCodes",
18867
18867
  contract: "/V1.0/Contracts",
18868
18868
  company: "/V1.0/Companies",
18869
- ticket: "/V1.0/Tickets"
18869
+ ticket: "/V1.0/Tickets",
18870
+ product: "/V1.0/Products",
18871
+ configurationItemCategory: "/V1.0/ConfigurationItemCategories"
18870
18872
  };
18871
18873
  var FK_GET_OPERATION = {
18872
18874
  role: "roles.get",
18873
18875
  billingCode: "billing_codes.get",
18874
18876
  contract: "contracts.get",
18875
18877
  company: "companies.get",
18876
- ticket: "tickets.get"
18878
+ ticket: "tickets.get",
18879
+ product: "products.get",
18880
+ configurationItemCategory: "configuration_item_categories.get"
18877
18881
  };
18878
18882
  var FK_NAME_FIELD = {
18879
18883
  role: "name",
18880
18884
  billingCode: "name",
18881
18885
  contract: "contractName",
18882
18886
  company: "companyName",
18883
- ticket: "ticketNumber"
18887
+ ticket: "ticketNumber",
18888
+ product: "name",
18889
+ configurationItemCategory: "name"
18884
18890
  };
18885
18891
  function fkName(record, table) {
18886
18892
  if (table === "ticket") {
@@ -18955,7 +18961,9 @@ async function resolveCompositeNames(http, plan, opts = {}) {
18955
18961
  billingCode: client.billingCodes,
18956
18962
  contract: client.contracts,
18957
18963
  company: client.companies,
18958
- ticket: client.tickets
18964
+ ticket: client.tickets,
18965
+ product: client.products,
18966
+ configurationItemCategory: client.configurationItemCategories
18959
18967
  };
18960
18968
  for (const fk2 of plan.recordFks) {
18961
18969
  const key = `${fk2.table}:${fk2.id}`;
@@ -19585,7 +19593,10 @@ var ROW_FK_TABLES = {
19585
19593
  contractID: "contract",
19586
19594
  ticketID: "ticket",
19587
19595
  roleID: "role",
19588
- billingCodeID: "billingCode"
19596
+ billingCodeID: "billingCode",
19597
+ productID: "product",
19598
+ vendorID: "company",
19599
+ configurationItemCategoryID: "configurationItemCategory"
19589
19600
  };
19590
19601
  var isResourceFkField = (field) => field === "resourceID" || field.endsWith("ResourceID");
19591
19602
  function rowNamePlan(rows, resourceKey, picklistFields = []) {
@@ -25446,7 +25457,7 @@ function dateBucketLabel(value, bucket) {
25446
25457
  var queryResourceKeysPromise = null;
25447
25458
  function queryResourceKeys() {
25448
25459
  if (queryResourceKeysPromise === null) {
25449
- queryResourceKeysPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
25460
+ queryResourceKeysPromise = chunkJCKYM7FD_cjs.loadCapabilityRecords().then((records) => {
25450
25461
  const s = /* @__PURE__ */ new Set();
25451
25462
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
25452
25463
  return s;
@@ -25568,7 +25579,7 @@ function parseTopAndLimit(opts, problems) {
25568
25579
  return { top, limit };
25569
25580
  }
25570
25581
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
25571
- const records = resourceKey === void 0 ? [] : await chunkMVGGHMOB_cjs.loadCapabilityRecords();
25582
+ const records = resourceKey === void 0 ? [] : await chunkJCKYM7FD_cjs.loadCapabilityRecords();
25572
25583
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
25573
25584
  if (record === void 0) return void 0;
25574
25585
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -26219,7 +26230,7 @@ async function uiLink(client, input) {
26219
26230
  var indexPromise = null;
26220
26231
  function operationIndex() {
26221
26232
  if (indexPromise === null) {
26222
- indexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
26233
+ indexPromise = chunkJCKYM7FD_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
26223
26234
  }
26224
26235
  return indexPromise;
26225
26236
  }
@@ -1,5 +1,5 @@
1
- import { GenericResource, readTasks, OperationNotSupportedError, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-AWK7FIZD.js';
2
- import { loadCapabilityRecords } from './chunk-HASLVFC7.js';
1
+ import { GenericResource, readTasks, OperationNotSupportedError, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-L6YCH2I4.js';
2
+ import { loadCapabilityRecords } from './chunk-GTTAPAGP.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -80,6 +80,11 @@ async function moveConfigurationItem(_resource, sourceId, opts) {
80
80
  return { sourceId: numericSource, newId, destinationCompanyId: destId, sourceDeactivated };
81
81
  }
82
82
  var PROFILE_PART_LIMIT = 50;
83
+ var CI_NAME_FKS = [
84
+ ["contractID", "contract"],
85
+ ["companyID", "company"],
86
+ ["vendorID", "company"]
87
+ ];
83
88
  function profilePartLimit(value, name) {
84
89
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
85
90
  if (!Number.isInteger(n) || n < 1) {
@@ -106,6 +111,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
106
111
  throw err;
107
112
  }
108
113
  }
114
+ async function degradable(read) {
115
+ try {
116
+ return { value: await read() };
117
+ } catch (err) {
118
+ if (isAutotaskError(err) && err.code !== "ABORTED") return { fault: err.code };
119
+ throw err;
120
+ }
121
+ }
109
122
  async function ciScopedQuery(http, path, itemID, limit) {
110
123
  const res = await http.request({
111
124
  method: "POST",
@@ -120,15 +133,24 @@ async function profile(resource, id, opts = {}) {
120
133
  const http = resource.http;
121
134
  const noteLimit = profilePartLimit(opts.noteLimit, "noteLimit");
122
135
  const relatedLimit = profilePartLimit(opts.relatedLimit, "relatedLimit");
136
+ const subscriptionLimit = profilePartLimit(opts.subscriptionLimit, "subscriptionLimit");
123
137
  const ci = await resource.get(id);
124
138
  const root = ci;
125
- const [type, category, notes, relatedItems, associations] = await readTasks(http, [
139
+ const productRef = root["productID"] === 0 ? null : root["productID"];
140
+ const [type, category, productRead, notes, relatedItems, associations, subscriptionsRead] = await readTasks(http, [
126
141
  () => contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type"),
127
142
  () => contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category"),
143
+ () => degradable(() => contextFetchPart(http, "/V1.0/Products", productRef, "product")),
128
144
  () => ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit),
129
145
  () => ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit),
130
- () => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT)
146
+ () => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT),
147
+ () => degradable(() => ciScopedQuery(http, "/V1.0/Subscriptions/query", id, subscriptionLimit))
131
148
  ]);
149
+ const product = "value" in productRead ? productRead.value : null;
150
+ const subscriptions = "value" in subscriptionsRead ? subscriptionsRead.value : [];
151
+ const unavailable = {};
152
+ if ("fault" in productRead) unavailable.product = productRead.fault;
153
+ if ("fault" in subscriptionsRead) unavailable.subscriptions = subscriptionsRead.fault;
132
154
  const productAssociations = {
133
155
  items: associations,
134
156
  capped: associations.length >= PROFILE_PART_LIMIT,
@@ -138,24 +160,37 @@ async function profile(resource, id, opts = {}) {
138
160
  ci,
139
161
  type,
140
162
  category,
163
+ product,
141
164
  notes: { items: notes, capped: notes.length >= noteLimit },
142
165
  relatedItems: { items: relatedItems, capped: relatedItems.length >= relatedLimit },
143
166
  productAssociations,
167
+ subscriptions: { items: subscriptions, capped: subscriptions.length >= subscriptionLimit },
144
168
  parts: {
145
169
  ci: "ok",
146
170
  type: type !== null ? "ok" : "absent",
147
171
  category: category !== null ? "ok" : "absent",
172
+ product: unavailable.product !== void 0 ? "unavailable" : product !== null ? "ok" : "absent",
148
173
  notes: "ok",
149
174
  relatedItems: "ok",
150
- productAssociations: "ok"
175
+ productAssociations: "ok",
176
+ subscriptions: unavailable.subscriptions !== void 0 ? "unavailable" : "ok"
151
177
  }
152
178
  };
179
+ if (Object.keys(unavailable).length > 0) result.unavailable = unavailable;
153
180
  if (opts.names === true) {
154
181
  const builder = createNamePlan();
155
- builder.addFk("contract", root["contractID"]);
182
+ for (const [field, table] of CI_NAME_FKS) builder.addFk(table, root[field]);
156
183
  const names = await resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
157
184
  const ciRow = { ...ci };
158
- addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
185
+ for (const [field, table] of CI_NAME_FKS) addNameSibling(ciRow, field, (v) => names.recordName(table, v));
186
+ if (root["productID"] !== void 0) {
187
+ const raw = product?.["name"];
188
+ const name = typeof raw === "string" && raw.trim() !== "" ? raw : null;
189
+ ciRow["productIDName"] = name;
190
+ if (typeof productRef === "number") {
191
+ names.section.rows[`product:${productRef}`] = "fault" in productRead ? { name: null, blind: false, error: { code: productRead.fault, message: "the product part read faulted" } } : { name, blind: product === null };
192
+ }
193
+ }
159
194
  result.ci = ciRow;
160
195
  result.names = names.section;
161
196
  }
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1",
4
- "A": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1",
5
- "operations": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1"
3
+ "B": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735",
4
+ "A": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735",
5
+ "operations": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735"
6
6
  };
7
7
  var cached = null;
8
8
  function loadCapabilities() {
@@ -1,5 +1,5 @@
1
- import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-Z56J7TFC.js';
2
- import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-AWK7FIZD.js';
1
+ import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-EPJG7M5C.js';
2
+ import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-L6YCH2I4.js';
3
3
 
4
4
  // src/client.ts
5
5
  var AutotaskClient = class {
@@ -2,9 +2,9 @@
2
2
 
3
3
  // src/capabilities.ts
4
4
  var CAPABILITY_PLAN_HASHES = {
5
- "B": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1",
6
- "A": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1",
7
- "operations": "5a5cfa013a7d398302f69e1c12e260ea29a89942aec743997be1f8cdf60a8df1"
5
+ "B": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735",
6
+ "A": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735",
7
+ "operations": "9521525945b1306da363ce5fb38649e17c5526f2c0842da64c3bec7993e62735"
8
8
  };
9
9
  var cached = null;
10
10
  function loadCapabilities() {