node-autotask 0.91.0 → 0.92.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/MCP_TOOL_CATALOG.json +152 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +575 -28
  5. package/dist/capabilities-data.js +574 -27
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-43ADHLZJ.js → chunk-2MC3LDZU.js} +3 -3
  9. package/dist/{chunk-2GP7W6QB.js → chunk-4BICEQ4S.js} +841 -295
  10. package/dist/{chunk-Y2KXGSWM.js → chunk-C7KZ7PB3.js} +3 -2
  11. package/dist/{chunk-5PUHGPKG.cjs → chunk-JY6BQUPO.cjs} +202 -200
  12. package/dist/{chunk-RXXITZH4.cjs → chunk-LYAHXYZR.cjs} +847 -299
  13. package/dist/{chunk-YFC5VAKK.cjs → chunk-QC45KFQQ.cjs} +31 -30
  14. package/dist/{chunk-WAHRZDV4.js → chunk-QVDXIXY4.js} +4 -2
  15. package/dist/{chunk-KRYDLTY3.cjs → chunk-QXJQIZCT.cjs} +3 -3
  16. package/dist/{index-Dy92Xbpv.d.cts → index-B0p5O-2e.d.cts} +70 -2
  17. package/dist/{index-Dy92Xbpv.d.ts → index-B0p5O-2e.d.ts} +70 -2
  18. package/dist/{index-C3jXvpXZ.d.ts → index-it9IqLsM.d.ts} +13 -5
  19. package/dist/{index-BfGOllfY.d.cts → index-opnSlg90.d.cts} +13 -5
  20. package/dist/index.cjs +89 -85
  21. package/dist/index.d.cts +8 -4
  22. package/dist/index.d.ts +8 -4
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +9 -4
  26. package/dist/operations/index.d.ts +9 -4
  27. package/dist/operations/index.js +2 -2
  28. package/dist/pool.cjs +12 -12
  29. package/dist/pool.d.cts +1 -1
  30. package/dist/pool.d.ts +1 -1
  31. package/dist/pool.js +4 -4
  32. package/dist/resources/index.cjs +27 -27
  33. package/dist/resources/index.d.cts +2 -2
  34. package/dist/resources/index.d.ts +2 -2
  35. package/dist/resources/index.js +3 -3
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/docs/API.md +39 -2
  39. package/examples/mcp/manifest.ts +1 -1
  40. package/examples/mcp/tools-mode.ts +15 -6
  41. package/examples/mcp/tools-read.ts +8 -2
  42. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
- import { loadCapabilityRecords } from './chunk-43ADHLZJ.js';
1
+ import { loadCapabilityRecords } from './chunk-2MC3LDZU.js';
2
2
  import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-X6VWD6WW.js';
3
3
  import { randomUUID, createHash } from 'crypto';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
5
+ import { types } from 'util';
5
6
 
6
7
  // src/errors/base.ts
7
8
  function nextActionFor(code, opts = {}) {
@@ -1440,6 +1441,7 @@ function resolveConfig(config) {
1440
1441
  }
1441
1442
 
1442
1443
  // src/http/types.ts
1444
+ var INVENTORY_APPROVAL_PRODUCT_ID = /* @__PURE__ */ Symbol("inventoryApprovalProductId");
1443
1445
  var IDEMPOTENT_METHODS = ["GET", "PUT", "DELETE"];
1444
1446
  var AUDIT_DECIMAL_ID = /^(?:0|[1-9]\d{0,18})$/;
1445
1447
  var MAX_AUDIT_ID = "9223372036854775807";
@@ -1586,6 +1588,11 @@ function countUdfConditions(conditions) {
1586
1588
  }
1587
1589
  return n;
1588
1590
  }
1591
+ function assertSupportedUdfConditions(conditions, operation) {
1592
+ if (operation.startsWith("inventory_items.") && conditions !== void 0 && countUdfConditions(conditions) > 0) {
1593
+ throw new AutotaskConfigError("InventoryItems has no record UDFs. Filter on its documented fields.", { operation });
1594
+ }
1595
+ }
1589
1596
  function serializeFilter(filter) {
1590
1597
  return JSON.stringify(filter);
1591
1598
  }
@@ -10965,6 +10972,65 @@ var RELATIONSHIP_MAP = {
10965
10972
  "deleteBoundary": null,
10966
10973
  "markerField": null
10967
10974
  },
10975
+ "inventory_items": {
10976
+ "resource": "inventory_items",
10977
+ "apiEntity": "InventoryItem",
10978
+ "kind": "entity",
10979
+ "path": "InventoryItems",
10980
+ "parentScoped": false,
10981
+ "tier": "extended",
10982
+ "workflowResource": false,
10983
+ "group": "A",
10984
+ "parent": null,
10985
+ "children": [],
10986
+ "naturalKeys": {
10987
+ "hasSearch": false,
10988
+ "searchCovers": null,
10989
+ "findBy": []
10990
+ },
10991
+ "blindSurfaces": null,
10992
+ "zoneFacts": {
10993
+ "createRequiredSet": [
10994
+ "inventoryLocationID",
10995
+ "productID",
10996
+ "quantityMinimum",
10997
+ "quantityMaximum",
10998
+ "quantityOnHand"
10999
+ ],
11000
+ "createGuidance": {
11001
+ "createOp": "inventory_items.create",
11002
+ "parentScoped": false,
11003
+ "liveProvenPrefix": [],
11004
+ "unproven": true,
11005
+ "blocker": {
11006
+ "kind": "unknown",
11007
+ "message": "Inventory access, an active location, a visible product and a unique product-location pair are required.",
11008
+ "remedy": "Read product and location metadata, supply the required quantities and preview before apply.",
11009
+ "requires": {
11010
+ "allOf": [
11011
+ "inventoryLocationID",
11012
+ "productID",
11013
+ "quantityMinimum",
11014
+ "quantityMaximum",
11015
+ "quantityOnHand"
11016
+ ]
11017
+ }
11018
+ },
11019
+ "vendorEvidence": [
11020
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryItemsEntity.htm"
11021
+ ],
11022
+ "deleteBoundary": {
11023
+ "available": false,
11024
+ "note": "The specification defines no public DELETE for InventoryItems."
11025
+ }
11026
+ }
11027
+ },
11028
+ "deleteBoundary": {
11029
+ "note": "The specification defines no public DELETE for InventoryItems. A created item cannot be removed through that API.",
11030
+ "proof": "spec-derived"
11031
+ },
11032
+ "markerField": null
11033
+ },
10968
11034
  "inventory_locations": {
10969
11035
  "resource": "inventory_locations",
10970
11036
  "apiEntity": "InventoryLocation",
@@ -11171,6 +11237,7 @@ var DELETE_BOUNDARY_NOTES = {
11171
11237
  "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.",
11172
11238
  "task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API.",
11173
11239
  "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.",
11240
+ "inventory_items": "The specification defines no public DELETE for InventoryItems. A created item cannot be removed through that API.",
11174
11241
  "inventory_locations": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API."
11175
11242
  };
11176
11243
  var RESPONSE_DRIFT_MARKERS = {
@@ -14098,6 +14165,34 @@ var CREATE_GUIDANCE = {
14098
14165
  "note": null
14099
14166
  }
14100
14167
  },
14168
+ {
14169
+ "resource": "inventory_items",
14170
+ "createOp": "inventory_items.create",
14171
+ "parentScoped": false,
14172
+ "liveProvenPrefix": [],
14173
+ "unproven": true,
14174
+ "blocker": {
14175
+ "kind": "unknown",
14176
+ "message": "Inventory access, an active location, a visible product and a unique product-location pair are required.",
14177
+ "remedy": "Read product and location metadata, supply the required quantities and preview before apply.",
14178
+ "requires": {
14179
+ "allOf": [
14180
+ "inventoryLocationID",
14181
+ "productID",
14182
+ "quantityMinimum",
14183
+ "quantityMaximum",
14184
+ "quantityOnHand"
14185
+ ]
14186
+ }
14187
+ },
14188
+ "vendorEvidence": [
14189
+ "https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryItemsEntity.htm"
14190
+ ],
14191
+ "deleteBoundary": {
14192
+ "available": false,
14193
+ "note": "The specification defines no public DELETE for InventoryItems."
14194
+ }
14195
+ },
14101
14196
  {
14102
14197
  "resource": "inventory_locations",
14103
14198
  "createOp": "inventory_locations.create",
@@ -15703,7 +15798,7 @@ var CREATE_GUIDANCE = {
15703
15798
  }
15704
15799
  ],
15705
15800
  "counts": {
15706
- "total": 117,
15801
+ "total": 118,
15707
15802
  "byKind": {
15708
15803
  "ok": 41,
15709
15804
  "blind-reference": 16,
@@ -15713,7 +15808,7 @@ var CREATE_GUIDANCE = {
15713
15808
  "resource-role-pair": 2,
15714
15809
  "delete-absent": 0,
15715
15810
  "non-mutable": 0,
15716
- "unknown": 41
15811
+ "unknown": 42
15717
15812
  }
15718
15813
  }
15719
15814
  };
@@ -16493,6 +16588,10 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
16493
16588
  "referenceLink",
16494
16589
  "title"
16495
16590
  ],
16591
+ "inventory_items": [
16592
+ "bin",
16593
+ "referenceNumber"
16594
+ ],
16496
16595
  "inventory_locations": [
16497
16596
  "locationName"
16498
16597
  ],
@@ -16964,9 +17063,9 @@ function isKnowledgeBaseRootResource(resource) {
16964
17063
  return resource === "knowledge_base_categories" || resource === "knowledge_base_articles";
16965
17064
  }
16966
17065
  function isExactRecordResource(resource) {
16967
- return resource === "inventory_locations" || resource === "internal_locations" || resource === "shipping_types" || isKnowledgeBaseRootResource(resource);
17066
+ return resource === "inventory_locations" || resource === "inventory_items" || resource === "internal_locations" || resource === "shipping_types" || isKnowledgeBaseRootResource(resource);
16968
17067
  }
16969
- var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|InternalLocations|ShippingTypes|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
17068
+ var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|InventoryItems|InternalLocations|ShippingTypes|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
16970
17069
  function exactRecordResponseTarget(path, method, operation) {
16971
17070
  const match = EXACT_RECORD_PATH.exec(path);
16972
17071
  if (match === null) return void 0;
@@ -17138,7 +17237,7 @@ function attachEmptyReasonDetails(err) {
17138
17237
  } : {
17139
17238
  surface,
17140
17239
  kind: "not-found",
17141
- note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : resource === "internal_locations" || resource === "shipping_types" ? "No record at this ID was visible to this API user." : resource === "knowledge_base_articles" ? "No published article at this ID was visible to this API user." : `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
17240
+ note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : resource === "internal_locations" || resource === "shipping_types" || resource === "inventory_items" ? "No record at this ID was visible to this API user." : resource === "knowledge_base_articles" ? "No published article at this ID was visible to this API user." : `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
17142
17241
  authority: `${resource}.query`,
17143
17242
  remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface \u2014 do not retry the same get`
17144
17243
  };
@@ -17704,7 +17803,8 @@ var HttpClient = class {
17704
17803
  }
17705
17804
  let parsed;
17706
17805
  try {
17707
- parsed = decodeResponseJson(text, s.auditTarget, s.recordTarget, decodeURIComponent(s.opts.path));
17806
+ const decodeTarget = opts[INVENTORY_APPROVAL_PRODUCT_ID] === true ? "item" : s.recordTarget;
17807
+ parsed = decodeResponseJson(text, s.auditTarget, decodeTarget, decodeURIComponent(s.opts.path));
17708
17808
  } catch {
17709
17809
  return this.handleNonJson2xx(s, res, status, text);
17710
17810
  }
@@ -18360,6 +18460,502 @@ function slimCompany(row) {
18360
18460
  return { id: row.id, companyName: row.companyName, isActive: row.isActive, parentCompanyID: row.parentCompanyID };
18361
18461
  }
18362
18462
 
18463
+ // src/resources/base/helpers.ts
18464
+ function describeResponseShape(body) {
18465
+ if (body === null) return "null";
18466
+ if (Array.isArray(body)) return `array(len=${body.length})`;
18467
+ if (typeof body !== "object") return typeof body;
18468
+ const rec = body;
18469
+ const keys = Object.keys(rec).sort();
18470
+ const typeOf = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
18471
+ const parts = keys.slice(0, 16).map((k) => `${k}:${typeOf(rec[k])}`);
18472
+ const more = keys.length > 16 ? `, +${keys.length - 16} more` : "";
18473
+ return `{ ${parts.join(", ")}${more} }`;
18474
+ }
18475
+ function defaultMarkerToken(data) {
18476
+ for (const field of ["name", "title"]) {
18477
+ const v = data[field];
18478
+ if (typeof v === "string" && v.trim() !== "") return v.trim();
18479
+ }
18480
+ return null;
18481
+ }
18482
+ var CONTEXT_ABSENT_MARKER = "#context-absent";
18483
+ function contextAbsentKey(path) {
18484
+ return path + "\0context-absent";
18485
+ }
18486
+ function noteCharsTruncationMarker(charsRemoved) {
18487
+ return `\u2026 [+${charsRemoved} chars truncated]`;
18488
+ }
18489
+ function truncateNoteChars(items, cap, fields) {
18490
+ let truncated = 0;
18491
+ const out = items.map((item) => {
18492
+ if (!isRecord2(item)) return item;
18493
+ let changed = false;
18494
+ const copy = { ...item };
18495
+ for (const field of fields) {
18496
+ const v = copy[field];
18497
+ if (typeof v === "string" && v !== REDACTED && v.length > cap) {
18498
+ const end = cap > 0 && (v.charCodeAt(cap - 1) & 64512) === 55296 ? cap - 1 : cap;
18499
+ copy[field] = v.slice(0, end) + noteCharsTruncationMarker(v.length - end);
18500
+ truncated += 1;
18501
+ changed = true;
18502
+ }
18503
+ }
18504
+ return changed ? copy : item;
18505
+ });
18506
+ return [out, truncated];
18507
+ }
18508
+ function blindEmptyReason(stamp) {
18509
+ return {
18510
+ surface: stamp.surface,
18511
+ kind: "blind-surface",
18512
+ note: stamp.note,
18513
+ authority: stamp.authority,
18514
+ remedy: "the note is the remedy \u2014 the authority op answers for a record"
18515
+ };
18516
+ }
18517
+ function attachUpdateTargetMissReason(err, key) {
18518
+ const pinned = EMPTY_REASON_STAMPS[key]?.update;
18519
+ if (pinned === void 0) return;
18520
+ err.details = { ...err.details ?? {}, emptyReason: pinned };
18521
+ }
18522
+ function buildDryRunResult(spec, policy) {
18523
+ if (spec.operation === "") {
18524
+ throw new AutotaskConfigError("dry-run: the operation name is required");
18525
+ }
18526
+ const wouldApply = spec.checks.every((check) => check.ok);
18527
+ const resource = spec.operation.split(".")[0] ?? spec.operation;
18528
+ const diffPart = spec.diff !== void 0 ? {
18529
+ diff: spec.diff.map((entry) => {
18530
+ if (entry.to === void 0) return entry;
18531
+ const to = isRedactedFieldName(entry.field, policy) ? REDACTED : redactResponseBody(entry.to, policy);
18532
+ return { ...entry, to };
18533
+ })
18534
+ } : {};
18535
+ const dataPart = spec.data !== void 0 ? { data: redactResponseBody(spec.data, policy) } : {};
18536
+ return {
18537
+ operation: spec.operation,
18538
+ wouldApply,
18539
+ target: { resource, ids: spec.ids },
18540
+ request: { method: spec.method, path: spec.path },
18541
+ ...diffPart,
18542
+ checks: spec.checks,
18543
+ impact: spec.impact,
18544
+ simulated: true,
18545
+ warnings: spec.warnings ?? [],
18546
+ ...dataPart,
18547
+ ...spec.emptyReason !== void 0 ? { emptyReason: spec.emptyReason } : {}
18548
+ };
18549
+ }
18550
+ function computeFieldDiff(current, data) {
18551
+ const out = [];
18552
+ for (const [field, to] of Object.entries(data)) {
18553
+ if (field === "id" || to === void 0) continue;
18554
+ const from = Object.hasOwn(current, field) ? current[field] : void 0;
18555
+ if (from !== void 0 && JSON.stringify(from) === JSON.stringify(to)) continue;
18556
+ out.push({ field, from: from === void 0 ? null : from, to });
18557
+ }
18558
+ return out;
18559
+ }
18560
+ function mergePartialBody(current, data) {
18561
+ const merged = { ...current };
18562
+ for (const [key, value] of Object.entries(data)) {
18563
+ if (value === void 0) continue;
18564
+ merged[key] = value;
18565
+ }
18566
+ return merged;
18567
+ }
18568
+ function snapshotMutationOptions(options) {
18569
+ const { dryRun, lastModifiedDate, maxRetries, raw, verifyPersisted } = options ?? {};
18570
+ if (dryRun !== void 0 && typeof dryRun !== "boolean") {
18571
+ throw new AutotaskConfigError("dryRun must be a boolean");
18572
+ }
18573
+ return { dryRun, lastModifiedDate, maxRetries, raw, verifyPersisted };
18574
+ }
18575
+ function normalizeUdfInput(value) {
18576
+ if (Array.isArray(value)) {
18577
+ return value.map((entry) => {
18578
+ if (!isRecord2(entry) || typeof entry.name !== "string" || entry.name === "") {
18579
+ throw new AutotaskConfigError("userDefinedFields array entries must be { name, value } objects");
18580
+ }
18581
+ return { name: entry.name, value: entry.value };
18582
+ });
18583
+ }
18584
+ if (isRecord2(value)) {
18585
+ return Object.entries(value).map(([name, entryValue]) => ({ name, value: entryValue }));
18586
+ }
18587
+ throw new AutotaskConfigError("userDefinedFields must be an array of { name, value } entries or a name-to-value map");
18588
+ }
18589
+ function blindStampFor(stamp, filter) {
18590
+ if (stamp === void 0) return void 0;
18591
+ if (stamp.kind !== "unfiltered-blind") return stamp;
18592
+ const conditions = normalizedConditions(filter);
18593
+ return conditions === void 0 || conditions.length === 0 ? stamp : void 0;
18594
+ }
18595
+ function decodeFileData(body) {
18596
+ if (isRecord2(body)) {
18597
+ const data = body.data;
18598
+ if (typeof data === "string") return Buffer.from(data, "base64");
18599
+ if (Array.isArray(data) && data.every((b) => typeof b === "number")) {
18600
+ return Buffer.from(data);
18601
+ }
18602
+ }
18603
+ if (typeof body === "string") return Buffer.from(body, "base64");
18604
+ throw new AutotaskError(
18605
+ "Expected the file envelope FileQueryResultModel { data } (or a base64 string); got a different shape",
18606
+ { code: "INVALID_RESPONSE", category: "server" }
18607
+ );
18608
+ }
18609
+ var DEPLURAL_EXCEPTIONS = {
18610
+ tag_aliase: "tag_alias"
18611
+ };
18612
+ function entityNameFromPath(resourcePath) {
18613
+ const segment = resourcePath.slice(resourcePath.lastIndexOf("/") + 1);
18614
+ const snake = segment.replace(/([A-Z])/g, (_m, c, i) => (i > 0 ? `_` : "") + c.toLowerCase()).replace(/_{2,}/g, "_");
18615
+ if (snake.endsWith("ies")) return `${snake.slice(0, -3)}y`;
18616
+ if (snake.endsWith("s")) {
18617
+ const stripped = snake.slice(0, -1);
18618
+ return DEPLURAL_EXCEPTIONS[stripped] ?? stripped;
18619
+ }
18620
+ return snake;
18621
+ }
18622
+
18623
+ // src/resources/special/inventoryItems.ts
18624
+ var REFERENCES = ["inventoryLocationID", "productID"];
18625
+ var QUANTITIES = ["quantityMinimum", "quantityMaximum", "quantityOnHand"];
18626
+ var TEXT_FIELDS = ["bin", "referenceNumber"];
18627
+ var MUTATION_OPTIONS = ["dryRun", "lastModifiedDate", "maxRetries", "raw", "verifyPersisted", "expectedInventoryFacts"];
18628
+ function fail(message) {
18629
+ throw new AutotaskConfigError(`inventory_items: ${message}`);
18630
+ }
18631
+ function own(record, field) {
18632
+ return Object.hasOwn(record, field) ? record[field] : void 0;
18633
+ }
18634
+ function int32(value, label, minimum = -2147483648) {
18635
+ if (typeof value !== "number" || !Number.isInteger(value) || value < minimum || value > 2147483647) {
18636
+ fail(`${label} must be an integer between ${minimum} and 2147483647`);
18637
+ }
18638
+ return value;
18639
+ }
18640
+ function inventoryItemId(value) {
18641
+ const id = parseIdentifier(value, "inventory_items: id");
18642
+ if (!isAuditDecimalId(String(id))) fail("id must fit a signed 64-bit integer");
18643
+ return id;
18644
+ }
18645
+ function admitInventoryItem(value, creating) {
18646
+ if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("data must be a plain record");
18647
+ const body = captureInventoryPayload(value)();
18648
+ const writable = [...QUANTITIES, ...TEXT_FIELDS, ...creating ? REFERENCES : []];
18649
+ for (const field of Object.keys(body)) {
18650
+ if (!writable.some((name) => name === field)) fail(`${field} is not a writable InventoryItems field on ${creating ? "create" : "update"}`);
18651
+ }
18652
+ if (!creating && Object.keys(body).length === 0) fail("update must contain a writable field");
18653
+ if (creating) for (const field of REFERENCES) int32(own(body, field), field, 1);
18654
+ for (const field of QUANTITIES) {
18655
+ const nonnegative = field === "quantityMinimum" || creating && field === "quantityOnHand";
18656
+ if (creating || Object.hasOwn(body, field)) int32(own(body, field), field, nonnegative ? 0 : void 0);
18657
+ }
18658
+ for (const field of TEXT_FIELDS) {
18659
+ const text = own(body, field);
18660
+ if (Object.hasOwn(body, field) && (typeof text !== "string" || text.length > 50)) fail(`${field} must be a string of at most 50 characters`);
18661
+ }
18662
+ assertQuantityRange(own(body, "quantityMinimum"), own(body, "quantityMaximum"));
18663
+ return body;
18664
+ }
18665
+ function captureInventoryPayload(value) {
18666
+ if (types.isProxy(value)) fail("payload must not be a Proxy");
18667
+ if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("data must be a plain record");
18668
+ const descriptors = Object.getOwnPropertyDescriptors(value);
18669
+ const captured = /* @__PURE__ */ Object.create(null);
18670
+ const accessors = [];
18671
+ for (const [field, descriptor2] of Object.entries(descriptors)) {
18672
+ if (!descriptor2.enumerable) continue;
18673
+ if (Object.hasOwn(descriptor2, "value")) captured[field] = descriptor2.value;
18674
+ else accessors.push([field, descriptor2]);
18675
+ }
18676
+ return (allowAccessors = true) => {
18677
+ if (!allowAccessors && accessors.length > 0) fail("approved InventoryItems payload fields must be data properties; accessors are unsupported");
18678
+ const body = { ...captured };
18679
+ for (const [field, descriptor2] of accessors) {
18680
+ const capturedValue = descriptor2.get === void 0 ? void 0 : Reflect.apply(descriptor2.get, value, []);
18681
+ Object.defineProperty(body, field, { value: capturedValue, enumerable: true });
18682
+ }
18683
+ return body;
18684
+ };
18685
+ }
18686
+ function captureInventoryOptionDescriptors(options) {
18687
+ if (types.isProxy(options)) fail("options must not be a Proxy");
18688
+ if (!isRecord2(options)) fail("options must be an object");
18689
+ const prototype = Object.getPrototypeOf(options);
18690
+ for (let owner = prototype; owner !== null && owner !== Object.prototype; owner = Object.getPrototypeOf(owner)) {
18691
+ if (types.isProxy(owner)) fail("options must not inherit from a Proxy");
18692
+ }
18693
+ const descriptors = Object.getOwnPropertyDescriptors(options);
18694
+ const fact = Object.hasOwn(descriptors, "expectedInventoryFacts") ? descriptors.expectedInventoryFacts : void 0;
18695
+ if (fact === void 0 ? "expectedInventoryFacts" in options : !Object.hasOwn(fact, "value")) {
18696
+ fail("expectedInventoryFacts must be an own data property; accessors are unsupported");
18697
+ }
18698
+ const suppliedFacts = fact?.value;
18699
+ if (suppliedFacts !== void 0 && ![Object.prototype, null].includes(prototype)) fail("approved options must be a plain record");
18700
+ const expectedInventoryFacts = suppliedFacts === void 0 ? void 0 : snapshotExpectedInventoryFacts(suppliedFacts);
18701
+ return { options, descriptors, expectedInventoryFacts };
18702
+ }
18703
+ function snapshotInventoryMutationOptions(value) {
18704
+ const { options, descriptors, expectedInventoryFacts } = captureInventoryOptionDescriptors(value === void 0 ? {} : value);
18705
+ for (const key of MUTATION_OPTIONS) {
18706
+ if (key !== "expectedInventoryFacts" && !Object.hasOwn(descriptors, key) && key in options) fail(`${key} must be an own option`);
18707
+ }
18708
+ if (expectedInventoryFacts !== void 0 && Object.values(descriptors).some((descriptor2) => !Object.hasOwn(descriptor2, "value"))) fail("approved InventoryItems options must be data properties; accessors are unsupported");
18709
+ const captured = /* @__PURE__ */ Object.create(null);
18710
+ const dryRun = Object.hasOwn(descriptors, "dryRun") ? descriptors.dryRun : void 0;
18711
+ if (dryRun !== void 0) {
18712
+ const dataFlag = Object.hasOwn(dryRun, "value");
18713
+ const value2 = dataFlag ? dryRun.value : dryRun.get === void 0 ? void 0 : Reflect.apply(dryRun.get, options, []);
18714
+ captured.dryRun = !dataFlag && value2 === void 0 ? true : value2;
18715
+ }
18716
+ for (const key of MUTATION_OPTIONS) {
18717
+ if (key === "expectedInventoryFacts" || key === "dryRun") continue;
18718
+ const descriptor2 = descriptors[key];
18719
+ captured[key] = descriptor2 === void 0 ? void 0 : Object.hasOwn(descriptor2, "value") ? descriptor2.value : descriptor2.get === void 0 ? void 0 : Reflect.apply(descriptor2.get, options, []);
18720
+ }
18721
+ const result = snapshotMutationOptions(captured);
18722
+ if (expectedInventoryFacts !== void 0) result.expectedInventoryFacts = expectedInventoryFacts;
18723
+ if (result.lastModifiedDate !== void 0) fail("no documented stale timestamp is available");
18724
+ if (result.raw !== void 0 && result.raw !== false) fail("raw updates are unsupported");
18725
+ if (result.maxRetries !== void 0 && (!Number.isSafeInteger(result.maxRetries) || result.maxRetries < 0)) fail("maxRetries must be a nonnegative safe integer");
18726
+ if (result.verifyPersisted !== void 0 && typeof result.verifyPersisted !== "boolean") fail("verifyPersisted must be a boolean");
18727
+ return result;
18728
+ }
18729
+ function validateInventoryFactIntent(result, creating, data) {
18730
+ const facts = result.expectedInventoryFacts;
18731
+ if (facts === void 0) return;
18732
+ if (creating ? facts.item !== void 0 || facts.product === void 0 || facts.location === void 0 : facts.item === void 0 || facts.location !== void 0 || (Object.hasOwn(data, "quantityOnHand") ? facts.product === void 0 : facts.product !== void 0)) {
18733
+ fail("expectedInventoryFacts must supply only the facts required by this create or update");
18734
+ }
18735
+ if (creating && (facts.product.id !== data.productID || facts.location.id !== data.inventoryLocationID)) fail("expectedInventoryFacts references must match the submitted references");
18736
+ }
18737
+ function captureInventoryItemCall(value, options, creating) {
18738
+ const payload = captureInventoryPayload(value);
18739
+ const opts = snapshotInventoryMutationOptions(options);
18740
+ const body = admitInventoryItem(payload(opts.expectedInventoryFacts === void 0), creating);
18741
+ validateInventoryFactIntent(opts, creating, body);
18742
+ return { body, opts };
18743
+ }
18744
+ function deferredInventoryPayload(value, allowAccessors) {
18745
+ if (types.isProxy(value)) fail("payload must not be a Proxy");
18746
+ if (!isRecord2(value)) return value;
18747
+ if (![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("data must be a plain record");
18748
+ const result = Object.create(Object.getPrototypeOf(value));
18749
+ for (const [field, descriptor2] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
18750
+ if (!descriptor2.enumerable) continue;
18751
+ if (Object.hasOwn(descriptor2, "value")) Object.defineProperty(result, field, { value: descriptor2.value, enumerable: true });
18752
+ else {
18753
+ if (!allowAccessors) fail("approved InventoryItems payload fields must be data properties; accessors are unsupported");
18754
+ let resolved = false;
18755
+ let captured;
18756
+ Object.defineProperty(result, field, { enumerable: true, get() {
18757
+ if (!resolved) {
18758
+ captured = descriptor2.get === void 0 ? void 0 : Reflect.apply(descriptor2.get, value, []);
18759
+ resolved = true;
18760
+ }
18761
+ return captured;
18762
+ } });
18763
+ }
18764
+ }
18765
+ return result;
18766
+ }
18767
+ function captureInventoryInvocationArgs(operation, args) {
18768
+ if (operation !== "inventory_items.create" && operation !== "inventory_items.update") return () => args;
18769
+ if (types.isProxy(args)) fail("invoke arguments must not be a Proxy");
18770
+ const array = Array.isArray(args);
18771
+ if (!array && (!isRecord2(args) || ![Object.prototype, null].includes(Object.getPrototypeOf(args))) || array && args.length !== (operation === "inventory_items.create" ? 1 : 2)) fail("InventoryItems invoke requires its documented positional or plain named inputs");
18772
+ const descriptors = Object.getOwnPropertyDescriptors(args);
18773
+ if (!array && Object.getOwnPropertySymbols(descriptors).length > 0) fail("InventoryItems named inputs must use string keys");
18774
+ const dataKey = array ? operation === "inventory_items.create" ? "0" : "1" : "data";
18775
+ const payload = descriptors[dataKey];
18776
+ const pinnedPayload = payload !== void 0 && Object.hasOwn(payload, "value") ? deferredInventoryPayload(payload.value, true) : void 0;
18777
+ return (allowAccessors = true) => {
18778
+ const result = array ? [] : Object.create(Object.getPrototypeOf(args));
18779
+ for (const [key, descriptor2] of Object.entries(descriptors)) {
18780
+ if (array && key === "length") continue;
18781
+ const enumerable = !array || descriptor2.enumerable;
18782
+ if (Object.hasOwn(descriptor2, "value")) {
18783
+ const value = key === dataKey ? deferredInventoryPayload(pinnedPayload, allowAccessors) : descriptor2.value;
18784
+ Object.defineProperty(result, key, { value, enumerable, configurable: true });
18785
+ } else {
18786
+ if (!allowAccessors) fail("approved InventoryItems named inputs must be data properties; accessors are unsupported");
18787
+ let resolved = false;
18788
+ let captured;
18789
+ Object.defineProperty(result, key, { enumerable, configurable: true, get() {
18790
+ if (!resolved) {
18791
+ const value = descriptor2.get === void 0 ? void 0 : Reflect.apply(descriptor2.get, args, []);
18792
+ captured = key === dataKey ? deferredInventoryPayload(value, true) : value;
18793
+ resolved = true;
18794
+ }
18795
+ return captured;
18796
+ } });
18797
+ }
18798
+ }
18799
+ return result;
18800
+ };
18801
+ }
18802
+ var ITEM_NUMERIC_FACTS = [...REFERENCES, ...QUANTITIES, "quantityPicked", "quantityReserved", "quantityOnOrder", "backOrderQuantity", "impersonatorCreatorResourceID"];
18803
+ var ITEM_FACT_KEYS = ["id", ...ITEM_NUMERIC_FACTS, ...TEXT_FIELDS];
18804
+ function inventoryItemGuardFacts(value) {
18805
+ const captured = closedFacts(value, ITEM_FACT_KEYS, false);
18806
+ if (!Object.hasOwn(captured, "id")) fail("inventory facts require an own item id");
18807
+ const facts = { id: inventoryItemId(captured.id) };
18808
+ for (const field of ITEM_NUMERIC_FACTS) if (Object.hasOwn(captured, field)) {
18809
+ const current = captured[field];
18810
+ facts[field] = current === null ? null : int32(current, "inventory fact");
18811
+ }
18812
+ for (const field of TEXT_FIELDS) if (Object.hasOwn(captured, field)) {
18813
+ const current = captured[field];
18814
+ if (current !== null && typeof current !== "string") fail("inventory text facts must be strings or null");
18815
+ facts[field] = current;
18816
+ }
18817
+ return facts;
18818
+ }
18819
+ function closedFacts(value, fields, closed = true) {
18820
+ if (types.isProxy(value)) fail("expectedInventoryFacts records must not be a Proxy");
18821
+ if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("expectedInventoryFacts must contain plain records");
18822
+ const descriptors = Object.getOwnPropertyDescriptors(value);
18823
+ if (closed && Reflect.ownKeys(descriptors).some((key) => typeof key !== "string" || !fields.includes(key))) fail("expectedInventoryFacts contains an unsupported field");
18824
+ for (const key of fields) if (key in value && !Object.hasOwn(value, key)) fail("expectedInventoryFacts fields must be own fields");
18825
+ const captured = /* @__PURE__ */ Object.create(null);
18826
+ for (const key of fields) {
18827
+ const descriptor2 = descriptors[key];
18828
+ if (descriptor2 === void 0) continue;
18829
+ if (!Object.hasOwn(descriptor2, "value")) fail("expectedInventoryFacts fields must be data properties; accessors are unsupported");
18830
+ captured[key] = descriptor2.value;
18831
+ }
18832
+ return captured;
18833
+ }
18834
+ function snapshotExpectedInventoryFacts(value) {
18835
+ const source = closedFacts(value, ["item", "product", "location"]);
18836
+ const result = {};
18837
+ if (Object.hasOwn(source, "item")) {
18838
+ const item = closedFacts(source.item, ITEM_FACT_KEYS);
18839
+ result.item = inventoryItemGuardFacts(item);
18840
+ }
18841
+ for (const kind of ["product", "location"]) if (Object.hasOwn(source, kind)) {
18842
+ const flag = kind === "product" ? "isSerialized" : "isActive";
18843
+ const record = closedFacts(source[kind], ["id", flag]);
18844
+ const id = int32(own(record, "id"), "expected reference id", 1);
18845
+ const state2 = own(record, flag);
18846
+ if (typeof state2 !== "boolean") fail("expected reference state must be an own boolean");
18847
+ if (kind === "product") result.product = { id, isSerialized: state2 };
18848
+ else result.location = { id, isActive: state2 };
18849
+ }
18850
+ return result;
18851
+ }
18852
+ function rejectInventoryFactsOption(options, operation) {
18853
+ if (operation === "inventory_items.create" || operation === "inventory_items.update" || !isRecord2(options)) return;
18854
+ const option = Object.getOwnPropertyDescriptor(options, "expectedInventoryFacts");
18855
+ if (option === void 0 && !("expectedInventoryFacts" in options)) return;
18856
+ if (option !== void 0 && Object.hasOwn(option, "value") && option.value === void 0) return;
18857
+ fail("expectedInventoryFacts is supported only by inventory_items.create/update");
18858
+ }
18859
+ function inventoryFactsStale(operation) {
18860
+ const error = new StaleObjectError("inventory_items: approved facts changed; no mutation was sent", {
18861
+ operation,
18862
+ suggestedAction: "Read fresh inventory facts and generate a new preview and approval before retrying."
18863
+ });
18864
+ Object.assign(error, { notSent: true });
18865
+ throw error;
18866
+ }
18867
+ function rethrowInventoryGuardError(error, expected, operation) {
18868
+ if (expected !== void 0 && error instanceof NotFoundError && error.httpStatus === 200) inventoryFactsStale(operation);
18869
+ throw error;
18870
+ }
18871
+ function assertApprovedFacts(expected, actual, operation) {
18872
+ const before = expected;
18873
+ const after = actual;
18874
+ if (Object.keys(before).length !== Object.keys(after).length || Object.keys(before).some((key) => !Object.hasOwn(after, key) || before[key] !== after[key])) {
18875
+ inventoryFactsStale(operation);
18876
+ }
18877
+ }
18878
+ function assertQuantityRange(minimum, maximum) {
18879
+ if (typeof minimum === "number" && typeof maximum === "number" && maximum < minimum) fail("quantityMaximum must be at least quantityMinimum");
18880
+ }
18881
+ function exactItem(value, id, label, approvedOperation) {
18882
+ const record = isRecord2(value);
18883
+ if (approvedOperation !== void 0 && (!record || own(value, "id") === null)) {
18884
+ throw Object.assign(new AutotaskError("InventoryItems approval could not verify the Product item or its exact ID", {
18885
+ code: "INVALID_RESPONSE",
18886
+ category: "server",
18887
+ operation: approvedOperation
18888
+ }), { notSent: true });
18889
+ }
18890
+ if (!record) fail(`${label} must be a record`);
18891
+ if (approvedOperation !== void 0 && !Object.hasOwn(value, "id")) inventoryFactsStale(approvedOperation);
18892
+ const returned = own(value, "id");
18893
+ if (typeof returned !== "string" && (typeof returned !== "number" || !Number.isSafeInteger(returned))) fail(`${label} requires its own exact id`);
18894
+ if (String(returned) !== String(id)) {
18895
+ if (approvedOperation !== void 0 && isAuditDecimalId(String(returned))) inventoryFactsStale(approvedOperation);
18896
+ fail(`${label} id must match the requested id`);
18897
+ }
18898
+ return value;
18899
+ }
18900
+ async function productIsSerialized(http, id, checkedBaseUrl, maxRetries, expected, mutationOperation = "inventory_items.update") {
18901
+ const operation = "products.get";
18902
+ const body = await http.request({
18903
+ method: "GET",
18904
+ path: `/V1.0/Products/${id}`,
18905
+ operation,
18906
+ maxRetries,
18907
+ checkedBaseUrl,
18908
+ ...expected !== void 0 ? { [INVENTORY_APPROVAL_PRODUCT_ID]: true } : {}
18909
+ });
18910
+ let raw;
18911
+ try {
18912
+ raw = unwrapItem(body, id, operation, "product");
18913
+ } catch (error) {
18914
+ rethrowInventoryGuardError(error, expected === void 0 ? void 0 : { }, mutationOperation);
18915
+ }
18916
+ const product = exactItem(raw, id, "product", expected === void 0 ? void 0 : mutationOperation);
18917
+ const serialized = own(product, "isSerialized");
18918
+ if (expected !== void 0) assertApprovedFacts(expected, { id, isSerialized: serialized }, mutationOperation);
18919
+ if (typeof serialized !== "boolean") fail("product requires a fresh boolean isSerialized fact");
18920
+ return serialized;
18921
+ }
18922
+ async function guardInventoryItemCreate(http, data, checkedBaseUrl, maxRetries, expected) {
18923
+ const locationId = data.inventoryLocationID;
18924
+ const operation = "inventory_locations.get";
18925
+ const body = await http.request({ method: "GET", path: `/V1.0/InventoryLocations/${locationId}`, operation, maxRetries, checkedBaseUrl });
18926
+ let raw;
18927
+ try {
18928
+ raw = unwrapItem(body, locationId, operation, "inventory_location");
18929
+ } catch (error) {
18930
+ rethrowInventoryGuardError(error, expected, "inventory_items.create");
18931
+ }
18932
+ const location = exactItem(raw, locationId, "inventory location");
18933
+ if (expected?.location !== void 0) assertApprovedFacts(expected.location, { id: locationId, isActive: own(location, "isActive") }, "inventory_items.create");
18934
+ if (own(location, "isActive") !== true) fail("inventory location requires a fresh isActive value explicitly true");
18935
+ if (await productIsSerialized(http, data.productID, checkedBaseUrl, maxRetries, expected?.product, "inventory_items.create") && data.quantityOnHand !== 0) {
18936
+ fail("quantityOnHand must be zero when creating an item for a serialized product");
18937
+ }
18938
+ }
18939
+ async function checkInventoryItemCurrent(http, data, current, id, checkedBaseUrl, maxRetries, expected) {
18940
+ const item = exactItem(current, id, "current record");
18941
+ if (expected?.item !== void 0) assertApprovedFacts(expected.item, inventoryItemGuardFacts(item), "inventory_items.update");
18942
+ const minimum = own(data, "quantityMinimum");
18943
+ const maximum = own(data, "quantityMaximum");
18944
+ if (minimum !== void 0 || maximum !== void 0) {
18945
+ assertQuantityRange(
18946
+ minimum ?? int32(own(item, "quantityMinimum"), "current quantityMinimum", 0),
18947
+ maximum ?? int32(own(item, "quantityMaximum"), "current quantityMaximum")
18948
+ );
18949
+ }
18950
+ const onHand = own(data, "quantityOnHand");
18951
+ if (typeof onHand !== "number") return;
18952
+ const picked = int32(own(item, "quantityPicked"), "current quantityPicked");
18953
+ const reserved = int32(own(item, "quantityReserved"), "current quantityReserved");
18954
+ if (onHand < picked + reserved) fail("quantityOnHand must be at least quantityPicked plus quantityReserved");
18955
+ const productId = int32(own(item, "productID"), "current productID", 1);
18956
+ if (await productIsSerialized(http, productId, checkedBaseUrl, maxRetries, expected?.product)) fail("quantityOnHand is read-only on update for a serialized product");
18957
+ }
18958
+
18363
18959
  // src/operations/requiredFields.ts
18364
18960
  function effectiveRequiredFields(record, zoneFacts) {
18365
18961
  const guidance = zoneFacts?.createGuidance;
@@ -18527,13 +19123,13 @@ async function runBounded(fn, items, opts) {
18527
19123
  const results = new Array(items.length);
18528
19124
  let next = 0;
18529
19125
  let failure;
18530
- const fail4 = (error, index) => {
19126
+ const fail5 = (error, index) => {
18531
19127
  if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
18532
19128
  };
18533
19129
  const worker = async () => {
18534
19130
  while (failure === void 0 && next < items.length) {
18535
19131
  if (signal?.aborted) {
18536
- fail4(signal.reason, -1);
19132
+ fail5(signal.reason, -1);
18537
19133
  return;
18538
19134
  }
18539
19135
  const i = next++;
@@ -18543,7 +19139,7 @@ async function runBounded(fn, items, opts) {
18543
19139
  results[i] = settle ? { status: "fulfilled", value } : value;
18544
19140
  } catch (error) {
18545
19141
  if (settle) results[i] = { status: "rejected", reason: error };
18546
- else fail4(error, i);
19142
+ else fail5(error, i);
18547
19143
  }
18548
19144
  }
18549
19145
  };
@@ -18963,166 +19559,6 @@ async function fieldCatalog(client, opts) {
18963
19559
  return result;
18964
19560
  }
18965
19561
 
18966
- // src/resources/base/helpers.ts
18967
- function describeResponseShape(body) {
18968
- if (body === null) return "null";
18969
- if (Array.isArray(body)) return `array(len=${body.length})`;
18970
- if (typeof body !== "object") return typeof body;
18971
- const rec = body;
18972
- const keys = Object.keys(rec).sort();
18973
- const typeOf = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
18974
- const parts = keys.slice(0, 16).map((k) => `${k}:${typeOf(rec[k])}`);
18975
- const more = keys.length > 16 ? `, +${keys.length - 16} more` : "";
18976
- return `{ ${parts.join(", ")}${more} }`;
18977
- }
18978
- function defaultMarkerToken(data) {
18979
- for (const field of ["name", "title"]) {
18980
- const v = data[field];
18981
- if (typeof v === "string" && v.trim() !== "") return v.trim();
18982
- }
18983
- return null;
18984
- }
18985
- var CONTEXT_ABSENT_MARKER = "#context-absent";
18986
- function contextAbsentKey(path) {
18987
- return path + "\0context-absent";
18988
- }
18989
- function noteCharsTruncationMarker(charsRemoved) {
18990
- return `\u2026 [+${charsRemoved} chars truncated]`;
18991
- }
18992
- function truncateNoteChars(items, cap, fields) {
18993
- let truncated = 0;
18994
- const out = items.map((item) => {
18995
- if (!isRecord2(item)) return item;
18996
- let changed = false;
18997
- const copy = { ...item };
18998
- for (const field of fields) {
18999
- const v = copy[field];
19000
- if (typeof v === "string" && v !== REDACTED && v.length > cap) {
19001
- const end = cap > 0 && (v.charCodeAt(cap - 1) & 64512) === 55296 ? cap - 1 : cap;
19002
- copy[field] = v.slice(0, end) + noteCharsTruncationMarker(v.length - end);
19003
- truncated += 1;
19004
- changed = true;
19005
- }
19006
- }
19007
- return changed ? copy : item;
19008
- });
19009
- return [out, truncated];
19010
- }
19011
- function blindEmptyReason(stamp) {
19012
- return {
19013
- surface: stamp.surface,
19014
- kind: "blind-surface",
19015
- note: stamp.note,
19016
- authority: stamp.authority,
19017
- remedy: "the note is the remedy \u2014 the authority op answers for a record"
19018
- };
19019
- }
19020
- function attachUpdateTargetMissReason(err, key) {
19021
- const pinned = EMPTY_REASON_STAMPS[key]?.update;
19022
- if (pinned === void 0) return;
19023
- err.details = { ...err.details ?? {}, emptyReason: pinned };
19024
- }
19025
- function buildDryRunResult(spec, policy) {
19026
- if (spec.operation === "") {
19027
- throw new AutotaskConfigError("dry-run: the operation name is required");
19028
- }
19029
- const wouldApply = spec.checks.every((check) => check.ok);
19030
- const resource = spec.operation.split(".")[0] ?? spec.operation;
19031
- const diffPart = spec.diff !== void 0 ? {
19032
- diff: spec.diff.map((entry) => {
19033
- if (entry.to === void 0) return entry;
19034
- const to = isRedactedFieldName(entry.field, policy) ? REDACTED : redactResponseBody(entry.to, policy);
19035
- return { ...entry, to };
19036
- })
19037
- } : {};
19038
- const dataPart = spec.data !== void 0 ? { data: redactResponseBody(spec.data, policy) } : {};
19039
- return {
19040
- operation: spec.operation,
19041
- wouldApply,
19042
- target: { resource, ids: spec.ids },
19043
- request: { method: spec.method, path: spec.path },
19044
- ...diffPart,
19045
- checks: spec.checks,
19046
- impact: spec.impact,
19047
- simulated: true,
19048
- warnings: spec.warnings ?? [],
19049
- ...dataPart,
19050
- ...spec.emptyReason !== void 0 ? { emptyReason: spec.emptyReason } : {}
19051
- };
19052
- }
19053
- function computeFieldDiff(current, data) {
19054
- const out = [];
19055
- for (const [field, to] of Object.entries(data)) {
19056
- if (field === "id" || to === void 0) continue;
19057
- const from = Object.hasOwn(current, field) ? current[field] : void 0;
19058
- if (from !== void 0 && JSON.stringify(from) === JSON.stringify(to)) continue;
19059
- out.push({ field, from: from === void 0 ? null : from, to });
19060
- }
19061
- return out;
19062
- }
19063
- function mergePartialBody(current, data) {
19064
- const merged = { ...current };
19065
- for (const [key, value] of Object.entries(data)) {
19066
- if (value === void 0) continue;
19067
- merged[key] = value;
19068
- }
19069
- return merged;
19070
- }
19071
- function snapshotMutationOptions(options) {
19072
- const { dryRun, lastModifiedDate, maxRetries, raw, verifyPersisted } = options ?? {};
19073
- if (dryRun !== void 0 && typeof dryRun !== "boolean") {
19074
- throw new AutotaskConfigError("dryRun must be a boolean");
19075
- }
19076
- return { dryRun, lastModifiedDate, maxRetries, raw, verifyPersisted };
19077
- }
19078
- function normalizeUdfInput(value) {
19079
- if (Array.isArray(value)) {
19080
- return value.map((entry) => {
19081
- if (!isRecord2(entry) || typeof entry.name !== "string" || entry.name === "") {
19082
- throw new AutotaskConfigError("userDefinedFields array entries must be { name, value } objects");
19083
- }
19084
- return { name: entry.name, value: entry.value };
19085
- });
19086
- }
19087
- if (isRecord2(value)) {
19088
- return Object.entries(value).map(([name, entryValue]) => ({ name, value: entryValue }));
19089
- }
19090
- throw new AutotaskConfigError("userDefinedFields must be an array of { name, value } entries or a name-to-value map");
19091
- }
19092
- function blindStampFor(stamp, filter) {
19093
- if (stamp === void 0) return void 0;
19094
- if (stamp.kind !== "unfiltered-blind") return stamp;
19095
- const conditions = normalizedConditions(filter);
19096
- return conditions === void 0 || conditions.length === 0 ? stamp : void 0;
19097
- }
19098
- function decodeFileData(body) {
19099
- if (isRecord2(body)) {
19100
- const data = body.data;
19101
- if (typeof data === "string") return Buffer.from(data, "base64");
19102
- if (Array.isArray(data) && data.every((b) => typeof b === "number")) {
19103
- return Buffer.from(data);
19104
- }
19105
- }
19106
- if (typeof body === "string") return Buffer.from(body, "base64");
19107
- throw new AutotaskError(
19108
- "Expected the file envelope FileQueryResultModel { data } (or a base64 string); got a different shape",
19109
- { code: "INVALID_RESPONSE", category: "server" }
19110
- );
19111
- }
19112
- var DEPLURAL_EXCEPTIONS = {
19113
- tag_aliase: "tag_alias"
19114
- };
19115
- function entityNameFromPath(resourcePath) {
19116
- const segment = resourcePath.slice(resourcePath.lastIndexOf("/") + 1);
19117
- const snake = segment.replace(/([A-Z])/g, (_m, c, i) => (i > 0 ? `_` : "") + c.toLowerCase()).replace(/_{2,}/g, "_");
19118
- if (snake.endsWith("ies")) return `${snake.slice(0, -3)}y`;
19119
- if (snake.endsWith("s")) {
19120
- const stripped = snake.slice(0, -1);
19121
- return DEPLURAL_EXCEPTIONS[stripped] ?? stripped;
19122
- }
19123
- return snake;
19124
- }
19125
-
19126
19562
  // src/operations/nameSnapshot.ts
19127
19563
  function nameRecordSnapshot(cache, path, id, operation) {
19128
19564
  const body = cache?.get(path);
@@ -19967,17 +20403,17 @@ function validateParamsBag(record, args) {
19967
20403
  }
19968
20404
  );
19969
20405
  }
19970
- var INVOKE_OPTION_KEYS = ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh", "verifyPersisted", "mode"];
20406
+ var INVOKE_OPTION_KEYS = ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh", "verifyPersisted", "expectedInventoryFacts", "mode"];
19971
20407
  function validateInvokeOptions(opts, operation) {
19972
20408
  if (opts === void 0 || opts === null) return;
19973
20409
  const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
19974
20410
  if (unknown.length === 0) return;
19975
- const suggestions = keySuggestions(unknown, ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh", "verifyPersisted"]);
20411
+ const suggestions = keySuggestions(unknown, ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh", "verifyPersisted", "expectedInventoryFacts"]);
19976
20412
  throw new AutotaskConfigError(
19977
- `invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries, fresh, verifyPersisted; "mode" is internal to the mode wrappers)`,
20413
+ `invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries, fresh, verifyPersisted, expectedInventoryFacts; "mode" is internal to the mode wrappers)`,
19978
20414
  {
19979
20415
  operation,
19980
- suggestedAction: suggestions.length > 0 ? `Fix the option name (${suggestions.join(", ")}).` : `Pass only dryRun / confirm / lastModifiedDate / maxRetries / fresh / verifyPersisted.`
20416
+ suggestedAction: suggestions.length > 0 ? `Fix the option name (${suggestions.join(", ")}).` : `Pass only dryRun / confirm / lastModifiedDate / maxRetries / fresh / verifyPersisted / expectedInventoryFacts.`
19981
20417
  }
19982
20418
  );
19983
20419
  }
@@ -19996,24 +20432,24 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
19996
20432
  }
19997
20433
 
19998
20434
  // src/resources/special/inventoryLocations.ts
19999
- var fail = (message) => {
20435
+ var fail2 = (message) => {
20000
20436
  throw new AutotaskConfigError(`inventory_locations: ${message}`);
20001
20437
  };
20002
20438
  function admitInventoryLocation(value, creating) {
20003
- if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail("data must be a plain record");
20439
+ if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail2("data must be a plain record");
20004
20440
  const body = { ...value };
20005
- for (const field of Object.keys(body)) if (!["locationName", "isActive"].includes(field)) fail(`${field} is not a writable InventoryLocations field`);
20441
+ for (const field of Object.keys(body)) if (!["locationName", "isActive"].includes(field)) fail2(`${field} is not a writable InventoryLocations field`);
20006
20442
  const hasName = Object.hasOwn(body, "locationName");
20007
20443
  const hasActive = Object.hasOwn(body, "isActive");
20008
- if (creating && !hasName || hasName && (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");
20009
- if (creating && !hasActive || hasActive && typeof body.isActive !== "boolean") fail("isActive must be a boolean");
20010
- if (!creating && !hasName && !hasActive) fail("update must contain locationName or isActive");
20444
+ if (creating && !hasName || hasName && (typeof body.locationName !== "string" || body.locationName.trim() === "" || body.locationName.length > 50)) fail2("locationName is required and must be a nonblank string of at most 50 characters");
20445
+ if (creating && !hasActive || hasActive && typeof body.isActive !== "boolean") fail2("isActive must be a boolean");
20446
+ if (!creating && !hasName && !hasActive) fail2("update must contain locationName or isActive");
20011
20447
  return body;
20012
20448
  }
20013
20449
  function checkInventoryLocationCurrent(value, current, id) {
20014
- if (!isRecord2(current) || !Object.hasOwn(current, "id")) fail("current record requires its own id");
20015
- if (parseIdentifier(current.id, "inventory_locations: current id") !== id) fail("current record id must match the requested id");
20016
- if (Object.hasOwn(value, "isActive") && value.isActive === false && (!Object.hasOwn(current, "isDefault") || current.isDefault !== false)) fail("inactivation requires a fresh current isDefault value explicitly false; default or unknown locations cannot be inactivated");
20450
+ if (!isRecord2(current) || !Object.hasOwn(current, "id")) fail2("current record requires its own id");
20451
+ if (parseIdentifier(current.id, "inventory_locations: current id") !== id) fail2("current record id must match the requested id");
20452
+ if (Object.hasOwn(value, "isActive") && value.isActive === false && (!Object.hasOwn(current, "isDefault") || current.isDefault !== false)) fail2("inactivation requires a fresh current isDefault value explicitly false; default or unknown locations cannot be inactivated");
20017
20453
  }
20018
20454
 
20019
20455
  // src/resources/base/types.ts
@@ -20183,6 +20619,7 @@ var MODEL_FIELD_SETS = {
20183
20619
  "holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
20184
20620
  "holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
20185
20621
  "internal_locations": ["id", "additionalAddressInfo", "address1", "address2", "city", "country", "holidaySetId", "isDefault", "name", "postalCode", "state", "timeZone"],
20622
+ "inventory_items": ["id", "backOrderQuantity", "bin", "impersonatorCreatorResourceID", "inventoryLocationID", "productID", "quantityMaximum", "quantityMinimum", "quantityOnHand", "quantityOnOrder", "quantityPicked", "quantityReserved", "referenceNumber"],
20186
20623
  "inventory_locations": ["id", "impersonatorCreatorResourceID", "isActive", "isDefault", "locationName", "resourceID"],
20187
20624
  "inventory_products": ["id", "availableUnits", "backOrderQuantity", "bin", "createDateTime", "createdByResourceID", "inventoryLocationID", "onHandUnits", "pickedUnits", "productID", "quantityMaximum", "quantityMinimum", "referenceNumber", "reservedUnits", "unitsOnOrder"],
20188
20625
  "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"],
@@ -20424,27 +20861,28 @@ function validateRelationLeaves(resourceKey, conditions, op) {
20424
20861
  assertUndottedUdfField(c, op);
20425
20862
  const field = c.field;
20426
20863
  const [rel, sub, ...rest] = field.split(".");
20427
- const fail4 = (why) => {
20864
+ const fail5 = (why) => {
20428
20865
  throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
20429
20866
  operation: op,
20430
20867
  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.`
20431
20868
  });
20432
20869
  };
20433
20870
  if (selfPrefixes(resourceKey).includes(rel)) {
20434
- if (rest.length > 0 || !sub) fail4("is not <resource>.<field> (multi-hop relations are not supported)");
20871
+ if (rest.length > 0 || !sub) fail5("is not <resource>.<field> (multi-hop relations are not supported)");
20435
20872
  continue;
20436
20873
  }
20437
- if (rest.length > 0 || !sub) fail4("is not <relation>.<field> (multi-hop relations are not supported)");
20438
- if (!valid.includes(rel)) fail4(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
20874
+ if (rest.length > 0 || !sub) fail5("is not <relation>.<field> (multi-hop relations are not supported)");
20875
+ if (!valid.includes(rel)) fail5(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
20439
20876
  const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
20440
20877
  if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
20441
- fail4(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
20878
+ fail5(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
20442
20879
  }
20443
20880
  }
20444
20881
  };
20445
20882
  walk(conditions);
20446
20883
  }
20447
20884
  async function rewriteRelationFilters(http, resourceKey, conditions, op) {
20885
+ assertSupportedUdfConditions(conditions, op);
20448
20886
  if (!hasRelationConditions(conditions)) return void 0;
20449
20887
  const conds = conditions;
20450
20888
  validateRelationLeaves(resourceKey, conds, op);
@@ -20797,11 +21235,13 @@ var QueryBase = class {
20797
21235
  walkPageSize(params) {
20798
21236
  return clampPageSize(params?.maxRecords ?? this.defaultPageSize);
20799
21237
  }
21238
+ /** Capture mutable input for Knowledge Base and InventoryItems reads. */
20800
21239
  snapshotKnowledgeBaseQuery(params) {
20801
- if (isKnowledgeBaseRootResource(this.config.key) && isRecord2(params)) {
21240
+ const knowledgeBase = isKnowledgeBaseRootResource(this.config.key);
21241
+ if ((knowledgeBase || this.config.key === "inventory_items") && isRecord2(params)) {
20802
21242
  const captured = snapshotQueryBag(params, QUERY_BAG_KEYS);
20803
21243
  const conditions = Array.isArray(captured.filter) ? captured.filter : captured.filter?.filter;
20804
- if (conditions?.length === 0) delete captured.filter;
21244
+ if (knowledgeBase && conditions?.length === 0) delete captured.filter;
20805
21245
  return captured;
20806
21246
  }
20807
21247
  return params;
@@ -20842,7 +21282,7 @@ var QueryBase = class {
20842
21282
  }
20843
21283
  /** Stream page objects (the resource `queryPages` surface; relation filters resolve first, #281). */
20844
21284
  async *queryPageIter(params) {
20845
- const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
21285
+ const walk = await this.relationWalkParams(this.snapshotKnowledgeBaseQuery(params), `${this.config.key}.query`);
20846
21286
  if (walk === void 0) return;
20847
21287
  yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: this.continueAcrossEmptyPage() });
20848
21288
  }
@@ -21879,26 +22319,26 @@ var MetaBase = class _MetaBase extends QueryBase {
21879
22319
 
21880
22320
  // src/resources/special/knowledgeBaseCategories.ts
21881
22321
  function admitKnowledgeBaseCategory(data, creating, staleToken) {
21882
- const fail4 = (message) => {
22322
+ const fail5 = (message) => {
21883
22323
  throw new AutotaskConfigError(`knowledge_base_categories: ${message}`);
21884
22324
  };
21885
- if (!creating && staleToken !== void 0) fail4("no documented stale timestamp is available");
21886
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
22325
+ if (!creating && staleToken !== void 0) fail5("no documented stale timestamp is available");
22326
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
21887
22327
  const body = { ...data };
21888
- for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field)) fail4(`${field} is not a writable KnowledgeBaseCategories field`);
22328
+ for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field)) fail5(`${field} is not a writable KnowledgeBaseCategories field`);
21889
22329
  for (const [field, max] of [["name", 50], ["description", 1e3]]) {
21890
22330
  const value = body[field];
21891
- if (value !== void 0 && (typeof value !== "string" || value.length > max)) fail4(`${field} must be a string of at most ${max} characters`);
22331
+ if (value !== void 0 && (typeof value !== "string" || value.length > max)) fail5(`${field} must be a string of at most ${max} characters`);
21892
22332
  }
21893
- if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === "")) fail4("name is required");
21894
- if (creating && body.parentCategoryID === void 0) fail4("parentCategoryID is required; choose a documented visible category rather than guessing a root id");
22333
+ if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === "")) fail5("name is required");
22334
+ if (creating && body.parentCategoryID === void 0) fail5("parentCategoryID is required; choose a documented visible category rather than guessing a root id");
21895
22335
  const parent = body.parentCategoryID;
21896
22336
  if (parent !== void 0) {
21897
- if (typeof parent !== "number") return fail4("parentCategoryID must be a numeric identifier");
22337
+ if (typeof parent !== "number") return fail5("parentCategoryID must be a numeric identifier");
21898
22338
  parseIdentifier(parent, "parentCategoryID");
21899
- if (parent > 2147483647) fail4("parentCategoryID must fit a signed 32-bit integer");
22339
+ if (parent > 2147483647) fail5("parentCategoryID must fit a signed 32-bit integer");
21900
22340
  }
21901
- if (!creating && !Object.values(body).some((value) => value !== void 0)) fail4("update must contain a writable field");
22341
+ if (!creating && !Object.values(body).some((value) => value !== void 0)) fail5("update must contain a writable field");
21902
22342
  return body;
21903
22343
  }
21904
22344
  function categoryReplacement(body) {
@@ -21912,45 +22352,45 @@ function categoryReplacement(body) {
21912
22352
  }
21913
22353
 
21914
22354
  // src/resources/special/knowledgeBaseArticles.ts
21915
- function fail2(detail) {
22355
+ function fail3(detail) {
21916
22356
  throw new AutotaskConfigError(`knowledge_base_articles: ${detail}`);
21917
22357
  }
21918
22358
  function reference(value, name) {
21919
- if (typeof value !== "number") fail2(`${name} must be a numeric identifier`);
22359
+ if (typeof value !== "number") fail3(`${name} must be a numeric identifier`);
21920
22360
  parseIdentifier(value, name);
21921
- if (value > 2147483647) fail2(`${name} must fit a signed 32-bit integer`);
22361
+ if (value > 2147483647) fail3(`${name} must fit a signed 32-bit integer`);
21922
22362
  return value;
21923
22363
  }
21924
22364
  function articleParent(value) {
21925
22365
  const parent = parseIdentifier(value, "parentId");
21926
- if (typeof parent !== "number" || parent > 2147483647) fail2("parentId must fit a signed 32-bit category identifier");
21927
- if (parent === 0) fail2("parentId must name an article category");
22366
+ if (typeof parent !== "number" || parent > 2147483647) fail3("parentId must fit a signed 32-bit category identifier");
22367
+ if (parent === 0) fail3("parentId must name an article category");
21928
22368
  return parent;
21929
22369
  }
21930
22370
  function admitArticle(data, parentId, creating) {
21931
22371
  const parent = articleParent(parentId);
21932
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail2("data must be a plain record");
22372
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
21933
22373
  const body = { ...data };
21934
22374
  const allowed = ["articleCategoryID", "publish", "title", "errorCodes", "keywords", "referenceLink", "isActive"];
21935
22375
  for (const key of Object.keys(body)) {
21936
- if (!allowed.includes(key)) fail2(`${key} is not a writable article root field`);
22376
+ if (!allowed.includes(key)) fail3(`${key} is not a writable article root field`);
21937
22377
  if (key !== "articleCategoryID" && body[key] === void 0) delete body[key];
21938
22378
  }
21939
22379
  for (const [field, max] of [["title", 200], ["errorCodes", 200], ["keywords", 300], ["referenceLink", 500]]) {
21940
- if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max)) fail2(`${field} must be a string of at most ${max} characters`);
21941
- }
21942
- if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim())) fail2("title is required and cannot be blank");
21943
- if (!creating && Object.hasOwn(body, "articleCategoryID")) fail2("articleCategoryID is read-only after creation");
21944
- if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent)) fail2("articleCategoryID must match parentId");
21945
- 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");
21946
- if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean") fail2("isActive must be boolean");
21947
- if (!creating && !Object.keys(body).length) fail2("update must contain a writable field");
22380
+ if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max)) fail3(`${field} must be a string of at most ${max} characters`);
22381
+ }
22382
+ if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim())) fail3("title is required and cannot be blank");
22383
+ if (!creating && Object.hasOwn(body, "articleCategoryID")) fail3("articleCategoryID is read-only after creation");
22384
+ if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent)) fail3("articleCategoryID must match parentId");
22385
+ if ((creating || Object.hasOwn(body, "publish")) && (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish) || body.publish < -2147483648 || body.publish > 2147483647)) fail3("publish must be an int32 from current field metadata");
22386
+ if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean") fail3("isActive must be boolean");
22387
+ if (!creating && !Object.keys(body).length) fail3("update must contain a writable field");
21948
22388
  return body;
21949
22389
  }
21950
22390
  async function guardArticle(http, parentId, id, maxRetries) {
21951
22391
  const parent = articleParent(parentId);
21952
22392
  const target = id === void 0 ? void 0 : parseIdentifier(id, "id");
21953
- if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target)))) fail2("id must name an article within the signed 64-bit range");
22393
+ if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target)))) fail3("id must name an article within the signed 64-bit range");
21954
22394
  unwrapItem(await http.request({ method: "GET", path: `/V1.0/KnowledgeBaseCategories/${parent}`, operation: "knowledge_base_categories.get", maxRetries }), parent, "knowledge_base_categories.get", "article_category");
21955
22395
  if (target !== void 0) {
21956
22396
  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");
@@ -21959,7 +22399,7 @@ async function guardArticle(http, parentId, id, maxRetries) {
21959
22399
  }
21960
22400
  function assertArticlePublish(data, fields) {
21961
22401
  if (!Object.hasOwn(data, "publish")) return;
21962
- const unavailable = () => fail2("publish requires an unambiguous active value in current field metadata");
22402
+ const unavailable = () => fail3("publish requires an unambiguous active value in current field metadata");
21963
22403
  if (!Array.isArray(fields)) unavailable();
21964
22404
  const rows = fields.filter((field) => isRecord2(field) && field.name === "publish");
21965
22405
  if (rows.length !== 1 || rows[0].isPickList !== true || rows[0].isReadOnly !== false || !Array.isArray(rows[0].picklistValues)) unavailable();
@@ -21993,14 +22433,15 @@ var MutationBase = class extends MetaBase {
21993
22433
  return body;
21994
22434
  }
21995
22435
  /** `POST /V1.0/<E>` → `{ id }` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
21996
- async createGlobal(data, opts = {}) {
22436
+ async createGlobal(data, opts = {}, checkedBaseUrl) {
21997
22437
  const body = this.normalizeMutationBody(data);
21998
22438
  const res = await this.http.request({
21999
22439
  method: "POST",
22000
22440
  path: this.resourcePath,
22001
22441
  body,
22002
22442
  operation: `${this.config.key}.create`,
22003
- maxRetries: opts.maxRetries
22443
+ maxRetries: opts.maxRetries,
22444
+ ...checkedBaseUrl === void 0 ? {} : { checkedBaseUrl, maintenanceMaxWaitMs: 0 }
22004
22445
  });
22005
22446
  return this.unwrapCreateOperation(res, body, opts);
22006
22447
  }
@@ -22172,11 +22613,12 @@ var MutationBase = class extends MetaBase {
22172
22613
  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);
22173
22614
  const submitted = data;
22174
22615
  const persisted = stored;
22175
- if (this.config.key === "inventory_locations") {
22176
- if (!Object.hasOwn(persisted, "id")) throw new AutotaskConfigError("inventory_locations: persisted record requires its own id");
22616
+ const inventory = this.config.key === "inventory_locations" || this.config.key === "inventory_items";
22617
+ if (inventory) {
22618
+ if (!Object.hasOwn(persisted, "id")) throw new AutotaskConfigError(`${this.config.key}: persisted record requires its own id`);
22177
22619
  validateExactRecordResponse({ item: persisted }, "item", `${this.resourcePath}/${parseIdentifier(id, "id")}`, "GET", void 0, `${this.config.key}.get`);
22178
22620
  }
22179
- const notPersisted = this.config.key === "inventory_locations" ? Object.keys(submitted).filter((field) => !Object.hasOwn(persisted, field) || submitted[field] !== persisted[field]) : notPersistedFields(submitted, persisted);
22621
+ const notPersisted = inventory ? Object.keys(submitted).filter((field) => !Object.hasOwn(persisted, field) || submitted[field] !== persisted[field]) : notPersistedFields(submitted, persisted);
22180
22622
  return { ...result, notPersisted };
22181
22623
  } catch (err) {
22182
22624
  return { ...result, persistedCheckFailed: err instanceof AutotaskError ? err.code : `UNKNOWN (${err instanceof Error ? err.name : typeof err})` };
@@ -22563,9 +23005,14 @@ var MutationBase = class extends MetaBase {
22563
23005
  const method = scopedUpdate || partialCollection !== void 0 ? "PATCH" : "PUT";
22564
23006
  let current;
22565
23007
  try {
22566
- 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));
23008
+ current = currentRecord ?? (parentId === void 0 ? await this.getGlobal(id, true, this.config.key === "knowledge_base_categories" || partialCollection !== void 0 ? opts.maxRetries : void 0, partialCollection?.checkedBaseUrl) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true));
22567
23009
  } catch (err) {
22568
23010
  if (err instanceof NotFoundError) {
23011
+ if (this.config.key === "inventory_items" && opts.expectedInventoryFacts !== void 0) {
23012
+ if (err.httpStatus === 200) inventoryFactsStale(operation);
23013
+ Object.assign(err, { notSent: true });
23014
+ throw err;
23015
+ }
22569
23016
  const reasons = EMPTY_REASON_STAMPS[this.config.key];
22570
23017
  const updateReason = reasons?.update ?? (partialCollection === void 0 ? void 0 : reasons?.get);
22571
23018
  checks.push({
@@ -22589,7 +23036,7 @@ var MutationBase = class extends MetaBase {
22589
23036
  throw err;
22590
23037
  }
22591
23038
  checks.push({ name: "current-record-exists", ok: true });
22592
- partialCollection?.checkCurrent(current);
23039
+ if (partialCollection !== void 0) await partialCollection.checkCurrent(current);
22593
23040
  if (this.staleObjectCheck(current, opts, operation)) {
22594
23041
  checks.push({ name: "stale-check", ok: true });
22595
23042
  }
@@ -22671,34 +23118,34 @@ var BaseResource = class extends MutationBase {
22671
23118
  };
22672
23119
 
22673
23120
  // src/resources/special/taskPredecessors.ts
22674
- function fail3(detail) {
23121
+ function fail4(detail) {
22675
23122
  throw new AutotaskConfigError(`task_predecessors: ${detail}`);
22676
23123
  }
22677
23124
  function numeric(value, field) {
22678
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail3(`${field} must be a positive numeric identifier`);
23125
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail4(`${field} must be a positive numeric identifier`);
22679
23126
  return value;
22680
23127
  }
22681
23128
  function predecessorParent(value) {
22682
23129
  const parent = parseIdentifier(value, "parentId");
22683
- if (parent === 0) fail3("parentId must name a successor task");
23130
+ if (parent === 0) fail4("parentId must name a successor task");
22684
23131
  return parent;
22685
23132
  }
22686
23133
  function assertPredecessorBinding(value, parentId, id) {
22687
- if (!isRecord2(value)) fail3("the returned record must establish id and successorTaskID parent");
22688
- 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");
23134
+ if (!isRecord2(value)) fail4("the returned record must establish id and successorTaskID parent");
23135
+ if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId))) fail4("the returned record must match id and successorTaskID parent");
22689
23136
  }
22690
23137
  function admitTaskPredecessor(data, parentId, creating) {
22691
23138
  const parent = predecessorParent(parentId);
22692
- if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
23139
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
22693
23140
  const payload = { ...data };
22694
23141
  const allowed = creating ? ["predecessorTaskID", "successorTaskID", "lagDays"] : ["lagDays"];
22695
- 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");
22696
- 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");
23142
+ if (Object.keys(payload).some((key) => !allowed.includes(key))) fail4(creating ? "only predecessorTaskID, successorTaskID and lagDays are writable on create" : "only lagDays can be updated");
23143
+ if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647)) fail4("lagDays must be an int32 integer");
22697
23144
  if (creating) {
22698
23145
  const successor = numeric(payload.successorTaskID, "successorTaskID");
22699
23146
  const predecessor = numeric(payload.predecessorTaskID, "predecessorTaskID");
22700
- if (String(successor) !== String(parent)) fail3("successorTaskID must match parentId");
22701
- if (predecessor === successor) fail3("predecessorTaskID and successorTaskID must be distinct");
23147
+ if (String(successor) !== String(parent)) fail4("successorTaskID must match parentId");
23148
+ if (predecessor === successor) fail4("predecessorTaskID and successorTaskID must be distinct");
22702
23149
  }
22703
23150
  return payload;
22704
23151
  }
@@ -22707,50 +23154,50 @@ async function guardTaskPredecessor(http, parentId, id, data) {
22707
23154
  let row = data;
22708
23155
  if (id !== void 0) {
22709
23156
  const target = parseIdentifier(id, "id");
22710
- if (target === 0) fail3("id must name a predecessor relationship");
23157
+ if (target === 0) fail4("id must name a predecessor relationship");
22711
23158
  row = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${parent}/Predecessors/${target}`, operation: "task_predecessors.get" }), target, "task_predecessors.get", "task_predecessor");
22712
23159
  assertPredecessorBinding(row, parent, target);
22713
23160
  }
22714
23161
  const predecessor = numeric(row?.predecessorTaskID, "predecessorTaskID");
22715
23162
  const successor = numeric(row?.successorTaskID, "successorTaskID");
22716
- if (predecessor === successor) fail3("predecessorTaskID and successorTaskID must be distinct");
23163
+ if (predecessor === successor) fail4("predecessorTaskID and successorTaskID must be distinct");
22717
23164
  const projects = [];
22718
23165
  for (const taskId of [predecessor, successor]) {
22719
23166
  const task = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${taskId}`, operation: "tasks.get" }), taskId, "tasks.get", "task");
22720
- if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail3("the returned task must match its requested id");
23167
+ if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail4("the returned task must match its requested id");
22721
23168
  projects.push(numeric(task.projectID, "task.projectID"));
22722
23169
  }
22723
- if (projects[0] !== projects[1]) fail3("predecessor and successor tasks must belong to the same project");
23170
+ if (projects[0] !== projects[1]) fail4("predecessor and successor tasks must belong to the same project");
22724
23171
  }
22725
23172
 
22726
23173
  // src/resources/special/taskNotes.ts
22727
23174
  var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
22728
23175
  function admitTaskNote(data, parentId, creating) {
22729
23176
  const parent = parseIdentifier(parentId, "parentId");
22730
- const fail4 = (message) => {
23177
+ const fail5 = (message) => {
22731
23178
  throw new AutotaskConfigError(`task_notes: ${message}`);
22732
23179
  };
22733
- if (data === null || typeof data !== "object" || Array.isArray(data)) fail4("data must be a record");
23180
+ if (data === null || typeof data !== "object" || Array.isArray(data)) fail5("data must be a record");
22734
23181
  const body = data;
22735
- for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail4(`${key} is not a writable TaskNotes field`);
23182
+ for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail5(`${key} is not a writable TaskNotes field`);
22736
23183
  for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
22737
23184
  const value = body[field];
22738
- if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail4(`${field} must be a string of at most ${maximum} characters`);
23185
+ if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail5(`${field} must be a string of at most ${maximum} characters`);
22739
23186
  }
22740
- if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail4("description is required");
23187
+ if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail5("description is required");
22741
23188
  for (const field of ["noteType", "publish"]) {
22742
23189
  const value = body[field];
22743
- if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail4(`${field} must be an integer from the current field metadata`);
23190
+ if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail5(`${field} must be an integer from the current field metadata`);
22744
23191
  }
22745
- if (creating && body.taskID === void 0) fail4("taskID is required in the create body and must match parentId");
23192
+ if (creating && body.taskID === void 0) fail5("taskID is required in the create body and must match parentId");
22746
23193
  for (const field of ["createdByContactID", "taskID"]) {
22747
23194
  if (body[field] !== void 0) {
22748
- if (typeof body[field] !== "number") fail4(`${field} must be a numeric identifier`);
23195
+ if (typeof body[field] !== "number") fail5(`${field} must be a numeric identifier`);
22749
23196
  const id = parseIdentifier(body[field], field);
22750
- if (field === "taskID" && String(id) !== String(parent)) fail4("taskID must match the parentId path argument");
23197
+ if (field === "taskID" && String(id) !== String(parent)) fail5("taskID must match the parentId path argument");
22751
23198
  }
22752
23199
  }
22753
- if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail4("update must contain a writable field");
23200
+ if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail5("update must contain a writable field");
22754
23201
  }
22755
23202
 
22756
23203
  // src/operations/invoke/fieldSuggest.ts
@@ -22885,8 +23332,8 @@ function collectFilterFieldNames(conditions, resourceKey, operation = `${resourc
22885
23332
  continue;
22886
23333
  }
22887
23334
  if (resourceKey !== void 0) {
22888
- const own = normalizeOwnField(resourceKey, cond.field);
22889
- if (own !== cond.field) out.push(own);
23335
+ const own2 = normalizeOwnField(resourceKey, cond.field);
23336
+ if (own2 !== cond.field) out.push(own2);
22890
23337
  }
22891
23338
  }
22892
23339
  }
@@ -22978,6 +23425,7 @@ async function validateQueryFieldNames(record, holder, args) {
22978
23425
  let filterNames;
22979
23426
  if (bag["filter"] !== void 0) {
22980
23427
  const conditions = normalizedConditions(bag["filter"]);
23428
+ assertSupportedUdfConditions(conditions, record.id);
22981
23429
  filterNames = collectFilterFieldNames(conditions ?? [], record.resource, record.id);
22982
23430
  }
22983
23431
  if (fieldCheck === false) return;
@@ -23020,38 +23468,38 @@ function isBase64(value) {
23020
23468
  }
23021
23469
  function admitTaskAttachment(data, parentId) {
23022
23470
  const parent = parseIdentifier(parentId, "parentId");
23023
- const fail4 = (message) => {
23471
+ const fail5 = (message) => {
23024
23472
  throw new AutotaskConfigError(`task_attachments: ${message}`);
23025
23473
  };
23026
- if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
23474
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
23027
23475
  const body = data;
23028
- for (const field of Object.keys(body)) if (!WRITABLE2.has(field)) fail4(`${field} is not a supported create field`);
23476
+ for (const field of Object.keys(body)) if (!WRITABLE2.has(field)) fail5(`${field} is not a supported create field`);
23029
23477
  for (const field of ["attachmentType", "fullPath", "title"]) {
23030
- if (typeof body[field] !== "string" || body[field].trim() === "") fail4(`${field} is required and must be a non-empty string`);
23478
+ if (typeof body[field] !== "string" || body[field].trim() === "") fail5(`${field} is required and must be a non-empty string`);
23031
23479
  }
23032
- if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail4("publish must be an integer from current field metadata");
23480
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail5("publish must be an integer from current field metadata");
23033
23481
  for (const field of ["data", "contentType"]) {
23034
- if (body[field] !== void 0 && typeof body[field] !== "string") fail4(`${field} must be a string`);
23482
+ if (body[field] !== void 0 && typeof body[field] !== "string") fail5(`${field} must be a string`);
23035
23483
  }
23036
23484
  if (body.attachmentType === "FILE_ATTACHMENT") {
23037
- if (typeof body.data !== "string" || body.data === "") return fail4("FILE_ATTACHMENT requires non-empty base64 data");
23038
- if (!isBase64(body.data)) fail4("FILE_ATTACHMENT data must be base64 encoded");
23485
+ if (typeof body.data !== "string" || body.data === "") return fail5("FILE_ATTACHMENT requires non-empty base64 data");
23486
+ if (!isBase64(body.data)) fail5("FILE_ATTACHMENT data must be base64 encoded");
23039
23487
  }
23040
23488
  if (body.taskID !== void 0) {
23041
- if (typeof body.taskID !== "number") fail4("taskID must be a numeric identifier");
23042
- if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent)) fail4("taskID must match the parentId path argument");
23489
+ if (typeof body.taskID !== "number") fail5("taskID must be a numeric identifier");
23490
+ if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent)) fail5("taskID must match the parentId path argument");
23043
23491
  }
23044
23492
  if (body.parentAttachmentID !== void 0) {
23045
- if (typeof body.parentAttachmentID !== "number") fail4("parentAttachmentID must be a numeric identifier");
23493
+ if (typeof body.parentAttachmentID !== "number") fail5("parentAttachmentID must be a numeric identifier");
23046
23494
  parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
23047
23495
  }
23048
23496
  }
23049
23497
  function admitFileAttachment(resource, data, parentId) {
23050
23498
  parseIdentifier(parentId, "parentId");
23051
- const fail4 = (message) => {
23499
+ const fail5 = (message) => {
23052
23500
  throw new AutotaskConfigError(`${resource}: ${message}`);
23053
23501
  };
23054
- if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
23502
+ if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
23055
23503
  const body = data;
23056
23504
  const reference2 = {
23057
23505
  project_attachments: void 0,
@@ -23064,20 +23512,20 @@ function admitFileAttachment(resource, data, parentId) {
23064
23512
  configuration_item_attachments: "parentAttachmentID",
23065
23513
  configuration_item_note_attachments: void 0
23066
23514
  }[resource];
23067
- for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2) fail4(`${field} is not a supported create field`);
23068
- if (body.attachmentType !== "FILE_ATTACHMENT") fail4("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
23515
+ for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2) fail5(`${field} is not a supported create field`);
23516
+ if (body.attachmentType !== "FILE_ATTACHMENT") fail5("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
23069
23517
  const maxLength = resource === "project_attachments" ? void 0 : 255;
23070
23518
  for (const field of ["fullPath", "title"]) {
23071
23519
  const value = body[field];
23072
23520
  const requirement = `${field} is required and must be a nonblank string${maxLength === void 0 ? "" : ` of at most ${maxLength} characters`}`;
23073
- if (typeof value !== "string" || value.trim() === "") return fail4(requirement);
23074
- if (maxLength !== void 0 && value.length > maxLength) fail4(requirement);
23521
+ if (typeof value !== "string" || value.trim() === "") return fail5(requirement);
23522
+ if (maxLength !== void 0 && value.length > maxLength) fail5(requirement);
23075
23523
  }
23076
- if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail4("publish must be an integer from current field metadata");
23077
- if (typeof body.data !== "string" || !isBase64(body.data)) fail4("FILE_ATTACHMENT requires nonempty base64 data");
23524
+ if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail5("publish must be an integer from current field metadata");
23525
+ if (typeof body.data !== "string" || !isBase64(body.data)) fail5("FILE_ATTACHMENT requires nonempty base64 data");
23078
23526
  if (reference2 !== void 0 && body[reference2] !== void 0) {
23079
- if (typeof body[reference2] !== "number") fail4(`${reference2} must be a numeric identifier`);
23080
- if (parseIdentifier(body[reference2], reference2) === 0) fail4(`${reference2} must be positive`);
23527
+ if (typeof body[reference2] !== "number") fail5(`${reference2} must be a numeric identifier`);
23528
+ if (parseIdentifier(body[reference2], reference2) === 0) fail5(`${reference2} must be positive`);
23081
23529
  }
23082
23530
  }
23083
23531
  function admitScopedAttachmentQuery(resource, params) {
@@ -23936,6 +24384,16 @@ var SIMPLE_RESOURCES = [
23936
24384
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
23937
24385
  opForms: { get: "global" }
23938
24386
  },
24387
+ {
24388
+ key: "inventory_items",
24389
+ accessor: "inventoryItems",
24390
+ resourcePath: "/V1.0/InventoryItems",
24391
+ deletable: false,
24392
+ udfCapable: false,
24393
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
24394
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
24395
+ opForms: { get: "global", create: "global", update: "global" }
24396
+ },
23939
24397
  {
23940
24398
  key: "inventory_locations",
23941
24399
  accessor: "inventoryLocations",
@@ -24851,7 +25309,7 @@ var GenericResource = class extends BaseResource {
24851
25309
  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 () => {
24852
25310
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
24853
25311
  };
24854
- if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles", "inventory_locations"].includes(config.key)) this.createIfNotExists = async () => {
25312
+ if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles", "inventory_locations", "inventory_items"].includes(config.key)) this.createIfNotExists = async () => {
24855
25313
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
24856
25314
  };
24857
25315
  if (config.key === "knowledge_base_categories") {
@@ -24944,6 +25402,7 @@ var GenericResource = class extends BaseResource {
24944
25402
  }
24945
25403
  async create(a, b = void 0, c = void 0) {
24946
25404
  this.requireOp("create");
25405
+ rejectInventoryFactsOption(isIdentifier(a) ? c : b, `${this.config.key}.create`);
24947
25406
  if (isIdentifier(a)) {
24948
25407
  if (this.config.opForms?.create === "global") throw new OperationNotSupportedError(this.config.key, "create");
24949
25408
  const parentId = this.config.key === "knowledge_base_articles" ? articleParent(a) : a;
@@ -24966,6 +25425,19 @@ var GenericResource = class extends BaseResource {
24966
25425
  return this.createScopedRaw(parentId, data2, opts2);
24967
25426
  }
24968
25427
  if (this.config.opForms?.create === "scoped") throw new OperationNotSupportedError(this.config.key, "create");
25428
+ if (this.config.key === "inventory_items") {
25429
+ const { body, opts: opts2 } = captureInventoryItemCall(a, b, true);
25430
+ const checkedBaseUrl = this.http.baseUrl;
25431
+ try {
25432
+ await guardInventoryItemCreate(this.http, body, checkedBaseUrl, opts2.maxRetries, opts2.expectedInventoryFacts);
25433
+ } catch (error) {
25434
+ if (error instanceof AutotaskError) Object.assign(error, { notSent: true });
25435
+ throw error;
25436
+ }
25437
+ if (opts2.dryRun === true) return this.runCreateDryRun(body);
25438
+ const result = await this.createGlobal(body, opts2, checkedBaseUrl);
25439
+ return this.withPersistedCheck(result, body, opts2, result.id, void 0, checkedBaseUrl);
25440
+ }
24969
25441
  const data = this.config.key === "knowledge_base_categories" ? admitKnowledgeBaseCategory(a, true) : this.config.key === "inventory_locations" ? admitInventoryLocation(a, true) : a;
24970
25442
  const supplied = b;
24971
25443
  const opts = ["knowledge_base_categories", "inventory_locations"].includes(this.config.key) ? snapshotMutationOptions(supplied) : supplied ?? {};
@@ -24974,6 +25446,7 @@ var GenericResource = class extends BaseResource {
24974
25446
  }
24975
25447
  async update(a, b = void 0, c = void 0, d = void 0) {
24976
25448
  this.requireOp("update");
25449
+ rejectInventoryFactsOption(isIdentifier(b) ? d : c, `${this.config.key}.update`);
24977
25450
  if (isIdentifier(a) && isIdentifier(b)) {
24978
25451
  if (this.config.opForms?.update === "global") throw new OperationNotSupportedError(this.config.key, "update");
24979
25452
  const parentId = this.config.key === "knowledge_base_articles" ? articleParent(a) : a;
@@ -24994,6 +25467,20 @@ var GenericResource = class extends BaseResource {
24994
25467
  return this.updateScopedRaw(parentId, id2, data2, opts2);
24995
25468
  }
24996
25469
  if (this.config.opForms?.update === "scoped") throw new OperationNotSupportedError(this.config.key, "update");
25470
+ if (this.config.key === "inventory_items") {
25471
+ const id2 = inventoryItemId(a);
25472
+ const { body, opts: opts2 } = captureInventoryItemCall(b, c, false);
25473
+ const checkedBaseUrl = this.http.baseUrl;
25474
+ const checkCurrent = (current) => checkInventoryItemCurrent(this.http, body, current, id2, checkedBaseUrl, opts2.maxRetries, opts2.expectedInventoryFacts);
25475
+ if (opts2.dryRun === true) return this.runUpdateDryRun(id2, body, opts2, void 0, void 0, { checkCurrent, checkedBaseUrl });
25476
+ try {
25477
+ await checkCurrent(await this.getGlobal(id2, true, opts2.maxRetries, checkedBaseUrl));
25478
+ } catch (error) {
25479
+ if (error instanceof AutotaskError) Object.assign(error, { notSent: true });
25480
+ rethrowInventoryGuardError(error, opts2.expectedInventoryFacts, "inventory_items.update");
25481
+ }
25482
+ return this.updateGlobal(id2, body, opts2, "PATCH", checkedBaseUrl);
25483
+ }
24997
25484
  const category = this.config.key === "knowledge_base_categories";
24998
25485
  const location = this.config.key === "inventory_locations";
24999
25486
  const id = category || location ? parseIdentifier(a, "id") : a;
@@ -25024,6 +25511,7 @@ var GenericResource = class extends BaseResource {
25024
25511
  }
25025
25512
  async delete(a, b = void 0, c = void 0) {
25026
25513
  this.requireOp("delete");
25514
+ rejectInventoryFactsOption(isIdentifier(b) ? c : b, `${this.config.key}.delete`);
25027
25515
  if (isIdentifier(a) && isIdentifier(b)) {
25028
25516
  if (this.config.opForms?.delete === "global") throw new OperationNotSupportedError(this.config.key, "delete");
25029
25517
  const parentId = this.config.key === "knowledge_base_articles" ? articleParent(a) : a;
@@ -26936,6 +27424,7 @@ async function aggregate(client, operation, filter, opts = {}) {
26936
27424
  const labelled = !label || v.groupBy.length === 0 ? void 0 : await labelRows(client, v.resourceKey, top.map((g) => g.key));
26937
27425
  const result = {
26938
27426
  mode: v.groupBy.length > 0 ? "group" : "sum",
27427
+ ...v.resourceKey === "inventory_items" ? { resource: v.resourceKey } : {},
26939
27428
  groups: top.map((g, i) => ({ key: labelled?.rows[i] ?? g.key, count: g.count, ...g.sums !== void 0 ? { sums: g.sums } : {} })),
26940
27429
  totalGroups: sorted.length,
26941
27430
  groupsTruncated: sorted.length > top.length,
@@ -27335,15 +27824,32 @@ async function sanitiseResult(client, result, operation) {
27335
27824
  { suggestedAction: "Pass the operation key the result came from \u2014 the registry id, not the resource key." }
27336
27825
  );
27337
27826
  }
27338
- const record = (await operationIndex()).get(operation);
27827
+ const records = await operationIndex();
27828
+ const record = records.get(operation);
27339
27829
  if (record === void 0) {
27340
27830
  throw new AutotaskConfigError(
27341
27831
  `sanitiseResult: unknown operation "${operation.slice(0, 60)}" \u2014 it is not in the capability registry`,
27342
27832
  { operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
27343
27833
  );
27344
27834
  }
27345
- const fields = record.metadata?.untrustedFields;
27346
- return deepMarkUntrusted(result, Array.isArray(fields) ? fields : []);
27835
+ const names = record.metadata.untrustedFields;
27836
+ const fields = Array.isArray(names) ? names : [];
27837
+ const inventoryAggregate = operation === "operations.aggregate" && result.resource === "inventory_items";
27838
+ const projected = deepMarkUntrusted(result, inventoryAggregate ? [...fields, "referenceNumber"] : fields);
27839
+ if (operation === "operations.searchAcrossResources") return wrapReferenceRows(projected, "matches");
27840
+ if (operation === "operations.fetchByIds") return wrapReferenceRows(projected, "value");
27841
+ if (operation === "operations.resolveAny") {
27842
+ const wrapped = wrapReferenceRows(projected, "value");
27843
+ return isRecord2(wrapped.contains) ? { ...wrapped, contains: wrapReferenceRows(wrapped.contains, "matches") } : wrapped;
27844
+ }
27845
+ return projected;
27846
+ }
27847
+ function wrapReferenceRows(result, field) {
27848
+ if (!Array.isArray(result.results)) return result;
27849
+ return { ...result, results: result.results.map((row) => {
27850
+ if (!isRecord2(row) || typeof row.resource !== "string" || !Object.hasOwn(row, field) || !row.resource.split("_").every(Boolean) || camelKey(row.resource) !== "inventoryItems") return row;
27851
+ return { ...row, [field]: deepMarkUntrusted(row[field], ["referenceNumber"]) };
27852
+ }) };
27347
27853
  }
27348
27854
 
27349
27855
  // src/resources/special/invoices.ts
@@ -28746,18 +29252,18 @@ async function fetchExpenses(ctx, join, entries) {
28746
29252
  const gaps = [...task.gaps];
28747
29253
  const timeTruncated = ctx.truncatedMonths["timeEntries"];
28748
29254
  if (timeTruncated !== void 0 && timeTruncated.length > 0) gaps.push(`time entries truncated in ${timeTruncated.join(", ")}, so a no-contract ticket or task their missing rows reference is not joined`);
28749
- const own = [
29255
+ const own2 = [
28750
29256
  ...tasks.ids.length > 0 ? [{ field: "taskID", op: "in", value: tasks.ids }] : [],
28751
29257
  ...task.projectIds.length > 0 ? [{ field: "projectID", op: "in", value: task.projectIds }] : []
28752
29258
  ];
28753
29259
  const orOf = (keys) => [keys.length === 1 ? keys[0] : { op: "or", items: keys }, ...ctx.windowOn("expenseDate")];
28754
- const expCond = orOf([{ field: "ticketID", op: "exist" }, ...own]);
29260
+ const expCond = orOf([{ field: "ticketID", op: "exist" }, ...own2]);
28755
29261
  const shared = ctx.sharedExpenses;
28756
29262
  let raw;
28757
- if (shared && own.length === 0) {
29263
+ if (shared && own2.length === 0) {
28758
29264
  raw = { items: [], capped: false, hasMore: false };
28759
29265
  } else {
28760
- const read = await ctx.windowedPart("expenses", "expense_items", "/V1.0/ExpenseItems/query", shared ? orOf(own) : expCond, EXPENSE_FIELDS, "expenseDate", EXPENSE_PAGE);
29266
+ const read = await ctx.windowedPart("expenses", "expense_items", "/V1.0/ExpenseItems/query", shared ? orOf(own2) : expCond, EXPENSE_FIELDS, "expenseDate", EXPENSE_PAGE);
28761
29267
  raw = read.part;
28762
29268
  raw.items = read.rows;
28763
29269
  }
@@ -29658,16 +30164,16 @@ function latchingHttp(raw, spend) {
29658
30164
  }
29659
30165
  };
29660
30166
  observeRecordReadFailures(http, latch);
29661
- const fail4 = (err) => {
30167
+ const fail5 = (err) => {
29662
30168
  latch(err);
29663
30169
  throw err;
29664
30170
  };
29665
30171
  http.request = (o) => {
29666
30172
  if (fatal) throw fatal;
29667
30173
  try {
29668
- return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail4);
30174
+ return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail5);
29669
30175
  } catch (err) {
29670
- return fail4(err);
30176
+ return fail5(err);
29671
30177
  }
29672
30178
  };
29673
30179
  return { http, fatal: () => fatal, signal };
@@ -31078,7 +31584,7 @@ async function wipHours(client, opts) {
31078
31584
  } else {
31079
31585
  const contractIds = positiveIds2(wipIn.map((e) => e["contractID"]));
31080
31586
  gate(chunks2(contractIds.length) + (contractIds.length > 0 ? 1 : 0), "before label reads", { contracts: contractIds.length });
31081
- const [contracts, types] = await readTasks(http, [
31587
+ const [contracts, types2] = await readTasks(http, [
31082
31588
  () => readChunks2(http, "/V1.0/Contracts", contractIds, ["contractType"]),
31083
31589
  async () => contractIds.length > 0 ? (await readPicklists(http, "/V1.0/Contracts", OP10)).get("contractType") : void 0
31084
31590
  ]);
@@ -31086,7 +31592,7 @@ async function wipHours(client, opts) {
31086
31592
  const bad = contractIds.filter((id) => typeof typeOf(id) !== "number");
31087
31593
  if (bad.length > 0) throw unresolved("contracts", bad);
31088
31594
  keyOfEntry = (e) => num(e["contractID"]) > 0 ? typeOf(num(e["contractID"])) : null;
31089
- for (const [id, label] of types ?? []) labels.set(id, { label });
31595
+ for (const [id, label] of types2 ?? []) labels.set(id, { label });
31090
31596
  }
31091
31597
  const approvalData = entries.some((e) => isApproved(e));
31092
31598
  const acc = () => ({ entries: 0, worked: 0, toBill: 0, approved: 0 });
@@ -31277,7 +31783,7 @@ async function nonChargeableWork(client, opts) {
31277
31783
  const contractIds = distinctIds(ncLines.map((x) => x.line["contractID"]), 1);
31278
31784
  const typed = v.groupBy === "contractType";
31279
31785
  gate(chunks3(contractIds.length) + (typed && contractIds.length > 0 ? 1 : 0) + (v.includeUnpostedTime ? 1 : 0), "before label reads", { contracts: contractIds.length });
31280
- const [contracts, types] = await readTasks(http, [
31786
+ const [contracts, types2] = await readTasks(http, [
31281
31787
  () => readChunks3(http, "/V1.0/Contracts", contractIds, [typed ? "contractType" : "contractName"]),
31282
31788
  async () => typed && contractIds.length > 0 ? (await readPicklists(http, "/V1.0/Contracts", OP11)).get("contractType") : void 0
31283
31789
  ]);
@@ -31288,7 +31794,7 @@ async function nonChargeableWork(client, opts) {
31288
31794
  if (!typed) return num(line["contractID"]);
31289
31795
  return isId(c["contractType"]) ? c["contractType"] : UNRESOLVED;
31290
31796
  };
31291
- if (typed) for (const [id, label] of types ?? []) labels.set(id, { label });
31797
+ if (typed) for (const [id, label] of types2 ?? []) labels.set(id, { label });
31292
31798
  else for (const [id, r] of contracts) labels.set(Number(id), typeof r["contractName"] === "string" ? { name: r["contractName"] } : {});
31293
31799
  }
31294
31800
  const cells = /* @__PURE__ */ new Map();
@@ -31466,8 +31972,37 @@ function bufferResult(buf) {
31466
31972
  };
31467
31973
  }
31468
31974
  var PUBLIC_INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS.filter((key) => key !== "mode");
31469
- function snapshotInvokeOptions(options, mode) {
31975
+ function snapshotInventoryInvokeOptions(options, operation, mode) {
31976
+ const { descriptors, expectedInventoryFacts: facts } = captureInventoryOptionDescriptors(options);
31977
+ if (Object.getOwnPropertySymbols(descriptors).length > 0) throw new AutotaskConfigError("inventory_items: invoke options must use string keys", { operation });
31978
+ const applyFlag = Object.hasOwn(descriptors, "dryRun") ? descriptors.dryRun : void 0;
31979
+ for (const key of PUBLIC_INVOKE_OPTION_KEYS) {
31980
+ if (key === "expectedInventoryFacts" || Object.hasOwn(descriptors, key)) continue;
31981
+ for (let owner = Object.getPrototypeOf(options); owner !== null && owner !== Object.prototype; owner = Object.getPrototypeOf(owner)) {
31982
+ const descriptor2 = Object.getOwnPropertyDescriptor(owner, key);
31983
+ if (descriptor2 !== void 0) {
31984
+ descriptors[key] = descriptor2;
31985
+ break;
31986
+ }
31987
+ }
31988
+ }
31989
+ const captured = /* @__PURE__ */ Object.create(null);
31990
+ for (const [key, descriptor2] of Object.entries(descriptors)) captured[key] = Object.hasOwn(descriptor2, "value") ? descriptor2.value : void 0;
31991
+ validateInvokeOptions(captured, operation);
31992
+ if (facts !== void 0 && Object.values(descriptors).some((descriptor2) => !Object.hasOwn(descriptor2, "value"))) throw new AutotaskConfigError("inventory_items: approved options must be data properties; accessors are unsupported", { operation });
31993
+ const applyRequested = applyFlag !== void 0 && Object.hasOwn(applyFlag, "value") && applyFlag.value === false;
31994
+ for (const [key, descriptor2] of Object.entries(descriptors)) {
31995
+ if (key === "expectedInventoryFacts" || Object.hasOwn(descriptor2, "value")) continue;
31996
+ captured[key] = descriptor2.get === void 0 ? void 0 : Reflect.apply(descriptor2.get, options, []);
31997
+ }
31998
+ captured.expectedInventoryFacts = facts;
31999
+ captured.dryRun = applyRequested || captured.dryRun !== false ? captured.dryRun : void 0;
32000
+ return Object.assign(captured, { mode });
32001
+ }
32002
+ function snapshotInvokeOptions(options, operation, mode) {
32003
+ if (operation === "inventory_items.create" || operation === "inventory_items.update") return snapshotInventoryInvokeOptions(options, operation, mode);
31470
32004
  if (!isRecord2(options)) throw new AutotaskConfigError("invoke: options must be an object");
32005
+ rejectInventoryFactsOption(options, operation);
31471
32006
  const applyFlag = Object.getOwnPropertyDescriptor(options, "dryRun");
31472
32007
  const applyRequested = applyFlag !== void 0 && Object.hasOwn(applyFlag, "value") && applyFlag.value === false;
31473
32008
  let confirmation;
@@ -31483,7 +32018,8 @@ function snapshotInvokeOptions(options, mode) {
31483
32018
  const dryRun = options.dryRun;
31484
32019
  const captured = snapshotFields(options, PUBLIC_INVOKE_OPTION_KEYS, {
31485
32020
  dryRun: applyRequested || dryRun !== false ? dryRun : void 0,
31486
- confirm
32021
+ confirm,
32022
+ expectedInventoryFacts: void 0
31487
32023
  });
31488
32024
  return Object.assign(/* @__PURE__ */ Object.create(null), captured, { mode });
31489
32025
  }
@@ -31499,6 +32035,7 @@ async function resolveRecord(operation) {
31499
32035
  }
31500
32036
  function governPreRequest(record, operation, opts) {
31501
32037
  validateInvokeOptions(opts, operation);
32038
+ if (opts.expectedInventoryFacts !== void 0) rejectInventoryFactsOption(opts, operation);
31502
32039
  const mode = opts.mode;
31503
32040
  if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
31504
32041
  throw new AutotaskConfigError(crossModeRefusal(operation, record.effect, mode), { operation });
@@ -31622,6 +32159,7 @@ var BAG_RIDING_ARGS = {
31622
32159
  function buildMutationOpts(opts, isWrite) {
31623
32160
  const dryRun = isWrite ? opts.dryRun !== false : false;
31624
32161
  const mutationOpts = { dryRun };
32162
+ if (opts.expectedInventoryFacts !== void 0) mutationOpts.expectedInventoryFacts = opts.expectedInventoryFacts;
31625
32163
  if (isWrite && opts.lastModifiedDate !== void 0) {
31626
32164
  mutationOpts.lastModifiedDate = opts.lastModifiedDate;
31627
32165
  }
@@ -31723,6 +32261,10 @@ async function runPreRequestPass(ctx) {
31723
32261
  }
31724
32262
  async function prepareInvocation(client, operation, argsIn, opts, streaming = false) {
31725
32263
  const record = await resolveRecord(operation);
32264
+ if (operation === "inventory_items.create" || operation === "inventory_items.update") {
32265
+ governPreRequest(record, operation, opts);
32266
+ snapshotInventoryMutationOptions(opts);
32267
+ }
31726
32268
  const resolvedArgs = resolveDispatchArgs(record, argsIn);
31727
32269
  const boundedQuery = record.kind === "primitive" && record.operation === "query";
31728
32270
  const countedQuery = record.kind === "primitive" && record.operation === "count";
@@ -31764,14 +32306,16 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
31764
32306
  return scopeNote !== void 0 && finished !== null && typeof finished === "object" ? { ...finished, scopeNote } : finished;
31765
32307
  }
31766
32308
  async function invoke(client, operation, args = [], opts = {}) {
31767
- return invokeMode(client, operation, args, snapshotInvokeOptions(opts));
32309
+ const capturedArgs = captureInventoryInvocationArgs(operation, args);
32310
+ const capturedOpts = snapshotInvokeOptions(opts, operation);
32311
+ return invokeMode(client, operation, capturedArgs(capturedOpts.expectedInventoryFacts === void 0), capturedOpts);
31768
32312
  }
31769
32313
  async function invokeRead(client, operation, args = [], opts = {}) {
31770
- return invokeMode(client, operation, args, snapshotInvokeOptions(opts, "read"));
32314
+ return invokeMode(client, operation, args, snapshotInvokeOptions(opts, operation, "read"));
31771
32315
  }
31772
32316
  async function invokeReadPages(client, operation, args, onPage, opts = {}) {
31773
32317
  if (typeof onPage !== "function") throw new AutotaskConfigError("invokeReadPages: onPage must be a function", { operation });
31774
- const prepared = await prepareInvocation(client, operation, args, snapshotInvokeOptions(opts, "read"), true);
32318
+ const prepared = await prepareInvocation(client, operation, args, snapshotInvokeOptions(opts, operation, "read"), true);
31775
32319
  prepared.pageSession.guard();
31776
32320
  const consume = prepared.method;
31777
32321
  const result = await consume.call(prepared.holder, prepared.callArgs[0], onPage);
@@ -31779,10 +32323,12 @@ async function invokeReadPages(client, operation, args, onPage, opts = {}) {
31779
32323
  return prepared.scopeNote === void 0 ? result : { ...result, scopeNote: prepared.scopeNote };
31780
32324
  }
31781
32325
  async function invokeWrite(client, operation, args = [], opts = {}) {
31782
- return invokeMode(client, operation, args, snapshotInvokeOptions(opts, "write"));
32326
+ const capturedArgs = captureInventoryInvocationArgs(operation, args);
32327
+ const capturedOpts = snapshotInvokeOptions(opts, operation, "write");
32328
+ return invokeMode(client, operation, capturedArgs(capturedOpts.expectedInventoryFacts === void 0), capturedOpts);
31783
32329
  }
31784
32330
  async function invokeDelete(client, operation, args = [], opts = {}) {
31785
- return invokeMode(client, operation, args, snapshotInvokeOptions(opts, "delete"));
32331
+ return invokeMode(client, operation, args, snapshotInvokeOptions(opts, operation, "delete"));
31786
32332
  }
31787
32333
 
31788
32334
  // src/resources/special/_shared/compositeParts.ts
@@ -31941,4 +32487,4 @@ var ContractsResource = class extends GenericResource {
31941
32487
  }
31942
32488
  };
31943
32489
 
31944
- export { AGGREGATE_DATE_BUCKETS, AGGREGATE_DEFAULT_LIMIT, AGGREGATE_DEFAULT_TOP, AGGREGATE_TOP_MAX, AutotaskAbortError, AutotaskConfigError, AutotaskError, AutotaskNetworkError, AutotaskTimeoutError, CREATE_BLOCKER_KINDS, CREDENTIAL_ENV_LOAD_ACTION, CREDENTIAL_SHAPE_POINTER, CompaniesResource, ConfirmationRequiredError, ConflictError, ContractsResource, DEFAULT_ZONE, DeleteBoundaryError, EXPAND_RESOURCE_NAMES_MAX_IDS, EmptyResponseError, FETCH_BY_IDS_CHUNK_SIZE, FETCH_BY_IDS_MAX_ITEMS, FIELD_CACHE_KINDS, FIELD_CATALOG_HONESTY_NOTE, GenericResource, HostPolicyDeniedError, HttpClient, INVOKE_OPTION_KEYS, InvoicesResource, MAX_FIELD_CATALOG_WIRE, MIN_FIELD_CATALOG_MAX_BYTES, MIN_PREFIX_SUMMARY_LENGTH, MaintenanceError, MarkerUnsafeIdError, MoveRefusedError, NotFoundError, OperationNotSupportedError, PARAMS_BAG_KEYS, PICKLIST_VALUE_NOT_SERVED_NOTE, PaginationLimitError, QueryTooLongError, RELATIONSHIP_MAP, RateLimitError, RecoveryTruncatedError, ResolutionError, ResponseRejectedError, SIMPLE_RESOURCES, ScopeRequiredError, StaleObjectError, TICKET_LABEL_FIELDS, TimeEntriesResource, TtlCache, UI_LINK_ENTITIES, UNSCOPED_WALK_THRESHOLD, UnexpectedContentTypeError, WORKFLOW_RESOURCES, ZONES, addLabelSibling, addNameSibling, aggregate, arAging, buildDryRunResult, buildQueryRequest, buildReadCache, buildUiLink, cachedRecordGet, clientOf, compositePart, compositePartLimit, createGuidance, createNamePlan, credentialShapeProblem, credentialValueSummary, cursorToPath, dateBucketLabel, effectiveRequiredFields, errorFromStatus, expandResourceNames, fetchByIds, fieldCatalog, foldFlattenedOpts, formatVendorDetail, invoke, invokeDelete, invokeRead, invokeReadPages, invokeWrite, isAutotaskError, isClosedStatus, isDateYMD, isDeterministicVendor500, isRecord2 as isRecord, joinedCompositePart, mergeDetails, mergePartialBody, needsConfirmation, nextActionFor, nonChargeableWork, notPersistedFields, openStatusFilter, openTicketsOfPart, parseIdentifier, parseVendorErrors, portfolioMargin, queryRows, readTasks, recurringRevenue, refuse2 as refuse, relationshipMap, resolveAny, resolveCompositeNames, resolveConfig, resolveCredentials, resolveLineOfBusinessChain, resolveStaff, resolveTicketStatusSemantics, revenueRollup, runBounded, runMove, runWithSignal, sanitiseResult, searchAcrossResources, suspendCompanyIndex, uiLink, uiLinkFor, unknownKeysRefusal, unwrapItem, unwrapItems, unwrapOperation, validateDispatchArgs, validateInvokeOptions, validateParamsBag, vendorId, wipHours, zoneUrl };
32490
+ export { AGGREGATE_DATE_BUCKETS, AGGREGATE_DEFAULT_LIMIT, AGGREGATE_DEFAULT_TOP, AGGREGATE_TOP_MAX, AutotaskAbortError, AutotaskConfigError, AutotaskError, AutotaskNetworkError, AutotaskTimeoutError, CREATE_BLOCKER_KINDS, CREDENTIAL_ENV_LOAD_ACTION, CREDENTIAL_SHAPE_POINTER, CompaniesResource, ConfirmationRequiredError, ConflictError, ContractsResource, DEFAULT_ZONE, DeleteBoundaryError, EXPAND_RESOURCE_NAMES_MAX_IDS, EmptyResponseError, FETCH_BY_IDS_CHUNK_SIZE, FETCH_BY_IDS_MAX_ITEMS, FIELD_CACHE_KINDS, FIELD_CATALOG_HONESTY_NOTE, GenericResource, HostPolicyDeniedError, HttpClient, INVOKE_OPTION_KEYS, InvoicesResource, MAX_FIELD_CATALOG_WIRE, MIN_FIELD_CATALOG_MAX_BYTES, MIN_PREFIX_SUMMARY_LENGTH, MaintenanceError, MarkerUnsafeIdError, MoveRefusedError, NotFoundError, OperationNotSupportedError, PARAMS_BAG_KEYS, PICKLIST_VALUE_NOT_SERVED_NOTE, PaginationLimitError, QueryTooLongError, RELATIONSHIP_MAP, RateLimitError, RecoveryTruncatedError, ResolutionError, ResponseRejectedError, SIMPLE_RESOURCES, ScopeRequiredError, StaleObjectError, TICKET_LABEL_FIELDS, TimeEntriesResource, TtlCache, UI_LINK_ENTITIES, UNSCOPED_WALK_THRESHOLD, UnexpectedContentTypeError, WORKFLOW_RESOURCES, ZONES, addLabelSibling, addNameSibling, aggregate, arAging, buildDryRunResult, buildQueryRequest, buildReadCache, buildUiLink, cachedRecordGet, clientOf, compositePart, compositePartLimit, createGuidance, createNamePlan, credentialShapeProblem, credentialValueSummary, cursorToPath, dateBucketLabel, effectiveRequiredFields, errorFromStatus, expandResourceNames, fetchByIds, fieldCatalog, foldFlattenedOpts, formatVendorDetail, inventoryItemGuardFacts, invoke, invokeDelete, invokeRead, invokeReadPages, invokeWrite, isAutotaskError, isClosedStatus, isDateYMD, isDeterministicVendor500, isRecord2 as isRecord, joinedCompositePart, mergeDetails, mergePartialBody, needsConfirmation, nextActionFor, nonChargeableWork, notPersistedFields, openStatusFilter, openTicketsOfPart, parseIdentifier, parseVendorErrors, portfolioMargin, queryRows, readTasks, recurringRevenue, refuse2 as refuse, rejectInventoryFactsOption, relationshipMap, resolveAny, resolveCompositeNames, resolveConfig, resolveCredentials, resolveLineOfBusinessChain, resolveStaff, resolveTicketStatusSemantics, revenueRollup, runBounded, runMove, runWithSignal, sanitiseResult, searchAcrossResources, suspendCompanyIndex, uiLink, uiLinkFor, unknownKeysRefusal, unwrapItem, unwrapItems, unwrapOperation, validateDispatchArgs, validateInvokeOptions, validateParamsBag, vendorId, wipHours, zoneUrl };