node-autotask 0.87.0 → 0.88.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 (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/MCP_TOOL_CATALOG.json +152 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +546 -26
  5. package/dist/capabilities-data.js +545 -25
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-RU4ECNQN.cjs → chunk-AB326MJO.cjs} +200 -200
  9. package/dist/{chunk-BD4AUGCJ.cjs → chunk-CM5O672I.cjs} +5 -4
  10. package/dist/{chunk-HUA4WB4N.cjs → chunk-ESKQAINP.cjs} +31 -30
  11. package/dist/{chunk-CUZJJCI5.cjs → chunk-GEFUSYH5.cjs} +325 -165
  12. package/dist/{chunk-GAFG7RHG.js → chunk-K72PPAAD.js} +312 -152
  13. package/dist/{chunk-NXSQXXNK.js → chunk-LGOJ2HBH.js} +3 -2
  14. package/dist/{chunk-G57Q7OAC.js → chunk-QKRHKLVY.js} +2 -2
  15. package/dist/{chunk-YVNGUGG6.cjs → chunk-SHJ7EOBW.cjs} +3 -3
  16. package/dist/{chunk-7NKB4UXV.js → chunk-X6VWD6WW.js} +5 -4
  17. package/dist/{chunk-EXNDYJPG.js → chunk-ZADTVF6M.js} +3 -3
  18. package/dist/{index-CsL5gGJo.d.ts → index-BFgZJsqx.d.ts} +13 -7
  19. package/dist/{index-Cxfr_DOD.d.cts → index-D0KHVqoO.d.cts} +29 -1
  20. package/dist/{index-Cxfr_DOD.d.ts → index-D0KHVqoO.d.ts} +29 -1
  21. package/dist/{index-DGiua9uK.d.cts → index-DsA1-2GA.d.cts} +13 -7
  22. package/dist/index.cjs +90 -87
  23. package/dist/index.d.cts +4 -3
  24. package/dist/index.d.ts +4 -3
  25. package/dist/index.js +9 -6
  26. package/dist/operations/index.cjs +53 -53
  27. package/dist/operations/index.d.cts +4 -4
  28. package/dist/operations/index.d.ts +4 -4
  29. package/dist/operations/index.js +3 -3
  30. package/dist/pool.cjs +13 -13
  31. package/dist/pool.d.cts +1 -1
  32. package/dist/pool.d.ts +1 -1
  33. package/dist/pool.js +5 -5
  34. package/dist/resources/index.cjs +28 -28
  35. package/dist/resources/index.d.cts +2 -2
  36. package/dist/resources/index.d.ts +2 -2
  37. package/dist/resources/index.js +4 -4
  38. package/dist/types/index.d.cts +1 -1
  39. package/dist/types/index.d.ts +1 -1
  40. package/dist/untrusted.cjs +11 -11
  41. package/dist/untrusted.d.cts +1 -1
  42. package/dist/untrusted.d.ts +1 -1
  43. package/dist/untrusted.js +1 -1
  44. package/docs/API.md +6 -2
  45. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkYVNGUGG6_cjs = require('./chunk-YVNGUGG6.cjs');
4
- var chunkBD4AUGCJ_cjs = require('./chunk-BD4AUGCJ.cjs');
3
+ var chunkSHJ7EOBW_cjs = require('./chunk-SHJ7EOBW.cjs');
4
+ var chunkCM5O672I_cjs = require('./chunk-CM5O672I.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
7
7
 
@@ -328,7 +328,7 @@ function redactResponseBody(value, policy) {
328
328
  const out = {};
329
329
  for (const [key, entry] of Object.entries(value)) {
330
330
  const pinned = SECRET_SET.has(key) || personal && OPTIONAL_SET.has(key);
331
- out[key] = pinned ? chunkBD4AUGCJ_cjs.REDACTED : redactResponseBody(entry, policy);
331
+ out[key] = pinned ? chunkCM5O672I_cjs.REDACTED : redactResponseBody(entry, policy);
332
332
  }
333
333
  return out;
334
334
  }
@@ -1412,7 +1412,7 @@ function resolveConfig(config) {
1412
1412
  }
1413
1413
  labels = config.labels;
1414
1414
  }
1415
- const logger = config.logger ?? chunkBD4AUGCJ_cjs.NoopLogger;
1415
+ const logger = config.logger ?? chunkCM5O672I_cjs.NoopLogger;
1416
1416
  if (credentials.baseUrl.startsWith("http:")) {
1417
1417
  const host = new URL(credentials.baseUrl).host;
1418
1418
  logger.warn?.(
@@ -1492,7 +1492,7 @@ function redactAuditBody(value) {
1492
1492
  if (!isRecord2(value)) return value;
1493
1493
  const out = {};
1494
1494
  for (const [key, entry] of Object.entries(value)) {
1495
- out[key] = CREDENTIAL_KEY_RE.test(key) ? chunkBD4AUGCJ_cjs.REDACTED : redactAuditBody(entry);
1495
+ out[key] = CREDENTIAL_KEY_RE.test(key) ? chunkCM5O672I_cjs.REDACTED : redactAuditBody(entry);
1496
1496
  }
1497
1497
  return out;
1498
1498
  }
@@ -10938,6 +10938,59 @@ var RELATIONSHIP_MAP = {
10938
10938
  },
10939
10939
  "deleteBoundary": null,
10940
10940
  "markerField": null
10941
+ },
10942
+ "inventory_locations": {
10943
+ "resource": "inventory_locations",
10944
+ "apiEntity": "InventoryLocation",
10945
+ "kind": "entity",
10946
+ "path": "InventoryLocations",
10947
+ "parentScoped": false,
10948
+ "tier": "extended",
10949
+ "workflowResource": false,
10950
+ "group": "A",
10951
+ "parent": null,
10952
+ "children": [],
10953
+ "naturalKeys": {
10954
+ "hasSearch": false,
10955
+ "searchCovers": null,
10956
+ "findBy": []
10957
+ },
10958
+ "blindSurfaces": null,
10959
+ "zoneFacts": {
10960
+ "createRequiredSet": [
10961
+ "locationName",
10962
+ "isActive"
10963
+ ],
10964
+ "createGuidance": {
10965
+ "createOp": "inventory_locations.create",
10966
+ "parentScoped": false,
10967
+ "liveProvenPrefix": [],
10968
+ "unproven": true,
10969
+ "blocker": {
10970
+ "kind": "unknown",
10971
+ "message": "Inventory location creation requires Inventory permissions and a unique locationName; not live verified.",
10972
+ "remedy": "Read current metadata, supply locationName and isActive, and preview first.",
10973
+ "requires": {
10974
+ "allOf": [
10975
+ "locationName",
10976
+ "isActive"
10977
+ ]
10978
+ }
10979
+ },
10980
+ "vendorEvidence": [
10981
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryLocationsEntity.htm"
10982
+ ],
10983
+ "deleteBoundary": {
10984
+ "available": false,
10985
+ "note": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API."
10986
+ }
10987
+ }
10988
+ },
10989
+ "deleteBoundary": {
10990
+ "note": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API.",
10991
+ "proof": "spec-derived"
10992
+ },
10993
+ "markerField": null
10941
10994
  }
10942
10995
  };
10943
10996
  var BLIND_SURFACE_STAMPS = {
@@ -11049,7 +11102,8 @@ var DELETE_BOUNDARY_NOTES = {
11049
11102
  "user_defined_field_definitions": "the vendor defines no DELETE for user_defined_field_definitions (spec-derived: the vendored api-docs.json defines no DELETE on the entity's paths) \u2014 a UDF definition cannot be deleted through the API; deactivation is via isActive (vendor soft-removal); hard cleanup is UI-only.",
11050
11103
  "user_defined_field_list_items": "the vendor defines no DELETE for user_defined_field_list_items (spec-derived: the vendored api-docs.json defines no DELETE on the standalone or parent-scoped ListItems paths) \u2014 a picklist value cannot be deleted through the API; deactivation is via isActive (vendor soft-removal); hard cleanup is UI-only.",
11051
11104
  "task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API.",
11052
- "time_off_requests": "The vendor defines no DELETE for time-off requests; cancel through time_off_requests.update using the Canceled status from exposed field metadata. Cancellation is leave management, not timesheet unposting."
11105
+ "time_off_requests": "The vendor defines no DELETE for time-off requests; cancel through time_off_requests.update using the Canceled status from exposed field metadata. Cancellation is leave management, not timesheet unposting.",
11106
+ "inventory_locations": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API."
11053
11107
  };
11054
11108
  var RESPONSE_DRIFT_MARKERS = {
11055
11109
  "ticket_checklist_libraries": {
@@ -12485,6 +12539,15 @@ var EMPTY_REASON_STAMPS = {
12485
12539
  "authority": null,
12486
12540
  "remedy": "verify the created record by id (ticket_checklist_libraries.get) \u2014 the create may have succeeded despite the drifted envelope"
12487
12541
  }
12542
+ },
12543
+ "inventory_locations": {
12544
+ "get": {
12545
+ "surface": "inventory_locations.get",
12546
+ "kind": "tenant-empty-for-user",
12547
+ "note": "No inventory location at this ID was visible to this API user. This is INCONCLUSIVE about tenant inventory because visibility may be limited by Inventory module access and permissions.",
12548
+ "authority": "inventory_locations.get",
12549
+ "remedy": "Verify the ID and check View permission, Inventory access and Inventory Manage Locations with an authorized user."
12550
+ }
12488
12551
  }
12489
12552
  };
12490
12553
  var POINTER_NOTES = {
@@ -13967,6 +14030,31 @@ var CREATE_GUIDANCE = {
13967
14030
  "note": null
13968
14031
  }
13969
14032
  },
14033
+ {
14034
+ "resource": "inventory_locations",
14035
+ "createOp": "inventory_locations.create",
14036
+ "parentScoped": false,
14037
+ "liveProvenPrefix": [],
14038
+ "unproven": true,
14039
+ "blocker": {
14040
+ "kind": "unknown",
14041
+ "message": "Inventory location creation requires Inventory permissions and a unique locationName; not live verified.",
14042
+ "remedy": "Read current metadata, supply locationName and isActive, and preview first.",
14043
+ "requires": {
14044
+ "allOf": [
14045
+ "locationName",
14046
+ "isActive"
14047
+ ]
14048
+ }
14049
+ },
14050
+ "vendorEvidence": [
14051
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryLocationsEntity.htm"
14052
+ ],
14053
+ "deleteBoundary": {
14054
+ "available": false,
14055
+ "note": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API."
14056
+ }
14057
+ },
13970
14058
  {
13971
14059
  "resource": "inventory_products",
13972
14060
  "createOp": "inventory_products.create",
@@ -15547,7 +15635,7 @@ var CREATE_GUIDANCE = {
15547
15635
  }
15548
15636
  ],
15549
15637
  "counts": {
15550
- "total": 116,
15638
+ "total": 117,
15551
15639
  "byKind": {
15552
15640
  "ok": 41,
15553
15641
  "blind-reference": 16,
@@ -15557,7 +15645,7 @@ var CREATE_GUIDANCE = {
15557
15645
  "resource-role-pair": 2,
15558
15646
  "delete-absent": 0,
15559
15647
  "non-mutable": 0,
15560
- "unknown": 40
15648
+ "unknown": 41
15561
15649
  }
15562
15650
  }
15563
15651
  };
@@ -16336,6 +16424,9 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
16336
16424
  "keywords",
16337
16425
  "referenceLink",
16338
16426
  "title"
16427
+ ],
16428
+ "inventory_locations": [
16429
+ "locationName"
16339
16430
  ]
16340
16431
  };
16341
16432
 
@@ -16794,22 +16885,25 @@ function auditReadTarget(path, operation) {
16794
16885
  function isKnowledgeBaseRootResource(resource) {
16795
16886
  return resource === "knowledge_base_categories" || resource === "knowledge_base_articles";
16796
16887
  }
16797
- var KNOWLEDGE_BASE_PATH = /^\/v1\.0\/(?:KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
16798
- function knowledgeBaseResponseTarget(path, method, operation) {
16799
- const match = KNOWLEDGE_BASE_PATH.exec(path);
16888
+ function isExactRecordResource(resource) {
16889
+ return resource === "inventory_locations" || isKnowledgeBaseRootResource(resource);
16890
+ }
16891
+ var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
16892
+ function exactRecordResponseTarget(path, method, operation) {
16893
+ const match = EXACT_RECORD_PATH.exec(path);
16800
16894
  if (match === null) return void 0;
16801
16895
  const suffix = match[1]?.toLowerCase();
16802
16896
  if (suffix === "query/count") return suffix;
16803
16897
  if (suffix?.startsWith("query")) return "query";
16804
16898
  if (suffix !== void 0 && !isAuditDecimalId(suffix)) {
16805
- throw new AutotaskConfigError("Knowledge Base record ID must be a non-negative signed 64-bit integer.", { operation });
16899
+ throw new AutotaskConfigError("Record ID must be a non-negative signed 64-bit integer.", { operation });
16806
16900
  }
16807
16901
  return method === "GET" ? suffix === void 0 ? void 0 : "item" : "mutation";
16808
16902
  }
16809
16903
  function isNonNegativeInt64(id) {
16810
16904
  return typeof id === "number" ? Number.isSafeInteger(id) && id >= 0 : typeof id === "string" && isAuditDecimalId(id);
16811
16905
  }
16812
- function validateKnowledgeBaseResponse(body, target, path, method, requestBody, operation) {
16906
+ function validateExactRecordResponse(body, target, path, method, requestBody, operation) {
16813
16907
  const invalid = (message) => {
16814
16908
  throw new AutotaskError(message, { code: "INVALID_RESPONSE", category: "server", operation, suggestedAction: INVALID_SHAPE_ACTION });
16815
16909
  };
@@ -16819,15 +16913,15 @@ function validateKnowledgeBaseResponse(body, target, path, method, requestBody,
16819
16913
  }
16820
16914
  if (target === "query") {
16821
16915
  if (!isRecord2(body) || !Array.isArray(body.items) || !isRecord2(body.pageDetails)) {
16822
- return invalid("Expected a Knowledge Base query page with paging details");
16916
+ return invalid("Expected a query page with paging details");
16823
16917
  }
16824
- if (!body.items.every(hasExactRecordId)) invalid("Expected valid record IDs in the Knowledge Base query response");
16918
+ if (!body.items.every(hasExactRecordId)) invalid("Expected valid record IDs in the query response");
16825
16919
  if (body.pageDetails.count !== body.items.length) {
16826
- invalid("The Knowledge Base page record count did not match its rows");
16920
+ invalid("The page record count did not match its rows");
16827
16921
  }
16828
16922
  const cursor = body.pageDetails.nextPageUrl;
16829
16923
  if (cursor !== null && (typeof cursor !== "string" || cursor.trim() === "")) {
16830
- invalid("Expected a valid Knowledge Base query cursor or an explicit end of results");
16924
+ invalid("Expected a valid query cursor or an explicit end of results");
16831
16925
  }
16832
16926
  return;
16833
16927
  }
@@ -16835,7 +16929,7 @@ function validateKnowledgeBaseResponse(body, target, path, method, requestBody,
16835
16929
  const expectedId = parts.at(-1);
16836
16930
  if (target === "mutation") {
16837
16931
  const id = isRecord2(body) ? body.itemId === void 0 ? body.id : body.itemId : void 0;
16838
- if (!isNonNegativeInt64(id)) invalid("Expected a valid Knowledge Base mutation receipt");
16932
+ if (!isNonNegativeInt64(id)) invalid("Expected a valid mutation receipt");
16839
16933
  const expected = method === "DELETE" ? expectedId : isRecord2(requestBody) ? requestBody.id : void 0;
16840
16934
  if (expected !== void 0 && String(id) !== String(expected)) {
16841
16935
  invalid("The mutation response identified a different record. Re-read the requested record before retrying.");
@@ -16845,9 +16939,10 @@ function validateKnowledgeBaseResponse(body, target, path, method, requestBody,
16845
16939
  const item = isRecord2(body) ? body.item : void 0;
16846
16940
  if (item === null) return;
16847
16941
  if (!isRecord2(item) || !isNonNegativeInt64(item.id)) {
16848
- return invalid("Expected a Knowledge Base item envelope with a valid record ID");
16942
+ return invalid("Expected an item envelope with a valid record ID");
16849
16943
  }
16850
- const resource = parts.at(-2)?.toLowerCase() === "knowledgebasearticles" ? "article" : "category";
16944
+ const entity = parts.at(-2)?.toLowerCase();
16945
+ const resource = entity === "inventorylocations" ? "inventory location" : entity === "knowledgebasearticles" ? "article" : "category";
16851
16946
  if (String(item.id) !== expectedId) {
16852
16947
  throw new AutotaskConfigError(`returned ${resource} id must match the requested id`, { operation });
16853
16948
  }
@@ -16861,16 +16956,16 @@ function validateKnowledgeBaseResponse(body, target, path, method, requestBody,
16861
16956
  }
16862
16957
  }
16863
16958
  }
16864
- function serializeKnowledgeBaseUpdate(body, operation) {
16959
+ function serializeExactRecordUpdate(body, operation) {
16865
16960
  if (!isRecord2(body) || typeof body.id !== "string") return JSON.stringify(body);
16866
16961
  if (!isAuditDecimalId(body.id)) {
16867
- throw new AutotaskConfigError("Knowledge Base update id must be a non-negative signed 64-bit integer.", { operation });
16962
+ throw new AutotaskConfigError("Update id must be a non-negative signed 64-bit integer.", { operation });
16868
16963
  }
16869
16964
  const { rawJSON } = JSON;
16870
16965
  return JSON.stringify({ ...body, id: rawJSON(body.id) });
16871
16966
  }
16872
- function decodeResponseJson(text, auditTarget, knowledgeBaseTarget) {
16873
- const target = auditTarget ?? knowledgeBaseTarget;
16967
+ function decodeResponseJson(text, auditTarget, recordTarget) {
16968
+ const target = auditTarget ?? recordTarget;
16874
16969
  if (target === void 0) return JSON.parse(text);
16875
16970
  if (target === "query/count") {
16876
16971
  return JSON.parse(text, (key, value, context) => key === "queryCount" && typeof value === "number" && !isAuditDecimalId(context?.source ?? "") ? null : value);
@@ -16930,9 +17025,9 @@ function attachEmptyReasonDetails(err) {
16930
17025
  const resource = err.operation.slice(0, dot);
16931
17026
  const op = err.operation.slice(dot + 1);
16932
17027
  const surface = err.operation;
16933
- const stamp = EMPTY_REASON_STAMPS[resource]?.[op];
16934
- const pointer = POINTER_NOTES[surface];
16935
17028
  const isGetMiss = err instanceof NotFoundError && op === "get";
17029
+ const stamp = op !== "get" || isGetMiss ? EMPTY_REASON_STAMPS[resource]?.[op] : void 0;
17030
+ const pointer = POINTER_NOTES[surface];
16936
17031
  if (stamp === void 0 && pointer === void 0 && !isGetMiss) return;
16937
17032
  err.details = { ...err.details ?? {} };
16938
17033
  if (stamp !== void 0) {
@@ -17044,7 +17139,7 @@ function normalizeZoneBase(raw) {
17044
17139
  return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
17045
17140
  }
17046
17141
  function canReResolveZone(reResolveZoneOn401, zone, opts) {
17047
- if (!reResolveZoneOn401) return false;
17142
+ if (!reResolveZoneOn401 || opts.checkedBaseUrl !== void 0) return false;
17048
17143
  if (zone === void 0 || zone === "other") return false;
17049
17144
  if (!opts.path.startsWith("/") || /^https?:\/\//i.test(opts.path)) return false;
17050
17145
  return true;
@@ -17437,6 +17532,7 @@ var HttpClient = class {
17437
17532
  if (s.signal.aborted || Date.now() >= s.deadlineAt) throw this.interrupted(s);
17438
17533
  this.gate(s, false);
17439
17534
  if (s.signal.aborted || Date.now() >= s.deadlineAt) throw this.interrupted(s);
17535
+ this.assertCheckedBase(opts);
17440
17536
  const admission = admitHourlyAttempt(s.url, this.hourly, Date.now());
17441
17537
  if (!admission.admitted) {
17442
17538
  releaseCurrent();
@@ -17513,13 +17609,13 @@ var HttpClient = class {
17513
17609
  }
17514
17610
  let parsed;
17515
17611
  try {
17516
- parsed = decodeResponseJson(text, s.auditTarget, s.knowledgeBaseTarget);
17612
+ parsed = decodeResponseJson(text, s.auditTarget, s.recordTarget);
17517
17613
  } catch {
17518
17614
  return this.handleNonJson2xx(s, res, status, text);
17519
17615
  }
17520
17616
  validateAuditResponse(parsed, s.auditTarget, opts.operation);
17521
- if (s.knowledgeBaseTarget !== void 0) {
17522
- validateKnowledgeBaseResponse(parsed, s.knowledgeBaseTarget, decodeURIComponent(opts.path), method, opts.body, opts.operation);
17617
+ if (s.recordTarget !== void 0) {
17618
+ validateExactRecordResponse(parsed, s.recordTarget, decodeURIComponent(opts.path), method, opts.body, opts.operation);
17523
17619
  }
17524
17620
  return {
17525
17621
  done: true,
@@ -17706,6 +17802,13 @@ var HttpClient = class {
17706
17802
  this.readCache?.clear();
17707
17803
  if (/\/V1\.0\/Companies(?:\/[^/]+)?(?:\?|$)/i.test(opts.path)) invalidateCompanyIndex(this);
17708
17804
  }
17805
+ assertCheckedBase(opts) {
17806
+ const baseUrl = this.baseUrl;
17807
+ if (opts.checkedBaseUrl !== void 0 && opts.checkedBaseUrl !== baseUrl) {
17808
+ throw new AutotaskConfigError("The Autotask zone changed after preflight. Preview or check the target again.", { operation: opts.operation });
17809
+ }
17810
+ return baseUrl;
17811
+ }
17709
17812
  /**
17710
17813
  * One request: build URL/headers, apply the whole-call deadline, retry
17711
17814
  * idempotent methods on 429/5xx, map failures to the typed errors.
@@ -17713,8 +17816,9 @@ var HttpClient = class {
17713
17816
  */
17714
17817
  async request(opts) {
17715
17818
  const method = opts.method;
17716
- const url = buildUrl(this.baseUrl, opts.path, opts.query);
17717
- const wirePath = url.slice(this.baseUrl.length);
17819
+ const baseUrl = this.assertCheckedBase(opts);
17820
+ const url = buildUrl(baseUrl, opts.path, opts.query);
17821
+ const wirePath = url.slice(baseUrl.length);
17718
17822
  const path = wirePath.split("?", 1)[0];
17719
17823
  const route = decodeURIComponent(path);
17720
17824
  const auditTarget = auditReadTarget(route, opts.operation);
@@ -17724,13 +17828,14 @@ var HttpClient = class {
17724
17828
  const queryRoute = /\/query(?:\/|$)/i.test(route);
17725
17829
  const getQuery = method === "GET" && queryRoute && requestUrl.search !== "";
17726
17830
  if (getQuery) assertGetQueryUrlLength(url);
17727
- const knowledgeBaseTarget = knowledgeBaseResponseTarget(route, method, opts.operation);
17728
- const knowledgeBaseUpdate = knowledgeBaseTarget === "mutation" && (method === "PUT" || method === "PATCH");
17729
- const bodyText = knowledgeBaseUpdate && opts.body !== void 0 ? serializeKnowledgeBaseUpdate(opts.body, opts.operation) : opts.body === void 0 ? void 0 : JSON.stringify(opts.body);
17831
+ const recordTarget = exactRecordResponseTarget(route, method, opts.operation);
17832
+ const exactRecordUpdate = recordTarget === "mutation" && (method === "PUT" || method === "PATCH");
17833
+ const bodyText = exactRecordUpdate && opts.body !== void 0 ? serializeExactRecordUpdate(opts.body, opts.operation) : opts.body === void 0 ? void 0 : JSON.stringify(opts.body);
17730
17834
  if (queryRoute) {
17731
17835
  const audit = auditTarget === "query" || auditTarget === "query/count";
17732
- const knowledgeBase = knowledgeBaseTarget === "query" || knowledgeBaseTarget === "query/count";
17733
- const exactIdLabel = audit ? "audit log" : knowledgeBase ? "Knowledge Base record" : void 0;
17836
+ const exactRecord = recordTarget === "query" || recordTarget === "query/count";
17837
+ const recordLabel = /^\/v1\.0\/InventoryLocations\//i.test(route) ? "inventory location" : "Knowledge Base record";
17838
+ const exactIdLabel = audit ? "audit log" : exactRecord ? recordLabel : void 0;
17734
17839
  assertQueryFilters(opts, requestUrl, bodyText, exactIdLabel);
17735
17840
  }
17736
17841
  opts = { ...opts, path };
@@ -17746,7 +17851,7 @@ var HttpClient = class {
17746
17851
  getQuery,
17747
17852
  method,
17748
17853
  auditTarget,
17749
- knowledgeBaseTarget,
17854
+ recordTarget,
17750
17855
  url,
17751
17856
  headers,
17752
17857
  bodyText,
@@ -18327,13 +18432,13 @@ async function runBounded(fn, items, opts) {
18327
18432
  const results = new Array(items.length);
18328
18433
  let next = 0;
18329
18434
  let failure;
18330
- const fail3 = (error, index) => {
18435
+ const fail4 = (error, index) => {
18331
18436
  if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
18332
18437
  };
18333
18438
  const worker = async () => {
18334
18439
  while (failure === void 0 && next < items.length) {
18335
18440
  if (signal?.aborted) {
18336
- fail3(signal.reason, -1);
18441
+ fail4(signal.reason, -1);
18337
18442
  return;
18338
18443
  }
18339
18444
  const i = next++;
@@ -18343,7 +18448,7 @@ async function runBounded(fn, items, opts) {
18343
18448
  results[i] = settle ? { status: "fulfilled", value } : value;
18344
18449
  } catch (error) {
18345
18450
  if (settle) results[i] = { status: "rejected", reason: error };
18346
- else fail3(error, i);
18451
+ else fail4(error, i);
18347
18452
  }
18348
18453
  }
18349
18454
  };
@@ -18399,7 +18504,7 @@ async function capabilitySets() {
18399
18504
  const fieldOps = /* @__PURE__ */ new Map();
18400
18505
  const udfCapable = /* @__PURE__ */ new Set();
18401
18506
  const resources = /* @__PURE__ */ new Set();
18402
- for (const rec of await chunkYVNGUGG6_cjs.loadCapabilityRecords()) {
18507
+ for (const rec of await chunkSHJ7EOBW_cjs.loadCapabilityRecords()) {
18403
18508
  if (rec.resource === "operations") continue;
18404
18509
  resources.add(rec.resource);
18405
18510
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -18410,7 +18515,7 @@ async function capabilitySets() {
18410
18515
  var derivedIndexPromise = null;
18411
18516
  function derivedIndexLoad() {
18412
18517
  if (derivedIndexPromise === null) {
18413
- derivedIndexPromise = chunkYVNGUGG6_cjs.loadCapabilityRecords().then((records) => {
18518
+ derivedIndexPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => {
18414
18519
  const index = /* @__PURE__ */ new Map();
18415
18520
  for (const rec of records) {
18416
18521
  const declared = rec.metadata?.derivedFields;
@@ -18831,7 +18936,7 @@ function buildDryRunResult(spec, policy = { redactPersonalData: true }) {
18831
18936
  const diffPart = spec.diff !== void 0 ? {
18832
18937
  diff: spec.diff.map((entry) => {
18833
18938
  if (entry.to === void 0) return entry;
18834
- const to = isRedactedFieldName(entry.field, policy) ? chunkBD4AUGCJ_cjs.REDACTED : redactResponseBody(entry.to, policy);
18939
+ const to = isRedactedFieldName(entry.field, policy) ? chunkCM5O672I_cjs.REDACTED : redactResponseBody(entry.to, policy);
18835
18940
  return { ...entry, to };
18836
18941
  })
18837
18942
  } : {};
@@ -19689,7 +19794,24 @@ function same(sent, stored) {
19689
19794
  return String(sent) === String(stored);
19690
19795
  }
19691
19796
  function notPersistedFields(sent, stored) {
19692
- return Object.entries(sent).filter(([key, value]) => (value === null || typeof value !== "object") && stored[key] !== chunkBD4AUGCJ_cjs.REDACTED && !same(value, stored[key])).map(([key]) => key);
19797
+ return Object.entries(sent).filter(([key, value]) => (value === null || typeof value !== "object") && stored[key] !== chunkCM5O672I_cjs.REDACTED && !same(value, stored[key])).map(([key]) => key);
19798
+ }
19799
+
19800
+ // src/resources/special/inventoryLocations.ts
19801
+ var fail = (message) => {
19802
+ throw new AutotaskConfigError(`inventory_locations: ${message}`);
19803
+ };
19804
+ function admitInventoryLocation(value, creating) {
19805
+ if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("data must be a plain record");
19806
+ const body = { ...value };
19807
+ for (const field of Object.keys(body)) if (!["locationName", "isActive"].includes(field)) fail(`${field} is not a writable InventoryLocations field`);
19808
+ if ((creating || Object.hasOwn(body, "locationName")) && (typeof body.locationName !== "string" || body.locationName.trim() === "" || body.locationName.length > 50)) fail("locationName is required and must be a nonblank string of at most 50 characters");
19809
+ if ((creating || Object.hasOwn(body, "isActive")) && typeof body.isActive !== "boolean") fail("isActive must be a boolean");
19810
+ if (!creating && !Object.keys(body).length) fail("update must contain locationName or isActive");
19811
+ return body;
19812
+ }
19813
+ function checkInventoryLocationCurrent(value, current) {
19814
+ if (value.isActive === false && current.isDefault !== false) fail("inactivation requires a fresh current isDefault value explicitly false; default or unknown locations cannot be inactivated");
19693
19815
  }
19694
19816
 
19695
19817
  // src/resources/base/types.ts
@@ -19858,6 +19980,7 @@ var MODEL_FIELD_SETS = {
19858
19980
  "expense_reports": ["id", "amountDue", "approvedDate", "approverID", "departmentNumber", "internalCurrencyCashAdvanceAmount", "internalCurrencyExpenseTotal", "name", "organizationalLevelAssociationID", "quickBooksReferenceNumber", "reimbursementCurrencyAmountDue", "reimbursementCurrencyCashAdvanceAmount", "reimbursementCurrencyID", "rejectionReason", "status", "submit", "submitDate", "submitterID", "weekEnding"],
19859
19981
  "holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
19860
19982
  "holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
19983
+ "inventory_locations": ["id", "impersonatorCreatorResourceID", "isActive", "isDefault", "locationName", "resourceID"],
19861
19984
  "inventory_products": ["id", "availableUnits", "backOrderQuantity", "bin", "createDateTime", "createdByResourceID", "inventoryLocationID", "onHandUnits", "pickedUnits", "productID", "quantityMaximum", "quantityMinimum", "referenceNumber", "reservedUnits", "unitsOnOrder"],
19862
19985
  "invoice_templates": ["id", "coveredByBlockRetainerContractLabel", "coveredByRecurringServiceFixedPricePerTicketContractLabel", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "displayFixedPriceContractLabor", "displayRecurringServiceContractLabor", "displaySeparateLineItemForEachTax", "displayTaxCategory", "displayTaxCategorySuperscripts", "displayZeroAmountRecurringServicesAndBundles", "groupBy", "itemizeItemsInEachGroup", "itemizeServicesAndBundles", "name", "nonBillableLaborLabel", "numberFormat", "pageLayout", "pageNumberFormat", "paymentTerms", "rateCostExpression", "showGridHeader", "showVerticalGridLines", "sortBy", "timeFormat"],
19863
19986
  "invoices": ["id", "batchID", "comments", "companyID", "createDateTime", "creatorResourceID", "dueDate", "fromDate", "invoiceDateTime", "invoiceEditorTemplateID", "invoiceNumber", "invoiceTotal", "isVoided", "orderNumber", "paidDate", "paymentTerm", "taxGroup", "taxRegionName", "toDate", "totalTaxValue", "voidedByResourceID", "voidedDate", "webServiceDate"],
@@ -20097,21 +20220,21 @@ function validateRelationLeaves(resourceKey, conditions, op) {
20097
20220
  assertUndottedUdfField(c, op);
20098
20221
  const field = c.field;
20099
20222
  const [rel, sub, ...rest] = field.split(".");
20100
- const fail3 = (why) => {
20223
+ const fail4 = (why) => {
20101
20224
  throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
20102
20225
  operation: op,
20103
20226
  suggestedAction: valid.length > 0 ? `Use ${valid.map((r) => `${r}.<${RELATION_TARGETS[r].resource} field>`).join(" or ")} (one hop; field names from operations.fieldCatalog).` : `${resourceKey} has no relation filters; filter on its own fields.`
20104
20227
  });
20105
20228
  };
20106
20229
  if (selfPrefixes(resourceKey).includes(rel)) {
20107
- if (rest.length > 0 || !sub) fail3("is not <resource>.<field> (multi-hop relations are not supported)");
20230
+ if (rest.length > 0 || !sub) fail4("is not <resource>.<field> (multi-hop relations are not supported)");
20108
20231
  continue;
20109
20232
  }
20110
- if (rest.length > 0 || !sub) fail3("is not <relation>.<field> (multi-hop relations are not supported)");
20111
- if (!valid.includes(rel)) fail3(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
20233
+ if (rest.length > 0 || !sub) fail4("is not <relation>.<field> (multi-hop relations are not supported)");
20234
+ if (!valid.includes(rel)) fail4(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
20112
20235
  const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
20113
20236
  if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
20114
- fail3(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
20237
+ fail4(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
20115
20238
  }
20116
20239
  }
20117
20240
  };
@@ -20221,7 +20344,7 @@ var LABEL_NAME_MAX_CHARS = 200;
20221
20344
  function untrustedName(name) {
20222
20345
  if (name === null) return null;
20223
20346
  const [[capped]] = truncateNoteChars([{ v: name }], LABEL_NAME_MAX_CHARS, ["v"]);
20224
- return chunkBD4AUGCJ_cjs.wrapUntrusted(capped.v) ?? capped.v;
20347
+ return chunkCM5O672I_cjs.wrapUntrusted(capped.v) ?? capped.v;
20225
20348
  }
20226
20349
  function readNamesOpt(client, value, where) {
20227
20350
  if (value === void 0) return client?.config?.labels ?? false;
@@ -20439,7 +20562,7 @@ var QueryBase = class {
20439
20562
  }
20440
20563
  continueAcrossEmptyPage() {
20441
20564
  const { key } = this.config;
20442
- return isAuditLogResource(key) || isKnowledgeBaseRootResource(key);
20565
+ return isAuditLogResource(key) || isExactRecordResource(key);
20443
20566
  }
20444
20567
  /** @internal */
20445
20568
  readPage(body, page, pageSize, state2) {
@@ -20836,7 +20959,7 @@ var QueryBase = class {
20836
20959
  }
20837
20960
  if (total <= BOUNDED_QUERY_MAX_LIMIT) {
20838
20961
  const { items: items2, pages: pages3, guard: guard2, sliced: sliced2, cursor: cursor2 } = await this.walkBounded(params, total);
20839
- if (this.walkTruncated(total, { itemsLength: items2.length, guard: guard2, sliced: sliced2, cursor: cursor2 }) || !this.hasCompleteKnowledgeBaseWindow(items2, total)) {
20962
+ if (this.walkTruncated(total, { itemsLength: items2.length, guard: guard2, sliced: sliced2, cursor: cursor2 }) || !this.hasCompleteExactRecordWindow(items2, total)) {
20840
20963
  throw this.latestWindowIncompleteError(total);
20841
20964
  }
20842
20965
  return this.finishLatest(items2, latest, pages3);
@@ -20845,11 +20968,11 @@ var QueryBase = class {
20845
20968
  probes += 1;
20846
20969
  if (probes > LATEST_MAX_COUNT_PROBES) throw this.latestThresholdUnresolvedError();
20847
20970
  };
20848
- const knowledgeBase = isKnowledgeBaseRootResource(this.config.key);
20849
- let lo = knowledgeBase ? -1n : 0n;
20971
+ const exactRecord = isExactRecordResource(this.config.key);
20972
+ let lo = exactRecord ? -1n : 0n;
20850
20973
  let hi;
20851
20974
  let aboveThreshold = 0;
20852
- if (isAuditLogResource(this.config.key) || knowledgeBase) {
20975
+ if (isAuditLogResource(this.config.key) || exactRecord) {
20853
20976
  hi = BigInt(MAX_AUDIT_ID);
20854
20977
  } else {
20855
20978
  for (let t = 1n; ; t = t << 1n) {
@@ -20870,17 +20993,17 @@ var QueryBase = class {
20870
20993
  aboveThreshold = above;
20871
20994
  } else lo = mid;
20872
20995
  }
20873
- if (knowledgeBase && aboveThreshold !== latest) throw this.latestWindowIncompleteError(latest + 1);
20996
+ if (exactRecord && aboveThreshold !== latest) throw this.latestWindowIncompleteError(latest + 1);
20874
20997
  const windowValue = hi <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(hi) : hi.toString();
20875
20998
  const window = [...baseConds, { op: "gte", field: "id", value: windowValue }];
20876
20999
  const { items, pages: pages2, guard, sliced, cursor } = await this.walkBounded({ ...params, filter: window }, latest + 1);
20877
- if (this.walkTruncated(latest + 1, { itemsLength: items.length, guard, sliced, cursor }) || !this.hasCompleteKnowledgeBaseWindow(items, latest + 1, hi)) {
21000
+ if (this.walkTruncated(latest + 1, { itemsLength: items.length, guard, sliced, cursor }) || !this.hasCompleteExactRecordWindow(items, latest + 1, hi)) {
20878
21001
  throw this.latestWindowIncompleteError(latest + 1);
20879
21002
  }
20880
21003
  return this.finishLatest(items, latest, pages2);
20881
21004
  }
20882
- hasCompleteKnowledgeBaseWindow(items, expected, minimum) {
20883
- if (!isKnowledgeBaseRootResource(this.config.key)) return true;
21005
+ hasCompleteExactRecordWindow(items, expected, minimum) {
21006
+ if (!isExactRecordResource(this.config.key)) return true;
20884
21007
  if (items.length !== expected) return false;
20885
21008
  const ids2 = items.map((item) => String(item.id));
20886
21009
  if (new Set(ids2).size !== expected) return false;
@@ -21027,10 +21150,12 @@ var MetaBase = class _MetaBase extends QueryBase {
21027
21150
  return cachedMetadataGet(this.http, this.config.key, kind, path, operation, unwrap, fresh, maxRetries);
21028
21151
  }
21029
21152
  /** `GET /V1.0/<E>/{id}` → `{ item }` unwrapped (`item: null` → NotFoundError). */
21030
- async getGlobal(id, fresh = false, maxRetries) {
21153
+ async getGlobal(id, fresh = false, maxRetries, checkedBaseUrl) {
21031
21154
  const numeric2 = parseIdentifier(id, "id");
21032
- const res = await this.cachedGet(`${this.resourcePath}/${numeric2}`, `${this.config.key}.get`, fresh, maxRetries);
21033
- return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
21155
+ const path = `${this.resourcePath}/${numeric2}`;
21156
+ const operation = `${this.config.key}.get`;
21157
+ const res = checkedBaseUrl === void 0 ? await this.cachedGet(path, operation, fresh, maxRetries) : await this.http.request({ method: "GET", path, operation, maxRetries, checkedBaseUrl });
21158
+ return unwrapItem(res, numeric2, operation, this.entityName);
21034
21159
  }
21035
21160
  /**
21036
21161
  * V2 merge read: a FRESH single-record GET that skips response redaction
@@ -21547,26 +21672,26 @@ var MetaBase = class _MetaBase extends QueryBase {
21547
21672
 
21548
21673
  // src/resources/special/knowledgeBaseCategories.ts
21549
21674
  function admitKnowledgeBaseCategory(data, creating, staleToken) {
21550
- const fail3 = (message) => {
21675
+ const fail4 = (message) => {
21551
21676
  throw new AutotaskConfigError(`knowledge_base_categories: ${message}`);
21552
21677
  };
21553
- if (!creating && staleToken !== void 0) fail3("no documented stale timestamp is available");
21554
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
21678
+ if (!creating && staleToken !== void 0) fail4("no documented stale timestamp is available");
21679
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
21555
21680
  const body = { ...data };
21556
- for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field)) fail3(`${field} is not a writable KnowledgeBaseCategories field`);
21681
+ for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field)) fail4(`${field} is not a writable KnowledgeBaseCategories field`);
21557
21682
  for (const [field, max] of [["name", 50], ["description", 1e3]]) {
21558
21683
  const value = body[field];
21559
- if (value !== void 0 && (typeof value !== "string" || value.length > max)) fail3(`${field} must be a string of at most ${max} characters`);
21684
+ if (value !== void 0 && (typeof value !== "string" || value.length > max)) fail4(`${field} must be a string of at most ${max} characters`);
21560
21685
  }
21561
- if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === "")) fail3("name is required");
21562
- if (creating && body.parentCategoryID === void 0) fail3("parentCategoryID is required; choose a documented visible category rather than guessing a root id");
21686
+ if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === "")) fail4("name is required");
21687
+ if (creating && body.parentCategoryID === void 0) fail4("parentCategoryID is required; choose a documented visible category rather than guessing a root id");
21563
21688
  const parent = body.parentCategoryID;
21564
21689
  if (parent !== void 0) {
21565
- if (typeof parent !== "number") return fail3("parentCategoryID must be a numeric identifier");
21690
+ if (typeof parent !== "number") return fail4("parentCategoryID must be a numeric identifier");
21566
21691
  parseIdentifier(parent, "parentCategoryID");
21567
- if (parent > 2147483647) fail3("parentCategoryID must fit a signed 32-bit integer");
21692
+ if (parent > 2147483647) fail4("parentCategoryID must fit a signed 32-bit integer");
21568
21693
  }
21569
- if (!creating && !Object.values(body).some((value) => value !== void 0)) fail3("update must contain a writable field");
21694
+ if (!creating && !Object.values(body).some((value) => value !== void 0)) fail4("update must contain a writable field");
21570
21695
  return body;
21571
21696
  }
21572
21697
  function categoryReplacement(body) {
@@ -21580,45 +21705,45 @@ function categoryReplacement(body) {
21580
21705
  }
21581
21706
 
21582
21707
  // src/resources/special/knowledgeBaseArticles.ts
21583
- function fail(detail) {
21708
+ function fail2(detail) {
21584
21709
  throw new AutotaskConfigError(`knowledge_base_articles: ${detail}`);
21585
21710
  }
21586
21711
  function reference(value, name) {
21587
- if (typeof value !== "number") fail(`${name} must be a numeric identifier`);
21712
+ if (typeof value !== "number") fail2(`${name} must be a numeric identifier`);
21588
21713
  parseIdentifier(value, name);
21589
- if (value > 2147483647) fail(`${name} must fit a signed 32-bit integer`);
21714
+ if (value > 2147483647) fail2(`${name} must fit a signed 32-bit integer`);
21590
21715
  return value;
21591
21716
  }
21592
21717
  function articleParent(value) {
21593
21718
  const parent = parseIdentifier(value, "parentId");
21594
- if (typeof parent !== "number" || parent > 2147483647) fail("parentId must fit a signed 32-bit category identifier");
21595
- if (parent === 0) fail("parentId must name an article category");
21719
+ if (typeof parent !== "number" || parent > 2147483647) fail2("parentId must fit a signed 32-bit category identifier");
21720
+ if (parent === 0) fail2("parentId must name an article category");
21596
21721
  return parent;
21597
21722
  }
21598
21723
  function admitArticle(data, parentId, creating) {
21599
21724
  const parent = articleParent(parentId);
21600
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail("data must be a plain record");
21725
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
21601
21726
  const body = { ...data };
21602
21727
  const allowed = ["articleCategoryID", "publish", "title", "errorCodes", "keywords", "referenceLink", "isActive"];
21603
21728
  for (const key of Object.keys(body)) {
21604
- if (!allowed.includes(key)) fail(`${key} is not a writable article root field`);
21729
+ if (!allowed.includes(key)) fail2(`${key} is not a writable article root field`);
21605
21730
  if (key !== "articleCategoryID" && body[key] === void 0) delete body[key];
21606
21731
  }
21607
21732
  for (const [field, max] of [["title", 200], ["errorCodes", 200], ["keywords", 300], ["referenceLink", 500]]) {
21608
- if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max)) fail(`${field} must be a string of at most ${max} characters`);
21609
- }
21610
- if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim())) fail("title is required and cannot be blank");
21611
- if (!creating && Object.hasOwn(body, "articleCategoryID")) fail("articleCategoryID is read-only after creation");
21612
- if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent)) fail("articleCategoryID must match parentId");
21613
- if ((creating || Object.hasOwn(body, "publish")) && (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish) || body.publish < -2147483648 || body.publish > 2147483647)) fail("publish must be an int32 from current field metadata");
21614
- if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean") fail("isActive must be boolean");
21615
- if (!creating && !Object.keys(body).length) fail("update must contain a writable field");
21733
+ if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max)) fail2(`${field} must be a string of at most ${max} characters`);
21734
+ }
21735
+ if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim())) fail2("title is required and cannot be blank");
21736
+ if (!creating && Object.hasOwn(body, "articleCategoryID")) fail2("articleCategoryID is read-only after creation");
21737
+ if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent)) fail2("articleCategoryID must match parentId");
21738
+ if ((creating || Object.hasOwn(body, "publish")) && (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish) || body.publish < -2147483648 || body.publish > 2147483647)) fail2("publish must be an int32 from current field metadata");
21739
+ if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean") fail2("isActive must be boolean");
21740
+ if (!creating && !Object.keys(body).length) fail2("update must contain a writable field");
21616
21741
  return body;
21617
21742
  }
21618
21743
  async function guardArticle(http, parentId, id, maxRetries) {
21619
21744
  const parent = articleParent(parentId);
21620
21745
  const target = id === void 0 ? void 0 : parseIdentifier(id, "id");
21621
- if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target)))) fail("id must name an article within the signed 64-bit range");
21746
+ if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target)))) fail2("id must name an article within the signed 64-bit range");
21622
21747
  unwrapItem(await http.request({ method: "GET", path: `/V1.0/KnowledgeBaseCategories/${parent}`, operation: "knowledge_base_categories.get", maxRetries }), parent, "knowledge_base_categories.get", "article_category");
21623
21748
  if (target !== void 0) {
21624
21749
  return unwrapItem(await http.request({ method: "GET", path: `/V1.0/KnowledgeBaseCategories/${parent}/KnowledgeBaseArticles/${target}`, operation: "knowledge_base_articles.get", maxRetries }), target, "knowledge_base_articles.get", "article");
@@ -21627,7 +21752,7 @@ async function guardArticle(http, parentId, id, maxRetries) {
21627
21752
  }
21628
21753
  function assertArticlePublish(data, fields) {
21629
21754
  if (!Object.hasOwn(data, "publish")) return;
21630
- const unavailable = () => fail("publish requires an unambiguous active value in current field metadata");
21755
+ const unavailable = () => fail2("publish requires an unambiguous active value in current field metadata");
21631
21756
  if (!Array.isArray(fields)) unavailable();
21632
21757
  const rows = fields.filter((field) => isRecord2(field) && field.name === "publish");
21633
21758
  if (rows.length !== 1 || rows[0].isPickList !== true || rows[0].isReadOnly !== false || !Array.isArray(rows[0].picklistValues)) unavailable();
@@ -21833,23 +21958,27 @@ var MutationBase = class extends MetaBase {
21833
21958
  * write already happened, so a failed read-back is reported on the result
21834
21959
  * (`persistedCheckFailed`: the error code, or `UNKNOWN (<error name>)`), never thrown.
21835
21960
  */
21836
- async withPersistedCheck(result, data, opts, id, parentId) {
21961
+ async withPersistedCheck(result, data, opts, id, parentId, checkedBaseUrl) {
21837
21962
  if (opts.verifyPersisted !== true) return result;
21838
- const maxRetries = isKnowledgeBaseRootResource(this.config.key) ? opts.maxRetries : void 0;
21963
+ const maxRetries = isExactRecordResource(this.config.key) ? opts.maxRetries : void 0;
21839
21964
  try {
21840
- const stored = parentId === void 0 ? await this.getGlobal(id, true, maxRetries) : this.config.attachmentGet === true ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true, maxRetries);
21841
- return { ...result, notPersisted: notPersistedFields(data, stored) };
21965
+ const stored = parentId === void 0 ? await this.getGlobal(id, true, maxRetries, checkedBaseUrl) : this.config.attachmentGet === true ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true, maxRetries);
21966
+ const submitted = data;
21967
+ const persisted = stored;
21968
+ const notPersisted = this.config.key === "inventory_locations" ? Object.keys(submitted).filter((field) => submitted[field] !== persisted[field]) : notPersistedFields(submitted, persisted);
21969
+ return { ...result, notPersisted };
21842
21970
  } catch (err) {
21843
21971
  return { ...result, persistedCheckFailed: err instanceof AutotaskError ? err.code : `UNKNOWN (${err instanceof Error ? err.name : typeof err})` };
21844
21972
  }
21845
21973
  }
21846
- async updateGlobal(id, data, opts = {}, method = "PUT") {
21974
+ async updateGlobal(id, data, opts = {}, method = "PUT", checkedBaseUrl) {
21847
21975
  const numeric2 = parseIdentifier(id, "id");
21848
21976
  const operation = `${this.config.key}.update`;
21849
21977
  let body = this.normalizeMutationBody(data);
21850
- const collectionUpdate = this.config.collectionUpdate === true;
21978
+ const partialCollection = checkedBaseUrl !== void 0;
21979
+ const collectionUpdate = partialCollection || this.config.collectionUpdate === true;
21851
21980
  if (collectionUpdate) {
21852
- if (opts.raw !== true) {
21981
+ if (!partialCollection && opts.raw !== true) {
21853
21982
  let current;
21854
21983
  try {
21855
21984
  current = await this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries });
@@ -21873,7 +22002,9 @@ var MutationBase = class extends MetaBase {
21873
22002
  path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`,
21874
22003
  body,
21875
22004
  operation,
21876
- maxRetries: opts.maxRetries
22005
+ maxRetries: opts.maxRetries,
22006
+ // The preflight facts must be checked again before any later PATCH.
22007
+ ...partialCollection ? { maintenanceMaxWaitMs: 0, checkedBaseUrl } : {}
21877
22008
  });
21878
22009
  } catch (err) {
21879
22010
  if (method === "PATCH" || !this.putFallbackEligible(err)) throw err;
@@ -21900,7 +22031,7 @@ var MutationBase = class extends MetaBase {
21900
22031
  }
21901
22032
  return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2);
21902
22033
  }
21903
- return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2);
22034
+ return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2, void 0, checkedBaseUrl);
21904
22035
  }
21905
22036
  /** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
21906
22037
  * (204 / empty body) is a valid vendor delete answer — synthesize the
@@ -22210,21 +22341,22 @@ var MutationBase = class extends MetaBase {
22210
22341
  * check (mismatch throws STALE_OBJECT) and the best-effort `diff`. NO
22211
22342
  * mutating request is issued.
22212
22343
  */
22213
- async runUpdateDryRun(id, data, opts = {}, parentId, currentRecord) {
22344
+ async runUpdateDryRun(id, data, opts = {}, parentId, currentRecord, partialCollection) {
22214
22345
  const operation = `${this.config.key}.update`;
22215
22346
  const checks = [];
22216
22347
  const warnings = [];
22217
22348
  checks.push({ name: "input-validation", ok: isRecord2(data) && Object.keys(data).length > 0 });
22218
22349
  const scopedUpdate = parentId !== void 0 && this.config.parentScopedPath !== void 0;
22219
- const collectionUpdate = scopedUpdate || this.config.collectionUpdate === true;
22350
+ const collectionUpdate = scopedUpdate || partialCollection !== void 0 || this.config.collectionUpdate === true;
22220
22351
  const path = scopedUpdate ? this.scopedCollectionPath(parentId) : collectionUpdate ? this.resourcePath : `${this.resourcePath}/${id}`;
22221
- const method = scopedUpdate ? "PATCH" : "PUT";
22352
+ const method = scopedUpdate || partialCollection !== void 0 ? "PATCH" : "PUT";
22222
22353
  let current;
22223
22354
  try {
22224
- current = currentRecord ?? (parentId === void 0 ? await this.getGlobal(id, true, this.config.key === "knowledge_base_categories" ? opts.maxRetries : void 0) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true));
22355
+ current = currentRecord ?? (parentId === void 0 ? await this.getGlobal(id, true, this.config.key === "knowledge_base_categories" || partialCollection !== void 0 ? opts.maxRetries : void 0) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true));
22225
22356
  } catch (err) {
22226
22357
  if (err instanceof NotFoundError) {
22227
- const updateReason = EMPTY_REASON_STAMPS[this.config.key]?.update;
22358
+ const reasons = EMPTY_REASON_STAMPS[this.config.key];
22359
+ const updateReason = reasons?.update ?? (partialCollection === void 0 ? void 0 : reasons?.get);
22228
22360
  checks.push({
22229
22361
  name: "current-record-exists",
22230
22362
  ok: false,
@@ -22239,18 +22371,19 @@ var MutationBase = class extends MetaBase {
22239
22371
  checks,
22240
22372
  impact: { affected: 1, scope: "single-record", reversible: true },
22241
22373
  warnings,
22242
- data,
22374
+ data: partialCollection === void 0 ? data : { ...data, id },
22243
22375
  ...updateReason !== void 0 ? { emptyReason: updateReason } : {}
22244
22376
  }, { redactPersonalData: this.http.redactPersonalData });
22245
22377
  }
22246
22378
  throw err;
22247
22379
  }
22248
22380
  checks.push({ name: "current-record-exists", ok: true });
22381
+ partialCollection?.checkCurrent(current);
22249
22382
  if (this.staleObjectCheck(current, opts, operation)) {
22250
22383
  checks.push({ name: "stale-check", ok: true });
22251
22384
  }
22252
22385
  let envelopeData = data;
22253
- if (this.config.key === "knowledge_base_articles") {
22386
+ if (partialCollection !== void 0 || this.config.key === "knowledge_base_articles") {
22254
22387
  envelopeData = { ...this.normalizeMutationBody(data), id };
22255
22388
  } else if (parentId === void 0 && this.config.collectionUpdate === true && opts.raw !== true) {
22256
22389
  const merged = mergePartialBody(current, this.normalizeMutationBody(data));
@@ -22327,34 +22460,34 @@ var BaseResource = class extends MutationBase {
22327
22460
  };
22328
22461
 
22329
22462
  // src/resources/special/taskPredecessors.ts
22330
- function fail2(detail) {
22463
+ function fail3(detail) {
22331
22464
  throw new AutotaskConfigError(`task_predecessors: ${detail}`);
22332
22465
  }
22333
22466
  function numeric(value, field) {
22334
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail2(`${field} must be a positive numeric identifier`);
22467
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail3(`${field} must be a positive numeric identifier`);
22335
22468
  return value;
22336
22469
  }
22337
22470
  function predecessorParent(value) {
22338
22471
  const parent = parseIdentifier(value, "parentId");
22339
- if (parent === 0) fail2("parentId must name a successor task");
22472
+ if (parent === 0) fail3("parentId must name a successor task");
22340
22473
  return parent;
22341
22474
  }
22342
22475
  function assertPredecessorBinding(value, parentId, id) {
22343
- if (!isRecord2(value)) fail2("the returned record must establish id and successorTaskID parent");
22344
- if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId))) fail2("the returned record must match id and successorTaskID parent");
22476
+ if (!isRecord2(value)) fail3("the returned record must establish id and successorTaskID parent");
22477
+ if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId))) fail3("the returned record must match id and successorTaskID parent");
22345
22478
  }
22346
22479
  function admitTaskPredecessor(data, parentId, creating) {
22347
22480
  const parent = predecessorParent(parentId);
22348
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
22481
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
22349
22482
  const payload = { ...data };
22350
22483
  const allowed = creating ? ["predecessorTaskID", "successorTaskID", "lagDays"] : ["lagDays"];
22351
- if (Object.keys(payload).some((key) => !allowed.includes(key))) fail2(creating ? "only predecessorTaskID, successorTaskID and lagDays are writable on create" : "only lagDays can be updated");
22352
- if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647)) fail2("lagDays must be an int32 integer");
22484
+ if (Object.keys(payload).some((key) => !allowed.includes(key))) fail3(creating ? "only predecessorTaskID, successorTaskID and lagDays are writable on create" : "only lagDays can be updated");
22485
+ if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647)) fail3("lagDays must be an int32 integer");
22353
22486
  if (creating) {
22354
22487
  const successor = numeric(payload.successorTaskID, "successorTaskID");
22355
22488
  const predecessor = numeric(payload.predecessorTaskID, "predecessorTaskID");
22356
- if (String(successor) !== String(parent)) fail2("successorTaskID must match parentId");
22357
- if (predecessor === successor) fail2("predecessorTaskID and successorTaskID must be distinct");
22489
+ if (String(successor) !== String(parent)) fail3("successorTaskID must match parentId");
22490
+ if (predecessor === successor) fail3("predecessorTaskID and successorTaskID must be distinct");
22358
22491
  }
22359
22492
  return payload;
22360
22493
  }
@@ -22363,50 +22496,50 @@ async function guardTaskPredecessor(http, parentId, id, data) {
22363
22496
  let row = data;
22364
22497
  if (id !== void 0) {
22365
22498
  const target = parseIdentifier(id, "id");
22366
- if (target === 0) fail2("id must name a predecessor relationship");
22499
+ if (target === 0) fail3("id must name a predecessor relationship");
22367
22500
  row = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${parent}/Predecessors/${target}`, operation: "task_predecessors.get" }), target, "task_predecessors.get", "task_predecessor");
22368
22501
  assertPredecessorBinding(row, parent, target);
22369
22502
  }
22370
22503
  const predecessor = numeric(row?.predecessorTaskID, "predecessorTaskID");
22371
22504
  const successor = numeric(row?.successorTaskID, "successorTaskID");
22372
- if (predecessor === successor) fail2("predecessorTaskID and successorTaskID must be distinct");
22505
+ if (predecessor === successor) fail3("predecessorTaskID and successorTaskID must be distinct");
22373
22506
  const projects = [];
22374
22507
  for (const taskId of [predecessor, successor]) {
22375
22508
  const task = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${taskId}`, operation: "tasks.get" }), taskId, "tasks.get", "task");
22376
- if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail2("the returned task must match its requested id");
22509
+ if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail3("the returned task must match its requested id");
22377
22510
  projects.push(numeric(task.projectID, "task.projectID"));
22378
22511
  }
22379
- if (projects[0] !== projects[1]) fail2("predecessor and successor tasks must belong to the same project");
22512
+ if (projects[0] !== projects[1]) fail3("predecessor and successor tasks must belong to the same project");
22380
22513
  }
22381
22514
 
22382
22515
  // src/resources/special/taskNotes.ts
22383
22516
  var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
22384
22517
  function admitTaskNote(data, parentId, creating) {
22385
22518
  const parent = parseIdentifier(parentId, "parentId");
22386
- const fail3 = (message) => {
22519
+ const fail4 = (message) => {
22387
22520
  throw new AutotaskConfigError(`task_notes: ${message}`);
22388
22521
  };
22389
- if (data === null || typeof data !== "object" || Array.isArray(data)) fail3("data must be a record");
22522
+ if (data === null || typeof data !== "object" || Array.isArray(data)) fail4("data must be a record");
22390
22523
  const body = data;
22391
- for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail3(`${key} is not a writable TaskNotes field`);
22524
+ for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail4(`${key} is not a writable TaskNotes field`);
22392
22525
  for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
22393
22526
  const value = body[field];
22394
- if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail3(`${field} must be a string of at most ${maximum} characters`);
22527
+ if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail4(`${field} must be a string of at most ${maximum} characters`);
22395
22528
  }
22396
- if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail3("description is required");
22529
+ if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail4("description is required");
22397
22530
  for (const field of ["noteType", "publish"]) {
22398
22531
  const value = body[field];
22399
- if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail3(`${field} must be an integer from the current field metadata`);
22532
+ if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail4(`${field} must be an integer from the current field metadata`);
22400
22533
  }
22401
- if (creating && body.taskID === void 0) fail3("taskID is required in the create body and must match parentId");
22534
+ if (creating && body.taskID === void 0) fail4("taskID is required in the create body and must match parentId");
22402
22535
  for (const field of ["createdByContactID", "taskID"]) {
22403
22536
  if (body[field] !== void 0) {
22404
- if (typeof body[field] !== "number") fail3(`${field} must be a numeric identifier`);
22537
+ if (typeof body[field] !== "number") fail4(`${field} must be a numeric identifier`);
22405
22538
  const id = parseIdentifier(body[field], field);
22406
- if (field === "taskID" && String(id) !== String(parent)) fail3("taskID must match the parentId path argument");
22539
+ if (field === "taskID" && String(id) !== String(parent)) fail4("taskID must match the parentId path argument");
22407
22540
  }
22408
22541
  }
22409
- if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail3("update must contain a writable field");
22542
+ if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail4("update must contain a writable field");
22410
22543
  }
22411
22544
 
22412
22545
  // src/operations/invoke/fieldSuggest.ts
@@ -22676,38 +22809,38 @@ function isBase64(value) {
22676
22809
  }
22677
22810
  function admitTaskAttachment(data, parentId) {
22678
22811
  const parent = parseIdentifier(parentId, "parentId");
22679
- const fail3 = (message) => {
22812
+ const fail4 = (message) => {
22680
22813
  throw new AutotaskConfigError(`task_attachments: ${message}`);
22681
22814
  };
22682
- if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
22815
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
22683
22816
  const body = data;
22684
- for (const field of Object.keys(body)) if (!WRITABLE2.has(field)) fail3(`${field} is not a supported create field`);
22817
+ for (const field of Object.keys(body)) if (!WRITABLE2.has(field)) fail4(`${field} is not a supported create field`);
22685
22818
  for (const field of ["attachmentType", "fullPath", "title"]) {
22686
- if (typeof body[field] !== "string" || body[field].trim() === "") fail3(`${field} is required and must be a non-empty string`);
22819
+ if (typeof body[field] !== "string" || body[field].trim() === "") fail4(`${field} is required and must be a non-empty string`);
22687
22820
  }
22688
- if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail3("publish must be an integer from current field metadata");
22821
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail4("publish must be an integer from current field metadata");
22689
22822
  for (const field of ["data", "contentType"]) {
22690
- if (body[field] !== void 0 && typeof body[field] !== "string") fail3(`${field} must be a string`);
22823
+ if (body[field] !== void 0 && typeof body[field] !== "string") fail4(`${field} must be a string`);
22691
22824
  }
22692
22825
  if (body.attachmentType === "FILE_ATTACHMENT") {
22693
- if (typeof body.data !== "string" || body.data === "") return fail3("FILE_ATTACHMENT requires non-empty base64 data");
22694
- if (!isBase64(body.data)) fail3("FILE_ATTACHMENT data must be base64 encoded");
22826
+ if (typeof body.data !== "string" || body.data === "") return fail4("FILE_ATTACHMENT requires non-empty base64 data");
22827
+ if (!isBase64(body.data)) fail4("FILE_ATTACHMENT data must be base64 encoded");
22695
22828
  }
22696
22829
  if (body.taskID !== void 0) {
22697
- if (typeof body.taskID !== "number") fail3("taskID must be a numeric identifier");
22698
- if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent)) fail3("taskID must match the parentId path argument");
22830
+ if (typeof body.taskID !== "number") fail4("taskID must be a numeric identifier");
22831
+ if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent)) fail4("taskID must match the parentId path argument");
22699
22832
  }
22700
22833
  if (body.parentAttachmentID !== void 0) {
22701
- if (typeof body.parentAttachmentID !== "number") fail3("parentAttachmentID must be a numeric identifier");
22834
+ if (typeof body.parentAttachmentID !== "number") fail4("parentAttachmentID must be a numeric identifier");
22702
22835
  parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
22703
22836
  }
22704
22837
  }
22705
22838
  function admitFileAttachment(resource, data, parentId) {
22706
22839
  parseIdentifier(parentId, "parentId");
22707
- const fail3 = (message) => {
22840
+ const fail4 = (message) => {
22708
22841
  throw new AutotaskConfigError(`${resource}: ${message}`);
22709
22842
  };
22710
- if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
22843
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
22711
22844
  const body = data;
22712
22845
  const reference2 = {
22713
22846
  project_attachments: void 0,
@@ -22720,20 +22853,20 @@ function admitFileAttachment(resource, data, parentId) {
22720
22853
  configuration_item_attachments: "parentAttachmentID",
22721
22854
  configuration_item_note_attachments: void 0
22722
22855
  }[resource];
22723
- for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2) fail3(`${field} is not a supported create field`);
22724
- if (body.attachmentType !== "FILE_ATTACHMENT") fail3("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
22856
+ for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2) fail4(`${field} is not a supported create field`);
22857
+ if (body.attachmentType !== "FILE_ATTACHMENT") fail4("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
22725
22858
  const maxLength = resource === "project_attachments" ? void 0 : 255;
22726
22859
  for (const field of ["fullPath", "title"]) {
22727
22860
  const value = body[field];
22728
22861
  const requirement = `${field} is required and must be a nonblank string${maxLength === void 0 ? "" : ` of at most ${maxLength} characters`}`;
22729
- if (typeof value !== "string" || value.trim() === "") return fail3(requirement);
22730
- if (maxLength !== void 0 && value.length > maxLength) fail3(requirement);
22862
+ if (typeof value !== "string" || value.trim() === "") return fail4(requirement);
22863
+ if (maxLength !== void 0 && value.length > maxLength) fail4(requirement);
22731
22864
  }
22732
- if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail3("publish must be an integer from current field metadata");
22733
- if (typeof body.data !== "string" || !isBase64(body.data)) fail3("FILE_ATTACHMENT requires nonempty base64 data");
22865
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail4("publish must be an integer from current field metadata");
22866
+ if (typeof body.data !== "string" || !isBase64(body.data)) fail4("FILE_ATTACHMENT requires nonempty base64 data");
22734
22867
  if (reference2 !== void 0 && body[reference2] !== void 0) {
22735
- if (typeof body[reference2] !== "number") fail3(`${reference2} must be a numeric identifier`);
22736
- if (parseIdentifier(body[reference2], reference2) === 0) fail3(`${reference2} must be positive`);
22868
+ if (typeof body[reference2] !== "number") fail4(`${reference2} must be a numeric identifier`);
22869
+ if (parseIdentifier(body[reference2], reference2) === 0) fail4(`${reference2} must be positive`);
22737
22870
  }
22738
22871
  }
22739
22872
  function admitScopedAttachmentQuery(resource, params) {
@@ -23582,6 +23715,16 @@ var SIMPLE_RESOURCES = [
23582
23715
  helpers: { search: false, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
23583
23716
  opForms: { get: "scoped", create: "scoped", update: "scoped", delete: "scoped" }
23584
23717
  },
23718
+ {
23719
+ key: "inventory_locations",
23720
+ accessor: "inventoryLocations",
23721
+ resourcePath: "/V1.0/InventoryLocations",
23722
+ deletable: false,
23723
+ udfCapable: false,
23724
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
23725
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
23726
+ opForms: { get: "global", create: "global", update: "global" }
23727
+ },
23585
23728
  {
23586
23729
  key: "invoice_templates",
23587
23730
  accessor: "invoiceTemplates",
@@ -24477,7 +24620,7 @@ var GenericResource = class extends BaseResource {
24477
24620
  if (["company_attachments", "company_note_attachments", "configuration_item_attachments", "configuration_item_note_attachments", "contract_note_attachments", "expense_report_attachments", "project_attachments", "project_note_attachments", "resource_attachments", "sales_order_attachments", "task_attachments", "task_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
24478
24621
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
24479
24622
  };
24480
- if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles"].includes(config.key)) this.createIfNotExists = async () => {
24623
+ if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles", "inventory_locations"].includes(config.key)) this.createIfNotExists = async () => {
24481
24624
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
24482
24625
  };
24483
24626
  if (config.key === "knowledge_base_categories") {
@@ -24592,9 +24735,9 @@ var GenericResource = class extends BaseResource {
24592
24735
  return this.createScopedRaw(parentId, data2, opts2);
24593
24736
  }
24594
24737
  if (this.config.opForms?.create === "scoped") throw new OperationNotSupportedError(this.config.key, "create");
24595
- const data = this.config.key === "knowledge_base_categories" ? admitKnowledgeBaseCategory(a, true) : a;
24738
+ const data = this.config.key === "knowledge_base_categories" ? admitKnowledgeBaseCategory(a, true) : this.config.key === "inventory_locations" ? admitInventoryLocation(a, true) : a;
24596
24739
  const supplied = b;
24597
- const opts = this.config.key === "knowledge_base_categories" ? snapshotMutationOptions(supplied) : supplied ?? {};
24740
+ const opts = ["knowledge_base_categories", "inventory_locations"].includes(this.config.key) ? snapshotMutationOptions(supplied) : supplied ?? {};
24598
24741
  if (opts.dryRun === true) return this.runCreateDryRun(data);
24599
24742
  return this.createGlobal(data, opts);
24600
24743
  }
@@ -24621,8 +24764,24 @@ var GenericResource = class extends BaseResource {
24621
24764
  }
24622
24765
  if (this.config.opForms?.update === "scoped") throw new OperationNotSupportedError(this.config.key, "update");
24623
24766
  const category = this.config.key === "knowledge_base_categories";
24624
- const id = category ? parseIdentifier(a, "id") : a;
24767
+ const location = this.config.key === "inventory_locations";
24768
+ const id = category || location ? parseIdentifier(a, "id") : a;
24625
24769
  const supplied = c;
24770
+ if (location) {
24771
+ const body = admitInventoryLocation(b, false);
24772
+ const opts2 = snapshotMutationOptions(supplied);
24773
+ if (opts2.lastModifiedDate !== void 0) throw new AutotaskConfigError("inventory_locations: no documented stale timestamp is available");
24774
+ const checkCurrent = (current) => checkInventoryLocationCurrent(body, current);
24775
+ if (opts2.dryRun === true) return this.runUpdateDryRun(id, body, opts2, void 0, void 0, { checkCurrent });
24776
+ const checkedBaseUrl = this.http.baseUrl;
24777
+ try {
24778
+ checkCurrent(await this.getGlobal(id, true, opts2.maxRetries, checkedBaseUrl));
24779
+ } catch (error) {
24780
+ if (error instanceof AutotaskError) Object.assign(error, { notSent: true });
24781
+ throw error;
24782
+ }
24783
+ return this.updateGlobal(id, body, opts2, "PATCH", checkedBaseUrl);
24784
+ }
24626
24785
  const opts = category ? snapshotMutationOptions(supplied) : supplied ?? {};
24627
24786
  if (category && opts.raw === true) throw new AutotaskConfigError("knowledge_base_categories: raw update is unsupported; a fresh merge is required");
24628
24787
  const data = category ? admitKnowledgeBaseCategory(b, false, opts.lastModifiedDate) : b;
@@ -26396,7 +26555,7 @@ function dateBucketLabel(value, bucket) {
26396
26555
  var queryResourceKeysPromise = null;
26397
26556
  function queryResourceKeys() {
26398
26557
  if (queryResourceKeysPromise === null) {
26399
- queryResourceKeysPromise = chunkYVNGUGG6_cjs.loadCapabilityRecords().then((records) => {
26558
+ queryResourceKeysPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => {
26400
26559
  const s = /* @__PURE__ */ new Set();
26401
26560
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
26402
26561
  return s;
@@ -26518,7 +26677,7 @@ function parseTopAndLimit(opts, problems) {
26518
26677
  return { top, limit };
26519
26678
  }
26520
26679
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
26521
- const records = resourceKey === void 0 ? [] : await chunkYVNGUGG6_cjs.loadCapabilityRecords();
26680
+ const records = resourceKey === void 0 ? [] : await chunkSHJ7EOBW_cjs.loadCapabilityRecords();
26522
26681
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
26523
26682
  if (record === void 0) return void 0;
26524
26683
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -26715,8 +26874,9 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
26715
26874
  try {
26716
26875
  const id = parseIdentifier(item.id, `${at}.id`);
26717
26876
  const audit = isAuditLogResource(resourceKey);
26718
- if ((audit || isKnowledgeBaseRootResource(resourceKey)) && !isAuditDecimalId(String(id))) {
26719
- problems.push(`${at}.id: ${audit ? "audit log" : "Knowledge Base record"} ID must be a non-negative signed 64-bit integer`);
26877
+ if ((audit || isExactRecordResource(resourceKey)) && !isAuditDecimalId(String(id))) {
26878
+ const label = audit ? "audit log" : resourceKey === "inventory_locations" ? "inventory location" : "Knowledge Base record";
26879
+ problems.push(`${at}.id: ${label} ID must be a non-negative signed 64-bit integer`);
26720
26880
  }
26721
26881
  } catch {
26722
26882
  if (typeof item.id === "string") {
@@ -27010,7 +27170,7 @@ async function uiLink(client, input) {
27010
27170
  var indexPromise = null;
27011
27171
  function operationIndex() {
27012
27172
  if (indexPromise === null) {
27013
- indexPromise = chunkYVNGUGG6_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27173
+ indexPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27014
27174
  }
27015
27175
  return indexPromise;
27016
27176
  }
@@ -27031,7 +27191,7 @@ async function sanitiseResult(client, result, operation) {
27031
27191
  );
27032
27192
  }
27033
27193
  const fields = record.metadata?.untrustedFields;
27034
- return chunkBD4AUGCJ_cjs.deepMarkUntrusted(result, Array.isArray(fields) ? fields : []);
27194
+ return chunkCM5O672I_cjs.deepMarkUntrusted(result, Array.isArray(fields) ? fields : []);
27035
27195
  }
27036
27196
 
27037
27197
  // src/resources/special/invoices.ts
@@ -29082,7 +29242,7 @@ function buildMiscoding(fc, crossTimeEntries, unresolvedRefs) {
29082
29242
  return [...miscoding.values()].sort((a, b) => a.entryId - b.entryId).slice(0, fc.v.limit);
29083
29243
  }
29084
29244
  function vendorLabel(value, fallback) {
29085
- return typeof value === "string" && value !== "" ? chunkBD4AUGCJ_cjs.wrapUntrusted(value) ?? value : fallback;
29245
+ return typeof value === "string" && value !== "" ? chunkCM5O672I_cjs.wrapUntrusted(value) ?? value : fallback;
29086
29246
  }
29087
29247
  function openTicketItems(fc) {
29088
29248
  const { openStatusSet } = fc.f.open;
@@ -29346,16 +29506,16 @@ function latchingHttp(raw, spend) {
29346
29506
  }
29347
29507
  };
29348
29508
  observeRecordReadFailures(http, latch);
29349
- const fail3 = (err) => {
29509
+ const fail4 = (err) => {
29350
29510
  latch(err);
29351
29511
  throw err;
29352
29512
  };
29353
29513
  http.request = (o) => {
29354
29514
  if (fatal) throw fatal;
29355
29515
  try {
29356
- return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail3);
29516
+ return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail4);
29357
29517
  } catch (err) {
29358
- return fail3(err);
29518
+ return fail4(err);
29359
29519
  }
29360
29520
  };
29361
29521
  return { http, fatal: () => fatal, signal };