node-autotask 0.59.0 → 0.60.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.
@@ -2,9 +2,9 @@
2
2
 
3
3
  // src/capabilities.ts
4
4
  var CAPABILITY_PLAN_HASHES = {
5
- "B": "144fc9158531bbe8478a9c86a7127cbf14a0cd5fa043b6a69f453841813a15c2",
6
- "A": "144fc9158531bbe8478a9c86a7127cbf14a0cd5fa043b6a69f453841813a15c2",
7
- "operations": "144fc9158531bbe8478a9c86a7127cbf14a0cd5fa043b6a69f453841813a15c2"
5
+ "B": "95323eaa92fca1ba1541721c6f34ce671118736aca889ea432156d87a8a8ecd8",
6
+ "A": "95323eaa92fca1ba1541721c6f34ce671118736aca889ea432156d87a8a8ecd8",
7
+ "operations": "95323eaa92fca1ba1541721c6f34ce671118736aca889ea432156d87a8a8ecd8"
8
8
  };
9
9
  var cached = null;
10
10
  function loadCapabilities() {
@@ -1,5 +1,5 @@
1
- import { GenericResource, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, RELATIONSHIP_MAP, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, numericIds, IN_FILTER_CAP, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, cursorToPath } from './chunk-WZBIGZMT.js';
2
- import { loadCapabilityRecords } from './chunk-U4XISLR7.js';
1
+ import { GenericResource, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, RELATIONSHIP_MAP, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, numericIds, IN_FILTER_CAP, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, cursorToPath } from './chunk-Y2SR6D2D.js';
2
+ import { loadCapabilityRecords } from './chunk-K722F7EM.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkVG6PMFE3_cjs = require('./chunk-VG6PMFE3.cjs');
4
- var chunk7ULWKWRZ_cjs = require('./chunk-7ULWKWRZ.cjs');
3
+ var chunkVN3OZHC7_cjs = require('./chunk-VN3OZHC7.cjs');
4
+ var chunkMYLSBOZI_cjs = require('./chunk-MYLSBOZI.cjs');
5
5
 
6
6
  // src/client.ts
7
7
  var AutotaskClient = class {
@@ -152,34 +152,34 @@ var AutotaskClient = class {
152
152
  * anything is wired. Construction issues NO request.
153
153
  */
154
154
  constructor(options) {
155
- this.config = chunk7ULWKWRZ_cjs.resolveConfig(options);
156
- this.http = new chunk7ULWKWRZ_cjs.HttpClient(this.config);
155
+ this.config = chunkMYLSBOZI_cjs.resolveConfig(options);
156
+ this.http = new chunkMYLSBOZI_cjs.HttpClient(this.config);
157
157
  this.http.client = this;
158
- for (const entry of chunk7ULWKWRZ_cjs.SIMPLE_RESOURCES) {
159
- this[entry.accessor] = new chunk7ULWKWRZ_cjs.GenericResource(this.http, entry, this.config.pageSize);
158
+ for (const entry of chunkMYLSBOZI_cjs.SIMPLE_RESOURCES) {
159
+ this[entry.accessor] = new chunkMYLSBOZI_cjs.GenericResource(this.http, entry, this.config.pageSize);
160
160
  }
161
- this.companies = new chunk7ULWKWRZ_cjs.CompaniesResource(this.http, this.config.pageSize);
162
- this.configurationItems = new chunkVG6PMFE3_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
163
- this.contacts = new chunkVG6PMFE3_cjs.ContactsResource(this.http, this.config.pageSize);
164
- this.contracts = new chunk7ULWKWRZ_cjs.ContractsResource(this.http, this.config.pageSize);
165
- this.inventoryProducts = new chunkVG6PMFE3_cjs.InventoryProductsResource(this.http, this.config.pageSize);
166
- this.invoices = new chunk7ULWKWRZ_cjs.InvoicesResource(this.http, this.config.pageSize);
167
- this.quotes = new chunkVG6PMFE3_cjs.QuotesResource(this.http, this.config.pageSize);
168
- this.resourceTimeOffAdditional = new chunkVG6PMFE3_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
169
- this.resourceTimeOffBalances = new chunkVG6PMFE3_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
170
- this.resources = new chunkVG6PMFE3_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
171
- this.serviceCalls = new chunkVG6PMFE3_cjs.ServiceCallsResource(this.http, this.config.pageSize);
172
- this.ticketCharges = new chunkVG6PMFE3_cjs.TicketChargesResource(this.http, this.config.pageSize);
173
- this.tickets = new chunkVG6PMFE3_cjs.TicketsResource(this.http, this.config.pageSize);
174
- this.timeEntries = new chunk7ULWKWRZ_cjs.TimeEntriesResource(this.http, this.config.pageSize);
175
- this.timeOffRequests = new chunkVG6PMFE3_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
176
- this.authenticateResource = new chunkVG6PMFE3_cjs.AuthenticateResource(this.http);
177
- this.entityInformation = new chunkVG6PMFE3_cjs.EntityInformationResource(this.http);
178
- this.modules = new chunkVG6PMFE3_cjs.ModulesResource(this.http);
179
- this.thresholdInformation = new chunkVG6PMFE3_cjs.ThresholdInformationResource(this.http);
180
- this.version = new chunkVG6PMFE3_cjs.VersionResource(this.http);
181
- this.versionInformation = new chunkVG6PMFE3_cjs.VersionInformationResource(this.http);
182
- this.zoneInformation = new chunkVG6PMFE3_cjs.ZoneInformationResource(this.http);
161
+ this.companies = new chunkMYLSBOZI_cjs.CompaniesResource(this.http, this.config.pageSize);
162
+ this.configurationItems = new chunkVN3OZHC7_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
163
+ this.contacts = new chunkVN3OZHC7_cjs.ContactsResource(this.http, this.config.pageSize);
164
+ this.contracts = new chunkMYLSBOZI_cjs.ContractsResource(this.http, this.config.pageSize);
165
+ this.inventoryProducts = new chunkVN3OZHC7_cjs.InventoryProductsResource(this.http, this.config.pageSize);
166
+ this.invoices = new chunkMYLSBOZI_cjs.InvoicesResource(this.http, this.config.pageSize);
167
+ this.quotes = new chunkVN3OZHC7_cjs.QuotesResource(this.http, this.config.pageSize);
168
+ this.resourceTimeOffAdditional = new chunkVN3OZHC7_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
169
+ this.resourceTimeOffBalances = new chunkVN3OZHC7_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
170
+ this.resources = new chunkVN3OZHC7_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
171
+ this.serviceCalls = new chunkVN3OZHC7_cjs.ServiceCallsResource(this.http, this.config.pageSize);
172
+ this.ticketCharges = new chunkVN3OZHC7_cjs.TicketChargesResource(this.http, this.config.pageSize);
173
+ this.tickets = new chunkVN3OZHC7_cjs.TicketsResource(this.http, this.config.pageSize);
174
+ this.timeEntries = new chunkMYLSBOZI_cjs.TimeEntriesResource(this.http, this.config.pageSize);
175
+ this.timeOffRequests = new chunkVN3OZHC7_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
176
+ this.authenticateResource = new chunkVN3OZHC7_cjs.AuthenticateResource(this.http);
177
+ this.entityInformation = new chunkVN3OZHC7_cjs.EntityInformationResource(this.http);
178
+ this.modules = new chunkVN3OZHC7_cjs.ModulesResource(this.http);
179
+ this.thresholdInformation = new chunkVN3OZHC7_cjs.ThresholdInformationResource(this.http);
180
+ this.version = new chunkVN3OZHC7_cjs.VersionResource(this.http);
181
+ this.versionInformation = new chunkVN3OZHC7_cjs.VersionInformationResource(this.http);
182
+ this.zoneInformation = new chunkVN3OZHC7_cjs.ZoneInformationResource(this.http);
183
183
  }
184
184
  /**
185
185
  * `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
@@ -213,12 +213,12 @@ var AutotaskClient = class {
213
213
  * parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
214
214
  */
215
215
  withSignal(signal, fn) {
216
- return chunk7ULWKWRZ_cjs.runWithSignal(signal, fn);
216
+ return chunkMYLSBOZI_cjs.runWithSignal(signal, fn);
217
217
  }
218
218
  async batch(fn, items, opts = {}) {
219
219
  const concurrency = opts.concurrency ?? this.config.maxConcurrent;
220
220
  if (!Number.isInteger(concurrency) || concurrency <= 0) {
221
- throw new chunk7ULWKWRZ_cjs.AutotaskConfigError("batch concurrency must be a positive integer");
221
+ throw new chunkMYLSBOZI_cjs.AutotaskConfigError("batch concurrency must be a positive integer");
222
222
  }
223
223
  const { signal, settle } = opts;
224
224
  const results = new Array(items.length);
@@ -233,7 +233,7 @@ var AutotaskClient = class {
233
233
  const i = next++;
234
234
  try {
235
235
  const item = items[i];
236
- const value = await (signal === void 0 ? fn(item) : chunk7ULWKWRZ_cjs.runWithSignal(signal, () => fn(item)));
236
+ const value = await (signal === void 0 ? fn(item) : chunkMYLSBOZI_cjs.runWithSignal(signal, () => fn(item)));
237
237
  results[i] = settle ? { status: "fulfilled", value } : value;
238
238
  } catch (error) {
239
239
  if (settle) results[i] = { status: "rejected", reason: error };
@@ -1,4 +1,4 @@
1
- import { loadCapabilityRecords } from './chunk-U4XISLR7.js';
1
+ import { loadCapabilityRecords } from './chunk-K722F7EM.js';
2
2
  import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-7NKB4UXV.js';
3
3
  import { randomUUID } from 'crypto';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
@@ -17534,7 +17534,7 @@ var MutationBase = class extends MetaBase {
17534
17534
  return { ...result, persistedCheckFailed: err instanceof AutotaskError ? err.code : `UNKNOWN (${err instanceof Error ? err.name : typeof err})` };
17535
17535
  }
17536
17536
  }
17537
- async updateGlobal(id, data, opts = {}) {
17537
+ async updateGlobal(id, data, opts = {}, method = "PUT") {
17538
17538
  const numeric = parseIdentifier(id, "id");
17539
17539
  const operation = `${this.config.key}.update`;
17540
17540
  let body = this.normalizeMutationBody(data);
@@ -17555,18 +17555,18 @@ var MutationBase = class extends MetaBase {
17555
17555
  }
17556
17556
  body.id = numeric;
17557
17557
  }
17558
- const route = collectionUpdate ? `PUT ${this.resourcePath}` : `PUT ${this.resourcePath}/${numeric}`;
17558
+ const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`}`;
17559
17559
  let res;
17560
17560
  try {
17561
17561
  res = await this.http.request({
17562
- method: "PUT",
17562
+ method,
17563
17563
  path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`,
17564
17564
  body,
17565
17565
  operation,
17566
17566
  maxRetries: opts.maxRetries
17567
17567
  });
17568
17568
  } catch (err) {
17569
- if (!this.putFallbackEligible(err)) throw err;
17569
+ if (method === "PATCH" || !this.putFallbackEligible(err)) throw err;
17570
17570
  if (collectionUpdate) {
17571
17571
  throw this.putFallbackDeclined(err, route, false);
17572
17572
  }
@@ -25548,7 +25548,7 @@ function clampWindowLimit(limit, OP14) {
25548
25548
  // src/resources/special/time_entries/review.ts
25549
25549
  var OP9 = "time_entries.updateReviewFields";
25550
25550
  var FIELDS = /* @__PURE__ */ new Set(["summaryNotes", "internalNotes", "billingCodeID", "contractID"]);
25551
- async function updateReviewFields(resource, id, data, opts = {}) {
25551
+ async function updateReviewFields(resource, id, data, send, opts = {}) {
25552
25552
  const invalid = () => new AutotaskConfigError(
25553
25553
  `${OP9}: supply a non-empty object of summaryNotes/internalNotes strings (up to 32000 characters) and positive integer billingCodeID/contractID references only`,
25554
25554
  { operation: OP9 }
@@ -25574,7 +25574,7 @@ async function updateReviewFields(resource, id, data, opts = {}) {
25574
25574
  throw new StaleObjectError(`${OP9}: the time entry has changed or its modification time is unavailable`, { operation: OP9 });
25575
25575
  }
25576
25576
  }
25577
- const result = await resource.update(id, payload, { ...opts, raw: true });
25577
+ const result = await send(payload);
25578
25578
  return "simulated" in result ? { ...result, operation: OP9 } : result;
25579
25579
  }
25580
25580
 
@@ -25590,9 +25590,16 @@ var TimeEntriesResource = class extends GenericResource {
25590
25590
  // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
25591
25591
  }, pageSize);
25592
25592
  }
25593
- /** Only four review fields; the collection PUT never merges the current entry. */
25593
+ /** Only four review fields; collection PATCH preserves every omitted field. */
25594
25594
  async updateReviewFields(id, data, opts = {}) {
25595
- return updateReviewFields(this, id, data, opts);
25595
+ return updateReviewFields(this, id, data, async (payload) => {
25596
+ const numeric = parseIdentifier(id, "id");
25597
+ if (opts.dryRun === true) {
25598
+ const preview2 = await this.runUpdateDryRun(numeric, payload, { ...opts, raw: true });
25599
+ return { ...preview2, request: { ...preview2.request, method: "PATCH" } };
25600
+ }
25601
+ return this.updateGlobal(numeric, payload, { ...opts, raw: true }, "PATCH");
25602
+ }, opts);
25596
25603
  }
25597
25604
  dateWorkedWindow(from, to, opts) {
25598
25605
  return dateWorkedWindow(this, from, to, opts);
@@ -32,7 +32,7 @@ import { L as Logger } from './logger-B1gYmFre.cjs';
32
32
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
33
33
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
34
34
  *
35
- * planHash: 144fc9158531bbe8478a9c86a7127cbf14a0cd5fa043b6a69f453841813a15c2
35
+ * planHash: 95323eaa92fca1ba1541721c6f34ce671118736aca889ea432156d87a8a8ecd8
36
36
  */
37
37
 
38
38
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -2638,15 +2638,9 @@ interface TimeEntriesPostedCountResult {
2638
2638
  type TimeEntryReviewFields = Partial<Pick<TimeEntryUpdate, 'summaryNotes' | 'internalNotes' | 'billingCodeID' | 'contractID'>>;
2639
2639
  type TimeEntryReviewResult = OperationResult | DryRunResult<TimeEntryReviewFields>;
2640
2640
 
2641
- /**
2642
- * TimeEntriesResource — TimeEntry resource (G5 batch B, plan key 'time_entries').
2643
- * HAND-OWNED (post-#293): no generator emits per-key resource files. Edit directly;
2644
- * the plan drives the generated types, fixtures and tests, not this shell.
2645
- */
2646
-
2647
2641
  declare class TimeEntriesResource extends GenericResource<TimeEntry, TimeEntryCreate, TimeEntryUpdate> {
2648
2642
  constructor(http: HttpClient, pageSize: number);
2649
- /** Only four review fields; the collection PUT never merges the current entry. */
2643
+ /** Only four review fields; collection PATCH preserves every omitted field. */
2650
2644
  updateReviewFields(id: Identifier, data: TimeEntryReviewFields, opts?: Omit<MutationOpts, 'raw'>): Promise<TimeEntryReviewResult>;
2651
2645
  /** Node-parity special op (hand-written in src/resources/special/time_entries/windows.ts). */
2652
2646
  dateWorkedWindow(from: string, to: string, opts?: TimeEntriesPostedWindowListOptions): Promise<TimeEntriesPostedWindowResult>;
@@ -3525,7 +3519,7 @@ declare abstract class MutationBase<T = Record<string, unknown>, TCreate = Recor
3525
3519
  * (`persistedCheckFailed`: the error code, or `UNKNOWN (<error name>)`), never thrown.
3526
3520
  */
3527
3521
  protected withPersistedCheck(result: OperationResult, data: TUpdate, opts: MutationOpts, id: Identifier, parentId?: Identifier): Promise<OperationResult>;
3528
- protected updateGlobal(id: Identifier, data: TUpdate, opts?: MutationOpts): Promise<OperationResult>;
3522
+ protected updateGlobal(id: Identifier, data: TUpdate, opts?: MutationOpts, method?: 'PUT' | 'PATCH'): Promise<OperationResult>;
3529
3523
  /** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
3530
3524
  * (204 / empty body) is a valid vendor delete answer — synthesize the
3531
3525
  * result from the path id (issue #25: the transport returns undefined
@@ -32,7 +32,7 @@ import { L as Logger } from './logger-B1gYmFre.js';
32
32
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
33
33
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
34
34
  *
35
- * planHash: 144fc9158531bbe8478a9c86a7127cbf14a0cd5fa043b6a69f453841813a15c2
35
+ * planHash: 95323eaa92fca1ba1541721c6f34ce671118736aca889ea432156d87a8a8ecd8
36
36
  */
37
37
 
38
38
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -2638,15 +2638,9 @@ interface TimeEntriesPostedCountResult {
2638
2638
  type TimeEntryReviewFields = Partial<Pick<TimeEntryUpdate, 'summaryNotes' | 'internalNotes' | 'billingCodeID' | 'contractID'>>;
2639
2639
  type TimeEntryReviewResult = OperationResult | DryRunResult<TimeEntryReviewFields>;
2640
2640
 
2641
- /**
2642
- * TimeEntriesResource — TimeEntry resource (G5 batch B, plan key 'time_entries').
2643
- * HAND-OWNED (post-#293): no generator emits per-key resource files. Edit directly;
2644
- * the plan drives the generated types, fixtures and tests, not this shell.
2645
- */
2646
-
2647
2641
  declare class TimeEntriesResource extends GenericResource<TimeEntry, TimeEntryCreate, TimeEntryUpdate> {
2648
2642
  constructor(http: HttpClient, pageSize: number);
2649
- /** Only four review fields; the collection PUT never merges the current entry. */
2643
+ /** Only four review fields; collection PATCH preserves every omitted field. */
2650
2644
  updateReviewFields(id: Identifier, data: TimeEntryReviewFields, opts?: Omit<MutationOpts, 'raw'>): Promise<TimeEntryReviewResult>;
2651
2645
  /** Node-parity special op (hand-written in src/resources/special/time_entries/windows.ts). */
2652
2646
  dateWorkedWindow(from: string, to: string, opts?: TimeEntriesPostedWindowListOptions): Promise<TimeEntriesPostedWindowResult>;
@@ -3525,7 +3519,7 @@ declare abstract class MutationBase<T = Record<string, unknown>, TCreate = Recor
3525
3519
  * (`persistedCheckFailed`: the error code, or `UNKNOWN (<error name>)`), never thrown.
3526
3520
  */
3527
3521
  protected withPersistedCheck(result: OperationResult, data: TUpdate, opts: MutationOpts, id: Identifier, parentId?: Identifier): Promise<OperationResult>;
3528
- protected updateGlobal(id: Identifier, data: TUpdate, opts?: MutationOpts): Promise<OperationResult>;
3522
+ protected updateGlobal(id: Identifier, data: TUpdate, opts?: MutationOpts, method?: 'PUT' | 'PATCH'): Promise<OperationResult>;
3529
3523
  /** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
3530
3524
  * (204 / empty body) is a valid vendor delete answer — synthesize the
3531
3525
  * result from the path id (issue #25: the transport returns undefined