node-autotask 0.88.1 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-33UVHMFN.js';
2
- import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-KM7ITBOT.js';
1
+ import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-Q73VQSUP.js';
2
+ import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-CY6USWUY.js';
3
3
 
4
4
  // src/client.ts
5
5
  var AutotaskClient = class {
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132",
4
- "A": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132",
5
- "operations": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132"
3
+ "B": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c",
4
+ "A": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c",
5
+ "operations": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c"
6
6
  };
7
7
  var cached = null;
8
8
  function loadCapabilities() {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkSHJ7EOBW_cjs = require('./chunk-SHJ7EOBW.cjs');
3
+ var chunkZLMYYO7R_cjs = require('./chunk-ZLMYYO7R.cjs');
4
4
  var chunkCM5O672I_cjs = require('./chunk-CM5O672I.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
@@ -402,7 +402,7 @@ function suggestedActionForStatus(status) {
402
402
  return status >= 500 ? "The SDK already retried per its policy. A repeated 500 on one entity while others work usually means the API user lacks permission on that entity \u2014 ask the Autotask admin to grant it; otherwise retry once more at most." : void 0;
403
403
  }
404
404
  }
405
- function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential, includeVendorDetails = true) {
405
+ function errorFromStatus(status, body, url, operation, redactPersonalData = false, credential, includeVendorDetails = true) {
406
406
  const safeBody = redactResponseBody(body, { redactPersonalData });
407
407
  const exposedBody = includeVendorDetails ? safeBody : void 0;
408
408
  let detail = formatVendorDetail(exposedBody);
@@ -1397,7 +1397,7 @@ function resolveConfig(config) {
1397
1397
  const rateLimit = resolveRateLimit(config, agent);
1398
1398
  const cooldown = resolveCooldown(config);
1399
1399
  const resolution = resolveResolution(config, agent);
1400
- const redactPersonalData = config.redactPersonalData ?? true;
1400
+ const redactPersonalData = config.redactPersonalData ?? false;
1401
1401
  const caches = resolveCaches(config);
1402
1402
  const update = { putFallback: config.update?.putFallback === true };
1403
1403
  const reResolveZoneOn401 = config.reResolveZoneOn401 === true;
@@ -1987,9 +1987,8 @@ function isJsonMediaType(header) {
1987
1987
  const mediaType = header.split(";")[0]?.trim().toLowerCase() ?? "";
1988
1988
  return mediaType.startsWith("application/json") || mediaType.endsWith("+json");
1989
1989
  }
1990
- function bodySnippet(text, redactPersonalData) {
1991
- const bytes = Buffer.from(text, "utf8").subarray(0, 256).toString("utf8");
1992
- return redactResponseBody(bytes, { redactPersonalData });
1990
+ function bodySnippet(text) {
1991
+ return Buffer.from(text, "utf8").subarray(0, 256).toString("utf8");
1993
1992
  }
1994
1993
 
1995
1994
  // src/http/limits.ts
@@ -9353,6 +9352,19 @@ var RELATIONSHIP_MAP = {
9353
9352
  "blindSurfaces": null,
9354
9353
  "zoneFacts": {
9355
9354
  "quirks": [
9355
+ {
9356
+ "kind": "vendor-managed-side-effect",
9357
+ "ops": [
9358
+ "query"
9359
+ ],
9360
+ "fields": [
9361
+ "billingApprovalDateTime",
9362
+ "billingApprovalResourceID",
9363
+ "billingApprovalLevelMostRecent"
9364
+ ],
9365
+ "statement": "Approval fields cannot establish posted status. A billing item referencing the entry through timeEntryID indicates it is posted.",
9366
+ "evidence": "Autotask REST BillingItemApprovalLevels entity help (https://ww6.autotask.net/help/developerhelp/content/apis/rest/Entities/BillingItemApprovalLevelsEntity.htm): creating an approval-level record updates the most recent level, while the date and resource on the time entry are editable separately. See docs/VENDOR-QUIRKS.md sections 11.4 and 11.13 for observed field population and the billing-item join."
9367
+ },
9356
9368
  {
9357
9369
  "kind": "wire-type",
9358
9370
  "ops": [
@@ -17477,7 +17489,7 @@ var HttpClient = class {
17477
17489
  since,
17478
17490
  retryAfterMs: s.maintenancePollMs,
17479
17491
  httpStatus: status,
17480
- ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) },
17492
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) },
17481
17493
  maintenanceDetected: true
17482
17494
  },
17483
17495
  suggestedAction: unknownWrite ? `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).` : `The Autotask zone is in its maintenance window (since ${since}); retry after the window (windows usually last 30-90 min).`
@@ -17655,7 +17667,7 @@ var HttpClient = class {
17655
17667
  httpStatus: status,
17656
17668
  details: {
17657
17669
  httpStatus: status,
17658
- ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) }
17670
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) }
17659
17671
  },
17660
17672
  // The content-type is host-sourced (a host-supplied
17661
17673
  // baseUrl can serve arbitrary HTML) — capped, never prose;
@@ -17706,7 +17718,7 @@ var HttpClient = class {
17706
17718
  nonJsonBody = text;
17707
17719
  }
17708
17720
  }
17709
- const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
17721
+ const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody);
17710
17722
  const nonJsonIsMaintenance = s.maintenancePage;
17711
17723
  const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
17712
17724
  if (nonJsonIsMaintenance) {
@@ -18526,7 +18538,7 @@ async function capabilitySets() {
18526
18538
  const fieldOps = /* @__PURE__ */ new Map();
18527
18539
  const udfCapable = /* @__PURE__ */ new Set();
18528
18540
  const resources = /* @__PURE__ */ new Set();
18529
- for (const rec of await chunkSHJ7EOBW_cjs.loadCapabilityRecords()) {
18541
+ for (const rec of await chunkZLMYYO7R_cjs.loadCapabilityRecords()) {
18530
18542
  if (rec.resource === "operations") continue;
18531
18543
  resources.add(rec.resource);
18532
18544
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -18537,7 +18549,7 @@ async function capabilitySets() {
18537
18549
  var derivedIndexPromise = null;
18538
18550
  function derivedIndexLoad() {
18539
18551
  if (derivedIndexPromise === null) {
18540
- derivedIndexPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => {
18552
+ derivedIndexPromise = chunkZLMYYO7R_cjs.loadCapabilityRecords().then((records) => {
18541
18553
  const index = /* @__PURE__ */ new Map();
18542
18554
  for (const rec of records) {
18543
18555
  const declared = rec.metadata?.derivedFields;
@@ -18949,7 +18961,7 @@ function attachUpdateTargetMissReason(err, key) {
18949
18961
  if (pinned === void 0) return;
18950
18962
  err.details = { ...err.details ?? {}, emptyReason: pinned };
18951
18963
  }
18952
- function buildDryRunResult(spec, policy = { redactPersonalData: true }) {
18964
+ function buildDryRunResult(spec, policy) {
18953
18965
  if (spec.operation === "") {
18954
18966
  throw new AutotaskConfigError("dry-run: the operation name is required");
18955
18967
  }
@@ -26607,7 +26619,7 @@ function dateBucketLabel(value, bucket) {
26607
26619
  var queryResourceKeysPromise = null;
26608
26620
  function queryResourceKeys() {
26609
26621
  if (queryResourceKeysPromise === null) {
26610
- queryResourceKeysPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => {
26622
+ queryResourceKeysPromise = chunkZLMYYO7R_cjs.loadCapabilityRecords().then((records) => {
26611
26623
  const s = /* @__PURE__ */ new Set();
26612
26624
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
26613
26625
  return s;
@@ -26729,7 +26741,7 @@ function parseTopAndLimit(opts, problems) {
26729
26741
  return { top, limit };
26730
26742
  }
26731
26743
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
26732
- const records = resourceKey === void 0 ? [] : await chunkSHJ7EOBW_cjs.loadCapabilityRecords();
26744
+ const records = resourceKey === void 0 ? [] : await chunkZLMYYO7R_cjs.loadCapabilityRecords();
26733
26745
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
26734
26746
  if (record === void 0) return void 0;
26735
26747
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -27224,7 +27236,7 @@ async function uiLink(client, input) {
27224
27236
  var indexPromise = null;
27225
27237
  function operationIndex() {
27226
27238
  if (indexPromise === null) {
27227
- indexPromise = chunkSHJ7EOBW_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27239
+ indexPromise = chunkZLMYYO7R_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27228
27240
  }
27229
27241
  return indexPromise;
27230
27242
  }
@@ -1,5 +1,5 @@
1
- import { GenericResource, readTasks, OperationNotSupportedError, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-KM7ITBOT.js';
2
- import { loadCapabilityRecords } from './chunk-ZADTVF6M.js';
1
+ import { GenericResource, readTasks, OperationNotSupportedError, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-CY6USWUY.js';
2
+ import { loadCapabilityRecords } from './chunk-K5X4BPQC.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -423,7 +423,7 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}) {
423
423
  checks: [{ name: "input-validation", ok: true }],
424
424
  impact: { affected: 1, scope: "single-record", reversible: kind !== "add" },
425
425
  data: { ...data }
426
- });
426
+ }, { redactPersonalData: http.redactPersonalData });
427
427
  }
428
428
  const res = await http.request({
429
429
  method: "POST",
@@ -2,9 +2,9 @@
2
2
 
3
3
  // src/capabilities.ts
4
4
  var CAPABILITY_PLAN_HASHES = {
5
- "B": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132",
6
- "A": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132",
7
- "operations": "911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132"
5
+ "B": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c",
6
+ "A": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c",
7
+ "operations": "2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c"
8
8
  };
9
9
  var cached = null;
10
10
  function loadCapabilities() {
@@ -109,7 +109,7 @@ interface RequestOptions {
109
109
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
110
110
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
111
111
  *
112
- * planHash: 911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132
112
+ * planHash: 2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c
113
113
  */
114
114
 
115
115
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -520,16 +520,11 @@ interface AutotaskConfig {
520
520
  */
521
521
  onAudit?: (event: AuditEvent) => void;
522
522
  /**
523
- * Response redaction for personal + business-sensitive field values
524
- * (default `true` = redacted). Setting `false` returns PII and
525
- * confidential fields (emails, phones, addresses, device IP/MAC, tax ids)
526
- * UNREDACTED to the caller — for regulated workflows that need raw
527
- * personal data and keep model transcripts inside your control. The
528
- * SECRET class (`password`, `secretKey`, `secret`) is ALWAYS redacted
529
- * regardless of this flag: the SDK is the only permission boundary (the
530
- * vendor API has no read-only key), so credential values never cross the
531
- * SDK boundary in a response. Request bodies are never redacted
532
- * (credentials travel in writes by design). See docs/API.md section 10.
523
+ * Redact personal and business-sensitive fields in parsed response bodies
524
+ * and dry-run results. Defaults to `false`, which returns those field
525
+ * values as received. Set `true` to redact them. Structured secret fields
526
+ * (`password`, `secretKey`, `secret`) are redacted under either policy.
527
+ * See docs/API.md section 10.
533
528
  */
534
529
  redactPersonalData?: boolean;
535
530
  /**
@@ -109,7 +109,7 @@ interface RequestOptions {
109
109
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
110
110
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
111
111
  *
112
- * planHash: 911f1470a0ebbe66c39579e8d26d97253914f4fecfe3b8d69ee61bd1710be132
112
+ * planHash: 2f78ad6e25fd96f024dfc749c3c9d1b8dbf52d8a23e097bd5046605a9975787c
113
113
  */
114
114
 
115
115
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -520,16 +520,11 @@ interface AutotaskConfig {
520
520
  */
521
521
  onAudit?: (event: AuditEvent) => void;
522
522
  /**
523
- * Response redaction for personal + business-sensitive field values
524
- * (default `true` = redacted). Setting `false` returns PII and
525
- * confidential fields (emails, phones, addresses, device IP/MAC, tax ids)
526
- * UNREDACTED to the caller — for regulated workflows that need raw
527
- * personal data and keep model transcripts inside your control. The
528
- * SECRET class (`password`, `secretKey`, `secret`) is ALWAYS redacted
529
- * regardless of this flag: the SDK is the only permission boundary (the
530
- * vendor API has no read-only key), so credential values never cross the
531
- * SDK boundary in a response. Request bodies are never redacted
532
- * (credentials travel in writes by design). See docs/API.md section 10.
523
+ * Redact personal and business-sensitive fields in parsed response bodies
524
+ * and dry-run results. Defaults to `false`, which returns those field
525
+ * values as received. Set `true` to redact them. Structured secret fields
526
+ * (`password`, `secretKey`, `secret`) are redacted under either policy.
527
+ * See docs/API.md section 10.
533
528
  */
534
529
  redactPersonalData?: boolean;
535
530
  /**