node-autotask 0.73.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/MCP_TOOL_CATALOG.json +175 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +532 -7
  5. package/dist/capabilities-data.js +531 -6
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-CWSXFVF2.cjs → chunk-AMB54GOO.cjs} +244 -86
  9. package/dist/{chunk-VHNWLON6.cjs → chunk-ASL3BIW2.cjs} +3 -3
  10. package/dist/{chunk-CKIKNZEB.cjs → chunk-DSQJTGXK.cjs} +31 -30
  11. package/dist/{chunk-VHN5B7OQ.js → chunk-HJKY7LUL.js} +239 -81
  12. package/dist/{chunk-RFH4VBMX.js → chunk-IFE5FWS7.js} +9 -7
  13. package/dist/{chunk-PNMEXWYR.js → chunk-IWTTCBCS.js} +3 -3
  14. package/dist/{chunk-L4J5EDCU.js → chunk-PGSDJS52.js} +3 -2
  15. package/dist/{chunk-STUQU7AX.cjs → chunk-QZY5LAOG.cjs} +206 -204
  16. package/dist/{index-CGp16Cdm.d.cts → index-CH65Ftmy.d.cts} +30 -1
  17. package/dist/{index-CGp16Cdm.d.ts → index-CH65Ftmy.d.ts} +30 -1
  18. package/dist/{index-MUM-uBX1.d.cts → index-CkBDlaSS.d.cts} +4 -2
  19. package/dist/{index-Dv8d9p_J.d.ts → index-ColCzIyw.d.ts} +4 -2
  20. package/dist/index.cjs +84 -84
  21. package/dist/index.d.cts +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +4 -4
  26. package/dist/operations/index.d.ts +4 -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 +3 -2
  39. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { loadCapabilityRecords } from './chunk-PNMEXWYR.js';
1
+ import { loadCapabilityRecords } from './chunk-IWTTCBCS.js';
2
2
  import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-7NKB4UXV.js';
3
3
  import { randomUUID, createHash } from 'crypto';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
@@ -6215,6 +6215,22 @@ var RELATIONSHIP_MAP = {
6215
6215
  "delete": false
6216
6216
  }
6217
6217
  },
6218
+ {
6219
+ "resource": "task_predecessors",
6220
+ "apiEntity": "TaskPredecessor",
6221
+ "parentField": "successorTaskID",
6222
+ "parentSegment": "Predecessors",
6223
+ "tier": "extended",
6224
+ "workflowResource": false,
6225
+ "specialOps": [],
6226
+ "searchCovers": null,
6227
+ "scopedOps": {
6228
+ "create": true,
6229
+ "query": true,
6230
+ "update": true,
6231
+ "delete": true
6232
+ }
6233
+ },
6218
6234
  {
6219
6235
  "resource": "task_secondary_resources",
6220
6236
  "apiEntity": "TaskSecondaryResource",
@@ -9773,6 +9789,50 @@ var RELATIONSHIP_MAP = {
9773
9789
  "proof": "spec-derived"
9774
9790
  },
9775
9791
  "markerField": "title"
9792
+ },
9793
+ "task_predecessors": {
9794
+ "resource": "task_predecessors",
9795
+ "apiEntity": "TaskPredecessor",
9796
+ "kind": "entity",
9797
+ "path": "TaskPredecessors",
9798
+ "parentScoped": true,
9799
+ "tier": "extended",
9800
+ "workflowResource": false,
9801
+ "group": "A",
9802
+ "parent": {
9803
+ "resource": "tasks",
9804
+ "segment": "Predecessors",
9805
+ "field": "successorTaskID"
9806
+ },
9807
+ "children": [],
9808
+ "naturalKeys": {
9809
+ "hasSearch": false,
9810
+ "searchCovers": null,
9811
+ "findBy": []
9812
+ },
9813
+ "blindSurfaces": null,
9814
+ "zoneFacts": {
9815
+ "createGuidance": {
9816
+ "createOp": "task_predecessors.create",
9817
+ "parentScoped": true,
9818
+ "liveProvenPrefix": [],
9819
+ "unproven": true,
9820
+ "blocker": {
9821
+ "kind": "unknown",
9822
+ "message": "TaskPredecessors mutations are not verified; module, task permissions and project state can restrict them.",
9823
+ "remedy": "Use preview and verify both task references; baseline relationships are read-only and predecessor phases are unsupported."
9824
+ },
9825
+ "vendorEvidence": [
9826
+ "https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskPredecessorsEntity.htm"
9827
+ ],
9828
+ "deleteBoundary": {
9829
+ "available": true,
9830
+ "note": null
9831
+ }
9832
+ }
9833
+ },
9834
+ "deleteBoundary": null,
9835
+ "markerField": null
9776
9836
  }
9777
9837
  };
9778
9838
  var BLIND_SURFACE_STAMPS = {
@@ -13349,6 +13409,25 @@ var CREATE_GUIDANCE = {
13349
13409
  "note": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API."
13350
13410
  }
13351
13411
  },
13412
+ {
13413
+ "resource": "task_predecessors",
13414
+ "createOp": "task_predecessors.create",
13415
+ "parentScoped": true,
13416
+ "liveProvenPrefix": [],
13417
+ "unproven": true,
13418
+ "blocker": {
13419
+ "kind": "unknown",
13420
+ "message": "TaskPredecessors mutations are not verified; module, task permissions and project state can restrict them.",
13421
+ "remedy": "Use preview and verify both task references; baseline relationships are read-only and predecessor phases are unsupported."
13422
+ },
13423
+ "vendorEvidence": [
13424
+ "https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskPredecessorsEntity.htm"
13425
+ ],
13426
+ "deleteBoundary": {
13427
+ "available": true,
13428
+ "note": null
13429
+ }
13430
+ },
13352
13431
  {
13353
13432
  "resource": "task_secondary_resources",
13354
13433
  "createOp": "task_secondary_resources.create",
@@ -13904,7 +13983,7 @@ var CREATE_GUIDANCE = {
13904
13983
  }
13905
13984
  ],
13906
13985
  "counts": {
13907
- "total": 103,
13986
+ "total": 104,
13908
13987
  "byKind": {
13909
13988
  "ok": 41,
13910
13989
  "blind-reference": 16,
@@ -13914,7 +13993,7 @@ var CREATE_GUIDANCE = {
13914
13993
  "resource-role-pair": 2,
13915
13994
  "delete-absent": 0,
13916
13995
  "non-mutable": 0,
13917
- "unknown": 27
13996
+ "unknown": 28
13918
13997
  }
13919
13998
  }
13920
13999
  };
@@ -16446,13 +16525,13 @@ async function runBounded(fn, items, opts) {
16446
16525
  const results = new Array(items.length);
16447
16526
  let next = 0;
16448
16527
  let failure;
16449
- const fail = (error, index) => {
16528
+ const fail2 = (error, index) => {
16450
16529
  if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
16451
16530
  };
16452
16531
  const worker = async () => {
16453
16532
  while (failure === void 0 && next < items.length) {
16454
16533
  if (signal?.aborted) {
16455
- fail(signal.reason, -1);
16534
+ fail2(signal.reason, -1);
16456
16535
  return;
16457
16536
  }
16458
16537
  const i = next++;
@@ -16462,7 +16541,7 @@ async function runBounded(fn, items, opts) {
16462
16541
  results[i] = settle ? { status: "fulfilled", value } : value;
16463
16542
  } catch (error) {
16464
16543
  if (settle) results[i] = { status: "rejected", reason: error };
16465
- else fail(error, i);
16544
+ else fail2(error, i);
16466
16545
  }
16467
16546
  }
16468
16547
  };
@@ -17739,6 +17818,7 @@ var MODEL_FIELD_SETS = {
17739
17818
  "tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
17740
17819
  "tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
17741
17820
  "task_notes": ["id", "createDateTime", "creatorResourceID", "createdByContactID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "taskID", "title", "soapParentPropertyId"],
17821
+ "task_predecessors": ["id", "lagDays", "predecessorTaskID", "successorTaskID", "soapParentPropertyId"],
17742
17822
  "task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
17743
17823
  "tasks": ["id", "assignedResourceID", "assignedResourceRoleID", "billingCodeID", "canClientPortalUserCompleteTask", "companyLocationID", "completedByResourceID", "completedByType", "completedDateTime", "createDateTime", "creatorResourceID", "creatorType", "departmentID", "description", "endDateTime", "estimatedHours", "externalID", "hoursToBeScheduled", "isTaskBillable", "isVisibleInClientPortal", "lastActivityDateTime", "lastActivityPersonType", "lastActivityResourceID", "phaseID", "priority", "priorityLabel", "projectID", "purchaseOrderNumber", "remainingHours", "startDateTime", "status", "taskCategoryID", "taskNumber", "taskType", "title", "soapParentPropertyId", "userDefinedFields"],
17744
17824
  "tax_regions": ["id", "isActive", "name"],
@@ -17907,21 +17987,21 @@ function validateRelationLeaves(resourceKey, conditions, op) {
17907
17987
  assertUndottedUdfField(c, op);
17908
17988
  const field = c.field;
17909
17989
  const [rel, sub, ...rest] = field.split(".");
17910
- const fail = (why) => {
17990
+ const fail2 = (why) => {
17911
17991
  throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
17912
17992
  operation: op,
17913
17993
  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.`
17914
17994
  });
17915
17995
  };
17916
17996
  if (selfPrefixes(resourceKey).includes(rel)) {
17917
- if (rest.length > 0 || !sub) fail("is not <resource>.<field> (multi-hop relations are not supported)");
17997
+ if (rest.length > 0 || !sub) fail2("is not <resource>.<field> (multi-hop relations are not supported)");
17918
17998
  continue;
17919
17999
  }
17920
- if (rest.length > 0 || !sub) fail("is not <relation>.<field> (multi-hop relations are not supported)");
17921
- if (!valid.includes(rel)) fail(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
18000
+ if (rest.length > 0 || !sub) fail2("is not <relation>.<field> (multi-hop relations are not supported)");
18001
+ if (!valid.includes(rel)) fail2(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
17922
18002
  const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
17923
18003
  if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
17924
- fail(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
18004
+ fail2(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
17925
18005
  }
17926
18006
  }
17927
18007
  };
@@ -18767,9 +18847,9 @@ var MetaBase = class _MetaBase extends QueryBase {
18767
18847
  }
18768
18848
  /** `GET /V1.0/<E>/{id}` → `{ item }` unwrapped (`item: null` → NotFoundError). */
18769
18849
  async getGlobal(id, fresh = false) {
18770
- const numeric = parseIdentifier(id, "id");
18771
- const res = await this.cachedGet(`${this.resourcePath}/${numeric}`, `${this.config.key}.get`, fresh);
18772
- return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
18850
+ const numeric2 = parseIdentifier(id, "id");
18851
+ const res = await this.cachedGet(`${this.resourcePath}/${numeric2}`, `${this.config.key}.get`, fresh);
18852
+ return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
18773
18853
  }
18774
18854
  /**
18775
18855
  * V2 merge read: a FRESH single-record GET that skips response redaction
@@ -18783,15 +18863,15 @@ var MetaBase = class _MetaBase extends QueryBase {
18783
18863
  * (redacted-view) read cache.
18784
18864
  */
18785
18865
  async getGlobalUnredacted(id, readOpts) {
18786
- const numeric = parseIdentifier(id, "id");
18866
+ const numeric2 = parseIdentifier(id, "id");
18787
18867
  const res = await this.http.request({
18788
18868
  method: "GET",
18789
- path: `${this.resourcePath}/${numeric}`,
18869
+ path: `${this.resourcePath}/${numeric2}`,
18790
18870
  operation: `${this.config.key}.get`,
18791
18871
  skipResponseRedaction: true,
18792
18872
  maxRetries: readOpts?.maxRetries
18793
18873
  });
18794
- return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
18874
+ return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
18795
18875
  }
18796
18876
  /**
18797
18877
  * Issue #34 fallback merge read: a FRESH parent-scoped single-record GET
@@ -18802,21 +18882,21 @@ var MetaBase = class _MetaBase extends QueryBase {
18802
18882
  * '[REDACTED]' markers into the fallback PUT (corruption on live records).
18803
18883
  */
18804
18884
  async getScopedUnredacted(parentId, id, readOpts) {
18805
- const numeric = parseIdentifier(id, "id");
18885
+ const numeric2 = parseIdentifier(id, "id");
18806
18886
  const res = await this.http.request({
18807
18887
  method: "GET",
18808
- path: this.scopedItemPath(parentId, numeric),
18888
+ path: this.scopedItemPath(parentId, numeric2),
18809
18889
  operation: `${this.config.key}.get`,
18810
18890
  skipResponseRedaction: true,
18811
18891
  maxRetries: readOpts?.maxRetries
18812
18892
  });
18813
- return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
18893
+ return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
18814
18894
  }
18815
18895
  /** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */
18816
18896
  async getScopedRaw(parentId, id, fresh = false) {
18817
- const numeric = parseIdentifier(id, "id");
18897
+ const numeric2 = parseIdentifier(id, "id");
18818
18898
  const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
18819
- return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
18899
+ return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
18820
18900
  }
18821
18901
  /**
18822
18902
  * Attachment single-read: the vendor answers the model DIRECTLY (swagger),
@@ -18824,9 +18904,9 @@ var MetaBase = class _MetaBase extends QueryBase {
18824
18904
  * accept all three shapes; empty/null → NotFoundError.
18825
18905
  */
18826
18906
  async getScopedModel(parentId, id, fresh = false) {
18827
- const numeric = parseIdentifier(id, "id");
18907
+ const numeric2 = parseIdentifier(id, "id");
18828
18908
  const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
18829
- return this.unwrapModelLike(res, numeric, this.entityName);
18909
+ return this.unwrapModelLike(res, numeric2, this.entityName);
18830
18910
  }
18831
18911
  /** @internal */
18832
18912
  unwrapModelLike(body, id, entity) {
@@ -18967,12 +19047,12 @@ var MetaBase = class _MetaBase extends QueryBase {
18967
19047
  * the composite ROOT of a hot resource (issue #36) must see the live
18968
19048
  * record, never a snapshot. */
18969
19049
  async fetchRecordRaw(entityPath, id, fresh = false) {
18970
- const numeric = parseIdentifier(id, "id");
18971
- const res = await this.cachedGet(`${entityPath}/${numeric}`, `${this.config.key}.fetchRecord`, fresh);
19050
+ const numeric2 = parseIdentifier(id, "id");
19051
+ const res = await this.cachedGet(`${entityPath}/${numeric2}`, `${this.config.key}.fetchRecord`, fresh);
18972
19052
  if (this.config.attachmentGet) {
18973
- return this.unwrapModelLike(res, numeric, entityNameFromPath(entityPath));
19053
+ return this.unwrapModelLike(res, numeric2, entityNameFromPath(entityPath));
18974
19054
  }
18975
- return unwrapItem(res, numeric, `${this.config.key}.fetchRecord`, entityNameFromPath(entityPath));
19055
+ return unwrapItem(res, numeric2, `${this.config.key}.fetchRecord`, entityNameFromPath(entityPath));
18976
19056
  }
18977
19057
  /**
18978
19058
  * `getContext` part fetch: a single-record read that degrades to `null`
@@ -19048,12 +19128,12 @@ var MetaBase = class _MetaBase extends QueryBase {
19048
19128
  * - bare value on an id-only resource → AutotaskConfigError (CONFIG_ERROR).
19049
19129
  */
19050
19130
  async resolveDetailed(identifier) {
19051
- let numeric = null;
19131
+ let numeric2 = null;
19052
19132
  if (isIdentifierCandidate(identifier)) {
19053
- numeric = parseIdentifier(identifier, "id");
19133
+ numeric2 = parseIdentifier(identifier, "id");
19054
19134
  }
19055
- if (numeric !== null) {
19056
- const record = await this.fetchRecordRaw(this.resourcePath, numeric);
19135
+ if (numeric2 !== null) {
19136
+ const record = await this.fetchRecordRaw(this.resourcePath, numeric2);
19057
19137
  return { value: record, resolutionCost: "direct", scanned: 0, scanTruncated: false };
19058
19138
  }
19059
19139
  if (typeof identifier !== "string" || identifier.trim() === "") {
@@ -19481,7 +19561,7 @@ var MutationBase = class extends MetaBase {
19481
19561
  }
19482
19562
  }
19483
19563
  async updateGlobal(id, data, opts = {}, method = "PUT") {
19484
- const numeric = parseIdentifier(id, "id");
19564
+ const numeric2 = parseIdentifier(id, "id");
19485
19565
  const operation = `${this.config.key}.update`;
19486
19566
  let body = this.normalizeMutationBody(data);
19487
19567
  const collectionUpdate = this.config.collectionUpdate === true;
@@ -19489,7 +19569,7 @@ var MutationBase = class extends MetaBase {
19489
19569
  if (opts.raw !== true) {
19490
19570
  let current;
19491
19571
  try {
19492
- current = await this.getGlobalUnredacted(numeric, { maxRetries: opts.maxRetries });
19572
+ current = await this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries });
19493
19573
  } catch (err) {
19494
19574
  if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);
19495
19575
  throw err;
@@ -19497,16 +19577,16 @@ var MutationBase = class extends MetaBase {
19497
19577
  this.staleObjectCheck(current, opts, operation);
19498
19578
  body = mergePartialBody(current, body);
19499
19579
  } else {
19500
- await this.guardStaleBeforeMutation(numeric, opts, operation);
19580
+ await this.guardStaleBeforeMutation(numeric2, opts, operation);
19501
19581
  }
19502
- body.id = numeric;
19582
+ body.id = numeric2;
19503
19583
  }
19504
- const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`}`;
19584
+ const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`}`;
19505
19585
  let res;
19506
19586
  try {
19507
19587
  res = await this.http.request({
19508
19588
  method,
19509
- path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`,
19589
+ path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`,
19510
19590
  body,
19511
19591
  operation,
19512
19592
  maxRetries: opts.maxRetries
@@ -19517,15 +19597,15 @@ var MutationBase = class extends MetaBase {
19517
19597
  throw this.putFallbackDeclined(err, route, false);
19518
19598
  }
19519
19599
  const merged = await this.putFallbackMergedBody(
19520
- () => this.getGlobalUnredacted(numeric, { maxRetries: opts.maxRetries }),
19600
+ () => this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries }),
19521
19601
  body,
19522
- numeric
19602
+ numeric2
19523
19603
  );
19524
19604
  let retry;
19525
19605
  try {
19526
19606
  retry = await this.http.request({
19527
19607
  method: "PUT",
19528
- path: `${this.resourcePath}/${numeric}`,
19608
+ path: `${this.resourcePath}/${numeric2}`,
19529
19609
  body: merged,
19530
19610
  operation,
19531
19611
  maxRetries: opts.maxRetries
@@ -19534,23 +19614,23 @@ var MutationBase = class extends MetaBase {
19534
19614
  if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, route, true);
19535
19615
  throw rerr;
19536
19616
  }
19537
- return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric);
19617
+ return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2);
19538
19618
  }
19539
- return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric);
19619
+ return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2);
19540
19620
  }
19541
19621
  /** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
19542
19622
  * (204 / empty body) is a valid vendor delete answer — synthesize the
19543
19623
  * result from the path id (issue #25: the transport returns undefined
19544
19624
  * for it; a non-blank wrong shape still throws via unwrapOperation). */
19545
19625
  async deleteGlobal(id, opts = {}) {
19546
- const numeric = parseIdentifier(id, "id");
19626
+ const numeric2 = parseIdentifier(id, "id");
19547
19627
  const res = await this.http.request({
19548
19628
  method: "DELETE",
19549
- path: `${this.resourcePath}/${numeric}`,
19629
+ path: `${this.resourcePath}/${numeric2}`,
19550
19630
  operation: `${this.config.key}.delete`,
19551
19631
  maxRetries: opts.maxRetries
19552
19632
  });
19553
- return res === void 0 ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);
19633
+ return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
19554
19634
  }
19555
19635
  /** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
19556
19636
  async createScopedRaw(parentId, data, opts = {}) {
@@ -19569,9 +19649,9 @@ var MutationBase = class extends MetaBase {
19569
19649
  * the item path anywhere in the spec; the node strips the id from the path and
19570
19650
  * PATCHes the collection, and the vendor keys the record by the id in the body. */
19571
19651
  async updateScopedRaw(parentId, id, data, opts = {}) {
19572
- const numeric = parseIdentifier(id, "id");
19652
+ const numeric2 = parseIdentifier(id, "id");
19573
19653
  const body = this.normalizeMutationBody(data);
19574
- body.id = numeric;
19654
+ body.id = numeric2;
19575
19655
  const path = this.scopedCollectionPath(parentId);
19576
19656
  const operation = `${this.config.key}.update`;
19577
19657
  let res;
@@ -19586,45 +19666,45 @@ var MutationBase = class extends MetaBase {
19586
19666
  } catch (err) {
19587
19667
  if (!this.putFallbackEligible(err)) throw err;
19588
19668
  const merged = await this.putFallbackMergedBody(
19589
- () => this.getScopedUnredacted(parentId, numeric, { maxRetries: opts.maxRetries }),
19669
+ () => this.getScopedUnredacted(parentId, numeric2, { maxRetries: opts.maxRetries }),
19590
19670
  body,
19591
- numeric
19671
+ numeric2
19592
19672
  );
19593
19673
  let retry;
19594
19674
  try {
19595
19675
  retry = await this.http.request({
19596
19676
  method: "PUT",
19597
- path: `${path}/${numeric}`,
19677
+ path: `${path}/${numeric2}`,
19598
19678
  body: merged,
19599
19679
  operation,
19600
19680
  maxRetries: opts.maxRetries
19601
19681
  });
19602
19682
  } catch (rerr) {
19603
- if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric}`, true);
19683
+ if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric2}`, true);
19604
19684
  throw rerr;
19605
19685
  }
19606
- return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric, parentId);
19686
+ return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2, parentId);
19607
19687
  }
19608
- return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric, parentId);
19688
+ return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2, parentId);
19609
19689
  }
19610
19690
  /** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
19611
19691
  * (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
19612
19692
  async deleteScopedRaw(parentId, id, opts = {}) {
19613
- const numeric = parseIdentifier(id, "id");
19693
+ const numeric2 = parseIdentifier(id, "id");
19614
19694
  const res = await this.http.request({
19615
19695
  method: "DELETE",
19616
19696
  path: this.scopedItemPath(parentId, id),
19617
19697
  operation: `${this.config.key}.delete`,
19618
19698
  maxRetries: opts.maxRetries
19619
19699
  });
19620
- return res === void 0 ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);
19700
+ return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
19621
19701
  }
19622
19702
  /**
19623
19703
  * Attachment delete: the vendor returns the deleted attachment MODEL, not
19624
19704
  * OperationResultModel (G1 envelope.md) — pass it through typed.
19625
19705
  */
19626
19706
  async deleteScopedModel(parentId, id, opts = {}) {
19627
- const numeric = parseIdentifier(id, "id");
19707
+ const numeric2 = parseIdentifier(id, "id");
19628
19708
  const res = await this.http.request({
19629
19709
  method: "DELETE",
19630
19710
  path: this.scopedItemPath(parentId, id),
@@ -19634,8 +19714,8 @@ var MutationBase = class extends MetaBase {
19634
19714
  if (res === void 0) return {};
19635
19715
  if (!isRecord2(res)) {
19636
19716
  throw new AutotaskError(
19637
- `Expected the deleted attachment model for ID ${numeric}; got a different shape`,
19638
- { code: "INVALID_RESPONSE", category: "server", resourceIds: [numeric], details: { idRefs: [{ entity: this.entityName, id: numeric }] } }
19717
+ `Expected the deleted attachment model for ID ${numeric2}; got a different shape`,
19718
+ { code: "INVALID_RESPONSE", category: "server", resourceIds: [numeric2], details: { idRefs: [{ entity: this.entityName, id: numeric2 }] } }
19639
19719
  );
19640
19720
  }
19641
19721
  return res;
@@ -19943,34 +20023,87 @@ var BaseResource = class extends MutationBase {
19943
20023
  }
19944
20024
  };
19945
20025
 
20026
+ // src/resources/special/taskPredecessors.ts
20027
+ function fail(detail) {
20028
+ throw new AutotaskConfigError(`task_predecessors: ${detail}`);
20029
+ }
20030
+ function numeric(value, field) {
20031
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail(`${field} must be a positive numeric identifier`);
20032
+ return value;
20033
+ }
20034
+ function predecessorParent(value) {
20035
+ const parent = parseIdentifier(value, "parentId");
20036
+ if (parent === 0) fail("parentId must name a successor task");
20037
+ return parent;
20038
+ }
20039
+ function assertPredecessorBinding(value, parentId, id) {
20040
+ if (!isRecord2(value)) fail("the returned record must establish id and successorTaskID parent");
20041
+ if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId))) fail("the returned record must match id and successorTaskID parent");
20042
+ }
20043
+ function admitTaskPredecessor(data, parentId, creating) {
20044
+ const parent = predecessorParent(parentId);
20045
+ if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail("data must be a plain record");
20046
+ const payload = { ...data };
20047
+ const allowed = creating ? ["predecessorTaskID", "successorTaskID", "lagDays"] : ["lagDays"];
20048
+ if (Object.keys(payload).some((key) => !allowed.includes(key))) fail(creating ? "only predecessorTaskID, successorTaskID and lagDays are writable on create" : "only lagDays can be updated");
20049
+ if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647)) fail("lagDays must be an int32 integer");
20050
+ if (creating) {
20051
+ const successor = numeric(payload.successorTaskID, "successorTaskID");
20052
+ const predecessor = numeric(payload.predecessorTaskID, "predecessorTaskID");
20053
+ if (String(successor) !== String(parent)) fail("successorTaskID must match parentId");
20054
+ if (predecessor === successor) fail("predecessorTaskID and successorTaskID must be distinct");
20055
+ }
20056
+ return payload;
20057
+ }
20058
+ async function guardTaskPredecessor(http, parentId, id, data) {
20059
+ const parent = predecessorParent(parentId);
20060
+ let row = data;
20061
+ if (id !== void 0) {
20062
+ const target = parseIdentifier(id, "id");
20063
+ if (target === 0) fail("id must name a predecessor relationship");
20064
+ row = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${parent}/Predecessors/${target}`, operation: "task_predecessors.get" }), target, "task_predecessors.get", "task_predecessor");
20065
+ assertPredecessorBinding(row, parent, target);
20066
+ }
20067
+ const predecessor = numeric(row?.predecessorTaskID, "predecessorTaskID");
20068
+ const successor = numeric(row?.successorTaskID, "successorTaskID");
20069
+ if (predecessor === successor) fail("predecessorTaskID and successorTaskID must be distinct");
20070
+ const projects = [];
20071
+ for (const taskId of [predecessor, successor]) {
20072
+ const task = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${taskId}`, operation: "tasks.get" }), taskId, "tasks.get", "task");
20073
+ if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail("the returned task must match its requested id");
20074
+ projects.push(numeric(task.projectID, "task.projectID"));
20075
+ }
20076
+ if (projects[0] !== projects[1]) fail("predecessor and successor tasks must belong to the same project");
20077
+ }
20078
+
19946
20079
  // src/resources/special/taskNotes.ts
19947
20080
  var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
19948
20081
  function admitTaskNote(data, parentId, creating) {
19949
20082
  const parent = parseIdentifier(parentId, "parentId");
19950
- const fail = (message) => {
20083
+ const fail2 = (message) => {
19951
20084
  throw new AutotaskConfigError(`task_notes: ${message}`);
19952
20085
  };
19953
- if (data === null || typeof data !== "object" || Array.isArray(data)) fail("data must be a record");
20086
+ if (data === null || typeof data !== "object" || Array.isArray(data)) fail2("data must be a record");
19954
20087
  const body = data;
19955
- for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail(`${key} is not a writable TaskNotes field`);
20088
+ for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail2(`${key} is not a writable TaskNotes field`);
19956
20089
  for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
19957
20090
  const value = body[field];
19958
- if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail(`${field} must be a string of at most ${maximum} characters`);
20091
+ if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail2(`${field} must be a string of at most ${maximum} characters`);
19959
20092
  }
19960
- if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail("description is required");
20093
+ if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail2("description is required");
19961
20094
  for (const field of ["noteType", "publish"]) {
19962
20095
  const value = body[field];
19963
- if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail(`${field} must be an integer from the current field metadata`);
20096
+ if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail2(`${field} must be an integer from the current field metadata`);
19964
20097
  }
19965
- if (creating && body.taskID === void 0) fail("taskID is required in the create body and must match parentId");
20098
+ if (creating && body.taskID === void 0) fail2("taskID is required in the create body and must match parentId");
19966
20099
  for (const field of ["createdByContactID", "taskID"]) {
19967
20100
  if (body[field] !== void 0) {
19968
- if (typeof body[field] !== "number") fail(`${field} must be a numeric identifier`);
20101
+ if (typeof body[field] !== "number") fail2(`${field} must be a numeric identifier`);
19969
20102
  const id = parseIdentifier(body[field], field);
19970
- if (field === "taskID" && String(id) !== String(parent)) fail("taskID must match the parentId path argument");
20103
+ if (field === "taskID" && String(id) !== String(parent)) fail2("taskID must match the parentId path argument");
19971
20104
  }
19972
20105
  }
19973
- if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail("update must contain a writable field");
20106
+ if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail2("update must contain a writable field");
19974
20107
  }
19975
20108
 
19976
20109
  // src/resources/simple.ts
@@ -21217,6 +21350,19 @@ var SIMPLE_RESOURCES = [
21217
21350
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21218
21351
  opForms: { get: "scoped", create: "scoped", update: "scoped" }
21219
21352
  },
21353
+ {
21354
+ key: "task_predecessors",
21355
+ accessor: "taskPredecessors",
21356
+ resourcePath: "/V1.0/TaskPredecessors",
21357
+ parentScopedPath: "/V1.0/Tasks/{parentId}/Predecessors",
21358
+ parentPath: "/V1.0/Tasks",
21359
+ parentField: "successorTaskID",
21360
+ deletable: true,
21361
+ udfCapable: false,
21362
+ ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
21363
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
21364
+ opForms: { get: "scoped", create: "scoped", update: "scoped", delete: "scoped" }
21365
+ },
21220
21366
  {
21221
21367
  key: "task_secondary_resources",
21222
21368
  accessor: "taskSecondaryResources",
@@ -21482,7 +21628,7 @@ var GenericResource = class extends BaseResource {
21482
21628
  if (["company_attachments", "company_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
21483
21629
  throw new OperationNotSupportedError(config.key, "getUdfInfo");
21484
21630
  };
21485
- if (config.ops?.create === false || config.key === "company_attachments") this.createIfNotExists = async () => {
21631
+ if (config.ops?.create === false || config.key === "company_attachments" || config.key === "task_predecessors") this.createIfNotExists = async () => {
21486
21632
  throw new OperationNotSupportedError(config.key, "createIfNotExists");
21487
21633
  };
21488
21634
  if (config.key === "task_notes") {
@@ -21493,6 +21639,9 @@ var GenericResource = class extends BaseResource {
21493
21639
  };
21494
21640
  }
21495
21641
  }
21642
+ putFallbackEligible(err) {
21643
+ return this.config.key !== "task_predecessors" && super.putFallbackEligible(err);
21644
+ }
21496
21645
  /** #293 QA F2: the superset exposes every generic method, but a row whose ops/helpers
21497
21646
  * flags mark an op absent (the plain entities) refuses it client-side, pre-wire — the
21498
21647
  * pre-#293 per-key shell simply did not carry the method. Rows without flags (the
@@ -21529,6 +21678,12 @@ var GenericResource = class extends BaseResource {
21529
21678
  if (isIdentifier(b)) {
21530
21679
  if (this.config.opForms?.get === "global") throw new OperationNotSupportedError(this.config.key, "get");
21531
21680
  const fresh = (c ?? null)?.fresh === true;
21681
+ if (this.config.key === "task_predecessors") {
21682
+ predecessorParent(a);
21683
+ const record = await this.getScopedRaw(a, b, fresh);
21684
+ assertPredecessorBinding(record, a, b);
21685
+ return record;
21686
+ }
21532
21687
  return this.config.attachmentGet === true ? this.getScopedModel(a, b, fresh) : this.getScopedRaw(a, b, fresh);
21533
21688
  }
21534
21689
  if (this.config.opForms?.get === "scoped") throw new OperationNotSupportedError(this.config.key, "get");
@@ -21539,9 +21694,10 @@ var GenericResource = class extends BaseResource {
21539
21694
  if (isIdentifier(a)) {
21540
21695
  if (this.config.opForms?.create === "global") throw new OperationNotSupportedError(this.config.key, "create");
21541
21696
  const parentId = a;
21542
- const data2 = b;
21543
- const opts2 = c ?? {};
21697
+ const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(b, parentId, true) : b;
21698
+ const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
21544
21699
  if (this.config.key === "task_notes") admitTaskNote(data2, parentId, true);
21700
+ if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, void 0, data2);
21545
21701
  if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
21546
21702
  return this.createScopedRaw(parentId, data2, opts2);
21547
21703
  }
@@ -21557,9 +21713,10 @@ var GenericResource = class extends BaseResource {
21557
21713
  if (this.config.opForms?.update === "global") throw new OperationNotSupportedError(this.config.key, "update");
21558
21714
  const parentId = a;
21559
21715
  const id2 = b;
21560
- const data2 = c;
21561
- const opts2 = d ?? {};
21716
+ const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(c, parentId, false) : c;
21717
+ const opts2 = this.config.key === "task_predecessors" ? { ...d } : d ?? {};
21562
21718
  if (this.config.key === "task_notes") admitTaskNote(data2, parentId, false);
21719
+ if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, id2);
21563
21720
  if (opts2.dryRun === true) return this.runUpdateDryRun(id2, data2, opts2, parentId);
21564
21721
  if (this.config.collectionUpdate !== true) {
21565
21722
  await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.update`, parentId);
@@ -21582,7 +21739,8 @@ var GenericResource = class extends BaseResource {
21582
21739
  if (this.config.opForms?.delete === "global") throw new OperationNotSupportedError(this.config.key, "delete");
21583
21740
  const parentId = a;
21584
21741
  const id2 = b;
21585
- const opts2 = c ?? {};
21742
+ const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
21743
+ if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, id2);
21586
21744
  if (opts2.dryRun === true) return this.runDeleteDryRun(id2, opts2, parentId);
21587
21745
  await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.delete`, parentId);
21588
21746
  return this.config.attachmentGet === true ? this.deleteScopedModel(parentId, id2, opts2) : this.deleteScopedRaw(parentId, id2, opts2);
@@ -26574,16 +26732,16 @@ function latchingHttp(raw, spend) {
26574
26732
  }
26575
26733
  };
26576
26734
  observeRecordReadFailures(http, latch);
26577
- const fail = (err) => {
26735
+ const fail2 = (err) => {
26578
26736
  latch(err);
26579
26737
  throw err;
26580
26738
  };
26581
26739
  http.request = (o) => {
26582
26740
  if (fatal) throw fatal;
26583
26741
  try {
26584
- return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail);
26742
+ return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail2);
26585
26743
  } catch (err) {
26586
- return fail(err);
26744
+ return fail2(err);
26587
26745
  }
26588
26746
  };
26589
26747
  return { http, fatal: () => fatal, signal };
@@ -27781,12 +27939,12 @@ var TimeEntriesResource = class extends GenericResource {
27781
27939
  /** Only four review fields; collection PATCH preserves every omitted field. */
27782
27940
  async updateReviewFields(id, data, opts = {}) {
27783
27941
  return updateReviewFields(this, id, data, async (payload) => {
27784
- const numeric = parseIdentifier(id, "id");
27942
+ const numeric2 = parseIdentifier(id, "id");
27785
27943
  if (opts.dryRun === true) {
27786
- const preview2 = await this.runUpdateDryRun(numeric, payload, { ...opts, raw: true });
27944
+ const preview2 = await this.runUpdateDryRun(numeric2, payload, { ...opts, raw: true });
27787
27945
  return { ...preview2, request: { ...preview2.request, method: "PATCH" } };
27788
27946
  }
27789
- return this.updateGlobal(numeric, payload, { ...opts, raw: true }, "PATCH");
27947
+ return this.updateGlobal(numeric2, payload, { ...opts, raw: true }, "PATCH");
27790
27948
  }, opts);
27791
27949
  }
27792
27950
  dateWorkedWindow(from, to, opts) {