node-autotask 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/MCP_TOOL_CATALOG.json +151 -9
- package/MCP_TOOL_MANIFEST.md +26 -21
- package/N8N_MCP_MANIFEST.json +3 -3
- package/N8N_MCP_MANIFEST.md +4 -4
- package/README.md +1 -1
- package/capabilities.json +2451 -1674
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +4 -1
- package/dist/capabilities.d.ts +4 -1
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-SOHQ6SDI.cjs → chunk-5OGJTS2E.cjs} +138 -135
- package/dist/{chunk-ICCU2S62.js → chunk-7DOSJS6S.js} +5 -2
- package/dist/{chunk-LVBFLSPL.cjs → chunk-HQGE4WAV.cjs} +45 -3
- package/dist/{chunk-WJD26CPN.js → chunk-QXWIQ67O.js} +2450 -1673
- package/dist/{chunk-SW66OWM5.cjs → chunk-SG4LIVMG.cjs} +523 -478
- package/dist/{chunk-BBQBWVBE.js → chunk-SSUECUVN.js} +44 -2
- package/dist/{chunk-IOVFTIW6.js → chunk-VVQ6NJYZ.js} +47 -2
- package/dist/{chunk-4VAC2Z55.cjs → chunk-WM6E5O55.cjs} +2450 -1673
- package/dist/{index-BVtycq-6.d.cts → index-1zBdJIEy.d.cts} +42 -1
- package/dist/{index-BVtycq-6.d.ts → index-1zBdJIEy.d.ts} +42 -1
- package/dist/{index-C0OwQhon.d.cts → index-C8QH3BkP.d.ts} +38 -3
- package/dist/{index-CZ94y401.d.ts → index-CKYr0unq.d.cts} +38 -3
- package/dist/index.cjs +26 -24
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -6
- package/dist/operations/index.cjs +147 -108
- package/dist/operations/index.d.cts +19 -9
- package/dist/operations/index.d.ts +19 -9
- package/dist/operations/index.js +42 -3
- package/dist/pool.cjs +8 -8
- package/dist/pool.d.cts +2 -2
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +7 -5
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +6 -4
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/docs/API.md +10 -1
- package/package.json +3 -3
- /package/dist/{chunk-DMMMWO6A.js → chunk-2TWKEB2L.js} +0 -0
- /package/dist/{chunk-UPQIUWOS.js → chunk-EBCHCNPK.js} +0 -0
- /package/dist/{chunk-FLB2X6O5.cjs → chunk-S643FDOR.cjs} +0 -0
- /package/dist/{chunk-IDPB4N2Q.cjs → chunk-W3K5BEVY.cjs} +0 -0
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkHQGE4WAVcjs = require('./chunk-HQGE4WAV.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkWM6E5O55cjs = require('./chunk-WM6E5O55.cjs');
|
|
45
45
|
|
|
46
46
|
// src/resources/appointments.ts
|
|
47
|
-
var AppointmentsResource = class extends
|
|
47
|
+
var AppointmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
48
48
|
constructor(http, pageSize) {
|
|
49
49
|
super(http, {
|
|
50
50
|
key: "appointments",
|
|
@@ -129,7 +129,7 @@ var AuthenticateResource = class {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
// src/resources/billing_codes.ts
|
|
132
|
-
var BillingCodesResource = class extends
|
|
132
|
+
var BillingCodesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
133
133
|
constructor(http, pageSize) {
|
|
134
134
|
super(http, {
|
|
135
135
|
key: "billing_codes",
|
|
@@ -179,7 +179,7 @@ var MAX_LIMIT = 500;
|
|
|
179
179
|
function clampWindowLimit(limit) {
|
|
180
180
|
const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
|
|
181
181
|
if (!Number.isInteger(n) || n < 1) {
|
|
182
|
-
throw new (0,
|
|
182
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
183
183
|
}
|
|
184
184
|
return Math.min(n, MAX_LIMIT);
|
|
185
185
|
}
|
|
@@ -225,7 +225,7 @@ function wallParts(tz, ms) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
|
|
228
|
-
throw new (0,
|
|
228
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
|
|
229
229
|
}
|
|
230
230
|
return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
|
|
231
231
|
}
|
|
@@ -252,7 +252,7 @@ function localDayEndMs(y, m, d, tz) {
|
|
|
252
252
|
}
|
|
253
253
|
function validateZone(tz, opName = "dateWindow") {
|
|
254
254
|
if (typeof tz !== "string" || tz.length === 0) {
|
|
255
|
-
throw new (0,
|
|
255
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
256
256
|
`${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
257
257
|
{ operation: opName }
|
|
258
258
|
);
|
|
@@ -260,7 +260,7 @@ function validateZone(tz, opName = "dateWindow") {
|
|
|
260
260
|
try {
|
|
261
261
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
262
262
|
} catch (e2) {
|
|
263
|
-
throw new (0,
|
|
263
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
264
264
|
`${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
265
265
|
{ operation: opName }
|
|
266
266
|
);
|
|
@@ -420,13 +420,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
|
|
|
420
420
|
body: { MaxRecords: limit, filter },
|
|
421
421
|
operation
|
|
422
422
|
});
|
|
423
|
-
return
|
|
423
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
424
424
|
}
|
|
425
425
|
var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
|
|
426
426
|
function customRangeDay(value, label, zone, opName) {
|
|
427
427
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
|
|
428
428
|
if (!m) {
|
|
429
|
-
throw new (0,
|
|
429
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
430
430
|
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)})`,
|
|
431
431
|
{ operation: opName }
|
|
432
432
|
);
|
|
@@ -438,7 +438,7 @@ function customRangeDay(value, label, zone, opName) {
|
|
|
438
438
|
const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
|
|
439
439
|
const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
|
|
440
440
|
if (!Number.isFinite(ms)) {
|
|
441
|
-
throw new (0,
|
|
441
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
442
442
|
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)})`,
|
|
443
443
|
{ operation: opName }
|
|
444
444
|
);
|
|
@@ -449,7 +449,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
449
449
|
const fromB = customRangeDay(from, "from", zone, operation);
|
|
450
450
|
const toB = customRangeDay(to, "to", zone, operation);
|
|
451
451
|
if (fromB.ms > toB.ms) {
|
|
452
|
-
throw new (0,
|
|
452
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
453
453
|
`${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
|
|
454
454
|
{ operation }
|
|
455
455
|
);
|
|
@@ -466,7 +466,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
466
466
|
body: { MaxRecords: limit, filter },
|
|
467
467
|
operation
|
|
468
468
|
});
|
|
469
|
-
return
|
|
469
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
// src/resources/special/billing_items.ts
|
|
@@ -499,7 +499,7 @@ async function customRange(_resource, from, to, http, opts) {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
// src/resources/billing_items.ts
|
|
502
|
-
var BillingItemsResource = class extends
|
|
502
|
+
var BillingItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
503
503
|
constructor(http, pageSize) {
|
|
504
504
|
super(http, {
|
|
505
505
|
key: "billing_items",
|
|
@@ -601,7 +601,7 @@ var BillingItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
601
601
|
};
|
|
602
602
|
|
|
603
603
|
// src/resources/change_request_links.ts
|
|
604
|
-
var ChangeRequestLinksResource = class extends
|
|
604
|
+
var ChangeRequestLinksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
605
605
|
constructor(http, pageSize) {
|
|
606
606
|
super(http, {
|
|
607
607
|
key: "change_request_links",
|
|
@@ -655,7 +655,7 @@ var ChangeRequestLinksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
655
655
|
};
|
|
656
656
|
|
|
657
657
|
// src/resources/checklist_libraries.ts
|
|
658
|
-
var ChecklistLibrariesResource = class extends
|
|
658
|
+
var ChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
659
659
|
constructor(http, pageSize) {
|
|
660
660
|
super(http, {
|
|
661
661
|
key: "checklist_libraries",
|
|
@@ -729,7 +729,7 @@ var ChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
729
729
|
};
|
|
730
730
|
|
|
731
731
|
// src/resources/checklist_library_checklist_items.ts
|
|
732
|
-
var ChecklistLibraryChecklistItemsResource = class extends
|
|
732
|
+
var ChecklistLibraryChecklistItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
733
733
|
constructor(http, pageSize) {
|
|
734
734
|
super(http, {
|
|
735
735
|
key: "checklist_library_checklist_items",
|
|
@@ -795,7 +795,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkLVBFLSPLcjs.Bas
|
|
|
795
795
|
};
|
|
796
796
|
|
|
797
797
|
// src/resources/classification_icons.ts
|
|
798
|
-
var ClassificationIconsResource = class extends
|
|
798
|
+
var ClassificationIconsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
799
799
|
constructor(http, pageSize) {
|
|
800
800
|
super(http, {
|
|
801
801
|
key: "classification_icons",
|
|
@@ -902,7 +902,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
|
|
|
902
902
|
body,
|
|
903
903
|
operation
|
|
904
904
|
});
|
|
905
|
-
const { items, pageDetails } =
|
|
905
|
+
const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
|
|
906
906
|
const capped = items.length >= limit;
|
|
907
907
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
908
908
|
}
|
|
@@ -912,7 +912,7 @@ var DEFAULT_LIMIT2 = 25;
|
|
|
912
912
|
var MAX_LIMIT2 = 500;
|
|
913
913
|
function clampLimit(limit) {
|
|
914
914
|
const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
|
|
915
|
-
if (!Number.isInteger(n) || n < 1) throw new (0,
|
|
915
|
+
if (!Number.isInteger(n) || n < 1) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
916
916
|
return Math.min(n, MAX_LIMIT2);
|
|
917
917
|
}
|
|
918
918
|
|
|
@@ -925,7 +925,7 @@ async function queryCompanies(http, filter, limit) {
|
|
|
925
925
|
body: { MaxRecords: limit, filter },
|
|
926
926
|
operation: "companies.searchByDomain"
|
|
927
927
|
});
|
|
928
|
-
return
|
|
928
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
929
929
|
}
|
|
930
930
|
async function queryContacts(http, filter, limit) {
|
|
931
931
|
const res = await http.request({
|
|
@@ -935,7 +935,7 @@ async function queryContacts(http, filter, limit) {
|
|
|
935
935
|
body: { MaxRecords: limit, filter },
|
|
936
936
|
operation: "companies.searchByDomain"
|
|
937
937
|
});
|
|
938
|
-
return
|
|
938
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
939
939
|
}
|
|
940
940
|
async function fetchCompanies(http, ids2, limit) {
|
|
941
941
|
const out = [];
|
|
@@ -950,7 +950,7 @@ async function fetchCompanies(http, ids2, limit) {
|
|
|
950
950
|
const item = body && "item" in body ? body.item : null;
|
|
951
951
|
if (item) out.push(item);
|
|
952
952
|
} catch (err) {
|
|
953
|
-
if (err instanceof
|
|
953
|
+
if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) continue;
|
|
954
954
|
throw err;
|
|
955
955
|
}
|
|
956
956
|
}
|
|
@@ -958,7 +958,7 @@ async function fetchCompanies(http, ids2, limit) {
|
|
|
958
958
|
}
|
|
959
959
|
async function searchByDomain(_resource, domain, opts = {}, http) {
|
|
960
960
|
const text = domain.trim();
|
|
961
|
-
if (text === "") throw new (0,
|
|
961
|
+
if (text === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("searchByDomain: empty domain");
|
|
962
962
|
const limit = clampLimit(opts.limit);
|
|
963
963
|
const filter = [{ field: "webAddress", op: "contains", value: text }];
|
|
964
964
|
const direct = await queryCompanies(http, filter, limit);
|
|
@@ -972,7 +972,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
|
|
|
972
972
|
const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
|
|
973
973
|
const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
|
|
974
974
|
if (name === "" && email === "" && website === "") {
|
|
975
|
-
throw new (0,
|
|
975
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
|
|
976
976
|
}
|
|
977
977
|
const limit = clampLimit(opts.limit);
|
|
978
978
|
const found = /* @__PURE__ */ new Map();
|
|
@@ -1001,23 +1001,23 @@ async function familyChildPage(http, parentID) {
|
|
|
1001
1001
|
path: "/V1.0/Companies/query",
|
|
1002
1002
|
body: {
|
|
1003
1003
|
MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
|
|
1004
|
-
filter:
|
|
1004
|
+
filter: _chunkHQGE4WAVcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
|
|
1005
1005
|
},
|
|
1006
1006
|
operation: "companies.search"
|
|
1007
1007
|
});
|
|
1008
|
-
const { items, pageDetails } =
|
|
1008
|
+
const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "companies.search");
|
|
1009
1009
|
return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
|
|
1010
1010
|
}
|
|
1011
1011
|
function assertSearchWithDetailOpts(opts) {
|
|
1012
1012
|
if (opts === void 0) return;
|
|
1013
1013
|
if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
|
|
1014
|
-
throw new (0,
|
|
1014
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
|
|
1015
1015
|
operation: "companies.searchWithDetail"
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
for (const key of Object.keys(opts)) {
|
|
1019
1019
|
if (key !== "limit") {
|
|
1020
|
-
throw new (0,
|
|
1020
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
1021
1021
|
`companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
|
|
1022
1022
|
{ operation: "companies.searchWithDetail" }
|
|
1023
1023
|
);
|
|
@@ -1026,32 +1026,32 @@ function assertSearchWithDetailOpts(opts) {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
async function searchWithFamily(_resource, query, opts = {}, http) {
|
|
1028
1028
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1029
|
-
throw new (0,
|
|
1029
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
|
|
1030
1030
|
}
|
|
1031
1031
|
for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
|
|
1032
1032
|
if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
|
|
1033
|
-
throw new (0,
|
|
1033
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
1034
1034
|
`companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
|
|
1035
1035
|
{ operation: "companies.search" }
|
|
1036
1036
|
);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
|
|
1040
|
-
throw new (0,
|
|
1040
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
|
|
1041
1041
|
operation: "companies.search"
|
|
1042
1042
|
});
|
|
1043
1043
|
}
|
|
1044
1044
|
const text = query.trim();
|
|
1045
|
-
if (text === "") throw new (0,
|
|
1046
|
-
const limit = opts.limit === void 0 ? 25 :
|
|
1045
|
+
if (text === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
|
|
1046
|
+
const limit = opts.limit === void 0 ? 25 : _chunkHQGE4WAVcjs.clampPageSize.call(void 0, opts.limit);
|
|
1047
1047
|
const res = await http.request({
|
|
1048
1048
|
method: "POST",
|
|
1049
1049
|
idempotent: true,
|
|
1050
1050
|
path: "/V1.0/Companies/query",
|
|
1051
|
-
body: { MaxRecords: limit, filter:
|
|
1051
|
+
body: { MaxRecords: limit, filter: _chunkHQGE4WAVcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
|
|
1052
1052
|
operation: "companies.search"
|
|
1053
1053
|
});
|
|
1054
|
-
const hits =
|
|
1054
|
+
const hits = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "companies.search").items;
|
|
1055
1055
|
if (opts.includeFamily !== true) return hits;
|
|
1056
1056
|
const rows = [];
|
|
1057
1057
|
for (const hit of hits) {
|
|
@@ -1071,7 +1071,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
// src/resources/special/companies/errors.ts
|
|
1074
|
-
var OwnerResourceRequiredError = class extends
|
|
1074
|
+
var OwnerResourceRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
1075
1075
|
constructor(message, options = {}) {
|
|
1076
1076
|
super(message, {
|
|
1077
1077
|
code: "OWNER_RESOURCE_REQUIRED",
|
|
@@ -1082,13 +1082,13 @@ var OwnerResourceRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
1082
1082
|
this.name = "OwnerResourceRequiredError";
|
|
1083
1083
|
}
|
|
1084
1084
|
};
|
|
1085
|
-
var CompanyResourceInvalidError = class extends
|
|
1085
|
+
var CompanyResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
1086
1086
|
constructor(message, options = {}) {
|
|
1087
1087
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
1088
1088
|
this.name = "CompanyResourceInvalidError";
|
|
1089
1089
|
}
|
|
1090
1090
|
};
|
|
1091
|
-
var CompanyCreateFailedError = class extends
|
|
1091
|
+
var CompanyCreateFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
1092
1092
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
1093
1093
|
|
|
1094
1094
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -1107,23 +1107,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
|
|
|
1107
1107
|
var SAFE_COMPANY_CREATE_DEFAULTS = {};
|
|
1108
1108
|
function validateUpsertInput(companyName, params) {
|
|
1109
1109
|
if (typeof companyName !== "string" || companyName.trim() === "") {
|
|
1110
|
-
throw new (0,
|
|
1110
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
|
|
1111
1111
|
}
|
|
1112
1112
|
if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
|
|
1113
|
-
throw new (0,
|
|
1113
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
1114
1114
|
}
|
|
1115
1115
|
const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
|
|
1116
1116
|
if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
|
|
1117
|
-
throw new (0,
|
|
1117
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
1118
1118
|
}
|
|
1119
1119
|
const owner = params.ownerResourceID;
|
|
1120
1120
|
if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
|
|
1121
|
-
throw new (0,
|
|
1121
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
|
|
1122
1122
|
}
|
|
1123
1123
|
return { companyType, owner };
|
|
1124
1124
|
}
|
|
1125
1125
|
function existsDryRun(http, companyName, match) {
|
|
1126
|
-
return
|
|
1126
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
1127
1127
|
{
|
|
1128
1128
|
operation: OP_UPSERT_NAME,
|
|
1129
1129
|
method: "POST",
|
|
@@ -1149,7 +1149,7 @@ function createDryRun(http, body, owner) {
|
|
|
1149
1149
|
"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"
|
|
1150
1150
|
);
|
|
1151
1151
|
}
|
|
1152
|
-
return
|
|
1152
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
1153
1153
|
{
|
|
1154
1154
|
operation: OP_UPSERT_NAME,
|
|
1155
1155
|
method: "POST",
|
|
@@ -1194,8 +1194,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
|
|
|
1194
1194
|
sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
|
|
1195
1195
|
};
|
|
1196
1196
|
} catch (err) {
|
|
1197
|
-
if (!
|
|
1198
|
-
const named = (_nullishCoalesce(
|
|
1197
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
1198
|
+
const named = (_nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
1199
1199
|
const seen = /* @__PURE__ */ new Set();
|
|
1200
1200
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
1201
1201
|
const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -1209,7 +1209,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
continue;
|
|
1211
1211
|
}
|
|
1212
|
-
const detail =
|
|
1212
|
+
const detail = _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
1213
1213
|
throw new CompanyCreateFailedError(
|
|
1214
1214
|
`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}` : ""}`,
|
|
1215
1215
|
unique,
|
|
@@ -1270,30 +1270,30 @@ var LOCATION_LIMIT_MAX = 500;
|
|
|
1270
1270
|
function locationLimit(value) {
|
|
1271
1271
|
if (value === void 0) return PROFILE_PART_LIMIT;
|
|
1272
1272
|
if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
|
|
1273
|
-
throw new (0,
|
|
1273
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
|
|
1274
1274
|
}
|
|
1275
1275
|
return value;
|
|
1276
1276
|
}
|
|
1277
1277
|
function validateProjection(fields) {
|
|
1278
1278
|
if (fields === void 0) return {};
|
|
1279
1279
|
if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
|
|
1280
|
-
throw new (0,
|
|
1280
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
|
|
1281
1281
|
}
|
|
1282
1282
|
const out = {};
|
|
1283
1283
|
for (const [part, list] of Object.entries(fields)) {
|
|
1284
1284
|
if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
|
|
1285
|
-
throw new (0,
|
|
1285
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
|
|
1286
1286
|
}
|
|
1287
1287
|
if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
|
|
1288
|
-
throw new (0,
|
|
1288
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
|
|
1289
1289
|
}
|
|
1290
1290
|
const names = [...new Set(list)];
|
|
1291
1291
|
const entity = PART_ENTITY[part];
|
|
1292
|
-
const known = _nullishCoalesce(
|
|
1292
|
+
const known = _nullishCoalesce(_chunkHQGE4WAVcjs.MODEL_FIELD_SETS[entity], () => ( []));
|
|
1293
1293
|
const unknown = names.filter((n) => !known.includes(n));
|
|
1294
1294
|
if (unknown.length > 0) {
|
|
1295
|
-
throw new (0,
|
|
1296
|
-
`fullProfile: fields.${part} has unknown field name(s) ${
|
|
1295
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
1296
|
+
`fullProfile: fields.${part} has unknown field name(s) ${_chunkHQGE4WAVcjs.formatUnknownNameList.call(void 0, unknown)} against the vendored spec for ${entity} (${known.length} fields; operations.fieldCatalog resources: ["${entity}"] lists the live set) \u2014 no request was issued`
|
|
1297
1297
|
);
|
|
1298
1298
|
}
|
|
1299
1299
|
out[part] = names;
|
|
@@ -1310,7 +1310,7 @@ function project(items, names) {
|
|
|
1310
1310
|
function profilePartLimit(value, name) {
|
|
1311
1311
|
const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
|
|
1312
1312
|
if (!Number.isInteger(n) || n < 1) {
|
|
1313
|
-
throw new (0,
|
|
1313
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
1314
1314
|
}
|
|
1315
1315
|
return n;
|
|
1316
1316
|
}
|
|
@@ -1322,7 +1322,7 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
|
|
|
1322
1322
|
body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
|
|
1323
1323
|
operation: "companies.fullProfile"
|
|
1324
1324
|
});
|
|
1325
|
-
return project(
|
|
1325
|
+
return project(_chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items, includeFields);
|
|
1326
1326
|
}
|
|
1327
1327
|
async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
|
|
1328
1328
|
const openRows = await (async () => {
|
|
@@ -1337,7 +1337,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
|
|
|
1337
1337
|
},
|
|
1338
1338
|
operation: "companies.fullProfile"
|
|
1339
1339
|
});
|
|
1340
|
-
return project(
|
|
1340
|
+
return project(_chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items, includeFields);
|
|
1341
1341
|
})();
|
|
1342
1342
|
let openTickets = {
|
|
1343
1343
|
items: openRows,
|
|
@@ -1346,7 +1346,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
|
|
|
1346
1346
|
note: OPEN_TICKETS_NOTE
|
|
1347
1347
|
};
|
|
1348
1348
|
if (openRows.length === 0) {
|
|
1349
|
-
const stamp =
|
|
1349
|
+
const stamp = _chunkHQGE4WAVcjs.blindStampFor.call(void 0, _optionalChain([_chunkHQGE4WAVcjs.BLIND_SURFACE_STAMPS, 'access', _19 => _19["tickets"], 'optionalAccess', _20 => _20.query]), [
|
|
1350
1350
|
{ field: "companyID", op: "eq", value: companyID },
|
|
1351
1351
|
{ field: "status", op: "noteq", value: 5 }
|
|
1352
1352
|
]);
|
|
@@ -1363,7 +1363,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
|
|
|
1363
1363
|
return openTickets;
|
|
1364
1364
|
}
|
|
1365
1365
|
async function addProfileNames(http, company, openTickets, projects, result, opts) {
|
|
1366
|
-
const builder =
|
|
1366
|
+
const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS);
|
|
1367
1367
|
const c = company;
|
|
1368
1368
|
builder.addResource(c["ownerResourceID"]);
|
|
1369
1369
|
builder.addResource(c["createdByResourceID"]);
|
|
@@ -1380,20 +1380,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
|
|
|
1380
1380
|
builder.addResource(r["creatorResourceID"]);
|
|
1381
1381
|
builder.addFk("contract", r["contractID"]);
|
|
1382
1382
|
}
|
|
1383
|
-
const names = await
|
|
1383
|
+
const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
1384
1384
|
const companyRow = { ...company };
|
|
1385
|
-
|
|
1386
|
-
|
|
1385
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
|
|
1386
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
|
|
1387
1387
|
result.company = companyRow;
|
|
1388
1388
|
result.openTickets = {
|
|
1389
1389
|
...openTickets,
|
|
1390
1390
|
items: openTickets.items.map((row) => {
|
|
1391
1391
|
const r = { ...row };
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
for (const f of
|
|
1392
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1393
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1394
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
1395
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
1396
|
+
for (const f of _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS) _chunkHQGE4WAVcjs.addLabelSibling.call(void 0, r, f, names);
|
|
1397
1397
|
return r;
|
|
1398
1398
|
})
|
|
1399
1399
|
};
|
|
@@ -1401,9 +1401,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
|
|
|
1401
1401
|
...result.projects,
|
|
1402
1402
|
items: result.projects.items.map((row) => {
|
|
1403
1403
|
const r = { ...row };
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1404
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
|
|
1405
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1406
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1407
1407
|
return r;
|
|
1408
1408
|
})
|
|
1409
1409
|
};
|
|
@@ -1416,7 +1416,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1416
1416
|
const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
|
|
1417
1417
|
const locLimit = locationLimit(opts.locationLimit);
|
|
1418
1418
|
const proj = validateProjection(opts.fields);
|
|
1419
|
-
const companyID =
|
|
1419
|
+
const companyID = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
1420
1420
|
const company = await resource.get(companyID);
|
|
1421
1421
|
const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
|
|
1422
1422
|
const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
|
|
@@ -1463,7 +1463,7 @@ var UNBILLED_WORK_OPT_KEYS = [
|
|
|
1463
1463
|
var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
|
|
1464
1464
|
function validateUnbilledWorkOptions(companyId, opts) {
|
|
1465
1465
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1466
|
-
throw new (0,
|
|
1466
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
1467
1467
|
`unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
1468
1468
|
{ operation: "companies.unbilledWork" }
|
|
1469
1469
|
);
|
|
@@ -1492,7 +1492,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1492
1492
|
try {
|
|
1493
1493
|
limit = clampLimit(opts.limit);
|
|
1494
1494
|
} catch (err) {
|
|
1495
|
-
problems.push(err instanceof
|
|
1495
|
+
problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
1496
1496
|
limit = 50;
|
|
1497
1497
|
}
|
|
1498
1498
|
if (source === "date_range") {
|
|
@@ -1507,9 +1507,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1507
1507
|
problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
|
|
1508
1508
|
} else {
|
|
1509
1509
|
try {
|
|
1510
|
-
|
|
1510
|
+
_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
|
|
1511
1511
|
} catch (err) {
|
|
1512
|
-
problems.push(err instanceof
|
|
1512
|
+
problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
@@ -1519,20 +1519,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1519
1519
|
} else {
|
|
1520
1520
|
opts.ticketIds.forEach((tid, i) => {
|
|
1521
1521
|
try {
|
|
1522
|
-
|
|
1522
|
+
_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
|
|
1523
1523
|
} catch (err) {
|
|
1524
|
-
problems.push(err instanceof
|
|
1524
|
+
problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
|
|
1525
1525
|
}
|
|
1526
1526
|
});
|
|
1527
1527
|
}
|
|
1528
1528
|
}
|
|
1529
1529
|
try {
|
|
1530
|
-
|
|
1530
|
+
_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1531
1531
|
} catch (err) {
|
|
1532
|
-
problems.push(err instanceof
|
|
1532
|
+
problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
|
|
1533
1533
|
}
|
|
1534
1534
|
if (problems.length > 0) {
|
|
1535
|
-
throw new (0,
|
|
1535
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
1536
1536
|
`unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
1537
1537
|
- ` + problems.join("\n- "),
|
|
1538
1538
|
{ operation: "companies.unbilledWork" }
|
|
@@ -1561,7 +1561,7 @@ function capJoinSet(ids2, cap) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function unbilledWorkPartStatus(key, conditions, items) {
|
|
1563
1563
|
if (items.length !== 0) return { status: "ok" };
|
|
1564
|
-
const stamp =
|
|
1564
|
+
const stamp = _chunkHQGE4WAVcjs.blindStampFor.call(void 0, _optionalChain([_chunkHQGE4WAVcjs.BLIND_SURFACE_STAMPS, 'access', _21 => _21[key], 'optionalAccess', _22 => _22.query]), conditions);
|
|
1565
1565
|
if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
|
|
1566
1566
|
return {
|
|
1567
1567
|
status: "ok",
|
|
@@ -1581,7 +1581,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
|
|
|
1581
1581
|
parentStatus = "ok";
|
|
1582
1582
|
companyIds.push(num(parent.id));
|
|
1583
1583
|
} catch (err) {
|
|
1584
|
-
if (err instanceof
|
|
1584
|
+
if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) parent = null;
|
|
1585
1585
|
else throw err;
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
@@ -1619,14 +1619,14 @@ async function readBillingPart(http, v, companyIds) {
|
|
|
1619
1619
|
if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
|
|
1620
1620
|
if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
|
|
1621
1621
|
}
|
|
1622
|
-
const billingFields =
|
|
1622
|
+
const billingFields = _chunkHQGE4WAVcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
|
|
1623
1623
|
const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
|
|
1624
1624
|
const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP, billingIncludeFields);
|
|
1625
1625
|
let billingItems = billingRaw.items;
|
|
1626
1626
|
let billingNoteCharsTruncated = 0;
|
|
1627
1627
|
if (v.includeNotes) {
|
|
1628
|
-
const noteFields = (_nullishCoalesce(
|
|
1629
|
-
[billingItems, billingNoteCharsTruncated] =
|
|
1628
|
+
const noteFields = (_nullishCoalesce(_chunkHQGE4WAVcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
|
|
1629
|
+
[billingItems, billingNoteCharsTruncated] = _chunkHQGE4WAVcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
|
|
1630
1630
|
}
|
|
1631
1631
|
const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
|
|
1632
1632
|
const billingItemsPart = {
|
|
@@ -1670,7 +1670,7 @@ async function readTimePart(http, v, join) {
|
|
|
1670
1670
|
let cappedItems = entries;
|
|
1671
1671
|
let noteCharsTruncated = 0;
|
|
1672
1672
|
if (v.includeNotes) {
|
|
1673
|
-
[cappedItems, noteCharsTruncated] =
|
|
1673
|
+
[cappedItems, noteCharsTruncated] = _chunkHQGE4WAVcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
|
|
1674
1674
|
}
|
|
1675
1675
|
const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
|
|
1676
1676
|
timePart = {
|
|
@@ -1758,7 +1758,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
1760
1760
|
const v = validateUnbilledWorkOptions(companyId, opts);
|
|
1761
|
-
const id =
|
|
1761
|
+
const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1762
1762
|
const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
|
|
1763
1763
|
const join = await readJoinSets(http, companyIds, v);
|
|
1764
1764
|
const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
|
|
@@ -1785,7 +1785,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
|
|
1787
1787
|
// src/resources/companies.ts
|
|
1788
|
-
var CompaniesResource = class extends
|
|
1788
|
+
var CompaniesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
1789
1789
|
constructor(http, pageSize) {
|
|
1790
1790
|
super(http, {
|
|
1791
1791
|
key: "companies",
|
|
@@ -1892,7 +1892,7 @@ var CompaniesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
1892
1892
|
};
|
|
1893
1893
|
|
|
1894
1894
|
// src/resources/company_alerts.ts
|
|
1895
|
-
var CompanyAlertsResource = class extends
|
|
1895
|
+
var CompanyAlertsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
1896
1896
|
constructor(http, pageSize) {
|
|
1897
1897
|
super(http, {
|
|
1898
1898
|
key: "company_alerts",
|
|
@@ -1958,7 +1958,7 @@ var CompanyAlertsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
1958
1958
|
};
|
|
1959
1959
|
|
|
1960
1960
|
// src/resources/company_locations.ts
|
|
1961
|
-
var CompanyLocationsResource = class extends
|
|
1961
|
+
var CompanyLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
1962
1962
|
constructor(http, pageSize) {
|
|
1963
1963
|
super(http, {
|
|
1964
1964
|
key: "company_locations",
|
|
@@ -2029,7 +2029,7 @@ var CompanyLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
2029
2029
|
};
|
|
2030
2030
|
|
|
2031
2031
|
// src/resources/company_notes.ts
|
|
2032
|
-
var CompanyNotesResource = class extends
|
|
2032
|
+
var CompanyNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2033
2033
|
constructor(http, pageSize) {
|
|
2034
2034
|
super(http, {
|
|
2035
2035
|
key: "company_notes",
|
|
@@ -2094,7 +2094,7 @@ var CompanyNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
2094
2094
|
};
|
|
2095
2095
|
|
|
2096
2096
|
// src/resources/company_site_configurations.ts
|
|
2097
|
-
var CompanySiteConfigurationsResource = class extends
|
|
2097
|
+
var CompanySiteConfigurationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2098
2098
|
constructor(http, pageSize) {
|
|
2099
2099
|
super(http, {
|
|
2100
2100
|
key: "company_site_configurations",
|
|
@@ -2145,7 +2145,7 @@ var CompanySiteConfigurationsResource = class extends _chunkLVBFLSPLcjs.BaseReso
|
|
|
2145
2145
|
};
|
|
2146
2146
|
|
|
2147
2147
|
// src/resources/company_webhooks.ts
|
|
2148
|
-
var CompanyWebhooksResource = class extends
|
|
2148
|
+
var CompanyWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2149
2149
|
constructor(http, pageSize) {
|
|
2150
2150
|
super(http, {
|
|
2151
2151
|
key: "company_webhooks",
|
|
@@ -2221,7 +2221,7 @@ var CompanyWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
2221
2221
|
};
|
|
2222
2222
|
|
|
2223
2223
|
// src/resources/configuration_item_billing_product_associations.ts
|
|
2224
|
-
var ConfigurationItemBillingProductAssociationsResource = class extends
|
|
2224
|
+
var ConfigurationItemBillingProductAssociationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2225
2225
|
constructor(http, pageSize) {
|
|
2226
2226
|
super(http, {
|
|
2227
2227
|
key: "configuration_item_billing_product_associations",
|
|
@@ -2287,7 +2287,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLV
|
|
|
2287
2287
|
};
|
|
2288
2288
|
|
|
2289
2289
|
// src/resources/configuration_item_categories.ts
|
|
2290
|
-
var ConfigurationItemCategoriesResource = class extends
|
|
2290
|
+
var ConfigurationItemCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2291
2291
|
constructor(http, pageSize) {
|
|
2292
2292
|
super(http, {
|
|
2293
2293
|
key: "configuration_item_categories",
|
|
@@ -2354,7 +2354,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseRe
|
|
|
2354
2354
|
};
|
|
2355
2355
|
|
|
2356
2356
|
// src/resources/configuration_item_category_udf_associations.ts
|
|
2357
|
-
var ConfigurationItemCategoryUdfAssociationsResource = class extends
|
|
2357
|
+
var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2358
2358
|
constructor(http, pageSize) {
|
|
2359
2359
|
super(http, {
|
|
2360
2360
|
key: "configuration_item_category_udf_associations",
|
|
@@ -2420,7 +2420,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLVBFL
|
|
|
2420
2420
|
};
|
|
2421
2421
|
|
|
2422
2422
|
// src/resources/configuration_item_dns_records.ts
|
|
2423
|
-
var ConfigurationItemDnsRecordsResource = class extends
|
|
2423
|
+
var ConfigurationItemDnsRecordsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2424
2424
|
constructor(http, pageSize) {
|
|
2425
2425
|
super(http, {
|
|
2426
2426
|
key: "configuration_item_dns_records",
|
|
@@ -2469,7 +2469,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkLVBFLSPLcjs.BaseRe
|
|
|
2469
2469
|
};
|
|
2470
2470
|
|
|
2471
2471
|
// src/resources/configuration_item_notes.ts
|
|
2472
|
-
var ConfigurationItemNotesResource = class extends
|
|
2472
|
+
var ConfigurationItemNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2473
2473
|
constructor(http, pageSize) {
|
|
2474
2474
|
super(http, {
|
|
2475
2475
|
key: "configuration_item_notes",
|
|
@@ -2528,7 +2528,7 @@ var ConfigurationItemNotesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
2528
2528
|
};
|
|
2529
2529
|
|
|
2530
2530
|
// src/resources/configuration_item_related_items.ts
|
|
2531
|
-
var ConfigurationItemRelatedItemsResource = class extends
|
|
2531
|
+
var ConfigurationItemRelatedItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2532
2532
|
constructor(http, pageSize) {
|
|
2533
2533
|
super(http, {
|
|
2534
2534
|
key: "configuration_item_related_items",
|
|
@@ -2589,16 +2589,16 @@ async function fetchRecord(http, path, label, readOpts) {
|
|
|
2589
2589
|
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _27 => _27.maxRetries]) });
|
|
2590
2590
|
const body = res;
|
|
2591
2591
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
2592
|
-
throw new (0,
|
|
2592
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
2593
2593
|
}
|
|
2594
2594
|
return body.item;
|
|
2595
2595
|
}
|
|
2596
2596
|
async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
2597
|
-
const numericSource =
|
|
2597
|
+
const numericSource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
|
|
2598
2598
|
if (_optionalChain([opts, 'optionalAccess', _28 => _28.destinationCompanyId]) === void 0) {
|
|
2599
|
-
throw new (0,
|
|
2599
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
|
|
2600
2600
|
}
|
|
2601
|
-
const destId =
|
|
2601
|
+
const destId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
|
|
2602
2602
|
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
|
|
2603
2603
|
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
|
|
2604
2604
|
const body = { ...source };
|
|
@@ -2608,20 +2608,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2608
2608
|
body.companyID = destId;
|
|
2609
2609
|
body.isActive = true;
|
|
2610
2610
|
if (opts.newReferenceTitle !== void 0) {
|
|
2611
|
-
if (opts.newReferenceTitle.trim() === "") throw new (0,
|
|
2611
|
+
if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
|
|
2612
2612
|
body.referenceTitle = opts.newReferenceTitle.trim();
|
|
2613
2613
|
}
|
|
2614
2614
|
if (opts.lastModifiedDate !== void 0) {
|
|
2615
2615
|
const current = source.lastModifiedDate;
|
|
2616
2616
|
if (current !== opts.lastModifiedDate) {
|
|
2617
|
-
throw new (0,
|
|
2617
|
+
throw new (0, _chunkHQGE4WAVcjs.StaleObjectError)(
|
|
2618
2618
|
`moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
|
|
2619
2619
|
{ operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
|
|
2620
2620
|
);
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
2623
|
if (opts.dryRun === true) {
|
|
2624
|
-
return
|
|
2624
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
2625
2625
|
operation: "configuration_items.moveConfigurationItem",
|
|
2626
2626
|
method: "POST",
|
|
2627
2627
|
path: "/V1.0/ConfigurationItems",
|
|
@@ -2646,7 +2646,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2646
2646
|
const createdBody = created;
|
|
2647
2647
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
2648
2648
|
if (typeof newId !== "number") {
|
|
2649
|
-
throw new (0,
|
|
2649
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
|
|
2650
2650
|
}
|
|
2651
2651
|
let sourceDeactivated = false;
|
|
2652
2652
|
if (opts.deactivateSource !== false) {
|
|
@@ -2665,7 +2665,7 @@ var PROFILE_PART_LIMIT2 = 50;
|
|
|
2665
2665
|
function profilePartLimit2(value, name) {
|
|
2666
2666
|
const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
|
|
2667
2667
|
if (!Number.isInteger(n) || n < 1) {
|
|
2668
|
-
throw new (0,
|
|
2668
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
2669
2669
|
}
|
|
2670
2670
|
return n;
|
|
2671
2671
|
}
|
|
@@ -2681,14 +2681,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
|
|
|
2681
2681
|
});
|
|
2682
2682
|
const body = res;
|
|
2683
2683
|
if (body === null || !("item" in body)) {
|
|
2684
|
-
throw new (0,
|
|
2684
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
|
|
2685
2685
|
}
|
|
2686
2686
|
if (body.item === null || body.item === void 0) {
|
|
2687
|
-
throw new (0,
|
|
2687
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
|
|
2688
2688
|
}
|
|
2689
2689
|
return body.item;
|
|
2690
2690
|
} catch (err) {
|
|
2691
|
-
if (err instanceof
|
|
2691
|
+
if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) return null;
|
|
2692
2692
|
throw err;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
@@ -2700,7 +2700,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
|
|
|
2700
2700
|
body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
|
|
2701
2701
|
operation: "configuration_items.profile"
|
|
2702
2702
|
});
|
|
2703
|
-
return
|
|
2703
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
2704
2704
|
}
|
|
2705
2705
|
async function profile(resource, id, opts = {}, http) {
|
|
2706
2706
|
const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
|
|
@@ -2712,7 +2712,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2712
2712
|
const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
|
|
2713
2713
|
const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
|
|
2714
2714
|
const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
|
|
2715
|
-
const wallQuirk = _optionalChain([
|
|
2715
|
+
const wallQuirk = _optionalChain([_chunkHQGE4WAVcjs.RELATIONSHIP_MAP, 'access', _29 => _29["configuration_items"], 'optionalAccess', _30 => _30.zoneFacts, 'optionalAccess', _31 => _31.quirks, 'optionalAccess', _32 => _32.find, 'call', _33 => _33((q) => q.startsWith("product wall"))]);
|
|
2716
2716
|
const productAssociations = {
|
|
2717
2717
|
items: associations,
|
|
2718
2718
|
capped: associations.length >= PROFILE_PART_LIMIT2,
|
|
@@ -2736,11 +2736,11 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2736
2736
|
}
|
|
2737
2737
|
};
|
|
2738
2738
|
if (opts.names === true) {
|
|
2739
|
-
const builder =
|
|
2739
|
+
const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, );
|
|
2740
2740
|
builder.addFk("contract", root["contractID"]);
|
|
2741
|
-
const names = await
|
|
2741
|
+
const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
2742
2742
|
const ciRow = { ...ci };
|
|
2743
|
-
|
|
2743
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
|
|
2744
2744
|
result.ci = ciRow;
|
|
2745
2745
|
result.names = names.section;
|
|
2746
2746
|
}
|
|
@@ -2748,7 +2748,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
|
|
2750
2750
|
// src/resources/configuration_items.ts
|
|
2751
|
-
var ConfigurationItemsResource = class extends
|
|
2751
|
+
var ConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2752
2752
|
constructor(http, pageSize) {
|
|
2753
2753
|
super(http, {
|
|
2754
2754
|
key: "configuration_items",
|
|
@@ -2837,7 +2837,7 @@ var ConfigurationItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
2837
2837
|
};
|
|
2838
2838
|
|
|
2839
2839
|
// src/resources/configuration_item_ssl_subject_alternative_names.ts
|
|
2840
|
-
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends
|
|
2840
|
+
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2841
2841
|
constructor(http, pageSize) {
|
|
2842
2842
|
super(http, {
|
|
2843
2843
|
key: "configuration_item_ssl_subject_alternative_names",
|
|
@@ -2900,7 +2900,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLV
|
|
|
2900
2900
|
};
|
|
2901
2901
|
|
|
2902
2902
|
// src/resources/configuration_item_types.ts
|
|
2903
|
-
var ConfigurationItemTypesResource = class extends
|
|
2903
|
+
var ConfigurationItemTypesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2904
2904
|
constructor(http, pageSize) {
|
|
2905
2905
|
super(http, {
|
|
2906
2906
|
key: "configuration_item_types",
|
|
@@ -2974,7 +2974,7 @@ var ConfigurationItemTypesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
2974
2974
|
};
|
|
2975
2975
|
|
|
2976
2976
|
// src/resources/configuration_item_webhooks.ts
|
|
2977
|
-
var ConfigurationItemWebhooksResource = class extends
|
|
2977
|
+
var ConfigurationItemWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
2978
2978
|
constructor(http, pageSize) {
|
|
2979
2979
|
super(http, {
|
|
2980
2980
|
key: "configuration_item_webhooks",
|
|
@@ -3050,7 +3050,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseReso
|
|
|
3050
3050
|
};
|
|
3051
3051
|
|
|
3052
3052
|
// src/resources/contact_group_contacts.ts
|
|
3053
|
-
var ContactGroupContactsResource = class extends
|
|
3053
|
+
var ContactGroupContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3054
3054
|
constructor(http, pageSize) {
|
|
3055
3055
|
super(http, {
|
|
3056
3056
|
key: "contact_group_contacts",
|
|
@@ -3104,7 +3104,7 @@ var ContactGroupContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
3104
3104
|
};
|
|
3105
3105
|
|
|
3106
3106
|
// src/resources/contact_groups.ts
|
|
3107
|
-
var ContactGroupsResource = class extends
|
|
3107
|
+
var ContactGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3108
3108
|
constructor(http, pageSize) {
|
|
3109
3109
|
super(http, {
|
|
3110
3110
|
key: "contact_groups",
|
|
@@ -3182,22 +3182,22 @@ async function fetchRecord2(http, path, label, readOpts) {
|
|
|
3182
3182
|
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _39 => _39.maxRetries]) });
|
|
3183
3183
|
const body = res;
|
|
3184
3184
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
3185
|
-
throw new (0,
|
|
3185
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
3186
3186
|
}
|
|
3187
3187
|
return body.item;
|
|
3188
3188
|
}
|
|
3189
3189
|
async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
|
|
3190
|
-
const sourceId =
|
|
3191
|
-
const destId =
|
|
3190
|
+
const sourceId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
|
|
3191
|
+
const destId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
|
|
3192
3192
|
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
|
|
3193
3193
|
const companyID = source.companyID;
|
|
3194
3194
|
if (typeof companyID !== "number" || companyID < 0) {
|
|
3195
|
-
throw new (0,
|
|
3195
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
|
|
3196
3196
|
}
|
|
3197
3197
|
if (opts.lastModifiedDate !== void 0) {
|
|
3198
3198
|
const current = source.lastModifiedDate;
|
|
3199
3199
|
if (current !== opts.lastModifiedDate) {
|
|
3200
|
-
throw new (0,
|
|
3200
|
+
throw new (0, _chunkHQGE4WAVcjs.StaleObjectError)(
|
|
3201
3201
|
`moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
|
|
3202
3202
|
{ operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
|
|
3203
3203
|
);
|
|
@@ -3219,10 +3219,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3219
3219
|
},
|
|
3220
3220
|
operation: "contacts.moveToCompany"
|
|
3221
3221
|
});
|
|
3222
|
-
const items =
|
|
3222
|
+
const items = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
3223
3223
|
const clash = items.find((c) => String(c.id) !== String(sourceId));
|
|
3224
3224
|
if (clash !== void 0) {
|
|
3225
|
-
throw new (0,
|
|
3225
|
+
throw new (0, _chunkHQGE4WAVcjs.ConflictError)(
|
|
3226
3226
|
`Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
|
|
3227
3227
|
{ resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
|
|
3228
3228
|
);
|
|
@@ -3236,7 +3236,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3236
3236
|
if (opts.dryRun === true) {
|
|
3237
3237
|
const warnings = [];
|
|
3238
3238
|
if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
|
|
3239
|
-
return
|
|
3239
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
3240
3240
|
operation: "contacts.moveToCompany",
|
|
3241
3241
|
method: "POST",
|
|
3242
3242
|
path: `/V1.0/Companies/${destId}/Contacts`,
|
|
@@ -3262,7 +3262,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3262
3262
|
const createdBody = created;
|
|
3263
3263
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
3264
3264
|
if (typeof newId !== "number") {
|
|
3265
|
-
throw new (0,
|
|
3265
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
|
|
3266
3266
|
}
|
|
3267
3267
|
let sourceDeleted = false;
|
|
3268
3268
|
if (opts.deleteSource === true) {
|
|
@@ -3281,7 +3281,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
|
|
|
3281
3281
|
var EMAIL_SHAPE = /^.+@.+/;
|
|
3282
3282
|
var SAFE_CONTACT_CREATE_DEFAULTS = {};
|
|
3283
3283
|
var DEDUP_LIMIT = 10;
|
|
3284
|
-
var CompanyNotFoundError = class extends
|
|
3284
|
+
var CompanyNotFoundError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
3285
3285
|
constructor(message, options = {}) {
|
|
3286
3286
|
super(message, {
|
|
3287
3287
|
code: "COMPANY_NOT_FOUND",
|
|
@@ -3292,7 +3292,7 @@ var CompanyNotFoundError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
3292
3292
|
this.name = "CompanyNotFoundError";
|
|
3293
3293
|
}
|
|
3294
3294
|
};
|
|
3295
|
-
var ContactCreateFailedError = class extends
|
|
3295
|
+
var ContactCreateFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
3296
3296
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
3297
3297
|
|
|
3298
3298
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -3302,25 +3302,25 @@ var ContactCreateFailedError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
3302
3302
|
}
|
|
3303
3303
|
};
|
|
3304
3304
|
async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
3305
|
-
const cid =
|
|
3305
|
+
const cid = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyID, "companyID");
|
|
3306
3306
|
if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
|
|
3307
|
-
throw new (0,
|
|
3307
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
3308
3308
|
`upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
|
|
3309
3309
|
{ operation: OP_UPSERT_EMAIL }
|
|
3310
3310
|
);
|
|
3311
3311
|
}
|
|
3312
3312
|
if (extra !== void 0) {
|
|
3313
3313
|
if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
|
|
3314
|
-
throw new (0,
|
|
3314
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
3315
3315
|
`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)})`,
|
|
3316
3316
|
{ operation: OP_UPSERT_EMAIL }
|
|
3317
3317
|
);
|
|
3318
3318
|
}
|
|
3319
3319
|
if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
|
|
3320
|
-
throw new (0,
|
|
3320
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
3321
3321
|
}
|
|
3322
3322
|
if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
|
|
3323
|
-
throw new (0,
|
|
3323
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
3324
3324
|
}
|
|
3325
3325
|
}
|
|
3326
3326
|
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
|
|
@@ -3341,7 +3341,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3341
3341
|
const match = q.items[0];
|
|
3342
3342
|
if (match !== void 0) {
|
|
3343
3343
|
if (opts.dryRun === true) {
|
|
3344
|
-
return
|
|
3344
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
3345
3345
|
{
|
|
3346
3346
|
operation: OP_UPSERT_EMAIL,
|
|
3347
3347
|
method: "POST",
|
|
@@ -3371,7 +3371,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3371
3371
|
isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
|
|
3372
3372
|
};
|
|
3373
3373
|
if (opts.dryRun === true) {
|
|
3374
|
-
return
|
|
3374
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
3375
3375
|
{
|
|
3376
3376
|
operation: OP_UPSERT_EMAIL,
|
|
3377
3377
|
method: "POST",
|
|
@@ -3394,8 +3394,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3394
3394
|
const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
|
|
3395
3395
|
return { id: created.id, created: true };
|
|
3396
3396
|
} catch (err) {
|
|
3397
|
-
if (!
|
|
3398
|
-
const named = (_nullishCoalesce(
|
|
3397
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
3398
|
+
const named = (_nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
3399
3399
|
const seen = /* @__PURE__ */ new Set();
|
|
3400
3400
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
3401
3401
|
const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -3409,7 +3409,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3409
3409
|
}
|
|
3410
3410
|
continue;
|
|
3411
3411
|
}
|
|
3412
|
-
const detail =
|
|
3412
|
+
const detail = _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
3413
3413
|
throw new ContactCreateFailedError(
|
|
3414
3414
|
`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}` : ""}`,
|
|
3415
3415
|
unique,
|
|
@@ -3426,7 +3426,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3426
3426
|
}
|
|
3427
3427
|
|
|
3428
3428
|
// src/resources/contacts.ts
|
|
3429
|
-
var ContactsResource = class extends
|
|
3429
|
+
var ContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3430
3430
|
constructor(http, pageSize) {
|
|
3431
3431
|
super(http, {
|
|
3432
3432
|
key: "contacts",
|
|
@@ -3518,7 +3518,7 @@ var ContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
3518
3518
|
};
|
|
3519
3519
|
|
|
3520
3520
|
// src/resources/contact_webhooks.ts
|
|
3521
|
-
var ContactWebhooksResource = class extends
|
|
3521
|
+
var ContactWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3522
3522
|
constructor(http, pageSize) {
|
|
3523
3523
|
super(http, {
|
|
3524
3524
|
key: "contact_webhooks",
|
|
@@ -3594,7 +3594,7 @@ var ContactWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
3594
3594
|
};
|
|
3595
3595
|
|
|
3596
3596
|
// src/resources/contract_billing_rules.ts
|
|
3597
|
-
var ContractBillingRulesResource = class extends
|
|
3597
|
+
var ContractBillingRulesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3598
3598
|
constructor(http, pageSize) {
|
|
3599
3599
|
super(http, {
|
|
3600
3600
|
key: "contract_billing_rules",
|
|
@@ -3660,7 +3660,7 @@ var ContractBillingRulesResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
3660
3660
|
};
|
|
3661
3661
|
|
|
3662
3662
|
// src/resources/contract_block_hour_factors.ts
|
|
3663
|
-
var ContractBlockHourFactorsResource = class extends
|
|
3663
|
+
var ContractBlockHourFactorsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3664
3664
|
constructor(http, pageSize) {
|
|
3665
3665
|
super(http, {
|
|
3666
3666
|
key: "contract_block_hour_factors",
|
|
@@ -3719,7 +3719,7 @@ var ContractBlockHourFactorsResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
3719
3719
|
};
|
|
3720
3720
|
|
|
3721
3721
|
// src/resources/contract_blocks.ts
|
|
3722
|
-
var ContractBlocksResource = class extends
|
|
3722
|
+
var ContractBlocksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3723
3723
|
constructor(http, pageSize) {
|
|
3724
3724
|
super(http, {
|
|
3725
3725
|
key: "contract_blocks",
|
|
@@ -3778,7 +3778,7 @@ var ContractBlocksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
3778
3778
|
};
|
|
3779
3779
|
|
|
3780
3780
|
// src/resources/contract_charges.ts
|
|
3781
|
-
var ContractChargesResource = class extends
|
|
3781
|
+
var ContractChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3782
3782
|
constructor(http, pageSize) {
|
|
3783
3783
|
super(http, {
|
|
3784
3784
|
key: "contract_charges",
|
|
@@ -3849,7 +3849,7 @@ var ContractChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
3849
3849
|
};
|
|
3850
3850
|
|
|
3851
3851
|
// src/resources/contract_exclusion_billing_codes.ts
|
|
3852
|
-
var ContractExclusionBillingCodesResource = class extends
|
|
3852
|
+
var ContractExclusionBillingCodesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3853
3853
|
constructor(http, pageSize) {
|
|
3854
3854
|
super(http, {
|
|
3855
3855
|
key: "contract_exclusion_billing_codes",
|
|
@@ -3906,7 +3906,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkLVBFLSPLcjs.Base
|
|
|
3906
3906
|
};
|
|
3907
3907
|
|
|
3908
3908
|
// src/resources/contract_exclusion_roles.ts
|
|
3909
|
-
var ContractExclusionRolesResource = class extends
|
|
3909
|
+
var ContractExclusionRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3910
3910
|
constructor(http, pageSize) {
|
|
3911
3911
|
super(http, {
|
|
3912
3912
|
key: "contract_exclusion_roles",
|
|
@@ -3963,7 +3963,7 @@ var ContractExclusionRolesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
3963
3963
|
};
|
|
3964
3964
|
|
|
3965
3965
|
// src/resources/contract_exclusion_set_excluded_roles.ts
|
|
3966
|
-
var ContractExclusionSetExcludedRolesResource = class extends
|
|
3966
|
+
var ContractExclusionSetExcludedRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
3967
3967
|
constructor(http, pageSize) {
|
|
3968
3968
|
super(http, {
|
|
3969
3969
|
key: "contract_exclusion_set_excluded_roles",
|
|
@@ -4020,7 +4020,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkLVBFLSPLcjs.
|
|
|
4020
4020
|
};
|
|
4021
4021
|
|
|
4022
4022
|
// src/resources/contract_exclusion_set_excluded_work_types.ts
|
|
4023
|
-
var ContractExclusionSetExcludedWorkTypesResource = class extends
|
|
4023
|
+
var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4024
4024
|
constructor(http, pageSize) {
|
|
4025
4025
|
super(http, {
|
|
4026
4026
|
key: "contract_exclusion_set_excluded_work_types",
|
|
@@ -4077,7 +4077,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLVBFLSPL
|
|
|
4077
4077
|
};
|
|
4078
4078
|
|
|
4079
4079
|
// src/resources/contract_exclusion_sets.ts
|
|
4080
|
-
var ContractExclusionSetsResource = class extends
|
|
4080
|
+
var ContractExclusionSetsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4081
4081
|
constructor(http, pageSize) {
|
|
4082
4082
|
super(http, {
|
|
4083
4083
|
key: "contract_exclusion_sets",
|
|
@@ -4151,7 +4151,7 @@ var ContractExclusionSetsResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
4151
4151
|
};
|
|
4152
4152
|
|
|
4153
4153
|
// src/resources/contract_milestones.ts
|
|
4154
|
-
var ContractMilestonesResource = class extends
|
|
4154
|
+
var ContractMilestonesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4155
4155
|
constructor(http, pageSize) {
|
|
4156
4156
|
super(http, {
|
|
4157
4157
|
key: "contract_milestones",
|
|
@@ -4210,7 +4210,7 @@ var ContractMilestonesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4210
4210
|
};
|
|
4211
4211
|
|
|
4212
4212
|
// src/resources/contract_notes.ts
|
|
4213
|
-
var ContractNotesResource = class extends
|
|
4213
|
+
var ContractNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4214
4214
|
constructor(http, pageSize) {
|
|
4215
4215
|
super(http, {
|
|
4216
4216
|
key: "contract_notes",
|
|
@@ -4269,7 +4269,7 @@ var ContractNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4269
4269
|
};
|
|
4270
4270
|
|
|
4271
4271
|
// src/resources/contract_rates.ts
|
|
4272
|
-
var ContractRatesResource = class extends
|
|
4272
|
+
var ContractRatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4273
4273
|
constructor(http, pageSize) {
|
|
4274
4274
|
super(http, {
|
|
4275
4275
|
key: "contract_rates",
|
|
@@ -4328,7 +4328,7 @@ var ContractRatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4328
4328
|
};
|
|
4329
4329
|
|
|
4330
4330
|
// src/resources/contract_retainers.ts
|
|
4331
|
-
var ContractRetainersResource = class extends
|
|
4331
|
+
var ContractRetainersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4332
4332
|
constructor(http, pageSize) {
|
|
4333
4333
|
super(http, {
|
|
4334
4334
|
key: "contract_retainers",
|
|
@@ -4387,7 +4387,7 @@ var ContractRetainersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4387
4387
|
};
|
|
4388
4388
|
|
|
4389
4389
|
// src/resources/contract_role_costs.ts
|
|
4390
|
-
var ContractRoleCostsResource = class extends
|
|
4390
|
+
var ContractRoleCostsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4391
4391
|
constructor(http, pageSize) {
|
|
4392
4392
|
super(http, {
|
|
4393
4393
|
key: "contract_role_costs",
|
|
@@ -4446,7 +4446,7 @@ var ContractRoleCostsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4446
4446
|
};
|
|
4447
4447
|
|
|
4448
4448
|
// src/resources/contract_service_adjustments.ts
|
|
4449
|
-
var ContractServiceAdjustmentsResource = class extends
|
|
4449
|
+
var ContractServiceAdjustmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4450
4450
|
constructor(http, pageSize) {
|
|
4451
4451
|
super(http, {
|
|
4452
4452
|
key: "contract_service_adjustments",
|
|
@@ -4480,7 +4480,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkLVBFLSPLcjs.BaseRes
|
|
|
4480
4480
|
};
|
|
4481
4481
|
|
|
4482
4482
|
// src/resources/contract_service_bundle_adjustments.ts
|
|
4483
|
-
var ContractServiceBundleAdjustmentsResource = class extends
|
|
4483
|
+
var ContractServiceBundleAdjustmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4484
4484
|
constructor(http, pageSize) {
|
|
4485
4485
|
super(http, {
|
|
4486
4486
|
key: "contract_service_bundle_adjustments",
|
|
@@ -4514,7 +4514,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkLVBFLSPLcjs.B
|
|
|
4514
4514
|
};
|
|
4515
4515
|
|
|
4516
4516
|
// src/resources/contract_service_bundles.ts
|
|
4517
|
-
var ContractServiceBundlesResource = class extends
|
|
4517
|
+
var ContractServiceBundlesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4518
4518
|
constructor(http, pageSize) {
|
|
4519
4519
|
super(http, {
|
|
4520
4520
|
key: "contract_service_bundles",
|
|
@@ -4573,7 +4573,7 @@ var ContractServiceBundlesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
4573
4573
|
};
|
|
4574
4574
|
|
|
4575
4575
|
// src/resources/contract_service_bundle_units.ts
|
|
4576
|
-
var ContractServiceBundleUnitsResource = class extends
|
|
4576
|
+
var ContractServiceBundleUnitsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4577
4577
|
constructor(http, pageSize) {
|
|
4578
4578
|
super(http, {
|
|
4579
4579
|
key: "contract_service_bundle_units",
|
|
@@ -4615,7 +4615,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkLVBFLSPLcjs.BaseRes
|
|
|
4615
4615
|
};
|
|
4616
4616
|
|
|
4617
4617
|
// src/resources/contract_services.ts
|
|
4618
|
-
var ContractServicesResource = class extends
|
|
4618
|
+
var ContractServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4619
4619
|
constructor(http, pageSize) {
|
|
4620
4620
|
super(http, {
|
|
4621
4621
|
key: "contract_services",
|
|
@@ -4674,7 +4674,7 @@ var ContractServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
4674
4674
|
};
|
|
4675
4675
|
|
|
4676
4676
|
// src/resources/contract_service_units.ts
|
|
4677
|
-
var ContractServiceUnitsResource = class extends
|
|
4677
|
+
var ContractServiceUnitsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
4678
4678
|
constructor(http, pageSize) {
|
|
4679
4679
|
super(http, {
|
|
4680
4680
|
key: "contract_service_units",
|
|
@@ -4942,7 +4942,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
|
|
|
4942
4942
|
// src/resources/special/contracts/profitability.validate.ts
|
|
4943
4943
|
function validateProfitabilityOptions(contractId, opts) {
|
|
4944
4944
|
if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
4945
|
-
throw new (0,
|
|
4945
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
4946
4946
|
`profitability: opts is required \u2014 the options object with dateFrom and dateTo (YYYY-MM-DD) (got ${opts === void 0 ? "undefined" : Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
4947
4947
|
{ operation: "contracts.profitability" }
|
|
4948
4948
|
);
|
|
@@ -5019,12 +5019,12 @@ function validateProfitabilityOptions(contractId, opts) {
|
|
|
5019
5019
|
}
|
|
5020
5020
|
}
|
|
5021
5021
|
try {
|
|
5022
|
-
|
|
5022
|
+
_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
5023
5023
|
} catch (err) {
|
|
5024
|
-
problems.push(err instanceof
|
|
5024
|
+
problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
|
|
5025
5025
|
}
|
|
5026
5026
|
if (problems.length > 0) {
|
|
5027
|
-
throw new (0,
|
|
5027
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
5028
5028
|
`profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
5029
5029
|
- ` + problems.join("\n- "),
|
|
5030
5030
|
{ operation: "contracts.profitability" }
|
|
@@ -5073,23 +5073,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
|
|
|
5073
5073
|
const byKey = /* @__PURE__ */ new Map();
|
|
5074
5074
|
const misses = [];
|
|
5075
5075
|
const notes = [];
|
|
5076
|
-
for (let c = 0; c < unique.length; c +=
|
|
5077
|
-
const chunk = unique.slice(c, c +
|
|
5076
|
+
for (let c = 0; c < unique.length; c += _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE) {
|
|
5077
|
+
const chunk = unique.slice(c, c + _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE);
|
|
5078
5078
|
const chunkKeys = new Set(chunk);
|
|
5079
5079
|
try {
|
|
5080
5080
|
const body = {
|
|
5081
|
-
MaxRecords:
|
|
5081
|
+
MaxRecords: _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE,
|
|
5082
5082
|
filter: [{ field: "id", op: "in", value: chunk }],
|
|
5083
5083
|
IncludeFields: fields
|
|
5084
5084
|
};
|
|
5085
5085
|
const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
|
|
5086
|
-
const { items: rows } =
|
|
5086
|
+
const { items: rows } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
|
|
5087
5087
|
for (const row of rows) {
|
|
5088
5088
|
const k = num(row.id);
|
|
5089
5089
|
if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
|
|
5090
5090
|
}
|
|
5091
5091
|
} catch (err) {
|
|
5092
|
-
const code = err instanceof
|
|
5092
|
+
const code = err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.code : "SERVER_ERROR";
|
|
5093
5093
|
for (const k of chunk) {
|
|
5094
5094
|
if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
|
|
5095
5095
|
}
|
|
@@ -5099,11 +5099,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
|
|
|
5099
5099
|
for (const k of queryMissed) {
|
|
5100
5100
|
try {
|
|
5101
5101
|
const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
|
|
5102
|
-
byKey.set(k,
|
|
5102
|
+
byKey.set(k, _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, k, operation, entity));
|
|
5103
5103
|
} catch (err) {
|
|
5104
|
-
if (err instanceof
|
|
5104
|
+
if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) {
|
|
5105
5105
|
misses.push({ id: k, code: "NOT_FOUND", message: err.message });
|
|
5106
|
-
} else if (err instanceof
|
|
5106
|
+
} else if (err instanceof _chunkHQGE4WAVcjs.AutotaskError) {
|
|
5107
5107
|
misses.push({ id: k, code: err.code, message: err.message });
|
|
5108
5108
|
} else {
|
|
5109
5109
|
misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
|
|
@@ -5157,7 +5157,7 @@ async function degradable(read) {
|
|
|
5157
5157
|
try {
|
|
5158
5158
|
return await read();
|
|
5159
5159
|
} catch (err) {
|
|
5160
|
-
if (!(err instanceof
|
|
5160
|
+
if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
|
|
5161
5161
|
return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
|
|
5162
5162
|
}
|
|
5163
5163
|
}
|
|
@@ -5177,7 +5177,7 @@ var stampPart = (key, raw, conditions, extraNotes) => {
|
|
|
5177
5177
|
status: st.status,
|
|
5178
5178
|
blindSurface: st.blindSurface,
|
|
5179
5179
|
note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
|
|
5180
|
-
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([
|
|
5180
|
+
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkHQGE4WAVcjs.EMPTY_REASON_STAMPS, 'access', _47 => _47[key], 'optionalAccess', _48 => _48.query]) : void 0
|
|
5181
5181
|
};
|
|
5182
5182
|
};
|
|
5183
5183
|
function appendWiresNote(wires, note) {
|
|
@@ -5185,7 +5185,7 @@ function appendWiresNote(wires, note) {
|
|
|
5185
5185
|
}
|
|
5186
5186
|
function makeFetchCtx(rawHttp, v, contractId, budget) {
|
|
5187
5187
|
const OP6 = PROFITABILITY_OP;
|
|
5188
|
-
const id =
|
|
5188
|
+
const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
5189
5189
|
const idNum = typeof id === "number" ? id : Number(id);
|
|
5190
5190
|
const wires = { issued: 0, requests: 0, budget };
|
|
5191
5191
|
const toExcl = dayAfter(v.dateTo);
|
|
@@ -5223,12 +5223,12 @@ async function fetchCustomer(ctx, companyID) {
|
|
|
5223
5223
|
path: `/V1.0/Companies/${companyID}`,
|
|
5224
5224
|
operation: ctx.OP
|
|
5225
5225
|
});
|
|
5226
|
-
const item =
|
|
5226
|
+
const item = _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
|
|
5227
5227
|
customer = _nullishCoalesce(item, () => ( null));
|
|
5228
5228
|
customerStatus = "ok";
|
|
5229
5229
|
} catch (err) {
|
|
5230
|
-
if (!(err instanceof
|
|
5231
|
-
if (!(err instanceof
|
|
5230
|
+
if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
|
|
5231
|
+
if (!(err instanceof _chunkHQGE4WAVcjs.NotFoundError)) {
|
|
5232
5232
|
customerStatus = "absent";
|
|
5233
5233
|
customerAbsent = err.code;
|
|
5234
5234
|
}
|
|
@@ -5244,7 +5244,7 @@ async function resolveContractType(ctx, contractType) {
|
|
|
5244
5244
|
try {
|
|
5245
5245
|
contractTypeLabel = await _asyncNullishCoalesce(await _asyncOptionalChain([(await readPicklists(ctx.http, "/V1.0/Contracts", ctx.OP)), 'access', async _49 => _49.get, 'call', async _50 => _50("contractType"), 'optionalAccess', async _51 => _51.get, 'call', async _52 => _52(contractType)]), async () => ( null));
|
|
5246
5246
|
} catch (err) {
|
|
5247
|
-
if (!(err instanceof
|
|
5247
|
+
if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
|
|
5248
5248
|
}
|
|
5249
5249
|
}
|
|
5250
5250
|
const contractTypeKnown = contractTypeLabel !== null;
|
|
@@ -5306,8 +5306,8 @@ async function fetchInvoices(ctx, billingRows) {
|
|
|
5306
5306
|
if (invoiceIds.length === 0) {
|
|
5307
5307
|
return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
|
|
5308
5308
|
}
|
|
5309
|
-
const capped = capJoinSet2(invoiceIds,
|
|
5310
|
-
if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${
|
|
5309
|
+
const capped = capJoinSet2(invoiceIds, _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5310
|
+
if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
|
|
5311
5311
|
const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
|
|
5312
5312
|
ctx.wires.issued += 1;
|
|
5313
5313
|
return {
|
|
@@ -5353,7 +5353,7 @@ async function readOpenStatusSet(ctx) {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
}
|
|
5355
5355
|
} catch (err) {
|
|
5356
|
-
statusNote = `the tickets.status field catalog read failed (${err instanceof
|
|
5356
|
+
statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
|
|
5357
5357
|
}
|
|
5358
5358
|
return { openStatusSet, statusNote };
|
|
5359
5359
|
}
|
|
@@ -5376,8 +5376,8 @@ async function fetchResources(ctx, entries) {
|
|
|
5376
5376
|
if (resourceIds.length === 0) {
|
|
5377
5377
|
return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
|
|
5378
5378
|
}
|
|
5379
|
-
const capped = capJoinSet2(resourceIds,
|
|
5380
|
-
if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${
|
|
5379
|
+
const capped = capJoinSet2(resourceIds, _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5380
|
+
if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
|
|
5381
5381
|
const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
|
|
5382
5382
|
ctx.wires.issued += 1;
|
|
5383
5383
|
for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
|
|
@@ -5444,7 +5444,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
|
|
|
5444
5444
|
try {
|
|
5445
5445
|
return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
|
|
5446
5446
|
} catch (err) {
|
|
5447
|
-
if (!(err instanceof
|
|
5447
|
+
if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
|
|
5448
5448
|
return null;
|
|
5449
5449
|
}
|
|
5450
5450
|
}
|
|
@@ -5461,7 +5461,7 @@ async function fetchSubscriptions(ctx, cis) {
|
|
|
5461
5461
|
cancelledSubs
|
|
5462
5462
|
};
|
|
5463
5463
|
}
|
|
5464
|
-
const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0),
|
|
5464
|
+
const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5465
5465
|
const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
|
|
5466
5466
|
const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
|
|
5467
5467
|
const subscriptions = raw.items;
|
|
@@ -6146,7 +6146,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
6146
6146
|
}
|
|
6147
6147
|
|
|
6148
6148
|
// src/resources/contracts.ts
|
|
6149
|
-
var ContractsResource = class extends
|
|
6149
|
+
var ContractsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6150
6150
|
constructor(http, pageSize) {
|
|
6151
6151
|
super(http, {
|
|
6152
6152
|
key: "contracts",
|
|
@@ -6217,7 +6217,7 @@ var ContractsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6217
6217
|
};
|
|
6218
6218
|
|
|
6219
6219
|
// src/resources/contract_ticket_purchases.ts
|
|
6220
|
-
var ContractTicketPurchasesResource = class extends
|
|
6220
|
+
var ContractTicketPurchasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6221
6221
|
constructor(http, pageSize) {
|
|
6222
6222
|
super(http, {
|
|
6223
6223
|
key: "contract_ticket_purchases",
|
|
@@ -6276,7 +6276,7 @@ var ContractTicketPurchasesResource = class extends _chunkLVBFLSPLcjs.BaseResour
|
|
|
6276
6276
|
};
|
|
6277
6277
|
|
|
6278
6278
|
// src/resources/countries.ts
|
|
6279
|
-
var CountriesResource = class extends
|
|
6279
|
+
var CountriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6280
6280
|
constructor(http, pageSize) {
|
|
6281
6281
|
super(http, {
|
|
6282
6282
|
key: "countries",
|
|
@@ -6334,8 +6334,52 @@ var CountriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6334
6334
|
}
|
|
6335
6335
|
};
|
|
6336
6336
|
|
|
6337
|
+
// src/resources/currencies.ts
|
|
6338
|
+
var CurrenciesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6339
|
+
constructor(http, pageSize) {
|
|
6340
|
+
super(http, {
|
|
6341
|
+
key: "currencies",
|
|
6342
|
+
resourcePath: "/V1.0/Currencies",
|
|
6343
|
+
deletable: false,
|
|
6344
|
+
udfCapable: false,
|
|
6345
|
+
searchFields: ["name"]
|
|
6346
|
+
}, pageSize);
|
|
6347
|
+
}
|
|
6348
|
+
/** Query Currency records with the G3 filter surface (server-side JSON filter). */
|
|
6349
|
+
query(params) {
|
|
6350
|
+
return this.queryItems(params);
|
|
6351
|
+
}
|
|
6352
|
+
/** Get every Currency record (the MCP-preferred read; 1000-page guarded). */
|
|
6353
|
+
async queryAll(params) {
|
|
6354
|
+
return this.queryAllItems(params);
|
|
6355
|
+
}
|
|
6356
|
+
/** Count matching records (queryCount envelope unwrapped to a plain number). */
|
|
6357
|
+
async count(params) {
|
|
6358
|
+
return this.countGlobal(params);
|
|
6359
|
+
}
|
|
6360
|
+
/** Get one record by id (item envelope; item: null → NotFoundError). */
|
|
6361
|
+
async get(id) {
|
|
6362
|
+
return this.getGlobal(id);
|
|
6363
|
+
}
|
|
6364
|
+
/** Resolve a Currency from a numeric id (or, where the vendor indexes a primary text field,
|
|
6365
|
+
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
6366
|
+
* non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a
|
|
6367
|
+
* cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).
|
|
6368
|
+
* The compact shape is the structural alias of the full record; `expand: true` is the
|
|
6369
|
+
* type-level escape hatch. */
|
|
6370
|
+
async resolve(identifier, opts = {}) {
|
|
6371
|
+
void opts;
|
|
6372
|
+
return this.resolveBase(identifier);
|
|
6373
|
+
}
|
|
6374
|
+
/** Search Currency records: bounded contains on name (no vendor free-text search exists);
|
|
6375
|
+
* limit defaults to 25, max 500. */
|
|
6376
|
+
async search(query, opts) {
|
|
6377
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _67 => _67.limit]) });
|
|
6378
|
+
}
|
|
6379
|
+
};
|
|
6380
|
+
|
|
6337
6381
|
// src/resources/departments.ts
|
|
6338
|
-
var DepartmentsResource = class extends
|
|
6382
|
+
var DepartmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6339
6383
|
constructor(http, pageSize) {
|
|
6340
6384
|
super(http, {
|
|
6341
6385
|
key: "departments",
|
|
@@ -6397,12 +6441,12 @@ var DepartmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6397
6441
|
/** Search Department records: bounded contains on name (no vendor free-text search exists);
|
|
6398
6442
|
* limit defaults to 25, max 500. */
|
|
6399
6443
|
async search(query, opts) {
|
|
6400
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
6444
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _68 => _68.limit]) });
|
|
6401
6445
|
}
|
|
6402
6446
|
};
|
|
6403
6447
|
|
|
6404
6448
|
// src/resources/domain_registrars.ts
|
|
6405
|
-
var DomainRegistrarsResource = class extends
|
|
6449
|
+
var DomainRegistrarsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6406
6450
|
constructor(http, pageSize) {
|
|
6407
6451
|
super(http, {
|
|
6408
6452
|
key: "domain_registrars",
|
|
@@ -6464,7 +6508,7 @@ var DomainRegistrarsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6464
6508
|
/** Search DomainRegistrar records: bounded contains on name (no vendor free-text search exists);
|
|
6465
6509
|
* limit defaults to 25, max 500. */
|
|
6466
6510
|
async search(query, opts) {
|
|
6467
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
6511
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _69 => _69.limit]) });
|
|
6468
6512
|
}
|
|
6469
6513
|
};
|
|
6470
6514
|
|
|
@@ -6485,7 +6529,7 @@ var EntityInformationResource = class {
|
|
|
6485
6529
|
};
|
|
6486
6530
|
|
|
6487
6531
|
// src/resources/expense_item_attachments.ts
|
|
6488
|
-
var ExpenseItemAttachmentsResource = class extends
|
|
6532
|
+
var ExpenseItemAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6489
6533
|
constructor(http, pageSize) {
|
|
6490
6534
|
super(http, {
|
|
6491
6535
|
key: "expense_item_attachments",
|
|
@@ -6547,7 +6591,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
6547
6591
|
};
|
|
6548
6592
|
|
|
6549
6593
|
// src/resources/expense_items.ts
|
|
6550
|
-
var ExpenseItemsResource = class extends
|
|
6594
|
+
var ExpenseItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6551
6595
|
constructor(http, pageSize) {
|
|
6552
6596
|
super(http, {
|
|
6553
6597
|
key: "expense_items",
|
|
@@ -6606,7 +6650,7 @@ var ExpenseItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6606
6650
|
};
|
|
6607
6651
|
|
|
6608
6652
|
// src/resources/expense_reports.ts
|
|
6609
|
-
var ExpenseReportsResource = class extends
|
|
6653
|
+
var ExpenseReportsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6610
6654
|
constructor(http, pageSize) {
|
|
6611
6655
|
super(http, {
|
|
6612
6656
|
key: "expense_reports",
|
|
@@ -6668,12 +6712,12 @@ var ExpenseReportsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6668
6712
|
/** Search ExpenseReport records: bounded contains on name (no vendor free-text search exists);
|
|
6669
6713
|
* limit defaults to 25, max 500. */
|
|
6670
6714
|
async search(query, opts) {
|
|
6671
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
6715
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _70 => _70.limit]) });
|
|
6672
6716
|
}
|
|
6673
6717
|
};
|
|
6674
6718
|
|
|
6675
6719
|
// src/resources/holiday_sets.ts
|
|
6676
|
-
var HolidaySetsResource = class extends
|
|
6720
|
+
var HolidaySetsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6677
6721
|
constructor(http, pageSize) {
|
|
6678
6722
|
super(http, {
|
|
6679
6723
|
key: "holiday_sets",
|
|
@@ -6742,7 +6786,7 @@ var HolidaySetsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6742
6786
|
};
|
|
6743
6787
|
|
|
6744
6788
|
// src/resources/holidays.ts
|
|
6745
|
-
var HolidaysResource = class extends
|
|
6789
|
+
var HolidaysResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6746
6790
|
constructor(http, pageSize) {
|
|
6747
6791
|
super(http, {
|
|
6748
6792
|
key: "holidays",
|
|
@@ -6814,10 +6858,10 @@ var PATH_SUFFIX = {
|
|
|
6814
6858
|
transfer: "StockedItemsTransfer"
|
|
6815
6859
|
};
|
|
6816
6860
|
async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
6817
|
-
const numericParent =
|
|
6861
|
+
const numericParent = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, parentId, "parentId");
|
|
6818
6862
|
const suffix = PATH_SUFFIX[kind];
|
|
6819
6863
|
if (opts.dryRun === true) {
|
|
6820
|
-
return
|
|
6864
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
6821
6865
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6822
6866
|
method: "POST",
|
|
6823
6867
|
path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
|
|
@@ -6834,11 +6878,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
|
6834
6878
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6835
6879
|
maxRetries: opts.maxRetries
|
|
6836
6880
|
});
|
|
6837
|
-
return
|
|
6881
|
+
return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
|
|
6838
6882
|
}
|
|
6839
6883
|
|
|
6840
6884
|
// src/resources/inventory_products.ts
|
|
6841
|
-
var InventoryProductsResource = class extends
|
|
6885
|
+
var InventoryProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6842
6886
|
constructor(http, pageSize) {
|
|
6843
6887
|
super(http, {
|
|
6844
6888
|
key: "inventory_products",
|
|
@@ -6920,7 +6964,7 @@ var InventoryProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
6920
6964
|
|
|
6921
6965
|
// src/resources/special/invoices.ts
|
|
6922
6966
|
async function markup(_resource, id, format, http) {
|
|
6923
|
-
const numericId =
|
|
6967
|
+
const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
6924
6968
|
const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
|
|
6925
6969
|
const res = await http.request({
|
|
6926
6970
|
method: "GET",
|
|
@@ -6929,7 +6973,7 @@ async function markup(_resource, id, format, http) {
|
|
|
6929
6973
|
});
|
|
6930
6974
|
const body = res;
|
|
6931
6975
|
if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
|
|
6932
|
-
throw new (0,
|
|
6976
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(
|
|
6933
6977
|
`Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
|
|
6934
6978
|
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
|
|
6935
6979
|
);
|
|
@@ -6937,44 +6981,44 @@ async function markup(_resource, id, format, http) {
|
|
|
6937
6981
|
return body.invoiceMarkup;
|
|
6938
6982
|
}
|
|
6939
6983
|
async function pdf(_resource, id, http) {
|
|
6940
|
-
const numericId =
|
|
6984
|
+
const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
6941
6985
|
const res = await http.request({
|
|
6942
6986
|
method: "GET",
|
|
6943
6987
|
path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
|
|
6944
6988
|
operation: "invoices.pdf"
|
|
6945
6989
|
});
|
|
6946
|
-
return
|
|
6990
|
+
return _chunkHQGE4WAVcjs.decodeFileData.call(void 0, res);
|
|
6947
6991
|
}
|
|
6948
6992
|
async function windowQuery2(_resource, kind, http, opts) {
|
|
6949
|
-
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
6950
|
-
const tz = _optionalChain([opts, 'optionalAccess',
|
|
6993
|
+
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _71 => _71.now]), () => ( /* @__PURE__ */ new Date()));
|
|
6994
|
+
const tz = _optionalChain([opts, 'optionalAccess', _72 => _72.tz]) === void 0 ? void 0 : validateZone(opts.tz, `invoices.${kind}`);
|
|
6951
6995
|
return dateWindowQuery(
|
|
6952
6996
|
http,
|
|
6953
6997
|
"/V1.0/Invoices/query",
|
|
6954
6998
|
"invoiceDateTime",
|
|
6955
6999
|
kind,
|
|
6956
|
-
clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
7000
|
+
clampWindowLimit(_optionalChain([opts, 'optionalAccess', _73 => _73.limit])),
|
|
6957
7001
|
`invoices.${kind}`,
|
|
6958
7002
|
now,
|
|
6959
7003
|
tz
|
|
6960
7004
|
);
|
|
6961
7005
|
}
|
|
6962
7006
|
async function customRange2(_resource, from, to, http, opts) {
|
|
6963
|
-
const zone = _optionalChain([opts, 'optionalAccess',
|
|
7007
|
+
const zone = _optionalChain([opts, 'optionalAccess', _74 => _74.tz]) === void 0 ? void 0 : validateZone(opts.tz, "invoices.customRange");
|
|
6964
7008
|
return customRangeQuery(
|
|
6965
7009
|
http,
|
|
6966
7010
|
"/V1.0/Invoices/query",
|
|
6967
7011
|
"invoiceDateTime",
|
|
6968
7012
|
from,
|
|
6969
7013
|
to,
|
|
6970
|
-
clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
7014
|
+
clampWindowLimit(_optionalChain([opts, 'optionalAccess', _75 => _75.limit])),
|
|
6971
7015
|
"invoices.customRange",
|
|
6972
7016
|
zone
|
|
6973
7017
|
);
|
|
6974
7018
|
}
|
|
6975
7019
|
|
|
6976
7020
|
// src/resources/invoices.ts
|
|
6977
|
-
var InvoicesResource = class extends
|
|
7021
|
+
var InvoicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
6978
7022
|
constructor(http, pageSize) {
|
|
6979
7023
|
super(http, {
|
|
6980
7024
|
key: "invoices",
|
|
@@ -7104,7 +7148,7 @@ var ModulesResource = class {
|
|
|
7104
7148
|
};
|
|
7105
7149
|
|
|
7106
7150
|
// src/resources/notification_history.ts
|
|
7107
|
-
var NotificationHistoryResource = class extends
|
|
7151
|
+
var NotificationHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7108
7152
|
constructor(http, pageSize) {
|
|
7109
7153
|
super(http, {
|
|
7110
7154
|
key: "notification_history",
|
|
@@ -7143,7 +7187,7 @@ var NotificationHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7143
7187
|
};
|
|
7144
7188
|
|
|
7145
7189
|
// src/resources/opportunities.ts
|
|
7146
|
-
var OpportunitiesResource = class extends
|
|
7190
|
+
var OpportunitiesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7147
7191
|
constructor(http, pageSize) {
|
|
7148
7192
|
super(http, {
|
|
7149
7193
|
key: "opportunities",
|
|
@@ -7205,7 +7249,7 @@ var OpportunitiesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7205
7249
|
};
|
|
7206
7250
|
|
|
7207
7251
|
// src/resources/opportunity_attachments.ts
|
|
7208
|
-
var OpportunityAttachmentsResource = class extends
|
|
7252
|
+
var OpportunityAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7209
7253
|
constructor(http, pageSize) {
|
|
7210
7254
|
super(http, {
|
|
7211
7255
|
key: "opportunity_attachments",
|
|
@@ -7267,7 +7311,7 @@ var OpportunityAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
7267
7311
|
};
|
|
7268
7312
|
|
|
7269
7313
|
// src/resources/opportunity_categories.ts
|
|
7270
|
-
var OpportunityCategoriesResource = class extends
|
|
7314
|
+
var OpportunityCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7271
7315
|
constructor(http, pageSize) {
|
|
7272
7316
|
super(http, {
|
|
7273
7317
|
key: "opportunity_categories",
|
|
@@ -7321,12 +7365,12 @@ var OpportunityCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
7321
7365
|
/** Search OpportunityCategory records: bounded contains on name (no vendor free-text search exists);
|
|
7322
7366
|
* limit defaults to 25, max 500. */
|
|
7323
7367
|
async search(query, opts) {
|
|
7324
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
7368
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _76 => _76.limit]) });
|
|
7325
7369
|
}
|
|
7326
7370
|
};
|
|
7327
7371
|
|
|
7328
7372
|
// src/resources/phases.ts
|
|
7329
|
-
var PhasesResource = class extends
|
|
7373
|
+
var PhasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7330
7374
|
constructor(http, pageSize) {
|
|
7331
7375
|
super(http, {
|
|
7332
7376
|
key: "phases",
|
|
@@ -7385,7 +7429,7 @@ var PhasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7385
7429
|
};
|
|
7386
7430
|
|
|
7387
7431
|
// src/resources/products.ts
|
|
7388
|
-
var ProductsResource = class extends
|
|
7432
|
+
var ProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7389
7433
|
constructor(http, pageSize) {
|
|
7390
7434
|
super(http, {
|
|
7391
7435
|
key: "products",
|
|
@@ -7447,12 +7491,12 @@ var ProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7447
7491
|
/** Search Product records: bounded contains on name (no vendor free-text search exists);
|
|
7448
7492
|
* limit defaults to 25, max 500. */
|
|
7449
7493
|
async search(query, opts) {
|
|
7450
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
7494
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _77 => _77.limit]) });
|
|
7451
7495
|
}
|
|
7452
7496
|
};
|
|
7453
7497
|
|
|
7454
7498
|
// src/resources/product_vendors.ts
|
|
7455
|
-
var ProductVendorsResource = class extends
|
|
7499
|
+
var ProductVendorsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7456
7500
|
constructor(http, pageSize) {
|
|
7457
7501
|
super(http, {
|
|
7458
7502
|
key: "product_vendors",
|
|
@@ -7511,7 +7555,7 @@ var ProductVendorsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7511
7555
|
};
|
|
7512
7556
|
|
|
7513
7557
|
// src/resources/project_charges.ts
|
|
7514
|
-
var ProjectChargesResource = class extends
|
|
7558
|
+
var ProjectChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7515
7559
|
constructor(http, pageSize) {
|
|
7516
7560
|
super(http, {
|
|
7517
7561
|
key: "project_charges",
|
|
@@ -7577,12 +7621,12 @@ var ProjectChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7577
7621
|
/** Search ProjectCharge records: bounded contains on name (no vendor free-text search exists);
|
|
7578
7622
|
* limit defaults to 25, max 500. */
|
|
7579
7623
|
async search(query, opts) {
|
|
7580
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
7624
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _78 => _78.limit]) });
|
|
7581
7625
|
}
|
|
7582
7626
|
};
|
|
7583
7627
|
|
|
7584
7628
|
// src/resources/project_notes.ts
|
|
7585
|
-
var ProjectNotesResource = class extends
|
|
7629
|
+
var ProjectNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7586
7630
|
constructor(http, pageSize) {
|
|
7587
7631
|
super(http, {
|
|
7588
7632
|
key: "project_notes",
|
|
@@ -7641,7 +7685,7 @@ var ProjectNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7641
7685
|
};
|
|
7642
7686
|
|
|
7643
7687
|
// src/resources/projects.ts
|
|
7644
|
-
var ProjectsResource = class extends
|
|
7688
|
+
var ProjectsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7645
7689
|
constructor(http, pageSize) {
|
|
7646
7690
|
super(http, {
|
|
7647
7691
|
key: "projects",
|
|
@@ -7703,7 +7747,7 @@ var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7703
7747
|
/** Search Project records: bounded contains on projectName (no vendor free-text search exists);
|
|
7704
7748
|
* limit defaults to 25, max 500. */
|
|
7705
7749
|
async search(query, opts) {
|
|
7706
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
7750
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _79 => _79.limit]) });
|
|
7707
7751
|
}
|
|
7708
7752
|
/** Get the Project with its primary context records in one call (each part a single-record
|
|
7709
7753
|
* fetch; no sub-lists; absent/dangling references come back null). `names: true` (issue #77)
|
|
@@ -7718,13 +7762,13 @@ var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7718
7762
|
const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
|
|
7719
7763
|
const result = { project: project2, company, opportunity, leadResource };
|
|
7720
7764
|
if (opts.names === true) {
|
|
7721
|
-
const builder =
|
|
7765
|
+
const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, );
|
|
7722
7766
|
builder.addResource(root["creatorResourceID"]);
|
|
7723
7767
|
builder.addFk("contract", root["contractID"]);
|
|
7724
|
-
const names = await
|
|
7768
|
+
const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
7725
7769
|
const row = { ...project2 };
|
|
7726
|
-
|
|
7727
|
-
|
|
7770
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
|
|
7771
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
7728
7772
|
result.project = row;
|
|
7729
7773
|
result.names = names.section;
|
|
7730
7774
|
}
|
|
@@ -7733,7 +7777,7 @@ var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7733
7777
|
};
|
|
7734
7778
|
|
|
7735
7779
|
// src/resources/purchase_approvals.ts
|
|
7736
|
-
var PurchaseApprovalsResource = class extends
|
|
7780
|
+
var PurchaseApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7737
7781
|
constructor(http, pageSize) {
|
|
7738
7782
|
super(http, {
|
|
7739
7783
|
key: "purchase_approvals",
|
|
@@ -7787,7 +7831,7 @@ var PurchaseApprovalsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7787
7831
|
};
|
|
7788
7832
|
|
|
7789
7833
|
// src/resources/purchase_order_item_receiving.ts
|
|
7790
|
-
var PurchaseOrderItemReceivingResource = class extends
|
|
7834
|
+
var PurchaseOrderItemReceivingResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7791
7835
|
constructor(http, pageSize) {
|
|
7792
7836
|
super(http, {
|
|
7793
7837
|
key: "purchase_order_item_receiving",
|
|
@@ -7837,7 +7881,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkLVBFLSPLcjs.BaseRes
|
|
|
7837
7881
|
};
|
|
7838
7882
|
|
|
7839
7883
|
// src/resources/purchase_order_items.ts
|
|
7840
|
-
var PurchaseOrderItemsResource = class extends
|
|
7884
|
+
var PurchaseOrderItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7841
7885
|
constructor(http, pageSize) {
|
|
7842
7886
|
super(http, {
|
|
7843
7887
|
key: "purchase_order_items",
|
|
@@ -7896,7 +7940,7 @@ var PurchaseOrderItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7896
7940
|
};
|
|
7897
7941
|
|
|
7898
7942
|
// src/resources/purchase_orders.ts
|
|
7899
|
-
var PurchaseOrdersResource = class extends
|
|
7943
|
+
var PurchaseOrdersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7900
7944
|
constructor(http, pageSize) {
|
|
7901
7945
|
super(http, {
|
|
7902
7946
|
key: "purchase_orders",
|
|
@@ -7958,7 +8002,7 @@ var PurchaseOrdersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
7958
8002
|
};
|
|
7959
8003
|
|
|
7960
8004
|
// src/resources/quote_items.ts
|
|
7961
|
-
var QuoteItemsResource = class extends
|
|
8005
|
+
var QuoteItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
7962
8006
|
constructor(http, pageSize) {
|
|
7963
8007
|
super(http, {
|
|
7964
8008
|
key: "quote_items",
|
|
@@ -8024,12 +8068,12 @@ var QuoteItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8024
8068
|
/** Search QuoteItem records: bounded contains on name (no vendor free-text search exists);
|
|
8025
8069
|
* limit defaults to 25, max 500. */
|
|
8026
8070
|
async search(query, opts) {
|
|
8027
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
8071
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _80 => _80.limit]) });
|
|
8028
8072
|
}
|
|
8029
8073
|
};
|
|
8030
8074
|
|
|
8031
8075
|
// src/resources/quote_locations.ts
|
|
8032
|
-
var QuoteLocationsResource = class extends
|
|
8076
|
+
var QuoteLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8033
8077
|
constructor(http, pageSize) {
|
|
8034
8078
|
super(http, {
|
|
8035
8079
|
key: "quote_locations",
|
|
@@ -8094,7 +8138,7 @@ var QuoteLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8094
8138
|
};
|
|
8095
8139
|
|
|
8096
8140
|
// src/resources/quotes.ts
|
|
8097
|
-
var QuotesResource = class extends
|
|
8141
|
+
var QuotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8098
8142
|
constructor(http, pageSize) {
|
|
8099
8143
|
super(http, {
|
|
8100
8144
|
key: "quotes",
|
|
@@ -8156,12 +8200,12 @@ var QuotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8156
8200
|
/** Search Quote records: bounded contains on name (no vendor free-text search exists);
|
|
8157
8201
|
* limit defaults to 25, max 500. */
|
|
8158
8202
|
async search(query, opts) {
|
|
8159
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
8203
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _81 => _81.limit]) });
|
|
8160
8204
|
}
|
|
8161
8205
|
};
|
|
8162
8206
|
|
|
8163
8207
|
// src/resources/quote_templates.ts
|
|
8164
|
-
var QuoteTemplatesResource = class extends
|
|
8208
|
+
var QuoteTemplatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8165
8209
|
constructor(http, pageSize) {
|
|
8166
8210
|
super(http, {
|
|
8167
8211
|
key: "quote_templates",
|
|
@@ -8200,12 +8244,12 @@ var QuoteTemplatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8200
8244
|
/** Search QuoteTemplate records: bounded contains on name (no vendor free-text search exists);
|
|
8201
8245
|
* limit defaults to 25, max 500. */
|
|
8202
8246
|
async search(query, opts) {
|
|
8203
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
8247
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _82 => _82.limit]) });
|
|
8204
8248
|
}
|
|
8205
8249
|
};
|
|
8206
8250
|
|
|
8207
8251
|
// src/resources/resource_role_queues.ts
|
|
8208
|
-
var ResourceRoleQueuesResource = class extends
|
|
8252
|
+
var ResourceRoleQueuesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8209
8253
|
constructor(http, pageSize) {
|
|
8210
8254
|
super(http, {
|
|
8211
8255
|
key: "resource_role_queues",
|
|
@@ -8264,7 +8308,7 @@ var ResourceRoleQueuesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8264
8308
|
};
|
|
8265
8309
|
|
|
8266
8310
|
// src/resources/resource_roles.ts
|
|
8267
|
-
var ResourceRolesResource = class extends
|
|
8311
|
+
var ResourceRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8268
8312
|
constructor(http, pageSize) {
|
|
8269
8313
|
super(http, {
|
|
8270
8314
|
key: "resource_roles",
|
|
@@ -8306,7 +8350,7 @@ var ResourceRolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8306
8350
|
};
|
|
8307
8351
|
|
|
8308
8352
|
// src/resources/resource_skills.ts
|
|
8309
|
-
var ResourceSkillsResource = class extends
|
|
8353
|
+
var ResourceSkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8310
8354
|
constructor(http, pageSize) {
|
|
8311
8355
|
super(http, {
|
|
8312
8356
|
key: "resource_skills",
|
|
@@ -8360,16 +8404,16 @@ var ResourceSkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8360
8404
|
var MAX_TRANSFER_IDS = 500;
|
|
8361
8405
|
function requirePositiveIds(ids2, label) {
|
|
8362
8406
|
if (!Array.isArray(ids2) || ids2.length === 0) {
|
|
8363
|
-
throw new (0,
|
|
8407
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
|
|
8364
8408
|
}
|
|
8365
8409
|
if (ids2.length > MAX_TRANSFER_IDS) {
|
|
8366
|
-
throw new (0,
|
|
8410
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
|
|
8367
8411
|
}
|
|
8368
8412
|
const out = [];
|
|
8369
8413
|
for (const raw of ids2) {
|
|
8370
|
-
const id =
|
|
8414
|
+
const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, raw, `${label} id`);
|
|
8371
8415
|
if (typeof id === "number" && id < 1) {
|
|
8372
|
-
throw new (0,
|
|
8416
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
|
|
8373
8417
|
}
|
|
8374
8418
|
out.push(id);
|
|
8375
8419
|
}
|
|
@@ -8377,7 +8421,7 @@ function requirePositiveIds(ids2, label) {
|
|
|
8377
8421
|
}
|
|
8378
8422
|
async function whoAmI(_resource, userName, http) {
|
|
8379
8423
|
const user = userName.trim();
|
|
8380
|
-
if (user === "") throw new (0,
|
|
8424
|
+
if (user === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
|
|
8381
8425
|
const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
|
|
8382
8426
|
const res = await http.request({
|
|
8383
8427
|
method: "POST",
|
|
@@ -8386,11 +8430,11 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8386
8430
|
body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
|
|
8387
8431
|
operation: "resources.whoAmI"
|
|
8388
8432
|
});
|
|
8389
|
-
const matches =
|
|
8433
|
+
const matches = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
8390
8434
|
if (matches.length === 0) return null;
|
|
8391
8435
|
if (matches.length > 1) {
|
|
8392
8436
|
const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
|
|
8393
|
-
throw new (0,
|
|
8437
|
+
throw new (0, _chunkHQGE4WAVcjs.ResolutionError)(
|
|
8394
8438
|
`whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
|
|
8395
8439
|
{ code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
|
|
8396
8440
|
);
|
|
@@ -8399,11 +8443,11 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8399
8443
|
}
|
|
8400
8444
|
async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
|
|
8401
8445
|
const ids2 = requirePositiveIds(companyIds, "transferOwnership");
|
|
8402
|
-
const destination =
|
|
8446
|
+
const destination = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
|
|
8403
8447
|
if (typeof destination === "number" && destination < 1) {
|
|
8404
|
-
throw new (0,
|
|
8448
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
|
|
8405
8449
|
}
|
|
8406
|
-
const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
8450
|
+
const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _83 => _83.dryRun]), () => ( true));
|
|
8407
8451
|
const changes = [];
|
|
8408
8452
|
const applied = [];
|
|
8409
8453
|
for (const id of ids2) {
|
|
@@ -8412,9 +8456,9 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8412
8456
|
method: "GET",
|
|
8413
8457
|
path: `/V1.0/Companies/${id}`,
|
|
8414
8458
|
operation: "resources.transferOwnership",
|
|
8415
|
-
maxRetries: _optionalChain([opts, 'optionalAccess',
|
|
8459
|
+
maxRetries: _optionalChain([opts, 'optionalAccess', _84 => _84.maxRetries])
|
|
8416
8460
|
});
|
|
8417
|
-
const company =
|
|
8461
|
+
const company = _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, id, void 0, "company");
|
|
8418
8462
|
const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
|
|
8419
8463
|
changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
|
|
8420
8464
|
if (!dryRun) {
|
|
@@ -8423,15 +8467,15 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8423
8467
|
path: "/V1.0/Companies",
|
|
8424
8468
|
body: { id, ownerResourceID: destination },
|
|
8425
8469
|
operation: "resources.transferOwnership",
|
|
8426
|
-
maxRetries: _optionalChain([opts, 'optionalAccess',
|
|
8470
|
+
maxRetries: _optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries])
|
|
8427
8471
|
});
|
|
8428
|
-
|
|
8472
|
+
_chunkHQGE4WAVcjs.unwrapOperation.call(void 0, update);
|
|
8429
8473
|
applied.push(id);
|
|
8430
8474
|
}
|
|
8431
8475
|
} catch (err) {
|
|
8432
|
-
if (!dryRun && err instanceof
|
|
8476
|
+
if (!dryRun && err instanceof _chunkHQGE4WAVcjs.AutotaskError) {
|
|
8433
8477
|
err.resourceIds = [id];
|
|
8434
|
-
err.details =
|
|
8478
|
+
err.details = _chunkHQGE4WAVcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
|
|
8435
8479
|
err.suggestedAction = `Partial transfer: ${applied.length} of ${ids2.length} companies were re-owned (ids: ${applied.join(", ") || "none"}); id ${id} failed. Re-run transferOwnership for the remaining ids (from ${id} on).`;
|
|
8436
8480
|
}
|
|
8437
8481
|
throw err;
|
|
@@ -8440,7 +8484,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8440
8484
|
if (dryRun) {
|
|
8441
8485
|
const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
|
|
8442
8486
|
return {
|
|
8443
|
-
...
|
|
8487
|
+
..._chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
8444
8488
|
operation: "resources.transferOwnership",
|
|
8445
8489
|
method: "PUT",
|
|
8446
8490
|
path: "/V1.0/Companies",
|
|
@@ -8464,7 +8508,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8464
8508
|
}
|
|
8465
8509
|
|
|
8466
8510
|
// src/resources/resources.ts
|
|
8467
|
-
var ResourcesResource = class extends
|
|
8511
|
+
var ResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8468
8512
|
|
|
8469
8513
|
constructor(http, clientConfig, pageSize) {
|
|
8470
8514
|
super(http, {
|
|
@@ -8523,7 +8567,7 @@ var ResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8523
8567
|
/** Search Resource records: bounded contains on firstName + lastName (no vendor free-text search exists);
|
|
8524
8568
|
* limit defaults to 25, max 500. */
|
|
8525
8569
|
async search(query, opts) {
|
|
8526
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
8570
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _86 => _86.limit]) });
|
|
8527
8571
|
}
|
|
8528
8572
|
/** Node-parity special op (hand-written in src/resources/special/resources.ts). */
|
|
8529
8573
|
transferOwnership(sourceResourceIds, destinationResourceId, opts = {}) {
|
|
@@ -8537,7 +8581,7 @@ var ResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8537
8581
|
|
|
8538
8582
|
// src/resources/special/resource_time_off_additional.ts
|
|
8539
8583
|
async function getByResource(_resource, resourceId, http) {
|
|
8540
|
-
const numericResource =
|
|
8584
|
+
const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8541
8585
|
const res = await http.request({
|
|
8542
8586
|
method: "GET",
|
|
8543
8587
|
path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
|
|
@@ -8551,11 +8595,11 @@ async function getByResource(_resource, resourceId, http) {
|
|
|
8551
8595
|
if (typeof item === "object" && !Array.isArray(item)) return [item];
|
|
8552
8596
|
}
|
|
8553
8597
|
}
|
|
8554
|
-
return
|
|
8598
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
|
|
8555
8599
|
}
|
|
8556
8600
|
|
|
8557
8601
|
// src/resources/resource_time_off_additional.ts
|
|
8558
|
-
var ResourceTimeOffAdditionalResource = class extends
|
|
8602
|
+
var ResourceTimeOffAdditionalResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8559
8603
|
constructor(http, pageSize) {
|
|
8560
8604
|
super(http, {
|
|
8561
8605
|
key: "resource_time_off_additional",
|
|
@@ -8594,7 +8638,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkLVBFLSPLcjs.BaseReso
|
|
|
8594
8638
|
};
|
|
8595
8639
|
|
|
8596
8640
|
// src/resources/resource_time_off_approvers.ts
|
|
8597
|
-
var ResourceTimeOffApproversResource = class extends
|
|
8641
|
+
var ResourceTimeOffApproversResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8598
8642
|
constructor(http, pageSize) {
|
|
8599
8643
|
super(http, {
|
|
8600
8644
|
key: "resource_time_off_approvers",
|
|
@@ -8637,29 +8681,29 @@ var ResourceTimeOffApproversResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
8637
8681
|
|
|
8638
8682
|
// src/resources/special/resource_time_off_balances.ts
|
|
8639
8683
|
async function getByResource2(_resource, resourceId, http) {
|
|
8640
|
-
const numericResource =
|
|
8684
|
+
const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8641
8685
|
const res = await http.request({
|
|
8642
8686
|
method: "GET",
|
|
8643
8687
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
|
|
8644
8688
|
operation: "resource_time_off_balances.getByResource"
|
|
8645
8689
|
});
|
|
8646
|
-
return
|
|
8690
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
|
|
8647
8691
|
}
|
|
8648
8692
|
async function getByYear(_resource, resourceId, year, http) {
|
|
8649
|
-
const numericResource =
|
|
8693
|
+
const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8650
8694
|
if (!Number.isSafeInteger(year) || year < 1) {
|
|
8651
|
-
throw new (0,
|
|
8695
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
|
|
8652
8696
|
}
|
|
8653
8697
|
const res = await http.request({
|
|
8654
8698
|
method: "GET",
|
|
8655
8699
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
|
|
8656
8700
|
operation: "resource_time_off_balances.getByYear"
|
|
8657
8701
|
});
|
|
8658
|
-
return
|
|
8702
|
+
return _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
|
|
8659
8703
|
}
|
|
8660
8704
|
|
|
8661
8705
|
// src/resources/resource_time_off_balances.ts
|
|
8662
|
-
var ResourceTimeOffBalancesResource = class extends
|
|
8706
|
+
var ResourceTimeOffBalancesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8663
8707
|
constructor(http, pageSize) {
|
|
8664
8708
|
super(http, {
|
|
8665
8709
|
key: "resource_time_off_balances",
|
|
@@ -8697,7 +8741,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkLVBFLSPLcjs.BaseResour
|
|
|
8697
8741
|
};
|
|
8698
8742
|
|
|
8699
8743
|
// src/resources/roles.ts
|
|
8700
|
-
var RolesResource = class extends
|
|
8744
|
+
var RolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8701
8745
|
constructor(http, pageSize) {
|
|
8702
8746
|
super(http, {
|
|
8703
8747
|
key: "roles",
|
|
@@ -8759,12 +8803,12 @@ var RolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8759
8803
|
/** Search Role records: bounded contains on name (no vendor free-text search exists);
|
|
8760
8804
|
* limit defaults to 25, max 500. */
|
|
8761
8805
|
async search(query, opts) {
|
|
8762
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
8806
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _87 => _87.limit]) });
|
|
8763
8807
|
}
|
|
8764
8808
|
};
|
|
8765
8809
|
|
|
8766
8810
|
// src/resources/service_calls.ts
|
|
8767
|
-
var ServiceCallsResource = class extends
|
|
8811
|
+
var ServiceCallsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8768
8812
|
constructor(http, pageSize) {
|
|
8769
8813
|
super(http, {
|
|
8770
8814
|
key: "service_calls",
|
|
@@ -8833,7 +8877,7 @@ var ServiceCallsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8833
8877
|
};
|
|
8834
8878
|
|
|
8835
8879
|
// src/resources/service_call_task_resources.ts
|
|
8836
|
-
var ServiceCallTaskResourcesResource = class extends
|
|
8880
|
+
var ServiceCallTaskResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8837
8881
|
constructor(http, pageSize) {
|
|
8838
8882
|
super(http, {
|
|
8839
8883
|
key: "service_call_task_resources",
|
|
@@ -8890,7 +8934,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
8890
8934
|
};
|
|
8891
8935
|
|
|
8892
8936
|
// src/resources/service_call_tasks.ts
|
|
8893
|
-
var ServiceCallTasksResource = class extends
|
|
8937
|
+
var ServiceCallTasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8894
8938
|
constructor(http, pageSize) {
|
|
8895
8939
|
super(http, {
|
|
8896
8940
|
key: "service_call_tasks",
|
|
@@ -8947,7 +8991,7 @@ var ServiceCallTasksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
8947
8991
|
};
|
|
8948
8992
|
|
|
8949
8993
|
// src/resources/service_call_ticket_resources.ts
|
|
8950
|
-
var ServiceCallTicketResourcesResource = class extends
|
|
8994
|
+
var ServiceCallTicketResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
8951
8995
|
constructor(http, pageSize) {
|
|
8952
8996
|
super(http, {
|
|
8953
8997
|
key: "service_call_ticket_resources",
|
|
@@ -9004,7 +9048,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkLVBFLSPLcjs.BaseRes
|
|
|
9004
9048
|
};
|
|
9005
9049
|
|
|
9006
9050
|
// src/resources/service_call_tickets.ts
|
|
9007
|
-
var ServiceCallTicketsResource = class extends
|
|
9051
|
+
var ServiceCallTicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9008
9052
|
constructor(http, pageSize) {
|
|
9009
9053
|
super(http, {
|
|
9010
9054
|
key: "service_call_tickets",
|
|
@@ -9061,7 +9105,7 @@ var ServiceCallTicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9061
9105
|
};
|
|
9062
9106
|
|
|
9063
9107
|
// src/resources/service_level_agreement_results.ts
|
|
9064
|
-
var ServiceLevelAgreementResultsResource = class extends
|
|
9108
|
+
var ServiceLevelAgreementResultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9065
9109
|
constructor(http, pageSize) {
|
|
9066
9110
|
super(http, {
|
|
9067
9111
|
key: "service_level_agreement_results",
|
|
@@ -9100,7 +9144,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkLVBFLSPLcjs.BaseR
|
|
|
9100
9144
|
};
|
|
9101
9145
|
|
|
9102
9146
|
// src/resources/services.ts
|
|
9103
|
-
var ServicesResource = class extends
|
|
9147
|
+
var ServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9104
9148
|
constructor(http, pageSize) {
|
|
9105
9149
|
super(http, {
|
|
9106
9150
|
key: "services",
|
|
@@ -9163,12 +9207,12 @@ var ServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9163
9207
|
/** Search Service records: bounded contains on name (no vendor free-text search exists);
|
|
9164
9208
|
* limit defaults to 25, max 500. */
|
|
9165
9209
|
async search(query, opts) {
|
|
9166
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
9210
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _88 => _88.limit]) });
|
|
9167
9211
|
}
|
|
9168
9212
|
};
|
|
9169
9213
|
|
|
9170
9214
|
// src/resources/skills.ts
|
|
9171
|
-
var SkillsResource = class extends
|
|
9215
|
+
var SkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9172
9216
|
constructor(http, pageSize) {
|
|
9173
9217
|
super(http, {
|
|
9174
9218
|
key: "skills",
|
|
@@ -9207,12 +9251,12 @@ var SkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9207
9251
|
/** Search Skill records: bounded contains on name (no vendor free-text search exists);
|
|
9208
9252
|
* limit defaults to 25, max 500. */
|
|
9209
9253
|
async search(query, opts) {
|
|
9210
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
9254
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _89 => _89.limit]) });
|
|
9211
9255
|
}
|
|
9212
9256
|
};
|
|
9213
9257
|
|
|
9214
9258
|
// src/resources/subscription_periods.ts
|
|
9215
|
-
var SubscriptionPeriodsResource = class extends
|
|
9259
|
+
var SubscriptionPeriodsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9216
9260
|
constructor(http, pageSize) {
|
|
9217
9261
|
super(http, {
|
|
9218
9262
|
key: "subscription_periods",
|
|
@@ -9251,7 +9295,7 @@ var SubscriptionPeriodsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9251
9295
|
};
|
|
9252
9296
|
|
|
9253
9297
|
// src/resources/subscriptions.ts
|
|
9254
|
-
var SubscriptionsResource = class extends
|
|
9298
|
+
var SubscriptionsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9255
9299
|
constructor(http, pageSize) {
|
|
9256
9300
|
super(http, {
|
|
9257
9301
|
key: "subscriptions",
|
|
@@ -9320,7 +9364,7 @@ var SubscriptionsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9320
9364
|
};
|
|
9321
9365
|
|
|
9322
9366
|
// src/resources/survey_results.ts
|
|
9323
|
-
var SurveyResultsResource = class extends
|
|
9367
|
+
var SurveyResultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9324
9368
|
constructor(http, pageSize) {
|
|
9325
9369
|
super(http, {
|
|
9326
9370
|
key: "survey_results",
|
|
@@ -9359,7 +9403,7 @@ var SurveyResultsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9359
9403
|
};
|
|
9360
9404
|
|
|
9361
9405
|
// src/resources/surveys.ts
|
|
9362
|
-
var SurveysResource = class extends
|
|
9406
|
+
var SurveysResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9363
9407
|
constructor(http, pageSize) {
|
|
9364
9408
|
super(http, {
|
|
9365
9409
|
key: "surveys",
|
|
@@ -9398,12 +9442,12 @@ var SurveysResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9398
9442
|
/** Search Survey records: bounded contains on name (no vendor free-text search exists);
|
|
9399
9443
|
* limit defaults to 25, max 500. */
|
|
9400
9444
|
async search(query, opts) {
|
|
9401
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
9445
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _90 => _90.limit]) });
|
|
9402
9446
|
}
|
|
9403
9447
|
};
|
|
9404
9448
|
|
|
9405
9449
|
// src/resources/tag_aliases.ts
|
|
9406
|
-
var TagAliasesResource = class extends
|
|
9450
|
+
var TagAliasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9407
9451
|
constructor(http, pageSize) {
|
|
9408
9452
|
super(http, {
|
|
9409
9453
|
key: "tag_aliases",
|
|
@@ -9460,7 +9504,7 @@ var TagAliasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9460
9504
|
};
|
|
9461
9505
|
|
|
9462
9506
|
// src/resources/tag_groups.ts
|
|
9463
|
-
var TagGroupsResource = class extends
|
|
9507
|
+
var TagGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9464
9508
|
constructor(http, pageSize) {
|
|
9465
9509
|
super(http, {
|
|
9466
9510
|
key: "tag_groups",
|
|
@@ -9529,7 +9573,7 @@ var TagGroupsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9529
9573
|
};
|
|
9530
9574
|
|
|
9531
9575
|
// src/resources/tags.ts
|
|
9532
|
-
var TagsResource = class extends
|
|
9576
|
+
var TagsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9533
9577
|
constructor(http, pageSize) {
|
|
9534
9578
|
super(http, {
|
|
9535
9579
|
key: "tags",
|
|
@@ -9598,7 +9642,7 @@ var TagsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9598
9642
|
};
|
|
9599
9643
|
|
|
9600
9644
|
// src/resources/task_secondary_resources.ts
|
|
9601
|
-
var TaskSecondaryResourcesResource = class extends
|
|
9645
|
+
var TaskSecondaryResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9602
9646
|
constructor(http, pageSize) {
|
|
9603
9647
|
super(http, {
|
|
9604
9648
|
key: "task_secondary_resources",
|
|
@@ -9655,7 +9699,7 @@ var TaskSecondaryResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
|
|
|
9655
9699
|
};
|
|
9656
9700
|
|
|
9657
9701
|
// src/resources/tasks.ts
|
|
9658
|
-
var TasksResource = class extends
|
|
9702
|
+
var TasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9659
9703
|
constructor(http, pageSize) {
|
|
9660
9704
|
super(http, {
|
|
9661
9705
|
key: "tasks",
|
|
@@ -9714,7 +9758,7 @@ var TasksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9714
9758
|
/** Search Task records: bounded contains on title (no vendor free-text search exists);
|
|
9715
9759
|
* limit defaults to 25, max 500. */
|
|
9716
9760
|
async search(query, opts) {
|
|
9717
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
9761
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _91 => _91.limit]) });
|
|
9718
9762
|
}
|
|
9719
9763
|
};
|
|
9720
9764
|
|
|
@@ -9743,7 +9787,7 @@ var ThresholdInformationResource = class {
|
|
|
9743
9787
|
};
|
|
9744
9788
|
|
|
9745
9789
|
// src/resources/ticket_additional_configuration_items.ts
|
|
9746
|
-
var TicketAdditionalConfigurationItemsResource = class extends
|
|
9790
|
+
var TicketAdditionalConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9747
9791
|
constructor(http, pageSize) {
|
|
9748
9792
|
super(http, {
|
|
9749
9793
|
key: "ticket_additional_configuration_items",
|
|
@@ -9800,7 +9844,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkLVBFLSPLcjs
|
|
|
9800
9844
|
};
|
|
9801
9845
|
|
|
9802
9846
|
// src/resources/ticket_additional_contacts.ts
|
|
9803
|
-
var TicketAdditionalContactsResource = class extends
|
|
9847
|
+
var TicketAdditionalContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9804
9848
|
constructor(http, pageSize) {
|
|
9805
9849
|
super(http, {
|
|
9806
9850
|
key: "ticket_additional_contacts",
|
|
@@ -9857,7 +9901,7 @@ var TicketAdditionalContactsResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
9857
9901
|
};
|
|
9858
9902
|
|
|
9859
9903
|
// src/resources/ticket_attachments.ts
|
|
9860
|
-
var TicketAttachmentsResource = class extends
|
|
9904
|
+
var TicketAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9861
9905
|
constructor(http, pageSize) {
|
|
9862
9906
|
super(http, {
|
|
9863
9907
|
key: "ticket_attachments",
|
|
@@ -9919,7 +9963,7 @@ var TicketAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9919
9963
|
};
|
|
9920
9964
|
|
|
9921
9965
|
// src/resources/ticket_categories.ts
|
|
9922
|
-
var TicketCategoriesResource = class extends
|
|
9966
|
+
var TicketCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9923
9967
|
constructor(http, pageSize) {
|
|
9924
9968
|
super(http, {
|
|
9925
9969
|
key: "ticket_categories",
|
|
@@ -9973,12 +10017,12 @@ var TicketCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
9973
10017
|
/** Search TicketCategory records: bounded contains on name (no vendor free-text search exists);
|
|
9974
10018
|
* limit defaults to 25, max 500. */
|
|
9975
10019
|
async search(query, opts) {
|
|
9976
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
10020
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _92 => _92.limit]) });
|
|
9977
10021
|
}
|
|
9978
10022
|
};
|
|
9979
10023
|
|
|
9980
10024
|
// src/resources/ticket_category_field_defaults.ts
|
|
9981
|
-
var TicketCategoryFieldDefaultsResource = class extends
|
|
10025
|
+
var TicketCategoryFieldDefaultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
9982
10026
|
constructor(http, pageSize) {
|
|
9983
10027
|
super(http, {
|
|
9984
10028
|
key: "ticket_category_field_defaults",
|
|
@@ -10020,7 +10064,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkLVBFLSPLcjs.BaseRe
|
|
|
10020
10064
|
};
|
|
10021
10065
|
|
|
10022
10066
|
// src/resources/ticket_change_request_approvals.ts
|
|
10023
|
-
var TicketChangeRequestApprovalsResource = class extends
|
|
10067
|
+
var TicketChangeRequestApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10024
10068
|
constructor(http, pageSize) {
|
|
10025
10069
|
super(http, {
|
|
10026
10070
|
key: "ticket_change_request_approvals",
|
|
@@ -10081,10 +10125,10 @@ var _crypto = require('crypto');
|
|
|
10081
10125
|
var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
|
|
10082
10126
|
var TICKET_COMPLETE_STATUS = 5;
|
|
10083
10127
|
var MOVE_EFFECTS_NOTE = "Create then delete: the new record gets a fresh create date and creator; creating/deleting may trigger notifications, SLA and workflow rules the API cannot suppress; vendor acceptance of the create is not validated by a dry run";
|
|
10084
|
-
var refuse = (code, message, ids2, operation, extra = {}) => new (0,
|
|
10128
|
+
var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
|
|
10085
10129
|
async function queryRows(http, resource, filter, operation, retries) {
|
|
10086
10130
|
const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
|
|
10087
|
-
return
|
|
10131
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
10088
10132
|
}
|
|
10089
10133
|
function sameValue(a, b) {
|
|
10090
10134
|
if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
|
|
@@ -10101,10 +10145,10 @@ function sameValue(a, b) {
|
|
|
10101
10145
|
async function readTicket(http, id, retries, operation) {
|
|
10102
10146
|
try {
|
|
10103
10147
|
const res = await http.request({ method: "GET", path: `/V1.0/Tickets/${id}`, operation, maxRetries: retries });
|
|
10104
|
-
const item = _optionalChain([res, 'optionalAccess',
|
|
10148
|
+
const item = _optionalChain([res, 'optionalAccess', _93 => _93.item]);
|
|
10105
10149
|
return _nullishCoalesce(item, () => ( null));
|
|
10106
10150
|
} catch (e) {
|
|
10107
|
-
if (
|
|
10151
|
+
if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
|
|
10108
10152
|
throw e;
|
|
10109
10153
|
}
|
|
10110
10154
|
}
|
|
@@ -10125,7 +10169,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
|
|
|
10125
10169
|
}
|
|
10126
10170
|
}
|
|
10127
10171
|
const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
|
|
10128
|
-
if (!Number.isFinite(cap) || cap < 0) throw new (0,
|
|
10172
|
+
if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
|
|
10129
10173
|
const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
|
|
10130
10174
|
if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
|
|
10131
10175
|
throw refuse("MOVE_SOURCE_TOO_OLD", `${op}: source ${spec.entity} ${sourceId} is older than ${cap} day(s) (or undated) \u2014 move it in the Autotask UI`, ids2, op, { manualAction: manualFor(http, spec, source, "older than the move age limit") });
|
|
@@ -10138,7 +10182,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
|
|
|
10138
10182
|
const origin = await readTicket(http, sourceTicketId, opts.maxRetries, op);
|
|
10139
10183
|
const facts = {
|
|
10140
10184
|
sourceTicketId,
|
|
10141
|
-
sourceCompanyID: _nullishCoalesce(_optionalChain([origin, 'optionalAccess',
|
|
10185
|
+
sourceCompanyID: _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _94 => _94.companyID]), () => ( null)),
|
|
10142
10186
|
targetCompanyID: _nullishCoalesce(target.companyID, () => ( null)),
|
|
10143
10187
|
companyChanged: origin === null ? null : origin.companyID !== target.companyID,
|
|
10144
10188
|
contractChanged: origin === null ? null : (_nullishCoalesce(origin.contractID, () => ( null))) !== (_nullishCoalesce(target.contractID, () => ( null)))
|
|
@@ -10160,17 +10204,17 @@ async function assertNoTwin(ctx, payload) {
|
|
|
10160
10204
|
throw refuse("MOVE_TARGET_HAS_TWIN", `${ctx.spec.operation}: target ticket ${ctx.toTicketId} already has an equivalent ${ctx.spec.entity} (id ${String(rows[0].id)}) \u2014 a duplicate or resumed move`, { sourceId: ctx.sourceId, toTicketId: ctx.toTicketId }, ctx.spec.operation, { twinId: rows[0].id });
|
|
10161
10205
|
}
|
|
10162
10206
|
}
|
|
10163
|
-
var statusOf = (e) =>
|
|
10207
|
+
var statusOf = (e) => _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
|
|
10164
10208
|
async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
|
|
10165
10209
|
const op = spec.operation;
|
|
10166
|
-
const sourceId = Number(
|
|
10167
|
-
const toTicketId = Number(
|
|
10210
|
+
const sourceId = Number(_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
|
|
10211
|
+
const toTicketId = Number(_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
|
|
10168
10212
|
if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
|
|
10169
|
-
throw new (0,
|
|
10213
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
|
|
10170
10214
|
}
|
|
10171
10215
|
const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
|
|
10172
10216
|
if (opts.dryRun === true) {
|
|
10173
|
-
return
|
|
10217
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
10174
10218
|
{
|
|
10175
10219
|
operation: op,
|
|
10176
10220
|
method: "POST",
|
|
@@ -10195,22 +10239,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
|
|
|
10195
10239
|
let newId;
|
|
10196
10240
|
try {
|
|
10197
10241
|
const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
|
|
10198
|
-
newId = Number(
|
|
10242
|
+
newId = Number(_chunkHQGE4WAVcjs.unwrapOperation.call(void 0, created, op).id);
|
|
10199
10243
|
} catch (e) {
|
|
10200
10244
|
const status = statusOf(e);
|
|
10201
10245
|
if (status !== void 0 && status >= 400 && status < 500) {
|
|
10202
|
-
throw new (0,
|
|
10246
|
+
throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
|
|
10203
10247
|
}
|
|
10204
|
-
throw new (0,
|
|
10248
|
+
throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: the create outcome is unknown (never resent) \u2014 check the target ticket for a new ${spec.entity} before retrying; the twin check blocks a second create`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2 } });
|
|
10205
10249
|
}
|
|
10206
10250
|
const rollback = async (code, message) => {
|
|
10207
10251
|
try {
|
|
10208
10252
|
await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
|
|
10209
10253
|
} catch (re) {
|
|
10210
10254
|
const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
|
|
10211
|
-
throw new (0,
|
|
10255
|
+
throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: ${message}; rolling back the new ${spec.entity} ${newId} FAILED \u2014 both records exist`, { code: unreadable ? "MOVE_UNKNOWN" : "MOVE_PARTIAL", operation: op, details: { status: unreadable ? "unknown" : "partial", ...ids2, newId, reason: code } });
|
|
10212
10256
|
}
|
|
10213
|
-
throw new (0,
|
|
10257
|
+
throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
|
|
10214
10258
|
};
|
|
10215
10259
|
const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
|
|
10216
10260
|
if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
|
|
@@ -10239,14 +10283,14 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
|
|
|
10239
10283
|
};
|
|
10240
10284
|
}
|
|
10241
10285
|
if (status === void 0) {
|
|
10242
|
-
throw new (0,
|
|
10286
|
+
throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: the source delete outcome is unknown (never resent) \u2014 re-read the source: absent means the move completed`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2, newId } });
|
|
10243
10287
|
}
|
|
10244
10288
|
return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
|
|
10245
10289
|
}
|
|
10246
10290
|
return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
|
|
10247
10291
|
}
|
|
10248
10292
|
function uiLinkFor(http, entity, id) {
|
|
10249
|
-
return _nullishCoalesce(
|
|
10293
|
+
return _nullishCoalesce(_chunkHQGE4WAVcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
|
|
10250
10294
|
}
|
|
10251
10295
|
|
|
10252
10296
|
// src/resources/special/ticket_charges.ts
|
|
@@ -10301,7 +10345,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
|
|
|
10301
10345
|
}
|
|
10302
10346
|
|
|
10303
10347
|
// src/resources/ticket_charges.ts
|
|
10304
|
-
var TicketChargesResource = class extends
|
|
10348
|
+
var TicketChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10305
10349
|
constructor(http, pageSize) {
|
|
10306
10350
|
super(http, {
|
|
10307
10351
|
key: "ticket_charges",
|
|
@@ -10367,7 +10411,7 @@ var TicketChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
10367
10411
|
/** Search TicketCharge records: bounded contains on name (no vendor free-text search exists);
|
|
10368
10412
|
* limit defaults to 25, max 500. */
|
|
10369
10413
|
async search(query, opts) {
|
|
10370
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
10414
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _95 => _95.limit]) });
|
|
10371
10415
|
}
|
|
10372
10416
|
/** Node-parity special op (hand-written in src/resources/special/ticket_charges.ts). */
|
|
10373
10417
|
moveToTicket(sourceId, toTicketId, opts = {}) {
|
|
@@ -10376,7 +10420,7 @@ var TicketChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
10376
10420
|
};
|
|
10377
10421
|
|
|
10378
10422
|
// src/resources/ticket_checklist_items.ts
|
|
10379
|
-
var TicketChecklistItemsResource = class extends
|
|
10423
|
+
var TicketChecklistItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10380
10424
|
constructor(http, pageSize) {
|
|
10381
10425
|
super(http, {
|
|
10382
10426
|
key: "ticket_checklist_items",
|
|
@@ -10442,7 +10486,7 @@ var TicketChecklistItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
10442
10486
|
};
|
|
10443
10487
|
|
|
10444
10488
|
// src/resources/ticket_checklist_libraries.ts
|
|
10445
|
-
var TicketChecklistLibrariesResource = class extends
|
|
10489
|
+
var TicketChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10446
10490
|
constructor(http, pageSize) {
|
|
10447
10491
|
super(http, {
|
|
10448
10492
|
key: "ticket_checklist_libraries",
|
|
@@ -10466,9 +10510,9 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
10466
10510
|
* `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
|
|
10467
10511
|
* surface — no documents read op — and never issues the POST). */
|
|
10468
10512
|
async attachToDocument(documentID, data, opts = {}) {
|
|
10469
|
-
const n =
|
|
10513
|
+
const n = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, documentID, "documentID");
|
|
10470
10514
|
if (opts.dryRun === true) {
|
|
10471
|
-
return
|
|
10515
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
10472
10516
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
10473
10517
|
method: "POST",
|
|
10474
10518
|
path: `/V1.0/Documents/${n}/ChecklistLibraries`,
|
|
@@ -10486,7 +10530,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
10486
10530
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
10487
10531
|
maxRetries: opts.maxRetries
|
|
10488
10532
|
});
|
|
10489
|
-
return
|
|
10533
|
+
return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
|
|
10490
10534
|
}
|
|
10491
10535
|
/** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
|
|
10492
10536
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -10502,7 +10546,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
|
|
|
10502
10546
|
};
|
|
10503
10547
|
|
|
10504
10548
|
// src/resources/ticket_history.ts
|
|
10505
|
-
var TicketHistoryResource = class extends
|
|
10549
|
+
var TicketHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10506
10550
|
constructor(http, pageSize) {
|
|
10507
10551
|
super(http, {
|
|
10508
10552
|
key: "ticket_history",
|
|
@@ -10541,7 +10585,7 @@ var TicketHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
10541
10585
|
};
|
|
10542
10586
|
|
|
10543
10587
|
// src/resources/ticket_note_attachments.ts
|
|
10544
|
-
var TicketNoteAttachmentsResource = class extends
|
|
10588
|
+
var TicketNoteAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10545
10589
|
constructor(http, pageSize) {
|
|
10546
10590
|
super(http, {
|
|
10547
10591
|
key: "ticket_note_attachments",
|
|
@@ -10603,7 +10647,7 @@ var TicketNoteAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
10603
10647
|
};
|
|
10604
10648
|
|
|
10605
10649
|
// src/resources/ticket_notes.ts
|
|
10606
|
-
var TicketNotesResource = class extends
|
|
10650
|
+
var TicketNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10607
10651
|
constructor(http, pageSize) {
|
|
10608
10652
|
super(http, {
|
|
10609
10653
|
key: "ticket_notes",
|
|
@@ -10662,7 +10706,7 @@ var TicketNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
10662
10706
|
};
|
|
10663
10707
|
|
|
10664
10708
|
// src/resources/ticket_note_webhooks.ts
|
|
10665
|
-
var TicketNoteWebhooksResource = class extends
|
|
10709
|
+
var TicketNoteWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10666
10710
|
constructor(http, pageSize) {
|
|
10667
10711
|
super(http, {
|
|
10668
10712
|
key: "ticket_note_webhooks",
|
|
@@ -10733,12 +10777,12 @@ var TicketNoteWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
10733
10777
|
/** Search TicketNoteWebhook records: bounded contains on name (no vendor free-text search exists);
|
|
10734
10778
|
* limit defaults to 25, max 500. */
|
|
10735
10779
|
async search(query, opts) {
|
|
10736
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
10780
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _96 => _96.limit]) });
|
|
10737
10781
|
}
|
|
10738
10782
|
};
|
|
10739
10783
|
|
|
10740
10784
|
// src/resources/ticket_secondary_resources.ts
|
|
10741
|
-
var TicketSecondaryResourcesResource = class extends
|
|
10785
|
+
var TicketSecondaryResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
10742
10786
|
constructor(http, pageSize) {
|
|
10743
10787
|
super(http, {
|
|
10744
10788
|
key: "ticket_secondary_resources",
|
|
@@ -10803,9 +10847,9 @@ async function fetchTicket(http, id, operation) {
|
|
|
10803
10847
|
});
|
|
10804
10848
|
const body = res;
|
|
10805
10849
|
if (body === null || !("item" in body)) {
|
|
10806
|
-
throw new (0,
|
|
10850
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
|
|
10807
10851
|
}
|
|
10808
|
-
if (body.item === null || body.item === void 0) throw new (0,
|
|
10852
|
+
if (body.item === null || body.item === void 0) throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
|
|
10809
10853
|
return body.item;
|
|
10810
10854
|
}
|
|
10811
10855
|
async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
@@ -10816,7 +10860,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
|
10816
10860
|
body: { MaxRecords: maxRecords, filter },
|
|
10817
10861
|
operation
|
|
10818
10862
|
});
|
|
10819
|
-
return
|
|
10863
|
+
return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
|
|
10820
10864
|
}
|
|
10821
10865
|
function truncate(text, limit) {
|
|
10822
10866
|
const full = _nullishCoalesce(text, () => ( ""));
|
|
@@ -10826,26 +10870,26 @@ function truncate(text, limit) {
|
|
|
10826
10870
|
|
|
10827
10871
|
// src/resources/special/tickets/childRead.ts
|
|
10828
10872
|
function isRouteUnavailable(err) {
|
|
10829
|
-
return
|
|
10873
|
+
return _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
|
|
10830
10874
|
}
|
|
10831
10875
|
function routeFact(route, path, err) {
|
|
10832
10876
|
return {
|
|
10833
10877
|
route,
|
|
10834
10878
|
path,
|
|
10835
|
-
httpStatus:
|
|
10879
|
+
httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
|
|
10836
10880
|
};
|
|
10837
10881
|
}
|
|
10838
10882
|
function childDeclaresQuery(resourceKey) {
|
|
10839
|
-
return
|
|
10883
|
+
return _chunkWM6E5O55cjs.CAPABILITIES.some(
|
|
10840
10884
|
(c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
|
|
10841
10885
|
);
|
|
10842
10886
|
}
|
|
10843
10887
|
function planScopedPath(resourceKey, ticketId) {
|
|
10844
10888
|
if (!childDeclaresQuery(resourceKey)) return null;
|
|
10845
|
-
const entry =
|
|
10889
|
+
const entry = _chunkHQGE4WAVcjs.RELATIONSHIP_MAP[resourceKey];
|
|
10846
10890
|
const parent = entry === void 0 ? null : entry.parent;
|
|
10847
10891
|
if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
|
|
10848
|
-
const parentPath = _optionalChain([
|
|
10892
|
+
const parentPath = _optionalChain([_chunkHQGE4WAVcjs.RELATIONSHIP_MAP, 'access', _97 => _97[parent.resource], 'optionalAccess', _98 => _98.path]);
|
|
10849
10893
|
if (parentPath === null || parentPath === void 0) return null;
|
|
10850
10894
|
return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
|
|
10851
10895
|
}
|
|
@@ -10884,14 +10928,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
|
|
|
10884
10928
|
break;
|
|
10885
10929
|
}
|
|
10886
10930
|
const body = await http.request({ method: "GET", path: target, operation });
|
|
10887
|
-
const { items: pageItems, pageDetails } =
|
|
10931
|
+
const { items: pageItems, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, body, operation);
|
|
10888
10932
|
nextCursor = pageDetails.nextPageUrl;
|
|
10889
10933
|
pages += 1;
|
|
10890
10934
|
const window = pageItems.slice(0, Math.max(0, limit - items.length));
|
|
10891
10935
|
for (const row of window) if (accept(row)) items.push(row);
|
|
10892
10936
|
if (items.length >= limit) break;
|
|
10893
10937
|
if (nextCursor === null || pageItems.length === 0) break;
|
|
10894
|
-
target =
|
|
10938
|
+
target = _chunkHQGE4WAVcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
|
|
10895
10939
|
}
|
|
10896
10940
|
const capped = items.length >= limit || guard && nextCursor !== null;
|
|
10897
10941
|
return { items, capped };
|
|
@@ -10924,7 +10968,7 @@ var MS = 864e5;
|
|
|
10924
10968
|
var SLA_PAGE = 100;
|
|
10925
10969
|
async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
10926
10970
|
void opts;
|
|
10927
|
-
const ticketId =
|
|
10971
|
+
const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
10928
10972
|
await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
|
|
10929
10973
|
const rows = await ticketQueryItems(
|
|
10930
10974
|
http,
|
|
@@ -10949,9 +10993,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
|
10949
10993
|
async function summary(_resource, id, opts = {}, http) {
|
|
10950
10994
|
const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
|
|
10951
10995
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
10952
|
-
throw new (0,
|
|
10996
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
|
|
10953
10997
|
}
|
|
10954
|
-
const ticketId =
|
|
10998
|
+
const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
10955
10999
|
const ticket = await fetchTicket(http, ticketId, "tickets.summary");
|
|
10956
11000
|
const desc = truncate(ticket.description, limit);
|
|
10957
11001
|
const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
|
|
@@ -10980,11 +11024,11 @@ async function summary(_resource, id, opts = {}, http) {
|
|
|
10980
11024
|
// src/resources/special/tickets/timeline.ts
|
|
10981
11025
|
function validateTimelineLimits(opts) {
|
|
10982
11026
|
const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
|
|
10983
|
-
if (!Number.isInteger(limit) || limit < 1) throw new (0,
|
|
11027
|
+
if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
10984
11028
|
const bounded = Math.min(limit, 500);
|
|
10985
11029
|
const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
|
|
10986
11030
|
if (!Number.isInteger(textLimit) || textLimit < 1) {
|
|
10987
|
-
throw new (0,
|
|
11031
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
|
|
10988
11032
|
}
|
|
10989
11033
|
return { bounded, textLimit };
|
|
10990
11034
|
}
|
|
@@ -11036,7 +11080,7 @@ function compareEventDates(a, b) {
|
|
|
11036
11080
|
}
|
|
11037
11081
|
async function timeline(_resource, id, opts = {}, http) {
|
|
11038
11082
|
const { bounded, textLimit } = validateTimelineLimits(opts);
|
|
11039
|
-
const ticketId =
|
|
11083
|
+
const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
11040
11084
|
await fetchTicket(http, ticketId, "tickets.timeline");
|
|
11041
11085
|
const dateFilters = (field) => {
|
|
11042
11086
|
const f = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -11076,7 +11120,7 @@ async function timeline(_resource, id, opts = {}, http) {
|
|
|
11076
11120
|
}
|
|
11077
11121
|
|
|
11078
11122
|
// src/resources/special/tickets/errors.ts
|
|
11079
|
-
var QueueRequiredError = class extends
|
|
11123
|
+
var QueueRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11080
11124
|
constructor(message, options = {}) {
|
|
11081
11125
|
super(message, {
|
|
11082
11126
|
code: "QUEUE_REQUIRED",
|
|
@@ -11087,13 +11131,13 @@ var QueueRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
11087
11131
|
this.name = "QueueRequiredError";
|
|
11088
11132
|
}
|
|
11089
11133
|
};
|
|
11090
|
-
var TicketResourceInvalidError = class extends
|
|
11134
|
+
var TicketResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11091
11135
|
constructor(message, options = {}) {
|
|
11092
11136
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
11093
11137
|
this.name = "TicketResourceInvalidError";
|
|
11094
11138
|
}
|
|
11095
11139
|
};
|
|
11096
|
-
var TicketCreateValidationFailedError = class extends
|
|
11140
|
+
var TicketCreateValidationFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11097
11141
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
11098
11142
|
|
|
11099
11143
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -11102,7 +11146,7 @@ var TicketCreateValidationFailedError = class extends _chunkLVBFLSPLcjs.Autotask
|
|
|
11102
11146
|
this.vendorFields = vendorFields;
|
|
11103
11147
|
}
|
|
11104
11148
|
};
|
|
11105
|
-
var StatusUnknownError = class extends
|
|
11149
|
+
var StatusUnknownError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11106
11150
|
/** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
|
|
11107
11151
|
|
|
11108
11152
|
constructor(message, options = {}) {
|
|
@@ -11116,7 +11160,7 @@ var StatusUnknownError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
11116
11160
|
this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
|
|
11117
11161
|
}
|
|
11118
11162
|
};
|
|
11119
|
-
var StatusFieldsRequiredError = class extends
|
|
11163
|
+
var StatusFieldsRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11120
11164
|
|
|
11121
11165
|
|
|
11122
11166
|
|
|
@@ -11139,21 +11183,21 @@ function isPositiveInt(v) {
|
|
|
11139
11183
|
return typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
11140
11184
|
}
|
|
11141
11185
|
function namedVendorFields(err) {
|
|
11142
|
-
if (!
|
|
11143
|
-
const entries = _nullishCoalesce(
|
|
11186
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
|
|
11187
|
+
const entries = _nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
|
|
11144
11188
|
const out = /* @__PURE__ */ new Set();
|
|
11145
11189
|
for (const e of entries) if (e.field !== void 0) out.add(e.field);
|
|
11146
11190
|
return [...out];
|
|
11147
11191
|
}
|
|
11148
11192
|
function vendorDetailOf(err) {
|
|
11149
|
-
return
|
|
11193
|
+
return _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
|
|
11150
11194
|
}
|
|
11151
11195
|
async function fetchItem(http, path, operation, readOpts) {
|
|
11152
|
-
const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
11196
|
+
const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _99 => _99.maxRetries]) });
|
|
11153
11197
|
return unwrapItemOrNull(res);
|
|
11154
11198
|
}
|
|
11155
11199
|
async function fetchItemUnredacted(http, path, operation, readOpts) {
|
|
11156
|
-
const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true, maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
11200
|
+
const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true, maxRetries: _optionalChain([readOpts, 'optionalAccess', _100 => _100.maxRetries]) });
|
|
11157
11201
|
return unwrapItemOrNull(res);
|
|
11158
11202
|
}
|
|
11159
11203
|
function unwrapItemOrNull(res) {
|
|
@@ -11167,8 +11211,8 @@ function operationId(res) {
|
|
|
11167
11211
|
return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
|
|
11168
11212
|
}
|
|
11169
11213
|
function discoveryMerge(err, body, defaults) {
|
|
11170
|
-
if (!
|
|
11171
|
-
const entries =
|
|
11214
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
11215
|
+
const entries = _chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
11172
11216
|
if (entries === void 0) return null;
|
|
11173
11217
|
for (const entry of entries) {
|
|
11174
11218
|
const field = entry.field;
|
|
@@ -11180,7 +11224,7 @@ function discoveryMerge(err, body, defaults) {
|
|
|
11180
11224
|
}
|
|
11181
11225
|
function stepErrorText(code, err) {
|
|
11182
11226
|
const detail = vendorDetailOf(err);
|
|
11183
|
-
const base =
|
|
11227
|
+
const base = _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
|
|
11184
11228
|
return detail ? `${code}: ${detail}` : `${code}: ${base}`;
|
|
11185
11229
|
}
|
|
11186
11230
|
|
|
@@ -11192,43 +11236,43 @@ var DEFAULT_PUBLISH = 1;
|
|
|
11192
11236
|
var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
|
|
11193
11237
|
var SAFE_TICKET_CREATE_DEFAULTS = {};
|
|
11194
11238
|
function validateOpenInput(params, note, assign) {
|
|
11195
|
-
const companyID =
|
|
11196
|
-
const title = _optionalChain([params, 'optionalAccess',
|
|
11239
|
+
const companyID = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _101 => _101.companyID]), "params.companyID");
|
|
11240
|
+
const title = _optionalChain([params, 'optionalAccess', _102 => _102.title]);
|
|
11197
11241
|
if (typeof title !== "string" || title.trim() === "") {
|
|
11198
|
-
throw new (0,
|
|
11242
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
|
|
11199
11243
|
}
|
|
11200
11244
|
const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
|
|
11201
11245
|
const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
|
|
11202
11246
|
if (!isPositiveInt(priority)) {
|
|
11203
|
-
throw new (0,
|
|
11247
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
|
|
11204
11248
|
}
|
|
11205
11249
|
if (!isPositiveInt(status)) {
|
|
11206
|
-
throw new (0,
|
|
11250
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
|
|
11207
11251
|
}
|
|
11208
11252
|
if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
|
|
11209
|
-
throw new (0,
|
|
11253
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
|
|
11210
11254
|
}
|
|
11211
11255
|
if (note !== void 0) {
|
|
11212
11256
|
if (typeof note.description !== "string" || note.description.trim() === "") {
|
|
11213
|
-
throw new (0,
|
|
11257
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
|
|
11214
11258
|
}
|
|
11215
11259
|
if (typeof note.title !== "string" || note.title.trim() === "") {
|
|
11216
|
-
throw new (0,
|
|
11260
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
11217
11261
|
}
|
|
11218
11262
|
if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
|
|
11219
|
-
throw new (0,
|
|
11263
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
|
|
11220
11264
|
}
|
|
11221
11265
|
if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
|
|
11222
|
-
throw new (0,
|
|
11266
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
|
|
11223
11267
|
}
|
|
11224
11268
|
}
|
|
11225
|
-
const assignee = assign === void 0 ? void 0 :
|
|
11269
|
+
const assignee = assign === void 0 ? void 0 : _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
|
|
11226
11270
|
if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
|
|
11227
|
-
throw new (0,
|
|
11271
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
|
|
11228
11272
|
}
|
|
11229
|
-
const roleID = _optionalChain([assign, 'optionalAccess',
|
|
11273
|
+
const roleID = _optionalChain([assign, 'optionalAccess', _103 => _103.roleID]);
|
|
11230
11274
|
if (assign !== void 0 && !isPositiveInt(roleID)) {
|
|
11231
|
-
throw new (0,
|
|
11275
|
+
throw new (0, _chunkHQGE4WAVcjs.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 });
|
|
11232
11276
|
}
|
|
11233
11277
|
return { companyID, title, priority, status, assignee, roleID };
|
|
11234
11278
|
}
|
|
@@ -11257,7 +11301,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
|
|
|
11257
11301
|
if (assign !== void 0) {
|
|
11258
11302
|
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).`);
|
|
11259
11303
|
}
|
|
11260
|
-
return
|
|
11304
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
11261
11305
|
{
|
|
11262
11306
|
operation: OP_OPEN,
|
|
11263
11307
|
method: "POST",
|
|
@@ -11297,8 +11341,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
|
|
|
11297
11341
|
`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}` : ""}`,
|
|
11298
11342
|
{
|
|
11299
11343
|
operation: OP_OPEN,
|
|
11300
|
-
httpStatus:
|
|
11301
|
-
vendorError:
|
|
11344
|
+
httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
11345
|
+
vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
|
|
11302
11346
|
}
|
|
11303
11347
|
);
|
|
11304
11348
|
}
|
|
@@ -11313,8 +11357,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
|
|
|
11313
11357
|
named,
|
|
11314
11358
|
{
|
|
11315
11359
|
operation: OP_OPEN,
|
|
11316
|
-
httpStatus:
|
|
11317
|
-
vendorError:
|
|
11360
|
+
httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
11361
|
+
vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
11318
11362
|
resourceIds: [companyID],
|
|
11319
11363
|
details: { idRefs: [{ entity: "company", id: companyID }] }
|
|
11320
11364
|
}
|
|
@@ -11339,10 +11383,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
|
|
|
11339
11383
|
try {
|
|
11340
11384
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
|
|
11341
11385
|
if (current === null) {
|
|
11342
|
-
throw new (0,
|
|
11386
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
|
|
11343
11387
|
}
|
|
11344
11388
|
ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
|
|
11345
|
-
const merged =
|
|
11389
|
+
const merged = _chunkHQGE4WAVcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
|
|
11346
11390
|
merged.id = ticketId;
|
|
11347
11391
|
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
|
|
11348
11392
|
assigned = true;
|
|
@@ -11406,17 +11450,17 @@ async function guardTargetStatus(resource, http, targetStatus) {
|
|
|
11406
11450
|
const ids2 = await readLiveStatusSet(resource);
|
|
11407
11451
|
if (ids2.size > 0) liveStatus = ids2;
|
|
11408
11452
|
} catch (err) {
|
|
11409
|
-
if (!
|
|
11453
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
11410
11454
|
}
|
|
11411
11455
|
if (liveStatus !== null && !liveStatus.has(targetStatus)) {
|
|
11412
|
-
_optionalChain([http, 'access',
|
|
11456
|
+
_optionalChain([http, 'access', _104 => _104.fieldCache, 'optionalAccess', _105 => _105.invalidate, 'call', _106 => _106("tickets")]);
|
|
11413
11457
|
let freshStatus = null;
|
|
11414
11458
|
let reReadFailed = false;
|
|
11415
11459
|
try {
|
|
11416
11460
|
const freshIds = await readLiveStatusSet(resource);
|
|
11417
11461
|
if (freshIds.size > 0) freshStatus = freshIds;
|
|
11418
11462
|
} catch (err) {
|
|
11419
|
-
if (!
|
|
11463
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
11420
11464
|
freshStatus = null;
|
|
11421
11465
|
reReadFailed = true;
|
|
11422
11466
|
}
|
|
@@ -11434,7 +11478,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
|
|
|
11434
11478
|
return { guardDegraded: liveStatus === null };
|
|
11435
11479
|
}
|
|
11436
11480
|
function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
|
|
11437
|
-
return
|
|
11481
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
11438
11482
|
{
|
|
11439
11483
|
operation: OP_STATUS,
|
|
11440
11484
|
method: "PUT",
|
|
@@ -11465,7 +11509,7 @@ function resolveMergeData(ticketId, targetStatus, previousStatus, current, field
|
|
|
11465
11509
|
for (const field of mapEntry.requiredFields) {
|
|
11466
11510
|
if (mergeData[field] !== void 0) continue;
|
|
11467
11511
|
if (current[field] !== null && current[field] !== void 0) continue;
|
|
11468
|
-
const safe = _optionalChain([mapEntry, 'access',
|
|
11512
|
+
const safe = _optionalChain([mapEntry, 'access', _107 => _107.safeDefaults, 'optionalAccess', _108 => _108[field]]);
|
|
11469
11513
|
if (safe === void 0) {
|
|
11470
11514
|
throw new StatusFieldsRequiredError(
|
|
11471
11515
|
`changeStatus: status ${targetStatus} requires the field '${field}' and the live-discovered map has no proven-safe default for it \u2014 the op is safe-without-the-map (never a blind full update): supply the value in fields and retry`,
|
|
@@ -11488,7 +11532,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
|
|
|
11488
11532
|
if (mapEntry === void 0) {
|
|
11489
11533
|
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).`);
|
|
11490
11534
|
}
|
|
11491
|
-
return
|
|
11535
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
11492
11536
|
{
|
|
11493
11537
|
operation: OP_STATUS,
|
|
11494
11538
|
method: "PUT",
|
|
@@ -11507,8 +11551,8 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
|
|
|
11507
11551
|
);
|
|
11508
11552
|
}
|
|
11509
11553
|
async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
|
|
11510
|
-
const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess',
|
|
11511
|
-
const body =
|
|
11554
|
+
const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _109 => _109.safeDefaults]), () => ( {}));
|
|
11555
|
+
const body = _chunkHQGE4WAVcjs.mergePartialBody.call(void 0, current, mergeData);
|
|
11512
11556
|
body.id = ticketId;
|
|
11513
11557
|
let merges = 0;
|
|
11514
11558
|
for (; ; ) {
|
|
@@ -11532,8 +11576,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
|
|
|
11532
11576
|
{ vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
|
|
11533
11577
|
{
|
|
11534
11578
|
operation: OP_STATUS,
|
|
11535
|
-
httpStatus:
|
|
11536
|
-
vendorError:
|
|
11579
|
+
httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
11580
|
+
vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
11537
11581
|
resourceIds: [ticketId],
|
|
11538
11582
|
details: { idRefs: [{ entity: "ticket", id: ticketId }] }
|
|
11539
11583
|
}
|
|
@@ -11546,7 +11590,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
|
|
|
11546
11590
|
async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
|
|
11547
11591
|
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
11548
11592
|
if (verify === null) {
|
|
11549
|
-
throw new (0,
|
|
11593
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
|
|
11550
11594
|
code: "INVALID_RESPONSE",
|
|
11551
11595
|
category: "server",
|
|
11552
11596
|
operation: OP_STATUS,
|
|
@@ -11556,7 +11600,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
|
|
|
11556
11600
|
}
|
|
11557
11601
|
const finalStatus = typeof verify.status === "number" ? verify.status : null;
|
|
11558
11602
|
if (finalStatus !== targetStatus) {
|
|
11559
|
-
throw new (0,
|
|
11603
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(
|
|
11560
11604
|
`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)`,
|
|
11561
11605
|
{
|
|
11562
11606
|
code: "INVALID_RESPONSE",
|
|
@@ -11571,17 +11615,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
|
|
|
11571
11615
|
}
|
|
11572
11616
|
}
|
|
11573
11617
|
async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
11574
|
-
const ticketId =
|
|
11618
|
+
const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
11575
11619
|
if (!isPositiveInt(targetStatus)) {
|
|
11576
|
-
throw new (0,
|
|
11620
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
|
|
11577
11621
|
}
|
|
11578
11622
|
const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
|
|
11579
11623
|
if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
|
|
11580
|
-
throw new (0,
|
|
11624
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
|
|
11581
11625
|
}
|
|
11582
11626
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
11583
11627
|
if (current === null) {
|
|
11584
|
-
throw new (0,
|
|
11628
|
+
throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
|
|
11585
11629
|
}
|
|
11586
11630
|
const previousStatus = typeof current.status === "number" ? current.status : null;
|
|
11587
11631
|
if (previousStatus === targetStatus) {
|
|
@@ -11601,7 +11645,7 @@ var DEFAULT_PART_LIMIT = 50;
|
|
|
11601
11645
|
function partLimit(value, name) {
|
|
11602
11646
|
const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
|
|
11603
11647
|
if (!Number.isInteger(n) || n < 1) {
|
|
11604
|
-
throw new (0,
|
|
11648
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
11605
11649
|
}
|
|
11606
11650
|
return n;
|
|
11607
11651
|
}
|
|
@@ -11614,7 +11658,7 @@ function servedTextRecord(row, textField, limit) {
|
|
|
11614
11658
|
return out;
|
|
11615
11659
|
}
|
|
11616
11660
|
async function addCompositeNames(http, ctx, entriesPart, result, opts) {
|
|
11617
|
-
const builder =
|
|
11661
|
+
const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS);
|
|
11618
11662
|
const t = ctx.ticket;
|
|
11619
11663
|
builder.addResource(t["creatorResourceID"]);
|
|
11620
11664
|
builder.addFk("contract", t["contractID"]);
|
|
@@ -11626,20 +11670,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
|
|
|
11626
11670
|
builder.addFk("billingCode", e["billingCodeID"]);
|
|
11627
11671
|
builder.addFk("contract", e["contractID"]);
|
|
11628
11672
|
}
|
|
11629
|
-
const names = await
|
|
11673
|
+
const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
11630
11674
|
const ticketRow = { ...ctx.ticket };
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
for (const f of
|
|
11675
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
|
|
11676
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
|
|
11677
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11678
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
11679
|
+
for (const f of _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS) _chunkHQGE4WAVcjs.addLabelSibling.call(void 0, ticketRow, f, names);
|
|
11636
11680
|
result.ticket = ticketRow;
|
|
11637
11681
|
result.timeEntries.items = entriesPart.items.map((e) => {
|
|
11638
11682
|
const row = { ...e };
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11683
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
|
|
11684
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
|
|
11685
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11686
|
+
_chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
11643
11687
|
return row;
|
|
11644
11688
|
});
|
|
11645
11689
|
result.names = names.section;
|
|
@@ -11649,7 +11693,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11649
11693
|
const noteLimit = partLimit(opts.noteLimit, "noteLimit");
|
|
11650
11694
|
const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
|
|
11651
11695
|
const textLimit = partLimit(opts.textLimit, "textLimit");
|
|
11652
|
-
const ticketId =
|
|
11696
|
+
const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
11653
11697
|
const ctx = await resource.getContext(ticketId);
|
|
11654
11698
|
const op = "tickets.fullContext";
|
|
11655
11699
|
const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -11707,7 +11751,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11707
11751
|
}
|
|
11708
11752
|
|
|
11709
11753
|
// src/resources/tickets.ts
|
|
11710
|
-
var TicketsResource = class extends
|
|
11754
|
+
var TicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
11711
11755
|
constructor(http, pageSize) {
|
|
11712
11756
|
super(http, {
|
|
11713
11757
|
key: "tickets",
|
|
@@ -11814,7 +11858,7 @@ var TicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
11814
11858
|
};
|
|
11815
11859
|
|
|
11816
11860
|
// src/resources/ticket_webhooks.ts
|
|
11817
|
-
var TicketWebhooksResource = class extends
|
|
11861
|
+
var TicketWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
11818
11862
|
constructor(http, pageSize) {
|
|
11819
11863
|
super(http, {
|
|
11820
11864
|
key: "ticket_webhooks",
|
|
@@ -11885,7 +11929,7 @@ var TicketWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
11885
11929
|
/** Search TicketWebhook records: bounded contains on name (no vendor free-text search exists);
|
|
11886
11930
|
* limit defaults to 25, max 500. */
|
|
11887
11931
|
async search(query, opts) {
|
|
11888
|
-
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess',
|
|
11932
|
+
return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _110 => _110.limit]) });
|
|
11889
11933
|
}
|
|
11890
11934
|
};
|
|
11891
11935
|
|
|
@@ -11900,62 +11944,62 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
|
|
|
11900
11944
|
body: { MaxRecords: limit, filter },
|
|
11901
11945
|
operation
|
|
11902
11946
|
});
|
|
11903
|
-
const { items, pageDetails } =
|
|
11947
|
+
const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res);
|
|
11904
11948
|
return { items, hasMore: pageDetails.nextPageUrl != null };
|
|
11905
11949
|
}
|
|
11906
11950
|
async function windowQuery3(_resource, kind, http, opts) {
|
|
11907
|
-
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
11908
|
-
const tz = _optionalChain([opts, 'optionalAccess',
|
|
11951
|
+
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _111 => _111.now]), () => ( /* @__PURE__ */ new Date()));
|
|
11952
|
+
const tz = _optionalChain([opts, 'optionalAccess', _112 => _112.tz]) === void 0 ? void 0 : validateZone(opts.tz, `time_entries.${kind}`);
|
|
11909
11953
|
const { from, to } = dateOnlyWindowBounds(kind, now, tz);
|
|
11910
11954
|
const filter = [
|
|
11911
11955
|
{ field: "dateWorked", op: "gte", value: from },
|
|
11912
11956
|
{ field: "dateWorked", op: "lte", value: to }
|
|
11913
11957
|
];
|
|
11914
|
-
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
11958
|
+
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _113 => _113.limit])), `time_entries.${kind}`, http);
|
|
11915
11959
|
return items;
|
|
11916
11960
|
}
|
|
11917
11961
|
async function customRange3(_resource, from, to, http, opts) {
|
|
11918
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11962
|
+
if (_optionalChain([opts, 'optionalAccess', _114 => _114.tz]) !== void 0) validateZone(opts.tz, "time_entries.customRange");
|
|
11919
11963
|
const fromB = customRangeDay(from, "from", void 0, "customRange");
|
|
11920
11964
|
const toB = customRangeDay(to, "to", void 0, "customRange");
|
|
11921
11965
|
if (fromB.ms > toB.ms) {
|
|
11922
|
-
throw new (0,
|
|
11966
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("customRange: from must not be after to");
|
|
11923
11967
|
}
|
|
11924
11968
|
const toEndMs = toB.ms + DAY_MS2 - 1;
|
|
11925
11969
|
const filter = [
|
|
11926
11970
|
{ field: "dateWorked", op: "gte", value: iso2(fromB.ms) },
|
|
11927
11971
|
{ field: "dateWorked", op: "lte", value: iso2(toEndMs) }
|
|
11928
11972
|
];
|
|
11929
|
-
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
11973
|
+
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _115 => _115.limit])), "time_entries.customRange", http);
|
|
11930
11974
|
return items;
|
|
11931
11975
|
}
|
|
11932
11976
|
async function postedDateStatusQuery(_resource, mode, http, opts) {
|
|
11933
11977
|
const filter = [
|
|
11934
11978
|
{ field: "postedDate", op: mode === "posted" ? "exist" : "notExist" }
|
|
11935
11979
|
];
|
|
11936
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11980
|
+
if (_optionalChain([opts, 'optionalAccess', _116 => _116.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
|
|
11937
11981
|
const operation = mode === "posted" ? "time_entries.getPosted" : "time_entries.getUnposted";
|
|
11938
|
-
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
11982
|
+
const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _117 => _117.limit])), operation, http);
|
|
11939
11983
|
return items;
|
|
11940
11984
|
}
|
|
11941
11985
|
async function postedWithin(_resource, from, to, http, opts, opLabel = "time_entries.postedWithin") {
|
|
11942
11986
|
const OP6 = opLabel;
|
|
11943
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11987
|
+
if (_optionalChain([opts, 'optionalAccess', _118 => _118.tz]) !== void 0) validateZone(opts.tz, OP6);
|
|
11944
11988
|
const fromB = customRangeDay(from, "from", void 0, OP6);
|
|
11945
11989
|
const toB = customRangeDay(to, "to", void 0, OP6);
|
|
11946
11990
|
if (fromB.ms > toB.ms) {
|
|
11947
|
-
throw new (0,
|
|
11991
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP6}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP6 });
|
|
11948
11992
|
}
|
|
11949
11993
|
const windowToMs = toB.ms + DAY_MS2 - 1;
|
|
11950
11994
|
const filter = [
|
|
11951
11995
|
{ field: "dateWorked", op: "gte", value: iso2(fromB.ms) },
|
|
11952
11996
|
{ field: "dateWorked", op: "lte", value: iso2(windowToMs) }
|
|
11953
11997
|
];
|
|
11954
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11955
|
-
else if (_optionalChain([opts, 'optionalAccess',
|
|
11956
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11957
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
11958
|
-
const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess',
|
|
11998
|
+
if (_optionalChain([opts, 'optionalAccess', _119 => _119.posted]) === true) filter.push({ field: "postedDate", op: "exist" });
|
|
11999
|
+
else if (_optionalChain([opts, 'optionalAccess', _120 => _120.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
|
|
12000
|
+
if (_optionalChain([opts, 'optionalAccess', _121 => _121.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
|
|
12001
|
+
if (_optionalChain([opts, 'optionalAccess', _122 => _122.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
|
|
12002
|
+
const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _123 => _123.limit])), OP6, http);
|
|
11959
12003
|
let postedCount = 0;
|
|
11960
12004
|
for (const item of items) {
|
|
11961
12005
|
const postedDate = item.postedDate;
|
|
@@ -11978,13 +12022,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
|
|
|
11978
12022
|
}
|
|
11979
12023
|
|
|
11980
12024
|
// src/resources/special/time_entries/errors.ts
|
|
11981
|
-
var ResourceInvalidError = class extends
|
|
12025
|
+
var ResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11982
12026
|
constructor(message, options = {}) {
|
|
11983
12027
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
11984
12028
|
this.name = "ResourceInvalidError";
|
|
11985
12029
|
}
|
|
11986
12030
|
};
|
|
11987
|
-
var AllocationCodeError = class extends
|
|
12031
|
+
var AllocationCodeError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11988
12032
|
/** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
|
|
11989
12033
|
|
|
11990
12034
|
constructor(kind, message, options = {}) {
|
|
@@ -11993,7 +12037,7 @@ var AllocationCodeError = class extends _chunkLVBFLSPLcjs.AutotaskError {
|
|
|
11993
12037
|
this.kind = kind;
|
|
11994
12038
|
}
|
|
11995
12039
|
};
|
|
11996
|
-
var NoApplicableAllocationCodeError = class extends
|
|
12040
|
+
var NoApplicableAllocationCodeError = class extends _chunkHQGE4WAVcjs.AutotaskError {
|
|
11997
12041
|
/** The structured blocker details (filters tried + department sets). */
|
|
11998
12042
|
|
|
11999
12043
|
constructor(details, options = {}) {
|
|
@@ -12058,7 +12102,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
12058
12102
|
let pages = 0;
|
|
12059
12103
|
for (; ; ) {
|
|
12060
12104
|
if (pages >= PAGE_GUARD) {
|
|
12061
|
-
throw new (0,
|
|
12105
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
|
|
12062
12106
|
code: "RESOLUTION_TRUNCATED",
|
|
12063
12107
|
category: "resolution",
|
|
12064
12108
|
operation,
|
|
@@ -12069,11 +12113,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
12069
12113
|
const res = await http.request({
|
|
12070
12114
|
method: "POST",
|
|
12071
12115
|
idempotent: true,
|
|
12072
|
-
path: isFirst ? path :
|
|
12116
|
+
path: isFirst ? path : _chunkHQGE4WAVcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
|
|
12073
12117
|
body: { MaxRecords: pageSize, filter },
|
|
12074
12118
|
operation
|
|
12075
12119
|
});
|
|
12076
|
-
const { items: pageItems, pageDetails } =
|
|
12120
|
+
const { items: pageItems, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
|
|
12077
12121
|
items.push(...pageItems);
|
|
12078
12122
|
pages += 1;
|
|
12079
12123
|
if (items.length >= totalCap) break;
|
|
@@ -12190,7 +12234,7 @@ function windowDefaults(params) {
|
|
|
12190
12234
|
var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
|
|
12191
12235
|
var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
|
|
12192
12236
|
function validateCreateParams(params) {
|
|
12193
|
-
const pin = (value, label) => typeof value === "number" ?
|
|
12237
|
+
const pin = (value, label) => typeof value === "number" ? _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, value, label) : void 0;
|
|
12194
12238
|
const pins = {
|
|
12195
12239
|
code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
|
|
12196
12240
|
ticket: pin(params.ticketID, "ticketID"),
|
|
@@ -12199,19 +12243,19 @@ function validateCreateParams(params) {
|
|
|
12199
12243
|
};
|
|
12200
12244
|
const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
|
|
12201
12245
|
if (pinCount > 1) {
|
|
12202
|
-
throw new (0,
|
|
12246
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
12203
12247
|
"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)",
|
|
12204
12248
|
{ operation: OP3 }
|
|
12205
12249
|
);
|
|
12206
12250
|
}
|
|
12207
12251
|
if (pins.role !== void 0 && pins.code !== void 0) {
|
|
12208
|
-
throw new (0,
|
|
12252
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
12209
12253
|
"createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
|
|
12210
12254
|
{ operation: OP3 }
|
|
12211
12255
|
);
|
|
12212
12256
|
}
|
|
12213
12257
|
if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
|
|
12214
|
-
throw new (0,
|
|
12258
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
|
|
12215
12259
|
`createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
|
|
12216
12260
|
{ operation: OP3 }
|
|
12217
12261
|
);
|
|
@@ -12294,7 +12338,7 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
|
|
|
12294
12338
|
if (usedLinkage === "internal" && linkage === "task") {
|
|
12295
12339
|
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).");
|
|
12296
12340
|
}
|
|
12297
|
-
return
|
|
12341
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
|
|
12298
12342
|
{
|
|
12299
12343
|
operation: OP3,
|
|
12300
12344
|
method: "POST",
|
|
@@ -12334,7 +12378,7 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
|
|
|
12334
12378
|
};
|
|
12335
12379
|
} catch (err) {
|
|
12336
12380
|
lastError = err;
|
|
12337
|
-
const text =
|
|
12381
|
+
const text = _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
|
|
12338
12382
|
const gate3 = ROLE_REJECTION_PATTERN.test(text);
|
|
12339
12383
|
if (usedLinkage !== "internal" && gate3) {
|
|
12340
12384
|
if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
|
|
@@ -12354,13 +12398,13 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
|
|
|
12354
12398
|
throw err;
|
|
12355
12399
|
}
|
|
12356
12400
|
}
|
|
12357
|
-
if (
|
|
12401
|
+
if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, lastError)) {
|
|
12358
12402
|
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.`;
|
|
12359
12403
|
}
|
|
12360
12404
|
throw lastError;
|
|
12361
12405
|
}
|
|
12362
12406
|
async function createForResource(resource, resourceID, params, opts = {}, http) {
|
|
12363
|
-
const rid =
|
|
12407
|
+
const rid = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
|
|
12364
12408
|
const pins = validateCreateParams(params);
|
|
12365
12409
|
await assertResourceActive(http, rid);
|
|
12366
12410
|
const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
|
|
@@ -12373,8 +12417,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
12373
12417
|
return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
|
|
12374
12418
|
}
|
|
12375
12419
|
function discoveryField(err, body, defaults) {
|
|
12376
|
-
if (!
|
|
12377
|
-
const entries =
|
|
12420
|
+
if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
12421
|
+
const entries = _chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
12378
12422
|
if (entries === void 0) return null;
|
|
12379
12423
|
for (const entry of entries) {
|
|
12380
12424
|
const field = entry.field;
|
|
@@ -12393,9 +12437,9 @@ var CONTRACT_SCOPED2 = ["contractID", "contractServiceID", "contractServiceBundl
|
|
|
12393
12437
|
async function readTimeEntry(http, id, retries) {
|
|
12394
12438
|
try {
|
|
12395
12439
|
const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP4, maxRetries: retries });
|
|
12396
|
-
return _nullishCoalesce(_optionalChain([res, 'optionalAccess',
|
|
12440
|
+
return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _124 => _124.item]), () => ( null));
|
|
12397
12441
|
} catch (e) {
|
|
12398
|
-
if (
|
|
12442
|
+
if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
|
|
12399
12443
|
throw e;
|
|
12400
12444
|
}
|
|
12401
12445
|
}
|
|
@@ -12464,13 +12508,13 @@ var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResource
|
|
|
12464
12508
|
function positiveId(value, name) {
|
|
12465
12509
|
const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
|
|
12466
12510
|
if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
|
|
12467
|
-
throw new (0,
|
|
12511
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
|
|
12468
12512
|
}
|
|
12469
12513
|
return n;
|
|
12470
12514
|
}
|
|
12471
12515
|
async function recentTickets(_resource, from, to, http, opts) {
|
|
12472
12516
|
if (opts === void 0 || opts === null || typeof opts !== "object") {
|
|
12473
|
-
throw new (0,
|
|
12517
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP5 });
|
|
12474
12518
|
}
|
|
12475
12519
|
const resourceID = positiveId(opts.resourceID, "resourceID");
|
|
12476
12520
|
const companyID = opts.companyID === void 0 ? void 0 : positiveId(opts.companyID, "companyID");
|
|
@@ -12478,7 +12522,7 @@ async function recentTickets(_resource, from, to, http, opts) {
|
|
|
12478
12522
|
const fromB = customRangeDay(from, "from", void 0, OP5);
|
|
12479
12523
|
const toB = customRangeDay(to, "to", void 0, OP5);
|
|
12480
12524
|
if (fromB.ms > toB.ms) {
|
|
12481
|
-
throw new (0,
|
|
12525
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP5 });
|
|
12482
12526
|
}
|
|
12483
12527
|
const windowToMs = toB.ms + DAY_MS3 - 1;
|
|
12484
12528
|
const { items: entries, hasMore } = await queryTimeEntries(
|
|
@@ -12517,7 +12561,7 @@ async function recentTickets(_resource, from, to, http, opts) {
|
|
|
12517
12561
|
body: { MaxRecords: TICKET_CHUNK, filter, IncludeFields: TICKET_FIELDS2 },
|
|
12518
12562
|
operation: OP5
|
|
12519
12563
|
});
|
|
12520
|
-
for (const t of
|
|
12564
|
+
for (const t of _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, OP5).items) if (typeof t.id === "number") tickets.set(t.id, t);
|
|
12521
12565
|
}
|
|
12522
12566
|
const items = [];
|
|
12523
12567
|
const unresolvedTicketIDs = [];
|
|
@@ -12525,17 +12569,17 @@ async function recentTickets(_resource, from, to, http, opts) {
|
|
|
12525
12569
|
for (const [ticketID, g] of groups) {
|
|
12526
12570
|
const t = tickets.get(ticketID);
|
|
12527
12571
|
if (t === void 0) unresolvedTicketIDs.push(ticketID);
|
|
12528
|
-
if (companyID !== void 0 && _optionalChain([t, 'optionalAccess',
|
|
12572
|
+
if (companyID !== void 0 && _optionalChain([t, 'optionalAccess', _125 => _125.companyID]) !== companyID) {
|
|
12529
12573
|
if (t !== void 0) excludedTickets += 1;
|
|
12530
12574
|
continue;
|
|
12531
12575
|
}
|
|
12532
12576
|
items.push({
|
|
12533
12577
|
ticketID,
|
|
12534
|
-
..._optionalChain([t, 'optionalAccess',
|
|
12535
|
-
..._optionalChain([t, 'optionalAccess',
|
|
12536
|
-
..._optionalChain([t, 'optionalAccess',
|
|
12537
|
-
..._optionalChain([t, 'optionalAccess',
|
|
12538
|
-
..._optionalChain([t, 'optionalAccess',
|
|
12578
|
+
..._optionalChain([t, 'optionalAccess', _126 => _126.ticketNumber]) !== void 0 ? { ticketNumber: t.ticketNumber } : {},
|
|
12579
|
+
..._optionalChain([t, 'optionalAccess', _127 => _127.title]) !== void 0 ? { title: t.title } : {},
|
|
12580
|
+
..._optionalChain([t, 'optionalAccess', _128 => _128.status]) !== void 0 ? { status: t.status } : {},
|
|
12581
|
+
..._optionalChain([t, 'optionalAccess', _129 => _129.assignedResourceID]) !== void 0 ? { assignedResourceID: t.assignedResourceID } : {},
|
|
12582
|
+
..._optionalChain([t, 'optionalAccess', _130 => _130.companyID]) !== void 0 ? { companyID: t.companyID } : {},
|
|
12539
12583
|
entryCount: g.entryCount,
|
|
12540
12584
|
totalHours: Math.round(g.totalHours * 100) / 100,
|
|
12541
12585
|
lastWorked: g.lastWorked
|
|
@@ -12554,7 +12598,7 @@ async function recentTickets(_resource, from, to, http, opts) {
|
|
|
12554
12598
|
}
|
|
12555
12599
|
|
|
12556
12600
|
// src/resources/time_entries.ts
|
|
12557
|
-
var TimeEntriesResource = class extends
|
|
12601
|
+
var TimeEntriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
12558
12602
|
constructor(http, pageSize) {
|
|
12559
12603
|
super(http, {
|
|
12560
12604
|
key: "time_entries",
|
|
@@ -12699,7 +12743,7 @@ var TimeEntriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
|
|
|
12699
12743
|
};
|
|
12700
12744
|
|
|
12701
12745
|
// src/resources/time_entry_attachments.ts
|
|
12702
|
-
var TimeEntryAttachmentsResource = class extends
|
|
12746
|
+
var TimeEntryAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
12703
12747
|
constructor(http, pageSize) {
|
|
12704
12748
|
super(http, {
|
|
12705
12749
|
key: "time_entry_attachments",
|
|
@@ -12762,9 +12806,9 @@ var TimeEntryAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource
|
|
|
12762
12806
|
|
|
12763
12807
|
// src/resources/special/time_off_requests.ts
|
|
12764
12808
|
async function approve(_resource, id, opts = {}, http) {
|
|
12765
|
-
const numericId =
|
|
12809
|
+
const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
12766
12810
|
if (opts.dryRun === true) {
|
|
12767
|
-
return
|
|
12811
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
12768
12812
|
operation: "time_off_requests.approve",
|
|
12769
12813
|
method: "GET",
|
|
12770
12814
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
@@ -12780,16 +12824,16 @@ async function approve(_resource, id, opts = {}, http) {
|
|
|
12780
12824
|
operation: "time_off_requests.approve",
|
|
12781
12825
|
maxRetries: opts.maxRetries
|
|
12782
12826
|
});
|
|
12783
|
-
return
|
|
12827
|
+
return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
|
|
12784
12828
|
}
|
|
12785
12829
|
async function reject(_resource, id, reason, opts = {}, http) {
|
|
12786
|
-
const numericId =
|
|
12830
|
+
const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
|
|
12787
12831
|
const text = reason.trim();
|
|
12788
12832
|
if (text === "") {
|
|
12789
|
-
throw new (0,
|
|
12833
|
+
throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
|
|
12790
12834
|
}
|
|
12791
12835
|
if (opts.dryRun === true) {
|
|
12792
|
-
return
|
|
12836
|
+
return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
|
|
12793
12837
|
operation: "time_off_requests.reject",
|
|
12794
12838
|
method: "POST",
|
|
12795
12839
|
path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
|
|
@@ -12807,11 +12851,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
|
|
|
12807
12851
|
operation: "time_off_requests.reject",
|
|
12808
12852
|
maxRetries: opts.maxRetries
|
|
12809
12853
|
});
|
|
12810
|
-
return
|
|
12854
|
+
return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
|
|
12811
12855
|
}
|
|
12812
12856
|
|
|
12813
12857
|
// src/resources/time_off_requests.ts
|
|
12814
|
-
var TimeOffRequestsResource = class extends
|
|
12858
|
+
var TimeOffRequestsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
|
|
12815
12859
|
constructor(http, pageSize) {
|
|
12816
12860
|
super(http, {
|
|
12817
12861
|
key: "time_off_requests",
|
|
@@ -13046,4 +13090,5 @@ var ZoneInformationResource = class {
|
|
|
13046
13090
|
|
|
13047
13091
|
|
|
13048
13092
|
|
|
13049
|
-
|
|
13093
|
+
|
|
13094
|
+
exports.AppointmentsResource = AppointmentsResource; exports.AuthenticateResource = AuthenticateResource; exports.BillingCodesResource = BillingCodesResource; exports.BillingItemsResource = BillingItemsResource; exports.ChangeRequestLinksResource = ChangeRequestLinksResource; exports.ChecklistLibrariesResource = ChecklistLibrariesResource; exports.ChecklistLibraryChecklistItemsResource = ChecklistLibraryChecklistItemsResource; exports.ClassificationIconsResource = ClassificationIconsResource; exports.CompaniesResource = CompaniesResource; exports.CompanyAlertsResource = CompanyAlertsResource; exports.CompanyLocationsResource = CompanyLocationsResource; exports.CompanyNotesResource = CompanyNotesResource; exports.CompanySiteConfigurationsResource = CompanySiteConfigurationsResource; exports.CompanyWebhooksResource = CompanyWebhooksResource; exports.ConfigurationItemBillingProductAssociationsResource = ConfigurationItemBillingProductAssociationsResource; exports.ConfigurationItemCategoriesResource = ConfigurationItemCategoriesResource; exports.ConfigurationItemCategoryUdfAssociationsResource = ConfigurationItemCategoryUdfAssociationsResource; exports.ConfigurationItemDnsRecordsResource = ConfigurationItemDnsRecordsResource; exports.ConfigurationItemNotesResource = ConfigurationItemNotesResource; exports.ConfigurationItemRelatedItemsResource = ConfigurationItemRelatedItemsResource; exports.ConfigurationItemsResource = ConfigurationItemsResource; exports.ConfigurationItemSslSubjectAlternativeNamesResource = ConfigurationItemSslSubjectAlternativeNamesResource; exports.ConfigurationItemTypesResource = ConfigurationItemTypesResource; exports.ConfigurationItemWebhooksResource = ConfigurationItemWebhooksResource; exports.ContactGroupContactsResource = ContactGroupContactsResource; exports.ContactGroupsResource = ContactGroupsResource; exports.ContactsResource = ContactsResource; exports.ContactWebhooksResource = ContactWebhooksResource; exports.ContractBillingRulesResource = ContractBillingRulesResource; exports.ContractBlockHourFactorsResource = ContractBlockHourFactorsResource; exports.ContractBlocksResource = ContractBlocksResource; exports.ContractChargesResource = ContractChargesResource; exports.ContractExclusionBillingCodesResource = ContractExclusionBillingCodesResource; exports.ContractExclusionRolesResource = ContractExclusionRolesResource; exports.ContractExclusionSetExcludedRolesResource = ContractExclusionSetExcludedRolesResource; exports.ContractExclusionSetExcludedWorkTypesResource = ContractExclusionSetExcludedWorkTypesResource; exports.ContractExclusionSetsResource = ContractExclusionSetsResource; exports.ContractMilestonesResource = ContractMilestonesResource; exports.ContractNotesResource = ContractNotesResource; exports.ContractRatesResource = ContractRatesResource; exports.ContractRetainersResource = ContractRetainersResource; exports.ContractRoleCostsResource = ContractRoleCostsResource; exports.ContractServiceAdjustmentsResource = ContractServiceAdjustmentsResource; exports.ContractServiceBundleAdjustmentsResource = ContractServiceBundleAdjustmentsResource; exports.ContractServiceBundlesResource = ContractServiceBundlesResource; exports.ContractServiceBundleUnitsResource = ContractServiceBundleUnitsResource; exports.ContractServicesResource = ContractServicesResource; exports.ContractServiceUnitsResource = ContractServiceUnitsResource; exports.ContractsResource = ContractsResource; exports.ContractTicketPurchasesResource = ContractTicketPurchasesResource; exports.CountriesResource = CountriesResource; exports.CurrenciesResource = CurrenciesResource; exports.DepartmentsResource = DepartmentsResource; exports.DomainRegistrarsResource = DomainRegistrarsResource; exports.EntityInformationResource = EntityInformationResource; exports.ExpenseItemAttachmentsResource = ExpenseItemAttachmentsResource; exports.ExpenseItemsResource = ExpenseItemsResource; exports.ExpenseReportsResource = ExpenseReportsResource; exports.HolidaySetsResource = HolidaySetsResource; exports.HolidaysResource = HolidaysResource; exports.InventoryProductsResource = InventoryProductsResource; exports.InvoicesResource = InvoicesResource; exports.ModulesResource = ModulesResource; exports.NotificationHistoryResource = NotificationHistoryResource; exports.OpportunitiesResource = OpportunitiesResource; exports.OpportunityAttachmentsResource = OpportunityAttachmentsResource; exports.OpportunityCategoriesResource = OpportunityCategoriesResource; exports.PhasesResource = PhasesResource; exports.ProductsResource = ProductsResource; exports.ProductVendorsResource = ProductVendorsResource; exports.ProjectChargesResource = ProjectChargesResource; exports.ProjectNotesResource = ProjectNotesResource; exports.ProjectsResource = ProjectsResource; exports.PurchaseApprovalsResource = PurchaseApprovalsResource; exports.PurchaseOrderItemReceivingResource = PurchaseOrderItemReceivingResource; exports.PurchaseOrderItemsResource = PurchaseOrderItemsResource; exports.PurchaseOrdersResource = PurchaseOrdersResource; exports.QuoteItemsResource = QuoteItemsResource; exports.QuoteLocationsResource = QuoteLocationsResource; exports.QuotesResource = QuotesResource; exports.QuoteTemplatesResource = QuoteTemplatesResource; exports.ResourceRoleQueuesResource = ResourceRoleQueuesResource; exports.ResourceRolesResource = ResourceRolesResource; exports.ResourceSkillsResource = ResourceSkillsResource; exports.ResourcesResource = ResourcesResource; exports.ResourceTimeOffAdditionalResource = ResourceTimeOffAdditionalResource; exports.ResourceTimeOffApproversResource = ResourceTimeOffApproversResource; exports.ResourceTimeOffBalancesResource = ResourceTimeOffBalancesResource; exports.RolesResource = RolesResource; exports.ServiceCallsResource = ServiceCallsResource; exports.ServiceCallTaskResourcesResource = ServiceCallTaskResourcesResource; exports.ServiceCallTasksResource = ServiceCallTasksResource; exports.ServiceCallTicketResourcesResource = ServiceCallTicketResourcesResource; exports.ServiceCallTicketsResource = ServiceCallTicketsResource; exports.ServiceLevelAgreementResultsResource = ServiceLevelAgreementResultsResource; exports.ServicesResource = ServicesResource; exports.SkillsResource = SkillsResource; exports.SubscriptionPeriodsResource = SubscriptionPeriodsResource; exports.SubscriptionsResource = SubscriptionsResource; exports.SurveyResultsResource = SurveyResultsResource; exports.SurveysResource = SurveysResource; exports.TagAliasesResource = TagAliasesResource; exports.TagGroupsResource = TagGroupsResource; exports.TagsResource = TagsResource; exports.TaskSecondaryResourcesResource = TaskSecondaryResourcesResource; exports.TasksResource = TasksResource; exports.ThresholdInformationResource = ThresholdInformationResource; exports.TicketAdditionalConfigurationItemsResource = TicketAdditionalConfigurationItemsResource; exports.TicketAdditionalContactsResource = TicketAdditionalContactsResource; exports.TicketAttachmentsResource = TicketAttachmentsResource; exports.TicketCategoriesResource = TicketCategoriesResource; exports.TicketCategoryFieldDefaultsResource = TicketCategoryFieldDefaultsResource; exports.TicketChangeRequestApprovalsResource = TicketChangeRequestApprovalsResource; exports.TicketChargesResource = TicketChargesResource; exports.TicketChecklistItemsResource = TicketChecklistItemsResource; exports.TicketChecklistLibrariesResource = TicketChecklistLibrariesResource; exports.TicketHistoryResource = TicketHistoryResource; exports.TicketNoteAttachmentsResource = TicketNoteAttachmentsResource; exports.TicketNotesResource = TicketNotesResource; exports.TicketNoteWebhooksResource = TicketNoteWebhooksResource; exports.TicketSecondaryResourcesResource = TicketSecondaryResourcesResource; exports.TicketsResource = TicketsResource; exports.TicketWebhooksResource = TicketWebhooksResource; exports.TimeEntriesResource = TimeEntriesResource; exports.TimeEntryAttachmentsResource = TimeEntryAttachmentsResource; exports.TimeOffRequestsResource = TimeOffRequestsResource; exports.VersionInformationResource = VersionInformationResource; exports.VersionResource = VersionResource; exports.ZoneInformationResource = ZoneInformationResource;
|