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,4 +1,4 @@
|
|
|
1
|
-
import { loadCapabilityRecords } from './chunk-
|
|
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",
|
|
@@ -7130,6 +7146,25 @@ var RELATIONSHIP_MAP = {
|
|
|
7130
7146
|
"update": false,
|
|
7131
7147
|
"delete": false
|
|
7132
7148
|
}
|
|
7149
|
+
},
|
|
7150
|
+
{
|
|
7151
|
+
"resource": "time_off_requests",
|
|
7152
|
+
"apiEntity": "TimeOffRequest",
|
|
7153
|
+
"parentField": "resourceID",
|
|
7154
|
+
"parentSegment": "TimeOffRequests",
|
|
7155
|
+
"tier": "extended",
|
|
7156
|
+
"workflowResource": false,
|
|
7157
|
+
"specialOps": [
|
|
7158
|
+
"approve",
|
|
7159
|
+
"reject"
|
|
7160
|
+
],
|
|
7161
|
+
"searchCovers": null,
|
|
7162
|
+
"scopedOps": {
|
|
7163
|
+
"create": true,
|
|
7164
|
+
"query": true,
|
|
7165
|
+
"update": true,
|
|
7166
|
+
"delete": false
|
|
7167
|
+
}
|
|
7133
7168
|
}
|
|
7134
7169
|
],
|
|
7135
7170
|
"naturalKeys": {
|
|
@@ -9195,11 +9230,15 @@ var RELATIONSHIP_MAP = {
|
|
|
9195
9230
|
"apiEntity": "TimeOffRequest",
|
|
9196
9231
|
"kind": "entity",
|
|
9197
9232
|
"path": "TimeOffRequests",
|
|
9198
|
-
"parentScoped":
|
|
9233
|
+
"parentScoped": true,
|
|
9199
9234
|
"tier": "extended",
|
|
9200
9235
|
"workflowResource": false,
|
|
9201
9236
|
"group": "B",
|
|
9202
|
-
"parent":
|
|
9237
|
+
"parent": {
|
|
9238
|
+
"resource": "resources",
|
|
9239
|
+
"segment": "TimeOffRequests",
|
|
9240
|
+
"field": "resourceID"
|
|
9241
|
+
},
|
|
9203
9242
|
"children": [],
|
|
9204
9243
|
"naturalKeys": {
|
|
9205
9244
|
"hasSearch": false,
|
|
@@ -9207,8 +9246,31 @@ var RELATIONSHIP_MAP = {
|
|
|
9207
9246
|
"findBy": []
|
|
9208
9247
|
},
|
|
9209
9248
|
"blindSurfaces": null,
|
|
9210
|
-
"zoneFacts":
|
|
9211
|
-
|
|
9249
|
+
"zoneFacts": {
|
|
9250
|
+
"createGuidance": {
|
|
9251
|
+
"createOp": "time_off_requests.create",
|
|
9252
|
+
"parentScoped": true,
|
|
9253
|
+
"liveProvenPrefix": [],
|
|
9254
|
+
"unproven": true,
|
|
9255
|
+
"blocker": {
|
|
9256
|
+
"kind": "unknown",
|
|
9257
|
+
"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.",
|
|
9258
|
+
"remedy": "Read time_off_requests.getFieldInfo to select Submitted, then preview with a known resource and valid leave request fields."
|
|
9259
|
+
},
|
|
9260
|
+
"vendorEvidence": [
|
|
9261
|
+
"Specification: POST /V1.0/Resources/{parentId}/TimeOffRequests returns OperationResultModel.",
|
|
9262
|
+
"Official TimeOffRequests entity documentation: create accepts Submitted only; https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TimeOffRequestsEntity.htm. No live validation performed."
|
|
9263
|
+
],
|
|
9264
|
+
"deleteBoundary": {
|
|
9265
|
+
"available": false,
|
|
9266
|
+
"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."
|
|
9267
|
+
}
|
|
9268
|
+
}
|
|
9269
|
+
},
|
|
9270
|
+
"deleteBoundary": {
|
|
9271
|
+
"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.",
|
|
9272
|
+
"proof": "spec-derived"
|
|
9273
|
+
},
|
|
9212
9274
|
"markerField": null
|
|
9213
9275
|
},
|
|
9214
9276
|
"inventory_products": {
|
|
@@ -9727,6 +9789,50 @@ var RELATIONSHIP_MAP = {
|
|
|
9727
9789
|
"proof": "spec-derived"
|
|
9728
9790
|
},
|
|
9729
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
|
|
9730
9836
|
}
|
|
9731
9837
|
};
|
|
9732
9838
|
var BLIND_SURFACE_STAMPS = {
|
|
@@ -9837,7 +9943,8 @@ var DELETE_BOUNDARY_NOTES = {
|
|
|
9837
9943
|
"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.",
|
|
9838
9944
|
"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.",
|
|
9839
9945
|
"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.",
|
|
9840
|
-
"task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API."
|
|
9946
|
+
"task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API.",
|
|
9947
|
+
"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."
|
|
9841
9948
|
};
|
|
9842
9949
|
var RESPONSE_DRIFT_MARKERS = {
|
|
9843
9950
|
"ticket_checklist_libraries": {
|
|
@@ -13302,6 +13409,25 @@ var CREATE_GUIDANCE = {
|
|
|
13302
13409
|
"note": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API."
|
|
13303
13410
|
}
|
|
13304
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
|
+
},
|
|
13305
13431
|
{
|
|
13306
13432
|
"resource": "task_secondary_resources",
|
|
13307
13433
|
"createOp": "task_secondary_resources.create",
|
|
@@ -13788,6 +13914,26 @@ var CREATE_GUIDANCE = {
|
|
|
13788
13914
|
"note": null
|
|
13789
13915
|
}
|
|
13790
13916
|
},
|
|
13917
|
+
{
|
|
13918
|
+
"resource": "time_off_requests",
|
|
13919
|
+
"createOp": "time_off_requests.create",
|
|
13920
|
+
"parentScoped": true,
|
|
13921
|
+
"liveProvenPrefix": [],
|
|
13922
|
+
"unproven": true,
|
|
13923
|
+
"blocker": {
|
|
13924
|
+
"kind": "unknown",
|
|
13925
|
+
"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.",
|
|
13926
|
+
"remedy": "Read time_off_requests.getFieldInfo to select Submitted, then preview with a known resource and valid leave request fields."
|
|
13927
|
+
},
|
|
13928
|
+
"vendorEvidence": [
|
|
13929
|
+
"Specification: POST /V1.0/Resources/{parentId}/TimeOffRequests returns OperationResultModel.",
|
|
13930
|
+
"Official TimeOffRequests entity documentation: create accepts Submitted only; https://autotask.net/help/developerhelp/Content/APIs/REST/Entities/TimeOffRequestsEntity.htm. No live validation performed."
|
|
13931
|
+
],
|
|
13932
|
+
"deleteBoundary": {
|
|
13933
|
+
"available": false,
|
|
13934
|
+
"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."
|
|
13935
|
+
}
|
|
13936
|
+
},
|
|
13791
13937
|
{
|
|
13792
13938
|
"resource": "user_defined_field_definitions",
|
|
13793
13939
|
"createOp": "user_defined_field_definitions.create",
|
|
@@ -13837,7 +13983,7 @@ var CREATE_GUIDANCE = {
|
|
|
13837
13983
|
}
|
|
13838
13984
|
],
|
|
13839
13985
|
"counts": {
|
|
13840
|
-
"total":
|
|
13986
|
+
"total": 104,
|
|
13841
13987
|
"byKind": {
|
|
13842
13988
|
"ok": 41,
|
|
13843
13989
|
"blind-reference": 16,
|
|
@@ -13847,7 +13993,7 @@ var CREATE_GUIDANCE = {
|
|
|
13847
13993
|
"resource-role-pair": 2,
|
|
13848
13994
|
"delete-absent": 0,
|
|
13849
13995
|
"non-mutable": 0,
|
|
13850
|
-
"unknown":
|
|
13996
|
+
"unknown": 28
|
|
13851
13997
|
}
|
|
13852
13998
|
}
|
|
13853
13999
|
};
|
|
@@ -16379,13 +16525,13 @@ async function runBounded(fn, items, opts) {
|
|
|
16379
16525
|
const results = new Array(items.length);
|
|
16380
16526
|
let next = 0;
|
|
16381
16527
|
let failure;
|
|
16382
|
-
const
|
|
16528
|
+
const fail2 = (error, index) => {
|
|
16383
16529
|
if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
|
|
16384
16530
|
};
|
|
16385
16531
|
const worker = async () => {
|
|
16386
16532
|
while (failure === void 0 && next < items.length) {
|
|
16387
16533
|
if (signal?.aborted) {
|
|
16388
|
-
|
|
16534
|
+
fail2(signal.reason, -1);
|
|
16389
16535
|
return;
|
|
16390
16536
|
}
|
|
16391
16537
|
const i = next++;
|
|
@@ -16395,7 +16541,7 @@ async function runBounded(fn, items, opts) {
|
|
|
16395
16541
|
results[i] = settle ? { status: "fulfilled", value } : value;
|
|
16396
16542
|
} catch (error) {
|
|
16397
16543
|
if (settle) results[i] = { status: "rejected", reason: error };
|
|
16398
|
-
else
|
|
16544
|
+
else fail2(error, i);
|
|
16399
16545
|
}
|
|
16400
16546
|
}
|
|
16401
16547
|
};
|
|
@@ -17672,6 +17818,7 @@ var MODEL_FIELD_SETS = {
|
|
|
17672
17818
|
"tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
|
|
17673
17819
|
"tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
|
|
17674
17820
|
"task_notes": ["id", "createDateTime", "creatorResourceID", "createdByContactID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "taskID", "title", "soapParentPropertyId"],
|
|
17821
|
+
"task_predecessors": ["id", "lagDays", "predecessorTaskID", "successorTaskID", "soapParentPropertyId"],
|
|
17675
17822
|
"task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
|
|
17676
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"],
|
|
17677
17824
|
"tax_regions": ["id", "isActive", "name"],
|
|
@@ -17840,21 +17987,21 @@ function validateRelationLeaves(resourceKey, conditions, op) {
|
|
|
17840
17987
|
assertUndottedUdfField(c, op);
|
|
17841
17988
|
const field = c.field;
|
|
17842
17989
|
const [rel, sub, ...rest] = field.split(".");
|
|
17843
|
-
const
|
|
17990
|
+
const fail2 = (why) => {
|
|
17844
17991
|
throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
|
|
17845
17992
|
operation: op,
|
|
17846
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.`
|
|
17847
17994
|
});
|
|
17848
17995
|
};
|
|
17849
17996
|
if (selfPrefixes(resourceKey).includes(rel)) {
|
|
17850
|
-
if (rest.length > 0 || !sub)
|
|
17997
|
+
if (rest.length > 0 || !sub) fail2("is not <resource>.<field> (multi-hop relations are not supported)");
|
|
17851
17998
|
continue;
|
|
17852
17999
|
}
|
|
17853
|
-
if (rest.length > 0 || !sub)
|
|
17854
|
-
if (!valid.includes(rel))
|
|
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"})`);
|
|
17855
18002
|
const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
|
|
17856
18003
|
if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
|
|
17857
|
-
|
|
18004
|
+
fail2(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
|
|
17858
18005
|
}
|
|
17859
18006
|
}
|
|
17860
18007
|
};
|
|
@@ -18700,9 +18847,9 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18700
18847
|
}
|
|
18701
18848
|
/** `GET /V1.0/<E>/{id}` → `{ item }` unwrapped (`item: null` → NotFoundError). */
|
|
18702
18849
|
async getGlobal(id, fresh = false) {
|
|
18703
|
-
const
|
|
18704
|
-
const res = await this.cachedGet(`${this.resourcePath}/${
|
|
18705
|
-
return unwrapItem(res,
|
|
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);
|
|
18706
18853
|
}
|
|
18707
18854
|
/**
|
|
18708
18855
|
* V2 merge read: a FRESH single-record GET that skips response redaction
|
|
@@ -18716,15 +18863,15 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18716
18863
|
* (redacted-view) read cache.
|
|
18717
18864
|
*/
|
|
18718
18865
|
async getGlobalUnredacted(id, readOpts) {
|
|
18719
|
-
const
|
|
18866
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18720
18867
|
const res = await this.http.request({
|
|
18721
18868
|
method: "GET",
|
|
18722
|
-
path: `${this.resourcePath}/${
|
|
18869
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
18723
18870
|
operation: `${this.config.key}.get`,
|
|
18724
18871
|
skipResponseRedaction: true,
|
|
18725
18872
|
maxRetries: readOpts?.maxRetries
|
|
18726
18873
|
});
|
|
18727
|
-
return unwrapItem(res,
|
|
18874
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18728
18875
|
}
|
|
18729
18876
|
/**
|
|
18730
18877
|
* Issue #34 fallback merge read: a FRESH parent-scoped single-record GET
|
|
@@ -18735,21 +18882,21 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18735
18882
|
* '[REDACTED]' markers into the fallback PUT (corruption on live records).
|
|
18736
18883
|
*/
|
|
18737
18884
|
async getScopedUnredacted(parentId, id, readOpts) {
|
|
18738
|
-
const
|
|
18885
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18739
18886
|
const res = await this.http.request({
|
|
18740
18887
|
method: "GET",
|
|
18741
|
-
path: this.scopedItemPath(parentId,
|
|
18888
|
+
path: this.scopedItemPath(parentId, numeric2),
|
|
18742
18889
|
operation: `${this.config.key}.get`,
|
|
18743
18890
|
skipResponseRedaction: true,
|
|
18744
18891
|
maxRetries: readOpts?.maxRetries
|
|
18745
18892
|
});
|
|
18746
|
-
return unwrapItem(res,
|
|
18893
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18747
18894
|
}
|
|
18748
18895
|
/** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */
|
|
18749
18896
|
async getScopedRaw(parentId, id, fresh = false) {
|
|
18750
|
-
const
|
|
18897
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18751
18898
|
const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
|
|
18752
|
-
return unwrapItem(res,
|
|
18899
|
+
return unwrapItem(res, numeric2, `${this.config.key}.get`, this.entityName);
|
|
18753
18900
|
}
|
|
18754
18901
|
/**
|
|
18755
18902
|
* Attachment single-read: the vendor answers the model DIRECTLY (swagger),
|
|
@@ -18757,9 +18904,9 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18757
18904
|
* accept all three shapes; empty/null → NotFoundError.
|
|
18758
18905
|
*/
|
|
18759
18906
|
async getScopedModel(parentId, id, fresh = false) {
|
|
18760
|
-
const
|
|
18907
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
18761
18908
|
const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh);
|
|
18762
|
-
return this.unwrapModelLike(res,
|
|
18909
|
+
return this.unwrapModelLike(res, numeric2, this.entityName);
|
|
18763
18910
|
}
|
|
18764
18911
|
/** @internal */
|
|
18765
18912
|
unwrapModelLike(body, id, entity) {
|
|
@@ -18900,12 +19047,12 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18900
19047
|
* the composite ROOT of a hot resource (issue #36) must see the live
|
|
18901
19048
|
* record, never a snapshot. */
|
|
18902
19049
|
async fetchRecordRaw(entityPath, id, fresh = false) {
|
|
18903
|
-
const
|
|
18904
|
-
const res = await this.cachedGet(`${entityPath}/${
|
|
19050
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19051
|
+
const res = await this.cachedGet(`${entityPath}/${numeric2}`, `${this.config.key}.fetchRecord`, fresh);
|
|
18905
19052
|
if (this.config.attachmentGet) {
|
|
18906
|
-
return this.unwrapModelLike(res,
|
|
19053
|
+
return this.unwrapModelLike(res, numeric2, entityNameFromPath(entityPath));
|
|
18907
19054
|
}
|
|
18908
|
-
return unwrapItem(res,
|
|
19055
|
+
return unwrapItem(res, numeric2, `${this.config.key}.fetchRecord`, entityNameFromPath(entityPath));
|
|
18909
19056
|
}
|
|
18910
19057
|
/**
|
|
18911
19058
|
* `getContext` part fetch: a single-record read that degrades to `null`
|
|
@@ -18981,12 +19128,12 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
18981
19128
|
* - bare value on an id-only resource → AutotaskConfigError (CONFIG_ERROR).
|
|
18982
19129
|
*/
|
|
18983
19130
|
async resolveDetailed(identifier) {
|
|
18984
|
-
let
|
|
19131
|
+
let numeric2 = null;
|
|
18985
19132
|
if (isIdentifierCandidate(identifier)) {
|
|
18986
|
-
|
|
19133
|
+
numeric2 = parseIdentifier(identifier, "id");
|
|
18987
19134
|
}
|
|
18988
|
-
if (
|
|
18989
|
-
const record = await this.fetchRecordRaw(this.resourcePath,
|
|
19135
|
+
if (numeric2 !== null) {
|
|
19136
|
+
const record = await this.fetchRecordRaw(this.resourcePath, numeric2);
|
|
18990
19137
|
return { value: record, resolutionCost: "direct", scanned: 0, scanTruncated: false };
|
|
18991
19138
|
}
|
|
18992
19139
|
if (typeof identifier !== "string" || identifier.trim() === "") {
|
|
@@ -19414,7 +19561,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19414
19561
|
}
|
|
19415
19562
|
}
|
|
19416
19563
|
async updateGlobal(id, data, opts = {}, method = "PUT") {
|
|
19417
|
-
const
|
|
19564
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19418
19565
|
const operation = `${this.config.key}.update`;
|
|
19419
19566
|
let body = this.normalizeMutationBody(data);
|
|
19420
19567
|
const collectionUpdate = this.config.collectionUpdate === true;
|
|
@@ -19422,7 +19569,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19422
19569
|
if (opts.raw !== true) {
|
|
19423
19570
|
let current;
|
|
19424
19571
|
try {
|
|
19425
|
-
current = await this.getGlobalUnredacted(
|
|
19572
|
+
current = await this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries });
|
|
19426
19573
|
} catch (err) {
|
|
19427
19574
|
if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);
|
|
19428
19575
|
throw err;
|
|
@@ -19430,16 +19577,16 @@ var MutationBase = class extends MetaBase {
|
|
|
19430
19577
|
this.staleObjectCheck(current, opts, operation);
|
|
19431
19578
|
body = mergePartialBody(current, body);
|
|
19432
19579
|
} else {
|
|
19433
|
-
await this.guardStaleBeforeMutation(
|
|
19580
|
+
await this.guardStaleBeforeMutation(numeric2, opts, operation);
|
|
19434
19581
|
}
|
|
19435
|
-
body.id =
|
|
19582
|
+
body.id = numeric2;
|
|
19436
19583
|
}
|
|
19437
|
-
const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${
|
|
19584
|
+
const route = `${method} ${collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`}`;
|
|
19438
19585
|
let res;
|
|
19439
19586
|
try {
|
|
19440
19587
|
res = await this.http.request({
|
|
19441
19588
|
method,
|
|
19442
|
-
path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${
|
|
19589
|
+
path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric2}`,
|
|
19443
19590
|
body,
|
|
19444
19591
|
operation,
|
|
19445
19592
|
maxRetries: opts.maxRetries
|
|
@@ -19450,15 +19597,15 @@ var MutationBase = class extends MetaBase {
|
|
|
19450
19597
|
throw this.putFallbackDeclined(err, route, false);
|
|
19451
19598
|
}
|
|
19452
19599
|
const merged = await this.putFallbackMergedBody(
|
|
19453
|
-
() => this.getGlobalUnredacted(
|
|
19600
|
+
() => this.getGlobalUnredacted(numeric2, { maxRetries: opts.maxRetries }),
|
|
19454
19601
|
body,
|
|
19455
|
-
|
|
19602
|
+
numeric2
|
|
19456
19603
|
);
|
|
19457
19604
|
let retry;
|
|
19458
19605
|
try {
|
|
19459
19606
|
retry = await this.http.request({
|
|
19460
19607
|
method: "PUT",
|
|
19461
|
-
path: `${this.resourcePath}/${
|
|
19608
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
19462
19609
|
body: merged,
|
|
19463
19610
|
operation,
|
|
19464
19611
|
maxRetries: opts.maxRetries
|
|
@@ -19467,23 +19614,23 @@ var MutationBase = class extends MetaBase {
|
|
|
19467
19614
|
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, route, true);
|
|
19468
19615
|
throw rerr;
|
|
19469
19616
|
}
|
|
19470
|
-
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts,
|
|
19617
|
+
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2);
|
|
19471
19618
|
}
|
|
19472
|
-
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts,
|
|
19619
|
+
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2);
|
|
19473
19620
|
}
|
|
19474
19621
|
/** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx
|
|
19475
19622
|
* (204 / empty body) is a valid vendor delete answer — synthesize the
|
|
19476
19623
|
* result from the path id (issue #25: the transport returns undefined
|
|
19477
19624
|
* for it; a non-blank wrong shape still throws via unwrapOperation). */
|
|
19478
19625
|
async deleteGlobal(id, opts = {}) {
|
|
19479
|
-
const
|
|
19626
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19480
19627
|
const res = await this.http.request({
|
|
19481
19628
|
method: "DELETE",
|
|
19482
|
-
path: `${this.resourcePath}/${
|
|
19629
|
+
path: `${this.resourcePath}/${numeric2}`,
|
|
19483
19630
|
operation: `${this.config.key}.delete`,
|
|
19484
19631
|
maxRetries: opts.maxRetries
|
|
19485
19632
|
});
|
|
19486
|
-
return res === void 0 ? { id:
|
|
19633
|
+
return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
|
|
19487
19634
|
}
|
|
19488
19635
|
/** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
|
|
19489
19636
|
async createScopedRaw(parentId, data, opts = {}) {
|
|
@@ -19502,9 +19649,9 @@ var MutationBase = class extends MetaBase {
|
|
|
19502
19649
|
* the item path anywhere in the spec; the node strips the id from the path and
|
|
19503
19650
|
* PATCHes the collection, and the vendor keys the record by the id in the body. */
|
|
19504
19651
|
async updateScopedRaw(parentId, id, data, opts = {}) {
|
|
19505
|
-
const
|
|
19652
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19506
19653
|
const body = this.normalizeMutationBody(data);
|
|
19507
|
-
body.id =
|
|
19654
|
+
body.id = numeric2;
|
|
19508
19655
|
const path = this.scopedCollectionPath(parentId);
|
|
19509
19656
|
const operation = `${this.config.key}.update`;
|
|
19510
19657
|
let res;
|
|
@@ -19519,45 +19666,45 @@ var MutationBase = class extends MetaBase {
|
|
|
19519
19666
|
} catch (err) {
|
|
19520
19667
|
if (!this.putFallbackEligible(err)) throw err;
|
|
19521
19668
|
const merged = await this.putFallbackMergedBody(
|
|
19522
|
-
() => this.getScopedUnredacted(parentId,
|
|
19669
|
+
() => this.getScopedUnredacted(parentId, numeric2, { maxRetries: opts.maxRetries }),
|
|
19523
19670
|
body,
|
|
19524
|
-
|
|
19671
|
+
numeric2
|
|
19525
19672
|
);
|
|
19526
19673
|
let retry;
|
|
19527
19674
|
try {
|
|
19528
19675
|
retry = await this.http.request({
|
|
19529
19676
|
method: "PUT",
|
|
19530
|
-
path: `${path}/${
|
|
19677
|
+
path: `${path}/${numeric2}`,
|
|
19531
19678
|
body: merged,
|
|
19532
19679
|
operation,
|
|
19533
19680
|
maxRetries: opts.maxRetries
|
|
19534
19681
|
});
|
|
19535
19682
|
} catch (rerr) {
|
|
19536
|
-
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${
|
|
19683
|
+
if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric2}`, true);
|
|
19537
19684
|
throw rerr;
|
|
19538
19685
|
}
|
|
19539
|
-
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts,
|
|
19686
|
+
return this.withPersistedCheck(unwrapOperation(retry, operation), data, opts, numeric2, parentId);
|
|
19540
19687
|
}
|
|
19541
|
-
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts,
|
|
19688
|
+
return this.withPersistedCheck(unwrapOperation(res, operation), data, opts, numeric2, parentId);
|
|
19542
19689
|
}
|
|
19543
19690
|
/** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
|
|
19544
19691
|
* (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
|
|
19545
19692
|
async deleteScopedRaw(parentId, id, opts = {}) {
|
|
19546
|
-
const
|
|
19693
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19547
19694
|
const res = await this.http.request({
|
|
19548
19695
|
method: "DELETE",
|
|
19549
19696
|
path: this.scopedItemPath(parentId, id),
|
|
19550
19697
|
operation: `${this.config.key}.delete`,
|
|
19551
19698
|
maxRetries: opts.maxRetries
|
|
19552
19699
|
});
|
|
19553
|
-
return res === void 0 ? { id:
|
|
19700
|
+
return res === void 0 ? { id: numeric2 } : unwrapOperation(res, `${this.config.key}.delete`);
|
|
19554
19701
|
}
|
|
19555
19702
|
/**
|
|
19556
19703
|
* Attachment delete: the vendor returns the deleted attachment MODEL, not
|
|
19557
19704
|
* OperationResultModel (G1 envelope.md) — pass it through typed.
|
|
19558
19705
|
*/
|
|
19559
19706
|
async deleteScopedModel(parentId, id, opts = {}) {
|
|
19560
|
-
const
|
|
19707
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
19561
19708
|
const res = await this.http.request({
|
|
19562
19709
|
method: "DELETE",
|
|
19563
19710
|
path: this.scopedItemPath(parentId, id),
|
|
@@ -19567,8 +19714,8 @@ var MutationBase = class extends MetaBase {
|
|
|
19567
19714
|
if (res === void 0) return {};
|
|
19568
19715
|
if (!isRecord2(res)) {
|
|
19569
19716
|
throw new AutotaskError(
|
|
19570
|
-
`Expected the deleted attachment model for ID ${
|
|
19571
|
-
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [
|
|
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 }] } }
|
|
19572
19719
|
);
|
|
19573
19720
|
}
|
|
19574
19721
|
return res;
|
|
@@ -19629,6 +19776,9 @@ var MutationBase = class extends MetaBase {
|
|
|
19629
19776
|
checks.push({ name: "duplicate-detection", ok: existingId === void 0 });
|
|
19630
19777
|
}
|
|
19631
19778
|
const warnings = existingId !== void 0 ? [`duplicate match on ${dedupFields.join(", ")} (id ${existingId}); the create would be skipped`] : [];
|
|
19779
|
+
const wouldCreate = existingId === void 0 && checks.every((check) => check.ok);
|
|
19780
|
+
const deleteBoundaryNote = wouldCreate ? DELETE_BOUNDARY_NOTES[this.config.key] : void 0;
|
|
19781
|
+
if (deleteBoundaryNote !== void 0) warnings.push(deleteBoundaryNote);
|
|
19632
19782
|
return buildDryRunResult({
|
|
19633
19783
|
operation: `${this.config.key}.createIfNotExists`,
|
|
19634
19784
|
method: "POST",
|
|
@@ -19636,7 +19786,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19636
19786
|
ids: existingId !== void 0 ? [existingId] : [],
|
|
19637
19787
|
checks,
|
|
19638
19788
|
warnings,
|
|
19639
|
-
impact: { affected: 1, scope: "single-record", reversible:
|
|
19789
|
+
impact: { affected: 1, scope: "single-record", reversible: !wouldCreate || this.config.deletable !== false && DELETE_BOUNDARY_NOTES[this.config.key] === void 0 },
|
|
19640
19790
|
data
|
|
19641
19791
|
}, { redactPersonalData: this.http.redactPersonalData });
|
|
19642
19792
|
}
|
|
@@ -19748,7 +19898,7 @@ var MutationBase = class extends MetaBase {
|
|
|
19748
19898
|
path,
|
|
19749
19899
|
ids: [],
|
|
19750
19900
|
checks,
|
|
19751
|
-
impact: { affected: 1, scope: "single-record", reversible:
|
|
19901
|
+
impact: { affected: 1, scope: "single-record", reversible: !checks.every((check) => check.ok) || this.config.deletable !== false && deleteBoundaryNote === void 0 },
|
|
19752
19902
|
warnings,
|
|
19753
19903
|
data
|
|
19754
19904
|
}, { redactPersonalData: this.http.redactPersonalData });
|
|
@@ -19873,34 +20023,87 @@ var BaseResource = class extends MutationBase {
|
|
|
19873
20023
|
}
|
|
19874
20024
|
};
|
|
19875
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
|
+
|
|
19876
20079
|
// src/resources/special/taskNotes.ts
|
|
19877
20080
|
var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
|
|
19878
20081
|
function admitTaskNote(data, parentId, creating) {
|
|
19879
20082
|
const parent = parseIdentifier(parentId, "parentId");
|
|
19880
|
-
const
|
|
20083
|
+
const fail2 = (message) => {
|
|
19881
20084
|
throw new AutotaskConfigError(`task_notes: ${message}`);
|
|
19882
20085
|
};
|
|
19883
|
-
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
20086
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) fail2("data must be a record");
|
|
19884
20087
|
const body = data;
|
|
19885
|
-
for (const key of Object.keys(body)) if (!WRITABLE.has(key))
|
|
20088
|
+
for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail2(`${key} is not a writable TaskNotes field`);
|
|
19886
20089
|
for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
|
|
19887
20090
|
const value = body[field];
|
|
19888
|
-
if (value !== void 0 && (typeof value !== "string" || value.length > maximum))
|
|
20091
|
+
if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail2(`${field} must be a string of at most ${maximum} characters`);
|
|
19889
20092
|
}
|
|
19890
|
-
if (creating && (typeof body.description !== "string" || body.description.trim() === ""))
|
|
20093
|
+
if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail2("description is required");
|
|
19891
20094
|
for (const field of ["noteType", "publish"]) {
|
|
19892
20095
|
const value = body[field];
|
|
19893
|
-
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value)))
|
|
20096
|
+
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail2(`${field} must be an integer from the current field metadata`);
|
|
19894
20097
|
}
|
|
19895
|
-
if (creating && body.taskID === void 0)
|
|
20098
|
+
if (creating && body.taskID === void 0) fail2("taskID is required in the create body and must match parentId");
|
|
19896
20099
|
for (const field of ["createdByContactID", "taskID"]) {
|
|
19897
20100
|
if (body[field] !== void 0) {
|
|
19898
|
-
if (typeof body[field] !== "number")
|
|
20101
|
+
if (typeof body[field] !== "number") fail2(`${field} must be a numeric identifier`);
|
|
19899
20102
|
const id = parseIdentifier(body[field], field);
|
|
19900
|
-
if (field === "taskID" && String(id) !== String(parent))
|
|
20103
|
+
if (field === "taskID" && String(id) !== String(parent)) fail2("taskID must match the parentId path argument");
|
|
19901
20104
|
}
|
|
19902
20105
|
}
|
|
19903
|
-
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId"))
|
|
20106
|
+
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail2("update must contain a writable field");
|
|
19904
20107
|
}
|
|
19905
20108
|
|
|
19906
20109
|
// src/resources/simple.ts
|
|
@@ -21147,6 +21350,19 @@ var SIMPLE_RESOURCES = [
|
|
|
21147
21350
|
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
21148
21351
|
opForms: { get: "scoped", create: "scoped", update: "scoped" }
|
|
21149
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
|
+
},
|
|
21150
21366
|
{
|
|
21151
21367
|
key: "task_secondary_resources",
|
|
21152
21368
|
accessor: "taskSecondaryResources",
|
|
@@ -21412,7 +21628,7 @@ var GenericResource = class extends BaseResource {
|
|
|
21412
21628
|
if (["company_attachments", "company_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
|
|
21413
21629
|
throw new OperationNotSupportedError(config.key, "getUdfInfo");
|
|
21414
21630
|
};
|
|
21415
|
-
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 () => {
|
|
21416
21632
|
throw new OperationNotSupportedError(config.key, "createIfNotExists");
|
|
21417
21633
|
};
|
|
21418
21634
|
if (config.key === "task_notes") {
|
|
@@ -21423,6 +21639,9 @@ var GenericResource = class extends BaseResource {
|
|
|
21423
21639
|
};
|
|
21424
21640
|
}
|
|
21425
21641
|
}
|
|
21642
|
+
putFallbackEligible(err) {
|
|
21643
|
+
return this.config.key !== "task_predecessors" && super.putFallbackEligible(err);
|
|
21644
|
+
}
|
|
21426
21645
|
/** #293 QA F2: the superset exposes every generic method, but a row whose ops/helpers
|
|
21427
21646
|
* flags mark an op absent (the plain entities) refuses it client-side, pre-wire — the
|
|
21428
21647
|
* pre-#293 per-key shell simply did not carry the method. Rows without flags (the
|
|
@@ -21459,6 +21678,12 @@ var GenericResource = class extends BaseResource {
|
|
|
21459
21678
|
if (isIdentifier(b)) {
|
|
21460
21679
|
if (this.config.opForms?.get === "global") throw new OperationNotSupportedError(this.config.key, "get");
|
|
21461
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
|
+
}
|
|
21462
21687
|
return this.config.attachmentGet === true ? this.getScopedModel(a, b, fresh) : this.getScopedRaw(a, b, fresh);
|
|
21463
21688
|
}
|
|
21464
21689
|
if (this.config.opForms?.get === "scoped") throw new OperationNotSupportedError(this.config.key, "get");
|
|
@@ -21469,9 +21694,10 @@ var GenericResource = class extends BaseResource {
|
|
|
21469
21694
|
if (isIdentifier(a)) {
|
|
21470
21695
|
if (this.config.opForms?.create === "global") throw new OperationNotSupportedError(this.config.key, "create");
|
|
21471
21696
|
const parentId = a;
|
|
21472
|
-
const data2 = b;
|
|
21473
|
-
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 ?? {};
|
|
21474
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);
|
|
21475
21701
|
if (opts2.dryRun === true) return this.runCreateDryRun(data2, parentId);
|
|
21476
21702
|
return this.createScopedRaw(parentId, data2, opts2);
|
|
21477
21703
|
}
|
|
@@ -21487,9 +21713,10 @@ var GenericResource = class extends BaseResource {
|
|
|
21487
21713
|
if (this.config.opForms?.update === "global") throw new OperationNotSupportedError(this.config.key, "update");
|
|
21488
21714
|
const parentId = a;
|
|
21489
21715
|
const id2 = b;
|
|
21490
|
-
const data2 = c;
|
|
21491
|
-
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 ?? {};
|
|
21492
21718
|
if (this.config.key === "task_notes") admitTaskNote(data2, parentId, false);
|
|
21719
|
+
if (this.config.key === "task_predecessors") await guardTaskPredecessor(this.http, parentId, id2);
|
|
21493
21720
|
if (opts2.dryRun === true) return this.runUpdateDryRun(id2, data2, opts2, parentId);
|
|
21494
21721
|
if (this.config.collectionUpdate !== true) {
|
|
21495
21722
|
await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.update`, parentId);
|
|
@@ -21512,7 +21739,8 @@ var GenericResource = class extends BaseResource {
|
|
|
21512
21739
|
if (this.config.opForms?.delete === "global") throw new OperationNotSupportedError(this.config.key, "delete");
|
|
21513
21740
|
const parentId = a;
|
|
21514
21741
|
const id2 = b;
|
|
21515
|
-
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);
|
|
21516
21744
|
if (opts2.dryRun === true) return this.runDeleteDryRun(id2, opts2, parentId);
|
|
21517
21745
|
await this.guardStaleBeforeMutation(id2, opts2, `${this.config.key}.delete`, parentId);
|
|
21518
21746
|
return this.config.attachmentGet === true ? this.deleteScopedModel(parentId, id2, opts2) : this.deleteScopedRaw(parentId, id2, opts2);
|
|
@@ -23868,7 +24096,7 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
|
|
|
23868
24096
|
continue;
|
|
23869
24097
|
}
|
|
23870
24098
|
const rel = RELATIONSHIP_MAP[resourceKey];
|
|
23871
|
-
if (rel !== void 0 && rel.parentScoped) {
|
|
24099
|
+
if (rel !== void 0 && rel.parentScoped && resourceKey !== "time_off_requests") {
|
|
23872
24100
|
problems.push(
|
|
23873
24101
|
`${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))`
|
|
23874
24102
|
);
|
|
@@ -26504,16 +26732,16 @@ function latchingHttp(raw, spend) {
|
|
|
26504
26732
|
}
|
|
26505
26733
|
};
|
|
26506
26734
|
observeRecordReadFailures(http, latch);
|
|
26507
|
-
const
|
|
26735
|
+
const fail2 = (err) => {
|
|
26508
26736
|
latch(err);
|
|
26509
26737
|
throw err;
|
|
26510
26738
|
};
|
|
26511
26739
|
http.request = (o) => {
|
|
26512
26740
|
if (fatal) throw fatal;
|
|
26513
26741
|
try {
|
|
26514
|
-
return counted.request({ ...o, signal: o.signal ?? signal }).catch(
|
|
26742
|
+
return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail2);
|
|
26515
26743
|
} catch (err) {
|
|
26516
|
-
return
|
|
26744
|
+
return fail2(err);
|
|
26517
26745
|
}
|
|
26518
26746
|
};
|
|
26519
26747
|
return { http, fatal: () => fatal, signal };
|
|
@@ -27711,12 +27939,12 @@ var TimeEntriesResource = class extends GenericResource {
|
|
|
27711
27939
|
/** Only four review fields; collection PATCH preserves every omitted field. */
|
|
27712
27940
|
async updateReviewFields(id, data, opts = {}) {
|
|
27713
27941
|
return updateReviewFields(this, id, data, async (payload) => {
|
|
27714
|
-
const
|
|
27942
|
+
const numeric2 = parseIdentifier(id, "id");
|
|
27715
27943
|
if (opts.dryRun === true) {
|
|
27716
|
-
const preview2 = await this.runUpdateDryRun(
|
|
27944
|
+
const preview2 = await this.runUpdateDryRun(numeric2, payload, { ...opts, raw: true });
|
|
27717
27945
|
return { ...preview2, request: { ...preview2.request, method: "PATCH" } };
|
|
27718
27946
|
}
|
|
27719
|
-
return this.updateGlobal(
|
|
27947
|
+
return this.updateGlobal(numeric2, payload, { ...opts, raw: true }, "PATCH");
|
|
27720
27948
|
}, opts);
|
|
27721
27949
|
}
|
|
27722
27950
|
dateWorkedWindow(from, to, opts) {
|
|
@@ -28751,4 +28979,4 @@ var ContractsResource = class extends GenericResource {
|
|
|
28751
28979
|
}
|
|
28752
28980
|
};
|
|
28753
28981
|
|
|
28754
|
-
export { AGGREGATE_DATE_BUCKETS, AGGREGATE_DEFAULT_LIMIT, AGGREGATE_DEFAULT_TOP, AGGREGATE_TOP_MAX, AutotaskAbortError, AutotaskConfigError, AutotaskError, AutotaskNetworkError, AutotaskTimeoutError, CREATE_BLOCKER_KINDS, CREDENTIAL_ENV_LOAD_ACTION, CREDENTIAL_SHAPE_POINTER, CompaniesResource, ConfirmationRequiredError, ConflictError, ContractsResource, DEFAULT_ZONE, DeleteBoundaryError, EXPAND_RESOURCE_NAMES_MAX_IDS, EmptyResponseError, FETCH_BY_IDS_CHUNK_SIZE, FETCH_BY_IDS_MAX_ITEMS, FIELD_CACHE_KINDS, FIELD_CATALOG_HONESTY_NOTE, GenericResource, HostPolicyDeniedError, HttpClient, INVOKE_OPTION_KEYS, InvoicesResource, MAX_FIELD_CATALOG_WIRE, MIN_FIELD_CATALOG_MAX_BYTES, MIN_PREFIX_SUMMARY_LENGTH, MaintenanceError, MarkerUnsafeIdError, MoveRefusedError, NotFoundError, OperationNotSupportedError, PARAMS_BAG_KEYS, PICKLIST_VALUE_NOT_SERVED_NOTE, PaginationLimitError, QueryTooLongError, RELATIONSHIP_MAP, RateLimitError, RecoveryTruncatedError, ResolutionError, ResponseRejectedError, SIMPLE_RESOURCES, ScopeRequiredError, StaleObjectError, TICKET_LABEL_FIELDS, TimeEntriesResource, TtlCache, UI_LINK_ENTITIES, UNSCOPED_WALK_THRESHOLD, UnexpectedContentTypeError, WORKFLOW_RESOURCES, ZONES, addLabelSibling, addNameSibling, aggregate, arAging, buildDryRunResult, buildQueryRequest, buildReadCache, buildUiLink, cachedRecordGet, clientOf, compositePart, compositePartLimit, createGuidance, createNamePlan, credentialShapeProblem, credentialValueSummary, cursorToPath, dateBucketLabel, effectiveRequiredFields, errorFromStatus, expandResourceNames, fetchByIds, fieldCatalog, foldFlattenedOpts, formatVendorDetail, invoke, invokeDelete, invokeRead, invokeReadPages, invokeWrite, isAutotaskError, isClosedStatus, isDeterministicVendor500, joinedCompositePart, mergeDetails, mergePartialBody, needsConfirmation, nextActionFor, nonChargeableWork, notPersistedFields, openStatusFilter, openTicketsOfPart, parseIdentifier, parseVendorErrors, portfolioMargin, queryRows, readTasks, recurringRevenue, refuse2 as refuse, relationshipMap, resolveAny, resolveCompositeNames, resolveConfig, resolveCredentials, resolveLineOfBusinessChain, resolveStaff, resolveTicketStatusSemantics, revenueRollup, runBounded, runMove, runWithSignal, sanitiseResult, searchAcrossResources, suspendCompanyIndex, uiLink, uiLinkFor, unknownKeysRefusal, unwrapItem, unwrapItems, unwrapOperation, validateDispatchArgs, validateInvokeOptions, validateParamsBag, vendorId, wipHours, zoneUrl };
|
|
28982
|
+
export { AGGREGATE_DATE_BUCKETS, AGGREGATE_DEFAULT_LIMIT, AGGREGATE_DEFAULT_TOP, AGGREGATE_TOP_MAX, AutotaskAbortError, AutotaskConfigError, AutotaskError, AutotaskNetworkError, AutotaskTimeoutError, CREATE_BLOCKER_KINDS, CREDENTIAL_ENV_LOAD_ACTION, CREDENTIAL_SHAPE_POINTER, CompaniesResource, ConfirmationRequiredError, ConflictError, ContractsResource, DEFAULT_ZONE, DeleteBoundaryError, EXPAND_RESOURCE_NAMES_MAX_IDS, EmptyResponseError, FETCH_BY_IDS_CHUNK_SIZE, FETCH_BY_IDS_MAX_ITEMS, FIELD_CACHE_KINDS, FIELD_CATALOG_HONESTY_NOTE, GenericResource, HostPolicyDeniedError, HttpClient, INVOKE_OPTION_KEYS, InvoicesResource, MAX_FIELD_CATALOG_WIRE, MIN_FIELD_CATALOG_MAX_BYTES, MIN_PREFIX_SUMMARY_LENGTH, MaintenanceError, MarkerUnsafeIdError, MoveRefusedError, NotFoundError, OperationNotSupportedError, PARAMS_BAG_KEYS, PICKLIST_VALUE_NOT_SERVED_NOTE, PaginationLimitError, QueryTooLongError, RELATIONSHIP_MAP, RateLimitError, RecoveryTruncatedError, ResolutionError, ResponseRejectedError, SIMPLE_RESOURCES, ScopeRequiredError, StaleObjectError, TICKET_LABEL_FIELDS, TimeEntriesResource, TtlCache, UI_LINK_ENTITIES, UNSCOPED_WALK_THRESHOLD, UnexpectedContentTypeError, WORKFLOW_RESOURCES, ZONES, addLabelSibling, addNameSibling, aggregate, arAging, buildDryRunResult, buildQueryRequest, buildReadCache, buildUiLink, cachedRecordGet, clientOf, compositePart, compositePartLimit, createGuidance, createNamePlan, credentialShapeProblem, credentialValueSummary, cursorToPath, dateBucketLabel, effectiveRequiredFields, errorFromStatus, expandResourceNames, fetchByIds, fieldCatalog, foldFlattenedOpts, formatVendorDetail, invoke, invokeDelete, invokeRead, invokeReadPages, invokeWrite, isAutotaskError, isClosedStatus, isDateYMD, isDeterministicVendor500, isRecord2 as isRecord, joinedCompositePart, mergeDetails, mergePartialBody, needsConfirmation, nextActionFor, nonChargeableWork, notPersistedFields, openStatusFilter, openTicketsOfPart, parseIdentifier, parseVendorErrors, portfolioMargin, queryRows, readTasks, recurringRevenue, refuse2 as refuse, relationshipMap, resolveAny, resolveCompositeNames, resolveConfig, resolveCredentials, resolveLineOfBusinessChain, resolveStaff, resolveTicketStatusSemantics, revenueRollup, runBounded, runMove, runWithSignal, sanitiseResult, searchAcrossResources, suspendCompanyIndex, uiLink, uiLinkFor, unknownKeysRefusal, unwrapItem, unwrapItems, unwrapOperation, validateDispatchArgs, validateInvokeOptions, validateParamsBag, vendorId, wipHours, zoneUrl };
|