node-autotask 0.72.0 → 0.74.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 (42) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/MCP_TOOL_CATALOG.json +216 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +664 -7
  5. package/dist/capabilities-data.js +663 -6
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-KVC5DZAP.cjs → chunk-AMB54GOO.cjs} +324 -94
  9. package/dist/{chunk-SPME362B.cjs → chunk-ASL3BIW2.cjs} +3 -3
  10. package/dist/{chunk-HJVTA7SI.cjs → chunk-DSQJTGXK.cjs} +31 -30
  11. package/dist/{chunk-EGG2RGL5.js → chunk-HJKY7LUL.js} +318 -90
  12. package/dist/{chunk-F2TYZKJS.js → chunk-IFE5FWS7.js} +128 -2
  13. package/dist/{chunk-K33DPJFK.js → chunk-IWTTCBCS.js} +3 -3
  14. package/dist/{chunk-A4IRIYZ5.js → chunk-PGSDJS52.js} +3 -2
  15. package/dist/{chunk-V5UGW6KZ.cjs → chunk-QZY5LAOG.cjs} +303 -177
  16. package/dist/{index-BXnhBnhN.d.cts → index-CH65Ftmy.d.cts} +39 -21
  17. package/dist/{index-BXnhBnhN.d.ts → index-CH65Ftmy.d.ts} +39 -21
  18. package/dist/{index-CqsY5YHt.d.cts → index-CkBDlaSS.d.cts} +166 -4
  19. package/dist/{index-DxfspQR1.d.ts → index-ColCzIyw.d.ts} +166 -4
  20. package/dist/index.cjs +84 -84
  21. package/dist/index.d.cts +3 -5
  22. package/dist/index.d.ts +3 -5
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +5 -6
  26. package/dist/operations/index.d.ts +5 -6
  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 -3
  39. package/docs/N8N-ADAPTER.md +1 -1
  40. package/package.json +1 -1
  41. package/dist/base-CHMATPq0.d.cts +0 -145
  42. package/dist/base-CHMATPq0.d.ts +0 -145
@@ -1,5 +1,5 @@
1
- import { GenericResource, readTasks, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-EGG2RGL5.js';
2
- import { loadCapabilityRecords } from './chunk-K33DPJFK.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-HJKY7LUL.js';
2
+ import { loadCapabilityRecords } from './chunk-IWTTCBCS.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -1842,10 +1842,136 @@ var TimeOffRequestsResource = class extends GenericResource {
1842
1842
  super(http, {
1843
1843
  key: "time_off_requests",
1844
1844
  resourcePath: "/V1.0/TimeOffRequests",
1845
+ parentScopedPath: "/V1.0/Resources/{parentId}/TimeOffRequests",
1846
+ parentPath: "/V1.0/Resources",
1847
+ parentField: "resourceID",
1848
+ staleField: "lastModifiedDateTime",
1849
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
1850
+ helpers: { search: false, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
1845
1851
  deletable: false,
1846
1852
  udfCapable: false
1847
1853
  }, pageSize);
1848
1854
  }
1855
+ async get(id, opts) {
1856
+ if (typeof opts === "number" || typeof opts === "string") {
1857
+ throw new OperationNotSupportedError("time_off_requests", "get");
1858
+ }
1859
+ return super.get(id, opts);
1860
+ }
1861
+ async create(a, b, c = {}) {
1862
+ if (typeof a !== "number" && typeof a !== "string") throw new OperationNotSupportedError("time_off_requests", "create");
1863
+ const parentId = parseIdentifier(a, "parentId");
1864
+ if (typeof parentId !== "number") throw this.writeError("create", "parentId cannot be represented safely in the numeric resourceID create body; this is an SDK create-body limit, not a vendor record-id maximum");
1865
+ const data = this.writePayload(b, "create");
1866
+ const opts = { ...c };
1867
+ if (data.resourceID !== void 0 && data.resourceID !== parentId) throw this.writeError("create", "resourceID must equal parentId");
1868
+ const fields = await this.guardWriteStatus(data.status, "Submitted", "create");
1869
+ this.guardChoice(fields, "timeOffRequestType", data.timeOffRequestType, "create");
1870
+ return super.create(parentId, { ...data, resourceID: parentId }, opts);
1871
+ }
1872
+ async update(a, b, c, d = {}) {
1873
+ if (typeof b !== "number" && typeof b !== "string") throw new OperationNotSupportedError("time_off_requests", "update");
1874
+ const parentId = parseIdentifier(a, "parentId");
1875
+ const id = parseIdentifier(b, "id");
1876
+ const data = this.writePayload(c, "update");
1877
+ const opts = { ...d };
1878
+ await this.guardWriteStatus(data.status, "Canceled", "update");
1879
+ if (opts.dryRun === true) {
1880
+ const preview = await this.runUpdateDryRun(id, data, opts, parentId);
1881
+ if (!preview.wouldApply) return preview;
1882
+ return {
1883
+ ...preview,
1884
+ impact: { ...preview.impact, reversible: false },
1885
+ warnings: [...preview.warnings, "A canceled time-off request cannot be restored through the public API."]
1886
+ };
1887
+ }
1888
+ const current = await this.getScopedRaw(parentId, id, true);
1889
+ this.staleObjectCheck(current, opts, "time_off_requests.update");
1890
+ return this.updateScopedRaw(parentId, id, data, opts);
1891
+ }
1892
+ async getScopedRaw(parentId, id, fresh = false) {
1893
+ const current = await super.getScopedRaw(parentId, id, fresh);
1894
+ if (current.resourceID === void 0 || parseIdentifier(current.resourceID, "resourceID") !== parentId) {
1895
+ throw this.writeError("update", "the current request resourceID must match parentId");
1896
+ }
1897
+ if (parseIdentifier(current.id, "id") !== id) {
1898
+ throw this.writeError("update", "the current request id must match the requested id");
1899
+ }
1900
+ return current;
1901
+ }
1902
+ async createIfNotExists(..._args) {
1903
+ throw new OperationNotSupportedError("time_off_requests", "createIfNotExists");
1904
+ }
1905
+ // Cancellation permits status only; never replace a full model through PUT fallback.
1906
+ putFallbackEligible(_err) {
1907
+ return false;
1908
+ }
1909
+ writeError(operation, detail) {
1910
+ return new AutotaskConfigError(`time_off_requests.${operation}: ${detail}`, { operation: `time_off_requests.${operation}` });
1911
+ }
1912
+ writePayload(value, operation) {
1913
+ if (!isRecord(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw this.writeError(operation, "supply a plain object");
1914
+ const allowed = operation === "create" ? ["hours", "requestDate", "resourceID", "status", "timeOffRequestType"] : ["status"];
1915
+ for (const key of Object.keys(value)) if (!allowed.includes(key)) throw this.writeError(operation, operation === "update" ? "cancellation accepts status only" : `${key} is not a supported create field`);
1916
+ if (typeof value.status !== "number" || !Number.isSafeInteger(value.status)) throw this.writeError(operation, "status must be a numeric picklist id");
1917
+ if (operation === "create") {
1918
+ if (typeof value.hours !== "number" || !Number.isFinite(value.hours) || value.hours < -24 || value.hours > 24) throw this.writeError(operation, "hours must be a finite decimal in the documented range -24 to 24");
1919
+ const date = value.requestDate;
1920
+ if (typeof date !== "string" || !isDateYMD(date.slice(0, 10)) || date.length !== 10 && (!/^T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(date.slice(10)) || !Number.isFinite(Date.parse(date)))) {
1921
+ throw this.writeError(operation, "requestDate must be an ISO calendar date or timestamp for the single requested day");
1922
+ }
1923
+ if (typeof value.timeOffRequestType !== "number" || !Number.isSafeInteger(value.timeOffRequestType)) throw this.writeError(operation, "timeOffRequestType must be a numeric picklist id");
1924
+ if (value.resourceID !== void 0) {
1925
+ if (typeof value.resourceID !== "number") throw this.writeError(operation, "resourceID must be a numeric identifier");
1926
+ parseIdentifier(value.resourceID, "resourceID");
1927
+ }
1928
+ }
1929
+ return { ...value, status: value.status };
1930
+ }
1931
+ async guardWriteStatus(status, label, operation) {
1932
+ let fields;
1933
+ try {
1934
+ fields = await this.cachedMeta("fields", `${this.resourcePath}/entityInformation/fields`, "time_off_requests.getFieldInfo", (body) => this.unwrapFields(body, "FieldInformationResultModel"), true);
1935
+ } catch (error) {
1936
+ if (isAutotaskError(error) && error.code === "ABORTED") throw error;
1937
+ if ((error instanceof RateLimitError || error instanceof MaintenanceError) && error.notSent === true) throw error;
1938
+ const detail = `status requires readable current field metadata for ${label}`;
1939
+ if (!isAutotaskError(error)) throw this.writeError(operation, detail);
1940
+ const safe = new AutotaskError(`time_off_requests.${operation}: ${detail}`, {
1941
+ code: error.code,
1942
+ category: error.category,
1943
+ correlationId: error.correlationId,
1944
+ httpStatus: error.httpStatus,
1945
+ nextAction: error.nextAction,
1946
+ operation: error.operation,
1947
+ retryable: error.retryable,
1948
+ suggestedAction: error.suggestedAction,
1949
+ url: error.url,
1950
+ ...error instanceof MaintenanceError ? { details: {
1951
+ since: error.details?.since,
1952
+ retryAfterMs: error.details?.retryAfterMs
1953
+ } } : {}
1954
+ });
1955
+ Object.setPrototypeOf(safe, Object.getPrototypeOf(error));
1956
+ safe.name = error.name;
1957
+ if (error instanceof RateLimitError || error instanceof MaintenanceError) {
1958
+ Object.assign(safe, { retryAfter: error.retryAfter, notSent: error.notSent });
1959
+ }
1960
+ throw safe;
1961
+ }
1962
+ this.guardChoice(fields, "status", status, operation, label);
1963
+ return fields;
1964
+ }
1965
+ guardChoice(fields, name, id, operation, label) {
1966
+ const unavailable = () => this.writeError(operation, `${name} requires an unambiguous active exposed ${label ?? "request-type"} picklist value; inspect time_off_requests.getFieldInfo`);
1967
+ const rows = fields.filter((field) => isRecord(field) && field.name === name);
1968
+ if (rows.length !== 1 || rows[0].isPickList !== true || !Array.isArray(rows[0].picklistValues)) throw unavailable();
1969
+ const values = rows[0].picklistValues;
1970
+ const numeric = (value) => isRecord(value) && typeof value.value === "string" && /^-?\d+$/.test(value.value) && Number.isSafeInteger(Number(value.value));
1971
+ const named = label === void 0 ? values.filter((value) => numeric(value) && Number(value.value) === id) : values.filter((value) => isRecord(value) && typeof value.label === "string" && value.label.trim().toLowerCase() === label.toLowerCase());
1972
+ if (named.length !== 1 || !numeric(named[0]) || named[0].isActive !== true || Number(named[0].value) !== id) throw unavailable();
1973
+ if (values.filter((value) => numeric(value) && Number(value.value) === id).length !== 1) throw unavailable();
1974
+ }
1849
1975
  /** Node-parity special op (hand-written in src/resources/special/time_off_requests.ts). */
1850
1976
  approve(id, opts = {}) {
1851
1977
  return approve(this, id, opts);
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "79f3968f072705fbc7b479dba6863a27bde47deee7b85885eda8d019302f9c25",
4
- "A": "79f3968f072705fbc7b479dba6863a27bde47deee7b85885eda8d019302f9c25",
5
- "operations": "79f3968f072705fbc7b479dba6863a27bde47deee7b85885eda8d019302f9c25"
3
+ "B": "cff16b0b9d022a81a1926ffacb0d01cf5a1e924805447744b62865a3cf9d3779",
4
+ "A": "cff16b0b9d022a81a1926ffacb0d01cf5a1e924805447744b62865a3cf9d3779",
5
+ "operations": "cff16b0b9d022a81a1926ffacb0d01cf5a1e924805447744b62865a3cf9d3779"
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-F2TYZKJS.js';
2
- import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-EGG2RGL5.js';
1
+ import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-IFE5FWS7.js';
2
+ import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-HJKY7LUL.js';
3
3
 
4
4
  // src/client.ts
5
5
  var AutotaskClient = class {
@@ -122,6 +122,7 @@ var AutotaskClient = class {
122
122
  tagGroups;
123
123
  tags;
124
124
  taskNotes;
125
+ taskPredecessors;
125
126
  tasks;
126
127
  taskSecondaryResources;
127
128
  taxRegions;