node-autotask 0.10.0 → 0.11.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/MCP_TOOL_CATALOG.json +3 -3
- package/MCP_TOOL_MANIFEST.md +5 -5
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +1327 -1236
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-QUM74WLQ.cjs → chunk-25ZUKHS4.cjs} +135 -135
- package/dist/{chunk-6KFP5HV3.js → chunk-7L23FDQW.js} +1326 -1235
- package/dist/{chunk-3VB6N44U.js → chunk-CJONZQ7E.js} +2 -2
- package/dist/{chunk-HWC2WPX2.js → chunk-LNRN45XS.js} +1 -1
- package/dist/{chunk-S7VMY5KN.cjs → chunk-QAX222R6.cjs} +365 -365
- package/dist/{chunk-NVJ2PTN3.js → chunk-SXHPUQMB.js} +2 -2
- package/dist/{chunk-WTVD2JZN.cjs → chunk-T5FLSJOD.cjs} +1326 -1235
- package/dist/{chunk-WTVLHMZA.cjs → chunk-YKEX4SK7.cjs} +2 -2
- package/dist/{index-DGgMD8aq.d.ts → index-B_xToSpq.d.ts} +1 -1
- package/dist/{index-BOyh7S65.d.cts → index-Dv_GSZaN.d.cts} +1 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +279 -130
- package/dist/operations/index.d.cts +22 -4
- package/dist/operations/index.d.ts +22 -4
- package/dist/operations/index.js +155 -6
- package/dist/pool.cjs +8 -8
- 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 +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/package.json +1 -1
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkYKEX4SK7cjs = require('./chunk-YKEX4SK7.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkT5FLSJODcjs = require('./chunk-T5FLSJOD.cjs');
|
|
37
37
|
|
|
38
38
|
// src/resources/appointments.ts
|
|
39
|
-
var AppointmentsResource = class extends
|
|
39
|
+
var AppointmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
40
40
|
constructor(http, pageSize) {
|
|
41
41
|
super(http, {
|
|
42
42
|
key: "appointments",
|
|
@@ -121,7 +121,7 @@ var AuthenticateResource = class {
|
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
// src/resources/billing_codes.ts
|
|
124
|
-
var BillingCodesResource = class extends
|
|
124
|
+
var BillingCodesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
125
125
|
constructor(http, pageSize) {
|
|
126
126
|
super(http, {
|
|
127
127
|
key: "billing_codes",
|
|
@@ -171,7 +171,7 @@ var MAX_LIMIT = 500;
|
|
|
171
171
|
function clampWindowLimit(limit) {
|
|
172
172
|
const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
|
|
173
173
|
if (!Number.isInteger(n) || n < 1) {
|
|
174
|
-
throw new (0,
|
|
174
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
175
175
|
}
|
|
176
176
|
return Math.min(n, MAX_LIMIT);
|
|
177
177
|
}
|
|
@@ -217,7 +217,7 @@ function wallParts(tz, ms) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
|
|
220
|
-
throw new (0,
|
|
220
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
|
|
221
221
|
}
|
|
222
222
|
return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
|
|
223
223
|
}
|
|
@@ -244,7 +244,7 @@ function localDayEndMs(y, m, d, tz) {
|
|
|
244
244
|
}
|
|
245
245
|
function validateZone(tz, opName = "dateWindow") {
|
|
246
246
|
if (typeof tz !== "string" || tz.length === 0) {
|
|
247
|
-
throw new (0,
|
|
247
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
248
248
|
`${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
249
249
|
{ operation: opName }
|
|
250
250
|
);
|
|
@@ -252,7 +252,7 @@ function validateZone(tz, opName = "dateWindow") {
|
|
|
252
252
|
try {
|
|
253
253
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
254
254
|
} catch (e2) {
|
|
255
|
-
throw new (0,
|
|
255
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
256
256
|
`${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
257
257
|
{ operation: opName }
|
|
258
258
|
);
|
|
@@ -404,13 +404,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
|
|
|
404
404
|
body: { MaxRecords: limit, filter },
|
|
405
405
|
operation
|
|
406
406
|
});
|
|
407
|
-
return
|
|
407
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
408
408
|
}
|
|
409
409
|
var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
|
|
410
410
|
function customRangeDay(value, label, zone, opName) {
|
|
411
411
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
|
|
412
412
|
if (!m) {
|
|
413
|
-
throw new (0,
|
|
413
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
414
414
|
zone === void 0 ? `${opName}: ${label} must be a UTC 'YYYY-MM-DD' date (got ${JSON.stringify(value)})` : `${opName}: ${label} must be a 'YYYY-MM-DD' local calendar day in ${zone} (got ${JSON.stringify(value)})`,
|
|
415
415
|
{ operation: opName }
|
|
416
416
|
);
|
|
@@ -422,7 +422,7 @@ function customRangeDay(value, label, zone, opName) {
|
|
|
422
422
|
const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
|
|
423
423
|
const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
|
|
424
424
|
if (!Number.isFinite(ms)) {
|
|
425
|
-
throw new (0,
|
|
425
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
426
426
|
zone === void 0 ? `${opName}: ${label} is not a valid UTC date (${JSON.stringify(value)})` : `${opName}: ${label} is not a valid calendar day in ${zone} (${JSON.stringify(value)})`,
|
|
427
427
|
{ operation: opName }
|
|
428
428
|
);
|
|
@@ -433,7 +433,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
433
433
|
const fromB = customRangeDay(from, "from", zone, operation);
|
|
434
434
|
const toB = customRangeDay(to, "to", zone, operation);
|
|
435
435
|
if (fromB.ms > toB.ms) {
|
|
436
|
-
throw new (0,
|
|
436
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
437
437
|
`${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
|
|
438
438
|
{ operation }
|
|
439
439
|
);
|
|
@@ -450,7 +450,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
450
450
|
body: { MaxRecords: limit, filter },
|
|
451
451
|
operation
|
|
452
452
|
});
|
|
453
|
-
return
|
|
453
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
// src/resources/special/billing_items.ts
|
|
@@ -483,7 +483,7 @@ async function customRange(_resource, from, to, http, opts) {
|
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
// src/resources/billing_items.ts
|
|
486
|
-
var BillingItemsResource = class extends
|
|
486
|
+
var BillingItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
487
487
|
constructor(http, pageSize) {
|
|
488
488
|
super(http, {
|
|
489
489
|
key: "billing_items",
|
|
@@ -585,7 +585,7 @@ var BillingItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
585
585
|
};
|
|
586
586
|
|
|
587
587
|
// src/resources/change_request_links.ts
|
|
588
|
-
var ChangeRequestLinksResource = class extends
|
|
588
|
+
var ChangeRequestLinksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
589
589
|
constructor(http, pageSize) {
|
|
590
590
|
super(http, {
|
|
591
591
|
key: "change_request_links",
|
|
@@ -639,7 +639,7 @@ var ChangeRequestLinksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
639
639
|
};
|
|
640
640
|
|
|
641
641
|
// src/resources/checklist_libraries.ts
|
|
642
|
-
var ChecklistLibrariesResource = class extends
|
|
642
|
+
var ChecklistLibrariesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
643
643
|
constructor(http, pageSize) {
|
|
644
644
|
super(http, {
|
|
645
645
|
key: "checklist_libraries",
|
|
@@ -713,7 +713,7 @@ var ChecklistLibrariesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
713
713
|
};
|
|
714
714
|
|
|
715
715
|
// src/resources/checklist_library_checklist_items.ts
|
|
716
|
-
var ChecklistLibraryChecklistItemsResource = class extends
|
|
716
|
+
var ChecklistLibraryChecklistItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
717
717
|
constructor(http, pageSize) {
|
|
718
718
|
super(http, {
|
|
719
719
|
key: "checklist_library_checklist_items",
|
|
@@ -779,7 +779,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkWTVLHMZAcjs.Bas
|
|
|
779
779
|
};
|
|
780
780
|
|
|
781
781
|
// src/resources/classification_icons.ts
|
|
782
|
-
var ClassificationIconsResource = class extends
|
|
782
|
+
var ClassificationIconsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
783
783
|
constructor(http, pageSize) {
|
|
784
784
|
super(http, {
|
|
785
785
|
key: "classification_icons",
|
|
@@ -827,7 +827,7 @@ var DEFAULT_LIMIT2 = 25;
|
|
|
827
827
|
var MAX_LIMIT2 = 500;
|
|
828
828
|
function clampLimit(limit) {
|
|
829
829
|
const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
|
|
830
|
-
if (!Number.isInteger(n) || n < 1) throw new (0,
|
|
830
|
+
if (!Number.isInteger(n) || n < 1) throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
831
831
|
return Math.min(n, MAX_LIMIT2);
|
|
832
832
|
}
|
|
833
833
|
async function queryCompanies(http, filter, limit) {
|
|
@@ -838,7 +838,7 @@ async function queryCompanies(http, filter, limit) {
|
|
|
838
838
|
body: { MaxRecords: limit, filter },
|
|
839
839
|
operation: "companies.searchByDomain"
|
|
840
840
|
});
|
|
841
|
-
return
|
|
841
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
842
842
|
}
|
|
843
843
|
async function queryContacts(http, filter, limit) {
|
|
844
844
|
const res = await http.request({
|
|
@@ -848,7 +848,7 @@ async function queryContacts(http, filter, limit) {
|
|
|
848
848
|
body: { MaxRecords: limit, filter },
|
|
849
849
|
operation: "companies.searchByDomain"
|
|
850
850
|
});
|
|
851
|
-
return
|
|
851
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
852
852
|
}
|
|
853
853
|
async function fetchCompanies(http, ids, limit) {
|
|
854
854
|
const out = [];
|
|
@@ -863,7 +863,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
863
863
|
const item = body && "item" in body ? body.item : null;
|
|
864
864
|
if (item) out.push(item);
|
|
865
865
|
} catch (err) {
|
|
866
|
-
if (err instanceof
|
|
866
|
+
if (err instanceof _chunkYKEX4SK7cjs.NotFoundError) continue;
|
|
867
867
|
throw err;
|
|
868
868
|
}
|
|
869
869
|
}
|
|
@@ -871,7 +871,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
871
871
|
}
|
|
872
872
|
async function searchByDomain(_resource, domain, opts = {}, http) {
|
|
873
873
|
const text = domain.trim();
|
|
874
|
-
if (text === "") throw new (0,
|
|
874
|
+
if (text === "") throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("searchByDomain: empty domain");
|
|
875
875
|
const limit = clampLimit(opts.limit);
|
|
876
876
|
const filter = [{ field: "webAddress", op: "contains", value: text }];
|
|
877
877
|
const direct = await queryCompanies(http, filter, limit);
|
|
@@ -885,7 +885,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
|
|
|
885
885
|
const email = _nullishCoalesce(_optionalChain([identity, 'access', _9 => _9.email, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]), () => ( ""));
|
|
886
886
|
const website = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.website, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
|
|
887
887
|
if (name === "" && email === "" && website === "") {
|
|
888
|
-
throw new (0,
|
|
888
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
|
|
889
889
|
}
|
|
890
890
|
const limit = clampLimit(opts.limit);
|
|
891
891
|
const found = /* @__PURE__ */ new Map();
|
|
@@ -912,23 +912,23 @@ async function familyChildPage(http, parentID) {
|
|
|
912
912
|
path: "/V1.0/Companies/query",
|
|
913
913
|
body: {
|
|
914
914
|
MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
|
|
915
|
-
filter:
|
|
915
|
+
filter: _chunkYKEX4SK7cjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
|
|
916
916
|
},
|
|
917
917
|
operation: "companies.search"
|
|
918
918
|
});
|
|
919
|
-
const { items, pageDetails } =
|
|
919
|
+
const { items, pageDetails } = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, "companies.search");
|
|
920
920
|
return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
|
|
921
921
|
}
|
|
922
922
|
function assertSearchWithDetailOpts(opts) {
|
|
923
923
|
if (opts === void 0) return;
|
|
924
924
|
if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
|
|
925
|
-
throw new (0,
|
|
925
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
|
|
926
926
|
operation: "companies.searchWithDetail"
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
929
|
for (const key of Object.keys(opts)) {
|
|
930
930
|
if (key !== "limit") {
|
|
931
|
-
throw new (0,
|
|
931
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
932
932
|
`companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
|
|
933
933
|
{ operation: "companies.searchWithDetail" }
|
|
934
934
|
);
|
|
@@ -937,32 +937,32 @@ function assertSearchWithDetailOpts(opts) {
|
|
|
937
937
|
}
|
|
938
938
|
async function searchWithFamily(_resource, query, opts = {}, http) {
|
|
939
939
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
940
|
-
throw new (0,
|
|
940
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
|
|
941
941
|
}
|
|
942
942
|
for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
|
|
943
943
|
if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
|
|
944
|
-
throw new (0,
|
|
944
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
945
945
|
`companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
|
|
946
946
|
{ operation: "companies.search" }
|
|
947
947
|
);
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
|
|
951
|
-
throw new (0,
|
|
951
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
|
|
952
952
|
operation: "companies.search"
|
|
953
953
|
});
|
|
954
954
|
}
|
|
955
955
|
const text = query.trim();
|
|
956
|
-
if (text === "") throw new (0,
|
|
957
|
-
const limit = opts.limit === void 0 ? 25 :
|
|
956
|
+
if (text === "") throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
|
|
957
|
+
const limit = opts.limit === void 0 ? 25 : _chunkYKEX4SK7cjs.clampPageSize.call(void 0, opts.limit);
|
|
958
958
|
const res = await http.request({
|
|
959
959
|
method: "POST",
|
|
960
960
|
idempotent: true,
|
|
961
961
|
path: "/V1.0/Companies/query",
|
|
962
|
-
body: { MaxRecords: limit, filter:
|
|
962
|
+
body: { MaxRecords: limit, filter: _chunkYKEX4SK7cjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
|
|
963
963
|
operation: "companies.search"
|
|
964
964
|
});
|
|
965
|
-
const hits =
|
|
965
|
+
const hits = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, "companies.search").items;
|
|
966
966
|
if (opts.includeFamily !== true) return hits;
|
|
967
967
|
const rows = [];
|
|
968
968
|
for (const hit of hits) {
|
|
@@ -986,7 +986,7 @@ var DEFAULT_COMPANY_TYPE = 1;
|
|
|
986
986
|
var DEDUP_NAME_LIMIT = 10;
|
|
987
987
|
var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumerate (the unowned surface is blind); a same-name company outside that scope is not detected";
|
|
988
988
|
var SAFE_COMPANY_CREATE_DEFAULTS = {};
|
|
989
|
-
var OwnerResourceRequiredError = class extends
|
|
989
|
+
var OwnerResourceRequiredError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
990
990
|
constructor(message, options = {}) {
|
|
991
991
|
super(message, {
|
|
992
992
|
code: "OWNER_RESOURCE_REQUIRED",
|
|
@@ -997,13 +997,13 @@ var OwnerResourceRequiredError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
997
997
|
this.name = "OwnerResourceRequiredError";
|
|
998
998
|
}
|
|
999
999
|
};
|
|
1000
|
-
var CompanyResourceInvalidError = class extends
|
|
1000
|
+
var CompanyResourceInvalidError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
1001
1001
|
constructor(message, options = {}) {
|
|
1002
1002
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
1003
1003
|
this.name = "CompanyResourceInvalidError";
|
|
1004
1004
|
}
|
|
1005
1005
|
};
|
|
1006
|
-
var CompanyCreateFailedError = class extends
|
|
1006
|
+
var CompanyCreateFailedError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
1007
1007
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
1008
1008
|
|
|
1009
1009
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -1014,18 +1014,18 @@ var CompanyCreateFailedError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
async function upsertByName(resource, companyName, params, opts, http) {
|
|
1016
1016
|
if (typeof companyName !== "string" || companyName.trim() === "") {
|
|
1017
|
-
throw new (0,
|
|
1017
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
|
|
1018
1018
|
}
|
|
1019
1019
|
if (typeof _optionalChain([params, 'optionalAccess', _15 => _15.phone]) !== "string" || params.phone.trim() === "") {
|
|
1020
|
-
throw new (0,
|
|
1020
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("upsertByName: params.phone is required (a non-empty string \u2014 the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })", { operation: OP_UPSERT_NAME });
|
|
1021
1021
|
}
|
|
1022
1022
|
const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
|
|
1023
1023
|
if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
|
|
1024
|
-
throw new (0,
|
|
1024
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 \u2014 the ww29-proven value)`, { operation: OP_UPSERT_NAME });
|
|
1025
1025
|
}
|
|
1026
1026
|
const owner = params.ownerResourceID;
|
|
1027
1027
|
if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
|
|
1028
|
-
throw new (0,
|
|
1028
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
|
|
1029
1029
|
}
|
|
1030
1030
|
const q = await resource.queryBounded({ filter: [{ field: "companyName", op: "eq", value: companyName }], limit: DEDUP_NAME_LIMIT });
|
|
1031
1031
|
const caveat = {
|
|
@@ -1036,7 +1036,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1036
1036
|
const match = q.items[0];
|
|
1037
1037
|
if (match !== void 0) {
|
|
1038
1038
|
if (opts.dryRun === true) {
|
|
1039
|
-
return
|
|
1039
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
1040
1040
|
{
|
|
1041
1041
|
operation: OP_UPSERT_NAME,
|
|
1042
1042
|
method: "POST",
|
|
@@ -1071,7 +1071,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1071
1071
|
"ownerResourceID is REQUIRED on the apply path (the vendor requires it; the node cannot enumerate candidates \u2014 the resources table is blind to this API user (count/query return 0)): the apply throws the typed OWNER_RESOURCE_REQUIRED if it is still absent"
|
|
1072
1072
|
);
|
|
1073
1073
|
}
|
|
1074
|
-
return
|
|
1074
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
1075
1075
|
{
|
|
1076
1076
|
operation: OP_UPSERT_NAME,
|
|
1077
1077
|
method: "POST",
|
|
@@ -1119,8 +1119,8 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1119
1119
|
sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
|
|
1120
1120
|
};
|
|
1121
1121
|
} catch (err) {
|
|
1122
|
-
if (!
|
|
1123
|
-
const named = (_nullishCoalesce(
|
|
1122
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
1123
|
+
const named = (_nullishCoalesce(_chunkYKEX4SK7cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
1124
1124
|
const seen = /* @__PURE__ */ new Set();
|
|
1125
1125
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
1126
1126
|
const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -1134,7 +1134,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
continue;
|
|
1136
1136
|
}
|
|
1137
|
-
const detail =
|
|
1137
|
+
const detail = _chunkYKEX4SK7cjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
1138
1138
|
throw new CompanyCreateFailedError(
|
|
1139
1139
|
`upsertByName: the vendor rejected the company create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the ww29 required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
|
|
1140
1140
|
unique,
|
|
@@ -1153,7 +1153,7 @@ var PROFILE_PART_LIMIT = 50;
|
|
|
1153
1153
|
function profilePartLimit(value, name) {
|
|
1154
1154
|
const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
|
|
1155
1155
|
if (!Number.isInteger(n) || n < 1) {
|
|
1156
|
-
throw new (0,
|
|
1156
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
1157
1157
|
}
|
|
1158
1158
|
return n;
|
|
1159
1159
|
}
|
|
@@ -1165,14 +1165,14 @@ async function scopedCompanyQuery(http, path, companyID, limit) {
|
|
|
1165
1165
|
body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }] },
|
|
1166
1166
|
operation: "companies.fullProfile"
|
|
1167
1167
|
});
|
|
1168
|
-
return
|
|
1168
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
1169
1169
|
}
|
|
1170
1170
|
async function fullProfile(resource, id, opts = {}, http) {
|
|
1171
1171
|
const contactLimit = profilePartLimit(opts.contactLimit, "contactLimit");
|
|
1172
1172
|
const noteLimit = profilePartLimit(opts.noteLimit, "noteLimit");
|
|
1173
1173
|
const ticketLimit = profilePartLimit(opts.ticketLimit, "ticketLimit");
|
|
1174
1174
|
const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
|
|
1175
|
-
const companyID =
|
|
1175
|
+
const companyID = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
1176
1176
|
const company = await resource.get(companyID);
|
|
1177
1177
|
const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, PROFILE_PART_LIMIT);
|
|
1178
1178
|
const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit);
|
|
@@ -1189,7 +1189,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1189
1189
|
},
|
|
1190
1190
|
operation: "companies.fullProfile"
|
|
1191
1191
|
});
|
|
1192
|
-
return
|
|
1192
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
1193
1193
|
})();
|
|
1194
1194
|
let openTickets = {
|
|
1195
1195
|
items: openRows,
|
|
@@ -1198,7 +1198,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1198
1198
|
note: OPEN_TICKETS_NOTE
|
|
1199
1199
|
};
|
|
1200
1200
|
if (openRows.length === 0) {
|
|
1201
|
-
const stamp =
|
|
1201
|
+
const stamp = _chunkYKEX4SK7cjs.blindStampFor.call(void 0, _optionalChain([_chunkYKEX4SK7cjs.BLIND_SURFACE_STAMPS, 'access', _16 => _16["tickets"], 'optionalAccess', _17 => _17.query]), [
|
|
1202
1202
|
{ field: "companyID", op: "eq", value: companyID },
|
|
1203
1203
|
{ field: "status", op: "noteq", value: 5 }
|
|
1204
1204
|
]);
|
|
@@ -1229,7 +1229,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
};
|
|
1231
1231
|
if (opts.names === true) {
|
|
1232
|
-
const builder =
|
|
1232
|
+
const builder = _chunkYKEX4SK7cjs.createNamePlan.call(void 0, _chunkYKEX4SK7cjs.TICKET_LABEL_FIELDS);
|
|
1233
1233
|
const c = company;
|
|
1234
1234
|
builder.addResource(c["ownerResourceID"]);
|
|
1235
1235
|
builder.addResource(c["createdByResourceID"]);
|
|
@@ -1246,20 +1246,20 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1246
1246
|
builder.addResource(r["creatorResourceID"]);
|
|
1247
1247
|
builder.addFk("contract", r["contractID"]);
|
|
1248
1248
|
}
|
|
1249
|
-
const names = await
|
|
1249
|
+
const names = await _chunkYKEX4SK7cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
1250
1250
|
const companyRow = { ...company };
|
|
1251
|
-
|
|
1252
|
-
|
|
1251
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
|
|
1252
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
|
|
1253
1253
|
result.company = companyRow;
|
|
1254
1254
|
result.openTickets = {
|
|
1255
1255
|
...openTickets,
|
|
1256
1256
|
items: openTickets.items.map((row) => {
|
|
1257
1257
|
const r = { ...row };
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
for (const f of
|
|
1258
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1259
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1260
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
1261
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
1262
|
+
for (const f of _chunkYKEX4SK7cjs.TICKET_LABEL_FIELDS) _chunkYKEX4SK7cjs.addLabelSibling.call(void 0, r, f, names);
|
|
1263
1263
|
return r;
|
|
1264
1264
|
})
|
|
1265
1265
|
};
|
|
@@ -1267,9 +1267,9 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1267
1267
|
...result.projects,
|
|
1268
1268
|
items: result.projects.items.map((row) => {
|
|
1269
1269
|
const r = { ...row };
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1270
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
|
|
1271
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1272
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1273
1273
|
return r;
|
|
1274
1274
|
})
|
|
1275
1275
|
};
|
|
@@ -1301,7 +1301,7 @@ function isDateYMD(v) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
function validateUnbilledWorkOptions(companyId, opts) {
|
|
1303
1303
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1304
|
-
throw new (0,
|
|
1304
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
1305
1305
|
`unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
1306
1306
|
{ operation: "companies.unbilledWork" }
|
|
1307
1307
|
);
|
|
@@ -1330,7 +1330,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1330
1330
|
try {
|
|
1331
1331
|
limit = clampLimit(opts.limit);
|
|
1332
1332
|
} catch (err) {
|
|
1333
|
-
problems.push(err instanceof
|
|
1333
|
+
problems.push(err instanceof _chunkYKEX4SK7cjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
1334
1334
|
limit = 50;
|
|
1335
1335
|
}
|
|
1336
1336
|
if (source === "date_range") {
|
|
@@ -1345,9 +1345,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1345
1345
|
problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
|
|
1346
1346
|
} else {
|
|
1347
1347
|
try {
|
|
1348
|
-
|
|
1348
|
+
_chunkYKEX4SK7cjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
|
|
1349
1349
|
} catch (err) {
|
|
1350
|
-
problems.push(err instanceof
|
|
1350
|
+
problems.push(err instanceof _chunkYKEX4SK7cjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
@@ -1357,20 +1357,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1357
1357
|
} else {
|
|
1358
1358
|
opts.ticketIds.forEach((tid, i) => {
|
|
1359
1359
|
try {
|
|
1360
|
-
|
|
1360
|
+
_chunkYKEX4SK7cjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
|
|
1361
1361
|
} catch (err) {
|
|
1362
|
-
problems.push(err instanceof
|
|
1362
|
+
problems.push(err instanceof _chunkYKEX4SK7cjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
|
|
1363
1363
|
}
|
|
1364
1364
|
});
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
try {
|
|
1368
|
-
|
|
1368
|
+
_chunkYKEX4SK7cjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1369
1369
|
} catch (err) {
|
|
1370
|
-
problems.push(err instanceof
|
|
1370
|
+
problems.push(err instanceof _chunkYKEX4SK7cjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
|
|
1371
1371
|
}
|
|
1372
1372
|
if (problems.length > 0) {
|
|
1373
|
-
throw new (0,
|
|
1373
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
1374
1374
|
`unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
1375
1375
|
- ` + problems.join("\n- "),
|
|
1376
1376
|
{ operation: "companies.unbilledWork" }
|
|
@@ -1399,7 +1399,7 @@ async function boundedPart(http, path, conditions, limit, includeFields) {
|
|
|
1399
1399
|
body,
|
|
1400
1400
|
operation: "companies.unbilledWork"
|
|
1401
1401
|
});
|
|
1402
|
-
const { items, pageDetails } =
|
|
1402
|
+
const { items, pageDetails } = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, "companies.unbilledWork");
|
|
1403
1403
|
const capped = items.length >= limit;
|
|
1404
1404
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
1405
1405
|
}
|
|
@@ -1410,7 +1410,7 @@ function capJoinSet(ids, cap) {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
function unbilledWorkPartStatus(key, conditions, items) {
|
|
1412
1412
|
if (items.length !== 0) return { status: "ok" };
|
|
1413
|
-
const stamp =
|
|
1413
|
+
const stamp = _chunkYKEX4SK7cjs.blindStampFor.call(void 0, _optionalChain([_chunkYKEX4SK7cjs.BLIND_SURFACE_STAMPS, 'access', _18 => _18[key], 'optionalAccess', _19 => _19.query]), conditions);
|
|
1414
1414
|
if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
|
|
1415
1415
|
return {
|
|
1416
1416
|
status: "ok",
|
|
@@ -1419,7 +1419,7 @@ function unbilledWorkPartStatus(key, conditions, items) {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
1421
1421
|
const v = validateUnbilledWorkOptions(companyId, opts);
|
|
1422
|
-
const id =
|
|
1422
|
+
const id = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1423
1423
|
const company = await resource.get(id);
|
|
1424
1424
|
const companyIds = [num(company.id)];
|
|
1425
1425
|
let parent = null;
|
|
@@ -1432,7 +1432,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1432
1432
|
parentStatus = "ok";
|
|
1433
1433
|
companyIds.push(num(parent.id));
|
|
1434
1434
|
} catch (err) {
|
|
1435
|
-
if (err instanceof
|
|
1435
|
+
if (err instanceof _chunkYKEX4SK7cjs.NotFoundError) parent = null;
|
|
1436
1436
|
else throw err;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
@@ -1464,7 +1464,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1464
1464
|
if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
|
|
1465
1465
|
if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
|
|
1466
1466
|
}
|
|
1467
|
-
const billingFields =
|
|
1467
|
+
const billingFields = _chunkYKEX4SK7cjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
|
|
1468
1468
|
const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
|
|
1469
1469
|
const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, billingIncludeFields);
|
|
1470
1470
|
const taskCap = capJoinSet(taskIds, UNBILLED_WORK_JOIN_SET_CAP);
|
|
@@ -1496,7 +1496,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1496
1496
|
let cappedItems = entries;
|
|
1497
1497
|
let noteCharsTruncated = 0;
|
|
1498
1498
|
if (v.includeNotes) {
|
|
1499
|
-
[cappedItems, noteCharsTruncated] =
|
|
1499
|
+
[cappedItems, noteCharsTruncated] = _chunkYKEX4SK7cjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
|
|
1500
1500
|
}
|
|
1501
1501
|
const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
|
|
1502
1502
|
timePart = {
|
|
@@ -1511,8 +1511,8 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1511
1511
|
let billingItems = billingRaw.items;
|
|
1512
1512
|
let billingNoteCharsTruncated = 0;
|
|
1513
1513
|
if (v.includeNotes) {
|
|
1514
|
-
const noteFields = (_nullishCoalesce(
|
|
1515
|
-
[billingItems, billingNoteCharsTruncated] =
|
|
1514
|
+
const noteFields = (_nullishCoalesce(_chunkYKEX4SK7cjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
|
|
1515
|
+
[billingItems, billingNoteCharsTruncated] = _chunkYKEX4SK7cjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
|
|
1516
1516
|
}
|
|
1517
1517
|
const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
|
|
1518
1518
|
const billingItemsPart = {
|
|
@@ -1609,7 +1609,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
|
|
1611
1611
|
// src/resources/companies.ts
|
|
1612
|
-
var CompaniesResource = class extends
|
|
1612
|
+
var CompaniesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1613
1613
|
constructor(http, pageSize) {
|
|
1614
1614
|
super(http, {
|
|
1615
1615
|
key: "companies",
|
|
@@ -1716,7 +1716,7 @@ var CompaniesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
1716
1716
|
};
|
|
1717
1717
|
|
|
1718
1718
|
// src/resources/company_alerts.ts
|
|
1719
|
-
var CompanyAlertsResource = class extends
|
|
1719
|
+
var CompanyAlertsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1720
1720
|
constructor(http, pageSize) {
|
|
1721
1721
|
super(http, {
|
|
1722
1722
|
key: "company_alerts",
|
|
@@ -1782,7 +1782,7 @@ var CompanyAlertsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
|
|
1784
1784
|
// src/resources/company_locations.ts
|
|
1785
|
-
var CompanyLocationsResource = class extends
|
|
1785
|
+
var CompanyLocationsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1786
1786
|
constructor(http, pageSize) {
|
|
1787
1787
|
super(http, {
|
|
1788
1788
|
key: "company_locations",
|
|
@@ -1853,7 +1853,7 @@ var CompanyLocationsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
1853
1853
|
};
|
|
1854
1854
|
|
|
1855
1855
|
// src/resources/company_notes.ts
|
|
1856
|
-
var CompanyNotesResource = class extends
|
|
1856
|
+
var CompanyNotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1857
1857
|
constructor(http, pageSize) {
|
|
1858
1858
|
super(http, {
|
|
1859
1859
|
key: "company_notes",
|
|
@@ -1918,7 +1918,7 @@ var CompanyNotesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
1918
1918
|
};
|
|
1919
1919
|
|
|
1920
1920
|
// src/resources/company_site_configurations.ts
|
|
1921
|
-
var CompanySiteConfigurationsResource = class extends
|
|
1921
|
+
var CompanySiteConfigurationsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1922
1922
|
constructor(http, pageSize) {
|
|
1923
1923
|
super(http, {
|
|
1924
1924
|
key: "company_site_configurations",
|
|
@@ -1969,7 +1969,7 @@ var CompanySiteConfigurationsResource = class extends _chunkWTVLHMZAcjs.BaseReso
|
|
|
1969
1969
|
};
|
|
1970
1970
|
|
|
1971
1971
|
// src/resources/company_webhooks.ts
|
|
1972
|
-
var CompanyWebhooksResource = class extends
|
|
1972
|
+
var CompanyWebhooksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
1973
1973
|
constructor(http, pageSize) {
|
|
1974
1974
|
super(http, {
|
|
1975
1975
|
key: "company_webhooks",
|
|
@@ -2045,7 +2045,7 @@ var CompanyWebhooksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
2045
2045
|
};
|
|
2046
2046
|
|
|
2047
2047
|
// src/resources/configuration_item_billing_product_associations.ts
|
|
2048
|
-
var ConfigurationItemBillingProductAssociationsResource = class extends
|
|
2048
|
+
var ConfigurationItemBillingProductAssociationsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2049
2049
|
constructor(http, pageSize) {
|
|
2050
2050
|
super(http, {
|
|
2051
2051
|
key: "configuration_item_billing_product_associations",
|
|
@@ -2111,7 +2111,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkWT
|
|
|
2111
2111
|
};
|
|
2112
2112
|
|
|
2113
2113
|
// src/resources/configuration_item_categories.ts
|
|
2114
|
-
var ConfigurationItemCategoriesResource = class extends
|
|
2114
|
+
var ConfigurationItemCategoriesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2115
2115
|
constructor(http, pageSize) {
|
|
2116
2116
|
super(http, {
|
|
2117
2117
|
key: "configuration_item_categories",
|
|
@@ -2178,7 +2178,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkWTVLHMZAcjs.BaseRe
|
|
|
2178
2178
|
};
|
|
2179
2179
|
|
|
2180
2180
|
// src/resources/configuration_item_category_udf_associations.ts
|
|
2181
|
-
var ConfigurationItemCategoryUdfAssociationsResource = class extends
|
|
2181
|
+
var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2182
2182
|
constructor(http, pageSize) {
|
|
2183
2183
|
super(http, {
|
|
2184
2184
|
key: "configuration_item_category_udf_associations",
|
|
@@ -2244,7 +2244,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkWTVLH
|
|
|
2244
2244
|
};
|
|
2245
2245
|
|
|
2246
2246
|
// src/resources/configuration_item_dns_records.ts
|
|
2247
|
-
var ConfigurationItemDnsRecordsResource = class extends
|
|
2247
|
+
var ConfigurationItemDnsRecordsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2248
2248
|
constructor(http, pageSize) {
|
|
2249
2249
|
super(http, {
|
|
2250
2250
|
key: "configuration_item_dns_records",
|
|
@@ -2293,7 +2293,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkWTVLHMZAcjs.BaseRe
|
|
|
2293
2293
|
};
|
|
2294
2294
|
|
|
2295
2295
|
// src/resources/configuration_item_notes.ts
|
|
2296
|
-
var ConfigurationItemNotesResource = class extends
|
|
2296
|
+
var ConfigurationItemNotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2297
2297
|
constructor(http, pageSize) {
|
|
2298
2298
|
super(http, {
|
|
2299
2299
|
key: "configuration_item_notes",
|
|
@@ -2352,7 +2352,7 @@ var ConfigurationItemNotesResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
2352
2352
|
};
|
|
2353
2353
|
|
|
2354
2354
|
// src/resources/configuration_item_related_items.ts
|
|
2355
|
-
var ConfigurationItemRelatedItemsResource = class extends
|
|
2355
|
+
var ConfigurationItemRelatedItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2356
2356
|
constructor(http, pageSize) {
|
|
2357
2357
|
super(http, {
|
|
2358
2358
|
key: "configuration_item_related_items",
|
|
@@ -2413,16 +2413,16 @@ async function fetchRecord(http, path, label) {
|
|
|
2413
2413
|
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem" });
|
|
2414
2414
|
const body = res;
|
|
2415
2415
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
2416
|
-
throw new (0,
|
|
2416
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
2417
2417
|
}
|
|
2418
2418
|
return body.item;
|
|
2419
2419
|
}
|
|
2420
2420
|
async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
2421
|
-
const numericSource =
|
|
2421
|
+
const numericSource = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, sourceId, "sourceId");
|
|
2422
2422
|
if (_optionalChain([opts, 'optionalAccess', _20 => _20.destinationCompanyId]) === void 0) {
|
|
2423
|
-
throw new (0,
|
|
2423
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
|
|
2424
2424
|
}
|
|
2425
|
-
const destId =
|
|
2425
|
+
const destId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
|
|
2426
2426
|
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`);
|
|
2427
2427
|
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`);
|
|
2428
2428
|
const body = { ...source };
|
|
@@ -2432,20 +2432,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2432
2432
|
body.companyID = destId;
|
|
2433
2433
|
body.isActive = true;
|
|
2434
2434
|
if (opts.newReferenceTitle !== void 0) {
|
|
2435
|
-
if (opts.newReferenceTitle.trim() === "") throw new (0,
|
|
2435
|
+
if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
|
|
2436
2436
|
body.referenceTitle = opts.newReferenceTitle.trim();
|
|
2437
2437
|
}
|
|
2438
2438
|
if (opts.lastModifiedDate !== void 0) {
|
|
2439
2439
|
const current = source.lastModifiedDate;
|
|
2440
2440
|
if (current !== opts.lastModifiedDate) {
|
|
2441
|
-
throw new (0,
|
|
2441
|
+
throw new (0, _chunkYKEX4SK7cjs.StaleObjectError)(
|
|
2442
2442
|
`moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
|
|
2443
2443
|
{ operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource] }
|
|
2444
2444
|
);
|
|
2445
2445
|
}
|
|
2446
2446
|
}
|
|
2447
2447
|
if (opts.dryRun === true) {
|
|
2448
|
-
return
|
|
2448
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
2449
2449
|
operation: "configuration_items.moveConfigurationItem",
|
|
2450
2450
|
method: "POST",
|
|
2451
2451
|
path: "/V1.0/ConfigurationItems",
|
|
@@ -2469,7 +2469,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2469
2469
|
const createdBody = created;
|
|
2470
2470
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
2471
2471
|
if (typeof newId !== "number") {
|
|
2472
|
-
throw new (0,
|
|
2472
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
|
|
2473
2473
|
}
|
|
2474
2474
|
let sourceDeactivated = false;
|
|
2475
2475
|
if (opts.deactivateSource !== false) {
|
|
@@ -2487,7 +2487,7 @@ var PROFILE_PART_LIMIT2 = 50;
|
|
|
2487
2487
|
function profilePartLimit2(value, name) {
|
|
2488
2488
|
const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
|
|
2489
2489
|
if (!Number.isInteger(n) || n < 1) {
|
|
2490
|
-
throw new (0,
|
|
2490
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
2491
2491
|
}
|
|
2492
2492
|
return n;
|
|
2493
2493
|
}
|
|
@@ -2503,14 +2503,14 @@ async function contextFetchPart(http, entityPath, referenceId) {
|
|
|
2503
2503
|
});
|
|
2504
2504
|
const body = res;
|
|
2505
2505
|
if (body === null || !("item" in body)) {
|
|
2506
|
-
throw new (0,
|
|
2506
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId] });
|
|
2507
2507
|
}
|
|
2508
2508
|
if (body.item === null || body.item === void 0) {
|
|
2509
|
-
throw new (0,
|
|
2509
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)("context part not found", { resourceIds: [referenceId] });
|
|
2510
2510
|
}
|
|
2511
2511
|
return body.item;
|
|
2512
2512
|
} catch (err) {
|
|
2513
|
-
if (err instanceof
|
|
2513
|
+
if (err instanceof _chunkYKEX4SK7cjs.NotFoundError) return null;
|
|
2514
2514
|
throw err;
|
|
2515
2515
|
}
|
|
2516
2516
|
}
|
|
@@ -2522,7 +2522,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
|
|
|
2522
2522
|
body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
|
|
2523
2523
|
operation: "configuration_items.profile"
|
|
2524
2524
|
});
|
|
2525
|
-
return
|
|
2525
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
2526
2526
|
}
|
|
2527
2527
|
async function profile(resource, id, opts = {}, http) {
|
|
2528
2528
|
const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
|
|
@@ -2534,7 +2534,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2534
2534
|
const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
|
|
2535
2535
|
const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
|
|
2536
2536
|
const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
|
|
2537
|
-
const wallQuirk = _optionalChain([
|
|
2537
|
+
const wallQuirk = _optionalChain([_chunkYKEX4SK7cjs.RELATIONSHIP_MAP, 'access', _21 => _21["configuration_items"], 'optionalAccess', _22 => _22.zoneFacts, 'optionalAccess', _23 => _23.quirks, 'optionalAccess', _24 => _24.find, 'call', _25 => _25((q) => q.startsWith("product wall"))]);
|
|
2538
2538
|
const productAssociations = {
|
|
2539
2539
|
items: associations,
|
|
2540
2540
|
capped: associations.length >= PROFILE_PART_LIMIT2,
|
|
@@ -2558,11 +2558,11 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
};
|
|
2560
2560
|
if (opts.names === true) {
|
|
2561
|
-
const builder =
|
|
2561
|
+
const builder = _chunkYKEX4SK7cjs.createNamePlan.call(void 0, );
|
|
2562
2562
|
builder.addFk("contract", root["contractID"]);
|
|
2563
|
-
const names = await
|
|
2563
|
+
const names = await _chunkYKEX4SK7cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
2564
2564
|
const ciRow = { ...ci };
|
|
2565
|
-
|
|
2565
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
|
|
2566
2566
|
result.ci = ciRow;
|
|
2567
2567
|
result.names = names.section;
|
|
2568
2568
|
}
|
|
@@ -2570,7 +2570,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2570
2570
|
}
|
|
2571
2571
|
|
|
2572
2572
|
// src/resources/configuration_items.ts
|
|
2573
|
-
var ConfigurationItemsResource = class extends
|
|
2573
|
+
var ConfigurationItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2574
2574
|
constructor(http, pageSize) {
|
|
2575
2575
|
super(http, {
|
|
2576
2576
|
key: "configuration_items",
|
|
@@ -2659,7 +2659,7 @@ var ConfigurationItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
2659
2659
|
};
|
|
2660
2660
|
|
|
2661
2661
|
// src/resources/configuration_item_ssl_subject_alternative_names.ts
|
|
2662
|
-
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends
|
|
2662
|
+
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2663
2663
|
constructor(http, pageSize) {
|
|
2664
2664
|
super(http, {
|
|
2665
2665
|
key: "configuration_item_ssl_subject_alternative_names",
|
|
@@ -2722,7 +2722,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkWT
|
|
|
2722
2722
|
};
|
|
2723
2723
|
|
|
2724
2724
|
// src/resources/configuration_item_types.ts
|
|
2725
|
-
var ConfigurationItemTypesResource = class extends
|
|
2725
|
+
var ConfigurationItemTypesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2726
2726
|
constructor(http, pageSize) {
|
|
2727
2727
|
super(http, {
|
|
2728
2728
|
key: "configuration_item_types",
|
|
@@ -2796,7 +2796,7 @@ var ConfigurationItemTypesResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
2796
2796
|
};
|
|
2797
2797
|
|
|
2798
2798
|
// src/resources/configuration_item_webhooks.ts
|
|
2799
|
-
var ConfigurationItemWebhooksResource = class extends
|
|
2799
|
+
var ConfigurationItemWebhooksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2800
2800
|
constructor(http, pageSize) {
|
|
2801
2801
|
super(http, {
|
|
2802
2802
|
key: "configuration_item_webhooks",
|
|
@@ -2872,7 +2872,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkWTVLHMZAcjs.BaseReso
|
|
|
2872
2872
|
};
|
|
2873
2873
|
|
|
2874
2874
|
// src/resources/contact_group_contacts.ts
|
|
2875
|
-
var ContactGroupContactsResource = class extends
|
|
2875
|
+
var ContactGroupContactsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2876
2876
|
constructor(http, pageSize) {
|
|
2877
2877
|
super(http, {
|
|
2878
2878
|
key: "contact_group_contacts",
|
|
@@ -2926,7 +2926,7 @@ var ContactGroupContactsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
2926
2926
|
};
|
|
2927
2927
|
|
|
2928
2928
|
// src/resources/contact_groups.ts
|
|
2929
|
-
var ContactGroupsResource = class extends
|
|
2929
|
+
var ContactGroupsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
2930
2930
|
constructor(http, pageSize) {
|
|
2931
2931
|
super(http, {
|
|
2932
2932
|
key: "contact_groups",
|
|
@@ -3004,22 +3004,22 @@ async function fetchRecord2(http, path, label) {
|
|
|
3004
3004
|
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany" });
|
|
3005
3005
|
const body = res;
|
|
3006
3006
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
3007
|
-
throw new (0,
|
|
3007
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
3008
3008
|
}
|
|
3009
3009
|
return body.item;
|
|
3010
3010
|
}
|
|
3011
3011
|
async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
|
|
3012
|
-
const sourceId =
|
|
3013
|
-
const destId =
|
|
3012
|
+
const sourceId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
|
|
3013
|
+
const destId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
|
|
3014
3014
|
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`);
|
|
3015
3015
|
const companyID = source.companyID;
|
|
3016
3016
|
if (typeof companyID !== "number" || companyID < 0) {
|
|
3017
|
-
throw new (0,
|
|
3017
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
|
|
3018
3018
|
}
|
|
3019
3019
|
if (opts.lastModifiedDate !== void 0) {
|
|
3020
3020
|
const current = source.lastModifiedDate;
|
|
3021
3021
|
if (current !== opts.lastModifiedDate) {
|
|
3022
|
-
throw new (0,
|
|
3022
|
+
throw new (0, _chunkYKEX4SK7cjs.StaleObjectError)(
|
|
3023
3023
|
`moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
|
|
3024
3024
|
{ operation: "contacts.moveToCompany", resourceIds: [sourceId, destId] }
|
|
3025
3025
|
);
|
|
@@ -3041,10 +3041,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3041
3041
|
},
|
|
3042
3042
|
operation: "contacts.moveToCompany"
|
|
3043
3043
|
});
|
|
3044
|
-
const items =
|
|
3044
|
+
const items = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
3045
3045
|
const clash = items.find((c) => String(c.id) !== String(sourceId));
|
|
3046
3046
|
if (clash !== void 0) {
|
|
3047
|
-
throw new (0,
|
|
3047
|
+
throw new (0, _chunkYKEX4SK7cjs.ConflictError)(
|
|
3048
3048
|
`Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
|
|
3049
3049
|
{ resourceIds: [sourceId, destId] }
|
|
3050
3050
|
);
|
|
@@ -3058,7 +3058,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3058
3058
|
if (opts.dryRun === true) {
|
|
3059
3059
|
const warnings = [];
|
|
3060
3060
|
if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
|
|
3061
|
-
return
|
|
3061
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
3062
3062
|
operation: "contacts.moveToCompany",
|
|
3063
3063
|
method: "POST",
|
|
3064
3064
|
path: `/V1.0/Companies/${destId}/Contacts`,
|
|
@@ -3083,7 +3083,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3083
3083
|
const createdBody = created;
|
|
3084
3084
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
3085
3085
|
if (typeof newId !== "number") {
|
|
3086
|
-
throw new (0,
|
|
3086
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
|
|
3087
3087
|
}
|
|
3088
3088
|
let sourceDeleted = false;
|
|
3089
3089
|
if (opts.deleteSource === true) {
|
|
@@ -3101,7 +3101,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
|
|
|
3101
3101
|
var EMAIL_SHAPE = /^.+@.+/;
|
|
3102
3102
|
var SAFE_CONTACT_CREATE_DEFAULTS = {};
|
|
3103
3103
|
var DEDUP_LIMIT = 10;
|
|
3104
|
-
var CompanyNotFoundError = class extends
|
|
3104
|
+
var CompanyNotFoundError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
3105
3105
|
constructor(message, options = {}) {
|
|
3106
3106
|
super(message, {
|
|
3107
3107
|
code: "COMPANY_NOT_FOUND",
|
|
@@ -3112,7 +3112,7 @@ var CompanyNotFoundError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
3112
3112
|
this.name = "CompanyNotFoundError";
|
|
3113
3113
|
}
|
|
3114
3114
|
};
|
|
3115
|
-
var ContactCreateFailedError = class extends
|
|
3115
|
+
var ContactCreateFailedError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
3116
3116
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
3117
3117
|
|
|
3118
3118
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -3122,25 +3122,25 @@ var ContactCreateFailedError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
};
|
|
3124
3124
|
async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
3125
|
-
const cid =
|
|
3125
|
+
const cid = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, companyID, "companyID");
|
|
3126
3126
|
if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
|
|
3127
|
-
throw new (0,
|
|
3127
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
3128
3128
|
`upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
|
|
3129
3129
|
{ operation: OP_UPSERT_EMAIL }
|
|
3130
3130
|
);
|
|
3131
3131
|
}
|
|
3132
3132
|
if (extra !== void 0) {
|
|
3133
3133
|
if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
|
|
3134
|
-
throw new (0,
|
|
3134
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
3135
3135
|
`upsertByEmail: extra.isActive must be a boolean (mapped to the zone-correct number 1/0) or a raw 0/1 number (got ${String(extra.isActive)})`,
|
|
3136
3136
|
{ operation: OP_UPSERT_EMAIL }
|
|
3137
3137
|
);
|
|
3138
3138
|
}
|
|
3139
3139
|
if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
|
|
3140
|
-
throw new (0,
|
|
3140
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("upsertByEmail: extra.firstName must be a non-empty string (or omitted \u2014 the node defaults it to the email local-part)", { operation: OP_UPSERT_EMAIL });
|
|
3141
3141
|
}
|
|
3142
3142
|
if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
|
|
3143
|
-
throw new (0,
|
|
3143
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
|
|
3144
3144
|
}
|
|
3145
3145
|
}
|
|
3146
3146
|
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL });
|
|
@@ -3161,7 +3161,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3161
3161
|
const match = q.items[0];
|
|
3162
3162
|
if (match !== void 0) {
|
|
3163
3163
|
if (opts.dryRun === true) {
|
|
3164
|
-
return
|
|
3164
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
3165
3165
|
{
|
|
3166
3166
|
operation: OP_UPSERT_EMAIL,
|
|
3167
3167
|
method: "POST",
|
|
@@ -3191,7 +3191,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3191
3191
|
isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
|
|
3192
3192
|
};
|
|
3193
3193
|
if (opts.dryRun === true) {
|
|
3194
|
-
return
|
|
3194
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
3195
3195
|
{
|
|
3196
3196
|
operation: OP_UPSERT_EMAIL,
|
|
3197
3197
|
method: "POST",
|
|
@@ -3214,8 +3214,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3214
3214
|
const created = await resource.create(cid, body, {});
|
|
3215
3215
|
return { id: created.id, created: true };
|
|
3216
3216
|
} catch (err) {
|
|
3217
|
-
if (!
|
|
3218
|
-
const named = (_nullishCoalesce(
|
|
3217
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
3218
|
+
const named = (_nullishCoalesce(_chunkYKEX4SK7cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
3219
3219
|
const seen = /* @__PURE__ */ new Set();
|
|
3220
3220
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
3221
3221
|
const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -3229,7 +3229,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3229
3229
|
}
|
|
3230
3230
|
continue;
|
|
3231
3231
|
}
|
|
3232
|
-
const detail =
|
|
3232
|
+
const detail = _chunkYKEX4SK7cjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
3233
3233
|
throw new ContactCreateFailedError(
|
|
3234
3234
|
`upsertByEmail: the vendor rejected the contact create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
|
|
3235
3235
|
unique,
|
|
@@ -3245,7 +3245,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3245
3245
|
}
|
|
3246
3246
|
|
|
3247
3247
|
// src/resources/contacts.ts
|
|
3248
|
-
var ContactsResource = class extends
|
|
3248
|
+
var ContactsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3249
3249
|
constructor(http, pageSize) {
|
|
3250
3250
|
super(http, {
|
|
3251
3251
|
key: "contacts",
|
|
@@ -3337,7 +3337,7 @@ var ContactsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
3337
3337
|
};
|
|
3338
3338
|
|
|
3339
3339
|
// src/resources/contact_webhooks.ts
|
|
3340
|
-
var ContactWebhooksResource = class extends
|
|
3340
|
+
var ContactWebhooksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3341
3341
|
constructor(http, pageSize) {
|
|
3342
3342
|
super(http, {
|
|
3343
3343
|
key: "contact_webhooks",
|
|
@@ -3413,7 +3413,7 @@ var ContactWebhooksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
3413
3413
|
};
|
|
3414
3414
|
|
|
3415
3415
|
// src/resources/contract_billing_rules.ts
|
|
3416
|
-
var ContractBillingRulesResource = class extends
|
|
3416
|
+
var ContractBillingRulesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3417
3417
|
constructor(http, pageSize) {
|
|
3418
3418
|
super(http, {
|
|
3419
3419
|
key: "contract_billing_rules",
|
|
@@ -3479,7 +3479,7 @@ var ContractBillingRulesResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
3479
3479
|
};
|
|
3480
3480
|
|
|
3481
3481
|
// src/resources/contract_block_hour_factors.ts
|
|
3482
|
-
var ContractBlockHourFactorsResource = class extends
|
|
3482
|
+
var ContractBlockHourFactorsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3483
3483
|
constructor(http, pageSize) {
|
|
3484
3484
|
super(http, {
|
|
3485
3485
|
key: "contract_block_hour_factors",
|
|
@@ -3538,7 +3538,7 @@ var ContractBlockHourFactorsResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
3538
3538
|
};
|
|
3539
3539
|
|
|
3540
3540
|
// src/resources/contract_blocks.ts
|
|
3541
|
-
var ContractBlocksResource = class extends
|
|
3541
|
+
var ContractBlocksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3542
3542
|
constructor(http, pageSize) {
|
|
3543
3543
|
super(http, {
|
|
3544
3544
|
key: "contract_blocks",
|
|
@@ -3597,7 +3597,7 @@ var ContractBlocksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
3597
3597
|
};
|
|
3598
3598
|
|
|
3599
3599
|
// src/resources/contract_charges.ts
|
|
3600
|
-
var ContractChargesResource = class extends
|
|
3600
|
+
var ContractChargesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3601
3601
|
constructor(http, pageSize) {
|
|
3602
3602
|
super(http, {
|
|
3603
3603
|
key: "contract_charges",
|
|
@@ -3668,7 +3668,7 @@ var ContractChargesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
3668
3668
|
};
|
|
3669
3669
|
|
|
3670
3670
|
// src/resources/contract_exclusion_billing_codes.ts
|
|
3671
|
-
var ContractExclusionBillingCodesResource = class extends
|
|
3671
|
+
var ContractExclusionBillingCodesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3672
3672
|
constructor(http, pageSize) {
|
|
3673
3673
|
super(http, {
|
|
3674
3674
|
key: "contract_exclusion_billing_codes",
|
|
@@ -3725,7 +3725,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkWTVLHMZAcjs.Base
|
|
|
3725
3725
|
};
|
|
3726
3726
|
|
|
3727
3727
|
// src/resources/contract_exclusion_roles.ts
|
|
3728
|
-
var ContractExclusionRolesResource = class extends
|
|
3728
|
+
var ContractExclusionRolesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3729
3729
|
constructor(http, pageSize) {
|
|
3730
3730
|
super(http, {
|
|
3731
3731
|
key: "contract_exclusion_roles",
|
|
@@ -3782,7 +3782,7 @@ var ContractExclusionRolesResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
3782
3782
|
};
|
|
3783
3783
|
|
|
3784
3784
|
// src/resources/contract_exclusion_set_excluded_roles.ts
|
|
3785
|
-
var ContractExclusionSetExcludedRolesResource = class extends
|
|
3785
|
+
var ContractExclusionSetExcludedRolesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3786
3786
|
constructor(http, pageSize) {
|
|
3787
3787
|
super(http, {
|
|
3788
3788
|
key: "contract_exclusion_set_excluded_roles",
|
|
@@ -3839,7 +3839,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkWTVLHMZAcjs.
|
|
|
3839
3839
|
};
|
|
3840
3840
|
|
|
3841
3841
|
// src/resources/contract_exclusion_set_excluded_work_types.ts
|
|
3842
|
-
var ContractExclusionSetExcludedWorkTypesResource = class extends
|
|
3842
|
+
var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3843
3843
|
constructor(http, pageSize) {
|
|
3844
3844
|
super(http, {
|
|
3845
3845
|
key: "contract_exclusion_set_excluded_work_types",
|
|
@@ -3896,7 +3896,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkWTVLHMZA
|
|
|
3896
3896
|
};
|
|
3897
3897
|
|
|
3898
3898
|
// src/resources/contract_exclusion_sets.ts
|
|
3899
|
-
var ContractExclusionSetsResource = class extends
|
|
3899
|
+
var ContractExclusionSetsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3900
3900
|
constructor(http, pageSize) {
|
|
3901
3901
|
super(http, {
|
|
3902
3902
|
key: "contract_exclusion_sets",
|
|
@@ -3970,7 +3970,7 @@ var ContractExclusionSetsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
3970
3970
|
};
|
|
3971
3971
|
|
|
3972
3972
|
// src/resources/contract_milestones.ts
|
|
3973
|
-
var ContractMilestonesResource = class extends
|
|
3973
|
+
var ContractMilestonesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
3974
3974
|
constructor(http, pageSize) {
|
|
3975
3975
|
super(http, {
|
|
3976
3976
|
key: "contract_milestones",
|
|
@@ -4029,7 +4029,7 @@ var ContractMilestonesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4029
4029
|
};
|
|
4030
4030
|
|
|
4031
4031
|
// src/resources/contract_notes.ts
|
|
4032
|
-
var ContractNotesResource = class extends
|
|
4032
|
+
var ContractNotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4033
4033
|
constructor(http, pageSize) {
|
|
4034
4034
|
super(http, {
|
|
4035
4035
|
key: "contract_notes",
|
|
@@ -4088,7 +4088,7 @@ var ContractNotesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4088
4088
|
};
|
|
4089
4089
|
|
|
4090
4090
|
// src/resources/contract_rates.ts
|
|
4091
|
-
var ContractRatesResource = class extends
|
|
4091
|
+
var ContractRatesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4092
4092
|
constructor(http, pageSize) {
|
|
4093
4093
|
super(http, {
|
|
4094
4094
|
key: "contract_rates",
|
|
@@ -4147,7 +4147,7 @@ var ContractRatesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4147
4147
|
};
|
|
4148
4148
|
|
|
4149
4149
|
// src/resources/contract_retainers.ts
|
|
4150
|
-
var ContractRetainersResource = class extends
|
|
4150
|
+
var ContractRetainersResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4151
4151
|
constructor(http, pageSize) {
|
|
4152
4152
|
super(http, {
|
|
4153
4153
|
key: "contract_retainers",
|
|
@@ -4206,7 +4206,7 @@ var ContractRetainersResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4206
4206
|
};
|
|
4207
4207
|
|
|
4208
4208
|
// src/resources/contract_role_costs.ts
|
|
4209
|
-
var ContractRoleCostsResource = class extends
|
|
4209
|
+
var ContractRoleCostsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4210
4210
|
constructor(http, pageSize) {
|
|
4211
4211
|
super(http, {
|
|
4212
4212
|
key: "contract_role_costs",
|
|
@@ -4265,7 +4265,7 @@ var ContractRoleCostsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4265
4265
|
};
|
|
4266
4266
|
|
|
4267
4267
|
// src/resources/contract_service_adjustments.ts
|
|
4268
|
-
var ContractServiceAdjustmentsResource = class extends
|
|
4268
|
+
var ContractServiceAdjustmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4269
4269
|
constructor(http, pageSize) {
|
|
4270
4270
|
super(http, {
|
|
4271
4271
|
key: "contract_service_adjustments",
|
|
@@ -4299,7 +4299,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkWTVLHMZAcjs.BaseRes
|
|
|
4299
4299
|
};
|
|
4300
4300
|
|
|
4301
4301
|
// src/resources/contract_service_bundle_adjustments.ts
|
|
4302
|
-
var ContractServiceBundleAdjustmentsResource = class extends
|
|
4302
|
+
var ContractServiceBundleAdjustmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4303
4303
|
constructor(http, pageSize) {
|
|
4304
4304
|
super(http, {
|
|
4305
4305
|
key: "contract_service_bundle_adjustments",
|
|
@@ -4333,7 +4333,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkWTVLHMZAcjs.B
|
|
|
4333
4333
|
};
|
|
4334
4334
|
|
|
4335
4335
|
// src/resources/contract_service_bundles.ts
|
|
4336
|
-
var ContractServiceBundlesResource = class extends
|
|
4336
|
+
var ContractServiceBundlesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4337
4337
|
constructor(http, pageSize) {
|
|
4338
4338
|
super(http, {
|
|
4339
4339
|
key: "contract_service_bundles",
|
|
@@ -4392,7 +4392,7 @@ var ContractServiceBundlesResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
4392
4392
|
};
|
|
4393
4393
|
|
|
4394
4394
|
// src/resources/contract_service_bundle_units.ts
|
|
4395
|
-
var ContractServiceBundleUnitsResource = class extends
|
|
4395
|
+
var ContractServiceBundleUnitsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4396
4396
|
constructor(http, pageSize) {
|
|
4397
4397
|
super(http, {
|
|
4398
4398
|
key: "contract_service_bundle_units",
|
|
@@ -4434,7 +4434,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkWTVLHMZAcjs.BaseRes
|
|
|
4434
4434
|
};
|
|
4435
4435
|
|
|
4436
4436
|
// src/resources/contract_services.ts
|
|
4437
|
-
var ContractServicesResource = class extends
|
|
4437
|
+
var ContractServicesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4438
4438
|
constructor(http, pageSize) {
|
|
4439
4439
|
super(http, {
|
|
4440
4440
|
key: "contract_services",
|
|
@@ -4493,7 +4493,7 @@ var ContractServicesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4493
4493
|
};
|
|
4494
4494
|
|
|
4495
4495
|
// src/resources/contract_service_units.ts
|
|
4496
|
-
var ContractServiceUnitsResource = class extends
|
|
4496
|
+
var ContractServiceUnitsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4497
4497
|
constructor(http, pageSize) {
|
|
4498
4498
|
super(http, {
|
|
4499
4499
|
key: "contract_service_units",
|
|
@@ -4535,7 +4535,7 @@ var ContractServiceUnitsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
4535
4535
|
};
|
|
4536
4536
|
|
|
4537
4537
|
// src/resources/contracts.ts
|
|
4538
|
-
var ContractsResource = class extends
|
|
4538
|
+
var ContractsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4539
4539
|
constructor(http, pageSize) {
|
|
4540
4540
|
super(http, {
|
|
4541
4541
|
key: "contracts",
|
|
@@ -4602,7 +4602,7 @@ var ContractsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4602
4602
|
};
|
|
4603
4603
|
|
|
4604
4604
|
// src/resources/contract_ticket_purchases.ts
|
|
4605
|
-
var ContractTicketPurchasesResource = class extends
|
|
4605
|
+
var ContractTicketPurchasesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4606
4606
|
constructor(http, pageSize) {
|
|
4607
4607
|
super(http, {
|
|
4608
4608
|
key: "contract_ticket_purchases",
|
|
@@ -4661,7 +4661,7 @@ var ContractTicketPurchasesResource = class extends _chunkWTVLHMZAcjs.BaseResour
|
|
|
4661
4661
|
};
|
|
4662
4662
|
|
|
4663
4663
|
// src/resources/countries.ts
|
|
4664
|
-
var CountriesResource = class extends
|
|
4664
|
+
var CountriesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4665
4665
|
constructor(http, pageSize) {
|
|
4666
4666
|
super(http, {
|
|
4667
4667
|
key: "countries",
|
|
@@ -4720,7 +4720,7 @@ var CountriesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4720
4720
|
};
|
|
4721
4721
|
|
|
4722
4722
|
// src/resources/departments.ts
|
|
4723
|
-
var DepartmentsResource = class extends
|
|
4723
|
+
var DepartmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4724
4724
|
constructor(http, pageSize) {
|
|
4725
4725
|
super(http, {
|
|
4726
4726
|
key: "departments",
|
|
@@ -4787,7 +4787,7 @@ var DepartmentsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4787
4787
|
};
|
|
4788
4788
|
|
|
4789
4789
|
// src/resources/domain_registrars.ts
|
|
4790
|
-
var DomainRegistrarsResource = class extends
|
|
4790
|
+
var DomainRegistrarsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4791
4791
|
constructor(http, pageSize) {
|
|
4792
4792
|
super(http, {
|
|
4793
4793
|
key: "domain_registrars",
|
|
@@ -4870,7 +4870,7 @@ var EntityInformationResource = class {
|
|
|
4870
4870
|
};
|
|
4871
4871
|
|
|
4872
4872
|
// src/resources/expense_item_attachments.ts
|
|
4873
|
-
var ExpenseItemAttachmentsResource = class extends
|
|
4873
|
+
var ExpenseItemAttachmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4874
4874
|
constructor(http, pageSize) {
|
|
4875
4875
|
super(http, {
|
|
4876
4876
|
key: "expense_item_attachments",
|
|
@@ -4932,7 +4932,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
4932
4932
|
};
|
|
4933
4933
|
|
|
4934
4934
|
// src/resources/expense_items.ts
|
|
4935
|
-
var ExpenseItemsResource = class extends
|
|
4935
|
+
var ExpenseItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4936
4936
|
constructor(http, pageSize) {
|
|
4937
4937
|
super(http, {
|
|
4938
4938
|
key: "expense_items",
|
|
@@ -4991,7 +4991,7 @@ var ExpenseItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
4991
4991
|
};
|
|
4992
4992
|
|
|
4993
4993
|
// src/resources/expense_reports.ts
|
|
4994
|
-
var ExpenseReportsResource = class extends
|
|
4994
|
+
var ExpenseReportsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
4995
4995
|
constructor(http, pageSize) {
|
|
4996
4996
|
super(http, {
|
|
4997
4997
|
key: "expense_reports",
|
|
@@ -5058,7 +5058,7 @@ var ExpenseReportsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5058
5058
|
};
|
|
5059
5059
|
|
|
5060
5060
|
// src/resources/holiday_sets.ts
|
|
5061
|
-
var HolidaySetsResource = class extends
|
|
5061
|
+
var HolidaySetsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5062
5062
|
constructor(http, pageSize) {
|
|
5063
5063
|
super(http, {
|
|
5064
5064
|
key: "holiday_sets",
|
|
@@ -5127,7 +5127,7 @@ var HolidaySetsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5127
5127
|
};
|
|
5128
5128
|
|
|
5129
5129
|
// src/resources/holidays.ts
|
|
5130
|
-
var HolidaysResource = class extends
|
|
5130
|
+
var HolidaysResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5131
5131
|
constructor(http, pageSize) {
|
|
5132
5132
|
super(http, {
|
|
5133
5133
|
key: "holidays",
|
|
@@ -5199,10 +5199,10 @@ var PATH_SUFFIX = {
|
|
|
5199
5199
|
transfer: "StockedItemsTransfer"
|
|
5200
5200
|
};
|
|
5201
5201
|
async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
5202
|
-
const numericParent =
|
|
5202
|
+
const numericParent = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, parentId, "parentId");
|
|
5203
5203
|
const suffix = PATH_SUFFIX[kind];
|
|
5204
5204
|
if (opts.dryRun === true) {
|
|
5205
|
-
return
|
|
5205
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
5206
5206
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
5207
5207
|
method: "POST",
|
|
5208
5208
|
path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
|
|
@@ -5218,11 +5218,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
|
5218
5218
|
body: data,
|
|
5219
5219
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`
|
|
5220
5220
|
});
|
|
5221
|
-
return
|
|
5221
|
+
return _chunkYKEX4SK7cjs.unwrapOperation.call(void 0, res);
|
|
5222
5222
|
}
|
|
5223
5223
|
|
|
5224
5224
|
// src/resources/inventory_products.ts
|
|
5225
|
-
var InventoryProductsResource = class extends
|
|
5225
|
+
var InventoryProductsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5226
5226
|
constructor(http, pageSize) {
|
|
5227
5227
|
super(http, {
|
|
5228
5228
|
key: "inventory_products",
|
|
@@ -5304,7 +5304,7 @@ var InventoryProductsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5304
5304
|
|
|
5305
5305
|
// src/resources/special/invoices.ts
|
|
5306
5306
|
async function markup(_resource, id, format, http) {
|
|
5307
|
-
const numericId =
|
|
5307
|
+
const numericId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
5308
5308
|
const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
|
|
5309
5309
|
const res = await http.request({
|
|
5310
5310
|
method: "GET",
|
|
@@ -5313,7 +5313,7 @@ async function markup(_resource, id, format, http) {
|
|
|
5313
5313
|
});
|
|
5314
5314
|
const body = res;
|
|
5315
5315
|
if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
|
|
5316
|
-
throw new (0,
|
|
5316
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskError)(
|
|
5317
5317
|
`Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
|
|
5318
5318
|
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId] }
|
|
5319
5319
|
);
|
|
@@ -5321,13 +5321,13 @@ async function markup(_resource, id, format, http) {
|
|
|
5321
5321
|
return body.invoiceMarkup;
|
|
5322
5322
|
}
|
|
5323
5323
|
async function pdf(_resource, id, http) {
|
|
5324
|
-
const numericId =
|
|
5324
|
+
const numericId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
5325
5325
|
const res = await http.request({
|
|
5326
5326
|
method: "GET",
|
|
5327
5327
|
path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
|
|
5328
5328
|
operation: "invoices.pdf"
|
|
5329
5329
|
});
|
|
5330
|
-
return
|
|
5330
|
+
return _chunkYKEX4SK7cjs.decodeFileData.call(void 0, res);
|
|
5331
5331
|
}
|
|
5332
5332
|
async function windowQuery2(_resource, kind, http, opts) {
|
|
5333
5333
|
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _29 => _29.now]), () => ( /* @__PURE__ */ new Date()));
|
|
@@ -5358,7 +5358,7 @@ async function customRange2(_resource, from, to, http, opts) {
|
|
|
5358
5358
|
}
|
|
5359
5359
|
|
|
5360
5360
|
// src/resources/invoices.ts
|
|
5361
|
-
var InvoicesResource = class extends
|
|
5361
|
+
var InvoicesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5362
5362
|
constructor(http, pageSize) {
|
|
5363
5363
|
super(http, {
|
|
5364
5364
|
key: "invoices",
|
|
@@ -5488,7 +5488,7 @@ var ModulesResource = class {
|
|
|
5488
5488
|
};
|
|
5489
5489
|
|
|
5490
5490
|
// src/resources/notification_history.ts
|
|
5491
|
-
var NotificationHistoryResource = class extends
|
|
5491
|
+
var NotificationHistoryResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5492
5492
|
constructor(http, pageSize) {
|
|
5493
5493
|
super(http, {
|
|
5494
5494
|
key: "notification_history",
|
|
@@ -5527,7 +5527,7 @@ var NotificationHistoryResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5527
5527
|
};
|
|
5528
5528
|
|
|
5529
5529
|
// src/resources/opportunities.ts
|
|
5530
|
-
var OpportunitiesResource = class extends
|
|
5530
|
+
var OpportunitiesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5531
5531
|
constructor(http, pageSize) {
|
|
5532
5532
|
super(http, {
|
|
5533
5533
|
key: "opportunities",
|
|
@@ -5589,7 +5589,7 @@ var OpportunitiesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5589
5589
|
};
|
|
5590
5590
|
|
|
5591
5591
|
// src/resources/opportunity_attachments.ts
|
|
5592
|
-
var OpportunityAttachmentsResource = class extends
|
|
5592
|
+
var OpportunityAttachmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5593
5593
|
constructor(http, pageSize) {
|
|
5594
5594
|
super(http, {
|
|
5595
5595
|
key: "opportunity_attachments",
|
|
@@ -5651,7 +5651,7 @@ var OpportunityAttachmentsResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
5651
5651
|
};
|
|
5652
5652
|
|
|
5653
5653
|
// src/resources/opportunity_categories.ts
|
|
5654
|
-
var OpportunityCategoriesResource = class extends
|
|
5654
|
+
var OpportunityCategoriesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5655
5655
|
constructor(http, pageSize) {
|
|
5656
5656
|
super(http, {
|
|
5657
5657
|
key: "opportunity_categories",
|
|
@@ -5710,7 +5710,7 @@ var OpportunityCategoriesResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
5710
5710
|
};
|
|
5711
5711
|
|
|
5712
5712
|
// src/resources/phases.ts
|
|
5713
|
-
var PhasesResource = class extends
|
|
5713
|
+
var PhasesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5714
5714
|
constructor(http, pageSize) {
|
|
5715
5715
|
super(http, {
|
|
5716
5716
|
key: "phases",
|
|
@@ -5769,7 +5769,7 @@ var PhasesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5769
5769
|
};
|
|
5770
5770
|
|
|
5771
5771
|
// src/resources/products.ts
|
|
5772
|
-
var ProductsResource = class extends
|
|
5772
|
+
var ProductsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5773
5773
|
constructor(http, pageSize) {
|
|
5774
5774
|
super(http, {
|
|
5775
5775
|
key: "products",
|
|
@@ -5836,7 +5836,7 @@ var ProductsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5836
5836
|
};
|
|
5837
5837
|
|
|
5838
5838
|
// src/resources/product_vendors.ts
|
|
5839
|
-
var ProductVendorsResource = class extends
|
|
5839
|
+
var ProductVendorsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5840
5840
|
constructor(http, pageSize) {
|
|
5841
5841
|
super(http, {
|
|
5842
5842
|
key: "product_vendors",
|
|
@@ -5895,7 +5895,7 @@ var ProductVendorsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5895
5895
|
};
|
|
5896
5896
|
|
|
5897
5897
|
// src/resources/project_charges.ts
|
|
5898
|
-
var ProjectChargesResource = class extends
|
|
5898
|
+
var ProjectChargesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5899
5899
|
constructor(http, pageSize) {
|
|
5900
5900
|
super(http, {
|
|
5901
5901
|
key: "project_charges",
|
|
@@ -5966,7 +5966,7 @@ var ProjectChargesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
5966
5966
|
};
|
|
5967
5967
|
|
|
5968
5968
|
// src/resources/project_notes.ts
|
|
5969
|
-
var ProjectNotesResource = class extends
|
|
5969
|
+
var ProjectNotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
5970
5970
|
constructor(http, pageSize) {
|
|
5971
5971
|
super(http, {
|
|
5972
5972
|
key: "project_notes",
|
|
@@ -6025,7 +6025,7 @@ var ProjectNotesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6025
6025
|
};
|
|
6026
6026
|
|
|
6027
6027
|
// src/resources/projects.ts
|
|
6028
|
-
var ProjectsResource = class extends
|
|
6028
|
+
var ProjectsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6029
6029
|
constructor(http, pageSize) {
|
|
6030
6030
|
super(http, {
|
|
6031
6031
|
key: "projects",
|
|
@@ -6102,13 +6102,13 @@ var ProjectsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6102
6102
|
const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
|
|
6103
6103
|
const result = { project, company, opportunity, leadResource };
|
|
6104
6104
|
if (opts.names === true) {
|
|
6105
|
-
const builder =
|
|
6105
|
+
const builder = _chunkYKEX4SK7cjs.createNamePlan.call(void 0, );
|
|
6106
6106
|
builder.addResource(root["creatorResourceID"]);
|
|
6107
6107
|
builder.addFk("contract", root["contractID"]);
|
|
6108
|
-
const names = await
|
|
6108
|
+
const names = await _chunkYKEX4SK7cjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
6109
6109
|
const row = { ...project };
|
|
6110
|
-
|
|
6111
|
-
|
|
6110
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
|
|
6111
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
6112
6112
|
result.project = row;
|
|
6113
6113
|
result.names = names.section;
|
|
6114
6114
|
}
|
|
@@ -6117,7 +6117,7 @@ var ProjectsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6117
6117
|
};
|
|
6118
6118
|
|
|
6119
6119
|
// src/resources/purchase_approvals.ts
|
|
6120
|
-
var PurchaseApprovalsResource = class extends
|
|
6120
|
+
var PurchaseApprovalsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6121
6121
|
constructor(http, pageSize) {
|
|
6122
6122
|
super(http, {
|
|
6123
6123
|
key: "purchase_approvals",
|
|
@@ -6171,7 +6171,7 @@ var PurchaseApprovalsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6171
6171
|
};
|
|
6172
6172
|
|
|
6173
6173
|
// src/resources/purchase_order_item_receiving.ts
|
|
6174
|
-
var PurchaseOrderItemReceivingResource = class extends
|
|
6174
|
+
var PurchaseOrderItemReceivingResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6175
6175
|
constructor(http, pageSize) {
|
|
6176
6176
|
super(http, {
|
|
6177
6177
|
key: "purchase_order_item_receiving",
|
|
@@ -6221,7 +6221,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkWTVLHMZAcjs.BaseRes
|
|
|
6221
6221
|
};
|
|
6222
6222
|
|
|
6223
6223
|
// src/resources/purchase_order_items.ts
|
|
6224
|
-
var PurchaseOrderItemsResource = class extends
|
|
6224
|
+
var PurchaseOrderItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6225
6225
|
constructor(http, pageSize) {
|
|
6226
6226
|
super(http, {
|
|
6227
6227
|
key: "purchase_order_items",
|
|
@@ -6280,7 +6280,7 @@ var PurchaseOrderItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6280
6280
|
};
|
|
6281
6281
|
|
|
6282
6282
|
// src/resources/purchase_orders.ts
|
|
6283
|
-
var PurchaseOrdersResource = class extends
|
|
6283
|
+
var PurchaseOrdersResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6284
6284
|
constructor(http, pageSize) {
|
|
6285
6285
|
super(http, {
|
|
6286
6286
|
key: "purchase_orders",
|
|
@@ -6342,7 +6342,7 @@ var PurchaseOrdersResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6342
6342
|
};
|
|
6343
6343
|
|
|
6344
6344
|
// src/resources/quote_items.ts
|
|
6345
|
-
var QuoteItemsResource = class extends
|
|
6345
|
+
var QuoteItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6346
6346
|
constructor(http, pageSize) {
|
|
6347
6347
|
super(http, {
|
|
6348
6348
|
key: "quote_items",
|
|
@@ -6413,7 +6413,7 @@ var QuoteItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6413
6413
|
};
|
|
6414
6414
|
|
|
6415
6415
|
// src/resources/quote_locations.ts
|
|
6416
|
-
var QuoteLocationsResource = class extends
|
|
6416
|
+
var QuoteLocationsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6417
6417
|
constructor(http, pageSize) {
|
|
6418
6418
|
super(http, {
|
|
6419
6419
|
key: "quote_locations",
|
|
@@ -6478,7 +6478,7 @@ var QuoteLocationsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6478
6478
|
};
|
|
6479
6479
|
|
|
6480
6480
|
// src/resources/quotes.ts
|
|
6481
|
-
var QuotesResource = class extends
|
|
6481
|
+
var QuotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6482
6482
|
constructor(http, pageSize) {
|
|
6483
6483
|
super(http, {
|
|
6484
6484
|
key: "quotes",
|
|
@@ -6545,7 +6545,7 @@ var QuotesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6545
6545
|
};
|
|
6546
6546
|
|
|
6547
6547
|
// src/resources/quote_templates.ts
|
|
6548
|
-
var QuoteTemplatesResource = class extends
|
|
6548
|
+
var QuoteTemplatesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6549
6549
|
constructor(http, pageSize) {
|
|
6550
6550
|
super(http, {
|
|
6551
6551
|
key: "quote_templates",
|
|
@@ -6589,7 +6589,7 @@ var QuoteTemplatesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6589
6589
|
};
|
|
6590
6590
|
|
|
6591
6591
|
// src/resources/resource_role_queues.ts
|
|
6592
|
-
var ResourceRoleQueuesResource = class extends
|
|
6592
|
+
var ResourceRoleQueuesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6593
6593
|
constructor(http, pageSize) {
|
|
6594
6594
|
super(http, {
|
|
6595
6595
|
key: "resource_role_queues",
|
|
@@ -6648,7 +6648,7 @@ var ResourceRoleQueuesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6648
6648
|
};
|
|
6649
6649
|
|
|
6650
6650
|
// src/resources/resource_roles.ts
|
|
6651
|
-
var ResourceRolesResource = class extends
|
|
6651
|
+
var ResourceRolesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6652
6652
|
constructor(http, pageSize) {
|
|
6653
6653
|
super(http, {
|
|
6654
6654
|
key: "resource_roles",
|
|
@@ -6690,7 +6690,7 @@ var ResourceRolesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6690
6690
|
};
|
|
6691
6691
|
|
|
6692
6692
|
// src/resources/resource_skills.ts
|
|
6693
|
-
var ResourceSkillsResource = class extends
|
|
6693
|
+
var ResourceSkillsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6694
6694
|
constructor(http, pageSize) {
|
|
6695
6695
|
super(http, {
|
|
6696
6696
|
key: "resource_skills",
|
|
@@ -6744,16 +6744,16 @@ var ResourceSkillsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6744
6744
|
var MAX_TRANSFER_IDS = 500;
|
|
6745
6745
|
function requirePositiveIds(ids, label) {
|
|
6746
6746
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
6747
|
-
throw new (0,
|
|
6747
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
|
|
6748
6748
|
}
|
|
6749
6749
|
if (ids.length > MAX_TRANSFER_IDS) {
|
|
6750
|
-
throw new (0,
|
|
6750
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
|
|
6751
6751
|
}
|
|
6752
6752
|
const out = [];
|
|
6753
6753
|
for (const raw of ids) {
|
|
6754
|
-
const id =
|
|
6754
|
+
const id = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, raw, `${label} id`);
|
|
6755
6755
|
if (typeof id === "number" && id < 1) {
|
|
6756
|
-
throw new (0,
|
|
6756
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
|
|
6757
6757
|
}
|
|
6758
6758
|
out.push(id);
|
|
6759
6759
|
}
|
|
@@ -6761,7 +6761,7 @@ function requirePositiveIds(ids, label) {
|
|
|
6761
6761
|
}
|
|
6762
6762
|
async function whoAmI(_resource, userName, http) {
|
|
6763
6763
|
const user = userName.trim();
|
|
6764
|
-
if (user === "") throw new (0,
|
|
6764
|
+
if (user === "") throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
|
|
6765
6765
|
const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
|
|
6766
6766
|
const res = await http.request({
|
|
6767
6767
|
method: "POST",
|
|
@@ -6770,11 +6770,11 @@ async function whoAmI(_resource, userName, http) {
|
|
|
6770
6770
|
body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
|
|
6771
6771
|
operation: "resources.whoAmI"
|
|
6772
6772
|
});
|
|
6773
|
-
const matches =
|
|
6773
|
+
const matches = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
6774
6774
|
if (matches.length === 0) return null;
|
|
6775
6775
|
if (matches.length > 1) {
|
|
6776
6776
|
const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
|
|
6777
|
-
throw new (0,
|
|
6777
|
+
throw new (0, _chunkYKEX4SK7cjs.ResolutionError)(
|
|
6778
6778
|
`whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
|
|
6779
6779
|
{ code: "RESOLUTION_AMBIGUOUS", resourceIds: ids }
|
|
6780
6780
|
);
|
|
@@ -6783,9 +6783,9 @@ async function whoAmI(_resource, userName, http) {
|
|
|
6783
6783
|
}
|
|
6784
6784
|
async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
|
|
6785
6785
|
const ids = requirePositiveIds(companyIds, "transferOwnership");
|
|
6786
|
-
const destination =
|
|
6786
|
+
const destination = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
|
|
6787
6787
|
if (typeof destination === "number" && destination < 1) {
|
|
6788
|
-
throw new (0,
|
|
6788
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
|
|
6789
6789
|
}
|
|
6790
6790
|
const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _34 => _34.dryRun]), () => ( true));
|
|
6791
6791
|
const changes = [];
|
|
@@ -6797,7 +6797,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
6797
6797
|
path: `/V1.0/Companies/${id}`,
|
|
6798
6798
|
operation: "resources.transferOwnership"
|
|
6799
6799
|
});
|
|
6800
|
-
const company =
|
|
6800
|
+
const company = _chunkYKEX4SK7cjs.unwrapItem.call(void 0, res, id);
|
|
6801
6801
|
const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
|
|
6802
6802
|
changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
|
|
6803
6803
|
if (!dryRun) {
|
|
@@ -6807,11 +6807,11 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
6807
6807
|
body: { id, ownerResourceID: destination },
|
|
6808
6808
|
operation: "resources.transferOwnership"
|
|
6809
6809
|
});
|
|
6810
|
-
|
|
6810
|
+
_chunkYKEX4SK7cjs.unwrapOperation.call(void 0, update);
|
|
6811
6811
|
applied.push(id);
|
|
6812
6812
|
}
|
|
6813
6813
|
} catch (err) {
|
|
6814
|
-
if (!dryRun && err instanceof
|
|
6814
|
+
if (!dryRun && err instanceof _chunkYKEX4SK7cjs.AutotaskError) {
|
|
6815
6815
|
err.resourceIds = [id];
|
|
6816
6816
|
err.suggestedAction = `Partial transfer: ${applied.length} of ${ids.length} companies were re-owned (ids: ${applied.join(", ") || "none"}); id ${id} failed. Re-run transferOwnership for the remaining ids (from ${id} on).`;
|
|
6817
6817
|
}
|
|
@@ -6821,7 +6821,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
6821
6821
|
if (dryRun) {
|
|
6822
6822
|
const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
|
|
6823
6823
|
return {
|
|
6824
|
-
...
|
|
6824
|
+
..._chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
6825
6825
|
operation: "resources.transferOwnership",
|
|
6826
6826
|
method: "PUT",
|
|
6827
6827
|
path: "/V1.0/Companies",
|
|
@@ -6845,7 +6845,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
6845
6845
|
}
|
|
6846
6846
|
|
|
6847
6847
|
// src/resources/resources.ts
|
|
6848
|
-
var ResourcesResource = class extends
|
|
6848
|
+
var ResourcesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6849
6849
|
|
|
6850
6850
|
constructor(http, clientConfig, pageSize) {
|
|
6851
6851
|
super(http, {
|
|
@@ -6918,7 +6918,7 @@ var ResourcesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
6918
6918
|
|
|
6919
6919
|
// src/resources/special/resource_time_off_additional.ts
|
|
6920
6920
|
async function getByResource(_resource, resourceId, http) {
|
|
6921
|
-
const numericResource =
|
|
6921
|
+
const numericResource = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
6922
6922
|
const res = await http.request({
|
|
6923
6923
|
method: "GET",
|
|
6924
6924
|
path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
|
|
@@ -6932,11 +6932,11 @@ async function getByResource(_resource, resourceId, http) {
|
|
|
6932
6932
|
if (typeof item === "object" && !Array.isArray(item)) return [item];
|
|
6933
6933
|
}
|
|
6934
6934
|
}
|
|
6935
|
-
return
|
|
6935
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
|
|
6936
6936
|
}
|
|
6937
6937
|
|
|
6938
6938
|
// src/resources/resource_time_off_additional.ts
|
|
6939
|
-
var ResourceTimeOffAdditionalResource = class extends
|
|
6939
|
+
var ResourceTimeOffAdditionalResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6940
6940
|
constructor(http, pageSize) {
|
|
6941
6941
|
super(http, {
|
|
6942
6942
|
key: "resource_time_off_additional",
|
|
@@ -6975,7 +6975,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkWTVLHMZAcjs.BaseReso
|
|
|
6975
6975
|
};
|
|
6976
6976
|
|
|
6977
6977
|
// src/resources/resource_time_off_approvers.ts
|
|
6978
|
-
var ResourceTimeOffApproversResource = class extends
|
|
6978
|
+
var ResourceTimeOffApproversResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
6979
6979
|
constructor(http, pageSize) {
|
|
6980
6980
|
super(http, {
|
|
6981
6981
|
key: "resource_time_off_approvers",
|
|
@@ -7018,29 +7018,29 @@ var ResourceTimeOffApproversResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
7018
7018
|
|
|
7019
7019
|
// src/resources/special/resource_time_off_balances.ts
|
|
7020
7020
|
async function getByResource2(_resource, resourceId, http) {
|
|
7021
|
-
const numericResource =
|
|
7021
|
+
const numericResource = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
7022
7022
|
const res = await http.request({
|
|
7023
7023
|
method: "GET",
|
|
7024
7024
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
|
|
7025
7025
|
operation: "resource_time_off_balances.getByResource"
|
|
7026
7026
|
});
|
|
7027
|
-
return
|
|
7027
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
|
|
7028
7028
|
}
|
|
7029
7029
|
async function getByYear(_resource, resourceId, year, http) {
|
|
7030
|
-
const numericResource =
|
|
7030
|
+
const numericResource = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
7031
7031
|
if (!Number.isSafeInteger(year) || year < 1) {
|
|
7032
|
-
throw new (0,
|
|
7032
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("getByYear: year must be a positive integer");
|
|
7033
7033
|
}
|
|
7034
7034
|
const res = await http.request({
|
|
7035
7035
|
method: "GET",
|
|
7036
7036
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
|
|
7037
7037
|
operation: "resource_time_off_balances.getByYear"
|
|
7038
7038
|
});
|
|
7039
|
-
return
|
|
7039
|
+
return _chunkYKEX4SK7cjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear");
|
|
7040
7040
|
}
|
|
7041
7041
|
|
|
7042
7042
|
// src/resources/resource_time_off_balances.ts
|
|
7043
|
-
var ResourceTimeOffBalancesResource = class extends
|
|
7043
|
+
var ResourceTimeOffBalancesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7044
7044
|
constructor(http, pageSize) {
|
|
7045
7045
|
super(http, {
|
|
7046
7046
|
key: "resource_time_off_balances",
|
|
@@ -7078,7 +7078,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkWTVLHMZAcjs.BaseResour
|
|
|
7078
7078
|
};
|
|
7079
7079
|
|
|
7080
7080
|
// src/resources/roles.ts
|
|
7081
|
-
var RolesResource = class extends
|
|
7081
|
+
var RolesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7082
7082
|
constructor(http, pageSize) {
|
|
7083
7083
|
super(http, {
|
|
7084
7084
|
key: "roles",
|
|
@@ -7145,7 +7145,7 @@ var RolesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7145
7145
|
};
|
|
7146
7146
|
|
|
7147
7147
|
// src/resources/service_calls.ts
|
|
7148
|
-
var ServiceCallsResource = class extends
|
|
7148
|
+
var ServiceCallsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7149
7149
|
constructor(http, pageSize) {
|
|
7150
7150
|
super(http, {
|
|
7151
7151
|
key: "service_calls",
|
|
@@ -7214,7 +7214,7 @@ var ServiceCallsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7214
7214
|
};
|
|
7215
7215
|
|
|
7216
7216
|
// src/resources/service_call_task_resources.ts
|
|
7217
|
-
var ServiceCallTaskResourcesResource = class extends
|
|
7217
|
+
var ServiceCallTaskResourcesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7218
7218
|
constructor(http, pageSize) {
|
|
7219
7219
|
super(http, {
|
|
7220
7220
|
key: "service_call_task_resources",
|
|
@@ -7271,7 +7271,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
7271
7271
|
};
|
|
7272
7272
|
|
|
7273
7273
|
// src/resources/service_call_tasks.ts
|
|
7274
|
-
var ServiceCallTasksResource = class extends
|
|
7274
|
+
var ServiceCallTasksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7275
7275
|
constructor(http, pageSize) {
|
|
7276
7276
|
super(http, {
|
|
7277
7277
|
key: "service_call_tasks",
|
|
@@ -7328,7 +7328,7 @@ var ServiceCallTasksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7328
7328
|
};
|
|
7329
7329
|
|
|
7330
7330
|
// src/resources/service_call_ticket_resources.ts
|
|
7331
|
-
var ServiceCallTicketResourcesResource = class extends
|
|
7331
|
+
var ServiceCallTicketResourcesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7332
7332
|
constructor(http, pageSize) {
|
|
7333
7333
|
super(http, {
|
|
7334
7334
|
key: "service_call_ticket_resources",
|
|
@@ -7385,7 +7385,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkWTVLHMZAcjs.BaseRes
|
|
|
7385
7385
|
};
|
|
7386
7386
|
|
|
7387
7387
|
// src/resources/service_call_tickets.ts
|
|
7388
|
-
var ServiceCallTicketsResource = class extends
|
|
7388
|
+
var ServiceCallTicketsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7389
7389
|
constructor(http, pageSize) {
|
|
7390
7390
|
super(http, {
|
|
7391
7391
|
key: "service_call_tickets",
|
|
@@ -7442,7 +7442,7 @@ var ServiceCallTicketsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7442
7442
|
};
|
|
7443
7443
|
|
|
7444
7444
|
// src/resources/service_level_agreement_results.ts
|
|
7445
|
-
var ServiceLevelAgreementResultsResource = class extends
|
|
7445
|
+
var ServiceLevelAgreementResultsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7446
7446
|
constructor(http, pageSize) {
|
|
7447
7447
|
super(http, {
|
|
7448
7448
|
key: "service_level_agreement_results",
|
|
@@ -7481,7 +7481,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkWTVLHMZAcjs.BaseR
|
|
|
7481
7481
|
};
|
|
7482
7482
|
|
|
7483
7483
|
// src/resources/services.ts
|
|
7484
|
-
var ServicesResource = class extends
|
|
7484
|
+
var ServicesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7485
7485
|
constructor(http, pageSize) {
|
|
7486
7486
|
super(http, {
|
|
7487
7487
|
key: "services",
|
|
@@ -7549,7 +7549,7 @@ var ServicesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7549
7549
|
};
|
|
7550
7550
|
|
|
7551
7551
|
// src/resources/skills.ts
|
|
7552
|
-
var SkillsResource = class extends
|
|
7552
|
+
var SkillsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7553
7553
|
constructor(http, pageSize) {
|
|
7554
7554
|
super(http, {
|
|
7555
7555
|
key: "skills",
|
|
@@ -7593,7 +7593,7 @@ var SkillsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7593
7593
|
};
|
|
7594
7594
|
|
|
7595
7595
|
// src/resources/subscription_periods.ts
|
|
7596
|
-
var SubscriptionPeriodsResource = class extends
|
|
7596
|
+
var SubscriptionPeriodsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7597
7597
|
constructor(http, pageSize) {
|
|
7598
7598
|
super(http, {
|
|
7599
7599
|
key: "subscription_periods",
|
|
@@ -7632,7 +7632,7 @@ var SubscriptionPeriodsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7632
7632
|
};
|
|
7633
7633
|
|
|
7634
7634
|
// src/resources/subscriptions.ts
|
|
7635
|
-
var SubscriptionsResource = class extends
|
|
7635
|
+
var SubscriptionsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7636
7636
|
constructor(http, pageSize) {
|
|
7637
7637
|
super(http, {
|
|
7638
7638
|
key: "subscriptions",
|
|
@@ -7701,7 +7701,7 @@ var SubscriptionsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7701
7701
|
};
|
|
7702
7702
|
|
|
7703
7703
|
// src/resources/survey_results.ts
|
|
7704
|
-
var SurveyResultsResource = class extends
|
|
7704
|
+
var SurveyResultsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7705
7705
|
constructor(http, pageSize) {
|
|
7706
7706
|
super(http, {
|
|
7707
7707
|
key: "survey_results",
|
|
@@ -7740,7 +7740,7 @@ var SurveyResultsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7740
7740
|
};
|
|
7741
7741
|
|
|
7742
7742
|
// src/resources/surveys.ts
|
|
7743
|
-
var SurveysResource = class extends
|
|
7743
|
+
var SurveysResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7744
7744
|
constructor(http, pageSize) {
|
|
7745
7745
|
super(http, {
|
|
7746
7746
|
key: "surveys",
|
|
@@ -7784,7 +7784,7 @@ var SurveysResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7784
7784
|
};
|
|
7785
7785
|
|
|
7786
7786
|
// src/resources/tag_aliases.ts
|
|
7787
|
-
var TagAliasesResource = class extends
|
|
7787
|
+
var TagAliasesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7788
7788
|
constructor(http, pageSize) {
|
|
7789
7789
|
super(http, {
|
|
7790
7790
|
key: "tag_aliases",
|
|
@@ -7841,7 +7841,7 @@ var TagAliasesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7841
7841
|
};
|
|
7842
7842
|
|
|
7843
7843
|
// src/resources/tag_groups.ts
|
|
7844
|
-
var TagGroupsResource = class extends
|
|
7844
|
+
var TagGroupsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7845
7845
|
constructor(http, pageSize) {
|
|
7846
7846
|
super(http, {
|
|
7847
7847
|
key: "tag_groups",
|
|
@@ -7910,7 +7910,7 @@ var TagGroupsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7910
7910
|
};
|
|
7911
7911
|
|
|
7912
7912
|
// src/resources/tags.ts
|
|
7913
|
-
var TagsResource = class extends
|
|
7913
|
+
var TagsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7914
7914
|
constructor(http, pageSize) {
|
|
7915
7915
|
super(http, {
|
|
7916
7916
|
key: "tags",
|
|
@@ -7979,7 +7979,7 @@ var TagsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
7979
7979
|
};
|
|
7980
7980
|
|
|
7981
7981
|
// src/resources/task_secondary_resources.ts
|
|
7982
|
-
var TaskSecondaryResourcesResource = class extends
|
|
7982
|
+
var TaskSecondaryResourcesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
7983
7983
|
constructor(http, pageSize) {
|
|
7984
7984
|
super(http, {
|
|
7985
7985
|
key: "task_secondary_resources",
|
|
@@ -8036,7 +8036,7 @@ var TaskSecondaryResourcesResource = class extends _chunkWTVLHMZAcjs.BaseResourc
|
|
|
8036
8036
|
};
|
|
8037
8037
|
|
|
8038
8038
|
// src/resources/tasks.ts
|
|
8039
|
-
var TasksResource = class extends
|
|
8039
|
+
var TasksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8040
8040
|
constructor(http, pageSize) {
|
|
8041
8041
|
super(http, {
|
|
8042
8042
|
key: "tasks",
|
|
@@ -8124,7 +8124,7 @@ var ThresholdInformationResource = class {
|
|
|
8124
8124
|
};
|
|
8125
8125
|
|
|
8126
8126
|
// src/resources/ticket_additional_configuration_items.ts
|
|
8127
|
-
var TicketAdditionalConfigurationItemsResource = class extends
|
|
8127
|
+
var TicketAdditionalConfigurationItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8128
8128
|
constructor(http, pageSize) {
|
|
8129
8129
|
super(http, {
|
|
8130
8130
|
key: "ticket_additional_configuration_items",
|
|
@@ -8181,7 +8181,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkWTVLHMZAcjs
|
|
|
8181
8181
|
};
|
|
8182
8182
|
|
|
8183
8183
|
// src/resources/ticket_additional_contacts.ts
|
|
8184
|
-
var TicketAdditionalContactsResource = class extends
|
|
8184
|
+
var TicketAdditionalContactsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8185
8185
|
constructor(http, pageSize) {
|
|
8186
8186
|
super(http, {
|
|
8187
8187
|
key: "ticket_additional_contacts",
|
|
@@ -8238,7 +8238,7 @@ var TicketAdditionalContactsResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
8238
8238
|
};
|
|
8239
8239
|
|
|
8240
8240
|
// src/resources/ticket_attachments.ts
|
|
8241
|
-
var TicketAttachmentsResource = class extends
|
|
8241
|
+
var TicketAttachmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8242
8242
|
constructor(http, pageSize) {
|
|
8243
8243
|
super(http, {
|
|
8244
8244
|
key: "ticket_attachments",
|
|
@@ -8300,7 +8300,7 @@ var TicketAttachmentsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8300
8300
|
};
|
|
8301
8301
|
|
|
8302
8302
|
// src/resources/ticket_categories.ts
|
|
8303
|
-
var TicketCategoriesResource = class extends
|
|
8303
|
+
var TicketCategoriesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8304
8304
|
constructor(http, pageSize) {
|
|
8305
8305
|
super(http, {
|
|
8306
8306
|
key: "ticket_categories",
|
|
@@ -8359,7 +8359,7 @@ var TicketCategoriesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8359
8359
|
};
|
|
8360
8360
|
|
|
8361
8361
|
// src/resources/ticket_category_field_defaults.ts
|
|
8362
|
-
var TicketCategoryFieldDefaultsResource = class extends
|
|
8362
|
+
var TicketCategoryFieldDefaultsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8363
8363
|
constructor(http, pageSize) {
|
|
8364
8364
|
super(http, {
|
|
8365
8365
|
key: "ticket_category_field_defaults",
|
|
@@ -8401,7 +8401,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkWTVLHMZAcjs.BaseRe
|
|
|
8401
8401
|
};
|
|
8402
8402
|
|
|
8403
8403
|
// src/resources/ticket_change_request_approvals.ts
|
|
8404
|
-
var TicketChangeRequestApprovalsResource = class extends
|
|
8404
|
+
var TicketChangeRequestApprovalsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8405
8405
|
constructor(http, pageSize) {
|
|
8406
8406
|
super(http, {
|
|
8407
8407
|
key: "ticket_change_request_approvals",
|
|
@@ -8458,7 +8458,7 @@ var TicketChangeRequestApprovalsResource = class extends _chunkWTVLHMZAcjs.BaseR
|
|
|
8458
8458
|
};
|
|
8459
8459
|
|
|
8460
8460
|
// src/resources/ticket_charges.ts
|
|
8461
|
-
var TicketChargesResource = class extends
|
|
8461
|
+
var TicketChargesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8462
8462
|
constructor(http, pageSize) {
|
|
8463
8463
|
super(http, {
|
|
8464
8464
|
key: "ticket_charges",
|
|
@@ -8529,7 +8529,7 @@ var TicketChargesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8529
8529
|
};
|
|
8530
8530
|
|
|
8531
8531
|
// src/resources/ticket_checklist_items.ts
|
|
8532
|
-
var TicketChecklistItemsResource = class extends
|
|
8532
|
+
var TicketChecklistItemsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8533
8533
|
constructor(http, pageSize) {
|
|
8534
8534
|
super(http, {
|
|
8535
8535
|
key: "ticket_checklist_items",
|
|
@@ -8595,7 +8595,7 @@ var TicketChecklistItemsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
8595
8595
|
};
|
|
8596
8596
|
|
|
8597
8597
|
// src/resources/ticket_checklist_libraries.ts
|
|
8598
|
-
var TicketChecklistLibrariesResource = class extends
|
|
8598
|
+
var TicketChecklistLibrariesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8599
8599
|
constructor(http, pageSize) {
|
|
8600
8600
|
super(http, {
|
|
8601
8601
|
key: "ticket_checklist_libraries",
|
|
@@ -8619,9 +8619,9 @@ var TicketChecklistLibrariesResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
8619
8619
|
* `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
|
|
8620
8620
|
* surface — no documents read op — and never issues the POST). */
|
|
8621
8621
|
async attachToDocument(documentID, data, opts = {}) {
|
|
8622
|
-
const n =
|
|
8622
|
+
const n = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, documentID, "documentID");
|
|
8623
8623
|
if (opts.dryRun === true) {
|
|
8624
|
-
return
|
|
8624
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
8625
8625
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
8626
8626
|
method: "POST",
|
|
8627
8627
|
path: `/V1.0/Documents/${n}/ChecklistLibraries`,
|
|
@@ -8638,7 +8638,7 @@ var TicketChecklistLibrariesResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
8638
8638
|
body: { ...data },
|
|
8639
8639
|
operation: "ticket_checklist_libraries.attachToDocument"
|
|
8640
8640
|
});
|
|
8641
|
-
return
|
|
8641
|
+
return _chunkYKEX4SK7cjs.unwrapOperation.call(void 0, res);
|
|
8642
8642
|
}
|
|
8643
8643
|
/** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
|
|
8644
8644
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8654,7 +8654,7 @@ var TicketChecklistLibrariesResource = class extends _chunkWTVLHMZAcjs.BaseResou
|
|
|
8654
8654
|
};
|
|
8655
8655
|
|
|
8656
8656
|
// src/resources/ticket_history.ts
|
|
8657
|
-
var TicketHistoryResource = class extends
|
|
8657
|
+
var TicketHistoryResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8658
8658
|
constructor(http, pageSize) {
|
|
8659
8659
|
super(http, {
|
|
8660
8660
|
key: "ticket_history",
|
|
@@ -8693,7 +8693,7 @@ var TicketHistoryResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8693
8693
|
};
|
|
8694
8694
|
|
|
8695
8695
|
// src/resources/ticket_note_attachments.ts
|
|
8696
|
-
var TicketNoteAttachmentsResource = class extends
|
|
8696
|
+
var TicketNoteAttachmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8697
8697
|
constructor(http, pageSize) {
|
|
8698
8698
|
super(http, {
|
|
8699
8699
|
key: "ticket_note_attachments",
|
|
@@ -8755,7 +8755,7 @@ var TicketNoteAttachmentsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
8755
8755
|
};
|
|
8756
8756
|
|
|
8757
8757
|
// src/resources/ticket_notes.ts
|
|
8758
|
-
var TicketNotesResource = class extends
|
|
8758
|
+
var TicketNotesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8759
8759
|
constructor(http, pageSize) {
|
|
8760
8760
|
super(http, {
|
|
8761
8761
|
key: "ticket_notes",
|
|
@@ -8814,7 +8814,7 @@ var TicketNotesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8814
8814
|
};
|
|
8815
8815
|
|
|
8816
8816
|
// src/resources/ticket_note_webhooks.ts
|
|
8817
|
-
var TicketNoteWebhooksResource = class extends
|
|
8817
|
+
var TicketNoteWebhooksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8818
8818
|
constructor(http, pageSize) {
|
|
8819
8819
|
super(http, {
|
|
8820
8820
|
key: "ticket_note_webhooks",
|
|
@@ -8890,7 +8890,7 @@ var TicketNoteWebhooksResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
8890
8890
|
};
|
|
8891
8891
|
|
|
8892
8892
|
// src/resources/ticket_secondary_resources.ts
|
|
8893
|
-
var TicketSecondaryResourcesResource = class extends
|
|
8893
|
+
var TicketSecondaryResourcesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
8894
8894
|
constructor(http, pageSize) {
|
|
8895
8895
|
super(http, {
|
|
8896
8896
|
key: "ticket_secondary_resources",
|
|
@@ -8957,9 +8957,9 @@ async function fetchTicket(http, id, operation) {
|
|
|
8957
8957
|
});
|
|
8958
8958
|
const body = res;
|
|
8959
8959
|
if (body === null || !("item" in body)) {
|
|
8960
|
-
throw new (0,
|
|
8960
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id] });
|
|
8961
8961
|
}
|
|
8962
|
-
if (body.item === null || body.item === void 0) throw new (0,
|
|
8962
|
+
if (body.item === null || body.item === void 0) throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id] });
|
|
8963
8963
|
return body.item;
|
|
8964
8964
|
}
|
|
8965
8965
|
async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
@@ -8970,29 +8970,29 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
|
8970
8970
|
body: { MaxRecords: maxRecords, filter },
|
|
8971
8971
|
operation
|
|
8972
8972
|
});
|
|
8973
|
-
return
|
|
8973
|
+
return _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res).items;
|
|
8974
8974
|
}
|
|
8975
8975
|
function isRouteUnavailable(err) {
|
|
8976
|
-
return
|
|
8976
|
+
return _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
|
|
8977
8977
|
}
|
|
8978
8978
|
function routeFact(route, path, err) {
|
|
8979
8979
|
return {
|
|
8980
8980
|
route,
|
|
8981
8981
|
path,
|
|
8982
|
-
httpStatus:
|
|
8982
|
+
httpStatus: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
|
|
8983
8983
|
};
|
|
8984
8984
|
}
|
|
8985
8985
|
function childDeclaresQuery(resourceKey) {
|
|
8986
|
-
return
|
|
8986
|
+
return _chunkT5FLSJODcjs.CAPABILITIES.some(
|
|
8987
8987
|
(c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
|
|
8988
8988
|
);
|
|
8989
8989
|
}
|
|
8990
8990
|
function planScopedPath(resourceKey, ticketId) {
|
|
8991
8991
|
if (!childDeclaresQuery(resourceKey)) return null;
|
|
8992
|
-
const entry =
|
|
8992
|
+
const entry = _chunkYKEX4SK7cjs.RELATIONSHIP_MAP[resourceKey];
|
|
8993
8993
|
const parent = entry === void 0 ? null : entry.parent;
|
|
8994
8994
|
if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
|
|
8995
|
-
const parentPath = _optionalChain([
|
|
8995
|
+
const parentPath = _optionalChain([_chunkYKEX4SK7cjs.RELATIONSHIP_MAP, 'access', _35 => _35[parent.resource], 'optionalAccess', _36 => _36.path]);
|
|
8996
8996
|
if (parentPath === null || parentPath === void 0) return null;
|
|
8997
8997
|
return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
|
|
8998
8998
|
}
|
|
@@ -9031,14 +9031,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
|
|
|
9031
9031
|
break;
|
|
9032
9032
|
}
|
|
9033
9033
|
const body = await http.request({ method: "GET", path: target, operation });
|
|
9034
|
-
const { items: pageItems, pageDetails } =
|
|
9034
|
+
const { items: pageItems, pageDetails } = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, body, operation);
|
|
9035
9035
|
nextCursor = pageDetails.nextPageUrl;
|
|
9036
9036
|
pages += 1;
|
|
9037
9037
|
const window = pageItems.slice(0, Math.max(0, limit - items.length));
|
|
9038
9038
|
for (const row of window) if (accept(row)) items.push(row);
|
|
9039
9039
|
if (items.length >= limit) break;
|
|
9040
9040
|
if (nextCursor === null || pageItems.length === 0) break;
|
|
9041
|
-
target =
|
|
9041
|
+
target = _chunkYKEX4SK7cjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
|
|
9042
9042
|
}
|
|
9043
9043
|
const capped = items.length >= limit || guard && nextCursor !== null;
|
|
9044
9044
|
return { items, capped };
|
|
@@ -9072,7 +9072,7 @@ function truncate(text, limit) {
|
|
|
9072
9072
|
}
|
|
9073
9073
|
async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
9074
9074
|
void opts;
|
|
9075
|
-
const ticketId =
|
|
9075
|
+
const ticketId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
9076
9076
|
await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
|
|
9077
9077
|
const rows = await ticketQueryItems(
|
|
9078
9078
|
http,
|
|
@@ -9097,9 +9097,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
|
9097
9097
|
async function summary(_resource, id, opts = {}, http) {
|
|
9098
9098
|
const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
|
|
9099
9099
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
9100
|
-
throw new (0,
|
|
9100
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
|
|
9101
9101
|
}
|
|
9102
|
-
const ticketId =
|
|
9102
|
+
const ticketId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
9103
9103
|
const ticket = await fetchTicket(http, ticketId, "tickets.summary");
|
|
9104
9104
|
const desc = truncate(ticket.description, limit);
|
|
9105
9105
|
const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
|
|
@@ -9126,13 +9126,13 @@ async function summary(_resource, id, opts = {}, http) {
|
|
|
9126
9126
|
}
|
|
9127
9127
|
async function timeline(_resource, id, opts = {}, http) {
|
|
9128
9128
|
const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
|
|
9129
|
-
if (!Number.isInteger(limit) || limit < 1) throw new (0,
|
|
9129
|
+
if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
9130
9130
|
const bounded = Math.min(limit, 500);
|
|
9131
9131
|
const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
|
|
9132
9132
|
if (!Number.isInteger(textLimit) || textLimit < 1) {
|
|
9133
|
-
throw new (0,
|
|
9133
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
|
|
9134
9134
|
}
|
|
9135
|
-
const ticketId =
|
|
9135
|
+
const ticketId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
9136
9136
|
await fetchTicket(http, ticketId, "tickets.timeline");
|
|
9137
9137
|
const dateFilters = (field) => {
|
|
9138
9138
|
const f = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -9219,14 +9219,14 @@ function isPositiveInt(v) {
|
|
|
9219
9219
|
return typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
9220
9220
|
}
|
|
9221
9221
|
function namedVendorFields(err) {
|
|
9222
|
-
if (!
|
|
9223
|
-
const entries = _nullishCoalesce(
|
|
9222
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
|
|
9223
|
+
const entries = _nullishCoalesce(_chunkYKEX4SK7cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
|
|
9224
9224
|
const out = /* @__PURE__ */ new Set();
|
|
9225
9225
|
for (const e of entries) if (e.field !== void 0) out.add(e.field);
|
|
9226
9226
|
return [...out];
|
|
9227
9227
|
}
|
|
9228
9228
|
function vendorDetailOf(err) {
|
|
9229
|
-
return
|
|
9229
|
+
return _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? _chunkYKEX4SK7cjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
|
|
9230
9230
|
}
|
|
9231
9231
|
async function fetchItem(http, path, operation) {
|
|
9232
9232
|
const res = await http.request({ method: "GET", path, operation });
|
|
@@ -9247,8 +9247,8 @@ function operationId(res) {
|
|
|
9247
9247
|
return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
|
|
9248
9248
|
}
|
|
9249
9249
|
function discoveryMerge(err, body, defaults) {
|
|
9250
|
-
if (!
|
|
9251
|
-
const entries =
|
|
9250
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
9251
|
+
const entries = _chunkYKEX4SK7cjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
9252
9252
|
if (entries === void 0) return null;
|
|
9253
9253
|
for (const entry of entries) {
|
|
9254
9254
|
const field = entry.field;
|
|
@@ -9260,7 +9260,7 @@ function discoveryMerge(err, body, defaults) {
|
|
|
9260
9260
|
}
|
|
9261
9261
|
function stepErrorText(code, err) {
|
|
9262
9262
|
const detail = vendorDetailOf(err);
|
|
9263
|
-
const base =
|
|
9263
|
+
const base = _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
|
|
9264
9264
|
return detail ? `${code}: ${detail}` : `${code}: ${base}`;
|
|
9265
9265
|
}
|
|
9266
9266
|
var DEFAULT_TICKET_PRIORITY = 3;
|
|
@@ -9269,7 +9269,7 @@ var DEFAULT_NOTE_TYPE = 1;
|
|
|
9269
9269
|
var DEFAULT_PUBLISH = 1;
|
|
9270
9270
|
var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
|
|
9271
9271
|
var SAFE_TICKET_CREATE_DEFAULTS = {};
|
|
9272
|
-
var QueueRequiredError = class extends
|
|
9272
|
+
var QueueRequiredError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
9273
9273
|
constructor(message, options = {}) {
|
|
9274
9274
|
super(message, {
|
|
9275
9275
|
code: "QUEUE_REQUIRED",
|
|
@@ -9280,13 +9280,13 @@ var QueueRequiredError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
9280
9280
|
this.name = "QueueRequiredError";
|
|
9281
9281
|
}
|
|
9282
9282
|
};
|
|
9283
|
-
var TicketResourceInvalidError = class extends
|
|
9283
|
+
var TicketResourceInvalidError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
9284
9284
|
constructor(message, options = {}) {
|
|
9285
9285
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
9286
9286
|
this.name = "TicketResourceInvalidError";
|
|
9287
9287
|
}
|
|
9288
9288
|
};
|
|
9289
|
-
var TicketCreateValidationFailedError = class extends
|
|
9289
|
+
var TicketCreateValidationFailedError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
9290
9290
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
9291
9291
|
|
|
9292
9292
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -9296,43 +9296,43 @@ var TicketCreateValidationFailedError = class extends _chunkWTVLHMZAcjs.Autotask
|
|
|
9296
9296
|
}
|
|
9297
9297
|
};
|
|
9298
9298
|
async function openWithNoteAndAssign(resource, params, note, assign, opts, http) {
|
|
9299
|
-
const companyID =
|
|
9299
|
+
const companyID = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _37 => _37.companyID]), "params.companyID");
|
|
9300
9300
|
const title = _optionalChain([params, 'optionalAccess', _38 => _38.title]);
|
|
9301
9301
|
if (typeof title !== "string" || title.trim() === "") {
|
|
9302
|
-
throw new (0,
|
|
9302
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
|
|
9303
9303
|
}
|
|
9304
9304
|
const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
|
|
9305
9305
|
const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
|
|
9306
9306
|
if (!isPositiveInt(priority)) {
|
|
9307
|
-
throw new (0,
|
|
9307
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
|
|
9308
9308
|
}
|
|
9309
9309
|
if (!isPositiveInt(status)) {
|
|
9310
|
-
throw new (0,
|
|
9310
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
|
|
9311
9311
|
}
|
|
9312
9312
|
if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
|
|
9313
|
-
throw new (0,
|
|
9313
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
|
|
9314
9314
|
}
|
|
9315
9315
|
if (note !== void 0) {
|
|
9316
9316
|
if (typeof note.description !== "string" || note.description.trim() === "") {
|
|
9317
|
-
throw new (0,
|
|
9317
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
|
|
9318
9318
|
}
|
|
9319
9319
|
if (typeof note.title !== "string" || note.title.trim() === "") {
|
|
9320
|
-
throw new (0,
|
|
9320
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("openWithNoteAndAssign: note.title is required (a non-empty string) \u2014 the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })", { operation: OP_OPEN });
|
|
9321
9321
|
}
|
|
9322
9322
|
if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
|
|
9323
|
-
throw new (0,
|
|
9323
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
|
|
9324
9324
|
}
|
|
9325
9325
|
if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
|
|
9326
|
-
throw new (0,
|
|
9326
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
|
|
9327
9327
|
}
|
|
9328
9328
|
}
|
|
9329
|
-
const assignee = assign === void 0 ? void 0 :
|
|
9329
|
+
const assignee = assign === void 0 ? void 0 : _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
|
|
9330
9330
|
if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
|
|
9331
|
-
throw new (0,
|
|
9331
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
|
|
9332
9332
|
}
|
|
9333
9333
|
const roleID = _optionalChain([assign, 'optionalAccess', _39 => _39.roleID]);
|
|
9334
9334
|
if (assign !== void 0 && !isPositiveInt(roleID)) {
|
|
9335
|
-
throw new (0,
|
|
9335
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("openWithNoteAndAssign: assign.roleID is required (a positive integer) \u2014 the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)", { operation: OP_OPEN });
|
|
9336
9336
|
}
|
|
9337
9337
|
if (assign !== void 0 && assignee !== void 0) {
|
|
9338
9338
|
const rid = assignee;
|
|
@@ -9367,7 +9367,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
9367
9367
|
if (assign !== void 0) {
|
|
9368
9368
|
warnings.push(`the assignment is the v0.6.0 MERGE update (unredacted GET + collection PUT, 2 wire) setting assignedResourceID ${String(assignee)} + assignedResourceRoleID ${String(roleID)} (the vendor requires both \u2014 S12-A live-verified); a failure lands in steps[] as ASSIGN_FAILED (the applied ticketId is still returned).`);
|
|
9369
9369
|
}
|
|
9370
|
-
return
|
|
9370
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
9371
9371
|
{
|
|
9372
9372
|
operation: OP_OPEN,
|
|
9373
9373
|
method: "POST",
|
|
@@ -9409,8 +9409,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
9409
9409
|
`openWithNoteAndAssign: the vendor rejected the ticket create naming 'queueID' (the ww29 live-required set is { title, status, priority, companyID, queueID }) and the node never guesses a queue${detail ? ` \u2014 ${detail}` : ""}`,
|
|
9410
9410
|
{
|
|
9411
9411
|
operation: OP_OPEN,
|
|
9412
|
-
httpStatus:
|
|
9413
|
-
vendorError:
|
|
9412
|
+
httpStatus: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
9413
|
+
vendorError: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
|
|
9414
9414
|
}
|
|
9415
9415
|
);
|
|
9416
9416
|
}
|
|
@@ -9425,8 +9425,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
9425
9425
|
named,
|
|
9426
9426
|
{
|
|
9427
9427
|
operation: OP_OPEN,
|
|
9428
|
-
httpStatus:
|
|
9429
|
-
vendorError:
|
|
9428
|
+
httpStatus: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
9429
|
+
vendorError: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
9430
9430
|
resourceIds: [companyID]
|
|
9431
9431
|
}
|
|
9432
9432
|
);
|
|
@@ -9448,10 +9448,10 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
9448
9448
|
try {
|
|
9449
9449
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN);
|
|
9450
9450
|
if (current === null) {
|
|
9451
|
-
throw new (0,
|
|
9451
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId] });
|
|
9452
9452
|
}
|
|
9453
9453
|
ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
|
|
9454
|
-
const merged =
|
|
9454
|
+
const merged = _chunkYKEX4SK7cjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
|
|
9455
9455
|
merged.id = ticketId;
|
|
9456
9456
|
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN });
|
|
9457
9457
|
assigned = true;
|
|
@@ -9472,7 +9472,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
9472
9472
|
var STATUS_REQUIRED_FIELDS = {
|
|
9473
9473
|
// <discovery output lands here — e.g. 8: { requiredFields: ['dueDateTime'], safeDefaults: { dueDateTime: '<now>' } }>
|
|
9474
9474
|
};
|
|
9475
|
-
var StatusUnknownError = class extends
|
|
9475
|
+
var StatusUnknownError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
9476
9476
|
/** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
|
|
9477
9477
|
|
|
9478
9478
|
constructor(message, options = {}) {
|
|
@@ -9486,7 +9486,7 @@ var StatusUnknownError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
9486
9486
|
this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
|
|
9487
9487
|
}
|
|
9488
9488
|
};
|
|
9489
|
-
var StatusFieldsRequiredError = class extends
|
|
9489
|
+
var StatusFieldsRequiredError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
9490
9490
|
|
|
9491
9491
|
|
|
9492
9492
|
|
|
@@ -9515,16 +9515,16 @@ async function readLiveStatusSet(resource) {
|
|
|
9515
9515
|
}
|
|
9516
9516
|
var GUARD_DEGRADED_WARNING = "the tenant's live status picklist metadata was unavailable (the local guard is degraded for this call \u2014 the W-A4 wall or a metadata failure); the vendor's own validation is the final authority on the status value";
|
|
9517
9517
|
async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
9518
|
-
const ticketId =
|
|
9518
|
+
const ticketId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
9519
9519
|
if (!isPositiveInt(targetStatus)) {
|
|
9520
|
-
throw new (0,
|
|
9520
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
|
|
9521
9521
|
}
|
|
9522
9522
|
let liveStatus = null;
|
|
9523
9523
|
try {
|
|
9524
9524
|
const ids = await readLiveStatusSet(resource);
|
|
9525
9525
|
if (ids.size > 0) liveStatus = ids;
|
|
9526
9526
|
} catch (err) {
|
|
9527
|
-
if (!
|
|
9527
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
9528
9528
|
}
|
|
9529
9529
|
if (liveStatus !== null && !liveStatus.has(targetStatus)) {
|
|
9530
9530
|
_optionalChain([http, 'access', _40 => _40.fieldCache, 'optionalAccess', _41 => _41.invalidate, 'call', _42 => _42("tickets")]);
|
|
@@ -9534,7 +9534,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9534
9534
|
const freshIds = await readLiveStatusSet(resource);
|
|
9535
9535
|
if (freshIds.size > 0) freshStatus = freshIds;
|
|
9536
9536
|
} catch (err) {
|
|
9537
|
-
if (!
|
|
9537
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
9538
9538
|
freshStatus = null;
|
|
9539
9539
|
reReadFailed = true;
|
|
9540
9540
|
}
|
|
@@ -9551,16 +9551,16 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9551
9551
|
}
|
|
9552
9552
|
const guardDegraded = liveStatus === null;
|
|
9553
9553
|
if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
|
|
9554
|
-
throw new (0,
|
|
9554
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
|
|
9555
9555
|
}
|
|
9556
9556
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);
|
|
9557
9557
|
if (current === null) {
|
|
9558
|
-
throw new (0,
|
|
9558
|
+
throw new (0, _chunkYKEX4SK7cjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId] });
|
|
9559
9559
|
}
|
|
9560
9560
|
const previousStatus = typeof current.status === "number" ? current.status : null;
|
|
9561
9561
|
if (previousStatus === targetStatus) {
|
|
9562
9562
|
if (opts.dryRun === true) {
|
|
9563
|
-
return
|
|
9563
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
9564
9564
|
{
|
|
9565
9565
|
operation: OP_STATUS,
|
|
9566
9566
|
method: "PUT",
|
|
@@ -9614,7 +9614,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9614
9614
|
if (mapEntry === void 0) {
|
|
9615
9615
|
warnings.push(`status ${targetStatus} has no entry in the live-discovered required-field map yet \u2014 if the vendor 500 names a required field without a safe default, the apply throws the typed STATUS_FIELDS_REQUIRED (the caller supplies the value; never a blind retry).`);
|
|
9616
9616
|
}
|
|
9617
|
-
return
|
|
9617
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
9618
9618
|
{
|
|
9619
9619
|
operation: OP_STATUS,
|
|
9620
9620
|
method: "PUT",
|
|
@@ -9633,7 +9633,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9633
9633
|
);
|
|
9634
9634
|
}
|
|
9635
9635
|
const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _45 => _45.safeDefaults]), () => ( {}));
|
|
9636
|
-
const body =
|
|
9636
|
+
const body = _chunkYKEX4SK7cjs.mergePartialBody.call(void 0, current, mergeData);
|
|
9637
9637
|
body.id = ticketId;
|
|
9638
9638
|
let merges = 0;
|
|
9639
9639
|
for (; ; ) {
|
|
@@ -9657,8 +9657,8 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9657
9657
|
{ vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
|
|
9658
9658
|
{
|
|
9659
9659
|
operation: OP_STATUS,
|
|
9660
|
-
httpStatus:
|
|
9661
|
-
vendorError:
|
|
9660
|
+
httpStatus: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
9661
|
+
vendorError: _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
9662
9662
|
resourceIds: [ticketId]
|
|
9663
9663
|
}
|
|
9664
9664
|
);
|
|
@@ -9668,7 +9668,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9668
9668
|
}
|
|
9669
9669
|
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);
|
|
9670
9670
|
if (verify === null) {
|
|
9671
|
-
throw new (0,
|
|
9671
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
|
|
9672
9672
|
code: "INVALID_RESPONSE",
|
|
9673
9673
|
category: "server",
|
|
9674
9674
|
operation: OP_STATUS,
|
|
@@ -9677,7 +9677,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
9677
9677
|
}
|
|
9678
9678
|
const finalStatus = typeof verify.status === "number" ? verify.status : null;
|
|
9679
9679
|
if (finalStatus !== targetStatus) {
|
|
9680
|
-
throw new (0,
|
|
9680
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskError)(
|
|
9681
9681
|
`changeStatus: the post-PUT read-back shows status ${_nullishCoalesce(finalStatus, () => ( "unknown"))} (the vendor 200ed the PUT but did not apply ${targetStatus} \u2014 the F-A1 lesson: the 200 proves nothing)`,
|
|
9682
9682
|
{
|
|
9683
9683
|
code: "INVALID_RESPONSE",
|
|
@@ -9695,7 +9695,7 @@ var DEFAULT_PART_LIMIT = 50;
|
|
|
9695
9695
|
function partLimit(value, name) {
|
|
9696
9696
|
const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
|
|
9697
9697
|
if (!Number.isInteger(n) || n < 1) {
|
|
9698
|
-
throw new (0,
|
|
9698
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
9699
9699
|
}
|
|
9700
9700
|
return n;
|
|
9701
9701
|
}
|
|
@@ -9711,7 +9711,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
9711
9711
|
const noteLimit = partLimit(opts.noteLimit, "noteLimit");
|
|
9712
9712
|
const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
|
|
9713
9713
|
const textLimit = partLimit(opts.textLimit, "textLimit");
|
|
9714
|
-
const ticketId =
|
|
9714
|
+
const ticketId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
9715
9715
|
const ctx = await resource.getContext(ticketId);
|
|
9716
9716
|
const op = "tickets.fullContext";
|
|
9717
9717
|
const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -9765,7 +9765,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
9765
9765
|
result.truncated = result.truncated || part.capped || historyRows.some((h) => h.detailTruncated === true);
|
|
9766
9766
|
}
|
|
9767
9767
|
if (opts.names === true) {
|
|
9768
|
-
const builder =
|
|
9768
|
+
const builder = _chunkYKEX4SK7cjs.createNamePlan.call(void 0, _chunkYKEX4SK7cjs.TICKET_LABEL_FIELDS);
|
|
9769
9769
|
const t = ctx.ticket;
|
|
9770
9770
|
builder.addResource(t["creatorResourceID"]);
|
|
9771
9771
|
builder.addFk("contract", t["contractID"]);
|
|
@@ -9777,20 +9777,20 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
9777
9777
|
builder.addFk("billingCode", e["billingCodeID"]);
|
|
9778
9778
|
builder.addFk("contract", e["contractID"]);
|
|
9779
9779
|
}
|
|
9780
|
-
const names = await
|
|
9780
|
+
const names = await _chunkYKEX4SK7cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
9781
9781
|
const ticketRow = { ...ctx.ticket };
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
for (const f of
|
|
9782
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
|
|
9783
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
|
|
9784
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
9785
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
9786
|
+
for (const f of _chunkYKEX4SK7cjs.TICKET_LABEL_FIELDS) _chunkYKEX4SK7cjs.addLabelSibling.call(void 0, ticketRow, f, names);
|
|
9787
9787
|
result.ticket = ticketRow;
|
|
9788
9788
|
result.timeEntries.items = entriesPart.items.map((e) => {
|
|
9789
9789
|
const row = { ...e };
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9790
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
|
|
9791
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
|
|
9792
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
9793
|
+
_chunkYKEX4SK7cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
9794
9794
|
return row;
|
|
9795
9795
|
});
|
|
9796
9796
|
result.names = names.section;
|
|
@@ -9800,7 +9800,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
9800
9800
|
}
|
|
9801
9801
|
|
|
9802
9802
|
// src/resources/tickets.ts
|
|
9803
|
-
var TicketsResource = class extends
|
|
9803
|
+
var TicketsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
9804
9804
|
constructor(http, pageSize) {
|
|
9805
9805
|
super(http, {
|
|
9806
9806
|
key: "tickets",
|
|
@@ -9906,7 +9906,7 @@ var TicketsResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
9906
9906
|
};
|
|
9907
9907
|
|
|
9908
9908
|
// src/resources/ticket_webhooks.ts
|
|
9909
|
-
var TicketWebhooksResource = class extends
|
|
9909
|
+
var TicketWebhooksResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
9910
9910
|
constructor(http, pageSize) {
|
|
9911
9911
|
super(http, {
|
|
9912
9912
|
key: "ticket_webhooks",
|
|
@@ -9992,7 +9992,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
|
|
|
9992
9992
|
body: { MaxRecords: limit, filter },
|
|
9993
9993
|
operation
|
|
9994
9994
|
});
|
|
9995
|
-
const { items, pageDetails } =
|
|
9995
|
+
const { items, pageDetails } = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res);
|
|
9996
9996
|
return { items, hasMore: pageDetails.nextPageUrl != null };
|
|
9997
9997
|
}
|
|
9998
9998
|
async function windowQuery3(_resource, kind, http, opts) {
|
|
@@ -10011,7 +10011,7 @@ async function customRange3(_resource, from, to, http, opts) {
|
|
|
10011
10011
|
const fromB = customRangeDay(from, "from", zone, "customRange");
|
|
10012
10012
|
const toB = customRangeDay(to, "to", zone, "customRange");
|
|
10013
10013
|
if (fromB.ms > toB.ms) {
|
|
10014
|
-
throw new (0,
|
|
10014
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("customRange: from must not be after to");
|
|
10015
10015
|
}
|
|
10016
10016
|
const toEndMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
10017
10017
|
const filter = [
|
|
@@ -10036,7 +10036,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
|
|
|
10036
10036
|
const fromB = customRangeDay(from, "from", zone, OP2);
|
|
10037
10037
|
const toB = customRangeDay(to, "to", zone, OP2);
|
|
10038
10038
|
if (fromB.ms > toB.ms) {
|
|
10039
|
-
throw new (0,
|
|
10039
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(`${OP2}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP2 });
|
|
10040
10040
|
}
|
|
10041
10041
|
const windowToMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
10042
10042
|
const filter = [
|
|
@@ -10103,13 +10103,13 @@ var LINKAGE_OWNED_FIELDS = /* @__PURE__ */ new Set([
|
|
|
10103
10103
|
"roleID"
|
|
10104
10104
|
]);
|
|
10105
10105
|
var TIME_WINDOW_FIELDS = /* @__PURE__ */ new Set(["dateWorked", "startDateTime", "endDateTime", "hoursWorked"]);
|
|
10106
|
-
var ResourceInvalidError = class extends
|
|
10106
|
+
var ResourceInvalidError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
10107
10107
|
constructor(message, options = {}) {
|
|
10108
10108
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
10109
10109
|
this.name = "ResourceInvalidError";
|
|
10110
10110
|
}
|
|
10111
10111
|
};
|
|
10112
|
-
var AllocationCodeError = class extends
|
|
10112
|
+
var AllocationCodeError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
10113
10113
|
/** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
|
|
10114
10114
|
|
|
10115
10115
|
constructor(kind, message, options = {}) {
|
|
@@ -10118,7 +10118,7 @@ var AllocationCodeError = class extends _chunkWTVLHMZAcjs.AutotaskError {
|
|
|
10118
10118
|
this.kind = kind;
|
|
10119
10119
|
}
|
|
10120
10120
|
};
|
|
10121
|
-
var NoApplicableAllocationCodeError = class extends
|
|
10121
|
+
var NoApplicableAllocationCodeError = class extends _chunkYKEX4SK7cjs.AutotaskError {
|
|
10122
10122
|
/** The structured blocker details (filters tried + department sets). */
|
|
10123
10123
|
|
|
10124
10124
|
constructor(details, options = {}) {
|
|
@@ -10144,7 +10144,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
10144
10144
|
let pages = 0;
|
|
10145
10145
|
for (; ; ) {
|
|
10146
10146
|
if (pages >= PAGE_GUARD) {
|
|
10147
|
-
throw new (0,
|
|
10147
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
|
|
10148
10148
|
code: "RESOLUTION_TRUNCATED",
|
|
10149
10149
|
category: "resolution",
|
|
10150
10150
|
operation,
|
|
@@ -10155,11 +10155,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
10155
10155
|
const res = await http.request({
|
|
10156
10156
|
method: "POST",
|
|
10157
10157
|
idempotent: true,
|
|
10158
|
-
path: isFirst ? path :
|
|
10158
|
+
path: isFirst ? path : _chunkYKEX4SK7cjs.cursorToPath.call(void 0, http.baseUrl, cursor),
|
|
10159
10159
|
body: { MaxRecords: pageSize, filter },
|
|
10160
10160
|
operation
|
|
10161
10161
|
});
|
|
10162
|
-
const { items: pageItems, pageDetails } =
|
|
10162
|
+
const { items: pageItems, pageDetails } = _chunkYKEX4SK7cjs.unwrapItems.call(void 0, res, operation);
|
|
10163
10163
|
items.push(...pageItems);
|
|
10164
10164
|
pages += 1;
|
|
10165
10165
|
if (items.length >= totalCap) break;
|
|
@@ -10272,8 +10272,8 @@ function windowDefaults(params) {
|
|
|
10272
10272
|
};
|
|
10273
10273
|
}
|
|
10274
10274
|
async function createForResource(resource, resourceID, params, opts = {}, http) {
|
|
10275
|
-
const rid =
|
|
10276
|
-
const pin = (value, label) => typeof value === "number" ?
|
|
10275
|
+
const rid = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, resourceID, "resourceID");
|
|
10276
|
+
const pin = (value, label) => typeof value === "number" ? _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, value, label) : void 0;
|
|
10277
10277
|
const pins = {
|
|
10278
10278
|
code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
|
|
10279
10279
|
ticket: pin(params.ticketID, "ticketID"),
|
|
@@ -10282,19 +10282,19 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
10282
10282
|
};
|
|
10283
10283
|
const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
|
|
10284
10284
|
if (pinCount > 1) {
|
|
10285
|
-
throw new (0,
|
|
10285
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
10286
10286
|
"createForResource: exactly one linkage pin is honoured (internallAllocationCodeID | ticketID | taskID) \u2014 the vendor gate requires exactly one; pass one pin (or none for the default internal linkage)",
|
|
10287
10287
|
{ operation: OP }
|
|
10288
10288
|
);
|
|
10289
10289
|
}
|
|
10290
10290
|
if (pins.role !== void 0 && pins.code !== void 0) {
|
|
10291
|
-
throw new (0,
|
|
10291
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
10292
10292
|
"createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
|
|
10293
10293
|
{ operation: OP }
|
|
10294
10294
|
);
|
|
10295
10295
|
}
|
|
10296
10296
|
if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
|
|
10297
|
-
throw new (0,
|
|
10297
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)(
|
|
10298
10298
|
`createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
|
|
10299
10299
|
{ operation: OP }
|
|
10300
10300
|
);
|
|
@@ -10371,7 +10371,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
10371
10371
|
if (usedLinkage === "internal" && linkage === "task") {
|
|
10372
10372
|
warnings.push("the task had zero applicable general allocation codes \u2014 the linkage fell back to internal (the sanctioned fallback; no taskID/roleID in the body).");
|
|
10373
10373
|
}
|
|
10374
|
-
return
|
|
10374
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0,
|
|
10375
10375
|
{
|
|
10376
10376
|
operation: OP,
|
|
10377
10377
|
method: "POST",
|
|
@@ -10410,7 +10410,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
10410
10410
|
};
|
|
10411
10411
|
} catch (err) {
|
|
10412
10412
|
lastError = err;
|
|
10413
|
-
const text =
|
|
10413
|
+
const text = _chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkYKEX4SK7cjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
|
|
10414
10414
|
const gate3 = ROLE_REJECTION_PATTERN.test(text);
|
|
10415
10415
|
if (usedLinkage !== "internal" && gate3) {
|
|
10416
10416
|
if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
|
|
@@ -10430,14 +10430,14 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
10430
10430
|
throw err;
|
|
10431
10431
|
}
|
|
10432
10432
|
}
|
|
10433
|
-
if (
|
|
10433
|
+
if (_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, lastError)) {
|
|
10434
10434
|
lastError.suggestedAction = (lastError.suggestedAction ? `${lastError.suggestedAction} ` : "") + `The createForResource attempt budget (${MAX_CREATE_ATTEMPTS} attempts: the role ladder + ${MAX_DISCOVERY_MERGES2} discovery merges) was exhausted \u2014 the vendor oracle rejected every candidate. Re-read the record/fields (operations.fieldCatalog, billing_codes.query with a filter) and retry with an explicit pin.`;
|
|
10435
10435
|
}
|
|
10436
10436
|
throw lastError;
|
|
10437
10437
|
}
|
|
10438
10438
|
function discoveryField(err, body, defaults) {
|
|
10439
|
-
if (!
|
|
10440
|
-
const entries =
|
|
10439
|
+
if (!_chunkYKEX4SK7cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
10440
|
+
const entries = _chunkYKEX4SK7cjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
10441
10441
|
if (entries === void 0) return null;
|
|
10442
10442
|
for (const entry of entries) {
|
|
10443
10443
|
const field = entry.field;
|
|
@@ -10450,7 +10450,7 @@ function discoveryField(err, body, defaults) {
|
|
|
10450
10450
|
}
|
|
10451
10451
|
|
|
10452
10452
|
// src/resources/time_entries.ts
|
|
10453
|
-
var TimeEntriesResource = class extends
|
|
10453
|
+
var TimeEntriesResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
10454
10454
|
constructor(http, pageSize) {
|
|
10455
10455
|
super(http, {
|
|
10456
10456
|
key: "time_entries",
|
|
@@ -10587,7 +10587,7 @@ var TimeEntriesResource = class extends _chunkWTVLHMZAcjs.BaseResource {
|
|
|
10587
10587
|
};
|
|
10588
10588
|
|
|
10589
10589
|
// src/resources/time_entry_attachments.ts
|
|
10590
|
-
var TimeEntryAttachmentsResource = class extends
|
|
10590
|
+
var TimeEntryAttachmentsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
10591
10591
|
constructor(http, pageSize) {
|
|
10592
10592
|
super(http, {
|
|
10593
10593
|
key: "time_entry_attachments",
|
|
@@ -10650,9 +10650,9 @@ var TimeEntryAttachmentsResource = class extends _chunkWTVLHMZAcjs.BaseResource
|
|
|
10650
10650
|
|
|
10651
10651
|
// src/resources/special/time_off_requests.ts
|
|
10652
10652
|
async function approve(_resource, id, opts = {}, http) {
|
|
10653
|
-
const numericId =
|
|
10653
|
+
const numericId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
10654
10654
|
if (opts.dryRun === true) {
|
|
10655
|
-
return
|
|
10655
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
10656
10656
|
operation: "time_off_requests.approve",
|
|
10657
10657
|
method: "GET",
|
|
10658
10658
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
@@ -10667,16 +10667,16 @@ async function approve(_resource, id, opts = {}, http) {
|
|
|
10667
10667
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
10668
10668
|
operation: "time_off_requests.approve"
|
|
10669
10669
|
});
|
|
10670
|
-
return
|
|
10670
|
+
return _chunkYKEX4SK7cjs.unwrapOperation.call(void 0, res);
|
|
10671
10671
|
}
|
|
10672
10672
|
async function reject(_resource, id, reason, opts = {}, http) {
|
|
10673
|
-
const numericId =
|
|
10673
|
+
const numericId = _chunkYKEX4SK7cjs.parseIdentifier.call(void 0, id, "id");
|
|
10674
10674
|
const text = reason.trim();
|
|
10675
10675
|
if (text === "") {
|
|
10676
|
-
throw new (0,
|
|
10676
|
+
throw new (0, _chunkYKEX4SK7cjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
|
|
10677
10677
|
}
|
|
10678
10678
|
if (opts.dryRun === true) {
|
|
10679
|
-
return
|
|
10679
|
+
return _chunkYKEX4SK7cjs.buildDryRunResult.call(void 0, {
|
|
10680
10680
|
operation: "time_off_requests.reject",
|
|
10681
10681
|
method: "POST",
|
|
10682
10682
|
path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
|
|
@@ -10693,11 +10693,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
|
|
|
10693
10693
|
body: { timeOffRequestID: numericId, reason: text },
|
|
10694
10694
|
operation: "time_off_requests.reject"
|
|
10695
10695
|
});
|
|
10696
|
-
return
|
|
10696
|
+
return _chunkYKEX4SK7cjs.unwrapOperation.call(void 0, res);
|
|
10697
10697
|
}
|
|
10698
10698
|
|
|
10699
10699
|
// src/resources/time_off_requests.ts
|
|
10700
|
-
var TimeOffRequestsResource = class extends
|
|
10700
|
+
var TimeOffRequestsResource = class extends _chunkYKEX4SK7cjs.BaseResource {
|
|
10701
10701
|
constructor(http, pageSize) {
|
|
10702
10702
|
super(http, {
|
|
10703
10703
|
key: "time_off_requests",
|