node-autotask 0.72.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.
- package/CHANGELOG.md +24 -0
- package/MCP_TOOL_CATALOG.json +216 -9
- package/README.md +1 -1
- package/capabilities.json +664 -7
- package/dist/capabilities-data.js +663 -6
- package/dist/capabilities.cjs +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-KVC5DZAP.cjs → chunk-AMB54GOO.cjs} +324 -94
- package/dist/{chunk-SPME362B.cjs → chunk-ASL3BIW2.cjs} +3 -3
- package/dist/{chunk-HJVTA7SI.cjs → chunk-DSQJTGXK.cjs} +31 -30
- package/dist/{chunk-EGG2RGL5.js → chunk-HJKY7LUL.js} +318 -90
- package/dist/{chunk-F2TYZKJS.js → chunk-IFE5FWS7.js} +128 -2
- package/dist/{chunk-K33DPJFK.js → chunk-IWTTCBCS.js} +3 -3
- package/dist/{chunk-A4IRIYZ5.js → chunk-PGSDJS52.js} +3 -2
- package/dist/{chunk-V5UGW6KZ.cjs → chunk-QZY5LAOG.cjs} +303 -177
- package/dist/{index-BXnhBnhN.d.cts → index-CH65Ftmy.d.cts} +39 -21
- package/dist/{index-BXnhBnhN.d.ts → index-CH65Ftmy.d.ts} +39 -21
- package/dist/{index-CqsY5YHt.d.cts → index-CkBDlaSS.d.cts} +166 -4
- package/dist/{index-DxfspQR1.d.ts → index-ColCzIyw.d.ts} +166 -4
- package/dist/index.cjs +84 -84
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +5 -5
- package/dist/operations/index.cjs +51 -51
- package/dist/operations/index.d.cts +5 -6
- package/dist/operations/index.d.ts +5 -6
- package/dist/operations/index.js +2 -2
- package/dist/pool.cjs +12 -12
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +27 -27
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/API.md +4 -3
- package/docs/N8N-ADAPTER.md +1 -1
- package/package.json +1 -1
- package/dist/base-CHMATPq0.d.cts +0 -145
- package/dist/base-CHMATPq0.d.ts +0 -145
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkASL3BIW2_cjs = require('./chunk-ASL3BIW2.cjs');
|
|
4
4
|
var chunkBD4AUGCJ_cjs = require('./chunk-BD4AUGCJ.cjs');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
var async_hooks = require('async_hooks');
|
|
@@ -6217,6 +6217,22 @@ var RELATIONSHIP_MAP = {
|
|
|
6217
6217
|
"delete": false
|
|
6218
6218
|
}
|
|
6219
6219
|
},
|
|
6220
|
+
{
|
|
6221
|
+
"resource": "task_predecessors",
|
|
6222
|
+
"apiEntity": "TaskPredecessor",
|
|
6223
|
+
"parentField": "successorTaskID",
|
|
6224
|
+
"parentSegment": "Predecessors",
|
|
6225
|
+
"tier": "extended",
|
|
6226
|
+
"workflowResource": false,
|
|
6227
|
+
"specialOps": [],
|
|
6228
|
+
"searchCovers": null,
|
|
6229
|
+
"scopedOps": {
|
|
6230
|
+
"create": true,
|
|
6231
|
+
"query": true,
|
|
6232
|
+
"update": true,
|
|
6233
|
+
"delete": true
|
|
6234
|
+
}
|
|
6235
|
+
},
|
|
6220
6236
|
{
|
|
6221
6237
|
"resource": "task_secondary_resources",
|
|
6222
6238
|
"apiEntity": "TaskSecondaryResource",
|
|
@@ -7132,6 +7148,25 @@ var RELATIONSHIP_MAP = {
|
|
|
7132
7148
|
"update": false,
|
|
7133
7149
|
"delete": false
|
|
7134
7150
|
}
|
|
7151
|
+
},
|
|
7152
|
+
{
|
|
7153
|
+
"resource": "time_off_requests",
|
|
7154
|
+
"apiEntity": "TimeOffRequest",
|
|
7155
|
+
"parentField": "resourceID",
|
|
7156
|
+
"parentSegment": "TimeOffRequests",
|
|
7157
|
+
"tier": "extended",
|
|
7158
|
+
"workflowResource": false,
|
|
7159
|
+
"specialOps": [
|
|
7160
|
+
"approve",
|
|
7161
|
+
"reject"
|
|
7162
|
+
],
|
|
7163
|
+
"searchCovers": null,
|
|
7164
|
+
"scopedOps": {
|
|
7165
|
+
"create": true,
|
|
7166
|
+
"query": true,
|
|
7167
|
+
"update": true,
|
|
7168
|
+
"delete": false
|
|
7169
|
+
}
|
|
7135
7170
|
}
|
|
7136
7171
|
],
|
|
7137
7172
|
"naturalKeys": {
|
|
@@ -9197,11 +9232,15 @@ var RELATIONSHIP_MAP = {
|
|
|
9197
9232
|
"apiEntity": "TimeOffRequest",
|
|
9198
9233
|
"kind": "entity",
|
|
9199
9234
|
"path": "TimeOffRequests",
|
|
9200
|
-
"parentScoped":
|
|
9235
|
+
"parentScoped": true,
|
|
9201
9236
|
"tier": "extended",
|
|
9202
9237
|
"workflowResource": false,
|
|
9203
9238
|
"group": "B",
|
|
9204
|
-
"parent":
|
|
9239
|
+
"parent": {
|
|
9240
|
+
"resource": "resources",
|
|
9241
|
+
"segment": "TimeOffRequests",
|
|
9242
|
+
"field": "resourceID"
|
|
9243
|
+
},
|
|
9205
9244
|
"children": [],
|
|
9206
9245
|
"naturalKeys": {
|
|
9207
9246
|
"hasSearch": false,
|
|
@@ -9209,8 +9248,31 @@ var RELATIONSHIP_MAP = {
|
|
|
9209
9248
|
"findBy": []
|
|
9210
9249
|
},
|
|
9211
9250
|
"blindSurfaces": null,
|
|
9212
|
-
"zoneFacts":
|
|
9213
|
-
|
|
9251
|
+
"zoneFacts": {
|
|
9252
|
+
"createGuidance": {
|
|
9253
|
+
"createOp": "time_off_requests.create",
|
|
9254
|
+
"parentScoped": true,
|
|
9255
|
+
"liveProvenPrefix": [],
|
|
9256
|
+
"unproven": true,
|
|
9257
|
+
"blocker": {
|
|
9258
|
+
"kind": "unknown",
|
|
9259
|
+
"message": "Submission is documented but has not been verified; the status must resolve uniquely to Submitted in exposed field metadata. Permissions and request fields remain subject to vendor validation.",
|
|
9260
|
+
"remedy": "Read time_off_requests.getFieldInfo to select Submitted, then preview with a known resource and valid leave request fields."
|
|
9261
|
+
},
|
|
9262
|
+
"vendorEvidence": [
|
|
9263
|
+
"Specification: POST /V1.0/Resources/{parentId}/TimeOffRequests returns OperationResultModel.",
|
|
9264
|
+
"Official TimeOffRequests entity documentation: create accepts Submitted only; https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TimeOffRequestsEntity.htm. No live validation performed."
|
|
9265
|
+
],
|
|
9266
|
+
"deleteBoundary": {
|
|
9267
|
+
"available": false,
|
|
9268
|
+
"note": "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."
|
|
9269
|
+
}
|
|
9270
|
+
}
|
|
9271
|
+
},
|
|
9272
|
+
"deleteBoundary": {
|
|
9273
|
+
"note": "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.",
|
|
9274
|
+
"proof": "spec-derived"
|
|
9275
|
+
},
|
|
9214
9276
|
"markerField": null
|
|
9215
9277
|
},
|
|
9216
9278
|
"inventory_products": {
|
|
@@ -9729,6 +9791,50 @@ var RELATIONSHIP_MAP = {
|
|
|
9729
9791
|
"proof": "spec-derived"
|
|
9730
9792
|
},
|
|
9731
9793
|
"markerField": "title"
|
|
9794
|
+
},
|
|
9795
|
+
"task_predecessors": {
|
|
9796
|
+
"resource": "task_predecessors",
|
|
9797
|
+
"apiEntity": "TaskPredecessor",
|
|
9798
|
+
"kind": "entity",
|
|
9799
|
+
"path": "TaskPredecessors",
|
|
9800
|
+
"parentScoped": true,
|
|
9801
|
+
"tier": "extended",
|
|
9802
|
+
"workflowResource": false,
|
|
9803
|
+
"group": "A",
|
|
9804
|
+
"parent": {
|
|
9805
|
+
"resource": "tasks",
|
|
9806
|
+
"segment": "Predecessors",
|
|
9807
|
+
"field": "successorTaskID"
|
|
9808
|
+
},
|
|
9809
|
+
"children": [],
|
|
9810
|
+
"naturalKeys": {
|
|
9811
|
+
"hasSearch": false,
|
|
9812
|
+
"searchCovers": null,
|
|
9813
|
+
"findBy": []
|
|
9814
|
+
},
|
|
9815
|
+
"blindSurfaces": null,
|
|
9816
|
+
"zoneFacts": {
|
|
9817
|
+
"createGuidance": {
|
|
9818
|
+
"createOp": "task_predecessors.create",
|
|
9819
|
+
"parentScoped": true,
|
|
9820
|
+
"liveProvenPrefix": [],
|
|
9821
|
+
"unproven": true,
|
|
9822
|
+
"blocker": {
|
|
9823
|
+
"kind": "unknown",
|
|
9824
|
+
"message": "TaskPredecessors mutations are not verified; module, task permissions and project state can restrict them.",
|
|
9825
|
+
"remedy": "Use preview and verify both task references; baseline relationships are read-only and predecessor phases are unsupported."
|
|
9826
|
+
},
|
|
9827
|
+
"vendorEvidence": [
|
|
9828
|
+
"https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskPredecessorsEntity.htm"
|
|
9829
|
+
],
|
|
9830
|
+
"deleteBoundary": {
|
|
9831
|
+
"available": true,
|
|
9832
|
+
"note": null
|
|
9833
|
+
}
|
|
9834
|
+
}
|
|
9835
|
+
},
|
|
9836
|
+
"deleteBoundary": null,
|
|
9837
|
+
"markerField": null
|
|
9732
9838
|
}
|
|
9733
9839
|
};
|
|
9734
9840
|
var BLIND_SURFACE_STAMPS = {
|
|
@@ -9839,7 +9945,8 @@ var DELETE_BOUNDARY_NOTES = {
|
|
|
9839
9945
|
"tickets": "the vendor defines no DELETE for tickets (spec-derived: the vendored api-docs.json defines no DELETE on the entity's paths) \u2014 a create cannot be undone through the API; cleanup is UI-only.",
|
|
9840
9946
|
"user_defined_field_definitions": "the vendor defines no DELETE for user_defined_field_definitions (spec-derived: the vendored api-docs.json defines no DELETE on the entity's paths) \u2014 a UDF definition cannot be deleted through the API; deactivation is via isActive (vendor soft-removal); hard cleanup is UI-only.",
|
|
9841
9947
|
"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.",
|
|
9842
|
-
"task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API."
|
|
9948
|
+
"task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API.",
|
|
9949
|
+
"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."
|
|
9843
9950
|
};
|
|
9844
9951
|
var RESPONSE_DRIFT_MARKERS = {
|
|
9845
9952
|
"ticket_checklist_libraries": {
|
|
@@ -13304,6 +13411,25 @@ var CREATE_GUIDANCE = {
|
|
|
13304
13411
|
"note": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API."
|
|
13305
13412
|
}
|
|
13306
13413
|
},
|
|
13414
|
+
{
|
|
13415
|
+
"resource": "task_predecessors",
|
|
13416
|
+
"createOp": "task_predecessors.create",
|
|
13417
|
+
"parentScoped": true,
|
|
13418
|
+
"liveProvenPrefix": [],
|
|
13419
|
+
"unproven": true,
|
|
13420
|
+
"blocker": {
|
|
13421
|
+
"kind": "unknown",
|
|
13422
|
+
"message": "TaskPredecessors mutations are not verified; module, task permissions and project state can restrict them.",
|
|
13423
|
+
"remedy": "Use preview and verify both task references; baseline relationships are read-only and predecessor phases are unsupported."
|
|
13424
|
+
},
|
|
13425
|
+
"vendorEvidence": [
|
|
13426
|
+
"https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TaskPredecessorsEntity.htm"
|
|
13427
|
+
],
|
|
13428
|
+
"deleteBoundary": {
|
|
13429
|
+
"available": true,
|
|
13430
|
+
"note": null
|
|
13431
|
+
}
|
|
13432
|
+
},
|
|
13307
13433
|
{
|
|
13308
13434
|
"resource": "task_secondary_resources",
|
|
13309
13435
|
"createOp": "task_secondary_resources.create",
|
|
@@ -13790,6 +13916,26 @@ var CREATE_GUIDANCE = {
|
|
|
13790
13916
|
"note": null
|
|
13791
13917
|
}
|
|
13792
13918
|
},
|
|
13919
|
+
{
|
|
13920
|
+
"resource": "time_off_requests",
|
|
13921
|
+
"createOp": "time_off_requests.create",
|
|
13922
|
+
"parentScoped": true,
|
|
13923
|
+
"liveProvenPrefix": [],
|
|
13924
|
+
"unproven": true,
|
|
13925
|
+
"blocker": {
|
|
13926
|
+
"kind": "unknown",
|
|
13927
|
+
"message": "Submission is documented but has not been verified; the status must resolve uniquely to Submitted in exposed field metadata. Permissions and request fields remain subject to vendor validation.",
|
|
13928
|
+
"remedy": "Read time_off_requests.getFieldInfo to select Submitted, then preview with a known resource and valid leave request fields."
|
|
13929
|
+
},
|
|
13930
|
+
"vendorEvidence": [
|
|
13931
|
+
"Specification: POST /V1.0/Resources/{parentId}/TimeOffRequests returns OperationResultModel.",
|
|
13932
|
+
"Official TimeOffRequests entity documentation: create accepts Submitted only; https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TimeOffRequestsEntity.htm. No live validation performed."
|
|
13933
|
+
],
|
|
13934
|
+
"deleteBoundary": {
|
|
13935
|
+
"available": false,
|
|
13936
|
+
"note": "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."
|
|
13937
|
+
}
|
|
13938
|
+
},
|
|
13793
13939
|
{
|
|
13794
13940
|
"resource": "user_defined_field_definitions",
|
|
13795
13941
|
"createOp": "user_defined_field_definitions.create",
|
|
@@ -13839,7 +13985,7 @@ var CREATE_GUIDANCE = {
|
|
|
13839
13985
|
}
|
|
13840
13986
|
],
|
|
13841
13987
|
"counts": {
|
|
13842
|
-
"total":
|
|
13988
|
+
"total": 104,
|
|
13843
13989
|
"byKind": {
|
|
13844
13990
|
"ok": 41,
|
|
13845
13991
|
"blind-reference": 16,
|
|
@@ -13849,7 +13995,7 @@ var CREATE_GUIDANCE = {
|
|
|
13849
13995
|
"resource-role-pair": 2,
|
|
13850
13996
|
"delete-absent": 0,
|
|
13851
13997
|
"non-mutable": 0,
|
|
13852
|
-
"unknown":
|
|
13998
|
+
"unknown": 28
|
|
13853
13999
|
}
|
|
13854
14000
|
}
|
|
13855
14001
|
};
|
|
@@ -16381,13 +16527,13 @@ async function runBounded(fn, items, opts) {
|
|
|
16381
16527
|
const results = new Array(items.length);
|
|
16382
16528
|
let next = 0;
|
|
16383
16529
|
let failure;
|
|
16384
|
-
const
|
|
16530
|
+
const fail2 = (error, index) => {
|
|
16385
16531
|
if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
|
|
16386
16532
|
};
|
|
16387
16533
|
const worker = async () => {
|
|
16388
16534
|
while (failure === void 0 && next < items.length) {
|
|
16389
16535
|
if (signal?.aborted) {
|
|
16390
|
-
|
|
16536
|
+
fail2(signal.reason, -1);
|
|
16391
16537
|
return;
|
|
16392
16538
|
}
|
|
16393
16539
|
const i = next++;
|
|
@@ -16397,7 +16543,7 @@ async function runBounded(fn, items, opts) {
|
|
|
16397
16543
|
results[i] = settle ? { status: "fulfilled", value } : value;
|
|
16398
16544
|
} catch (error) {
|
|
16399
16545
|
if (settle) results[i] = { status: "rejected", reason: error };
|
|
16400
|
-
else
|
|
16546
|
+
else fail2(error, i);
|
|
16401
16547
|
}
|
|
16402
16548
|
}
|
|
16403
16549
|
};
|
|
@@ -16453,7 +16599,7 @@ async function capabilitySets() {
|
|
|
16453
16599
|
const fieldOps = /* @__PURE__ */ new Map();
|
|
16454
16600
|
const udfCapable = /* @__PURE__ */ new Set();
|
|
16455
16601
|
const resources = /* @__PURE__ */ new Set();
|
|
16456
|
-
for (const rec of await
|
|
16602
|
+
for (const rec of await chunkASL3BIW2_cjs.loadCapabilityRecords()) {
|
|
16457
16603
|
if (rec.resource === "operations") continue;
|
|
16458
16604
|
resources.add(rec.resource);
|
|
16459
16605
|
if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
|
|
@@ -16464,7 +16610,7 @@ async function capabilitySets() {
|
|
|
16464
16610
|
var derivedIndexPromise = null;
|
|
16465
16611
|
function derivedIndexLoad() {
|
|
16466
16612
|
if (derivedIndexPromise === null) {
|
|
16467
|
-
derivedIndexPromise =
|
|
16613
|
+
derivedIndexPromise = chunkASL3BIW2_cjs.loadCapabilityRecords().then((records) => {
|
|
16468
16614
|
const index = /* @__PURE__ */ new Map();
|
|
16469
16615
|
for (const rec of records) {
|
|
16470
16616
|
const declared = rec.metadata?.derivedFields;
|
|
@@ -17674,6 +17820,7 @@ var MODEL_FIELD_SETS = {
|
|
|
17674
17820
|
"tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
|
|
17675
17821
|
"tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
|
|
17676
17822
|
"task_notes": ["id", "createDateTime", "creatorResourceID", "createdByContactID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "taskID", "title", "soapParentPropertyId"],
|
|
17823
|
+
"task_predecessors": ["id", "lagDays", "predecessorTaskID", "successorTaskID", "soapParentPropertyId"],
|
|
17677
17824
|
"task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
|
|
17678
17825
|
"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"],
|
|
17679
17826
|
"tax_regions": ["id", "isActive", "name"],
|
|
@@ -17842,21 +17989,21 @@ function validateRelationLeaves(resourceKey, conditions, op) {
|
|
|
17842
17989
|
assertUndottedUdfField(c, op);
|
|
17843
17990
|
const field = c.field;
|
|
17844
17991
|
const [rel, sub, ...rest] = field.split(".");
|
|
17845
|
-
const
|
|
17992
|
+
const fail2 = (why) => {
|
|
17846
17993
|
throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
|
|
17847
17994
|
operation: op,
|
|
17848
17995
|
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.`
|
|
17849
17996
|
});
|
|
17850
17997
|
};
|
|
17851
17998
|
if (selfPrefixes(resourceKey).includes(rel)) {
|
|
17852
|
-
if (rest.length > 0 || !sub)
|
|
17999
|
+
if (rest.length > 0 || !sub) fail2("is not <resource>.<field> (multi-hop relations are not supported)");
|
|
17853
18000
|
continue;
|
|
17854
18001
|
}
|
|
17855
|
-
if (rest.length > 0 || !sub)
|
|
17856
|
-
if (!valid.includes(rel))
|
|
18002
|
+
if (rest.length > 0 || !sub) fail2("is not <relation>.<field> (multi-hop relations are not supported)");
|
|
18003
|
+
if (!valid.includes(rel)) fail2(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
|
|
17857
18004
|
const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
|
|
17858
18005
|
if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
|
|
17859
|
-
|
|
18006
|
+
fail2(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
|
|
17860
18007
|
}
|
|
17861
18008
|
}
|
|
17862
18009
|
};
|
|
@@ -18702,9 +18849,9 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18702
18849
|
}
|
|
18703
18850
|
/** `GET /V1.0/<E>/{id}` → `{ item }` unwrapped (`item: null` → NotFoundError). */
|
|
18704
18851
|
async getGlobal(id, fresh = false) {
|
|
18705
|
-
const
|
|
18706
|
-
const res = await this.cachedGet(`${this.resourcePath}/${
|
|
18707
|
-
return unwrapItem(res,
|
|
18852
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18853
|
+
const res = await this.cachedGet(`${this.resourcePath}/${numeric2}`, `${this.config.key}.get`, fresh);
|
|
18854
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18708
18855
|
}
|
|
18709
18856
|
/**
|
|
18710
18857
|
* V2 merge read: a FRESH single-record GET that skips response redaction
|
|
@@ -18718,15 +18865,15 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18718
18865
|
* (redacted-view) read cache.
|
|
18719
18866
|
*/
|
|
18720
18867
|
async getGlobalUnredacted(id, readOpts) {
|
|
18721
|
-
const
|
|
18868
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18722
18869
|
const res = await this.http.request({
|
|
18723
18870
|
method: "GET",
|
|
18724
|
-
path: `${this.resourcePath}/${
|
|
18871
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
18725
18872
|
operation: `${this.config.key}.get`,
|
|
18726
18873
|
skipResponseRedaction: true,
|
|
18727
18874
|
maxRetries: readOpts?.maxRetries
|
|
18728
18875
|
});
|
|
18729
|
-
return unwrapItem(res,
|
|
18876
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18730
18877
|
}
|
|
18731
18878
|
/**
|
|
18732
18879
|
* Issue #34 fallback merge read: a FRESH parent-scoped single-record GET
|
|
@@ -18737,21 +18884,21 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18737
18884
|
* '[REDACTED]' markers into the fallback PUT (corruption on live records).
|
|
18738
18885
|
*/
|
|
18739
18886
|
async getScopedUnredacted(parentId, id, readOpts) {
|
|
18740
|
-
const
|
|
18887
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18741
18888
|
const res = await this.http.request({
|
|
18742
18889
|
method: "GET",
|
|
18743
|
-
path: this.scopedItemPath(parentId,
|
|
18890
|
+
path: this.scopedItemPath(parentId, numeric2),
|
|
18744
18891
|
operation: `${this.config.key}.get`,
|
|
18745
18892
|
skipResponseRedaction: true,
|
|
18746
18893
|
maxRetries: readOpts?.maxRetries
|
|
18747
18894
|
});
|
|
18748
|
-
return unwrapItem(res,
|
|
18895
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18749
18896
|
}
|
|
18750
18897
|
/** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */
|
|
18751
18898
|
async getScopedRaw(parentId, id, fresh = false) {
|
|
18752
|
-
const
|
|
18899
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18753
18900
|
const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
|
|
18754
|
-
return unwrapItem(res,
|
|
18901
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18755
18902
|
}
|
|
18756
18903
|
/**
|
|
18757
18904
|
* Attachment single-read: the vendor answers the model DIRECTLY (swagger),
|
|
@@ -18759,9 +18906,9 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18759
18906
|
* accept all three shapes; empty/null → NotFoundError.
|
|
18760
18907
|
*/
|
|
18761
18908
|
async getScopedModel(parentId, id, fresh = false) {
|
|
18762
|
-
const
|
|
18909
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18763
18910
|
const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
|
|
18764
|
-
return this.unwrapModelLike(res,
|
|
18911
|
+
return this.unwrapModelLike(res, numeric2, this.entityName);
|
|
18765
18912
|
}
|
|
18766
18913
|
/** @internal */
|
|
18767
18914
|
unwrapModelLike(body, id, entity) {
|
|
@@ -18902,12 +19049,12 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18902
19049
|
* the composite ROOT of a hot resource (issue #36) must see the live
|
|
18903
19050
|
* record, never a snapshot. */
|
|
18904
19051
|
async fetchRecordRaw(entityPath, id, fresh = false) {
|
|
18905
|
-
const
|
|
18906
|
-
const res = await this.cachedGet(`${entityPath}/${
|
|
19052
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19053
|
+
const res = await this.cachedGet(`${entityPath}/${numeric2}`, `${this.config.key}.fetchRecord`, fresh);
|
|
18907
19054
|
if (this.config.attachmentGet) {
|
|
18908
|
-
return this.unwrapModelLike(res,
|
|
19055
|
+
return this.unwrapModelLike(res, numeric2, entityNameFromPath(entityPath));
|
|
18909
19056
|
}
|
|
18910
|
-
return unwrapItem(res,
|
|
19057
|
+
return unwrapItem(res, numeric2, `${this.config.key}.fetchRecord`, entityNameFromPath(entityPath));
|
|
18911
19058
|
}
|
|
18912
19059
|
/**
|
|
18913
19060
|
* `getContext` part fetch: a single-record read that degrades to `null`
|
|
@@ -18983,12 +19130,12 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18983
19130
|
* - bare value on an id-only resource → AutotaskConfigError (CONFIG_ERROR).
|
|
18984
19131
|
*/
|
|
18985
19132
|
async resolveDetailed(identifier) {
|
|
18986
|
-
let
|
|
19133
|
+
let numeric2 = null;
|
|
18987
19134
|
if (isIdentifierCandidate(identifier)) {
|
|
18988
|
-
|
|
19135
|
+
numeric2 = parseIdentifier(identifier, "id");
|
|
18989
19136
|
}
|
|
18990
|
-
if (
|
|
18991
|
-
const record = await this.fetchRecordRaw(this.resourcePath,
|
|
19137
|
+
if (numeric2 !== null) {
|
|
19138
|
+
const record = await this.fetchRecordRaw(this.resourcePath, numeric2);
|
|
18992
19139
|
return { value: record, resolutionCost: "direct", scanned: 0, scanTruncated: false };
|
|
18993
19140
|
}
|
|
18994
19141
|
if (typeof identifier !== "string" || identifier.trim() === "") {
|
|
@@ -19416,7 +19563,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19416
19563
|
}
|
|
19417
19564
|
}
|
|
19418
19565
|
async updateGlobal(id, data, opts = {}, method = "PUT") {
|
|
19419
|
-
const
|
|
19566
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19420
19567
|
const operation = `${this.config.key}.update`;
|
|
19421
19568
|
let body = this.normalizeMutationBody(data);
|
|
19422
19569
|
const collectionUpdate = this.config.collectionUpdate === true;
|
|
@@ -19424,7 +19571,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19424
19571
|
if (opts.raw !== true) {
|
|
19425
19572
|
let current;
|
|
19426
19573
|
try {
|
|
19427
|
-
current = await this.getGlobalUnredacted(
|
|
19574
|
+
current = await this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries });
|
|
19428
19575
|
} catch (err) {
|
|
19429
19576
|
if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);
|
|
19430
19577
|
throw err;
|
|
@@ -19432,16 +19579,16 @@ var MutationBase = class extends MetaBase {
|
|
|
19432
19579
|
this.staleObjectCheck(current, opts, operation);
|
|
19433
19580
|
body = mergePartialBody(current, body);
|
|
19434
19581
|
} else {
|
|
19435
|
-
await this.guardStaleBeforeMutation(
|
|
19582
|
+
await this.guardStaleBeforeMutation(numeric2, opts, operation);
|
|
19436
19583
|
}
|
|
19437
|
-
body.id =
|
|
19584
|
+
body.id = numeric2;
|
|
19438
19585
|
}
|
|
19439
|
-
const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${
|
|
19586
|
+
const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`}`;
|
|
19440
19587
|
let res;
|
|
19441
19588
|
try {
|
|
19442
19589
|
res = await this.http.request({
|
|
19443
19590
|
method,
|
|
19444
|
-
path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${
|
|
19591
|
+
path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`,
|
|
19445
19592
|
body,
|
|
19446
19593
|
operation,
|
|
19447
19594
|
maxRetries: opts.maxRetries
|
|
@@ -19452,15 +19599,15 @@ var MutationBase = class extends MetaBase {
|
|
|
19452
19599
|
throw this.putFallbackDeclined(err, route, false);
|
|
19453
19600
|
}
|
|
19454
19601
|
const merged = await this.putFallbackMergedBody(
|
|
19455
|
-
() => this.getGlobalUnredacted(
|
|
19602
|
+
() => this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries }),
|
|
19456
19603
|
body,
|
|
19457
|
-
|
|
19604
|
+
numeric2
|
|
19458
19605
|
);
|
|
19459
19606
|
let retry;
|
|
19460
19607
|
try {
|
|
19461
19608
|
retry = await this.http.request({
|
|
19462
19609
|
method: "PUT",
|
|
19463
|
-
path: `${this.resourcePath}/${
|
|
19610
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
19464
19611
|
body: merged,
|
|
19465
19612
|
operation,
|
|
19466
19613
|
maxRetries: opts.maxRetries
|
|
@@ -19469,23 +19616,23 @@ var MutationBase = class extends MetaBase {
|
|
|
19469
19616
|
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, route, true);
|
|
19470
19617
|
throw rerr;
|
|
19471
19618
|
}
|
|
19472
|
-
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts,
|
|
19619
|
+
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2);
|
|
19473
19620
|
}
|
|
19474
|
-
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts,
|
|
19621
|
+
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2);
|
|
19475
19622
|
}
|
|
19476
19623
|
/** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
|
|
19477
19624
|
* (204 / empty body) is a valid vendor delete answer — synthesize the
|
|
19478
19625
|
* result from the path id (issue #25: the transport returns undefined
|
|
19479
19626
|
* for it; a non-blank wrong shape still throws via unwrapOperation). */
|
|
19480
19627
|
async deleteGlobal(id, opts = {}) {
|
|
19481
|
-
const
|
|
19628
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19482
19629
|
const res = await this.http.request({
|
|
19483
19630
|
method: "DELETE",
|
|
19484
|
-
path: `${this.resourcePath}/${
|
|
19631
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
19485
19632
|
operation: `${this.config.key}.delete`,
|
|
19486
19633
|
maxRetries: opts.maxRetries
|
|
19487
19634
|
});
|
|
19488
|
-
return res === void 0 ? { id:
|
|
19635
|
+
return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
|
|
19489
19636
|
}
|
|
19490
19637
|
/** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
|
|
19491
19638
|
async createScopedRaw(parentId, data, opts = {}) {
|
|
@@ -19504,9 +19651,9 @@ var MutationBase = class extends MetaBase {
|
|
|
19504
19651
|
* the item path anywhere in the spec; the node strips the id from the path and
|
|
19505
19652
|
* PATCHes the collection, and the vendor keys the record by the id in the body. */
|
|
19506
19653
|
async updateScopedRaw(parentId, id, data, opts = {}) {
|
|
19507
|
-
const
|
|
19654
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19508
19655
|
const body = this.normalizeMutationBody(data);
|
|
19509
|
-
body.id =
|
|
19656
|
+
body.id = numeric2;
|
|
19510
19657
|
const path = this.scopedCollectionPath(parentId);
|
|
19511
19658
|
const operation = `${this.config.key}.update`;
|
|
19512
19659
|
let res;
|
|
@@ -19521,45 +19668,45 @@ var MutationBase = class extends MetaBase {
|
|
|
19521
19668
|
} catch (err) {
|
|
19522
19669
|
if (!this.putFallbackEligible(err)) throw err;
|
|
19523
19670
|
const merged = await this.putFallbackMergedBody(
|
|
19524
|
-
() => this.getScopedUnredacted(parentId,
|
|
19671
|
+
() => this.getScopedUnredacted(parentId, numeric2, { maxRetries: opts.maxRetries }),
|
|
19525
19672
|
body,
|
|
19526
|
-
|
|
19673
|
+
numeric2
|
|
19527
19674
|
);
|
|
19528
19675
|
let retry;
|
|
19529
19676
|
try {
|
|
19530
19677
|
retry = await this.http.request({
|
|
19531
19678
|
method: "PUT",
|
|
19532
|
-
path: `${path}/${
|
|
19679
|
+
path: `${path}/${numeric2}`,
|
|
19533
19680
|
body: merged,
|
|
19534
19681
|
operation,
|
|
19535
19682
|
maxRetries: opts.maxRetries
|
|
19536
19683
|
});
|
|
19537
19684
|
} catch (rerr) {
|
|
19538
|
-
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${
|
|
19685
|
+
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric2}`, true);
|
|
19539
19686
|
throw rerr;
|
|
19540
19687
|
}
|
|
19541
|
-
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts,
|
|
19688
|
+
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2, parentId);
|
|
19542
19689
|
}
|
|
19543
|
-
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts,
|
|
19690
|
+
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2, parentId);
|
|
19544
19691
|
}
|
|
19545
19692
|
/** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
|
|
19546
19693
|
* (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
|
|
19547
19694
|
async deleteScopedRaw(parentId, id, opts = {}) {
|
|
19548
|
-
const
|
|
19695
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19549
19696
|
const res = await this.http.request({
|
|
19550
19697
|
method: "DELETE",
|
|
19551
19698
|
path: this.scopedItemPath(parentId, id),
|
|
19552
19699
|
operation: `${this.config.key}.delete`,
|
|
19553
19700
|
maxRetries: opts.maxRetries
|
|
19554
19701
|
});
|
|
19555
|
-
return res === void 0 ? { id:
|
|
19702
|
+
return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
|
|
19556
19703
|
}
|
|
19557
19704
|
/**
|
|
19558
19705
|
* Attachment delete: the vendor returns the deleted attachment MODEL, not
|
|
19559
19706
|
* OperationResultModel (G1 envelope.md) — pass it through typed.
|
|
19560
19707
|
*/
|
|
19561
19708
|
async deleteScopedModel(parentId, id, opts = {}) {
|
|
19562
|
-
const
|
|
19709
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19563
19710
|
const res = await this.http.request({
|
|
19564
19711
|
method: "DELETE",
|
|
19565
19712
|
path: this.scopedItemPath(parentId, id),
|
|
@@ -19569,8 +19716,8 @@ var MutationBase = class extends MetaBase {
|
|
|
19569
19716
|
if (res === void 0) return {};
|
|
19570
19717
|
if (!isRecord2(res)) {
|
|
19571
19718
|
throw new AutotaskError(
|
|
19572
|
-
`Expected the deleted attachment model for ID ${
|
|
19573
|
-
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [
|
|
19719
|
+
`Expected the deleted attachment model for ID ${numeric2}; got a different shape`,
|
|
19720
|
+
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [numeric2], details: { idRefs: [{ entity: this.entityName, id: numeric2 }] } }
|
|
19574
19721
|
);
|
|
19575
19722
|
}
|
|
19576
19723
|
return res;
|
|
@@ -19631,6 +19778,9 @@ var MutationBase = class extends MetaBase {
|
|
|
19631
19778
|
checks.push({ name: "duplicate-detection", ok: existingId === void 0 });
|
|
19632
19779
|
}
|
|
19633
19780
|
const warnings = existingId !== void 0 ? [`duplicate match on ${dedupFields.join(", ")} (id ${existingId}); the create would be skipped`] : [];
|
|
19781
|
+
const wouldCreate = existingId === void 0 && checks.every((check) => check.ok);
|
|
19782
|
+
const deleteBoundaryNote = wouldCreate ? DELETE_BOUNDARY_NOTES[this.config.key] : void 0;
|
|
19783
|
+
if (deleteBoundaryNote !== void 0) warnings.push(deleteBoundaryNote);
|
|
19634
19784
|
return buildDryRunResult({
|
|
19635
19785
|
operation: `${this.config.key}.createIfNotExists`,
|
|
19636
19786
|
method: "POST",
|
|
@@ -19638,7 +19788,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19638
19788
|
ids: existingId !== void 0 ? [existingId] : [],
|
|
19639
19789
|
checks,
|
|
19640
19790
|
warnings,
|
|
19641
|
-
impact: { affected: 1, scope: "single-record", reversible:
|
|
19791
|
+
impact: { affected: 1, scope: "single-record", reversible: !wouldCreate || this.config.deletable !== false && DELETE_BOUNDARY_NOTES[this.config.key] === void 0 },
|
|
19642
19792
|
data
|
|
19643
19793
|
}, { redactPersonalData: this.http.redactPersonalData });
|
|
19644
19794
|
}
|
|
@@ -19750,7 +19900,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19750
19900
|
path,
|
|
19751
19901
|
ids: [],
|
|
19752
19902
|
checks,
|
|
19753
|
-
impact: { affected: 1, scope: "single-record", reversible:
|
|
19903
|
+
impact: { affected: 1, scope: "single-record", reversible: !checks.every((check) => check.ok) || this.config.deletable !== false && deleteBoundaryNote === void 0 },
|
|
19754
19904
|
warnings,
|
|
19755
19905
|
data
|
|
19756
19906
|
}, { redactPersonalData: this.http.redactPersonalData });
|
|
@@ -19875,34 +20025,87 @@ var BaseResource = class extends MutationBase {
|
|
|
19875
20025
|
}
|
|
19876
20026
|
};
|
|
19877
20027
|
|
|
20028
|
+
// src/resources/special/taskPredecessors.ts
|
|
20029
|
+
function fail(detail) {
|
|
20030
|
+
throw new AutotaskConfigError(`task_predecessors: ${detail}`);
|
|
20031
|
+
}
|
|
20032
|
+
function numeric(value, field) {
|
|
20033
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail(`${field} must be a positive numeric identifier`);
|
|
20034
|
+
return value;
|
|
20035
|
+
}
|
|
20036
|
+
function predecessorParent(value) {
|
|
20037
|
+
const parent = parseIdentifier(value, "parentId");
|
|
20038
|
+
if (parent === 0) fail("parentId must name a successor task");
|
|
20039
|
+
return parent;
|
|
20040
|
+
}
|
|
20041
|
+
function assertPredecessorBinding(value, parentId, id) {
|
|
20042
|
+
if (!isRecord2(value)) fail("the returned record must establish id and successorTaskID parent");
|
|
20043
|
+
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");
|
|
20044
|
+
}
|
|
20045
|
+
function admitTaskPredecessor(data, parentId, creating) {
|
|
20046
|
+
const parent = predecessorParent(parentId);
|
|
20047
|
+
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail("data must be a plain record");
|
|
20048
|
+
const payload = { ...data };
|
|
20049
|
+
const allowed = creating ? ["predecessorTaskID", "successorTaskID", "lagDays"] : ["lagDays"];
|
|
20050
|
+
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");
|
|
20051
|
+
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");
|
|
20052
|
+
if (creating) {
|
|
20053
|
+
const successor = numeric(payload.successorTaskID, "successorTaskID");
|
|
20054
|
+
const predecessor = numeric(payload.predecessorTaskID, "predecessorTaskID");
|
|
20055
|
+
if (String(successor) !== String(parent)) fail("successorTaskID must match parentId");
|
|
20056
|
+
if (predecessor === successor) fail("predecessorTaskID and successorTaskID must be distinct");
|
|
20057
|
+
}
|
|
20058
|
+
return payload;
|
|
20059
|
+
}
|
|
20060
|
+
async function guardTaskPredecessor(http, parentId, id, data) {
|
|
20061
|
+
const parent = predecessorParent(parentId);
|
|
20062
|
+
let row = data;
|
|
20063
|
+
if (id !== void 0) {
|
|
20064
|
+
const target = parseIdentifier(id, "id");
|
|
20065
|
+
if (target === 0) fail("id must name a predecessor relationship");
|
|
20066
|
+
row = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${parent}/Predecessors/${target}`, operation: "task_predecessors.get" }), target, "task_predecessors.get", "task_predecessor");
|
|
20067
|
+
assertPredecessorBinding(row, parent, target);
|
|
20068
|
+
}
|
|
20069
|
+
const predecessor = numeric(row?.predecessorTaskID, "predecessorTaskID");
|
|
20070
|
+
const successor = numeric(row?.successorTaskID, "successorTaskID");
|
|
20071
|
+
if (predecessor === successor) fail("predecessorTaskID and successorTaskID must be distinct");
|
|
20072
|
+
const projects = [];
|
|
20073
|
+
for (const taskId of [predecessor, successor]) {
|
|
20074
|
+
const task = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${taskId}`, operation: "tasks.get" }), taskId, "tasks.get", "task");
|
|
20075
|
+
if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail("the returned task must match its requested id");
|
|
20076
|
+
projects.push(numeric(task.projectID, "task.projectID"));
|
|
20077
|
+
}
|
|
20078
|
+
if (projects[0] !== projects[1]) fail("predecessor and successor tasks must belong to the same project");
|
|
20079
|
+
}
|
|
20080
|
+
|
|
19878
20081
|
// src/resources/special/taskNotes.ts
|
|
19879
20082
|
var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
|
|
19880
20083
|
function admitTaskNote(data, parentId, creating) {
|
|
19881
20084
|
const parent = parseIdentifier(parentId, "parentId");
|
|
19882
|
-
const
|
|
20085
|
+
const fail2 = (message) => {
|
|
19883
20086
|
throw new AutotaskConfigError(`task_notes: ${message}`);
|
|
19884
20087
|
};
|
|
19885
|
-
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
20088
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) fail2("data must be a record");
|
|
19886
20089
|
const body = data;
|
|
19887
|
-
for (const key of Object.keys(body)) if (!WRITABLE.has(key))
|
|
20090
|
+
for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail2(`${key} is not a writable TaskNotes field`);
|
|
19888
20091
|
for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
|
|
19889
20092
|
const value = body[field];
|
|
19890
|
-
if (value !== void 0 && (typeof value !== "string" || value.length > maximum))
|
|
20093
|
+
if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail2(`${field} must be a string of at most ${maximum} characters`);
|
|
19891
20094
|
}
|
|
19892
|
-
if (creating && (typeof body.description !== "string" || body.description.trim() === ""))
|
|
20095
|
+
if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail2("description is required");
|
|
19893
20096
|
for (const field of ["noteType", "publish"]) {
|
|
19894
20097
|
const value = body[field];
|
|
19895
|
-
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value)))
|
|
20098
|
+
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail2(`${field} must be an integer from the current field metadata`);
|
|
19896
20099
|
}
|
|
19897
|
-
if (creating && body.taskID === void 0)
|
|
20100
|
+
if (creating && body.taskID === void 0) fail2("taskID is required in the create body and must match parentId");
|
|
19898
20101
|
for (const field of ["createdByContactID", "taskID"]) {
|
|
19899
20102
|
if (body[field] !== void 0) {
|
|
19900
|
-
if (typeof body[field] !== "number")
|
|
20103
|
+
if (typeof body[field] !== "number") fail2(`${field} must be a numeric identifier`);
|
|
19901
20104
|
const id = parseIdentifier(body[field], field);
|
|
19902
|
-
if (field === "taskID" && String(id) !== String(parent))
|
|
20105
|
+
if (field === "taskID" && String(id) !== String(parent)) fail2("taskID must match the parentId path argument");
|
|
19903
20106
|
}
|
|
19904
20107
|
}
|
|
19905
|
-
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId"))
|
|
20108
|
+
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail2("update must contain a writable field");
|
|
19906
20109
|
}
|
|
19907
20110
|
|
|
19908
20111
|
// src/resources/simple.ts
|
|
@@ -21149,6 +21352,19 @@ var SIMPLE_RESOURCES = [
|
|
|
21149
21352
|
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
21150
21353
|
opForms: { get: "scoped", create: "scoped", update: "scoped" }
|
|
21151
21354
|
},
|
|
21355
|
+
{
|
|
21356
|
+
key: "task_predecessors",
|
|
21357
|
+
accessor: "taskPredecessors",
|
|
21358
|
+
resourcePath: "/V1.0/TaskPredecessors",
|
|
21359
|
+
parentScopedPath: "/V1.0/Tasks/{parentId}/Predecessors",
|
|
21360
|
+
parentPath: "/V1.0/Tasks",
|
|
21361
|
+
parentField: "successorTaskID",
|
|
21362
|
+
deletable: true,
|
|
21363
|
+
udfCapable: false,
|
|
21364
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
21365
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
21366
|
+
opForms: { get: "scoped", create: "scoped", update: "scoped", delete: "scoped" }
|
|
21367
|
+
},
|
|
21152
21368
|
{
|
|
21153
21369
|
key: "task_secondary_resources",
|
|
21154
21370
|
accessor: "taskSecondaryResources",
|
|
@@ -21414,7 +21630,7 @@ var GenericResource = class extends BaseResource {
|
|
|
21414
21630
|
if (["company_attachments", "company_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
|
|
21415
21631
|
throw new OperationNotSupportedError(config.key, "getUdfInfo");
|
|
21416
21632
|
};
|
|
21417
|
-
if (config.ops?.create === false || config.key === "company_attachments") this.createIfNotExists = async () => {
|
|
21633
|
+
if (config.ops?.create === false || config.key === "company_attachments" || config.key === "task_predecessors") this.createIfNotExists = async () => {
|
|
21418
21634
|
throw new OperationNotSupportedError(config.key, "createIfNotExists");
|
|
21419
21635
|
};
|
|
21420
21636
|
if (config.key === "task_notes") {
|
|
@@ -21425,6 +21641,9 @@ var GenericResource = class extends BaseResource {
|
|
|
21425
21641
|
};
|
|
21426
21642
|
}
|
|
21427
21643
|
}
|
|
21644
|
+
putFallbackEligible(err) {
|
|
21645
|
+
return this.config.key !== "task_predecessors" && super.putFallbackEligible(err);
|
|
21646
|
+
}
|
|
21428
21647
|
/** #293 QA F2: the superset exposes every generic method, but a row whose ops/helpers
|
|
21429
21648
|
* flags mark an op absent (the plain entities) refuses it client-side, pre-wire — the
|
|
21430
21649
|
* pre-#293 per-key shell simply did not carry the method. Rows without flags (the
|
|
@@ -21461,6 +21680,12 @@ var GenericResource = class extends BaseResource {
|
|
|
21461
21680
|
if (isIdentifier(b)) {
|
|
21462
21681
|
if (this.config.opForms?.get === "global") throw new OperationNotSupportedError(this.config.key, "get");
|
|
21463
21682
|
const fresh = (c ?? null)?.fresh === true;
|
|
21683
|
+
if (this.config.key === "task_predecessors") {
|
|
21684
|
+
predecessorParent(a);
|
|
21685
|
+
const record = await this.getScopedRaw(a, b, fresh);
|
|
21686
|
+
assertPredecessorBinding(record, a, b);
|
|
21687
|
+
return record;
|
|
21688
|
+
}
|
|
21464
21689
|
return this.config.attachmentGet === true ? this.getScopedModel(a, b, fresh) : this.getScopedRaw(a, b, fresh);
|
|
21465
21690
|
}
|
|
21466
21691
|
if (this.config.opForms?.get === "scoped") throw new OperationNotSupportedError(this.config.key, "get");
|
|
@@ -21471,9 +21696,10 @@ var GenericResource = class extends BaseResource {
|
|
|
21471
21696
|
if (isIdentifier(a)) {
|
|
21472
21697
|
if (this.config.opForms?.create === "global") throw new OperationNotSupportedError(this.config.key, "create");
|
|
21473
21698
|
const parentId = a;
|
|
21474
|
-
const data2 = b;
|
|
21475
|
-
const opts2 = c ?? {};
|
|
21699
|
+
const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(b, parentId, true) : b;
|
|
21700
|
+
const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
|
|
21476
21701
|
if (this.config.key === "task_notes") admitTaskNote(data2, parentId, true);
|
|
21702
|
+
if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, void 0, data2);
|
|
21477
21703
|
if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
|
|
21478
21704
|
return this.createScopedRaw(parentId, data2, opts2);
|
|
21479
21705
|
}
|
|
@@ -21489,9 +21715,10 @@ var GenericResource = class extends BaseResource {
|
|
|
21489
21715
|
if (this.config.opForms?.update === "global") throw new OperationNotSupportedError(this.config.key, "update");
|
|
21490
21716
|
const parentId = a;
|
|
21491
21717
|
const id2 = b;
|
|
21492
|
-
const data2 = c;
|
|
21493
|
-
const opts2 = d ?? {};
|
|
21718
|
+
const data2 = this.config.key === "task_predecessors" ? admitTaskPredecessor(c, parentId, false) : c;
|
|
21719
|
+
const opts2 = this.config.key === "task_predecessors" ? { ...d } : d ?? {};
|
|
21494
21720
|
if (this.config.key === "task_notes") admitTaskNote(data2, parentId, false);
|
|
21721
|
+
if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, id2);
|
|
21495
21722
|
if (opts2.dryRun === true) return this.runUpdateDryRun(id2, data2, opts2, parentId);
|
|
21496
21723
|
if (this.config.collectionUpdate !== true) {
|
|
21497
21724
|
await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.update`, parentId);
|
|
@@ -21514,7 +21741,8 @@ var GenericResource = class extends BaseResource {
|
|
|
21514
21741
|
if (this.config.opForms?.delete === "global") throw new OperationNotSupportedError(this.config.key, "delete");
|
|
21515
21742
|
const parentId = a;
|
|
21516
21743
|
const id2 = b;
|
|
21517
|
-
const opts2 = c ?? {};
|
|
21744
|
+
const opts2 = this.config.key === "task_predecessors" ? { ...c } : c ?? {};
|
|
21745
|
+
if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, id2);
|
|
21518
21746
|
if (opts2.dryRun === true) return this.runDeleteDryRun(id2, opts2, parentId);
|
|
21519
21747
|
await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.delete`, parentId);
|
|
21520
21748
|
return this.config.attachmentGet === true ? this.deleteScopedModel(parentId, id2, opts2) : this.deleteScopedRaw(parentId, id2, opts2);
|
|
@@ -23403,7 +23631,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
23403
23631
|
var queryResourceKeysPromise = null;
|
|
23404
23632
|
function queryResourceKeys() {
|
|
23405
23633
|
if (queryResourceKeysPromise === null) {
|
|
23406
|
-
queryResourceKeysPromise =
|
|
23634
|
+
queryResourceKeysPromise = chunkASL3BIW2_cjs.loadCapabilityRecords().then((records) => {
|
|
23407
23635
|
const s = /* @__PURE__ */ new Set();
|
|
23408
23636
|
for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
|
|
23409
23637
|
return s;
|
|
@@ -23525,7 +23753,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
23525
23753
|
return { top, limit };
|
|
23526
23754
|
}
|
|
23527
23755
|
async function checkFieldNames(resourceKey, conditions, opts, problems) {
|
|
23528
|
-
const records = resourceKey === void 0 ? [] : await
|
|
23756
|
+
const records = resourceKey === void 0 ? [] : await chunkASL3BIW2_cjs.loadCapabilityRecords();
|
|
23529
23757
|
const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
|
|
23530
23758
|
if (record === void 0) return void 0;
|
|
23531
23759
|
const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
|
|
@@ -23870,7 +24098,7 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
|
|
|
23870
24098
|
continue;
|
|
23871
24099
|
}
|
|
23872
24100
|
const rel = RELATIONSHIP_MAP[resourceKey];
|
|
23873
|
-
if (rel !== void 0 && rel.parentScoped) {
|
|
24101
|
+
if (rel !== void 0 && rel.parentScoped && resourceKey !== "time_off_requests") {
|
|
23874
24102
|
problems.push(
|
|
23875
24103
|
`${at}.resource: "${resourceKey}" is a parent-scoped child \u2014 its get needs (parentId, id); ${opName} takes single numeric ids of TOP-LEVEL records (scoped reads: client.${camelKey(resourceKey)}.get(parentId, id))`
|
|
23876
24104
|
);
|
|
@@ -24170,7 +24398,7 @@ async function uiLink(client, input) {
|
|
|
24170
24398
|
var indexPromise = null;
|
|
24171
24399
|
function operationIndex() {
|
|
24172
24400
|
if (indexPromise === null) {
|
|
24173
|
-
indexPromise =
|
|
24401
|
+
indexPromise = chunkASL3BIW2_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
|
|
24174
24402
|
}
|
|
24175
24403
|
return indexPromise;
|
|
24176
24404
|
}
|
|
@@ -26506,16 +26734,16 @@ function latchingHttp(raw, spend) {
|
|
|
26506
26734
|
}
|
|
26507
26735
|
};
|
|
26508
26736
|
observeRecordReadFailures(http, latch);
|
|
26509
|
-
const
|
|
26737
|
+
const fail2 = (err) => {
|
|
26510
26738
|
latch(err);
|
|
26511
26739
|
throw err;
|
|
26512
26740
|
};
|
|
26513
26741
|
http.request = (o) => {
|
|
26514
26742
|
if (fatal) throw fatal;
|
|
26515
26743
|
try {
|
|
26516
|
-
return counted.request({ ...o, signal: o.signal ?? signal }).catch(
|
|
26744
|
+
return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail2);
|
|
26517
26745
|
} catch (err) {
|
|
26518
|
-
return
|
|
26746
|
+
return fail2(err);
|
|
26519
26747
|
}
|
|
26520
26748
|
};
|
|
26521
26749
|
return { http, fatal: () => fatal, signal };
|
|
@@ -27713,12 +27941,12 @@ var TimeEntriesResource = class extends GenericResource {
|
|
|
27713
27941
|
/** Only four review fields; collection PATCH preserves every omitted field. */
|
|
27714
27942
|
async updateReviewFields(id, data, opts = {}) {
|
|
27715
27943
|
return updateReviewFields(this, id, data, async (payload) => {
|
|
27716
|
-
const
|
|
27944
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
27717
27945
|
if (opts.dryRun === true) {
|
|
27718
|
-
const preview2 = await this.runUpdateDryRun(
|
|
27946
|
+
const preview2 = await this.runUpdateDryRun(numeric2, payload, { ...opts, raw: true });
|
|
27719
27947
|
return { ...preview2, request: { ...preview2.request, method: "PATCH" } };
|
|
27720
27948
|
}
|
|
27721
|
-
return this.updateGlobal(
|
|
27949
|
+
return this.updateGlobal(numeric2, payload, { ...opts, raw: true }, "PATCH");
|
|
27722
27950
|
}, opts);
|
|
27723
27951
|
}
|
|
27724
27952
|
dateWorkedWindow(from, to, opts) {
|
|
@@ -28842,7 +29070,9 @@ exports.invokeReadPages = invokeReadPages;
|
|
|
28842
29070
|
exports.invokeWrite = invokeWrite;
|
|
28843
29071
|
exports.isAutotaskError = isAutotaskError;
|
|
28844
29072
|
exports.isClosedStatus = isClosedStatus;
|
|
29073
|
+
exports.isDateYMD = isDateYMD;
|
|
28845
29074
|
exports.isDeterministicVendor500 = isDeterministicVendor500;
|
|
29075
|
+
exports.isRecord = isRecord2;
|
|
28846
29076
|
exports.joinedCompositePart = joinedCompositePart;
|
|
28847
29077
|
exports.mergeDetails = mergeDetails;
|
|
28848
29078
|
exports.mergePartialBody = mergePartialBody;
|