node-autotask 0.39.0 → 0.39.1

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 +10 -0
  2. package/MCP_TOOL_MANIFEST.md +4 -4
  3. package/N8N_MCP_MANIFEST.json +2 -2
  4. package/N8N_MCP_MANIFEST.md +3 -3
  5. package/capabilities.json +144 -144
  6. package/dist/capabilities.cjs +2 -2
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-KSNK6UEW.cjs → chunk-73QNAEAF.cjs} +143 -143
  9. package/dist/{chunk-OKFTECIE.js → chunk-CQXB7KAO.js} +2 -2
  10. package/dist/{chunk-2KQS3RHQ.js → chunk-GDSCYY2G.js} +143 -143
  11. package/dist/{chunk-6ROB5KXB.cjs → chunk-GIVYTQ6R.cjs} +285 -285
  12. package/dist/{chunk-45PLS73K.cjs → chunk-LB34VFQY.cjs} +132 -99
  13. package/dist/{chunk-LD5UPSDB.js → chunk-LDTJNLX7.js} +2 -2
  14. package/dist/{chunk-FV5PJLIZ.js → chunk-LN3HQQBR.js} +48 -15
  15. package/dist/{chunk-RAZEXOLC.cjs → chunk-VR6RYXTD.cjs} +143 -143
  16. package/dist/{index-Bmoiwhx2.d.ts → index-C-Oqef4y.d.cts} +7169 -51
  17. package/dist/{index-BVOOHPvr.d.cts → index-C-Oqef4y.d.ts} +7169 -51
  18. package/dist/index.cjs +22 -22
  19. package/dist/index.d.cts +2 -4
  20. package/dist/index.d.ts +2 -4
  21. package/dist/index.js +4 -4
  22. package/dist/operations/index.cjs +179 -177
  23. package/dist/operations/index.d.cts +3 -221
  24. package/dist/operations/index.d.ts +3 -221
  25. package/dist/operations/index.js +4 -2
  26. package/dist/pool.cjs +9 -9
  27. package/dist/pool.d.cts +1 -2
  28. package/dist/pool.d.ts +1 -2
  29. package/dist/pool.js +4 -4
  30. package/dist/resources/index.cjs +4 -4
  31. package/dist/resources/index.d.cts +1 -2
  32. package/dist/resources/index.d.ts +1 -2
  33. package/dist/resources/index.js +3 -3
  34. package/dist/types/index.d.cts +1 -1
  35. package/dist/types/index.d.ts +1 -1
  36. package/docs/API.md +37 -7
  37. package/package.json +1 -1
  38. package/dist/index-BQVStxwi.d.cts +0 -6893
  39. package/dist/index-BQVStxwi.d.ts +0 -6893
@@ -30,10 +30,10 @@ import {
30
30
  unwrapItems,
31
31
  unwrapOperation,
32
32
  vendorId
33
- } from "./chunk-FV5PJLIZ.js";
33
+ } from "./chunk-LN3HQQBR.js";
34
34
  import {
35
35
  CAPABILITIES
36
- } from "./chunk-2KQS3RHQ.js";
36
+ } from "./chunk-GDSCYY2G.js";
37
37
 
38
38
  // src/resources/appointments.ts
39
39
  var AppointmentsResource = class extends BaseResource {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CAPABILITIES
3
- } from "./chunk-2KQS3RHQ.js";
3
+ } from "./chunk-GDSCYY2G.js";
4
4
  import {
5
5
  wrapUntrusted
6
6
  } from "./chunk-5VHSLJMR.js";
@@ -20530,6 +20530,7 @@ var BaseResource = class extends MutationBase {
20530
20530
 
20531
20531
  // src/operations/compositeNames.ts
20532
20532
  var PICKLIST_VALUE_NOT_SERVED_NOTE = "The picklist is served to this API user, but this record's value is not in it (an inactive or unexposed value) \u2014 the label cannot be resolved and is null; refreshing the field catalog will not surface it. (A picklist the vendor does not expose at all is reported with the field-catalog honesty note instead.)";
20533
+ var PICKLIST_CATALOG_UNAVAILABLE_NOTE = "The field-catalog read that serves picklist labels failed for this call, so this label is unavailable (null), not absent: the value may well have one. Retry the call once the catalog read succeeds (see names.catalogError).";
20533
20534
  var DEFAULT_MAX_NAME_READS = 20;
20534
20535
  var TICKET_LABEL_FIELDS = ["status", "priority", "ticketType", "issueType", "subIssueType", "source", "queueID"];
20535
20536
  function isVendorId(value) {
@@ -20840,7 +20841,7 @@ async function resolveCompositeNames(http, plan, opts = {}) {
20840
20841
  }
20841
20842
  const hit = values.find((v) => String(v.value) === String(value));
20842
20843
  if (hit === void 0) {
20843
- section.reasons[field] = PICKLIST_VALUE_NOT_SERVED_NOTE;
20844
+ if (String(value) !== "0") section.reasons[field] = PICKLIST_VALUE_NOT_SERVED_NOTE;
20844
20845
  return null;
20845
20846
  }
20846
20847
  return typeof hit.label === "string" ? hit.label : null;
@@ -20861,6 +20862,7 @@ function untrustedName(name) {
20861
20862
  const [[capped]] = truncateNoteChars([{ v: name }], LABEL_NAME_MAX_CHARS, ["v"]);
20862
20863
  return wrapUntrusted(capped.v) ?? capped.v;
20863
20864
  }
20865
+ var lastPicklists = /* @__PURE__ */ new WeakMap();
20864
20866
  function readNamesOpt(value, where) {
20865
20867
  if (value === void 0) return true;
20866
20868
  if (typeof value !== "boolean") {
@@ -20873,17 +20875,31 @@ async function labelRows(client, resourceKey, rows) {
20873
20875
  for (const row of rows) for (const k of Object.keys(row)) keys.add(k);
20874
20876
  if (keys.size === 0) return { rows: [...rows] };
20875
20877
  let picklistFields = [];
20878
+ let unavailable = [];
20879
+ let catalogError;
20876
20880
  const modelFields = MODEL_FIELD_SETS[resourceKey] ?? [];
20877
20881
  const candidates = [...keys].filter((f) => f !== "id" && modelFields.includes(f) && ROW_FK_TABLES[f] === void 0 && !isResourceFkField(f));
20878
20882
  if (candidates.length > 0) try {
20879
20883
  const catalog = await fieldCatalog(client, { resources: [resourceKey], labels: true });
20880
- const fields = catalog.rows.find((r) => r.resource === resourceKey)?.fields ?? [];
20881
- picklistFields = fields.filter((f) => f.isPickList && candidates.includes(f.name)).map((f) => f.name);
20884
+ const row = catalog.rows.find((r) => r.resource === resourceKey);
20885
+ const known = lastPicklists.get(client) ?? /* @__PURE__ */ new Map();
20886
+ lastPicklists.set(client, known);
20887
+ if (row?.fields === void 0) {
20888
+ const last = known.get(resourceKey);
20889
+ unavailable = (last ?? []).filter((f) => candidates.includes(f));
20890
+ if (last === void 0 || unavailable.length > 0) {
20891
+ catalogError = row?.error ?? { code: "INVALID_RESPONSE", message: `fieldCatalog: no ${resourceKey} row` };
20892
+ }
20893
+ } else {
20894
+ const all = row.fields.filter((f) => f.isPickList).map((f) => f.name);
20895
+ known.set(resourceKey, all);
20896
+ picklistFields = all.filter((f) => candidates.includes(f));
20897
+ }
20882
20898
  } catch (err) {
20883
20899
  if (!isAutotaskError(err) || err.code === "ABORTED") throw err;
20884
20900
  }
20885
- const labelled = (field) => picklistFields.includes(field) || ROW_FK_TABLES[field] !== void 0 || isResourceFkField(field);
20886
- if (![...keys].some(labelled)) return { rows: [...rows] };
20901
+ const labelled = (field) => picklistFields.includes(field) || unavailable.includes(field) || ROW_FK_TABLES[field] !== void 0 || isResourceFkField(field);
20902
+ if (catalogError === void 0 && ![...keys].some(labelled)) return { rows: [...rows] };
20887
20903
  const builder = createNamePlan(picklistFields, resourceKey);
20888
20904
  for (const row of rows) {
20889
20905
  for (const [field, value] of Object.entries(row)) {
@@ -20898,8 +20914,10 @@ async function labelRows(client, resourceKey, rows) {
20898
20914
  const out = rows.map((row) => {
20899
20915
  const r = { ...row };
20900
20916
  for (const [field, value] of Object.entries(row)) {
20901
- const set = value !== null && value !== void 0 && value !== 0 && value !== "0" && names !== void 0;
20902
- if (picklistFields.includes(field)) r[`${field}Label`] = set ? names.labelFor(field, value) : null;
20917
+ const has2 = value !== null && value !== void 0 && names !== void 0;
20918
+ if (picklistFields.includes(field)) r[`${field}Label`] = has2 ? names.labelFor(field, value) : null;
20919
+ else if (unavailable.includes(field)) r[`${field}Label`] = null;
20920
+ const set = has2 && value !== 0 && value !== "0";
20903
20921
  const table = ROW_FK_TABLES[field];
20904
20922
  if (table !== void 0) r[`${field}Name`] = set && isVendorId(value) ? untrustedName(names.recordName(table, value)) : null;
20905
20923
  else if (isResourceFkField(field)) r[`${field}Name`] = set && isVendorId(value) ? untrustedName(names.resourceName(value)) : null;
@@ -20907,16 +20925,28 @@ async function labelRows(client, resourceKey, rows) {
20907
20925
  if (r["assignedResourceIDName"] !== void 0) r["assignedResourceName"] = r["assignedResourceIDName"];
20908
20926
  return r;
20909
20927
  });
20910
- if (names === void 0) return { rows: out };
20911
- const capped = Object.values(names.section.rows).filter((row) => row.capped).length;
20912
- const reasons = names.section.reasons;
20913
- if (capped === 0 && Object.keys(reasons).length === 0) return { rows: out };
20928
+ const capped = names === void 0 ? 0 : Object.values(names.section.rows).filter((row) => row.capped).length;
20929
+ const unresolved = Object.keys(names?.section.reasons ?? {});
20930
+ const reasons = { ...names?.section.reasons };
20931
+ for (const f of unavailable) reasons[f] = PICKLIST_CATALOG_UNAVAILABLE_NOTE;
20932
+ if (capped === 0 && unresolved.length === 0 && catalogError === void 0) return { rows: out };
20914
20933
  const parts = [];
20915
20934
  if (capped > 0) parts.push(`${capped} id(s) left unlabelled (their *Name is null): the per-call cap of ${DEFAULT_MAX_NAME_READS} uncached name reads was hit \u2014 names already read are cached, so repeating or narrowing the call labels more`);
20916
- if (Object.keys(reasons).length > 0) parts.push(`picklist label(s) unavailable for ${Object.keys(reasons).join(", ")} (see reasons)`);
20935
+ if (unresolved.length > 0) parts.push(`picklist label(s) unavailable for ${unresolved.join(", ")} (see reasons)`);
20936
+ if (catalogError !== void 0) {
20937
+ parts.push(
20938
+ `the ${resourceKey} field catalog read failed (${catalogError.code}), so picklist labels are unavailable for this call, not absent: ` + (unavailable.length > 0 ? `the *Label is null for ${unavailable.join(", ")}` : "no *Label sibling was added (the picklist fields are unknown until a catalog read succeeds)") + " \u2014 retry the call to label them"
20939
+ );
20940
+ }
20917
20941
  return {
20918
20942
  rows: out,
20919
- names: { truncated: capped > 0, capped, note: parts.join("; "), ...Object.keys(reasons).length > 0 ? { reasons } : {} }
20943
+ names: {
20944
+ truncated: capped > 0,
20945
+ capped,
20946
+ note: parts.join("; "),
20947
+ ...Object.keys(reasons).length > 0 ? { reasons } : {},
20948
+ ...catalogError !== void 0 ? { catalogError } : {}
20949
+ }
20920
20950
  };
20921
20951
  }
20922
20952
  async function labelFetchResults(client, result) {
@@ -20935,11 +20965,13 @@ async function labelFetchResults(client, result) {
20935
20965
  }
20936
20966
  if (summaries.length === 0) return { ...result, results };
20937
20967
  const reasons = Object.assign({}, ...summaries.map((s) => s.reasons ?? {}));
20968
+ const catalogError = summaries.find((s) => s.catalogError !== void 0)?.catalogError;
20938
20969
  const names = {
20939
20970
  truncated: summaries.some((s) => s.truncated),
20940
20971
  capped: summaries.reduce((n, s) => n + s.capped, 0),
20941
20972
  note: summaries.map((s) => s.note).join("; "),
20942
- ...Object.keys(reasons).length > 0 ? { reasons } : {}
20973
+ ...Object.keys(reasons).length > 0 ? { reasons } : {},
20974
+ ...catalogError !== void 0 ? { catalogError } : {}
20943
20975
  };
20944
20976
  return { ...result, results, names };
20945
20977
  }
@@ -26608,6 +26640,7 @@ export {
26608
26640
  MIN_FIELD_CATALOG_MAX_BYTES,
26609
26641
  fieldCatalog,
26610
26642
  PICKLIST_VALUE_NOT_SERVED_NOTE,
26643
+ PICKLIST_CATALOG_UNAVAILABLE_NOTE,
26611
26644
  TICKET_LABEL_FIELDS,
26612
26645
  createNamePlan,
26613
26646
  addNameSibling,