node-autotask 0.17.0 → 0.18.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/ARCHITECTURE.md +10 -4
- package/MCP_TOOL_CATALOG.json +2 -2
- package/MCP_TOOL_MANIFEST.md +4 -4
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +1571 -1571
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-5ZGXWS4E.cjs → chunk-5O5EPYBO.cjs} +1570 -1570
- package/dist/{chunk-NQVD2XLH.cjs → chunk-7I3F3AJJ.cjs} +393 -393
- package/dist/{chunk-DQIZUZWP.cjs → chunk-G564CHXM.cjs} +135 -135
- package/dist/{chunk-EGR2ZLYM.js → chunk-HXOWEYV3.js} +2 -2
- package/dist/{chunk-6SP6GJJR.js → chunk-VV2UUW2J.js} +1570 -1570
- package/dist/{chunk-HC6YWPIY.js → chunk-VYUZZIEE.js} +31 -17
- package/dist/{chunk-UV2PECAL.js → chunk-W2WSZOZA.js} +2 -2
- package/dist/{chunk-4RJG73GY.cjs → chunk-WRWX6WIK.cjs} +33 -19
- package/dist/{index-BAFdPxjG.d.ts → index-BqPY04ZG.d.ts} +34 -10
- package/dist/{index-CjC0oWZX.d.cts → index-D7x3MkLK.d.cts} +34 -10
- package/dist/index.cjs +24 -22
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -4
- package/dist/operations/index.cjs +178 -105
- package/dist/operations/index.d.cts +12 -3
- package/dist/operations/index.d.ts +12 -3
- package/dist/operations/index.js +77 -4
- package/dist/pool.cjs +8 -8
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/docs/API.md +44 -8
- package/package.json +3 -2
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkWRWX6WIKcjs = require('./chunk-WRWX6WIK.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunk5O5EPYBOcjs = require('./chunk-5O5EPYBO.cjs');
|
|
41
41
|
|
|
42
42
|
// src/resources/appointments.ts
|
|
43
|
-
var AppointmentsResource = class extends
|
|
43
|
+
var AppointmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
44
44
|
constructor(http, pageSize) {
|
|
45
45
|
super(http, {
|
|
46
46
|
key: "appointments",
|
|
@@ -125,7 +125,7 @@ var AuthenticateResource = class {
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
// src/resources/billing_codes.ts
|
|
128
|
-
var BillingCodesResource = class extends
|
|
128
|
+
var BillingCodesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
129
129
|
constructor(http, pageSize) {
|
|
130
130
|
super(http, {
|
|
131
131
|
key: "billing_codes",
|
|
@@ -175,7 +175,7 @@ var MAX_LIMIT = 500;
|
|
|
175
175
|
function clampWindowLimit(limit) {
|
|
176
176
|
const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
|
|
177
177
|
if (!Number.isInteger(n) || n < 1) {
|
|
178
|
-
throw new (0,
|
|
178
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
179
179
|
}
|
|
180
180
|
return Math.min(n, MAX_LIMIT);
|
|
181
181
|
}
|
|
@@ -221,7 +221,7 @@ function wallParts(tz, ms) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
|
|
224
|
-
throw new (0,
|
|
224
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
|
|
225
225
|
}
|
|
226
226
|
return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
|
|
227
227
|
}
|
|
@@ -248,7 +248,7 @@ function localDayEndMs(y, m, d, tz) {
|
|
|
248
248
|
}
|
|
249
249
|
function validateZone(tz, opName = "dateWindow") {
|
|
250
250
|
if (typeof tz !== "string" || tz.length === 0) {
|
|
251
|
-
throw new (0,
|
|
251
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
252
252
|
`${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
253
253
|
{ operation: opName }
|
|
254
254
|
);
|
|
@@ -256,7 +256,7 @@ function validateZone(tz, opName = "dateWindow") {
|
|
|
256
256
|
try {
|
|
257
257
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
258
258
|
} catch (e2) {
|
|
259
|
-
throw new (0,
|
|
259
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
260
260
|
`${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
261
261
|
{ operation: opName }
|
|
262
262
|
);
|
|
@@ -408,13 +408,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
|
|
|
408
408
|
body: { MaxRecords: limit, filter },
|
|
409
409
|
operation
|
|
410
410
|
});
|
|
411
|
-
return
|
|
411
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
412
412
|
}
|
|
413
413
|
var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
|
|
414
414
|
function customRangeDay(value, label, zone, opName) {
|
|
415
415
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
|
|
416
416
|
if (!m) {
|
|
417
|
-
throw new (0,
|
|
417
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
418
418
|
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)})`,
|
|
419
419
|
{ operation: opName }
|
|
420
420
|
);
|
|
@@ -426,7 +426,7 @@ function customRangeDay(value, label, zone, opName) {
|
|
|
426
426
|
const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
|
|
427
427
|
const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
|
|
428
428
|
if (!Number.isFinite(ms)) {
|
|
429
|
-
throw new (0,
|
|
429
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
430
430
|
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)})`,
|
|
431
431
|
{ operation: opName }
|
|
432
432
|
);
|
|
@@ -437,7 +437,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
437
437
|
const fromB = customRangeDay(from, "from", zone, operation);
|
|
438
438
|
const toB = customRangeDay(to, "to", zone, operation);
|
|
439
439
|
if (fromB.ms > toB.ms) {
|
|
440
|
-
throw new (0,
|
|
440
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
441
441
|
`${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
|
|
442
442
|
{ operation }
|
|
443
443
|
);
|
|
@@ -454,7 +454,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
454
454
|
body: { MaxRecords: limit, filter },
|
|
455
455
|
operation
|
|
456
456
|
});
|
|
457
|
-
return
|
|
457
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
// src/resources/special/billing_items.ts
|
|
@@ -487,7 +487,7 @@ async function customRange(_resource, from, to, http, opts) {
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
// src/resources/billing_items.ts
|
|
490
|
-
var BillingItemsResource = class extends
|
|
490
|
+
var BillingItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
491
491
|
constructor(http, pageSize) {
|
|
492
492
|
super(http, {
|
|
493
493
|
key: "billing_items",
|
|
@@ -589,7 +589,7 @@ var BillingItemsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
589
589
|
};
|
|
590
590
|
|
|
591
591
|
// src/resources/change_request_links.ts
|
|
592
|
-
var ChangeRequestLinksResource = class extends
|
|
592
|
+
var ChangeRequestLinksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
593
593
|
constructor(http, pageSize) {
|
|
594
594
|
super(http, {
|
|
595
595
|
key: "change_request_links",
|
|
@@ -643,7 +643,7 @@ var ChangeRequestLinksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
643
643
|
};
|
|
644
644
|
|
|
645
645
|
// src/resources/checklist_libraries.ts
|
|
646
|
-
var ChecklistLibrariesResource = class extends
|
|
646
|
+
var ChecklistLibrariesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
647
647
|
constructor(http, pageSize) {
|
|
648
648
|
super(http, {
|
|
649
649
|
key: "checklist_libraries",
|
|
@@ -717,7 +717,7 @@ var ChecklistLibrariesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
717
717
|
};
|
|
718
718
|
|
|
719
719
|
// src/resources/checklist_library_checklist_items.ts
|
|
720
|
-
var ChecklistLibraryChecklistItemsResource = class extends
|
|
720
|
+
var ChecklistLibraryChecklistItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
721
721
|
constructor(http, pageSize) {
|
|
722
722
|
super(http, {
|
|
723
723
|
key: "checklist_library_checklist_items",
|
|
@@ -783,7 +783,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunk4RJG73GYcjs.Bas
|
|
|
783
783
|
};
|
|
784
784
|
|
|
785
785
|
// src/resources/classification_icons.ts
|
|
786
|
-
var ClassificationIconsResource = class extends
|
|
786
|
+
var ClassificationIconsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
787
787
|
constructor(http, pageSize) {
|
|
788
788
|
super(http, {
|
|
789
789
|
key: "classification_icons",
|
|
@@ -831,7 +831,7 @@ var DEFAULT_LIMIT2 = 25;
|
|
|
831
831
|
var MAX_LIMIT2 = 500;
|
|
832
832
|
function clampLimit(limit) {
|
|
833
833
|
const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
|
|
834
|
-
if (!Number.isInteger(n) || n < 1) throw new (0,
|
|
834
|
+
if (!Number.isInteger(n) || n < 1) throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
835
835
|
return Math.min(n, MAX_LIMIT2);
|
|
836
836
|
}
|
|
837
837
|
async function queryCompanies(http, filter, limit) {
|
|
@@ -842,7 +842,7 @@ async function queryCompanies(http, filter, limit) {
|
|
|
842
842
|
body: { MaxRecords: limit, filter },
|
|
843
843
|
operation: "companies.searchByDomain"
|
|
844
844
|
});
|
|
845
|
-
return
|
|
845
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
846
846
|
}
|
|
847
847
|
async function queryContacts(http, filter, limit) {
|
|
848
848
|
const res = await http.request({
|
|
@@ -852,7 +852,7 @@ async function queryContacts(http, filter, limit) {
|
|
|
852
852
|
body: { MaxRecords: limit, filter },
|
|
853
853
|
operation: "companies.searchByDomain"
|
|
854
854
|
});
|
|
855
|
-
return
|
|
855
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
856
856
|
}
|
|
857
857
|
async function fetchCompanies(http, ids, limit) {
|
|
858
858
|
const out = [];
|
|
@@ -867,7 +867,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
867
867
|
const item = body && "item" in body ? body.item : null;
|
|
868
868
|
if (item) out.push(item);
|
|
869
869
|
} catch (err) {
|
|
870
|
-
if (err instanceof
|
|
870
|
+
if (err instanceof _chunkWRWX6WIKcjs.NotFoundError) continue;
|
|
871
871
|
throw err;
|
|
872
872
|
}
|
|
873
873
|
}
|
|
@@ -875,7 +875,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
875
875
|
}
|
|
876
876
|
async function searchByDomain(_resource, domain, opts = {}, http) {
|
|
877
877
|
const text = domain.trim();
|
|
878
|
-
if (text === "") throw new (0,
|
|
878
|
+
if (text === "") throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("searchByDomain: empty domain");
|
|
879
879
|
const limit = clampLimit(opts.limit);
|
|
880
880
|
const filter = [{ field: "webAddress", op: "contains", value: text }];
|
|
881
881
|
const direct = await queryCompanies(http, filter, limit);
|
|
@@ -889,7 +889,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
|
|
|
889
889
|
const email = _nullishCoalesce(_optionalChain([identity, 'access', _9 => _9.email, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]), () => ( ""));
|
|
890
890
|
const website = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.website, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
|
|
891
891
|
if (name === "" && email === "" && website === "") {
|
|
892
|
-
throw new (0,
|
|
892
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
|
|
893
893
|
}
|
|
894
894
|
const limit = clampLimit(opts.limit);
|
|
895
895
|
const found = /* @__PURE__ */ new Map();
|
|
@@ -916,23 +916,23 @@ async function familyChildPage(http, parentID) {
|
|
|
916
916
|
path: "/V1.0/Companies/query",
|
|
917
917
|
body: {
|
|
918
918
|
MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
|
|
919
|
-
filter:
|
|
919
|
+
filter: _chunkWRWX6WIKcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
|
|
920
920
|
},
|
|
921
921
|
operation: "companies.search"
|
|
922
922
|
});
|
|
923
|
-
const { items, pageDetails } =
|
|
923
|
+
const { items, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, "companies.search");
|
|
924
924
|
return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
|
|
925
925
|
}
|
|
926
926
|
function assertSearchWithDetailOpts(opts) {
|
|
927
927
|
if (opts === void 0) return;
|
|
928
928
|
if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
|
|
929
|
-
throw new (0,
|
|
929
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
|
|
930
930
|
operation: "companies.searchWithDetail"
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
933
|
for (const key of Object.keys(opts)) {
|
|
934
934
|
if (key !== "limit") {
|
|
935
|
-
throw new (0,
|
|
935
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
936
936
|
`companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
|
|
937
937
|
{ operation: "companies.searchWithDetail" }
|
|
938
938
|
);
|
|
@@ -941,32 +941,32 @@ function assertSearchWithDetailOpts(opts) {
|
|
|
941
941
|
}
|
|
942
942
|
async function searchWithFamily(_resource, query, opts = {}, http) {
|
|
943
943
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
944
|
-
throw new (0,
|
|
944
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
|
|
945
945
|
}
|
|
946
946
|
for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
|
|
947
947
|
if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
|
|
948
|
-
throw new (0,
|
|
948
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
949
949
|
`companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
|
|
950
950
|
{ operation: "companies.search" }
|
|
951
951
|
);
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
|
|
955
|
-
throw new (0,
|
|
955
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
|
|
956
956
|
operation: "companies.search"
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
959
|
const text = query.trim();
|
|
960
|
-
if (text === "") throw new (0,
|
|
961
|
-
const limit = opts.limit === void 0 ? 25 :
|
|
960
|
+
if (text === "") throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
|
|
961
|
+
const limit = opts.limit === void 0 ? 25 : _chunkWRWX6WIKcjs.clampPageSize.call(void 0, opts.limit);
|
|
962
962
|
const res = await http.request({
|
|
963
963
|
method: "POST",
|
|
964
964
|
idempotent: true,
|
|
965
965
|
path: "/V1.0/Companies/query",
|
|
966
|
-
body: { MaxRecords: limit, filter:
|
|
966
|
+
body: { MaxRecords: limit, filter: _chunkWRWX6WIKcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
|
|
967
967
|
operation: "companies.search"
|
|
968
968
|
});
|
|
969
|
-
const hits =
|
|
969
|
+
const hits = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, "companies.search").items;
|
|
970
970
|
if (opts.includeFamily !== true) return hits;
|
|
971
971
|
const rows = [];
|
|
972
972
|
for (const hit of hits) {
|
|
@@ -990,7 +990,7 @@ var DEFAULT_COMPANY_TYPE = 1;
|
|
|
990
990
|
var DEDUP_NAME_LIMIT = 10;
|
|
991
991
|
var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumerate (the unowned surface is blind); a same-name company outside that scope is not detected";
|
|
992
992
|
var SAFE_COMPANY_CREATE_DEFAULTS = {};
|
|
993
|
-
var OwnerResourceRequiredError = class extends
|
|
993
|
+
var OwnerResourceRequiredError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
994
994
|
constructor(message, options = {}) {
|
|
995
995
|
super(message, {
|
|
996
996
|
code: "OWNER_RESOURCE_REQUIRED",
|
|
@@ -1001,13 +1001,13 @@ var OwnerResourceRequiredError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
1001
1001
|
this.name = "OwnerResourceRequiredError";
|
|
1002
1002
|
}
|
|
1003
1003
|
};
|
|
1004
|
-
var CompanyResourceInvalidError = class extends
|
|
1004
|
+
var CompanyResourceInvalidError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
1005
1005
|
constructor(message, options = {}) {
|
|
1006
1006
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
1007
1007
|
this.name = "CompanyResourceInvalidError";
|
|
1008
1008
|
}
|
|
1009
1009
|
};
|
|
1010
|
-
var CompanyCreateFailedError = class extends
|
|
1010
|
+
var CompanyCreateFailedError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
1011
1011
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
1012
1012
|
|
|
1013
1013
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -1018,18 +1018,18 @@ var CompanyCreateFailedError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
1018
1018
|
};
|
|
1019
1019
|
async function upsertByName(resource, companyName, params, opts, http) {
|
|
1020
1020
|
if (typeof companyName !== "string" || companyName.trim() === "") {
|
|
1021
|
-
throw new (0,
|
|
1021
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
|
|
1022
1022
|
}
|
|
1023
1023
|
if (typeof _optionalChain([params, 'optionalAccess', _15 => _15.phone]) !== "string" || params.phone.trim() === "") {
|
|
1024
|
-
throw new (0,
|
|
1024
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
1025
1025
|
}
|
|
1026
1026
|
const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
|
|
1027
1027
|
if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
|
|
1028
|
-
throw new (0,
|
|
1028
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
1029
1029
|
}
|
|
1030
1030
|
const owner = params.ownerResourceID;
|
|
1031
1031
|
if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
|
|
1032
|
-
throw new (0,
|
|
1032
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
|
|
1033
1033
|
}
|
|
1034
1034
|
const q = await resource.queryBounded({ filter: [{ field: "companyName", op: "eq", value: companyName }], limit: DEDUP_NAME_LIMIT });
|
|
1035
1035
|
const caveat = {
|
|
@@ -1040,7 +1040,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1040
1040
|
const match = q.items[0];
|
|
1041
1041
|
if (match !== void 0) {
|
|
1042
1042
|
if (opts.dryRun === true) {
|
|
1043
|
-
return
|
|
1043
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
1044
1044
|
{
|
|
1045
1045
|
operation: OP_UPSERT_NAME,
|
|
1046
1046
|
method: "POST",
|
|
@@ -1075,7 +1075,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1075
1075
|
"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"
|
|
1076
1076
|
);
|
|
1077
1077
|
}
|
|
1078
|
-
return
|
|
1078
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
1079
1079
|
{
|
|
1080
1080
|
operation: OP_UPSERT_NAME,
|
|
1081
1081
|
method: "POST",
|
|
@@ -1123,8 +1123,8 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1123
1123
|
sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
|
|
1124
1124
|
};
|
|
1125
1125
|
} catch (err) {
|
|
1126
|
-
if (!
|
|
1127
|
-
const named = (_nullishCoalesce(
|
|
1126
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
1127
|
+
const named = (_nullishCoalesce(_chunkWRWX6WIKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
1128
1128
|
const seen = /* @__PURE__ */ new Set();
|
|
1129
1129
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
1130
1130
|
const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -1138,7 +1138,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
continue;
|
|
1140
1140
|
}
|
|
1141
|
-
const detail =
|
|
1141
|
+
const detail = _chunkWRWX6WIKcjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
1142
1142
|
throw new CompanyCreateFailedError(
|
|
1143
1143
|
`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}` : ""}`,
|
|
1144
1144
|
unique,
|
|
@@ -1158,7 +1158,7 @@ var PROFILE_PART_LIMIT = 50;
|
|
|
1158
1158
|
function profilePartLimit(value, name) {
|
|
1159
1159
|
const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
|
|
1160
1160
|
if (!Number.isInteger(n) || n < 1) {
|
|
1161
|
-
throw new (0,
|
|
1161
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
1162
1162
|
}
|
|
1163
1163
|
return n;
|
|
1164
1164
|
}
|
|
@@ -1170,14 +1170,14 @@ async function scopedCompanyQuery(http, path, companyID, limit) {
|
|
|
1170
1170
|
body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }] },
|
|
1171
1171
|
operation: "companies.fullProfile"
|
|
1172
1172
|
});
|
|
1173
|
-
return
|
|
1173
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
1174
1174
|
}
|
|
1175
1175
|
async function fullProfile(resource, id, opts = {}, http) {
|
|
1176
1176
|
const contactLimit = profilePartLimit(opts.contactLimit, "contactLimit");
|
|
1177
1177
|
const noteLimit = profilePartLimit(opts.noteLimit, "noteLimit");
|
|
1178
1178
|
const ticketLimit = profilePartLimit(opts.ticketLimit, "ticketLimit");
|
|
1179
1179
|
const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
|
|
1180
|
-
const companyID =
|
|
1180
|
+
const companyID = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
1181
1181
|
const company = await resource.get(companyID);
|
|
1182
1182
|
const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, PROFILE_PART_LIMIT);
|
|
1183
1183
|
const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit);
|
|
@@ -1194,7 +1194,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
operation: "companies.fullProfile"
|
|
1196
1196
|
});
|
|
1197
|
-
return
|
|
1197
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
1198
1198
|
})();
|
|
1199
1199
|
let openTickets = {
|
|
1200
1200
|
items: openRows,
|
|
@@ -1203,7 +1203,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1203
1203
|
note: OPEN_TICKETS_NOTE
|
|
1204
1204
|
};
|
|
1205
1205
|
if (openRows.length === 0) {
|
|
1206
|
-
const stamp =
|
|
1206
|
+
const stamp = _chunkWRWX6WIKcjs.blindStampFor.call(void 0, _optionalChain([_chunkWRWX6WIKcjs.BLIND_SURFACE_STAMPS, 'access', _16 => _16["tickets"], 'optionalAccess', _17 => _17.query]), [
|
|
1207
1207
|
{ field: "companyID", op: "eq", value: companyID },
|
|
1208
1208
|
{ field: "status", op: "noteq", value: 5 }
|
|
1209
1209
|
]);
|
|
@@ -1234,7 +1234,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
};
|
|
1236
1236
|
if (opts.names === true) {
|
|
1237
|
-
const builder =
|
|
1237
|
+
const builder = _chunkWRWX6WIKcjs.createNamePlan.call(void 0, _chunkWRWX6WIKcjs.TICKET_LABEL_FIELDS);
|
|
1238
1238
|
const c = company;
|
|
1239
1239
|
builder.addResource(c["ownerResourceID"]);
|
|
1240
1240
|
builder.addResource(c["createdByResourceID"]);
|
|
@@ -1251,20 +1251,20 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1251
1251
|
builder.addResource(r["creatorResourceID"]);
|
|
1252
1252
|
builder.addFk("contract", r["contractID"]);
|
|
1253
1253
|
}
|
|
1254
|
-
const names = await
|
|
1254
|
+
const names = await _chunkWRWX6WIKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
1255
1255
|
const companyRow = { ...company };
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
|
|
1257
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
|
|
1258
1258
|
result.company = companyRow;
|
|
1259
1259
|
result.openTickets = {
|
|
1260
1260
|
...openTickets,
|
|
1261
1261
|
items: openTickets.items.map((row) => {
|
|
1262
1262
|
const r = { ...row };
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
for (const f of
|
|
1263
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1264
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1265
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
1266
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
1267
|
+
for (const f of _chunkWRWX6WIKcjs.TICKET_LABEL_FIELDS) _chunkWRWX6WIKcjs.addLabelSibling.call(void 0, r, f, names);
|
|
1268
1268
|
return r;
|
|
1269
1269
|
})
|
|
1270
1270
|
};
|
|
@@ -1272,9 +1272,9 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1272
1272
|
...result.projects,
|
|
1273
1273
|
items: result.projects.items.map((row) => {
|
|
1274
1274
|
const r = { ...row };
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1275
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
|
|
1276
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1277
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1278
1278
|
return r;
|
|
1279
1279
|
})
|
|
1280
1280
|
};
|
|
@@ -1306,7 +1306,7 @@ function isDateYMD(v) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
function validateUnbilledWorkOptions(companyId, opts) {
|
|
1308
1308
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1309
|
-
throw new (0,
|
|
1309
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
1310
1310
|
`unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
1311
1311
|
{ operation: "companies.unbilledWork" }
|
|
1312
1312
|
);
|
|
@@ -1335,7 +1335,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1335
1335
|
try {
|
|
1336
1336
|
limit = clampLimit(opts.limit);
|
|
1337
1337
|
} catch (err) {
|
|
1338
|
-
problems.push(err instanceof
|
|
1338
|
+
problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
1339
1339
|
limit = 50;
|
|
1340
1340
|
}
|
|
1341
1341
|
if (source === "date_range") {
|
|
@@ -1350,9 +1350,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1350
1350
|
problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
|
|
1351
1351
|
} else {
|
|
1352
1352
|
try {
|
|
1353
|
-
|
|
1353
|
+
_chunkWRWX6WIKcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
|
|
1354
1354
|
} catch (err) {
|
|
1355
|
-
problems.push(err instanceof
|
|
1355
|
+
problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
@@ -1362,20 +1362,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1362
1362
|
} else {
|
|
1363
1363
|
opts.ticketIds.forEach((tid, i) => {
|
|
1364
1364
|
try {
|
|
1365
|
-
|
|
1365
|
+
_chunkWRWX6WIKcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
|
|
1366
1366
|
} catch (err) {
|
|
1367
|
-
problems.push(err instanceof
|
|
1367
|
+
problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
|
|
1368
1368
|
}
|
|
1369
1369
|
});
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
try {
|
|
1373
|
-
|
|
1373
|
+
_chunkWRWX6WIKcjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1374
1374
|
} catch (err) {
|
|
1375
|
-
problems.push(err instanceof
|
|
1375
|
+
problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
|
|
1376
1376
|
}
|
|
1377
1377
|
if (problems.length > 0) {
|
|
1378
|
-
throw new (0,
|
|
1378
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
1379
1379
|
`unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
1380
1380
|
- ` + problems.join("\n- "),
|
|
1381
1381
|
{ operation: "companies.unbilledWork" }
|
|
@@ -1404,7 +1404,7 @@ async function boundedPart(http, path, conditions, limit, includeFields) {
|
|
|
1404
1404
|
body,
|
|
1405
1405
|
operation: "companies.unbilledWork"
|
|
1406
1406
|
});
|
|
1407
|
-
const { items, pageDetails } =
|
|
1407
|
+
const { items, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, "companies.unbilledWork");
|
|
1408
1408
|
const capped = items.length >= limit;
|
|
1409
1409
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
1410
1410
|
}
|
|
@@ -1415,7 +1415,7 @@ function capJoinSet(ids, cap) {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
function unbilledWorkPartStatus(key, conditions, items) {
|
|
1417
1417
|
if (items.length !== 0) return { status: "ok" };
|
|
1418
|
-
const stamp =
|
|
1418
|
+
const stamp = _chunkWRWX6WIKcjs.blindStampFor.call(void 0, _optionalChain([_chunkWRWX6WIKcjs.BLIND_SURFACE_STAMPS, 'access', _18 => _18[key], 'optionalAccess', _19 => _19.query]), conditions);
|
|
1419
1419
|
if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
|
|
1420
1420
|
return {
|
|
1421
1421
|
status: "ok",
|
|
@@ -1424,7 +1424,7 @@ function unbilledWorkPartStatus(key, conditions, items) {
|
|
|
1424
1424
|
}
|
|
1425
1425
|
async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
1426
1426
|
const v = validateUnbilledWorkOptions(companyId, opts);
|
|
1427
|
-
const id =
|
|
1427
|
+
const id = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1428
1428
|
const company = await resource.get(id);
|
|
1429
1429
|
const companyIds = [num(company.id)];
|
|
1430
1430
|
let parent = null;
|
|
@@ -1437,7 +1437,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1437
1437
|
parentStatus = "ok";
|
|
1438
1438
|
companyIds.push(num(parent.id));
|
|
1439
1439
|
} catch (err) {
|
|
1440
|
-
if (err instanceof
|
|
1440
|
+
if (err instanceof _chunkWRWX6WIKcjs.NotFoundError) parent = null;
|
|
1441
1441
|
else throw err;
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
@@ -1469,7 +1469,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1469
1469
|
if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
|
|
1470
1470
|
if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
|
|
1471
1471
|
}
|
|
1472
|
-
const billingFields =
|
|
1472
|
+
const billingFields = _chunkWRWX6WIKcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
|
|
1473
1473
|
const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
|
|
1474
1474
|
const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, billingIncludeFields);
|
|
1475
1475
|
const taskCap = capJoinSet(taskIds, UNBILLED_WORK_JOIN_SET_CAP);
|
|
@@ -1501,7 +1501,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1501
1501
|
let cappedItems = entries;
|
|
1502
1502
|
let noteCharsTruncated = 0;
|
|
1503
1503
|
if (v.includeNotes) {
|
|
1504
|
-
[cappedItems, noteCharsTruncated] =
|
|
1504
|
+
[cappedItems, noteCharsTruncated] = _chunkWRWX6WIKcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
|
|
1505
1505
|
}
|
|
1506
1506
|
const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
|
|
1507
1507
|
timePart = {
|
|
@@ -1516,8 +1516,8 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1516
1516
|
let billingItems = billingRaw.items;
|
|
1517
1517
|
let billingNoteCharsTruncated = 0;
|
|
1518
1518
|
if (v.includeNotes) {
|
|
1519
|
-
const noteFields = (_nullishCoalesce(
|
|
1520
|
-
[billingItems, billingNoteCharsTruncated] =
|
|
1519
|
+
const noteFields = (_nullishCoalesce(_chunkWRWX6WIKcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
|
|
1520
|
+
[billingItems, billingNoteCharsTruncated] = _chunkWRWX6WIKcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
|
|
1521
1521
|
}
|
|
1522
1522
|
const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
|
|
1523
1523
|
const billingItemsPart = {
|
|
@@ -1614,7 +1614,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
1616
|
// src/resources/companies.ts
|
|
1617
|
-
var CompaniesResource = class extends
|
|
1617
|
+
var CompaniesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1618
1618
|
constructor(http, pageSize) {
|
|
1619
1619
|
super(http, {
|
|
1620
1620
|
key: "companies",
|
|
@@ -1721,7 +1721,7 @@ var CompaniesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
1721
1721
|
};
|
|
1722
1722
|
|
|
1723
1723
|
// src/resources/company_alerts.ts
|
|
1724
|
-
var CompanyAlertsResource = class extends
|
|
1724
|
+
var CompanyAlertsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1725
1725
|
constructor(http, pageSize) {
|
|
1726
1726
|
super(http, {
|
|
1727
1727
|
key: "company_alerts",
|
|
@@ -1787,7 +1787,7 @@ var CompanyAlertsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
1787
1787
|
};
|
|
1788
1788
|
|
|
1789
1789
|
// src/resources/company_locations.ts
|
|
1790
|
-
var CompanyLocationsResource = class extends
|
|
1790
|
+
var CompanyLocationsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1791
1791
|
constructor(http, pageSize) {
|
|
1792
1792
|
super(http, {
|
|
1793
1793
|
key: "company_locations",
|
|
@@ -1858,7 +1858,7 @@ var CompanyLocationsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
1858
1858
|
};
|
|
1859
1859
|
|
|
1860
1860
|
// src/resources/company_notes.ts
|
|
1861
|
-
var CompanyNotesResource = class extends
|
|
1861
|
+
var CompanyNotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1862
1862
|
constructor(http, pageSize) {
|
|
1863
1863
|
super(http, {
|
|
1864
1864
|
key: "company_notes",
|
|
@@ -1923,7 +1923,7 @@ var CompanyNotesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
1923
1923
|
};
|
|
1924
1924
|
|
|
1925
1925
|
// src/resources/company_site_configurations.ts
|
|
1926
|
-
var CompanySiteConfigurationsResource = class extends
|
|
1926
|
+
var CompanySiteConfigurationsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1927
1927
|
constructor(http, pageSize) {
|
|
1928
1928
|
super(http, {
|
|
1929
1929
|
key: "company_site_configurations",
|
|
@@ -1974,7 +1974,7 @@ var CompanySiteConfigurationsResource = class extends _chunk4RJG73GYcjs.BaseReso
|
|
|
1974
1974
|
};
|
|
1975
1975
|
|
|
1976
1976
|
// src/resources/company_webhooks.ts
|
|
1977
|
-
var CompanyWebhooksResource = class extends
|
|
1977
|
+
var CompanyWebhooksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
1978
1978
|
constructor(http, pageSize) {
|
|
1979
1979
|
super(http, {
|
|
1980
1980
|
key: "company_webhooks",
|
|
@@ -2050,7 +2050,7 @@ var CompanyWebhooksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
2050
2050
|
};
|
|
2051
2051
|
|
|
2052
2052
|
// src/resources/configuration_item_billing_product_associations.ts
|
|
2053
|
-
var ConfigurationItemBillingProductAssociationsResource = class extends
|
|
2053
|
+
var ConfigurationItemBillingProductAssociationsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2054
2054
|
constructor(http, pageSize) {
|
|
2055
2055
|
super(http, {
|
|
2056
2056
|
key: "configuration_item_billing_product_associations",
|
|
@@ -2116,7 +2116,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunk4R
|
|
|
2116
2116
|
};
|
|
2117
2117
|
|
|
2118
2118
|
// src/resources/configuration_item_categories.ts
|
|
2119
|
-
var ConfigurationItemCategoriesResource = class extends
|
|
2119
|
+
var ConfigurationItemCategoriesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2120
2120
|
constructor(http, pageSize) {
|
|
2121
2121
|
super(http, {
|
|
2122
2122
|
key: "configuration_item_categories",
|
|
@@ -2183,7 +2183,7 @@ var ConfigurationItemCategoriesResource = class extends _chunk4RJG73GYcjs.BaseRe
|
|
|
2183
2183
|
};
|
|
2184
2184
|
|
|
2185
2185
|
// src/resources/configuration_item_category_udf_associations.ts
|
|
2186
|
-
var ConfigurationItemCategoryUdfAssociationsResource = class extends
|
|
2186
|
+
var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2187
2187
|
constructor(http, pageSize) {
|
|
2188
2188
|
super(http, {
|
|
2189
2189
|
key: "configuration_item_category_udf_associations",
|
|
@@ -2249,7 +2249,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunk4RJG7
|
|
|
2249
2249
|
};
|
|
2250
2250
|
|
|
2251
2251
|
// src/resources/configuration_item_dns_records.ts
|
|
2252
|
-
var ConfigurationItemDnsRecordsResource = class extends
|
|
2252
|
+
var ConfigurationItemDnsRecordsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2253
2253
|
constructor(http, pageSize) {
|
|
2254
2254
|
super(http, {
|
|
2255
2255
|
key: "configuration_item_dns_records",
|
|
@@ -2298,7 +2298,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunk4RJG73GYcjs.BaseRe
|
|
|
2298
2298
|
};
|
|
2299
2299
|
|
|
2300
2300
|
// src/resources/configuration_item_notes.ts
|
|
2301
|
-
var ConfigurationItemNotesResource = class extends
|
|
2301
|
+
var ConfigurationItemNotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2302
2302
|
constructor(http, pageSize) {
|
|
2303
2303
|
super(http, {
|
|
2304
2304
|
key: "configuration_item_notes",
|
|
@@ -2357,7 +2357,7 @@ var ConfigurationItemNotesResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
2357
2357
|
};
|
|
2358
2358
|
|
|
2359
2359
|
// src/resources/configuration_item_related_items.ts
|
|
2360
|
-
var ConfigurationItemRelatedItemsResource = class extends
|
|
2360
|
+
var ConfigurationItemRelatedItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2361
2361
|
constructor(http, pageSize) {
|
|
2362
2362
|
super(http, {
|
|
2363
2363
|
key: "configuration_item_related_items",
|
|
@@ -2418,16 +2418,16 @@ async function fetchRecord(http, path, label, readOpts) {
|
|
|
2418
2418
|
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _20 => _20.maxRetries]) });
|
|
2419
2419
|
const body = res;
|
|
2420
2420
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
2421
|
-
throw new (0,
|
|
2421
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
2422
2422
|
}
|
|
2423
2423
|
return body.item;
|
|
2424
2424
|
}
|
|
2425
2425
|
async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
2426
|
-
const numericSource =
|
|
2426
|
+
const numericSource = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
|
|
2427
2427
|
if (_optionalChain([opts, 'optionalAccess', _21 => _21.destinationCompanyId]) === void 0) {
|
|
2428
|
-
throw new (0,
|
|
2428
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
|
|
2429
2429
|
}
|
|
2430
|
-
const destId =
|
|
2430
|
+
const destId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
|
|
2431
2431
|
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
|
|
2432
2432
|
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
|
|
2433
2433
|
const body = { ...source };
|
|
@@ -2437,20 +2437,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2437
2437
|
body.companyID = destId;
|
|
2438
2438
|
body.isActive = true;
|
|
2439
2439
|
if (opts.newReferenceTitle !== void 0) {
|
|
2440
|
-
if (opts.newReferenceTitle.trim() === "") throw new (0,
|
|
2440
|
+
if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
|
|
2441
2441
|
body.referenceTitle = opts.newReferenceTitle.trim();
|
|
2442
2442
|
}
|
|
2443
2443
|
if (opts.lastModifiedDate !== void 0) {
|
|
2444
2444
|
const current = source.lastModifiedDate;
|
|
2445
2445
|
if (current !== opts.lastModifiedDate) {
|
|
2446
|
-
throw new (0,
|
|
2446
|
+
throw new (0, _chunkWRWX6WIKcjs.StaleObjectError)(
|
|
2447
2447
|
`moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
|
|
2448
2448
|
{ operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
|
|
2449
2449
|
);
|
|
2450
2450
|
}
|
|
2451
2451
|
}
|
|
2452
2452
|
if (opts.dryRun === true) {
|
|
2453
|
-
return
|
|
2453
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
2454
2454
|
operation: "configuration_items.moveConfigurationItem",
|
|
2455
2455
|
method: "POST",
|
|
2456
2456
|
path: "/V1.0/ConfigurationItems",
|
|
@@ -2475,7 +2475,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2475
2475
|
const createdBody = created;
|
|
2476
2476
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
2477
2477
|
if (typeof newId !== "number") {
|
|
2478
|
-
throw new (0,
|
|
2478
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
|
|
2479
2479
|
}
|
|
2480
2480
|
let sourceDeactivated = false;
|
|
2481
2481
|
if (opts.deactivateSource !== false) {
|
|
@@ -2494,7 +2494,7 @@ var PROFILE_PART_LIMIT2 = 50;
|
|
|
2494
2494
|
function profilePartLimit2(value, name) {
|
|
2495
2495
|
const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
|
|
2496
2496
|
if (!Number.isInteger(n) || n < 1) {
|
|
2497
|
-
throw new (0,
|
|
2497
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
2498
2498
|
}
|
|
2499
2499
|
return n;
|
|
2500
2500
|
}
|
|
@@ -2510,14 +2510,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
|
|
|
2510
2510
|
});
|
|
2511
2511
|
const body = res;
|
|
2512
2512
|
if (body === null || !("item" in body)) {
|
|
2513
|
-
throw new (0,
|
|
2513
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
|
|
2514
2514
|
}
|
|
2515
2515
|
if (body.item === null || body.item === void 0) {
|
|
2516
|
-
throw new (0,
|
|
2516
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
|
|
2517
2517
|
}
|
|
2518
2518
|
return body.item;
|
|
2519
2519
|
} catch (err) {
|
|
2520
|
-
if (err instanceof
|
|
2520
|
+
if (err instanceof _chunkWRWX6WIKcjs.NotFoundError) return null;
|
|
2521
2521
|
throw err;
|
|
2522
2522
|
}
|
|
2523
2523
|
}
|
|
@@ -2529,7 +2529,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
|
|
|
2529
2529
|
body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
|
|
2530
2530
|
operation: "configuration_items.profile"
|
|
2531
2531
|
});
|
|
2532
|
-
return
|
|
2532
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
2533
2533
|
}
|
|
2534
2534
|
async function profile(resource, id, opts = {}, http) {
|
|
2535
2535
|
const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
|
|
@@ -2541,7 +2541,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2541
2541
|
const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
|
|
2542
2542
|
const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
|
|
2543
2543
|
const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
|
|
2544
|
-
const wallQuirk = _optionalChain([
|
|
2544
|
+
const wallQuirk = _optionalChain([_chunkWRWX6WIKcjs.RELATIONSHIP_MAP, 'access', _22 => _22["configuration_items"], 'optionalAccess', _23 => _23.zoneFacts, 'optionalAccess', _24 => _24.quirks, 'optionalAccess', _25 => _25.find, 'call', _26 => _26((q) => q.startsWith("product wall"))]);
|
|
2545
2545
|
const productAssociations = {
|
|
2546
2546
|
items: associations,
|
|
2547
2547
|
capped: associations.length >= PROFILE_PART_LIMIT2,
|
|
@@ -2565,11 +2565,11 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2565
2565
|
}
|
|
2566
2566
|
};
|
|
2567
2567
|
if (opts.names === true) {
|
|
2568
|
-
const builder =
|
|
2568
|
+
const builder = _chunkWRWX6WIKcjs.createNamePlan.call(void 0, );
|
|
2569
2569
|
builder.addFk("contract", root["contractID"]);
|
|
2570
|
-
const names = await
|
|
2570
|
+
const names = await _chunkWRWX6WIKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
2571
2571
|
const ciRow = { ...ci };
|
|
2572
|
-
|
|
2572
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
|
|
2573
2573
|
result.ci = ciRow;
|
|
2574
2574
|
result.names = names.section;
|
|
2575
2575
|
}
|
|
@@ -2577,7 +2577,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2577
2577
|
}
|
|
2578
2578
|
|
|
2579
2579
|
// src/resources/configuration_items.ts
|
|
2580
|
-
var ConfigurationItemsResource = class extends
|
|
2580
|
+
var ConfigurationItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2581
2581
|
constructor(http, pageSize) {
|
|
2582
2582
|
super(http, {
|
|
2583
2583
|
key: "configuration_items",
|
|
@@ -2666,7 +2666,7 @@ var ConfigurationItemsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
2666
2666
|
};
|
|
2667
2667
|
|
|
2668
2668
|
// src/resources/configuration_item_ssl_subject_alternative_names.ts
|
|
2669
|
-
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends
|
|
2669
|
+
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2670
2670
|
constructor(http, pageSize) {
|
|
2671
2671
|
super(http, {
|
|
2672
2672
|
key: "configuration_item_ssl_subject_alternative_names",
|
|
@@ -2729,7 +2729,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunk4R
|
|
|
2729
2729
|
};
|
|
2730
2730
|
|
|
2731
2731
|
// src/resources/configuration_item_types.ts
|
|
2732
|
-
var ConfigurationItemTypesResource = class extends
|
|
2732
|
+
var ConfigurationItemTypesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2733
2733
|
constructor(http, pageSize) {
|
|
2734
2734
|
super(http, {
|
|
2735
2735
|
key: "configuration_item_types",
|
|
@@ -2803,7 +2803,7 @@ var ConfigurationItemTypesResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
2803
2803
|
};
|
|
2804
2804
|
|
|
2805
2805
|
// src/resources/configuration_item_webhooks.ts
|
|
2806
|
-
var ConfigurationItemWebhooksResource = class extends
|
|
2806
|
+
var ConfigurationItemWebhooksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2807
2807
|
constructor(http, pageSize) {
|
|
2808
2808
|
super(http, {
|
|
2809
2809
|
key: "configuration_item_webhooks",
|
|
@@ -2879,7 +2879,7 @@ var ConfigurationItemWebhooksResource = class extends _chunk4RJG73GYcjs.BaseReso
|
|
|
2879
2879
|
};
|
|
2880
2880
|
|
|
2881
2881
|
// src/resources/contact_group_contacts.ts
|
|
2882
|
-
var ContactGroupContactsResource = class extends
|
|
2882
|
+
var ContactGroupContactsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2883
2883
|
constructor(http, pageSize) {
|
|
2884
2884
|
super(http, {
|
|
2885
2885
|
key: "contact_group_contacts",
|
|
@@ -2933,7 +2933,7 @@ var ContactGroupContactsResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
2933
2933
|
};
|
|
2934
2934
|
|
|
2935
2935
|
// src/resources/contact_groups.ts
|
|
2936
|
-
var ContactGroupsResource = class extends
|
|
2936
|
+
var ContactGroupsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
2937
2937
|
constructor(http, pageSize) {
|
|
2938
2938
|
super(http, {
|
|
2939
2939
|
key: "contact_groups",
|
|
@@ -3011,22 +3011,22 @@ async function fetchRecord2(http, path, label, readOpts) {
|
|
|
3011
3011
|
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _27 => _27.maxRetries]) });
|
|
3012
3012
|
const body = res;
|
|
3013
3013
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
3014
|
-
throw new (0,
|
|
3014
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
3015
3015
|
}
|
|
3016
3016
|
return body.item;
|
|
3017
3017
|
}
|
|
3018
3018
|
async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
|
|
3019
|
-
const sourceId =
|
|
3020
|
-
const destId =
|
|
3019
|
+
const sourceId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
|
|
3020
|
+
const destId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
|
|
3021
3021
|
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
|
|
3022
3022
|
const companyID = source.companyID;
|
|
3023
3023
|
if (typeof companyID !== "number" || companyID < 0) {
|
|
3024
|
-
throw new (0,
|
|
3024
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
|
|
3025
3025
|
}
|
|
3026
3026
|
if (opts.lastModifiedDate !== void 0) {
|
|
3027
3027
|
const current = source.lastModifiedDate;
|
|
3028
3028
|
if (current !== opts.lastModifiedDate) {
|
|
3029
|
-
throw new (0,
|
|
3029
|
+
throw new (0, _chunkWRWX6WIKcjs.StaleObjectError)(
|
|
3030
3030
|
`moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
|
|
3031
3031
|
{ operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
|
|
3032
3032
|
);
|
|
@@ -3048,10 +3048,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3048
3048
|
},
|
|
3049
3049
|
operation: "contacts.moveToCompany"
|
|
3050
3050
|
});
|
|
3051
|
-
const items =
|
|
3051
|
+
const items = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
3052
3052
|
const clash = items.find((c) => String(c.id) !== String(sourceId));
|
|
3053
3053
|
if (clash !== void 0) {
|
|
3054
|
-
throw new (0,
|
|
3054
|
+
throw new (0, _chunkWRWX6WIKcjs.ConflictError)(
|
|
3055
3055
|
`Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
|
|
3056
3056
|
{ resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
|
|
3057
3057
|
);
|
|
@@ -3065,7 +3065,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3065
3065
|
if (opts.dryRun === true) {
|
|
3066
3066
|
const warnings = [];
|
|
3067
3067
|
if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
|
|
3068
|
-
return
|
|
3068
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
3069
3069
|
operation: "contacts.moveToCompany",
|
|
3070
3070
|
method: "POST",
|
|
3071
3071
|
path: `/V1.0/Companies/${destId}/Contacts`,
|
|
@@ -3091,7 +3091,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3091
3091
|
const createdBody = created;
|
|
3092
3092
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
3093
3093
|
if (typeof newId !== "number") {
|
|
3094
|
-
throw new (0,
|
|
3094
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
|
|
3095
3095
|
}
|
|
3096
3096
|
let sourceDeleted = false;
|
|
3097
3097
|
if (opts.deleteSource === true) {
|
|
@@ -3110,7 +3110,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
|
|
|
3110
3110
|
var EMAIL_SHAPE = /^.+@.+/;
|
|
3111
3111
|
var SAFE_CONTACT_CREATE_DEFAULTS = {};
|
|
3112
3112
|
var DEDUP_LIMIT = 10;
|
|
3113
|
-
var CompanyNotFoundError = class extends
|
|
3113
|
+
var CompanyNotFoundError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
3114
3114
|
constructor(message, options = {}) {
|
|
3115
3115
|
super(message, {
|
|
3116
3116
|
code: "COMPANY_NOT_FOUND",
|
|
@@ -3121,7 +3121,7 @@ var CompanyNotFoundError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
3121
3121
|
this.name = "CompanyNotFoundError";
|
|
3122
3122
|
}
|
|
3123
3123
|
};
|
|
3124
|
-
var ContactCreateFailedError = class extends
|
|
3124
|
+
var ContactCreateFailedError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
3125
3125
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
3126
3126
|
|
|
3127
3127
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -3131,25 +3131,25 @@ var ContactCreateFailedError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
3131
3131
|
}
|
|
3132
3132
|
};
|
|
3133
3133
|
async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
3134
|
-
const cid =
|
|
3134
|
+
const cid = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, companyID, "companyID");
|
|
3135
3135
|
if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
|
|
3136
|
-
throw new (0,
|
|
3136
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
3137
3137
|
`upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
|
|
3138
3138
|
{ operation: OP_UPSERT_EMAIL }
|
|
3139
3139
|
);
|
|
3140
3140
|
}
|
|
3141
3141
|
if (extra !== void 0) {
|
|
3142
3142
|
if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
|
|
3143
|
-
throw new (0,
|
|
3143
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
3144
3144
|
`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)})`,
|
|
3145
3145
|
{ operation: OP_UPSERT_EMAIL }
|
|
3146
3146
|
);
|
|
3147
3147
|
}
|
|
3148
3148
|
if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
|
|
3149
|
-
throw new (0,
|
|
3149
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
3150
3150
|
}
|
|
3151
3151
|
if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
|
|
3152
|
-
throw new (0,
|
|
3152
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
3155
|
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
|
|
@@ -3170,7 +3170,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3170
3170
|
const match = q.items[0];
|
|
3171
3171
|
if (match !== void 0) {
|
|
3172
3172
|
if (opts.dryRun === true) {
|
|
3173
|
-
return
|
|
3173
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
3174
3174
|
{
|
|
3175
3175
|
operation: OP_UPSERT_EMAIL,
|
|
3176
3176
|
method: "POST",
|
|
@@ -3200,7 +3200,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3200
3200
|
isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
|
|
3201
3201
|
};
|
|
3202
3202
|
if (opts.dryRun === true) {
|
|
3203
|
-
return
|
|
3203
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
3204
3204
|
{
|
|
3205
3205
|
operation: OP_UPSERT_EMAIL,
|
|
3206
3206
|
method: "POST",
|
|
@@ -3223,8 +3223,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3223
3223
|
const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
|
|
3224
3224
|
return { id: created.id, created: true };
|
|
3225
3225
|
} catch (err) {
|
|
3226
|
-
if (!
|
|
3227
|
-
const named = (_nullishCoalesce(
|
|
3226
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
3227
|
+
const named = (_nullishCoalesce(_chunkWRWX6WIKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
3228
3228
|
const seen = /* @__PURE__ */ new Set();
|
|
3229
3229
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
3230
3230
|
const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -3238,7 +3238,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3238
3238
|
}
|
|
3239
3239
|
continue;
|
|
3240
3240
|
}
|
|
3241
|
-
const detail =
|
|
3241
|
+
const detail = _chunkWRWX6WIKcjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
3242
3242
|
throw new ContactCreateFailedError(
|
|
3243
3243
|
`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}` : ""}`,
|
|
3244
3244
|
unique,
|
|
@@ -3255,7 +3255,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3255
3255
|
}
|
|
3256
3256
|
|
|
3257
3257
|
// src/resources/contacts.ts
|
|
3258
|
-
var ContactsResource = class extends
|
|
3258
|
+
var ContactsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3259
3259
|
constructor(http, pageSize) {
|
|
3260
3260
|
super(http, {
|
|
3261
3261
|
key: "contacts",
|
|
@@ -3347,7 +3347,7 @@ var ContactsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
3347
3347
|
};
|
|
3348
3348
|
|
|
3349
3349
|
// src/resources/contact_webhooks.ts
|
|
3350
|
-
var ContactWebhooksResource = class extends
|
|
3350
|
+
var ContactWebhooksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3351
3351
|
constructor(http, pageSize) {
|
|
3352
3352
|
super(http, {
|
|
3353
3353
|
key: "contact_webhooks",
|
|
@@ -3423,7 +3423,7 @@ var ContactWebhooksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
3423
3423
|
};
|
|
3424
3424
|
|
|
3425
3425
|
// src/resources/contract_billing_rules.ts
|
|
3426
|
-
var ContractBillingRulesResource = class extends
|
|
3426
|
+
var ContractBillingRulesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3427
3427
|
constructor(http, pageSize) {
|
|
3428
3428
|
super(http, {
|
|
3429
3429
|
key: "contract_billing_rules",
|
|
@@ -3489,7 +3489,7 @@ var ContractBillingRulesResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
3489
3489
|
};
|
|
3490
3490
|
|
|
3491
3491
|
// src/resources/contract_block_hour_factors.ts
|
|
3492
|
-
var ContractBlockHourFactorsResource = class extends
|
|
3492
|
+
var ContractBlockHourFactorsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3493
3493
|
constructor(http, pageSize) {
|
|
3494
3494
|
super(http, {
|
|
3495
3495
|
key: "contract_block_hour_factors",
|
|
@@ -3548,7 +3548,7 @@ var ContractBlockHourFactorsResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
3548
3548
|
};
|
|
3549
3549
|
|
|
3550
3550
|
// src/resources/contract_blocks.ts
|
|
3551
|
-
var ContractBlocksResource = class extends
|
|
3551
|
+
var ContractBlocksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3552
3552
|
constructor(http, pageSize) {
|
|
3553
3553
|
super(http, {
|
|
3554
3554
|
key: "contract_blocks",
|
|
@@ -3607,7 +3607,7 @@ var ContractBlocksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
3607
3607
|
};
|
|
3608
3608
|
|
|
3609
3609
|
// src/resources/contract_charges.ts
|
|
3610
|
-
var ContractChargesResource = class extends
|
|
3610
|
+
var ContractChargesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3611
3611
|
constructor(http, pageSize) {
|
|
3612
3612
|
super(http, {
|
|
3613
3613
|
key: "contract_charges",
|
|
@@ -3678,7 +3678,7 @@ var ContractChargesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
3678
3678
|
};
|
|
3679
3679
|
|
|
3680
3680
|
// src/resources/contract_exclusion_billing_codes.ts
|
|
3681
|
-
var ContractExclusionBillingCodesResource = class extends
|
|
3681
|
+
var ContractExclusionBillingCodesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3682
3682
|
constructor(http, pageSize) {
|
|
3683
3683
|
super(http, {
|
|
3684
3684
|
key: "contract_exclusion_billing_codes",
|
|
@@ -3735,7 +3735,7 @@ var ContractExclusionBillingCodesResource = class extends _chunk4RJG73GYcjs.Base
|
|
|
3735
3735
|
};
|
|
3736
3736
|
|
|
3737
3737
|
// src/resources/contract_exclusion_roles.ts
|
|
3738
|
-
var ContractExclusionRolesResource = class extends
|
|
3738
|
+
var ContractExclusionRolesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3739
3739
|
constructor(http, pageSize) {
|
|
3740
3740
|
super(http, {
|
|
3741
3741
|
key: "contract_exclusion_roles",
|
|
@@ -3792,7 +3792,7 @@ var ContractExclusionRolesResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
3792
3792
|
};
|
|
3793
3793
|
|
|
3794
3794
|
// src/resources/contract_exclusion_set_excluded_roles.ts
|
|
3795
|
-
var ContractExclusionSetExcludedRolesResource = class extends
|
|
3795
|
+
var ContractExclusionSetExcludedRolesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3796
3796
|
constructor(http, pageSize) {
|
|
3797
3797
|
super(http, {
|
|
3798
3798
|
key: "contract_exclusion_set_excluded_roles",
|
|
@@ -3849,7 +3849,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunk4RJG73GYcjs.
|
|
|
3849
3849
|
};
|
|
3850
3850
|
|
|
3851
3851
|
// src/resources/contract_exclusion_set_excluded_work_types.ts
|
|
3852
|
-
var ContractExclusionSetExcludedWorkTypesResource = class extends
|
|
3852
|
+
var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3853
3853
|
constructor(http, pageSize) {
|
|
3854
3854
|
super(http, {
|
|
3855
3855
|
key: "contract_exclusion_set_excluded_work_types",
|
|
@@ -3906,7 +3906,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunk4RJG73GY
|
|
|
3906
3906
|
};
|
|
3907
3907
|
|
|
3908
3908
|
// src/resources/contract_exclusion_sets.ts
|
|
3909
|
-
var ContractExclusionSetsResource = class extends
|
|
3909
|
+
var ContractExclusionSetsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3910
3910
|
constructor(http, pageSize) {
|
|
3911
3911
|
super(http, {
|
|
3912
3912
|
key: "contract_exclusion_sets",
|
|
@@ -3980,7 +3980,7 @@ var ContractExclusionSetsResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
3980
3980
|
};
|
|
3981
3981
|
|
|
3982
3982
|
// src/resources/contract_milestones.ts
|
|
3983
|
-
var ContractMilestonesResource = class extends
|
|
3983
|
+
var ContractMilestonesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
3984
3984
|
constructor(http, pageSize) {
|
|
3985
3985
|
super(http, {
|
|
3986
3986
|
key: "contract_milestones",
|
|
@@ -4039,7 +4039,7 @@ var ContractMilestonesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4039
4039
|
};
|
|
4040
4040
|
|
|
4041
4041
|
// src/resources/contract_notes.ts
|
|
4042
|
-
var ContractNotesResource = class extends
|
|
4042
|
+
var ContractNotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4043
4043
|
constructor(http, pageSize) {
|
|
4044
4044
|
super(http, {
|
|
4045
4045
|
key: "contract_notes",
|
|
@@ -4098,7 +4098,7 @@ var ContractNotesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4098
4098
|
};
|
|
4099
4099
|
|
|
4100
4100
|
// src/resources/contract_rates.ts
|
|
4101
|
-
var ContractRatesResource = class extends
|
|
4101
|
+
var ContractRatesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4102
4102
|
constructor(http, pageSize) {
|
|
4103
4103
|
super(http, {
|
|
4104
4104
|
key: "contract_rates",
|
|
@@ -4157,7 +4157,7 @@ var ContractRatesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4157
4157
|
};
|
|
4158
4158
|
|
|
4159
4159
|
// src/resources/contract_retainers.ts
|
|
4160
|
-
var ContractRetainersResource = class extends
|
|
4160
|
+
var ContractRetainersResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4161
4161
|
constructor(http, pageSize) {
|
|
4162
4162
|
super(http, {
|
|
4163
4163
|
key: "contract_retainers",
|
|
@@ -4216,7 +4216,7 @@ var ContractRetainersResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4216
4216
|
};
|
|
4217
4217
|
|
|
4218
4218
|
// src/resources/contract_role_costs.ts
|
|
4219
|
-
var ContractRoleCostsResource = class extends
|
|
4219
|
+
var ContractRoleCostsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4220
4220
|
constructor(http, pageSize) {
|
|
4221
4221
|
super(http, {
|
|
4222
4222
|
key: "contract_role_costs",
|
|
@@ -4275,7 +4275,7 @@ var ContractRoleCostsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4275
4275
|
};
|
|
4276
4276
|
|
|
4277
4277
|
// src/resources/contract_service_adjustments.ts
|
|
4278
|
-
var ContractServiceAdjustmentsResource = class extends
|
|
4278
|
+
var ContractServiceAdjustmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4279
4279
|
constructor(http, pageSize) {
|
|
4280
4280
|
super(http, {
|
|
4281
4281
|
key: "contract_service_adjustments",
|
|
@@ -4309,7 +4309,7 @@ var ContractServiceAdjustmentsResource = class extends _chunk4RJG73GYcjs.BaseRes
|
|
|
4309
4309
|
};
|
|
4310
4310
|
|
|
4311
4311
|
// src/resources/contract_service_bundle_adjustments.ts
|
|
4312
|
-
var ContractServiceBundleAdjustmentsResource = class extends
|
|
4312
|
+
var ContractServiceBundleAdjustmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4313
4313
|
constructor(http, pageSize) {
|
|
4314
4314
|
super(http, {
|
|
4315
4315
|
key: "contract_service_bundle_adjustments",
|
|
@@ -4343,7 +4343,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunk4RJG73GYcjs.B
|
|
|
4343
4343
|
};
|
|
4344
4344
|
|
|
4345
4345
|
// src/resources/contract_service_bundles.ts
|
|
4346
|
-
var ContractServiceBundlesResource = class extends
|
|
4346
|
+
var ContractServiceBundlesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4347
4347
|
constructor(http, pageSize) {
|
|
4348
4348
|
super(http, {
|
|
4349
4349
|
key: "contract_service_bundles",
|
|
@@ -4402,7 +4402,7 @@ var ContractServiceBundlesResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
4402
4402
|
};
|
|
4403
4403
|
|
|
4404
4404
|
// src/resources/contract_service_bundle_units.ts
|
|
4405
|
-
var ContractServiceBundleUnitsResource = class extends
|
|
4405
|
+
var ContractServiceBundleUnitsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4406
4406
|
constructor(http, pageSize) {
|
|
4407
4407
|
super(http, {
|
|
4408
4408
|
key: "contract_service_bundle_units",
|
|
@@ -4444,7 +4444,7 @@ var ContractServiceBundleUnitsResource = class extends _chunk4RJG73GYcjs.BaseRes
|
|
|
4444
4444
|
};
|
|
4445
4445
|
|
|
4446
4446
|
// src/resources/contract_services.ts
|
|
4447
|
-
var ContractServicesResource = class extends
|
|
4447
|
+
var ContractServicesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4448
4448
|
constructor(http, pageSize) {
|
|
4449
4449
|
super(http, {
|
|
4450
4450
|
key: "contract_services",
|
|
@@ -4503,7 +4503,7 @@ var ContractServicesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
4503
4503
|
};
|
|
4504
4504
|
|
|
4505
4505
|
// src/resources/contract_service_units.ts
|
|
4506
|
-
var ContractServiceUnitsResource = class extends
|
|
4506
|
+
var ContractServiceUnitsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
4507
4507
|
constructor(http, pageSize) {
|
|
4508
4508
|
super(http, {
|
|
4509
4509
|
key: "contract_service_units",
|
|
@@ -4695,7 +4695,7 @@ function dateToDay(v) {
|
|
|
4695
4695
|
}
|
|
4696
4696
|
function validateProfitabilityOptions(contractId, opts) {
|
|
4697
4697
|
if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
4698
|
-
throw new (0,
|
|
4698
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
4699
4699
|
`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})`,
|
|
4700
4700
|
{ operation: "contracts.profitability" }
|
|
4701
4701
|
);
|
|
@@ -4772,12 +4772,12 @@ function validateProfitabilityOptions(contractId, opts) {
|
|
|
4772
4772
|
}
|
|
4773
4773
|
}
|
|
4774
4774
|
try {
|
|
4775
|
-
|
|
4775
|
+
_chunkWRWX6WIKcjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
4776
4776
|
} catch (err) {
|
|
4777
|
-
problems.push(err instanceof
|
|
4777
|
+
problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
|
|
4778
4778
|
}
|
|
4779
4779
|
if (problems.length > 0) {
|
|
4780
|
-
throw new (0,
|
|
4780
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
4781
4781
|
`profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
4782
4782
|
- ` + problems.join("\n- "),
|
|
4783
4783
|
{ operation: "contracts.profitability" }
|
|
@@ -4808,7 +4808,7 @@ async function boundedPart2(http, path, conditions, limit, operation, includeFie
|
|
|
4808
4808
|
body,
|
|
4809
4809
|
operation
|
|
4810
4810
|
});
|
|
4811
|
-
const { items, pageDetails } =
|
|
4811
|
+
const { items, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, operation);
|
|
4812
4812
|
const capped = items.length >= limit;
|
|
4813
4813
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
4814
4814
|
}
|
|
@@ -4822,23 +4822,23 @@ async function fetchByIdsPart(http, entityPath, ids, fields, operation, entity)
|
|
|
4822
4822
|
const byKey = /* @__PURE__ */ new Map();
|
|
4823
4823
|
const misses = [];
|
|
4824
4824
|
const notes = [];
|
|
4825
|
-
for (let c = 0; c < unique.length; c +=
|
|
4826
|
-
const chunk = unique.slice(c, c +
|
|
4825
|
+
for (let c = 0; c < unique.length; c += _chunkWRWX6WIKcjs.FETCH_BY_IDS_CHUNK_SIZE) {
|
|
4826
|
+
const chunk = unique.slice(c, c + _chunkWRWX6WIKcjs.FETCH_BY_IDS_CHUNK_SIZE);
|
|
4827
4827
|
const chunkKeys = new Set(chunk);
|
|
4828
4828
|
try {
|
|
4829
4829
|
const body = {
|
|
4830
|
-
MaxRecords:
|
|
4830
|
+
MaxRecords: _chunkWRWX6WIKcjs.FETCH_BY_IDS_CHUNK_SIZE,
|
|
4831
4831
|
filter: [{ field: "id", op: "in", value: chunk }],
|
|
4832
4832
|
IncludeFields: fields
|
|
4833
4833
|
};
|
|
4834
4834
|
const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
|
|
4835
|
-
const { items: rows } =
|
|
4835
|
+
const { items: rows } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, operation);
|
|
4836
4836
|
for (const row of rows) {
|
|
4837
4837
|
const k = num2(row.id);
|
|
4838
4838
|
if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
|
|
4839
4839
|
}
|
|
4840
4840
|
} catch (err) {
|
|
4841
|
-
const code = err instanceof
|
|
4841
|
+
const code = err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.code : "SERVER_ERROR";
|
|
4842
4842
|
for (const k of chunk) {
|
|
4843
4843
|
if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
|
|
4844
4844
|
}
|
|
@@ -4848,11 +4848,11 @@ async function fetchByIdsPart(http, entityPath, ids, fields, operation, entity)
|
|
|
4848
4848
|
for (const k of queryMissed) {
|
|
4849
4849
|
try {
|
|
4850
4850
|
const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
|
|
4851
|
-
byKey.set(k,
|
|
4851
|
+
byKey.set(k, _chunkWRWX6WIKcjs.unwrapItem.call(void 0, res, k, operation, entity));
|
|
4852
4852
|
} catch (err) {
|
|
4853
|
-
if (err instanceof
|
|
4853
|
+
if (err instanceof _chunkWRWX6WIKcjs.NotFoundError) {
|
|
4854
4854
|
misses.push({ id: k, code: "NOT_FOUND", message: err.message });
|
|
4855
|
-
} else if (err instanceof
|
|
4855
|
+
} else if (err instanceof _chunkWRWX6WIKcjs.AutotaskError) {
|
|
4856
4856
|
misses.push({ id: k, code: err.code, message: err.message });
|
|
4857
4857
|
} else {
|
|
4858
4858
|
misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
|
|
@@ -4975,7 +4975,7 @@ async function degradable(read) {
|
|
|
4975
4975
|
try {
|
|
4976
4976
|
return await read();
|
|
4977
4977
|
} catch (err) {
|
|
4978
|
-
if (!(err instanceof
|
|
4978
|
+
if (!(err instanceof _chunkWRWX6WIKcjs.AutotaskError)) throw err;
|
|
4979
4979
|
return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
|
|
4980
4980
|
}
|
|
4981
4981
|
}
|
|
@@ -4996,7 +4996,7 @@ function dedupeSortCap(ids, limit) {
|
|
|
4996
4996
|
async function profitability(resource, contractId, opts, rawHttp) {
|
|
4997
4997
|
const v = validateProfitabilityOptions(contractId, opts);
|
|
4998
4998
|
const OP2 = "contracts.profitability";
|
|
4999
|
-
const id =
|
|
4999
|
+
const id = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
5000
5000
|
const idNum = typeof id === "number" ? id : Number(id);
|
|
5001
5001
|
const wires = { issued: 0, requests: 0, budget: PROFITABILITY_WIRE_BUDGET };
|
|
5002
5002
|
const asOf = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5024,7 +5024,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5024
5024
|
status: st.status,
|
|
5025
5025
|
blindSurface: st.blindSurface,
|
|
5026
5026
|
note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
|
|
5027
|
-
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([
|
|
5027
|
+
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkWRWX6WIKcjs.EMPTY_REASON_STAMPS, 'access', _31 => _31[key], 'optionalAccess', _32 => _32.query]) : void 0
|
|
5028
5028
|
};
|
|
5029
5029
|
};
|
|
5030
5030
|
const truncatedMonths = {};
|
|
@@ -5054,12 +5054,12 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5054
5054
|
path: `/V1.0/Companies/${companyID}`,
|
|
5055
5055
|
operation: OP2
|
|
5056
5056
|
});
|
|
5057
|
-
const item =
|
|
5057
|
+
const item = _chunkWRWX6WIKcjs.unwrapItem.call(void 0, res, companyID, OP2, "company");
|
|
5058
5058
|
customer = _nullishCoalesce(item, () => ( null));
|
|
5059
5059
|
customerStatus = "ok";
|
|
5060
5060
|
} catch (err) {
|
|
5061
|
-
if (!(err instanceof
|
|
5062
|
-
if (!(err instanceof
|
|
5061
|
+
if (!(err instanceof _chunkWRWX6WIKcjs.AutotaskError)) throw err;
|
|
5062
|
+
if (!(err instanceof _chunkWRWX6WIKcjs.NotFoundError)) {
|
|
5063
5063
|
customerStatus = "absent";
|
|
5064
5064
|
customerAbsent = err.code;
|
|
5065
5065
|
}
|
|
@@ -5072,7 +5072,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5072
5072
|
try {
|
|
5073
5073
|
contractTypeLabel = await _asyncNullishCoalesce(await _asyncOptionalChain([(await readPicklists(http, "/V1.0/Contracts", OP2)), 'access', async _36 => _36.get, 'call', async _37 => _37("contractType"), 'optionalAccess', async _38 => _38.get, 'call', async _39 => _39(contractType)]), async () => ( null));
|
|
5074
5074
|
} catch (err) {
|
|
5075
|
-
if (!(err instanceof
|
|
5075
|
+
if (!(err instanceof _chunkWRWX6WIKcjs.AutotaskError)) throw err;
|
|
5076
5076
|
}
|
|
5077
5077
|
}
|
|
5078
5078
|
const contractTypeKnown = contractTypeLabel !== null;
|
|
@@ -5119,8 +5119,8 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5119
5119
|
if (invoiceIds.length === 0) {
|
|
5120
5120
|
invoicesPart = skipPart("skipped: the billing part has no invoiceIDs (zero wire)");
|
|
5121
5121
|
} else {
|
|
5122
|
-
const capped = capJoinSet2(invoiceIds,
|
|
5123
|
-
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `invoiceJoinTruncated: the join set is capped at ${
|
|
5122
|
+
const capped = capJoinSet2(invoiceIds, _chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5123
|
+
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `invoiceJoinTruncated: the join set is capped at ${_chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`;
|
|
5124
5124
|
const fb = await fetchByIdsPart(http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], OP2, "invoice");
|
|
5125
5125
|
wires.issued += 1;
|
|
5126
5126
|
invoices = fb.items;
|
|
@@ -5152,7 +5152,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5152
5152
|
}
|
|
5153
5153
|
}
|
|
5154
5154
|
} catch (err) {
|
|
5155
|
-
statusNote = `the tickets.status field catalog read failed (${err instanceof
|
|
5155
|
+
statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkWRWX6WIKcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
|
|
5156
5156
|
}
|
|
5157
5157
|
let ticketsOpenPart;
|
|
5158
5158
|
let openTickets = [];
|
|
@@ -5171,8 +5171,8 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5171
5171
|
if (resourceIds.length === 0) {
|
|
5172
5172
|
resourcesPart = skipPart("skipped: the time part has no resourceIDs (zero wire)");
|
|
5173
5173
|
} else {
|
|
5174
|
-
const capped = capJoinSet2(resourceIds,
|
|
5175
|
-
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `resourceJoinTruncated: the join set is capped at ${
|
|
5174
|
+
const capped = capJoinSet2(resourceIds, _chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5175
|
+
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `resourceJoinTruncated: the join set is capped at ${_chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`;
|
|
5176
5176
|
const fb = await fetchByIdsPart(http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], OP2, "resource");
|
|
5177
5177
|
wires.issued += 1;
|
|
5178
5178
|
resources = fb.items;
|
|
@@ -5229,7 +5229,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5229
5229
|
if (cis.length === 0) {
|
|
5230
5230
|
subscriptionsPart = skipPart("skipped: the CI join found no configuration items \u2014 the subscriptions part is not evaluable (zero wire)");
|
|
5231
5231
|
} else {
|
|
5232
|
-
const ciIds = capJoinSet2(cis.map((c) => num2(c["id"])).filter((n) => n > 0),
|
|
5232
|
+
const ciIds = capJoinSet2(cis.map((c) => num2(c["id"])).filter((n) => n > 0), _chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5233
5233
|
const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
|
|
5234
5234
|
const raw = await readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
|
|
5235
5235
|
subscriptions = raw.items;
|
|
@@ -5239,7 +5239,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5239
5239
|
try {
|
|
5240
5240
|
labels = await readPicklists(http, "/V1.0/Subscriptions", OP2);
|
|
5241
5241
|
} catch (err) {
|
|
5242
|
-
if (!(err instanceof
|
|
5242
|
+
if (!(err instanceof _chunkWRWX6WIKcjs.AutotaskError)) throw err;
|
|
5243
5243
|
}
|
|
5244
5244
|
}
|
|
5245
5245
|
for (const x of subscriptions) {
|
|
@@ -5801,7 +5801,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5801
5801
|
}
|
|
5802
5802
|
|
|
5803
5803
|
// src/resources/contracts.ts
|
|
5804
|
-
var ContractsResource = class extends
|
|
5804
|
+
var ContractsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
5805
5805
|
constructor(http, pageSize) {
|
|
5806
5806
|
super(http, {
|
|
5807
5807
|
key: "contracts",
|
|
@@ -5872,7 +5872,7 @@ var ContractsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
5872
5872
|
};
|
|
5873
5873
|
|
|
5874
5874
|
// src/resources/contract_ticket_purchases.ts
|
|
5875
|
-
var ContractTicketPurchasesResource = class extends
|
|
5875
|
+
var ContractTicketPurchasesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
5876
5876
|
constructor(http, pageSize) {
|
|
5877
5877
|
super(http, {
|
|
5878
5878
|
key: "contract_ticket_purchases",
|
|
@@ -5931,7 +5931,7 @@ var ContractTicketPurchasesResource = class extends _chunk4RJG73GYcjs.BaseResour
|
|
|
5931
5931
|
};
|
|
5932
5932
|
|
|
5933
5933
|
// src/resources/countries.ts
|
|
5934
|
-
var CountriesResource = class extends
|
|
5934
|
+
var CountriesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
5935
5935
|
constructor(http, pageSize) {
|
|
5936
5936
|
super(http, {
|
|
5937
5937
|
key: "countries",
|
|
@@ -5990,7 +5990,7 @@ var CountriesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
5990
5990
|
};
|
|
5991
5991
|
|
|
5992
5992
|
// src/resources/departments.ts
|
|
5993
|
-
var DepartmentsResource = class extends
|
|
5993
|
+
var DepartmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
5994
5994
|
constructor(http, pageSize) {
|
|
5995
5995
|
super(http, {
|
|
5996
5996
|
key: "departments",
|
|
@@ -6057,7 +6057,7 @@ var DepartmentsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6057
6057
|
};
|
|
6058
6058
|
|
|
6059
6059
|
// src/resources/domain_registrars.ts
|
|
6060
|
-
var DomainRegistrarsResource = class extends
|
|
6060
|
+
var DomainRegistrarsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6061
6061
|
constructor(http, pageSize) {
|
|
6062
6062
|
super(http, {
|
|
6063
6063
|
key: "domain_registrars",
|
|
@@ -6140,7 +6140,7 @@ var EntityInformationResource = class {
|
|
|
6140
6140
|
};
|
|
6141
6141
|
|
|
6142
6142
|
// src/resources/expense_item_attachments.ts
|
|
6143
|
-
var ExpenseItemAttachmentsResource = class extends
|
|
6143
|
+
var ExpenseItemAttachmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6144
6144
|
constructor(http, pageSize) {
|
|
6145
6145
|
super(http, {
|
|
6146
6146
|
key: "expense_item_attachments",
|
|
@@ -6202,7 +6202,7 @@ var ExpenseItemAttachmentsResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
6202
6202
|
};
|
|
6203
6203
|
|
|
6204
6204
|
// src/resources/expense_items.ts
|
|
6205
|
-
var ExpenseItemsResource = class extends
|
|
6205
|
+
var ExpenseItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6206
6206
|
constructor(http, pageSize) {
|
|
6207
6207
|
super(http, {
|
|
6208
6208
|
key: "expense_items",
|
|
@@ -6261,7 +6261,7 @@ var ExpenseItemsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6261
6261
|
};
|
|
6262
6262
|
|
|
6263
6263
|
// src/resources/expense_reports.ts
|
|
6264
|
-
var ExpenseReportsResource = class extends
|
|
6264
|
+
var ExpenseReportsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6265
6265
|
constructor(http, pageSize) {
|
|
6266
6266
|
super(http, {
|
|
6267
6267
|
key: "expense_reports",
|
|
@@ -6328,7 +6328,7 @@ var ExpenseReportsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6328
6328
|
};
|
|
6329
6329
|
|
|
6330
6330
|
// src/resources/holiday_sets.ts
|
|
6331
|
-
var HolidaySetsResource = class extends
|
|
6331
|
+
var HolidaySetsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6332
6332
|
constructor(http, pageSize) {
|
|
6333
6333
|
super(http, {
|
|
6334
6334
|
key: "holiday_sets",
|
|
@@ -6397,7 +6397,7 @@ var HolidaySetsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6397
6397
|
};
|
|
6398
6398
|
|
|
6399
6399
|
// src/resources/holidays.ts
|
|
6400
|
-
var HolidaysResource = class extends
|
|
6400
|
+
var HolidaysResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6401
6401
|
constructor(http, pageSize) {
|
|
6402
6402
|
super(http, {
|
|
6403
6403
|
key: "holidays",
|
|
@@ -6469,10 +6469,10 @@ var PATH_SUFFIX = {
|
|
|
6469
6469
|
transfer: "StockedItemsTransfer"
|
|
6470
6470
|
};
|
|
6471
6471
|
async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
6472
|
-
const numericParent =
|
|
6472
|
+
const numericParent = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, parentId, "parentId");
|
|
6473
6473
|
const suffix = PATH_SUFFIX[kind];
|
|
6474
6474
|
if (opts.dryRun === true) {
|
|
6475
|
-
return
|
|
6475
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
6476
6476
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6477
6477
|
method: "POST",
|
|
6478
6478
|
path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
|
|
@@ -6489,11 +6489,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
|
6489
6489
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6490
6490
|
maxRetries: opts.maxRetries
|
|
6491
6491
|
});
|
|
6492
|
-
return
|
|
6492
|
+
return _chunkWRWX6WIKcjs.unwrapOperation.call(void 0, res);
|
|
6493
6493
|
}
|
|
6494
6494
|
|
|
6495
6495
|
// src/resources/inventory_products.ts
|
|
6496
|
-
var InventoryProductsResource = class extends
|
|
6496
|
+
var InventoryProductsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6497
6497
|
constructor(http, pageSize) {
|
|
6498
6498
|
super(http, {
|
|
6499
6499
|
key: "inventory_products",
|
|
@@ -6575,7 +6575,7 @@ var InventoryProductsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6575
6575
|
|
|
6576
6576
|
// src/resources/special/invoices.ts
|
|
6577
6577
|
async function markup(_resource, id, format, http) {
|
|
6578
|
-
const numericId =
|
|
6578
|
+
const numericId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
6579
6579
|
const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
|
|
6580
6580
|
const res = await http.request({
|
|
6581
6581
|
method: "GET",
|
|
@@ -6584,7 +6584,7 @@ async function markup(_resource, id, format, http) {
|
|
|
6584
6584
|
});
|
|
6585
6585
|
const body = res;
|
|
6586
6586
|
if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
|
|
6587
|
-
throw new (0,
|
|
6587
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
|
|
6588
6588
|
`Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
|
|
6589
6589
|
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
|
|
6590
6590
|
);
|
|
@@ -6592,13 +6592,13 @@ async function markup(_resource, id, format, http) {
|
|
|
6592
6592
|
return body.invoiceMarkup;
|
|
6593
6593
|
}
|
|
6594
6594
|
async function pdf(_resource, id, http) {
|
|
6595
|
-
const numericId =
|
|
6595
|
+
const numericId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
6596
6596
|
const res = await http.request({
|
|
6597
6597
|
method: "GET",
|
|
6598
6598
|
path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
|
|
6599
6599
|
operation: "invoices.pdf"
|
|
6600
6600
|
});
|
|
6601
|
-
return
|
|
6601
|
+
return _chunkWRWX6WIKcjs.decodeFileData.call(void 0, res);
|
|
6602
6602
|
}
|
|
6603
6603
|
async function windowQuery2(_resource, kind, http, opts) {
|
|
6604
6604
|
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _48 => _48.now]), () => ( /* @__PURE__ */ new Date()));
|
|
@@ -6629,7 +6629,7 @@ async function customRange2(_resource, from, to, http, opts) {
|
|
|
6629
6629
|
}
|
|
6630
6630
|
|
|
6631
6631
|
// src/resources/invoices.ts
|
|
6632
|
-
var InvoicesResource = class extends
|
|
6632
|
+
var InvoicesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6633
6633
|
constructor(http, pageSize) {
|
|
6634
6634
|
super(http, {
|
|
6635
6635
|
key: "invoices",
|
|
@@ -6759,7 +6759,7 @@ var ModulesResource = class {
|
|
|
6759
6759
|
};
|
|
6760
6760
|
|
|
6761
6761
|
// src/resources/notification_history.ts
|
|
6762
|
-
var NotificationHistoryResource = class extends
|
|
6762
|
+
var NotificationHistoryResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6763
6763
|
constructor(http, pageSize) {
|
|
6764
6764
|
super(http, {
|
|
6765
6765
|
key: "notification_history",
|
|
@@ -6798,7 +6798,7 @@ var NotificationHistoryResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6798
6798
|
};
|
|
6799
6799
|
|
|
6800
6800
|
// src/resources/opportunities.ts
|
|
6801
|
-
var OpportunitiesResource = class extends
|
|
6801
|
+
var OpportunitiesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6802
6802
|
constructor(http, pageSize) {
|
|
6803
6803
|
super(http, {
|
|
6804
6804
|
key: "opportunities",
|
|
@@ -6860,7 +6860,7 @@ var OpportunitiesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
6860
6860
|
};
|
|
6861
6861
|
|
|
6862
6862
|
// src/resources/opportunity_attachments.ts
|
|
6863
|
-
var OpportunityAttachmentsResource = class extends
|
|
6863
|
+
var OpportunityAttachmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6864
6864
|
constructor(http, pageSize) {
|
|
6865
6865
|
super(http, {
|
|
6866
6866
|
key: "opportunity_attachments",
|
|
@@ -6922,7 +6922,7 @@ var OpportunityAttachmentsResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
6922
6922
|
};
|
|
6923
6923
|
|
|
6924
6924
|
// src/resources/opportunity_categories.ts
|
|
6925
|
-
var OpportunityCategoriesResource = class extends
|
|
6925
|
+
var OpportunityCategoriesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6926
6926
|
constructor(http, pageSize) {
|
|
6927
6927
|
super(http, {
|
|
6928
6928
|
key: "opportunity_categories",
|
|
@@ -6981,7 +6981,7 @@ var OpportunityCategoriesResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
6981
6981
|
};
|
|
6982
6982
|
|
|
6983
6983
|
// src/resources/phases.ts
|
|
6984
|
-
var PhasesResource = class extends
|
|
6984
|
+
var PhasesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
6985
6985
|
constructor(http, pageSize) {
|
|
6986
6986
|
super(http, {
|
|
6987
6987
|
key: "phases",
|
|
@@ -7040,7 +7040,7 @@ var PhasesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7040
7040
|
};
|
|
7041
7041
|
|
|
7042
7042
|
// src/resources/products.ts
|
|
7043
|
-
var ProductsResource = class extends
|
|
7043
|
+
var ProductsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7044
7044
|
constructor(http, pageSize) {
|
|
7045
7045
|
super(http, {
|
|
7046
7046
|
key: "products",
|
|
@@ -7107,7 +7107,7 @@ var ProductsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7107
7107
|
};
|
|
7108
7108
|
|
|
7109
7109
|
// src/resources/product_vendors.ts
|
|
7110
|
-
var ProductVendorsResource = class extends
|
|
7110
|
+
var ProductVendorsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7111
7111
|
constructor(http, pageSize) {
|
|
7112
7112
|
super(http, {
|
|
7113
7113
|
key: "product_vendors",
|
|
@@ -7166,7 +7166,7 @@ var ProductVendorsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7166
7166
|
};
|
|
7167
7167
|
|
|
7168
7168
|
// src/resources/project_charges.ts
|
|
7169
|
-
var ProjectChargesResource = class extends
|
|
7169
|
+
var ProjectChargesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7170
7170
|
constructor(http, pageSize) {
|
|
7171
7171
|
super(http, {
|
|
7172
7172
|
key: "project_charges",
|
|
@@ -7237,7 +7237,7 @@ var ProjectChargesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7237
7237
|
};
|
|
7238
7238
|
|
|
7239
7239
|
// src/resources/project_notes.ts
|
|
7240
|
-
var ProjectNotesResource = class extends
|
|
7240
|
+
var ProjectNotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7241
7241
|
constructor(http, pageSize) {
|
|
7242
7242
|
super(http, {
|
|
7243
7243
|
key: "project_notes",
|
|
@@ -7296,7 +7296,7 @@ var ProjectNotesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7296
7296
|
};
|
|
7297
7297
|
|
|
7298
7298
|
// src/resources/projects.ts
|
|
7299
|
-
var ProjectsResource = class extends
|
|
7299
|
+
var ProjectsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7300
7300
|
constructor(http, pageSize) {
|
|
7301
7301
|
super(http, {
|
|
7302
7302
|
key: "projects",
|
|
@@ -7373,13 +7373,13 @@ var ProjectsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7373
7373
|
const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
|
|
7374
7374
|
const result = { project, company, opportunity, leadResource };
|
|
7375
7375
|
if (opts.names === true) {
|
|
7376
|
-
const builder =
|
|
7376
|
+
const builder = _chunkWRWX6WIKcjs.createNamePlan.call(void 0, );
|
|
7377
7377
|
builder.addResource(root["creatorResourceID"]);
|
|
7378
7378
|
builder.addFk("contract", root["contractID"]);
|
|
7379
|
-
const names = await
|
|
7379
|
+
const names = await _chunkWRWX6WIKcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
7380
7380
|
const row = { ...project };
|
|
7381
|
-
|
|
7382
|
-
|
|
7381
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
|
|
7382
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
7383
7383
|
result.project = row;
|
|
7384
7384
|
result.names = names.section;
|
|
7385
7385
|
}
|
|
@@ -7388,7 +7388,7 @@ var ProjectsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7388
7388
|
};
|
|
7389
7389
|
|
|
7390
7390
|
// src/resources/purchase_approvals.ts
|
|
7391
|
-
var PurchaseApprovalsResource = class extends
|
|
7391
|
+
var PurchaseApprovalsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7392
7392
|
constructor(http, pageSize) {
|
|
7393
7393
|
super(http, {
|
|
7394
7394
|
key: "purchase_approvals",
|
|
@@ -7442,7 +7442,7 @@ var PurchaseApprovalsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7442
7442
|
};
|
|
7443
7443
|
|
|
7444
7444
|
// src/resources/purchase_order_item_receiving.ts
|
|
7445
|
-
var PurchaseOrderItemReceivingResource = class extends
|
|
7445
|
+
var PurchaseOrderItemReceivingResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7446
7446
|
constructor(http, pageSize) {
|
|
7447
7447
|
super(http, {
|
|
7448
7448
|
key: "purchase_order_item_receiving",
|
|
@@ -7492,7 +7492,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunk4RJG73GYcjs.BaseRes
|
|
|
7492
7492
|
};
|
|
7493
7493
|
|
|
7494
7494
|
// src/resources/purchase_order_items.ts
|
|
7495
|
-
var PurchaseOrderItemsResource = class extends
|
|
7495
|
+
var PurchaseOrderItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7496
7496
|
constructor(http, pageSize) {
|
|
7497
7497
|
super(http, {
|
|
7498
7498
|
key: "purchase_order_items",
|
|
@@ -7551,7 +7551,7 @@ var PurchaseOrderItemsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7551
7551
|
};
|
|
7552
7552
|
|
|
7553
7553
|
// src/resources/purchase_orders.ts
|
|
7554
|
-
var PurchaseOrdersResource = class extends
|
|
7554
|
+
var PurchaseOrdersResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7555
7555
|
constructor(http, pageSize) {
|
|
7556
7556
|
super(http, {
|
|
7557
7557
|
key: "purchase_orders",
|
|
@@ -7613,7 +7613,7 @@ var PurchaseOrdersResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7613
7613
|
};
|
|
7614
7614
|
|
|
7615
7615
|
// src/resources/quote_items.ts
|
|
7616
|
-
var QuoteItemsResource = class extends
|
|
7616
|
+
var QuoteItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7617
7617
|
constructor(http, pageSize) {
|
|
7618
7618
|
super(http, {
|
|
7619
7619
|
key: "quote_items",
|
|
@@ -7684,7 +7684,7 @@ var QuoteItemsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7684
7684
|
};
|
|
7685
7685
|
|
|
7686
7686
|
// src/resources/quote_locations.ts
|
|
7687
|
-
var QuoteLocationsResource = class extends
|
|
7687
|
+
var QuoteLocationsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7688
7688
|
constructor(http, pageSize) {
|
|
7689
7689
|
super(http, {
|
|
7690
7690
|
key: "quote_locations",
|
|
@@ -7749,7 +7749,7 @@ var QuoteLocationsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7749
7749
|
};
|
|
7750
7750
|
|
|
7751
7751
|
// src/resources/quotes.ts
|
|
7752
|
-
var QuotesResource = class extends
|
|
7752
|
+
var QuotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7753
7753
|
constructor(http, pageSize) {
|
|
7754
7754
|
super(http, {
|
|
7755
7755
|
key: "quotes",
|
|
@@ -7816,7 +7816,7 @@ var QuotesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7816
7816
|
};
|
|
7817
7817
|
|
|
7818
7818
|
// src/resources/quote_templates.ts
|
|
7819
|
-
var QuoteTemplatesResource = class extends
|
|
7819
|
+
var QuoteTemplatesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7820
7820
|
constructor(http, pageSize) {
|
|
7821
7821
|
super(http, {
|
|
7822
7822
|
key: "quote_templates",
|
|
@@ -7860,7 +7860,7 @@ var QuoteTemplatesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7860
7860
|
};
|
|
7861
7861
|
|
|
7862
7862
|
// src/resources/resource_role_queues.ts
|
|
7863
|
-
var ResourceRoleQueuesResource = class extends
|
|
7863
|
+
var ResourceRoleQueuesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7864
7864
|
constructor(http, pageSize) {
|
|
7865
7865
|
super(http, {
|
|
7866
7866
|
key: "resource_role_queues",
|
|
@@ -7919,7 +7919,7 @@ var ResourceRoleQueuesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7919
7919
|
};
|
|
7920
7920
|
|
|
7921
7921
|
// src/resources/resource_roles.ts
|
|
7922
|
-
var ResourceRolesResource = class extends
|
|
7922
|
+
var ResourceRolesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7923
7923
|
constructor(http, pageSize) {
|
|
7924
7924
|
super(http, {
|
|
7925
7925
|
key: "resource_roles",
|
|
@@ -7961,7 +7961,7 @@ var ResourceRolesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
7961
7961
|
};
|
|
7962
7962
|
|
|
7963
7963
|
// src/resources/resource_skills.ts
|
|
7964
|
-
var ResourceSkillsResource = class extends
|
|
7964
|
+
var ResourceSkillsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
7965
7965
|
constructor(http, pageSize) {
|
|
7966
7966
|
super(http, {
|
|
7967
7967
|
key: "resource_skills",
|
|
@@ -8015,16 +8015,16 @@ var ResourceSkillsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8015
8015
|
var MAX_TRANSFER_IDS = 500;
|
|
8016
8016
|
function requirePositiveIds(ids, label) {
|
|
8017
8017
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
8018
|
-
throw new (0,
|
|
8018
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
|
|
8019
8019
|
}
|
|
8020
8020
|
if (ids.length > MAX_TRANSFER_IDS) {
|
|
8021
|
-
throw new (0,
|
|
8021
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
|
|
8022
8022
|
}
|
|
8023
8023
|
const out = [];
|
|
8024
8024
|
for (const raw of ids) {
|
|
8025
|
-
const id =
|
|
8025
|
+
const id = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, raw, `${label} id`);
|
|
8026
8026
|
if (typeof id === "number" && id < 1) {
|
|
8027
|
-
throw new (0,
|
|
8027
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
|
|
8028
8028
|
}
|
|
8029
8029
|
out.push(id);
|
|
8030
8030
|
}
|
|
@@ -8032,7 +8032,7 @@ function requirePositiveIds(ids, label) {
|
|
|
8032
8032
|
}
|
|
8033
8033
|
async function whoAmI(_resource, userName, http) {
|
|
8034
8034
|
const user = userName.trim();
|
|
8035
|
-
if (user === "") throw new (0,
|
|
8035
|
+
if (user === "") throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
|
|
8036
8036
|
const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
|
|
8037
8037
|
const res = await http.request({
|
|
8038
8038
|
method: "POST",
|
|
@@ -8041,11 +8041,11 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8041
8041
|
body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
|
|
8042
8042
|
operation: "resources.whoAmI"
|
|
8043
8043
|
});
|
|
8044
|
-
const matches =
|
|
8044
|
+
const matches = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
8045
8045
|
if (matches.length === 0) return null;
|
|
8046
8046
|
if (matches.length > 1) {
|
|
8047
8047
|
const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
|
|
8048
|
-
throw new (0,
|
|
8048
|
+
throw new (0, _chunkWRWX6WIKcjs.ResolutionError)(
|
|
8049
8049
|
`whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
|
|
8050
8050
|
{ code: "RESOLUTION_AMBIGUOUS", resourceIds: ids, details: { idRefs: ids.map((cid) => ({ entity: "resource", id: cid })) } }
|
|
8051
8051
|
);
|
|
@@ -8054,9 +8054,9 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8054
8054
|
}
|
|
8055
8055
|
async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
|
|
8056
8056
|
const ids = requirePositiveIds(companyIds, "transferOwnership");
|
|
8057
|
-
const destination =
|
|
8057
|
+
const destination = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
|
|
8058
8058
|
if (typeof destination === "number" && destination < 1) {
|
|
8059
|
-
throw new (0,
|
|
8059
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
|
|
8060
8060
|
}
|
|
8061
8061
|
const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _53 => _53.dryRun]), () => ( true));
|
|
8062
8062
|
const changes = [];
|
|
@@ -8069,7 +8069,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8069
8069
|
operation: "resources.transferOwnership",
|
|
8070
8070
|
maxRetries: _optionalChain([opts, 'optionalAccess', _54 => _54.maxRetries])
|
|
8071
8071
|
});
|
|
8072
|
-
const company =
|
|
8072
|
+
const company = _chunkWRWX6WIKcjs.unwrapItem.call(void 0, res, id, void 0, "company");
|
|
8073
8073
|
const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
|
|
8074
8074
|
changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
|
|
8075
8075
|
if (!dryRun) {
|
|
@@ -8080,13 +8080,13 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8080
8080
|
operation: "resources.transferOwnership",
|
|
8081
8081
|
maxRetries: _optionalChain([opts, 'optionalAccess', _55 => _55.maxRetries])
|
|
8082
8082
|
});
|
|
8083
|
-
|
|
8083
|
+
_chunkWRWX6WIKcjs.unwrapOperation.call(void 0, update);
|
|
8084
8084
|
applied.push(id);
|
|
8085
8085
|
}
|
|
8086
8086
|
} catch (err) {
|
|
8087
|
-
if (!dryRun && err instanceof
|
|
8087
|
+
if (!dryRun && err instanceof _chunkWRWX6WIKcjs.AutotaskError) {
|
|
8088
8088
|
err.resourceIds = [id];
|
|
8089
|
-
err.details =
|
|
8089
|
+
err.details = _chunkWRWX6WIKcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
|
|
8090
8090
|
err.suggestedAction = `Partial transfer: ${applied.length} of ${ids.length} companies were re-owned (ids: ${applied.join(", ") || "none"}); id ${id} failed. Re-run transferOwnership for the remaining ids (from ${id} on).`;
|
|
8091
8091
|
}
|
|
8092
8092
|
throw err;
|
|
@@ -8095,7 +8095,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8095
8095
|
if (dryRun) {
|
|
8096
8096
|
const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
|
|
8097
8097
|
return {
|
|
8098
|
-
...
|
|
8098
|
+
..._chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
8099
8099
|
operation: "resources.transferOwnership",
|
|
8100
8100
|
method: "PUT",
|
|
8101
8101
|
path: "/V1.0/Companies",
|
|
@@ -8119,7 +8119,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8119
8119
|
}
|
|
8120
8120
|
|
|
8121
8121
|
// src/resources/resources.ts
|
|
8122
|
-
var ResourcesResource = class extends
|
|
8122
|
+
var ResourcesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8123
8123
|
|
|
8124
8124
|
constructor(http, clientConfig, pageSize) {
|
|
8125
8125
|
super(http, {
|
|
@@ -8192,7 +8192,7 @@ var ResourcesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8192
8192
|
|
|
8193
8193
|
// src/resources/special/resource_time_off_additional.ts
|
|
8194
8194
|
async function getByResource(_resource, resourceId, http) {
|
|
8195
|
-
const numericResource =
|
|
8195
|
+
const numericResource = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8196
8196
|
const res = await http.request({
|
|
8197
8197
|
method: "GET",
|
|
8198
8198
|
path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
|
|
@@ -8206,11 +8206,11 @@ async function getByResource(_resource, resourceId, http) {
|
|
|
8206
8206
|
if (typeof item === "object" && !Array.isArray(item)) return [item];
|
|
8207
8207
|
}
|
|
8208
8208
|
}
|
|
8209
|
-
return
|
|
8209
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
|
|
8210
8210
|
}
|
|
8211
8211
|
|
|
8212
8212
|
// src/resources/resource_time_off_additional.ts
|
|
8213
|
-
var ResourceTimeOffAdditionalResource = class extends
|
|
8213
|
+
var ResourceTimeOffAdditionalResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8214
8214
|
constructor(http, pageSize) {
|
|
8215
8215
|
super(http, {
|
|
8216
8216
|
key: "resource_time_off_additional",
|
|
@@ -8249,7 +8249,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunk4RJG73GYcjs.BaseReso
|
|
|
8249
8249
|
};
|
|
8250
8250
|
|
|
8251
8251
|
// src/resources/resource_time_off_approvers.ts
|
|
8252
|
-
var ResourceTimeOffApproversResource = class extends
|
|
8252
|
+
var ResourceTimeOffApproversResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8253
8253
|
constructor(http, pageSize) {
|
|
8254
8254
|
super(http, {
|
|
8255
8255
|
key: "resource_time_off_approvers",
|
|
@@ -8292,29 +8292,29 @@ var ResourceTimeOffApproversResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
8292
8292
|
|
|
8293
8293
|
// src/resources/special/resource_time_off_balances.ts
|
|
8294
8294
|
async function getByResource2(_resource, resourceId, http) {
|
|
8295
|
-
const numericResource =
|
|
8295
|
+
const numericResource = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8296
8296
|
const res = await http.request({
|
|
8297
8297
|
method: "GET",
|
|
8298
8298
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
|
|
8299
8299
|
operation: "resource_time_off_balances.getByResource"
|
|
8300
8300
|
});
|
|
8301
|
-
return
|
|
8301
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
|
|
8302
8302
|
}
|
|
8303
8303
|
async function getByYear(_resource, resourceId, year, http) {
|
|
8304
|
-
const numericResource =
|
|
8304
|
+
const numericResource = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8305
8305
|
if (!Number.isSafeInteger(year) || year < 1) {
|
|
8306
|
-
throw new (0,
|
|
8306
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
|
|
8307
8307
|
}
|
|
8308
8308
|
const res = await http.request({
|
|
8309
8309
|
method: "GET",
|
|
8310
8310
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
|
|
8311
8311
|
operation: "resource_time_off_balances.getByYear"
|
|
8312
8312
|
});
|
|
8313
|
-
return
|
|
8313
|
+
return _chunkWRWX6WIKcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
|
|
8314
8314
|
}
|
|
8315
8315
|
|
|
8316
8316
|
// src/resources/resource_time_off_balances.ts
|
|
8317
|
-
var ResourceTimeOffBalancesResource = class extends
|
|
8317
|
+
var ResourceTimeOffBalancesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8318
8318
|
constructor(http, pageSize) {
|
|
8319
8319
|
super(http, {
|
|
8320
8320
|
key: "resource_time_off_balances",
|
|
@@ -8352,7 +8352,7 @@ var ResourceTimeOffBalancesResource = class extends _chunk4RJG73GYcjs.BaseResour
|
|
|
8352
8352
|
};
|
|
8353
8353
|
|
|
8354
8354
|
// src/resources/roles.ts
|
|
8355
|
-
var RolesResource = class extends
|
|
8355
|
+
var RolesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8356
8356
|
constructor(http, pageSize) {
|
|
8357
8357
|
super(http, {
|
|
8358
8358
|
key: "roles",
|
|
@@ -8419,7 +8419,7 @@ var RolesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8419
8419
|
};
|
|
8420
8420
|
|
|
8421
8421
|
// src/resources/service_calls.ts
|
|
8422
|
-
var ServiceCallsResource = class extends
|
|
8422
|
+
var ServiceCallsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8423
8423
|
constructor(http, pageSize) {
|
|
8424
8424
|
super(http, {
|
|
8425
8425
|
key: "service_calls",
|
|
@@ -8488,7 +8488,7 @@ var ServiceCallsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8488
8488
|
};
|
|
8489
8489
|
|
|
8490
8490
|
// src/resources/service_call_task_resources.ts
|
|
8491
|
-
var ServiceCallTaskResourcesResource = class extends
|
|
8491
|
+
var ServiceCallTaskResourcesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8492
8492
|
constructor(http, pageSize) {
|
|
8493
8493
|
super(http, {
|
|
8494
8494
|
key: "service_call_task_resources",
|
|
@@ -8545,7 +8545,7 @@ var ServiceCallTaskResourcesResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
8545
8545
|
};
|
|
8546
8546
|
|
|
8547
8547
|
// src/resources/service_call_tasks.ts
|
|
8548
|
-
var ServiceCallTasksResource = class extends
|
|
8548
|
+
var ServiceCallTasksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8549
8549
|
constructor(http, pageSize) {
|
|
8550
8550
|
super(http, {
|
|
8551
8551
|
key: "service_call_tasks",
|
|
@@ -8602,7 +8602,7 @@ var ServiceCallTasksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8602
8602
|
};
|
|
8603
8603
|
|
|
8604
8604
|
// src/resources/service_call_ticket_resources.ts
|
|
8605
|
-
var ServiceCallTicketResourcesResource = class extends
|
|
8605
|
+
var ServiceCallTicketResourcesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8606
8606
|
constructor(http, pageSize) {
|
|
8607
8607
|
super(http, {
|
|
8608
8608
|
key: "service_call_ticket_resources",
|
|
@@ -8659,7 +8659,7 @@ var ServiceCallTicketResourcesResource = class extends _chunk4RJG73GYcjs.BaseRes
|
|
|
8659
8659
|
};
|
|
8660
8660
|
|
|
8661
8661
|
// src/resources/service_call_tickets.ts
|
|
8662
|
-
var ServiceCallTicketsResource = class extends
|
|
8662
|
+
var ServiceCallTicketsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8663
8663
|
constructor(http, pageSize) {
|
|
8664
8664
|
super(http, {
|
|
8665
8665
|
key: "service_call_tickets",
|
|
@@ -8716,7 +8716,7 @@ var ServiceCallTicketsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8716
8716
|
};
|
|
8717
8717
|
|
|
8718
8718
|
// src/resources/service_level_agreement_results.ts
|
|
8719
|
-
var ServiceLevelAgreementResultsResource = class extends
|
|
8719
|
+
var ServiceLevelAgreementResultsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8720
8720
|
constructor(http, pageSize) {
|
|
8721
8721
|
super(http, {
|
|
8722
8722
|
key: "service_level_agreement_results",
|
|
@@ -8755,7 +8755,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunk4RJG73GYcjs.BaseR
|
|
|
8755
8755
|
};
|
|
8756
8756
|
|
|
8757
8757
|
// src/resources/services.ts
|
|
8758
|
-
var ServicesResource = class extends
|
|
8758
|
+
var ServicesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8759
8759
|
constructor(http, pageSize) {
|
|
8760
8760
|
super(http, {
|
|
8761
8761
|
key: "services",
|
|
@@ -8823,7 +8823,7 @@ var ServicesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8823
8823
|
};
|
|
8824
8824
|
|
|
8825
8825
|
// src/resources/skills.ts
|
|
8826
|
-
var SkillsResource = class extends
|
|
8826
|
+
var SkillsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8827
8827
|
constructor(http, pageSize) {
|
|
8828
8828
|
super(http, {
|
|
8829
8829
|
key: "skills",
|
|
@@ -8867,7 +8867,7 @@ var SkillsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8867
8867
|
};
|
|
8868
8868
|
|
|
8869
8869
|
// src/resources/subscription_periods.ts
|
|
8870
|
-
var SubscriptionPeriodsResource = class extends
|
|
8870
|
+
var SubscriptionPeriodsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8871
8871
|
constructor(http, pageSize) {
|
|
8872
8872
|
super(http, {
|
|
8873
8873
|
key: "subscription_periods",
|
|
@@ -8906,7 +8906,7 @@ var SubscriptionPeriodsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8906
8906
|
};
|
|
8907
8907
|
|
|
8908
8908
|
// src/resources/subscriptions.ts
|
|
8909
|
-
var SubscriptionsResource = class extends
|
|
8909
|
+
var SubscriptionsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8910
8910
|
constructor(http, pageSize) {
|
|
8911
8911
|
super(http, {
|
|
8912
8912
|
key: "subscriptions",
|
|
@@ -8975,7 +8975,7 @@ var SubscriptionsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
8975
8975
|
};
|
|
8976
8976
|
|
|
8977
8977
|
// src/resources/survey_results.ts
|
|
8978
|
-
var SurveyResultsResource = class extends
|
|
8978
|
+
var SurveyResultsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
8979
8979
|
constructor(http, pageSize) {
|
|
8980
8980
|
super(http, {
|
|
8981
8981
|
key: "survey_results",
|
|
@@ -9014,7 +9014,7 @@ var SurveyResultsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9014
9014
|
};
|
|
9015
9015
|
|
|
9016
9016
|
// src/resources/surveys.ts
|
|
9017
|
-
var SurveysResource = class extends
|
|
9017
|
+
var SurveysResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9018
9018
|
constructor(http, pageSize) {
|
|
9019
9019
|
super(http, {
|
|
9020
9020
|
key: "surveys",
|
|
@@ -9058,7 +9058,7 @@ var SurveysResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9058
9058
|
};
|
|
9059
9059
|
|
|
9060
9060
|
// src/resources/tag_aliases.ts
|
|
9061
|
-
var TagAliasesResource = class extends
|
|
9061
|
+
var TagAliasesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9062
9062
|
constructor(http, pageSize) {
|
|
9063
9063
|
super(http, {
|
|
9064
9064
|
key: "tag_aliases",
|
|
@@ -9115,7 +9115,7 @@ var TagAliasesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9115
9115
|
};
|
|
9116
9116
|
|
|
9117
9117
|
// src/resources/tag_groups.ts
|
|
9118
|
-
var TagGroupsResource = class extends
|
|
9118
|
+
var TagGroupsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9119
9119
|
constructor(http, pageSize) {
|
|
9120
9120
|
super(http, {
|
|
9121
9121
|
key: "tag_groups",
|
|
@@ -9184,7 +9184,7 @@ var TagGroupsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9184
9184
|
};
|
|
9185
9185
|
|
|
9186
9186
|
// src/resources/tags.ts
|
|
9187
|
-
var TagsResource = class extends
|
|
9187
|
+
var TagsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9188
9188
|
constructor(http, pageSize) {
|
|
9189
9189
|
super(http, {
|
|
9190
9190
|
key: "tags",
|
|
@@ -9253,7 +9253,7 @@ var TagsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9253
9253
|
};
|
|
9254
9254
|
|
|
9255
9255
|
// src/resources/task_secondary_resources.ts
|
|
9256
|
-
var TaskSecondaryResourcesResource = class extends
|
|
9256
|
+
var TaskSecondaryResourcesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9257
9257
|
constructor(http, pageSize) {
|
|
9258
9258
|
super(http, {
|
|
9259
9259
|
key: "task_secondary_resources",
|
|
@@ -9310,7 +9310,7 @@ var TaskSecondaryResourcesResource = class extends _chunk4RJG73GYcjs.BaseResourc
|
|
|
9310
9310
|
};
|
|
9311
9311
|
|
|
9312
9312
|
// src/resources/tasks.ts
|
|
9313
|
-
var TasksResource = class extends
|
|
9313
|
+
var TasksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9314
9314
|
constructor(http, pageSize) {
|
|
9315
9315
|
super(http, {
|
|
9316
9316
|
key: "tasks",
|
|
@@ -9398,7 +9398,7 @@ var ThresholdInformationResource = class {
|
|
|
9398
9398
|
};
|
|
9399
9399
|
|
|
9400
9400
|
// src/resources/ticket_additional_configuration_items.ts
|
|
9401
|
-
var TicketAdditionalConfigurationItemsResource = class extends
|
|
9401
|
+
var TicketAdditionalConfigurationItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9402
9402
|
constructor(http, pageSize) {
|
|
9403
9403
|
super(http, {
|
|
9404
9404
|
key: "ticket_additional_configuration_items",
|
|
@@ -9455,7 +9455,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunk4RJG73GYcjs
|
|
|
9455
9455
|
};
|
|
9456
9456
|
|
|
9457
9457
|
// src/resources/ticket_additional_contacts.ts
|
|
9458
|
-
var TicketAdditionalContactsResource = class extends
|
|
9458
|
+
var TicketAdditionalContactsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9459
9459
|
constructor(http, pageSize) {
|
|
9460
9460
|
super(http, {
|
|
9461
9461
|
key: "ticket_additional_contacts",
|
|
@@ -9512,7 +9512,7 @@ var TicketAdditionalContactsResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
9512
9512
|
};
|
|
9513
9513
|
|
|
9514
9514
|
// src/resources/ticket_attachments.ts
|
|
9515
|
-
var TicketAttachmentsResource = class extends
|
|
9515
|
+
var TicketAttachmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9516
9516
|
constructor(http, pageSize) {
|
|
9517
9517
|
super(http, {
|
|
9518
9518
|
key: "ticket_attachments",
|
|
@@ -9574,7 +9574,7 @@ var TicketAttachmentsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9574
9574
|
};
|
|
9575
9575
|
|
|
9576
9576
|
// src/resources/ticket_categories.ts
|
|
9577
|
-
var TicketCategoriesResource = class extends
|
|
9577
|
+
var TicketCategoriesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9578
9578
|
constructor(http, pageSize) {
|
|
9579
9579
|
super(http, {
|
|
9580
9580
|
key: "ticket_categories",
|
|
@@ -9633,7 +9633,7 @@ var TicketCategoriesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9633
9633
|
};
|
|
9634
9634
|
|
|
9635
9635
|
// src/resources/ticket_category_field_defaults.ts
|
|
9636
|
-
var TicketCategoryFieldDefaultsResource = class extends
|
|
9636
|
+
var TicketCategoryFieldDefaultsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9637
9637
|
constructor(http, pageSize) {
|
|
9638
9638
|
super(http, {
|
|
9639
9639
|
key: "ticket_category_field_defaults",
|
|
@@ -9675,7 +9675,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunk4RJG73GYcjs.BaseRe
|
|
|
9675
9675
|
};
|
|
9676
9676
|
|
|
9677
9677
|
// src/resources/ticket_change_request_approvals.ts
|
|
9678
|
-
var TicketChangeRequestApprovalsResource = class extends
|
|
9678
|
+
var TicketChangeRequestApprovalsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9679
9679
|
constructor(http, pageSize) {
|
|
9680
9680
|
super(http, {
|
|
9681
9681
|
key: "ticket_change_request_approvals",
|
|
@@ -9732,7 +9732,7 @@ var TicketChangeRequestApprovalsResource = class extends _chunk4RJG73GYcjs.BaseR
|
|
|
9732
9732
|
};
|
|
9733
9733
|
|
|
9734
9734
|
// src/resources/ticket_charges.ts
|
|
9735
|
-
var TicketChargesResource = class extends
|
|
9735
|
+
var TicketChargesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9736
9736
|
constructor(http, pageSize) {
|
|
9737
9737
|
super(http, {
|
|
9738
9738
|
key: "ticket_charges",
|
|
@@ -9803,7 +9803,7 @@ var TicketChargesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9803
9803
|
};
|
|
9804
9804
|
|
|
9805
9805
|
// src/resources/ticket_checklist_items.ts
|
|
9806
|
-
var TicketChecklistItemsResource = class extends
|
|
9806
|
+
var TicketChecklistItemsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9807
9807
|
constructor(http, pageSize) {
|
|
9808
9808
|
super(http, {
|
|
9809
9809
|
key: "ticket_checklist_items",
|
|
@@ -9869,7 +9869,7 @@ var TicketChecklistItemsResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
9869
9869
|
};
|
|
9870
9870
|
|
|
9871
9871
|
// src/resources/ticket_checklist_libraries.ts
|
|
9872
|
-
var TicketChecklistLibrariesResource = class extends
|
|
9872
|
+
var TicketChecklistLibrariesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9873
9873
|
constructor(http, pageSize) {
|
|
9874
9874
|
super(http, {
|
|
9875
9875
|
key: "ticket_checklist_libraries",
|
|
@@ -9893,9 +9893,9 @@ var TicketChecklistLibrariesResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
9893
9893
|
* `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
|
|
9894
9894
|
* surface — no documents read op — and never issues the POST). */
|
|
9895
9895
|
async attachToDocument(documentID, data, opts = {}) {
|
|
9896
|
-
const n =
|
|
9896
|
+
const n = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, documentID, "documentID");
|
|
9897
9897
|
if (opts.dryRun === true) {
|
|
9898
|
-
return
|
|
9898
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
9899
9899
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
9900
9900
|
method: "POST",
|
|
9901
9901
|
path: `/V1.0/Documents/${n}/ChecklistLibraries`,
|
|
@@ -9913,7 +9913,7 @@ var TicketChecklistLibrariesResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
9913
9913
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
9914
9914
|
maxRetries: opts.maxRetries
|
|
9915
9915
|
});
|
|
9916
|
-
return
|
|
9916
|
+
return _chunkWRWX6WIKcjs.unwrapOperation.call(void 0, res);
|
|
9917
9917
|
}
|
|
9918
9918
|
/** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
|
|
9919
9919
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9929,7 +9929,7 @@ var TicketChecklistLibrariesResource = class extends _chunk4RJG73GYcjs.BaseResou
|
|
|
9929
9929
|
};
|
|
9930
9930
|
|
|
9931
9931
|
// src/resources/ticket_history.ts
|
|
9932
|
-
var TicketHistoryResource = class extends
|
|
9932
|
+
var TicketHistoryResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9933
9933
|
constructor(http, pageSize) {
|
|
9934
9934
|
super(http, {
|
|
9935
9935
|
key: "ticket_history",
|
|
@@ -9968,7 +9968,7 @@ var TicketHistoryResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
9968
9968
|
};
|
|
9969
9969
|
|
|
9970
9970
|
// src/resources/ticket_note_attachments.ts
|
|
9971
|
-
var TicketNoteAttachmentsResource = class extends
|
|
9971
|
+
var TicketNoteAttachmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
9972
9972
|
constructor(http, pageSize) {
|
|
9973
9973
|
super(http, {
|
|
9974
9974
|
key: "ticket_note_attachments",
|
|
@@ -10030,7 +10030,7 @@ var TicketNoteAttachmentsResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
10030
10030
|
};
|
|
10031
10031
|
|
|
10032
10032
|
// src/resources/ticket_notes.ts
|
|
10033
|
-
var TicketNotesResource = class extends
|
|
10033
|
+
var TicketNotesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
10034
10034
|
constructor(http, pageSize) {
|
|
10035
10035
|
super(http, {
|
|
10036
10036
|
key: "ticket_notes",
|
|
@@ -10089,7 +10089,7 @@ var TicketNotesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
10089
10089
|
};
|
|
10090
10090
|
|
|
10091
10091
|
// src/resources/ticket_note_webhooks.ts
|
|
10092
|
-
var TicketNoteWebhooksResource = class extends
|
|
10092
|
+
var TicketNoteWebhooksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
10093
10093
|
constructor(http, pageSize) {
|
|
10094
10094
|
super(http, {
|
|
10095
10095
|
key: "ticket_note_webhooks",
|
|
@@ -10165,7 +10165,7 @@ var TicketNoteWebhooksResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
10165
10165
|
};
|
|
10166
10166
|
|
|
10167
10167
|
// src/resources/ticket_secondary_resources.ts
|
|
10168
|
-
var TicketSecondaryResourcesResource = class extends
|
|
10168
|
+
var TicketSecondaryResourcesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
10169
10169
|
constructor(http, pageSize) {
|
|
10170
10170
|
super(http, {
|
|
10171
10171
|
key: "ticket_secondary_resources",
|
|
@@ -10232,9 +10232,9 @@ async function fetchTicket(http, id, operation) {
|
|
|
10232
10232
|
});
|
|
10233
10233
|
const body = res;
|
|
10234
10234
|
if (body === null || !("item" in body)) {
|
|
10235
|
-
throw new (0,
|
|
10235
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
|
|
10236
10236
|
}
|
|
10237
|
-
if (body.item === null || body.item === void 0) throw new (0,
|
|
10237
|
+
if (body.item === null || body.item === void 0) throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
|
|
10238
10238
|
return body.item;
|
|
10239
10239
|
}
|
|
10240
10240
|
async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
@@ -10245,29 +10245,29 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
|
10245
10245
|
body: { MaxRecords: maxRecords, filter },
|
|
10246
10246
|
operation
|
|
10247
10247
|
});
|
|
10248
|
-
return
|
|
10248
|
+
return _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res).items;
|
|
10249
10249
|
}
|
|
10250
10250
|
function isRouteUnavailable(err) {
|
|
10251
|
-
return
|
|
10251
|
+
return _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
|
|
10252
10252
|
}
|
|
10253
10253
|
function routeFact(route, path, err) {
|
|
10254
10254
|
return {
|
|
10255
10255
|
route,
|
|
10256
10256
|
path,
|
|
10257
|
-
httpStatus:
|
|
10257
|
+
httpStatus: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
|
|
10258
10258
|
};
|
|
10259
10259
|
}
|
|
10260
10260
|
function childDeclaresQuery(resourceKey) {
|
|
10261
|
-
return
|
|
10261
|
+
return _chunk5O5EPYBOcjs.CAPABILITIES.some(
|
|
10262
10262
|
(c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
|
|
10263
10263
|
);
|
|
10264
10264
|
}
|
|
10265
10265
|
function planScopedPath(resourceKey, ticketId) {
|
|
10266
10266
|
if (!childDeclaresQuery(resourceKey)) return null;
|
|
10267
|
-
const entry =
|
|
10267
|
+
const entry = _chunkWRWX6WIKcjs.RELATIONSHIP_MAP[resourceKey];
|
|
10268
10268
|
const parent = entry === void 0 ? null : entry.parent;
|
|
10269
10269
|
if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
|
|
10270
|
-
const parentPath = _optionalChain([
|
|
10270
|
+
const parentPath = _optionalChain([_chunkWRWX6WIKcjs.RELATIONSHIP_MAP, 'access', _56 => _56[parent.resource], 'optionalAccess', _57 => _57.path]);
|
|
10271
10271
|
if (parentPath === null || parentPath === void 0) return null;
|
|
10272
10272
|
return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
|
|
10273
10273
|
}
|
|
@@ -10306,14 +10306,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
|
|
|
10306
10306
|
break;
|
|
10307
10307
|
}
|
|
10308
10308
|
const body = await http.request({ method: "GET", path: target, operation });
|
|
10309
|
-
const { items: pageItems, pageDetails } =
|
|
10309
|
+
const { items: pageItems, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, body, operation);
|
|
10310
10310
|
nextCursor = pageDetails.nextPageUrl;
|
|
10311
10311
|
pages += 1;
|
|
10312
10312
|
const window = pageItems.slice(0, Math.max(0, limit - items.length));
|
|
10313
10313
|
for (const row of window) if (accept(row)) items.push(row);
|
|
10314
10314
|
if (items.length >= limit) break;
|
|
10315
10315
|
if (nextCursor === null || pageItems.length === 0) break;
|
|
10316
|
-
target =
|
|
10316
|
+
target = _chunkWRWX6WIKcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
|
|
10317
10317
|
}
|
|
10318
10318
|
const capped = items.length >= limit || guard && nextCursor !== null;
|
|
10319
10319
|
return { items, capped };
|
|
@@ -10347,7 +10347,7 @@ function truncate(text, limit) {
|
|
|
10347
10347
|
}
|
|
10348
10348
|
async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
10349
10349
|
void opts;
|
|
10350
|
-
const ticketId =
|
|
10350
|
+
const ticketId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
10351
10351
|
await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
|
|
10352
10352
|
const rows = await ticketQueryItems(
|
|
10353
10353
|
http,
|
|
@@ -10372,9 +10372,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
|
10372
10372
|
async function summary(_resource, id, opts = {}, http) {
|
|
10373
10373
|
const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
|
|
10374
10374
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
10375
|
-
throw new (0,
|
|
10375
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
|
|
10376
10376
|
}
|
|
10377
|
-
const ticketId =
|
|
10377
|
+
const ticketId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
10378
10378
|
const ticket = await fetchTicket(http, ticketId, "tickets.summary");
|
|
10379
10379
|
const desc = truncate(ticket.description, limit);
|
|
10380
10380
|
const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
|
|
@@ -10401,13 +10401,13 @@ async function summary(_resource, id, opts = {}, http) {
|
|
|
10401
10401
|
}
|
|
10402
10402
|
async function timeline(_resource, id, opts = {}, http) {
|
|
10403
10403
|
const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
|
|
10404
|
-
if (!Number.isInteger(limit) || limit < 1) throw new (0,
|
|
10404
|
+
if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
10405
10405
|
const bounded = Math.min(limit, 500);
|
|
10406
10406
|
const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
|
|
10407
10407
|
if (!Number.isInteger(textLimit) || textLimit < 1) {
|
|
10408
|
-
throw new (0,
|
|
10408
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
|
|
10409
10409
|
}
|
|
10410
|
-
const ticketId =
|
|
10410
|
+
const ticketId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
10411
10411
|
await fetchTicket(http, ticketId, "tickets.timeline");
|
|
10412
10412
|
const dateFilters = (field) => {
|
|
10413
10413
|
const f = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -10494,14 +10494,14 @@ function isPositiveInt(v) {
|
|
|
10494
10494
|
return typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
10495
10495
|
}
|
|
10496
10496
|
function namedVendorFields(err) {
|
|
10497
|
-
if (!
|
|
10498
|
-
const entries = _nullishCoalesce(
|
|
10497
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
|
|
10498
|
+
const entries = _nullishCoalesce(_chunkWRWX6WIKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
|
|
10499
10499
|
const out = /* @__PURE__ */ new Set();
|
|
10500
10500
|
for (const e of entries) if (e.field !== void 0) out.add(e.field);
|
|
10501
10501
|
return [...out];
|
|
10502
10502
|
}
|
|
10503
10503
|
function vendorDetailOf(err) {
|
|
10504
|
-
return
|
|
10504
|
+
return _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? _chunkWRWX6WIKcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
|
|
10505
10505
|
}
|
|
10506
10506
|
async function fetchItem(http, path, operation, readOpts) {
|
|
10507
10507
|
const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _58 => _58.maxRetries]) });
|
|
@@ -10522,8 +10522,8 @@ function operationId(res) {
|
|
|
10522
10522
|
return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
|
|
10523
10523
|
}
|
|
10524
10524
|
function discoveryMerge(err, body, defaults) {
|
|
10525
|
-
if (!
|
|
10526
|
-
const entries =
|
|
10525
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
10526
|
+
const entries = _chunkWRWX6WIKcjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
10527
10527
|
if (entries === void 0) return null;
|
|
10528
10528
|
for (const entry of entries) {
|
|
10529
10529
|
const field = entry.field;
|
|
@@ -10535,7 +10535,7 @@ function discoveryMerge(err, body, defaults) {
|
|
|
10535
10535
|
}
|
|
10536
10536
|
function stepErrorText(code, err) {
|
|
10537
10537
|
const detail = vendorDetailOf(err);
|
|
10538
|
-
const base =
|
|
10538
|
+
const base = _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
|
|
10539
10539
|
return detail ? `${code}: ${detail}` : `${code}: ${base}`;
|
|
10540
10540
|
}
|
|
10541
10541
|
var DEFAULT_TICKET_PRIORITY = 3;
|
|
@@ -10544,7 +10544,7 @@ var DEFAULT_NOTE_TYPE = 1;
|
|
|
10544
10544
|
var DEFAULT_PUBLISH = 1;
|
|
10545
10545
|
var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
|
|
10546
10546
|
var SAFE_TICKET_CREATE_DEFAULTS = {};
|
|
10547
|
-
var QueueRequiredError = class extends
|
|
10547
|
+
var QueueRequiredError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
10548
10548
|
constructor(message, options = {}) {
|
|
10549
10549
|
super(message, {
|
|
10550
10550
|
code: "QUEUE_REQUIRED",
|
|
@@ -10555,13 +10555,13 @@ var QueueRequiredError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
10555
10555
|
this.name = "QueueRequiredError";
|
|
10556
10556
|
}
|
|
10557
10557
|
};
|
|
10558
|
-
var TicketResourceInvalidError = class extends
|
|
10558
|
+
var TicketResourceInvalidError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
10559
10559
|
constructor(message, options = {}) {
|
|
10560
10560
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
10561
10561
|
this.name = "TicketResourceInvalidError";
|
|
10562
10562
|
}
|
|
10563
10563
|
};
|
|
10564
|
-
var TicketCreateValidationFailedError = class extends
|
|
10564
|
+
var TicketCreateValidationFailedError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
10565
10565
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
10566
10566
|
|
|
10567
10567
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -10571,43 +10571,43 @@ var TicketCreateValidationFailedError = class extends _chunk4RJG73GYcjs.Autotask
|
|
|
10571
10571
|
}
|
|
10572
10572
|
};
|
|
10573
10573
|
async function openWithNoteAndAssign(resource, params, note, assign, opts, http) {
|
|
10574
|
-
const companyID =
|
|
10574
|
+
const companyID = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _60 => _60.companyID]), "params.companyID");
|
|
10575
10575
|
const title = _optionalChain([params, 'optionalAccess', _61 => _61.title]);
|
|
10576
10576
|
if (typeof title !== "string" || title.trim() === "") {
|
|
10577
|
-
throw new (0,
|
|
10577
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
|
|
10578
10578
|
}
|
|
10579
10579
|
const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
|
|
10580
10580
|
const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
|
|
10581
10581
|
if (!isPositiveInt(priority)) {
|
|
10582
|
-
throw new (0,
|
|
10582
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
|
|
10583
10583
|
}
|
|
10584
10584
|
if (!isPositiveInt(status)) {
|
|
10585
|
-
throw new (0,
|
|
10585
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
|
|
10586
10586
|
}
|
|
10587
10587
|
if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
|
|
10588
|
-
throw new (0,
|
|
10588
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
|
|
10589
10589
|
}
|
|
10590
10590
|
if (note !== void 0) {
|
|
10591
10591
|
if (typeof note.description !== "string" || note.description.trim() === "") {
|
|
10592
|
-
throw new (0,
|
|
10592
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
|
|
10593
10593
|
}
|
|
10594
10594
|
if (typeof note.title !== "string" || note.title.trim() === "") {
|
|
10595
|
-
throw new (0,
|
|
10595
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
10596
10596
|
}
|
|
10597
10597
|
if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
|
|
10598
|
-
throw new (0,
|
|
10598
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
|
|
10599
10599
|
}
|
|
10600
10600
|
if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
|
|
10601
|
-
throw new (0,
|
|
10601
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
|
|
10602
10602
|
}
|
|
10603
10603
|
}
|
|
10604
|
-
const assignee = assign === void 0 ? void 0 :
|
|
10604
|
+
const assignee = assign === void 0 ? void 0 : _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
|
|
10605
10605
|
if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
|
|
10606
|
-
throw new (0,
|
|
10606
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
|
|
10607
10607
|
}
|
|
10608
10608
|
const roleID = _optionalChain([assign, 'optionalAccess', _62 => _62.roleID]);
|
|
10609
10609
|
if (assign !== void 0 && !isPositiveInt(roleID)) {
|
|
10610
|
-
throw new (0,
|
|
10610
|
+
throw new (0, _chunkWRWX6WIKcjs.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 });
|
|
10611
10611
|
}
|
|
10612
10612
|
if (assign !== void 0 && assignee !== void 0) {
|
|
10613
10613
|
const rid = assignee;
|
|
@@ -10642,7 +10642,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10642
10642
|
if (assign !== void 0) {
|
|
10643
10643
|
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).`);
|
|
10644
10644
|
}
|
|
10645
|
-
return
|
|
10645
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
10646
10646
|
{
|
|
10647
10647
|
operation: OP_OPEN,
|
|
10648
10648
|
method: "POST",
|
|
@@ -10684,8 +10684,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10684
10684
|
`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}` : ""}`,
|
|
10685
10685
|
{
|
|
10686
10686
|
operation: OP_OPEN,
|
|
10687
|
-
httpStatus:
|
|
10688
|
-
vendorError:
|
|
10687
|
+
httpStatus: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10688
|
+
vendorError: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
|
|
10689
10689
|
}
|
|
10690
10690
|
);
|
|
10691
10691
|
}
|
|
@@ -10700,8 +10700,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10700
10700
|
named,
|
|
10701
10701
|
{
|
|
10702
10702
|
operation: OP_OPEN,
|
|
10703
|
-
httpStatus:
|
|
10704
|
-
vendorError:
|
|
10703
|
+
httpStatus: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10704
|
+
vendorError: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
10705
10705
|
resourceIds: [companyID],
|
|
10706
10706
|
details: { idRefs: [{ entity: "company", id: companyID }] }
|
|
10707
10707
|
}
|
|
@@ -10724,10 +10724,10 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10724
10724
|
try {
|
|
10725
10725
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
|
|
10726
10726
|
if (current === null) {
|
|
10727
|
-
throw new (0,
|
|
10727
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
|
|
10728
10728
|
}
|
|
10729
10729
|
ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
|
|
10730
|
-
const merged =
|
|
10730
|
+
const merged = _chunkWRWX6WIKcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
|
|
10731
10731
|
merged.id = ticketId;
|
|
10732
10732
|
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
|
|
10733
10733
|
assigned = true;
|
|
@@ -10748,7 +10748,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10748
10748
|
var STATUS_REQUIRED_FIELDS = {
|
|
10749
10749
|
// <discovery output lands here — e.g. 8: { requiredFields: ['dueDateTime'], safeDefaults: { dueDateTime: '<now>' } }>
|
|
10750
10750
|
};
|
|
10751
|
-
var StatusUnknownError = class extends
|
|
10751
|
+
var StatusUnknownError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
10752
10752
|
/** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
|
|
10753
10753
|
|
|
10754
10754
|
constructor(message, options = {}) {
|
|
@@ -10762,7 +10762,7 @@ var StatusUnknownError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
10762
10762
|
this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
|
|
10763
10763
|
}
|
|
10764
10764
|
};
|
|
10765
|
-
var StatusFieldsRequiredError = class extends
|
|
10765
|
+
var StatusFieldsRequiredError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
10766
10766
|
|
|
10767
10767
|
|
|
10768
10768
|
|
|
@@ -10791,16 +10791,16 @@ async function readLiveStatusSet(resource) {
|
|
|
10791
10791
|
}
|
|
10792
10792
|
var GUARD_DEGRADED_WARNING = "the tenant's live status picklist metadata was unavailable (the local guard is degraded for this call \u2014 the W-A4 wall or a metadata failure); the vendor's own validation is the final authority on the status value";
|
|
10793
10793
|
async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
10794
|
-
const ticketId =
|
|
10794
|
+
const ticketId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
10795
10795
|
if (!isPositiveInt(targetStatus)) {
|
|
10796
|
-
throw new (0,
|
|
10796
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
|
|
10797
10797
|
}
|
|
10798
10798
|
let liveStatus = null;
|
|
10799
10799
|
try {
|
|
10800
10800
|
const ids = await readLiveStatusSet(resource);
|
|
10801
10801
|
if (ids.size > 0) liveStatus = ids;
|
|
10802
10802
|
} catch (err) {
|
|
10803
|
-
if (!
|
|
10803
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
10804
10804
|
}
|
|
10805
10805
|
if (liveStatus !== null && !liveStatus.has(targetStatus)) {
|
|
10806
10806
|
_optionalChain([http, 'access', _63 => _63.fieldCache, 'optionalAccess', _64 => _64.invalidate, 'call', _65 => _65("tickets")]);
|
|
@@ -10810,7 +10810,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10810
10810
|
const freshIds = await readLiveStatusSet(resource);
|
|
10811
10811
|
if (freshIds.size > 0) freshStatus = freshIds;
|
|
10812
10812
|
} catch (err) {
|
|
10813
|
-
if (!
|
|
10813
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
10814
10814
|
freshStatus = null;
|
|
10815
10815
|
reReadFailed = true;
|
|
10816
10816
|
}
|
|
@@ -10827,16 +10827,16 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10827
10827
|
}
|
|
10828
10828
|
const guardDegraded = liveStatus === null;
|
|
10829
10829
|
if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
|
|
10830
|
-
throw new (0,
|
|
10830
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
|
|
10831
10831
|
}
|
|
10832
10832
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10833
10833
|
if (current === null) {
|
|
10834
|
-
throw new (0,
|
|
10834
|
+
throw new (0, _chunkWRWX6WIKcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
|
|
10835
10835
|
}
|
|
10836
10836
|
const previousStatus = typeof current.status === "number" ? current.status : null;
|
|
10837
10837
|
if (previousStatus === targetStatus) {
|
|
10838
10838
|
if (opts.dryRun === true) {
|
|
10839
|
-
return
|
|
10839
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
10840
10840
|
{
|
|
10841
10841
|
operation: OP_STATUS,
|
|
10842
10842
|
method: "PUT",
|
|
@@ -10890,7 +10890,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10890
10890
|
if (mapEntry === void 0) {
|
|
10891
10891
|
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).`);
|
|
10892
10892
|
}
|
|
10893
|
-
return
|
|
10893
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
10894
10894
|
{
|
|
10895
10895
|
operation: OP_STATUS,
|
|
10896
10896
|
method: "PUT",
|
|
@@ -10909,7 +10909,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10909
10909
|
);
|
|
10910
10910
|
}
|
|
10911
10911
|
const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _68 => _68.safeDefaults]), () => ( {}));
|
|
10912
|
-
const body =
|
|
10912
|
+
const body = _chunkWRWX6WIKcjs.mergePartialBody.call(void 0, current, mergeData);
|
|
10913
10913
|
body.id = ticketId;
|
|
10914
10914
|
let merges = 0;
|
|
10915
10915
|
for (; ; ) {
|
|
@@ -10933,8 +10933,8 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10933
10933
|
{ vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
|
|
10934
10934
|
{
|
|
10935
10935
|
operation: OP_STATUS,
|
|
10936
|
-
httpStatus:
|
|
10937
|
-
vendorError:
|
|
10936
|
+
httpStatus: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10937
|
+
vendorError: _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
10938
10938
|
resourceIds: [ticketId],
|
|
10939
10939
|
details: { idRefs: [{ entity: "ticket", id: ticketId }] }
|
|
10940
10940
|
}
|
|
@@ -10945,7 +10945,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10945
10945
|
}
|
|
10946
10946
|
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10947
10947
|
if (verify === null) {
|
|
10948
|
-
throw new (0,
|
|
10948
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
|
|
10949
10949
|
code: "INVALID_RESPONSE",
|
|
10950
10950
|
category: "server",
|
|
10951
10951
|
operation: OP_STATUS,
|
|
@@ -10955,7 +10955,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10955
10955
|
}
|
|
10956
10956
|
const finalStatus = typeof verify.status === "number" ? verify.status : null;
|
|
10957
10957
|
if (finalStatus !== targetStatus) {
|
|
10958
|
-
throw new (0,
|
|
10958
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
|
|
10959
10959
|
`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)`,
|
|
10960
10960
|
{
|
|
10961
10961
|
code: "INVALID_RESPONSE",
|
|
@@ -10974,7 +10974,7 @@ var DEFAULT_PART_LIMIT = 50;
|
|
|
10974
10974
|
function partLimit(value, name) {
|
|
10975
10975
|
const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
|
|
10976
10976
|
if (!Number.isInteger(n) || n < 1) {
|
|
10977
|
-
throw new (0,
|
|
10977
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
10978
10978
|
}
|
|
10979
10979
|
return n;
|
|
10980
10980
|
}
|
|
@@ -10990,7 +10990,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
10990
10990
|
const noteLimit = partLimit(opts.noteLimit, "noteLimit");
|
|
10991
10991
|
const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
|
|
10992
10992
|
const textLimit = partLimit(opts.textLimit, "textLimit");
|
|
10993
|
-
const ticketId =
|
|
10993
|
+
const ticketId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
10994
10994
|
const ctx = await resource.getContext(ticketId);
|
|
10995
10995
|
const op = "tickets.fullContext";
|
|
10996
10996
|
const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -11044,7 +11044,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11044
11044
|
result.truncated = result.truncated || part.capped || historyRows.some((h) => h.detailTruncated === true);
|
|
11045
11045
|
}
|
|
11046
11046
|
if (opts.names === true) {
|
|
11047
|
-
const builder =
|
|
11047
|
+
const builder = _chunkWRWX6WIKcjs.createNamePlan.call(void 0, _chunkWRWX6WIKcjs.TICKET_LABEL_FIELDS);
|
|
11048
11048
|
const t = ctx.ticket;
|
|
11049
11049
|
builder.addResource(t["creatorResourceID"]);
|
|
11050
11050
|
builder.addFk("contract", t["contractID"]);
|
|
@@ -11056,20 +11056,20 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11056
11056
|
builder.addFk("billingCode", e["billingCodeID"]);
|
|
11057
11057
|
builder.addFk("contract", e["contractID"]);
|
|
11058
11058
|
}
|
|
11059
|
-
const names = await
|
|
11059
|
+
const names = await _chunkWRWX6WIKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
11060
11060
|
const ticketRow = { ...ctx.ticket };
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
for (const f of
|
|
11061
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
|
|
11062
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
|
|
11063
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11064
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
11065
|
+
for (const f of _chunkWRWX6WIKcjs.TICKET_LABEL_FIELDS) _chunkWRWX6WIKcjs.addLabelSibling.call(void 0, ticketRow, f, names);
|
|
11066
11066
|
result.ticket = ticketRow;
|
|
11067
11067
|
result.timeEntries.items = entriesPart.items.map((e) => {
|
|
11068
11068
|
const row = { ...e };
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11069
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
|
|
11070
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
|
|
11071
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11072
|
+
_chunkWRWX6WIKcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
11073
11073
|
return row;
|
|
11074
11074
|
});
|
|
11075
11075
|
result.names = names.section;
|
|
@@ -11079,7 +11079,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11079
11079
|
}
|
|
11080
11080
|
|
|
11081
11081
|
// src/resources/tickets.ts
|
|
11082
|
-
var TicketsResource = class extends
|
|
11082
|
+
var TicketsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
11083
11083
|
constructor(http, pageSize) {
|
|
11084
11084
|
super(http, {
|
|
11085
11085
|
key: "tickets",
|
|
@@ -11185,7 +11185,7 @@ var TicketsResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
11185
11185
|
};
|
|
11186
11186
|
|
|
11187
11187
|
// src/resources/ticket_webhooks.ts
|
|
11188
|
-
var TicketWebhooksResource = class extends
|
|
11188
|
+
var TicketWebhooksResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
11189
11189
|
constructor(http, pageSize) {
|
|
11190
11190
|
super(http, {
|
|
11191
11191
|
key: "ticket_webhooks",
|
|
@@ -11271,7 +11271,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
|
|
|
11271
11271
|
body: { MaxRecords: limit, filter },
|
|
11272
11272
|
operation
|
|
11273
11273
|
});
|
|
11274
|
-
const { items, pageDetails } =
|
|
11274
|
+
const { items, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res);
|
|
11275
11275
|
return { items, hasMore: pageDetails.nextPageUrl != null };
|
|
11276
11276
|
}
|
|
11277
11277
|
async function windowQuery3(_resource, kind, http, opts) {
|
|
@@ -11290,7 +11290,7 @@ async function customRange3(_resource, from, to, http, opts) {
|
|
|
11290
11290
|
const fromB = customRangeDay(from, "from", zone, "customRange");
|
|
11291
11291
|
const toB = customRangeDay(to, "to", zone, "customRange");
|
|
11292
11292
|
if (fromB.ms > toB.ms) {
|
|
11293
|
-
throw new (0,
|
|
11293
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("customRange: from must not be after to");
|
|
11294
11294
|
}
|
|
11295
11295
|
const toEndMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
11296
11296
|
const filter = [
|
|
@@ -11315,7 +11315,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
|
|
|
11315
11315
|
const fromB = customRangeDay(from, "from", zone, OP2);
|
|
11316
11316
|
const toB = customRangeDay(to, "to", zone, OP2);
|
|
11317
11317
|
if (fromB.ms > toB.ms) {
|
|
11318
|
-
throw new (0,
|
|
11318
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`${OP2}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP2 });
|
|
11319
11319
|
}
|
|
11320
11320
|
const windowToMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
11321
11321
|
const filter = [
|
|
@@ -11382,13 +11382,13 @@ var LINKAGE_OWNED_FIELDS = /* @__PURE__ */ new Set([
|
|
|
11382
11382
|
"roleID"
|
|
11383
11383
|
]);
|
|
11384
11384
|
var TIME_WINDOW_FIELDS = /* @__PURE__ */ new Set(["dateWorked", "startDateTime", "endDateTime", "hoursWorked"]);
|
|
11385
|
-
var ResourceInvalidError = class extends
|
|
11385
|
+
var ResourceInvalidError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
11386
11386
|
constructor(message, options = {}) {
|
|
11387
11387
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
11388
11388
|
this.name = "ResourceInvalidError";
|
|
11389
11389
|
}
|
|
11390
11390
|
};
|
|
11391
|
-
var AllocationCodeError = class extends
|
|
11391
|
+
var AllocationCodeError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
11392
11392
|
/** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
|
|
11393
11393
|
|
|
11394
11394
|
constructor(kind, message, options = {}) {
|
|
@@ -11397,7 +11397,7 @@ var AllocationCodeError = class extends _chunk4RJG73GYcjs.AutotaskError {
|
|
|
11397
11397
|
this.kind = kind;
|
|
11398
11398
|
}
|
|
11399
11399
|
};
|
|
11400
|
-
var NoApplicableAllocationCodeError = class extends
|
|
11400
|
+
var NoApplicableAllocationCodeError = class extends _chunkWRWX6WIKcjs.AutotaskError {
|
|
11401
11401
|
/** The structured blocker details (filters tried + department sets). */
|
|
11402
11402
|
|
|
11403
11403
|
constructor(details, options = {}) {
|
|
@@ -11423,7 +11423,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
11423
11423
|
let pages = 0;
|
|
11424
11424
|
for (; ; ) {
|
|
11425
11425
|
if (pages >= PAGE_GUARD) {
|
|
11426
|
-
throw new (0,
|
|
11426
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
|
|
11427
11427
|
code: "RESOLUTION_TRUNCATED",
|
|
11428
11428
|
category: "resolution",
|
|
11429
11429
|
operation,
|
|
@@ -11434,11 +11434,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
11434
11434
|
const res = await http.request({
|
|
11435
11435
|
method: "POST",
|
|
11436
11436
|
idempotent: true,
|
|
11437
|
-
path: isFirst ? path :
|
|
11437
|
+
path: isFirst ? path : _chunkWRWX6WIKcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
|
|
11438
11438
|
body: { MaxRecords: pageSize, filter },
|
|
11439
11439
|
operation
|
|
11440
11440
|
});
|
|
11441
|
-
const { items: pageItems, pageDetails } =
|
|
11441
|
+
const { items: pageItems, pageDetails } = _chunkWRWX6WIKcjs.unwrapItems.call(void 0, res, operation);
|
|
11442
11442
|
items.push(...pageItems);
|
|
11443
11443
|
pages += 1;
|
|
11444
11444
|
if (items.length >= totalCap) break;
|
|
@@ -11551,8 +11551,8 @@ function windowDefaults(params) {
|
|
|
11551
11551
|
};
|
|
11552
11552
|
}
|
|
11553
11553
|
async function createForResource(resource, resourceID, params, opts = {}, http) {
|
|
11554
|
-
const rid =
|
|
11555
|
-
const pin = (value, label) => typeof value === "number" ?
|
|
11554
|
+
const rid = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
|
|
11555
|
+
const pin = (value, label) => typeof value === "number" ? _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, value, label) : void 0;
|
|
11556
11556
|
const pins = {
|
|
11557
11557
|
code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
|
|
11558
11558
|
ticket: pin(params.ticketID, "ticketID"),
|
|
@@ -11561,19 +11561,19 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11561
11561
|
};
|
|
11562
11562
|
const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
|
|
11563
11563
|
if (pinCount > 1) {
|
|
11564
|
-
throw new (0,
|
|
11564
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
11565
11565
|
"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)",
|
|
11566
11566
|
{ operation: OP }
|
|
11567
11567
|
);
|
|
11568
11568
|
}
|
|
11569
11569
|
if (pins.role !== void 0 && pins.code !== void 0) {
|
|
11570
|
-
throw new (0,
|
|
11570
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
11571
11571
|
"createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
|
|
11572
11572
|
{ operation: OP }
|
|
11573
11573
|
);
|
|
11574
11574
|
}
|
|
11575
11575
|
if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
|
|
11576
|
-
throw new (0,
|
|
11576
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
|
|
11577
11577
|
`createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
|
|
11578
11578
|
{ operation: OP }
|
|
11579
11579
|
);
|
|
@@ -11652,7 +11652,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11652
11652
|
if (usedLinkage === "internal" && linkage === "task") {
|
|
11653
11653
|
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).");
|
|
11654
11654
|
}
|
|
11655
|
-
return
|
|
11655
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0,
|
|
11656
11656
|
{
|
|
11657
11657
|
operation: OP,
|
|
11658
11658
|
method: "POST",
|
|
@@ -11691,7 +11691,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11691
11691
|
};
|
|
11692
11692
|
} catch (err) {
|
|
11693
11693
|
lastError = err;
|
|
11694
|
-
const text =
|
|
11694
|
+
const text = _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkWRWX6WIKcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
|
|
11695
11695
|
const gate3 = ROLE_REJECTION_PATTERN.test(text);
|
|
11696
11696
|
if (usedLinkage !== "internal" && gate3) {
|
|
11697
11697
|
if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
|
|
@@ -11711,14 +11711,14 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11711
11711
|
throw err;
|
|
11712
11712
|
}
|
|
11713
11713
|
}
|
|
11714
|
-
if (
|
|
11714
|
+
if (_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, lastError)) {
|
|
11715
11715
|
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.`;
|
|
11716
11716
|
}
|
|
11717
11717
|
throw lastError;
|
|
11718
11718
|
}
|
|
11719
11719
|
function discoveryField(err, body, defaults) {
|
|
11720
|
-
if (!
|
|
11721
|
-
const entries =
|
|
11720
|
+
if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
11721
|
+
const entries = _chunkWRWX6WIKcjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
11722
11722
|
if (entries === void 0) return null;
|
|
11723
11723
|
for (const entry of entries) {
|
|
11724
11724
|
const field = entry.field;
|
|
@@ -11731,7 +11731,7 @@ function discoveryField(err, body, defaults) {
|
|
|
11731
11731
|
}
|
|
11732
11732
|
|
|
11733
11733
|
// src/resources/time_entries.ts
|
|
11734
|
-
var TimeEntriesResource = class extends
|
|
11734
|
+
var TimeEntriesResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
11735
11735
|
constructor(http, pageSize) {
|
|
11736
11736
|
super(http, {
|
|
11737
11737
|
key: "time_entries",
|
|
@@ -11868,7 +11868,7 @@ var TimeEntriesResource = class extends _chunk4RJG73GYcjs.BaseResource {
|
|
|
11868
11868
|
};
|
|
11869
11869
|
|
|
11870
11870
|
// src/resources/time_entry_attachments.ts
|
|
11871
|
-
var TimeEntryAttachmentsResource = class extends
|
|
11871
|
+
var TimeEntryAttachmentsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
11872
11872
|
constructor(http, pageSize) {
|
|
11873
11873
|
super(http, {
|
|
11874
11874
|
key: "time_entry_attachments",
|
|
@@ -11931,9 +11931,9 @@ var TimeEntryAttachmentsResource = class extends _chunk4RJG73GYcjs.BaseResource
|
|
|
11931
11931
|
|
|
11932
11932
|
// src/resources/special/time_off_requests.ts
|
|
11933
11933
|
async function approve(_resource, id, opts = {}, http) {
|
|
11934
|
-
const numericId =
|
|
11934
|
+
const numericId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
11935
11935
|
if (opts.dryRun === true) {
|
|
11936
|
-
return
|
|
11936
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
11937
11937
|
operation: "time_off_requests.approve",
|
|
11938
11938
|
method: "GET",
|
|
11939
11939
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
@@ -11949,16 +11949,16 @@ async function approve(_resource, id, opts = {}, http) {
|
|
|
11949
11949
|
operation: "time_off_requests.approve",
|
|
11950
11950
|
maxRetries: opts.maxRetries
|
|
11951
11951
|
});
|
|
11952
|
-
return
|
|
11952
|
+
return _chunkWRWX6WIKcjs.unwrapOperation.call(void 0, res);
|
|
11953
11953
|
}
|
|
11954
11954
|
async function reject(_resource, id, reason, opts = {}, http) {
|
|
11955
|
-
const numericId =
|
|
11955
|
+
const numericId = _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, id, "id");
|
|
11956
11956
|
const text = reason.trim();
|
|
11957
11957
|
if (text === "") {
|
|
11958
|
-
throw new (0,
|
|
11958
|
+
throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
|
|
11959
11959
|
}
|
|
11960
11960
|
if (opts.dryRun === true) {
|
|
11961
|
-
return
|
|
11961
|
+
return _chunkWRWX6WIKcjs.buildDryRunResult.call(void 0, {
|
|
11962
11962
|
operation: "time_off_requests.reject",
|
|
11963
11963
|
method: "POST",
|
|
11964
11964
|
path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
|
|
@@ -11976,11 +11976,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
|
|
|
11976
11976
|
operation: "time_off_requests.reject",
|
|
11977
11977
|
maxRetries: opts.maxRetries
|
|
11978
11978
|
});
|
|
11979
|
-
return
|
|
11979
|
+
return _chunkWRWX6WIKcjs.unwrapOperation.call(void 0, res);
|
|
11980
11980
|
}
|
|
11981
11981
|
|
|
11982
11982
|
// src/resources/time_off_requests.ts
|
|
11983
|
-
var TimeOffRequestsResource = class extends
|
|
11983
|
+
var TimeOffRequestsResource = class extends _chunkWRWX6WIKcjs.BaseResource {
|
|
11984
11984
|
constructor(http, pageSize) {
|
|
11985
11985
|
super(http, {
|
|
11986
11986
|
key: "time_off_requests",
|