node-autotask 0.14.0 → 0.16.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 +17 -2
- package/README.md +5 -3
- package/dist/capabilities.d.cts +6 -5
- package/dist/capabilities.d.ts +6 -5
- package/dist/{chunk-2ZZOTJ2C.js → chunk-GWALLMAM.js} +2 -2
- package/dist/{chunk-5QMXECLN.cjs → chunk-L3TK4CN5.cjs} +390 -390
- package/dist/{chunk-XSIY3WRR.cjs → chunk-MAYYTYV5.cjs} +129 -66
- package/dist/{chunk-IYN2BHVW.js → chunk-NB254T3F.js} +1 -1
- package/dist/{chunk-KA6UU26H.js → chunk-U6JUHHMB.js} +70 -7
- package/dist/{chunk-FCJUM42E.cjs → chunk-VCGC6YCI.cjs} +135 -135
- package/dist/{index-zt1KXThi.d.ts → index-CUsvZndu.d.ts} +34 -2
- package/dist/{index-oiwPuJOG.d.cts → index-leMyBJze.d.cts} +34 -2
- package/dist/index.cjs +25 -21
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/operations/index.cjs +100 -100
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +1 -1
- package/dist/pool.cjs +7 -7
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +3 -3
- package/dist/resources/index.cjs +3 -3
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +2 -2
- package/docs/API.md +34 -13
- package/package.json +1 -1
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkMAYYTYV5cjs = require('./chunk-MAYYTYV5.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
var _chunkEWMG3HHUcjs = require('./chunk-EWMG3HHU.cjs');
|
|
40
40
|
|
|
41
41
|
// src/resources/appointments.ts
|
|
42
|
-
var AppointmentsResource = class extends
|
|
42
|
+
var AppointmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
43
43
|
constructor(http, pageSize) {
|
|
44
44
|
super(http, {
|
|
45
45
|
key: "appointments",
|
|
@@ -124,7 +124,7 @@ var AuthenticateResource = class {
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// src/resources/billing_codes.ts
|
|
127
|
-
var BillingCodesResource = class extends
|
|
127
|
+
var BillingCodesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
128
128
|
constructor(http, pageSize) {
|
|
129
129
|
super(http, {
|
|
130
130
|
key: "billing_codes",
|
|
@@ -174,7 +174,7 @@ var MAX_LIMIT = 500;
|
|
|
174
174
|
function clampWindowLimit(limit) {
|
|
175
175
|
const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
|
|
176
176
|
if (!Number.isInteger(n) || n < 1) {
|
|
177
|
-
throw new (0,
|
|
177
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
178
178
|
}
|
|
179
179
|
return Math.min(n, MAX_LIMIT);
|
|
180
180
|
}
|
|
@@ -220,7 +220,7 @@ function wallParts(tz, ms) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
|
|
223
|
-
throw new (0,
|
|
223
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
|
|
224
224
|
}
|
|
225
225
|
return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
|
|
226
226
|
}
|
|
@@ -247,7 +247,7 @@ function localDayEndMs(y, m, d, tz) {
|
|
|
247
247
|
}
|
|
248
248
|
function validateZone(tz, opName = "dateWindow") {
|
|
249
249
|
if (typeof tz !== "string" || tz.length === 0) {
|
|
250
|
-
throw new (0,
|
|
250
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
251
251
|
`${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
252
252
|
{ operation: opName }
|
|
253
253
|
);
|
|
@@ -255,7 +255,7 @@ function validateZone(tz, opName = "dateWindow") {
|
|
|
255
255
|
try {
|
|
256
256
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
257
257
|
} catch (e2) {
|
|
258
|
-
throw new (0,
|
|
258
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
259
259
|
`${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
|
|
260
260
|
{ operation: opName }
|
|
261
261
|
);
|
|
@@ -407,13 +407,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
|
|
|
407
407
|
body: { MaxRecords: limit, filter },
|
|
408
408
|
operation
|
|
409
409
|
});
|
|
410
|
-
return
|
|
410
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
411
411
|
}
|
|
412
412
|
var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
|
|
413
413
|
function customRangeDay(value, label, zone, opName) {
|
|
414
414
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
|
|
415
415
|
if (!m) {
|
|
416
|
-
throw new (0,
|
|
416
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
417
417
|
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)})`,
|
|
418
418
|
{ operation: opName }
|
|
419
419
|
);
|
|
@@ -425,7 +425,7 @@ function customRangeDay(value, label, zone, opName) {
|
|
|
425
425
|
const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
|
|
426
426
|
const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
|
|
427
427
|
if (!Number.isFinite(ms)) {
|
|
428
|
-
throw new (0,
|
|
428
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
429
429
|
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)})`,
|
|
430
430
|
{ operation: opName }
|
|
431
431
|
);
|
|
@@ -436,7 +436,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
436
436
|
const fromB = customRangeDay(from, "from", zone, operation);
|
|
437
437
|
const toB = customRangeDay(to, "to", zone, operation);
|
|
438
438
|
if (fromB.ms > toB.ms) {
|
|
439
|
-
throw new (0,
|
|
439
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
440
440
|
`${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
|
|
441
441
|
{ operation }
|
|
442
442
|
);
|
|
@@ -453,7 +453,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
|
|
|
453
453
|
body: { MaxRecords: limit, filter },
|
|
454
454
|
operation
|
|
455
455
|
});
|
|
456
|
-
return
|
|
456
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
// src/resources/special/billing_items.ts
|
|
@@ -486,7 +486,7 @@ async function customRange(_resource, from, to, http, opts) {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
// src/resources/billing_items.ts
|
|
489
|
-
var BillingItemsResource = class extends
|
|
489
|
+
var BillingItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
490
490
|
constructor(http, pageSize) {
|
|
491
491
|
super(http, {
|
|
492
492
|
key: "billing_items",
|
|
@@ -588,7 +588,7 @@ var BillingItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
588
588
|
};
|
|
589
589
|
|
|
590
590
|
// src/resources/change_request_links.ts
|
|
591
|
-
var ChangeRequestLinksResource = class extends
|
|
591
|
+
var ChangeRequestLinksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
592
592
|
constructor(http, pageSize) {
|
|
593
593
|
super(http, {
|
|
594
594
|
key: "change_request_links",
|
|
@@ -642,7 +642,7 @@ var ChangeRequestLinksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
642
642
|
};
|
|
643
643
|
|
|
644
644
|
// src/resources/checklist_libraries.ts
|
|
645
|
-
var ChecklistLibrariesResource = class extends
|
|
645
|
+
var ChecklistLibrariesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
646
646
|
constructor(http, pageSize) {
|
|
647
647
|
super(http, {
|
|
648
648
|
key: "checklist_libraries",
|
|
@@ -716,7 +716,7 @@ var ChecklistLibrariesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
716
716
|
};
|
|
717
717
|
|
|
718
718
|
// src/resources/checklist_library_checklist_items.ts
|
|
719
|
-
var ChecklistLibraryChecklistItemsResource = class extends
|
|
719
|
+
var ChecklistLibraryChecklistItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
720
720
|
constructor(http, pageSize) {
|
|
721
721
|
super(http, {
|
|
722
722
|
key: "checklist_library_checklist_items",
|
|
@@ -782,7 +782,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkXSIY3WRRcjs.Bas
|
|
|
782
782
|
};
|
|
783
783
|
|
|
784
784
|
// src/resources/classification_icons.ts
|
|
785
|
-
var ClassificationIconsResource = class extends
|
|
785
|
+
var ClassificationIconsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
786
786
|
constructor(http, pageSize) {
|
|
787
787
|
super(http, {
|
|
788
788
|
key: "classification_icons",
|
|
@@ -830,7 +830,7 @@ var DEFAULT_LIMIT2 = 25;
|
|
|
830
830
|
var MAX_LIMIT2 = 500;
|
|
831
831
|
function clampLimit(limit) {
|
|
832
832
|
const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
|
|
833
|
-
if (!Number.isInteger(n) || n < 1) throw new (0,
|
|
833
|
+
if (!Number.isInteger(n) || n < 1) throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
|
|
834
834
|
return Math.min(n, MAX_LIMIT2);
|
|
835
835
|
}
|
|
836
836
|
async function queryCompanies(http, filter, limit) {
|
|
@@ -841,7 +841,7 @@ async function queryCompanies(http, filter, limit) {
|
|
|
841
841
|
body: { MaxRecords: limit, filter },
|
|
842
842
|
operation: "companies.searchByDomain"
|
|
843
843
|
});
|
|
844
|
-
return
|
|
844
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
845
845
|
}
|
|
846
846
|
async function queryContacts(http, filter, limit) {
|
|
847
847
|
const res = await http.request({
|
|
@@ -851,7 +851,7 @@ async function queryContacts(http, filter, limit) {
|
|
|
851
851
|
body: { MaxRecords: limit, filter },
|
|
852
852
|
operation: "companies.searchByDomain"
|
|
853
853
|
});
|
|
854
|
-
return
|
|
854
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
855
855
|
}
|
|
856
856
|
async function fetchCompanies(http, ids, limit) {
|
|
857
857
|
const out = [];
|
|
@@ -866,7 +866,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
866
866
|
const item = body && "item" in body ? body.item : null;
|
|
867
867
|
if (item) out.push(item);
|
|
868
868
|
} catch (err) {
|
|
869
|
-
if (err instanceof
|
|
869
|
+
if (err instanceof _chunkMAYYTYV5cjs.NotFoundError) continue;
|
|
870
870
|
throw err;
|
|
871
871
|
}
|
|
872
872
|
}
|
|
@@ -874,7 +874,7 @@ async function fetchCompanies(http, ids, limit) {
|
|
|
874
874
|
}
|
|
875
875
|
async function searchByDomain(_resource, domain, opts = {}, http) {
|
|
876
876
|
const text = domain.trim();
|
|
877
|
-
if (text === "") throw new (0,
|
|
877
|
+
if (text === "") throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("searchByDomain: empty domain");
|
|
878
878
|
const limit = clampLimit(opts.limit);
|
|
879
879
|
const filter = [{ field: "webAddress", op: "contains", value: text }];
|
|
880
880
|
const direct = await queryCompanies(http, filter, limit);
|
|
@@ -888,7 +888,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
|
|
|
888
888
|
const email = _nullishCoalesce(_optionalChain([identity, 'access', _9 => _9.email, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]), () => ( ""));
|
|
889
889
|
const website = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.website, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
|
|
890
890
|
if (name === "" && email === "" && website === "") {
|
|
891
|
-
throw new (0,
|
|
891
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
|
|
892
892
|
}
|
|
893
893
|
const limit = clampLimit(opts.limit);
|
|
894
894
|
const found = /* @__PURE__ */ new Map();
|
|
@@ -915,23 +915,23 @@ async function familyChildPage(http, parentID) {
|
|
|
915
915
|
path: "/V1.0/Companies/query",
|
|
916
916
|
body: {
|
|
917
917
|
MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
|
|
918
|
-
filter:
|
|
918
|
+
filter: _chunkMAYYTYV5cjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
|
|
919
919
|
},
|
|
920
920
|
operation: "companies.search"
|
|
921
921
|
});
|
|
922
|
-
const { items, pageDetails } =
|
|
922
|
+
const { items, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, "companies.search");
|
|
923
923
|
return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
|
|
924
924
|
}
|
|
925
925
|
function assertSearchWithDetailOpts(opts) {
|
|
926
926
|
if (opts === void 0) return;
|
|
927
927
|
if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
|
|
928
|
-
throw new (0,
|
|
928
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
|
|
929
929
|
operation: "companies.searchWithDetail"
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
932
|
for (const key of Object.keys(opts)) {
|
|
933
933
|
if (key !== "limit") {
|
|
934
|
-
throw new (0,
|
|
934
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
935
935
|
`companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
|
|
936
936
|
{ operation: "companies.searchWithDetail" }
|
|
937
937
|
);
|
|
@@ -940,32 +940,32 @@ function assertSearchWithDetailOpts(opts) {
|
|
|
940
940
|
}
|
|
941
941
|
async function searchWithFamily(_resource, query, opts = {}, http) {
|
|
942
942
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
943
|
-
throw new (0,
|
|
943
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
|
|
944
944
|
}
|
|
945
945
|
for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
|
|
946
946
|
if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
|
|
947
|
-
throw new (0,
|
|
947
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
948
948
|
`companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
|
|
949
949
|
{ operation: "companies.search" }
|
|
950
950
|
);
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
|
|
954
|
-
throw new (0,
|
|
954
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
|
|
955
955
|
operation: "companies.search"
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
const text = query.trim();
|
|
959
|
-
if (text === "") throw new (0,
|
|
960
|
-
const limit = opts.limit === void 0 ? 25 :
|
|
959
|
+
if (text === "") throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
|
|
960
|
+
const limit = opts.limit === void 0 ? 25 : _chunkMAYYTYV5cjs.clampPageSize.call(void 0, opts.limit);
|
|
961
961
|
const res = await http.request({
|
|
962
962
|
method: "POST",
|
|
963
963
|
idempotent: true,
|
|
964
964
|
path: "/V1.0/Companies/query",
|
|
965
|
-
body: { MaxRecords: limit, filter:
|
|
965
|
+
body: { MaxRecords: limit, filter: _chunkMAYYTYV5cjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
|
|
966
966
|
operation: "companies.search"
|
|
967
967
|
});
|
|
968
|
-
const hits =
|
|
968
|
+
const hits = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, "companies.search").items;
|
|
969
969
|
if (opts.includeFamily !== true) return hits;
|
|
970
970
|
const rows = [];
|
|
971
971
|
for (const hit of hits) {
|
|
@@ -989,7 +989,7 @@ var DEFAULT_COMPANY_TYPE = 1;
|
|
|
989
989
|
var DEDUP_NAME_LIMIT = 10;
|
|
990
990
|
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";
|
|
991
991
|
var SAFE_COMPANY_CREATE_DEFAULTS = {};
|
|
992
|
-
var OwnerResourceRequiredError = class extends
|
|
992
|
+
var OwnerResourceRequiredError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
993
993
|
constructor(message, options = {}) {
|
|
994
994
|
super(message, {
|
|
995
995
|
code: "OWNER_RESOURCE_REQUIRED",
|
|
@@ -1000,13 +1000,13 @@ var OwnerResourceRequiredError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
1000
1000
|
this.name = "OwnerResourceRequiredError";
|
|
1001
1001
|
}
|
|
1002
1002
|
};
|
|
1003
|
-
var CompanyResourceInvalidError = class extends
|
|
1003
|
+
var CompanyResourceInvalidError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
1004
1004
|
constructor(message, options = {}) {
|
|
1005
1005
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
1006
1006
|
this.name = "CompanyResourceInvalidError";
|
|
1007
1007
|
}
|
|
1008
1008
|
};
|
|
1009
|
-
var CompanyCreateFailedError = class extends
|
|
1009
|
+
var CompanyCreateFailedError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
1010
1010
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
1011
1011
|
|
|
1012
1012
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -1017,18 +1017,18 @@ var CompanyCreateFailedError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
async function upsertByName(resource, companyName, params, opts, http) {
|
|
1019
1019
|
if (typeof companyName !== "string" || companyName.trim() === "") {
|
|
1020
|
-
throw new (0,
|
|
1020
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
|
|
1021
1021
|
}
|
|
1022
1022
|
if (typeof _optionalChain([params, 'optionalAccess', _15 => _15.phone]) !== "string" || params.phone.trim() === "") {
|
|
1023
|
-
throw new (0,
|
|
1023
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
1024
1024
|
}
|
|
1025
1025
|
const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
|
|
1026
1026
|
if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
|
|
1027
|
-
throw new (0,
|
|
1027
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
1028
1028
|
}
|
|
1029
1029
|
const owner = params.ownerResourceID;
|
|
1030
1030
|
if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
|
|
1031
|
-
throw new (0,
|
|
1031
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
|
|
1032
1032
|
}
|
|
1033
1033
|
const q = await resource.queryBounded({ filter: [{ field: "companyName", op: "eq", value: companyName }], limit: DEDUP_NAME_LIMIT });
|
|
1034
1034
|
const caveat = {
|
|
@@ -1039,7 +1039,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1039
1039
|
const match = q.items[0];
|
|
1040
1040
|
if (match !== void 0) {
|
|
1041
1041
|
if (opts.dryRun === true) {
|
|
1042
|
-
return
|
|
1042
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
1043
1043
|
{
|
|
1044
1044
|
operation: OP_UPSERT_NAME,
|
|
1045
1045
|
method: "POST",
|
|
@@ -1074,7 +1074,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1074
1074
|
"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"
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
|
-
return
|
|
1077
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
1078
1078
|
{
|
|
1079
1079
|
operation: OP_UPSERT_NAME,
|
|
1080
1080
|
method: "POST",
|
|
@@ -1122,8 +1122,8 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1122
1122
|
sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
|
|
1123
1123
|
};
|
|
1124
1124
|
} catch (err) {
|
|
1125
|
-
if (!
|
|
1126
|
-
const named = (_nullishCoalesce(
|
|
1125
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
1126
|
+
const named = (_nullishCoalesce(_chunkMAYYTYV5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
1127
1127
|
const seen = /* @__PURE__ */ new Set();
|
|
1128
1128
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
1129
1129
|
const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -1137,7 +1137,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
continue;
|
|
1139
1139
|
}
|
|
1140
|
-
const detail =
|
|
1140
|
+
const detail = _chunkMAYYTYV5cjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
1141
1141
|
throw new CompanyCreateFailedError(
|
|
1142
1142
|
`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}` : ""}`,
|
|
1143
1143
|
unique,
|
|
@@ -1156,7 +1156,7 @@ var PROFILE_PART_LIMIT = 50;
|
|
|
1156
1156
|
function profilePartLimit(value, name) {
|
|
1157
1157
|
const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
|
|
1158
1158
|
if (!Number.isInteger(n) || n < 1) {
|
|
1159
|
-
throw new (0,
|
|
1159
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
1160
1160
|
}
|
|
1161
1161
|
return n;
|
|
1162
1162
|
}
|
|
@@ -1168,14 +1168,14 @@ async function scopedCompanyQuery(http, path, companyID, limit) {
|
|
|
1168
1168
|
body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }] },
|
|
1169
1169
|
operation: "companies.fullProfile"
|
|
1170
1170
|
});
|
|
1171
|
-
return
|
|
1171
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
1172
1172
|
}
|
|
1173
1173
|
async function fullProfile(resource, id, opts = {}, http) {
|
|
1174
1174
|
const contactLimit = profilePartLimit(opts.contactLimit, "contactLimit");
|
|
1175
1175
|
const noteLimit = profilePartLimit(opts.noteLimit, "noteLimit");
|
|
1176
1176
|
const ticketLimit = profilePartLimit(opts.ticketLimit, "ticketLimit");
|
|
1177
1177
|
const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
|
|
1178
|
-
const companyID =
|
|
1178
|
+
const companyID = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
1179
1179
|
const company = await resource.get(companyID);
|
|
1180
1180
|
const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, PROFILE_PART_LIMIT);
|
|
1181
1181
|
const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit);
|
|
@@ -1192,7 +1192,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1192
1192
|
},
|
|
1193
1193
|
operation: "companies.fullProfile"
|
|
1194
1194
|
});
|
|
1195
|
-
return
|
|
1195
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
1196
1196
|
})();
|
|
1197
1197
|
let openTickets = {
|
|
1198
1198
|
items: openRows,
|
|
@@ -1201,7 +1201,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1201
1201
|
note: OPEN_TICKETS_NOTE
|
|
1202
1202
|
};
|
|
1203
1203
|
if (openRows.length === 0) {
|
|
1204
|
-
const stamp =
|
|
1204
|
+
const stamp = _chunkMAYYTYV5cjs.blindStampFor.call(void 0, _optionalChain([_chunkMAYYTYV5cjs.BLIND_SURFACE_STAMPS, 'access', _16 => _16["tickets"], 'optionalAccess', _17 => _17.query]), [
|
|
1205
1205
|
{ field: "companyID", op: "eq", value: companyID },
|
|
1206
1206
|
{ field: "status", op: "noteq", value: 5 }
|
|
1207
1207
|
]);
|
|
@@ -1232,7 +1232,7 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
};
|
|
1234
1234
|
if (opts.names === true) {
|
|
1235
|
-
const builder =
|
|
1235
|
+
const builder = _chunkMAYYTYV5cjs.createNamePlan.call(void 0, _chunkMAYYTYV5cjs.TICKET_LABEL_FIELDS);
|
|
1236
1236
|
const c = company;
|
|
1237
1237
|
builder.addResource(c["ownerResourceID"]);
|
|
1238
1238
|
builder.addResource(c["createdByResourceID"]);
|
|
@@ -1249,20 +1249,20 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1249
1249
|
builder.addResource(r["creatorResourceID"]);
|
|
1250
1250
|
builder.addFk("contract", r["contractID"]);
|
|
1251
1251
|
}
|
|
1252
|
-
const names = await
|
|
1252
|
+
const names = await _chunkMAYYTYV5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
1253
1253
|
const companyRow = { ...company };
|
|
1254
|
-
|
|
1255
|
-
|
|
1254
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
|
|
1255
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
|
|
1256
1256
|
result.company = companyRow;
|
|
1257
1257
|
result.openTickets = {
|
|
1258
1258
|
...openTickets,
|
|
1259
1259
|
items: openTickets.items.map((row) => {
|
|
1260
1260
|
const r = { ...row };
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
for (const f of
|
|
1261
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1262
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1263
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
1264
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
1265
|
+
for (const f of _chunkMAYYTYV5cjs.TICKET_LABEL_FIELDS) _chunkMAYYTYV5cjs.addLabelSibling.call(void 0, r, f, names);
|
|
1266
1266
|
return r;
|
|
1267
1267
|
})
|
|
1268
1268
|
};
|
|
@@ -1270,9 +1270,9 @@ async function fullProfile(resource, id, opts = {}, http) {
|
|
|
1270
1270
|
...result.projects,
|
|
1271
1271
|
items: result.projects.items.map((row) => {
|
|
1272
1272
|
const r = { ...row };
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1273
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
|
|
1274
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
|
|
1275
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
|
|
1276
1276
|
return r;
|
|
1277
1277
|
})
|
|
1278
1278
|
};
|
|
@@ -1304,7 +1304,7 @@ function isDateYMD(v) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
function validateUnbilledWorkOptions(companyId, opts) {
|
|
1306
1306
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1307
|
-
throw new (0,
|
|
1307
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
1308
1308
|
`unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
1309
1309
|
{ operation: "companies.unbilledWork" }
|
|
1310
1310
|
);
|
|
@@ -1333,7 +1333,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1333
1333
|
try {
|
|
1334
1334
|
limit = clampLimit(opts.limit);
|
|
1335
1335
|
} catch (err) {
|
|
1336
|
-
problems.push(err instanceof
|
|
1336
|
+
problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
1337
1337
|
limit = 50;
|
|
1338
1338
|
}
|
|
1339
1339
|
if (source === "date_range") {
|
|
@@ -1348,9 +1348,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1348
1348
|
problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
|
|
1349
1349
|
} else {
|
|
1350
1350
|
try {
|
|
1351
|
-
|
|
1351
|
+
_chunkMAYYTYV5cjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
|
|
1352
1352
|
} catch (err) {
|
|
1353
|
-
problems.push(err instanceof
|
|
1353
|
+
problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
@@ -1360,20 +1360,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
|
|
|
1360
1360
|
} else {
|
|
1361
1361
|
opts.ticketIds.forEach((tid, i) => {
|
|
1362
1362
|
try {
|
|
1363
|
-
|
|
1363
|
+
_chunkMAYYTYV5cjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
|
|
1364
1364
|
} catch (err) {
|
|
1365
|
-
problems.push(err instanceof
|
|
1365
|
+
problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
|
|
1366
1366
|
}
|
|
1367
1367
|
});
|
|
1368
1368
|
}
|
|
1369
1369
|
}
|
|
1370
1370
|
try {
|
|
1371
|
-
|
|
1371
|
+
_chunkMAYYTYV5cjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1372
1372
|
} catch (err) {
|
|
1373
|
-
problems.push(err instanceof
|
|
1373
|
+
problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
|
|
1374
1374
|
}
|
|
1375
1375
|
if (problems.length > 0) {
|
|
1376
|
-
throw new (0,
|
|
1376
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
1377
1377
|
`unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
1378
1378
|
- ` + problems.join("\n- "),
|
|
1379
1379
|
{ operation: "companies.unbilledWork" }
|
|
@@ -1402,7 +1402,7 @@ async function boundedPart(http, path, conditions, limit, includeFields) {
|
|
|
1402
1402
|
body,
|
|
1403
1403
|
operation: "companies.unbilledWork"
|
|
1404
1404
|
});
|
|
1405
|
-
const { items, pageDetails } =
|
|
1405
|
+
const { items, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, "companies.unbilledWork");
|
|
1406
1406
|
const capped = items.length >= limit;
|
|
1407
1407
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
1408
1408
|
}
|
|
@@ -1413,7 +1413,7 @@ function capJoinSet(ids, cap) {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
function unbilledWorkPartStatus(key, conditions, items) {
|
|
1415
1415
|
if (items.length !== 0) return { status: "ok" };
|
|
1416
|
-
const stamp =
|
|
1416
|
+
const stamp = _chunkMAYYTYV5cjs.blindStampFor.call(void 0, _optionalChain([_chunkMAYYTYV5cjs.BLIND_SURFACE_STAMPS, 'access', _18 => _18[key], 'optionalAccess', _19 => _19.query]), conditions);
|
|
1417
1417
|
if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
|
|
1418
1418
|
return {
|
|
1419
1419
|
status: "ok",
|
|
@@ -1422,7 +1422,7 @@ function unbilledWorkPartStatus(key, conditions, items) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
1424
1424
|
const v = validateUnbilledWorkOptions(companyId, opts);
|
|
1425
|
-
const id =
|
|
1425
|
+
const id = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, companyId, "companyId");
|
|
1426
1426
|
const company = await resource.get(id);
|
|
1427
1427
|
const companyIds = [num(company.id)];
|
|
1428
1428
|
let parent = null;
|
|
@@ -1435,7 +1435,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1435
1435
|
parentStatus = "ok";
|
|
1436
1436
|
companyIds.push(num(parent.id));
|
|
1437
1437
|
} catch (err) {
|
|
1438
|
-
if (err instanceof
|
|
1438
|
+
if (err instanceof _chunkMAYYTYV5cjs.NotFoundError) parent = null;
|
|
1439
1439
|
else throw err;
|
|
1440
1440
|
}
|
|
1441
1441
|
}
|
|
@@ -1467,7 +1467,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1467
1467
|
if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
|
|
1468
1468
|
if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
|
|
1469
1469
|
}
|
|
1470
|
-
const billingFields =
|
|
1470
|
+
const billingFields = _chunkMAYYTYV5cjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
|
|
1471
1471
|
const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
|
|
1472
1472
|
const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, billingIncludeFields);
|
|
1473
1473
|
const taskCap = capJoinSet(taskIds, UNBILLED_WORK_JOIN_SET_CAP);
|
|
@@ -1499,7 +1499,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1499
1499
|
let cappedItems = entries;
|
|
1500
1500
|
let noteCharsTruncated = 0;
|
|
1501
1501
|
if (v.includeNotes) {
|
|
1502
|
-
[cappedItems, noteCharsTruncated] =
|
|
1502
|
+
[cappedItems, noteCharsTruncated] = _chunkMAYYTYV5cjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
|
|
1503
1503
|
}
|
|
1504
1504
|
const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
|
|
1505
1505
|
timePart = {
|
|
@@ -1514,8 +1514,8 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1514
1514
|
let billingItems = billingRaw.items;
|
|
1515
1515
|
let billingNoteCharsTruncated = 0;
|
|
1516
1516
|
if (v.includeNotes) {
|
|
1517
|
-
const noteFields = (_nullishCoalesce(
|
|
1518
|
-
[billingItems, billingNoteCharsTruncated] =
|
|
1517
|
+
const noteFields = (_nullishCoalesce(_chunkMAYYTYV5cjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
|
|
1518
|
+
[billingItems, billingNoteCharsTruncated] = _chunkMAYYTYV5cjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
|
|
1519
1519
|
}
|
|
1520
1520
|
const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
|
|
1521
1521
|
const billingItemsPart = {
|
|
@@ -1612,7 +1612,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
|
|
|
1612
1612
|
}
|
|
1613
1613
|
|
|
1614
1614
|
// src/resources/companies.ts
|
|
1615
|
-
var CompaniesResource = class extends
|
|
1615
|
+
var CompaniesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1616
1616
|
constructor(http, pageSize) {
|
|
1617
1617
|
super(http, {
|
|
1618
1618
|
key: "companies",
|
|
@@ -1719,7 +1719,7 @@ var CompaniesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
1719
1719
|
};
|
|
1720
1720
|
|
|
1721
1721
|
// src/resources/company_alerts.ts
|
|
1722
|
-
var CompanyAlertsResource = class extends
|
|
1722
|
+
var CompanyAlertsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1723
1723
|
constructor(http, pageSize) {
|
|
1724
1724
|
super(http, {
|
|
1725
1725
|
key: "company_alerts",
|
|
@@ -1785,7 +1785,7 @@ var CompanyAlertsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
1785
1785
|
};
|
|
1786
1786
|
|
|
1787
1787
|
// src/resources/company_locations.ts
|
|
1788
|
-
var CompanyLocationsResource = class extends
|
|
1788
|
+
var CompanyLocationsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1789
1789
|
constructor(http, pageSize) {
|
|
1790
1790
|
super(http, {
|
|
1791
1791
|
key: "company_locations",
|
|
@@ -1856,7 +1856,7 @@ var CompanyLocationsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
1856
1856
|
};
|
|
1857
1857
|
|
|
1858
1858
|
// src/resources/company_notes.ts
|
|
1859
|
-
var CompanyNotesResource = class extends
|
|
1859
|
+
var CompanyNotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1860
1860
|
constructor(http, pageSize) {
|
|
1861
1861
|
super(http, {
|
|
1862
1862
|
key: "company_notes",
|
|
@@ -1921,7 +1921,7 @@ var CompanyNotesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
1921
1921
|
};
|
|
1922
1922
|
|
|
1923
1923
|
// src/resources/company_site_configurations.ts
|
|
1924
|
-
var CompanySiteConfigurationsResource = class extends
|
|
1924
|
+
var CompanySiteConfigurationsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1925
1925
|
constructor(http, pageSize) {
|
|
1926
1926
|
super(http, {
|
|
1927
1927
|
key: "company_site_configurations",
|
|
@@ -1972,7 +1972,7 @@ var CompanySiteConfigurationsResource = class extends _chunkXSIY3WRRcjs.BaseReso
|
|
|
1972
1972
|
};
|
|
1973
1973
|
|
|
1974
1974
|
// src/resources/company_webhooks.ts
|
|
1975
|
-
var CompanyWebhooksResource = class extends
|
|
1975
|
+
var CompanyWebhooksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
1976
1976
|
constructor(http, pageSize) {
|
|
1977
1977
|
super(http, {
|
|
1978
1978
|
key: "company_webhooks",
|
|
@@ -2048,7 +2048,7 @@ var CompanyWebhooksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
2048
2048
|
};
|
|
2049
2049
|
|
|
2050
2050
|
// src/resources/configuration_item_billing_product_associations.ts
|
|
2051
|
-
var ConfigurationItemBillingProductAssociationsResource = class extends
|
|
2051
|
+
var ConfigurationItemBillingProductAssociationsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2052
2052
|
constructor(http, pageSize) {
|
|
2053
2053
|
super(http, {
|
|
2054
2054
|
key: "configuration_item_billing_product_associations",
|
|
@@ -2114,7 +2114,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkXS
|
|
|
2114
2114
|
};
|
|
2115
2115
|
|
|
2116
2116
|
// src/resources/configuration_item_categories.ts
|
|
2117
|
-
var ConfigurationItemCategoriesResource = class extends
|
|
2117
|
+
var ConfigurationItemCategoriesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2118
2118
|
constructor(http, pageSize) {
|
|
2119
2119
|
super(http, {
|
|
2120
2120
|
key: "configuration_item_categories",
|
|
@@ -2181,7 +2181,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkXSIY3WRRcjs.BaseRe
|
|
|
2181
2181
|
};
|
|
2182
2182
|
|
|
2183
2183
|
// src/resources/configuration_item_category_udf_associations.ts
|
|
2184
|
-
var ConfigurationItemCategoryUdfAssociationsResource = class extends
|
|
2184
|
+
var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2185
2185
|
constructor(http, pageSize) {
|
|
2186
2186
|
super(http, {
|
|
2187
2187
|
key: "configuration_item_category_udf_associations",
|
|
@@ -2247,7 +2247,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkXSIY3
|
|
|
2247
2247
|
};
|
|
2248
2248
|
|
|
2249
2249
|
// src/resources/configuration_item_dns_records.ts
|
|
2250
|
-
var ConfigurationItemDnsRecordsResource = class extends
|
|
2250
|
+
var ConfigurationItemDnsRecordsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2251
2251
|
constructor(http, pageSize) {
|
|
2252
2252
|
super(http, {
|
|
2253
2253
|
key: "configuration_item_dns_records",
|
|
@@ -2296,7 +2296,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkXSIY3WRRcjs.BaseRe
|
|
|
2296
2296
|
};
|
|
2297
2297
|
|
|
2298
2298
|
// src/resources/configuration_item_notes.ts
|
|
2299
|
-
var ConfigurationItemNotesResource = class extends
|
|
2299
|
+
var ConfigurationItemNotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2300
2300
|
constructor(http, pageSize) {
|
|
2301
2301
|
super(http, {
|
|
2302
2302
|
key: "configuration_item_notes",
|
|
@@ -2355,7 +2355,7 @@ var ConfigurationItemNotesResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
2355
2355
|
};
|
|
2356
2356
|
|
|
2357
2357
|
// src/resources/configuration_item_related_items.ts
|
|
2358
|
-
var ConfigurationItemRelatedItemsResource = class extends
|
|
2358
|
+
var ConfigurationItemRelatedItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2359
2359
|
constructor(http, pageSize) {
|
|
2360
2360
|
super(http, {
|
|
2361
2361
|
key: "configuration_item_related_items",
|
|
@@ -2416,16 +2416,16 @@ async function fetchRecord(http, path, label, readOpts) {
|
|
|
2416
2416
|
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _20 => _20.maxRetries]) });
|
|
2417
2417
|
const body = res;
|
|
2418
2418
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
2419
|
-
throw new (0,
|
|
2419
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
2420
2420
|
}
|
|
2421
2421
|
return body.item;
|
|
2422
2422
|
}
|
|
2423
2423
|
async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
2424
|
-
const numericSource =
|
|
2424
|
+
const numericSource = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, sourceId, "sourceId");
|
|
2425
2425
|
if (_optionalChain([opts, 'optionalAccess', _21 => _21.destinationCompanyId]) === void 0) {
|
|
2426
|
-
throw new (0,
|
|
2426
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
|
|
2427
2427
|
}
|
|
2428
|
-
const destId =
|
|
2428
|
+
const destId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
|
|
2429
2429
|
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
|
|
2430
2430
|
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
|
|
2431
2431
|
const body = { ...source };
|
|
@@ -2435,20 +2435,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2435
2435
|
body.companyID = destId;
|
|
2436
2436
|
body.isActive = true;
|
|
2437
2437
|
if (opts.newReferenceTitle !== void 0) {
|
|
2438
|
-
if (opts.newReferenceTitle.trim() === "") throw new (0,
|
|
2438
|
+
if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
|
|
2439
2439
|
body.referenceTitle = opts.newReferenceTitle.trim();
|
|
2440
2440
|
}
|
|
2441
2441
|
if (opts.lastModifiedDate !== void 0) {
|
|
2442
2442
|
const current = source.lastModifiedDate;
|
|
2443
2443
|
if (current !== opts.lastModifiedDate) {
|
|
2444
|
-
throw new (0,
|
|
2444
|
+
throw new (0, _chunkMAYYTYV5cjs.StaleObjectError)(
|
|
2445
2445
|
`moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
|
|
2446
2446
|
{ operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource] }
|
|
2447
2447
|
);
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
2450
|
if (opts.dryRun === true) {
|
|
2451
|
-
return
|
|
2451
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
2452
2452
|
operation: "configuration_items.moveConfigurationItem",
|
|
2453
2453
|
method: "POST",
|
|
2454
2454
|
path: "/V1.0/ConfigurationItems",
|
|
@@ -2473,7 +2473,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2473
2473
|
const createdBody = created;
|
|
2474
2474
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
2475
2475
|
if (typeof newId !== "number") {
|
|
2476
|
-
throw new (0,
|
|
2476
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
|
|
2477
2477
|
}
|
|
2478
2478
|
let sourceDeactivated = false;
|
|
2479
2479
|
if (opts.deactivateSource !== false) {
|
|
@@ -2492,7 +2492,7 @@ var PROFILE_PART_LIMIT2 = 50;
|
|
|
2492
2492
|
function profilePartLimit2(value, name) {
|
|
2493
2493
|
const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
|
|
2494
2494
|
if (!Number.isInteger(n) || n < 1) {
|
|
2495
|
-
throw new (0,
|
|
2495
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
2496
2496
|
}
|
|
2497
2497
|
return n;
|
|
2498
2498
|
}
|
|
@@ -2508,14 +2508,14 @@ async function contextFetchPart(http, entityPath, referenceId) {
|
|
|
2508
2508
|
});
|
|
2509
2509
|
const body = res;
|
|
2510
2510
|
if (body === null || !("item" in body)) {
|
|
2511
|
-
throw new (0,
|
|
2511
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId] });
|
|
2512
2512
|
}
|
|
2513
2513
|
if (body.item === null || body.item === void 0) {
|
|
2514
|
-
throw new (0,
|
|
2514
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)("context part not found", { resourceIds: [referenceId] });
|
|
2515
2515
|
}
|
|
2516
2516
|
return body.item;
|
|
2517
2517
|
} catch (err) {
|
|
2518
|
-
if (err instanceof
|
|
2518
|
+
if (err instanceof _chunkMAYYTYV5cjs.NotFoundError) return null;
|
|
2519
2519
|
throw err;
|
|
2520
2520
|
}
|
|
2521
2521
|
}
|
|
@@ -2527,7 +2527,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
|
|
|
2527
2527
|
body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
|
|
2528
2528
|
operation: "configuration_items.profile"
|
|
2529
2529
|
});
|
|
2530
|
-
return
|
|
2530
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
2531
2531
|
}
|
|
2532
2532
|
async function profile(resource, id, opts = {}, http) {
|
|
2533
2533
|
const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
|
|
@@ -2539,7 +2539,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2539
2539
|
const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
|
|
2540
2540
|
const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
|
|
2541
2541
|
const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
|
|
2542
|
-
const wallQuirk = _optionalChain([
|
|
2542
|
+
const wallQuirk = _optionalChain([_chunkMAYYTYV5cjs.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"))]);
|
|
2543
2543
|
const productAssociations = {
|
|
2544
2544
|
items: associations,
|
|
2545
2545
|
capped: associations.length >= PROFILE_PART_LIMIT2,
|
|
@@ -2563,11 +2563,11 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2563
2563
|
}
|
|
2564
2564
|
};
|
|
2565
2565
|
if (opts.names === true) {
|
|
2566
|
-
const builder =
|
|
2566
|
+
const builder = _chunkMAYYTYV5cjs.createNamePlan.call(void 0, );
|
|
2567
2567
|
builder.addFk("contract", root["contractID"]);
|
|
2568
|
-
const names = await
|
|
2568
|
+
const names = await _chunkMAYYTYV5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
2569
2569
|
const ciRow = { ...ci };
|
|
2570
|
-
|
|
2570
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
|
|
2571
2571
|
result.ci = ciRow;
|
|
2572
2572
|
result.names = names.section;
|
|
2573
2573
|
}
|
|
@@ -2575,7 +2575,7 @@ async function profile(resource, id, opts = {}, http) {
|
|
|
2575
2575
|
}
|
|
2576
2576
|
|
|
2577
2577
|
// src/resources/configuration_items.ts
|
|
2578
|
-
var ConfigurationItemsResource = class extends
|
|
2578
|
+
var ConfigurationItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2579
2579
|
constructor(http, pageSize) {
|
|
2580
2580
|
super(http, {
|
|
2581
2581
|
key: "configuration_items",
|
|
@@ -2664,7 +2664,7 @@ var ConfigurationItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
2664
2664
|
};
|
|
2665
2665
|
|
|
2666
2666
|
// src/resources/configuration_item_ssl_subject_alternative_names.ts
|
|
2667
|
-
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends
|
|
2667
|
+
var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2668
2668
|
constructor(http, pageSize) {
|
|
2669
2669
|
super(http, {
|
|
2670
2670
|
key: "configuration_item_ssl_subject_alternative_names",
|
|
@@ -2727,7 +2727,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkXS
|
|
|
2727
2727
|
};
|
|
2728
2728
|
|
|
2729
2729
|
// src/resources/configuration_item_types.ts
|
|
2730
|
-
var ConfigurationItemTypesResource = class extends
|
|
2730
|
+
var ConfigurationItemTypesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2731
2731
|
constructor(http, pageSize) {
|
|
2732
2732
|
super(http, {
|
|
2733
2733
|
key: "configuration_item_types",
|
|
@@ -2801,7 +2801,7 @@ var ConfigurationItemTypesResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
2801
2801
|
};
|
|
2802
2802
|
|
|
2803
2803
|
// src/resources/configuration_item_webhooks.ts
|
|
2804
|
-
var ConfigurationItemWebhooksResource = class extends
|
|
2804
|
+
var ConfigurationItemWebhooksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2805
2805
|
constructor(http, pageSize) {
|
|
2806
2806
|
super(http, {
|
|
2807
2807
|
key: "configuration_item_webhooks",
|
|
@@ -2877,7 +2877,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkXSIY3WRRcjs.BaseReso
|
|
|
2877
2877
|
};
|
|
2878
2878
|
|
|
2879
2879
|
// src/resources/contact_group_contacts.ts
|
|
2880
|
-
var ContactGroupContactsResource = class extends
|
|
2880
|
+
var ContactGroupContactsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2881
2881
|
constructor(http, pageSize) {
|
|
2882
2882
|
super(http, {
|
|
2883
2883
|
key: "contact_group_contacts",
|
|
@@ -2931,7 +2931,7 @@ var ContactGroupContactsResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
2931
2931
|
};
|
|
2932
2932
|
|
|
2933
2933
|
// src/resources/contact_groups.ts
|
|
2934
|
-
var ContactGroupsResource = class extends
|
|
2934
|
+
var ContactGroupsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
2935
2935
|
constructor(http, pageSize) {
|
|
2936
2936
|
super(http, {
|
|
2937
2937
|
key: "contact_groups",
|
|
@@ -3009,22 +3009,22 @@ async function fetchRecord2(http, path, label, readOpts) {
|
|
|
3009
3009
|
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _27 => _27.maxRetries]) });
|
|
3010
3010
|
const body = res;
|
|
3011
3011
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
3012
|
-
throw new (0,
|
|
3012
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
3013
3013
|
}
|
|
3014
3014
|
return body.item;
|
|
3015
3015
|
}
|
|
3016
3016
|
async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
|
|
3017
|
-
const sourceId =
|
|
3018
|
-
const destId =
|
|
3017
|
+
const sourceId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
|
|
3018
|
+
const destId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
|
|
3019
3019
|
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
|
|
3020
3020
|
const companyID = source.companyID;
|
|
3021
3021
|
if (typeof companyID !== "number" || companyID < 0) {
|
|
3022
|
-
throw new (0,
|
|
3022
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
|
|
3023
3023
|
}
|
|
3024
3024
|
if (opts.lastModifiedDate !== void 0) {
|
|
3025
3025
|
const current = source.lastModifiedDate;
|
|
3026
3026
|
if (current !== opts.lastModifiedDate) {
|
|
3027
|
-
throw new (0,
|
|
3027
|
+
throw new (0, _chunkMAYYTYV5cjs.StaleObjectError)(
|
|
3028
3028
|
`moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
|
|
3029
3029
|
{ operation: "contacts.moveToCompany", resourceIds: [sourceId, destId] }
|
|
3030
3030
|
);
|
|
@@ -3046,10 +3046,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3046
3046
|
},
|
|
3047
3047
|
operation: "contacts.moveToCompany"
|
|
3048
3048
|
});
|
|
3049
|
-
const items =
|
|
3049
|
+
const items = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
3050
3050
|
const clash = items.find((c) => String(c.id) !== String(sourceId));
|
|
3051
3051
|
if (clash !== void 0) {
|
|
3052
|
-
throw new (0,
|
|
3052
|
+
throw new (0, _chunkMAYYTYV5cjs.ConflictError)(
|
|
3053
3053
|
`Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
|
|
3054
3054
|
{ resourceIds: [sourceId, destId] }
|
|
3055
3055
|
);
|
|
@@ -3063,7 +3063,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3063
3063
|
if (opts.dryRun === true) {
|
|
3064
3064
|
const warnings = [];
|
|
3065
3065
|
if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
|
|
3066
|
-
return
|
|
3066
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
3067
3067
|
operation: "contacts.moveToCompany",
|
|
3068
3068
|
method: "POST",
|
|
3069
3069
|
path: `/V1.0/Companies/${destId}/Contacts`,
|
|
@@ -3089,7 +3089,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3089
3089
|
const createdBody = created;
|
|
3090
3090
|
const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
|
|
3091
3091
|
if (typeof newId !== "number") {
|
|
3092
|
-
throw new (0,
|
|
3092
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
|
|
3093
3093
|
}
|
|
3094
3094
|
let sourceDeleted = false;
|
|
3095
3095
|
if (opts.deleteSource === true) {
|
|
@@ -3108,7 +3108,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
|
|
|
3108
3108
|
var EMAIL_SHAPE = /^.+@.+/;
|
|
3109
3109
|
var SAFE_CONTACT_CREATE_DEFAULTS = {};
|
|
3110
3110
|
var DEDUP_LIMIT = 10;
|
|
3111
|
-
var CompanyNotFoundError = class extends
|
|
3111
|
+
var CompanyNotFoundError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
3112
3112
|
constructor(message, options = {}) {
|
|
3113
3113
|
super(message, {
|
|
3114
3114
|
code: "COMPANY_NOT_FOUND",
|
|
@@ -3119,7 +3119,7 @@ var CompanyNotFoundError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
3119
3119
|
this.name = "CompanyNotFoundError";
|
|
3120
3120
|
}
|
|
3121
3121
|
};
|
|
3122
|
-
var ContactCreateFailedError = class extends
|
|
3122
|
+
var ContactCreateFailedError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
3123
3123
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
3124
3124
|
|
|
3125
3125
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -3129,25 +3129,25 @@ var ContactCreateFailedError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
3129
3129
|
}
|
|
3130
3130
|
};
|
|
3131
3131
|
async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
3132
|
-
const cid =
|
|
3132
|
+
const cid = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, companyID, "companyID");
|
|
3133
3133
|
if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
|
|
3134
|
-
throw new (0,
|
|
3134
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
3135
3135
|
`upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
|
|
3136
3136
|
{ operation: OP_UPSERT_EMAIL }
|
|
3137
3137
|
);
|
|
3138
3138
|
}
|
|
3139
3139
|
if (extra !== void 0) {
|
|
3140
3140
|
if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
|
|
3141
|
-
throw new (0,
|
|
3141
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
3142
3142
|
`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)})`,
|
|
3143
3143
|
{ operation: OP_UPSERT_EMAIL }
|
|
3144
3144
|
);
|
|
3145
3145
|
}
|
|
3146
3146
|
if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
|
|
3147
|
-
throw new (0,
|
|
3147
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
3148
3148
|
}
|
|
3149
3149
|
if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
|
|
3150
|
-
throw new (0,
|
|
3150
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
3151
3151
|
}
|
|
3152
3152
|
}
|
|
3153
3153
|
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
|
|
@@ -3168,7 +3168,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3168
3168
|
const match = q.items[0];
|
|
3169
3169
|
if (match !== void 0) {
|
|
3170
3170
|
if (opts.dryRun === true) {
|
|
3171
|
-
return
|
|
3171
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
3172
3172
|
{
|
|
3173
3173
|
operation: OP_UPSERT_EMAIL,
|
|
3174
3174
|
method: "POST",
|
|
@@ -3198,7 +3198,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3198
3198
|
isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
|
|
3199
3199
|
};
|
|
3200
3200
|
if (opts.dryRun === true) {
|
|
3201
|
-
return
|
|
3201
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
3202
3202
|
{
|
|
3203
3203
|
operation: OP_UPSERT_EMAIL,
|
|
3204
3204
|
method: "POST",
|
|
@@ -3221,8 +3221,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3221
3221
|
const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
|
|
3222
3222
|
return { id: created.id, created: true };
|
|
3223
3223
|
} catch (err) {
|
|
3224
|
-
if (!
|
|
3225
|
-
const named = (_nullishCoalesce(
|
|
3224
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
|
|
3225
|
+
const named = (_nullishCoalesce(_chunkMAYYTYV5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
|
|
3226
3226
|
const seen = /* @__PURE__ */ new Set();
|
|
3227
3227
|
const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
|
|
3228
3228
|
const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
|
|
@@ -3236,7 +3236,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3236
3236
|
}
|
|
3237
3237
|
continue;
|
|
3238
3238
|
}
|
|
3239
|
-
const detail =
|
|
3239
|
+
const detail = _chunkMAYYTYV5cjs.formatVendorDetail.call(void 0, err.vendorError);
|
|
3240
3240
|
throw new ContactCreateFailedError(
|
|
3241
3241
|
`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}` : ""}`,
|
|
3242
3242
|
unique,
|
|
@@ -3252,7 +3252,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3252
3252
|
}
|
|
3253
3253
|
|
|
3254
3254
|
// src/resources/contacts.ts
|
|
3255
|
-
var ContactsResource = class extends
|
|
3255
|
+
var ContactsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3256
3256
|
constructor(http, pageSize) {
|
|
3257
3257
|
super(http, {
|
|
3258
3258
|
key: "contacts",
|
|
@@ -3344,7 +3344,7 @@ var ContactsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
3344
3344
|
};
|
|
3345
3345
|
|
|
3346
3346
|
// src/resources/contact_webhooks.ts
|
|
3347
|
-
var ContactWebhooksResource = class extends
|
|
3347
|
+
var ContactWebhooksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3348
3348
|
constructor(http, pageSize) {
|
|
3349
3349
|
super(http, {
|
|
3350
3350
|
key: "contact_webhooks",
|
|
@@ -3420,7 +3420,7 @@ var ContactWebhooksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
3420
3420
|
};
|
|
3421
3421
|
|
|
3422
3422
|
// src/resources/contract_billing_rules.ts
|
|
3423
|
-
var ContractBillingRulesResource = class extends
|
|
3423
|
+
var ContractBillingRulesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3424
3424
|
constructor(http, pageSize) {
|
|
3425
3425
|
super(http, {
|
|
3426
3426
|
key: "contract_billing_rules",
|
|
@@ -3486,7 +3486,7 @@ var ContractBillingRulesResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
3486
3486
|
};
|
|
3487
3487
|
|
|
3488
3488
|
// src/resources/contract_block_hour_factors.ts
|
|
3489
|
-
var ContractBlockHourFactorsResource = class extends
|
|
3489
|
+
var ContractBlockHourFactorsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3490
3490
|
constructor(http, pageSize) {
|
|
3491
3491
|
super(http, {
|
|
3492
3492
|
key: "contract_block_hour_factors",
|
|
@@ -3545,7 +3545,7 @@ var ContractBlockHourFactorsResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
3545
3545
|
};
|
|
3546
3546
|
|
|
3547
3547
|
// src/resources/contract_blocks.ts
|
|
3548
|
-
var ContractBlocksResource = class extends
|
|
3548
|
+
var ContractBlocksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3549
3549
|
constructor(http, pageSize) {
|
|
3550
3550
|
super(http, {
|
|
3551
3551
|
key: "contract_blocks",
|
|
@@ -3604,7 +3604,7 @@ var ContractBlocksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
3604
3604
|
};
|
|
3605
3605
|
|
|
3606
3606
|
// src/resources/contract_charges.ts
|
|
3607
|
-
var ContractChargesResource = class extends
|
|
3607
|
+
var ContractChargesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3608
3608
|
constructor(http, pageSize) {
|
|
3609
3609
|
super(http, {
|
|
3610
3610
|
key: "contract_charges",
|
|
@@ -3675,7 +3675,7 @@ var ContractChargesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
3675
3675
|
};
|
|
3676
3676
|
|
|
3677
3677
|
// src/resources/contract_exclusion_billing_codes.ts
|
|
3678
|
-
var ContractExclusionBillingCodesResource = class extends
|
|
3678
|
+
var ContractExclusionBillingCodesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3679
3679
|
constructor(http, pageSize) {
|
|
3680
3680
|
super(http, {
|
|
3681
3681
|
key: "contract_exclusion_billing_codes",
|
|
@@ -3732,7 +3732,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkXSIY3WRRcjs.Base
|
|
|
3732
3732
|
};
|
|
3733
3733
|
|
|
3734
3734
|
// src/resources/contract_exclusion_roles.ts
|
|
3735
|
-
var ContractExclusionRolesResource = class extends
|
|
3735
|
+
var ContractExclusionRolesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3736
3736
|
constructor(http, pageSize) {
|
|
3737
3737
|
super(http, {
|
|
3738
3738
|
key: "contract_exclusion_roles",
|
|
@@ -3789,7 +3789,7 @@ var ContractExclusionRolesResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
3789
3789
|
};
|
|
3790
3790
|
|
|
3791
3791
|
// src/resources/contract_exclusion_set_excluded_roles.ts
|
|
3792
|
-
var ContractExclusionSetExcludedRolesResource = class extends
|
|
3792
|
+
var ContractExclusionSetExcludedRolesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3793
3793
|
constructor(http, pageSize) {
|
|
3794
3794
|
super(http, {
|
|
3795
3795
|
key: "contract_exclusion_set_excluded_roles",
|
|
@@ -3846,7 +3846,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkXSIY3WRRcjs.
|
|
|
3846
3846
|
};
|
|
3847
3847
|
|
|
3848
3848
|
// src/resources/contract_exclusion_set_excluded_work_types.ts
|
|
3849
|
-
var ContractExclusionSetExcludedWorkTypesResource = class extends
|
|
3849
|
+
var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3850
3850
|
constructor(http, pageSize) {
|
|
3851
3851
|
super(http, {
|
|
3852
3852
|
key: "contract_exclusion_set_excluded_work_types",
|
|
@@ -3903,7 +3903,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkXSIY3WRR
|
|
|
3903
3903
|
};
|
|
3904
3904
|
|
|
3905
3905
|
// src/resources/contract_exclusion_sets.ts
|
|
3906
|
-
var ContractExclusionSetsResource = class extends
|
|
3906
|
+
var ContractExclusionSetsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3907
3907
|
constructor(http, pageSize) {
|
|
3908
3908
|
super(http, {
|
|
3909
3909
|
key: "contract_exclusion_sets",
|
|
@@ -3977,7 +3977,7 @@ var ContractExclusionSetsResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
3977
3977
|
};
|
|
3978
3978
|
|
|
3979
3979
|
// src/resources/contract_milestones.ts
|
|
3980
|
-
var ContractMilestonesResource = class extends
|
|
3980
|
+
var ContractMilestonesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
3981
3981
|
constructor(http, pageSize) {
|
|
3982
3982
|
super(http, {
|
|
3983
3983
|
key: "contract_milestones",
|
|
@@ -4036,7 +4036,7 @@ var ContractMilestonesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4036
4036
|
};
|
|
4037
4037
|
|
|
4038
4038
|
// src/resources/contract_notes.ts
|
|
4039
|
-
var ContractNotesResource = class extends
|
|
4039
|
+
var ContractNotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4040
4040
|
constructor(http, pageSize) {
|
|
4041
4041
|
super(http, {
|
|
4042
4042
|
key: "contract_notes",
|
|
@@ -4095,7 +4095,7 @@ var ContractNotesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4095
4095
|
};
|
|
4096
4096
|
|
|
4097
4097
|
// src/resources/contract_rates.ts
|
|
4098
|
-
var ContractRatesResource = class extends
|
|
4098
|
+
var ContractRatesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4099
4099
|
constructor(http, pageSize) {
|
|
4100
4100
|
super(http, {
|
|
4101
4101
|
key: "contract_rates",
|
|
@@ -4154,7 +4154,7 @@ var ContractRatesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4154
4154
|
};
|
|
4155
4155
|
|
|
4156
4156
|
// src/resources/contract_retainers.ts
|
|
4157
|
-
var ContractRetainersResource = class extends
|
|
4157
|
+
var ContractRetainersResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4158
4158
|
constructor(http, pageSize) {
|
|
4159
4159
|
super(http, {
|
|
4160
4160
|
key: "contract_retainers",
|
|
@@ -4213,7 +4213,7 @@ var ContractRetainersResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4213
4213
|
};
|
|
4214
4214
|
|
|
4215
4215
|
// src/resources/contract_role_costs.ts
|
|
4216
|
-
var ContractRoleCostsResource = class extends
|
|
4216
|
+
var ContractRoleCostsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4217
4217
|
constructor(http, pageSize) {
|
|
4218
4218
|
super(http, {
|
|
4219
4219
|
key: "contract_role_costs",
|
|
@@ -4272,7 +4272,7 @@ var ContractRoleCostsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4272
4272
|
};
|
|
4273
4273
|
|
|
4274
4274
|
// src/resources/contract_service_adjustments.ts
|
|
4275
|
-
var ContractServiceAdjustmentsResource = class extends
|
|
4275
|
+
var ContractServiceAdjustmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4276
4276
|
constructor(http, pageSize) {
|
|
4277
4277
|
super(http, {
|
|
4278
4278
|
key: "contract_service_adjustments",
|
|
@@ -4306,7 +4306,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkXSIY3WRRcjs.BaseRes
|
|
|
4306
4306
|
};
|
|
4307
4307
|
|
|
4308
4308
|
// src/resources/contract_service_bundle_adjustments.ts
|
|
4309
|
-
var ContractServiceBundleAdjustmentsResource = class extends
|
|
4309
|
+
var ContractServiceBundleAdjustmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4310
4310
|
constructor(http, pageSize) {
|
|
4311
4311
|
super(http, {
|
|
4312
4312
|
key: "contract_service_bundle_adjustments",
|
|
@@ -4340,7 +4340,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkXSIY3WRRcjs.B
|
|
|
4340
4340
|
};
|
|
4341
4341
|
|
|
4342
4342
|
// src/resources/contract_service_bundles.ts
|
|
4343
|
-
var ContractServiceBundlesResource = class extends
|
|
4343
|
+
var ContractServiceBundlesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4344
4344
|
constructor(http, pageSize) {
|
|
4345
4345
|
super(http, {
|
|
4346
4346
|
key: "contract_service_bundles",
|
|
@@ -4399,7 +4399,7 @@ var ContractServiceBundlesResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
4399
4399
|
};
|
|
4400
4400
|
|
|
4401
4401
|
// src/resources/contract_service_bundle_units.ts
|
|
4402
|
-
var ContractServiceBundleUnitsResource = class extends
|
|
4402
|
+
var ContractServiceBundleUnitsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4403
4403
|
constructor(http, pageSize) {
|
|
4404
4404
|
super(http, {
|
|
4405
4405
|
key: "contract_service_bundle_units",
|
|
@@ -4441,7 +4441,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkXSIY3WRRcjs.BaseRes
|
|
|
4441
4441
|
};
|
|
4442
4442
|
|
|
4443
4443
|
// src/resources/contract_services.ts
|
|
4444
|
-
var ContractServicesResource = class extends
|
|
4444
|
+
var ContractServicesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4445
4445
|
constructor(http, pageSize) {
|
|
4446
4446
|
super(http, {
|
|
4447
4447
|
key: "contract_services",
|
|
@@ -4500,7 +4500,7 @@ var ContractServicesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
4500
4500
|
};
|
|
4501
4501
|
|
|
4502
4502
|
// src/resources/contract_service_units.ts
|
|
4503
|
-
var ContractServiceUnitsResource = class extends
|
|
4503
|
+
var ContractServiceUnitsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
4504
4504
|
constructor(http, pageSize) {
|
|
4505
4505
|
super(http, {
|
|
4506
4506
|
key: "contract_service_units",
|
|
@@ -4692,7 +4692,7 @@ function dateToDay(v) {
|
|
|
4692
4692
|
}
|
|
4693
4693
|
function validateProfitabilityOptions(contractId, opts) {
|
|
4694
4694
|
if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
4695
|
-
throw new (0,
|
|
4695
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
4696
4696
|
`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})`,
|
|
4697
4697
|
{ operation: "contracts.profitability" }
|
|
4698
4698
|
);
|
|
@@ -4769,12 +4769,12 @@ function validateProfitabilityOptions(contractId, opts) {
|
|
|
4769
4769
|
}
|
|
4770
4770
|
}
|
|
4771
4771
|
try {
|
|
4772
|
-
|
|
4772
|
+
_chunkMAYYTYV5cjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
4773
4773
|
} catch (err) {
|
|
4774
|
-
problems.push(err instanceof
|
|
4774
|
+
problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
|
|
4775
4775
|
}
|
|
4776
4776
|
if (problems.length > 0) {
|
|
4777
|
-
throw new (0,
|
|
4777
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
4778
4778
|
`profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
4779
4779
|
- ` + problems.join("\n- "),
|
|
4780
4780
|
{ operation: "contracts.profitability" }
|
|
@@ -4805,7 +4805,7 @@ async function boundedPart2(http, path, conditions, limit, operation, includeFie
|
|
|
4805
4805
|
body,
|
|
4806
4806
|
operation
|
|
4807
4807
|
});
|
|
4808
|
-
const { items, pageDetails } =
|
|
4808
|
+
const { items, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, operation);
|
|
4809
4809
|
const capped = items.length >= limit;
|
|
4810
4810
|
return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
|
|
4811
4811
|
}
|
|
@@ -4819,23 +4819,23 @@ async function fetchByIdsPart(http, entityPath, ids, fields, operation) {
|
|
|
4819
4819
|
const byKey = /* @__PURE__ */ new Map();
|
|
4820
4820
|
const misses = [];
|
|
4821
4821
|
const notes = [];
|
|
4822
|
-
for (let c = 0; c < unique.length; c +=
|
|
4823
|
-
const chunk = unique.slice(c, c +
|
|
4822
|
+
for (let c = 0; c < unique.length; c += _chunkMAYYTYV5cjs.FETCH_BY_IDS_CHUNK_SIZE) {
|
|
4823
|
+
const chunk = unique.slice(c, c + _chunkMAYYTYV5cjs.FETCH_BY_IDS_CHUNK_SIZE);
|
|
4824
4824
|
const chunkKeys = new Set(chunk);
|
|
4825
4825
|
try {
|
|
4826
4826
|
const body = {
|
|
4827
|
-
MaxRecords:
|
|
4827
|
+
MaxRecords: _chunkMAYYTYV5cjs.FETCH_BY_IDS_CHUNK_SIZE,
|
|
4828
4828
|
filter: [{ field: "id", op: "in", value: chunk }],
|
|
4829
4829
|
IncludeFields: fields
|
|
4830
4830
|
};
|
|
4831
4831
|
const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
|
|
4832
|
-
const { items: rows } =
|
|
4832
|
+
const { items: rows } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, operation);
|
|
4833
4833
|
for (const row of rows) {
|
|
4834
4834
|
const k = num2(row.id);
|
|
4835
4835
|
if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
|
|
4836
4836
|
}
|
|
4837
4837
|
} catch (err) {
|
|
4838
|
-
const code = err instanceof
|
|
4838
|
+
const code = err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.code : "SERVER_ERROR";
|
|
4839
4839
|
for (const k of chunk) {
|
|
4840
4840
|
if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
|
|
4841
4841
|
}
|
|
@@ -4845,11 +4845,11 @@ async function fetchByIdsPart(http, entityPath, ids, fields, operation) {
|
|
|
4845
4845
|
for (const k of queryMissed) {
|
|
4846
4846
|
try {
|
|
4847
4847
|
const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
|
|
4848
|
-
byKey.set(k,
|
|
4848
|
+
byKey.set(k, _chunkMAYYTYV5cjs.unwrapItem.call(void 0, res, k, operation));
|
|
4849
4849
|
} catch (err) {
|
|
4850
|
-
if (err instanceof
|
|
4850
|
+
if (err instanceof _chunkMAYYTYV5cjs.NotFoundError) {
|
|
4851
4851
|
misses.push({ id: k, code: "NOT_FOUND", message: err.message });
|
|
4852
|
-
} else if (err instanceof
|
|
4852
|
+
} else if (err instanceof _chunkMAYYTYV5cjs.AutotaskError) {
|
|
4853
4853
|
misses.push({ id: k, code: err.code, message: err.message });
|
|
4854
4854
|
} else {
|
|
4855
4855
|
misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
|
|
@@ -4972,7 +4972,7 @@ async function degradable(read) {
|
|
|
4972
4972
|
try {
|
|
4973
4973
|
return await read();
|
|
4974
4974
|
} catch (err) {
|
|
4975
|
-
if (!(err instanceof
|
|
4975
|
+
if (!(err instanceof _chunkMAYYTYV5cjs.AutotaskError)) throw err;
|
|
4976
4976
|
return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
@@ -4993,7 +4993,7 @@ function dedupeSortCap(ids, limit) {
|
|
|
4993
4993
|
async function profitability(resource, contractId, opts, rawHttp) {
|
|
4994
4994
|
const v = validateProfitabilityOptions(contractId, opts);
|
|
4995
4995
|
const OP2 = "contracts.profitability";
|
|
4996
|
-
const id =
|
|
4996
|
+
const id = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, contractId, "contractId");
|
|
4997
4997
|
const idNum = typeof id === "number" ? id : Number(id);
|
|
4998
4998
|
const wires = { issued: 0, requests: 0, budget: PROFITABILITY_WIRE_BUDGET };
|
|
4999
4999
|
const asOf = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5021,7 +5021,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5021
5021
|
status: st.status,
|
|
5022
5022
|
blindSurface: st.blindSurface,
|
|
5023
5023
|
note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
|
|
5024
|
-
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([
|
|
5024
|
+
emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkMAYYTYV5cjs.EMPTY_REASON_STAMPS, 'access', _31 => _31[key], 'optionalAccess', _32 => _32.query]) : void 0
|
|
5025
5025
|
};
|
|
5026
5026
|
};
|
|
5027
5027
|
const truncatedMonths = {};
|
|
@@ -5051,12 +5051,12 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5051
5051
|
path: `/V1.0/Companies/${companyID}`,
|
|
5052
5052
|
operation: OP2
|
|
5053
5053
|
});
|
|
5054
|
-
const item =
|
|
5054
|
+
const item = _chunkMAYYTYV5cjs.unwrapItem.call(void 0, res, companyID, OP2);
|
|
5055
5055
|
customer = _nullishCoalesce(item, () => ( null));
|
|
5056
5056
|
customerStatus = "ok";
|
|
5057
5057
|
} catch (err) {
|
|
5058
|
-
if (!(err instanceof
|
|
5059
|
-
if (!(err instanceof
|
|
5058
|
+
if (!(err instanceof _chunkMAYYTYV5cjs.AutotaskError)) throw err;
|
|
5059
|
+
if (!(err instanceof _chunkMAYYTYV5cjs.NotFoundError)) {
|
|
5060
5060
|
customerStatus = "absent";
|
|
5061
5061
|
customerAbsent = err.code;
|
|
5062
5062
|
}
|
|
@@ -5069,7 +5069,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5069
5069
|
try {
|
|
5070
5070
|
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));
|
|
5071
5071
|
} catch (err) {
|
|
5072
|
-
if (!(err instanceof
|
|
5072
|
+
if (!(err instanceof _chunkMAYYTYV5cjs.AutotaskError)) throw err;
|
|
5073
5073
|
}
|
|
5074
5074
|
}
|
|
5075
5075
|
const contractTypeKnown = contractTypeLabel !== null;
|
|
@@ -5116,8 +5116,8 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5116
5116
|
if (invoiceIds.length === 0) {
|
|
5117
5117
|
invoicesPart = skipPart("skipped: the billing part has no invoiceIDs (zero wire)");
|
|
5118
5118
|
} else {
|
|
5119
|
-
const capped = capJoinSet2(invoiceIds,
|
|
5120
|
-
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `invoiceJoinTruncated: the join set is capped at ${
|
|
5119
|
+
const capped = capJoinSet2(invoiceIds, _chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5120
|
+
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `invoiceJoinTruncated: the join set is capped at ${_chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`;
|
|
5121
5121
|
const fb = await fetchByIdsPart(http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], OP2);
|
|
5122
5122
|
wires.issued += 1;
|
|
5123
5123
|
invoices = fb.items;
|
|
@@ -5149,7 +5149,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5149
5149
|
}
|
|
5150
5150
|
}
|
|
5151
5151
|
} catch (err) {
|
|
5152
|
-
statusNote = `the tickets.status field catalog read failed (${err instanceof
|
|
5152
|
+
statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkMAYYTYV5cjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
|
|
5153
5153
|
}
|
|
5154
5154
|
let ticketsOpenPart;
|
|
5155
5155
|
let openTickets = [];
|
|
@@ -5168,8 +5168,8 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5168
5168
|
if (resourceIds.length === 0) {
|
|
5169
5169
|
resourcesPart = skipPart("skipped: the time part has no resourceIDs (zero wire)");
|
|
5170
5170
|
} else {
|
|
5171
|
-
const capped = capJoinSet2(resourceIds,
|
|
5172
|
-
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `resourceJoinTruncated: the join set is capped at ${
|
|
5171
|
+
const capped = capJoinSet2(resourceIds, _chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5172
|
+
if (capped.truncated) wires.note = (wires.note ? wires.note + " | " : "") + `resourceJoinTruncated: the join set is capped at ${_chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`;
|
|
5173
5173
|
const fb = await fetchByIdsPart(http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], OP2);
|
|
5174
5174
|
wires.issued += 1;
|
|
5175
5175
|
resources = fb.items;
|
|
@@ -5226,7 +5226,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5226
5226
|
if (cis.length === 0) {
|
|
5227
5227
|
subscriptionsPart = skipPart("skipped: the CI join found no configuration items \u2014 the subscriptions part is not evaluable (zero wire)");
|
|
5228
5228
|
} else {
|
|
5229
|
-
const ciIds = capJoinSet2(cis.map((c) => num2(c["id"])).filter((n) => n > 0),
|
|
5229
|
+
const ciIds = capJoinSet2(cis.map((c) => num2(c["id"])).filter((n) => n > 0), _chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS);
|
|
5230
5230
|
const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
|
|
5231
5231
|
const raw = await readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
|
|
5232
5232
|
subscriptions = raw.items;
|
|
@@ -5236,7 +5236,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5236
5236
|
try {
|
|
5237
5237
|
labels = await readPicklists(http, "/V1.0/Subscriptions", OP2);
|
|
5238
5238
|
} catch (err) {
|
|
5239
|
-
if (!(err instanceof
|
|
5239
|
+
if (!(err instanceof _chunkMAYYTYV5cjs.AutotaskError)) throw err;
|
|
5240
5240
|
}
|
|
5241
5241
|
}
|
|
5242
5242
|
for (const x of subscriptions) {
|
|
@@ -5798,7 +5798,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5798
5798
|
}
|
|
5799
5799
|
|
|
5800
5800
|
// src/resources/contracts.ts
|
|
5801
|
-
var ContractsResource = class extends
|
|
5801
|
+
var ContractsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
5802
5802
|
constructor(http, pageSize) {
|
|
5803
5803
|
super(http, {
|
|
5804
5804
|
key: "contracts",
|
|
@@ -5869,7 +5869,7 @@ var ContractsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
5869
5869
|
};
|
|
5870
5870
|
|
|
5871
5871
|
// src/resources/contract_ticket_purchases.ts
|
|
5872
|
-
var ContractTicketPurchasesResource = class extends
|
|
5872
|
+
var ContractTicketPurchasesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
5873
5873
|
constructor(http, pageSize) {
|
|
5874
5874
|
super(http, {
|
|
5875
5875
|
key: "contract_ticket_purchases",
|
|
@@ -5928,7 +5928,7 @@ var ContractTicketPurchasesResource = class extends _chunkXSIY3WRRcjs.BaseResour
|
|
|
5928
5928
|
};
|
|
5929
5929
|
|
|
5930
5930
|
// src/resources/countries.ts
|
|
5931
|
-
var CountriesResource = class extends
|
|
5931
|
+
var CountriesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
5932
5932
|
constructor(http, pageSize) {
|
|
5933
5933
|
super(http, {
|
|
5934
5934
|
key: "countries",
|
|
@@ -5987,7 +5987,7 @@ var CountriesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
5987
5987
|
};
|
|
5988
5988
|
|
|
5989
5989
|
// src/resources/departments.ts
|
|
5990
|
-
var DepartmentsResource = class extends
|
|
5990
|
+
var DepartmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
5991
5991
|
constructor(http, pageSize) {
|
|
5992
5992
|
super(http, {
|
|
5993
5993
|
key: "departments",
|
|
@@ -6054,7 +6054,7 @@ var DepartmentsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6054
6054
|
};
|
|
6055
6055
|
|
|
6056
6056
|
// src/resources/domain_registrars.ts
|
|
6057
|
-
var DomainRegistrarsResource = class extends
|
|
6057
|
+
var DomainRegistrarsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6058
6058
|
constructor(http, pageSize) {
|
|
6059
6059
|
super(http, {
|
|
6060
6060
|
key: "domain_registrars",
|
|
@@ -6137,7 +6137,7 @@ var EntityInformationResource = class {
|
|
|
6137
6137
|
};
|
|
6138
6138
|
|
|
6139
6139
|
// src/resources/expense_item_attachments.ts
|
|
6140
|
-
var ExpenseItemAttachmentsResource = class extends
|
|
6140
|
+
var ExpenseItemAttachmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6141
6141
|
constructor(http, pageSize) {
|
|
6142
6142
|
super(http, {
|
|
6143
6143
|
key: "expense_item_attachments",
|
|
@@ -6199,7 +6199,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
6199
6199
|
};
|
|
6200
6200
|
|
|
6201
6201
|
// src/resources/expense_items.ts
|
|
6202
|
-
var ExpenseItemsResource = class extends
|
|
6202
|
+
var ExpenseItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6203
6203
|
constructor(http, pageSize) {
|
|
6204
6204
|
super(http, {
|
|
6205
6205
|
key: "expense_items",
|
|
@@ -6258,7 +6258,7 @@ var ExpenseItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6258
6258
|
};
|
|
6259
6259
|
|
|
6260
6260
|
// src/resources/expense_reports.ts
|
|
6261
|
-
var ExpenseReportsResource = class extends
|
|
6261
|
+
var ExpenseReportsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6262
6262
|
constructor(http, pageSize) {
|
|
6263
6263
|
super(http, {
|
|
6264
6264
|
key: "expense_reports",
|
|
@@ -6325,7 +6325,7 @@ var ExpenseReportsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6325
6325
|
};
|
|
6326
6326
|
|
|
6327
6327
|
// src/resources/holiday_sets.ts
|
|
6328
|
-
var HolidaySetsResource = class extends
|
|
6328
|
+
var HolidaySetsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6329
6329
|
constructor(http, pageSize) {
|
|
6330
6330
|
super(http, {
|
|
6331
6331
|
key: "holiday_sets",
|
|
@@ -6394,7 +6394,7 @@ var HolidaySetsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6394
6394
|
};
|
|
6395
6395
|
|
|
6396
6396
|
// src/resources/holidays.ts
|
|
6397
|
-
var HolidaysResource = class extends
|
|
6397
|
+
var HolidaysResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6398
6398
|
constructor(http, pageSize) {
|
|
6399
6399
|
super(http, {
|
|
6400
6400
|
key: "holidays",
|
|
@@ -6466,10 +6466,10 @@ var PATH_SUFFIX = {
|
|
|
6466
6466
|
transfer: "StockedItemsTransfer"
|
|
6467
6467
|
};
|
|
6468
6468
|
async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
6469
|
-
const numericParent =
|
|
6469
|
+
const numericParent = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, parentId, "parentId");
|
|
6470
6470
|
const suffix = PATH_SUFFIX[kind];
|
|
6471
6471
|
if (opts.dryRun === true) {
|
|
6472
|
-
return
|
|
6472
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
6473
6473
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6474
6474
|
method: "POST",
|
|
6475
6475
|
path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
|
|
@@ -6486,11 +6486,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
|
6486
6486
|
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6487
6487
|
maxRetries: opts.maxRetries
|
|
6488
6488
|
});
|
|
6489
|
-
return
|
|
6489
|
+
return _chunkMAYYTYV5cjs.unwrapOperation.call(void 0, res);
|
|
6490
6490
|
}
|
|
6491
6491
|
|
|
6492
6492
|
// src/resources/inventory_products.ts
|
|
6493
|
-
var InventoryProductsResource = class extends
|
|
6493
|
+
var InventoryProductsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6494
6494
|
constructor(http, pageSize) {
|
|
6495
6495
|
super(http, {
|
|
6496
6496
|
key: "inventory_products",
|
|
@@ -6572,7 +6572,7 @@ var InventoryProductsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6572
6572
|
|
|
6573
6573
|
// src/resources/special/invoices.ts
|
|
6574
6574
|
async function markup(_resource, id, format, http) {
|
|
6575
|
-
const numericId =
|
|
6575
|
+
const numericId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
6576
6576
|
const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
|
|
6577
6577
|
const res = await http.request({
|
|
6578
6578
|
method: "GET",
|
|
@@ -6581,7 +6581,7 @@ async function markup(_resource, id, format, http) {
|
|
|
6581
6581
|
});
|
|
6582
6582
|
const body = res;
|
|
6583
6583
|
if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
|
|
6584
|
-
throw new (0,
|
|
6584
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
|
|
6585
6585
|
`Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
|
|
6586
6586
|
{ code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId] }
|
|
6587
6587
|
);
|
|
@@ -6589,13 +6589,13 @@ async function markup(_resource, id, format, http) {
|
|
|
6589
6589
|
return body.invoiceMarkup;
|
|
6590
6590
|
}
|
|
6591
6591
|
async function pdf(_resource, id, http) {
|
|
6592
|
-
const numericId =
|
|
6592
|
+
const numericId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
6593
6593
|
const res = await http.request({
|
|
6594
6594
|
method: "GET",
|
|
6595
6595
|
path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
|
|
6596
6596
|
operation: "invoices.pdf"
|
|
6597
6597
|
});
|
|
6598
|
-
return
|
|
6598
|
+
return _chunkMAYYTYV5cjs.decodeFileData.call(void 0, res);
|
|
6599
6599
|
}
|
|
6600
6600
|
async function windowQuery2(_resource, kind, http, opts) {
|
|
6601
6601
|
const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _48 => _48.now]), () => ( /* @__PURE__ */ new Date()));
|
|
@@ -6626,7 +6626,7 @@ async function customRange2(_resource, from, to, http, opts) {
|
|
|
6626
6626
|
}
|
|
6627
6627
|
|
|
6628
6628
|
// src/resources/invoices.ts
|
|
6629
|
-
var InvoicesResource = class extends
|
|
6629
|
+
var InvoicesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6630
6630
|
constructor(http, pageSize) {
|
|
6631
6631
|
super(http, {
|
|
6632
6632
|
key: "invoices",
|
|
@@ -6756,7 +6756,7 @@ var ModulesResource = class {
|
|
|
6756
6756
|
};
|
|
6757
6757
|
|
|
6758
6758
|
// src/resources/notification_history.ts
|
|
6759
|
-
var NotificationHistoryResource = class extends
|
|
6759
|
+
var NotificationHistoryResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6760
6760
|
constructor(http, pageSize) {
|
|
6761
6761
|
super(http, {
|
|
6762
6762
|
key: "notification_history",
|
|
@@ -6795,7 +6795,7 @@ var NotificationHistoryResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6795
6795
|
};
|
|
6796
6796
|
|
|
6797
6797
|
// src/resources/opportunities.ts
|
|
6798
|
-
var OpportunitiesResource = class extends
|
|
6798
|
+
var OpportunitiesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6799
6799
|
constructor(http, pageSize) {
|
|
6800
6800
|
super(http, {
|
|
6801
6801
|
key: "opportunities",
|
|
@@ -6857,7 +6857,7 @@ var OpportunitiesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
6857
6857
|
};
|
|
6858
6858
|
|
|
6859
6859
|
// src/resources/opportunity_attachments.ts
|
|
6860
|
-
var OpportunityAttachmentsResource = class extends
|
|
6860
|
+
var OpportunityAttachmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6861
6861
|
constructor(http, pageSize) {
|
|
6862
6862
|
super(http, {
|
|
6863
6863
|
key: "opportunity_attachments",
|
|
@@ -6919,7 +6919,7 @@ var OpportunityAttachmentsResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
6919
6919
|
};
|
|
6920
6920
|
|
|
6921
6921
|
// src/resources/opportunity_categories.ts
|
|
6922
|
-
var OpportunityCategoriesResource = class extends
|
|
6922
|
+
var OpportunityCategoriesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6923
6923
|
constructor(http, pageSize) {
|
|
6924
6924
|
super(http, {
|
|
6925
6925
|
key: "opportunity_categories",
|
|
@@ -6978,7 +6978,7 @@ var OpportunityCategoriesResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
6978
6978
|
};
|
|
6979
6979
|
|
|
6980
6980
|
// src/resources/phases.ts
|
|
6981
|
-
var PhasesResource = class extends
|
|
6981
|
+
var PhasesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
6982
6982
|
constructor(http, pageSize) {
|
|
6983
6983
|
super(http, {
|
|
6984
6984
|
key: "phases",
|
|
@@ -7037,7 +7037,7 @@ var PhasesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7037
7037
|
};
|
|
7038
7038
|
|
|
7039
7039
|
// src/resources/products.ts
|
|
7040
|
-
var ProductsResource = class extends
|
|
7040
|
+
var ProductsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7041
7041
|
constructor(http, pageSize) {
|
|
7042
7042
|
super(http, {
|
|
7043
7043
|
key: "products",
|
|
@@ -7104,7 +7104,7 @@ var ProductsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7104
7104
|
};
|
|
7105
7105
|
|
|
7106
7106
|
// src/resources/product_vendors.ts
|
|
7107
|
-
var ProductVendorsResource = class extends
|
|
7107
|
+
var ProductVendorsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7108
7108
|
constructor(http, pageSize) {
|
|
7109
7109
|
super(http, {
|
|
7110
7110
|
key: "product_vendors",
|
|
@@ -7163,7 +7163,7 @@ var ProductVendorsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7163
7163
|
};
|
|
7164
7164
|
|
|
7165
7165
|
// src/resources/project_charges.ts
|
|
7166
|
-
var ProjectChargesResource = class extends
|
|
7166
|
+
var ProjectChargesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7167
7167
|
constructor(http, pageSize) {
|
|
7168
7168
|
super(http, {
|
|
7169
7169
|
key: "project_charges",
|
|
@@ -7234,7 +7234,7 @@ var ProjectChargesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7234
7234
|
};
|
|
7235
7235
|
|
|
7236
7236
|
// src/resources/project_notes.ts
|
|
7237
|
-
var ProjectNotesResource = class extends
|
|
7237
|
+
var ProjectNotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7238
7238
|
constructor(http, pageSize) {
|
|
7239
7239
|
super(http, {
|
|
7240
7240
|
key: "project_notes",
|
|
@@ -7293,7 +7293,7 @@ var ProjectNotesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7293
7293
|
};
|
|
7294
7294
|
|
|
7295
7295
|
// src/resources/projects.ts
|
|
7296
|
-
var ProjectsResource = class extends
|
|
7296
|
+
var ProjectsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7297
7297
|
constructor(http, pageSize) {
|
|
7298
7298
|
super(http, {
|
|
7299
7299
|
key: "projects",
|
|
@@ -7370,13 +7370,13 @@ var ProjectsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7370
7370
|
const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
|
|
7371
7371
|
const result = { project, company, opportunity, leadResource };
|
|
7372
7372
|
if (opts.names === true) {
|
|
7373
|
-
const builder =
|
|
7373
|
+
const builder = _chunkMAYYTYV5cjs.createNamePlan.call(void 0, );
|
|
7374
7374
|
builder.addResource(root["creatorResourceID"]);
|
|
7375
7375
|
builder.addFk("contract", root["contractID"]);
|
|
7376
|
-
const names = await
|
|
7376
|
+
const names = await _chunkMAYYTYV5cjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
7377
7377
|
const row = { ...project };
|
|
7378
|
-
|
|
7379
|
-
|
|
7378
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
|
|
7379
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
7380
7380
|
result.project = row;
|
|
7381
7381
|
result.names = names.section;
|
|
7382
7382
|
}
|
|
@@ -7385,7 +7385,7 @@ var ProjectsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7385
7385
|
};
|
|
7386
7386
|
|
|
7387
7387
|
// src/resources/purchase_approvals.ts
|
|
7388
|
-
var PurchaseApprovalsResource = class extends
|
|
7388
|
+
var PurchaseApprovalsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7389
7389
|
constructor(http, pageSize) {
|
|
7390
7390
|
super(http, {
|
|
7391
7391
|
key: "purchase_approvals",
|
|
@@ -7439,7 +7439,7 @@ var PurchaseApprovalsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7439
7439
|
};
|
|
7440
7440
|
|
|
7441
7441
|
// src/resources/purchase_order_item_receiving.ts
|
|
7442
|
-
var PurchaseOrderItemReceivingResource = class extends
|
|
7442
|
+
var PurchaseOrderItemReceivingResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7443
7443
|
constructor(http, pageSize) {
|
|
7444
7444
|
super(http, {
|
|
7445
7445
|
key: "purchase_order_item_receiving",
|
|
@@ -7489,7 +7489,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkXSIY3WRRcjs.BaseRes
|
|
|
7489
7489
|
};
|
|
7490
7490
|
|
|
7491
7491
|
// src/resources/purchase_order_items.ts
|
|
7492
|
-
var PurchaseOrderItemsResource = class extends
|
|
7492
|
+
var PurchaseOrderItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7493
7493
|
constructor(http, pageSize) {
|
|
7494
7494
|
super(http, {
|
|
7495
7495
|
key: "purchase_order_items",
|
|
@@ -7548,7 +7548,7 @@ var PurchaseOrderItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7548
7548
|
};
|
|
7549
7549
|
|
|
7550
7550
|
// src/resources/purchase_orders.ts
|
|
7551
|
-
var PurchaseOrdersResource = class extends
|
|
7551
|
+
var PurchaseOrdersResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7552
7552
|
constructor(http, pageSize) {
|
|
7553
7553
|
super(http, {
|
|
7554
7554
|
key: "purchase_orders",
|
|
@@ -7610,7 +7610,7 @@ var PurchaseOrdersResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7610
7610
|
};
|
|
7611
7611
|
|
|
7612
7612
|
// src/resources/quote_items.ts
|
|
7613
|
-
var QuoteItemsResource = class extends
|
|
7613
|
+
var QuoteItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7614
7614
|
constructor(http, pageSize) {
|
|
7615
7615
|
super(http, {
|
|
7616
7616
|
key: "quote_items",
|
|
@@ -7681,7 +7681,7 @@ var QuoteItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7681
7681
|
};
|
|
7682
7682
|
|
|
7683
7683
|
// src/resources/quote_locations.ts
|
|
7684
|
-
var QuoteLocationsResource = class extends
|
|
7684
|
+
var QuoteLocationsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7685
7685
|
constructor(http, pageSize) {
|
|
7686
7686
|
super(http, {
|
|
7687
7687
|
key: "quote_locations",
|
|
@@ -7746,7 +7746,7 @@ var QuoteLocationsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7746
7746
|
};
|
|
7747
7747
|
|
|
7748
7748
|
// src/resources/quotes.ts
|
|
7749
|
-
var QuotesResource = class extends
|
|
7749
|
+
var QuotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7750
7750
|
constructor(http, pageSize) {
|
|
7751
7751
|
super(http, {
|
|
7752
7752
|
key: "quotes",
|
|
@@ -7813,7 +7813,7 @@ var QuotesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7813
7813
|
};
|
|
7814
7814
|
|
|
7815
7815
|
// src/resources/quote_templates.ts
|
|
7816
|
-
var QuoteTemplatesResource = class extends
|
|
7816
|
+
var QuoteTemplatesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7817
7817
|
constructor(http, pageSize) {
|
|
7818
7818
|
super(http, {
|
|
7819
7819
|
key: "quote_templates",
|
|
@@ -7857,7 +7857,7 @@ var QuoteTemplatesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7857
7857
|
};
|
|
7858
7858
|
|
|
7859
7859
|
// src/resources/resource_role_queues.ts
|
|
7860
|
-
var ResourceRoleQueuesResource = class extends
|
|
7860
|
+
var ResourceRoleQueuesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7861
7861
|
constructor(http, pageSize) {
|
|
7862
7862
|
super(http, {
|
|
7863
7863
|
key: "resource_role_queues",
|
|
@@ -7916,7 +7916,7 @@ var ResourceRoleQueuesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7916
7916
|
};
|
|
7917
7917
|
|
|
7918
7918
|
// src/resources/resource_roles.ts
|
|
7919
|
-
var ResourceRolesResource = class extends
|
|
7919
|
+
var ResourceRolesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7920
7920
|
constructor(http, pageSize) {
|
|
7921
7921
|
super(http, {
|
|
7922
7922
|
key: "resource_roles",
|
|
@@ -7958,7 +7958,7 @@ var ResourceRolesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
7958
7958
|
};
|
|
7959
7959
|
|
|
7960
7960
|
// src/resources/resource_skills.ts
|
|
7961
|
-
var ResourceSkillsResource = class extends
|
|
7961
|
+
var ResourceSkillsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
7962
7962
|
constructor(http, pageSize) {
|
|
7963
7963
|
super(http, {
|
|
7964
7964
|
key: "resource_skills",
|
|
@@ -8012,16 +8012,16 @@ var ResourceSkillsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8012
8012
|
var MAX_TRANSFER_IDS = 500;
|
|
8013
8013
|
function requirePositiveIds(ids, label) {
|
|
8014
8014
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
8015
|
-
throw new (0,
|
|
8015
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
|
|
8016
8016
|
}
|
|
8017
8017
|
if (ids.length > MAX_TRANSFER_IDS) {
|
|
8018
|
-
throw new (0,
|
|
8018
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
|
|
8019
8019
|
}
|
|
8020
8020
|
const out = [];
|
|
8021
8021
|
for (const raw of ids) {
|
|
8022
|
-
const id =
|
|
8022
|
+
const id = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, raw, `${label} id`);
|
|
8023
8023
|
if (typeof id === "number" && id < 1) {
|
|
8024
|
-
throw new (0,
|
|
8024
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
|
|
8025
8025
|
}
|
|
8026
8026
|
out.push(id);
|
|
8027
8027
|
}
|
|
@@ -8029,7 +8029,7 @@ function requirePositiveIds(ids, label) {
|
|
|
8029
8029
|
}
|
|
8030
8030
|
async function whoAmI(_resource, userName, http) {
|
|
8031
8031
|
const user = userName.trim();
|
|
8032
|
-
if (user === "") throw new (0,
|
|
8032
|
+
if (user === "") throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
|
|
8033
8033
|
const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
|
|
8034
8034
|
const res = await http.request({
|
|
8035
8035
|
method: "POST",
|
|
@@ -8038,11 +8038,11 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8038
8038
|
body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
|
|
8039
8039
|
operation: "resources.whoAmI"
|
|
8040
8040
|
});
|
|
8041
|
-
const matches =
|
|
8041
|
+
const matches = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
8042
8042
|
if (matches.length === 0) return null;
|
|
8043
8043
|
if (matches.length > 1) {
|
|
8044
8044
|
const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
|
|
8045
|
-
throw new (0,
|
|
8045
|
+
throw new (0, _chunkMAYYTYV5cjs.ResolutionError)(
|
|
8046
8046
|
`whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
|
|
8047
8047
|
{ code: "RESOLUTION_AMBIGUOUS", resourceIds: ids }
|
|
8048
8048
|
);
|
|
@@ -8051,9 +8051,9 @@ async function whoAmI(_resource, userName, http) {
|
|
|
8051
8051
|
}
|
|
8052
8052
|
async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
|
|
8053
8053
|
const ids = requirePositiveIds(companyIds, "transferOwnership");
|
|
8054
|
-
const destination =
|
|
8054
|
+
const destination = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
|
|
8055
8055
|
if (typeof destination === "number" && destination < 1) {
|
|
8056
|
-
throw new (0,
|
|
8056
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
|
|
8057
8057
|
}
|
|
8058
8058
|
const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _53 => _53.dryRun]), () => ( true));
|
|
8059
8059
|
const changes = [];
|
|
@@ -8066,7 +8066,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8066
8066
|
operation: "resources.transferOwnership",
|
|
8067
8067
|
maxRetries: _optionalChain([opts, 'optionalAccess', _54 => _54.maxRetries])
|
|
8068
8068
|
});
|
|
8069
|
-
const company =
|
|
8069
|
+
const company = _chunkMAYYTYV5cjs.unwrapItem.call(void 0, res, id);
|
|
8070
8070
|
const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
|
|
8071
8071
|
changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
|
|
8072
8072
|
if (!dryRun) {
|
|
@@ -8077,11 +8077,11 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8077
8077
|
operation: "resources.transferOwnership",
|
|
8078
8078
|
maxRetries: _optionalChain([opts, 'optionalAccess', _55 => _55.maxRetries])
|
|
8079
8079
|
});
|
|
8080
|
-
|
|
8080
|
+
_chunkMAYYTYV5cjs.unwrapOperation.call(void 0, update);
|
|
8081
8081
|
applied.push(id);
|
|
8082
8082
|
}
|
|
8083
8083
|
} catch (err) {
|
|
8084
|
-
if (!dryRun && err instanceof
|
|
8084
|
+
if (!dryRun && err instanceof _chunkMAYYTYV5cjs.AutotaskError) {
|
|
8085
8085
|
err.resourceIds = [id];
|
|
8086
8086
|
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).`;
|
|
8087
8087
|
}
|
|
@@ -8091,7 +8091,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8091
8091
|
if (dryRun) {
|
|
8092
8092
|
const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
|
|
8093
8093
|
return {
|
|
8094
|
-
...
|
|
8094
|
+
..._chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
8095
8095
|
operation: "resources.transferOwnership",
|
|
8096
8096
|
method: "PUT",
|
|
8097
8097
|
path: "/V1.0/Companies",
|
|
@@ -8115,7 +8115,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8115
8115
|
}
|
|
8116
8116
|
|
|
8117
8117
|
// src/resources/resources.ts
|
|
8118
|
-
var ResourcesResource = class extends
|
|
8118
|
+
var ResourcesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8119
8119
|
|
|
8120
8120
|
constructor(http, clientConfig, pageSize) {
|
|
8121
8121
|
super(http, {
|
|
@@ -8188,7 +8188,7 @@ var ResourcesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8188
8188
|
|
|
8189
8189
|
// src/resources/special/resource_time_off_additional.ts
|
|
8190
8190
|
async function getByResource(_resource, resourceId, http) {
|
|
8191
|
-
const numericResource =
|
|
8191
|
+
const numericResource = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8192
8192
|
const res = await http.request({
|
|
8193
8193
|
method: "GET",
|
|
8194
8194
|
path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
|
|
@@ -8202,11 +8202,11 @@ async function getByResource(_resource, resourceId, http) {
|
|
|
8202
8202
|
if (typeof item === "object" && !Array.isArray(item)) return [item];
|
|
8203
8203
|
}
|
|
8204
8204
|
}
|
|
8205
|
-
return
|
|
8205
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
|
|
8206
8206
|
}
|
|
8207
8207
|
|
|
8208
8208
|
// src/resources/resource_time_off_additional.ts
|
|
8209
|
-
var ResourceTimeOffAdditionalResource = class extends
|
|
8209
|
+
var ResourceTimeOffAdditionalResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8210
8210
|
constructor(http, pageSize) {
|
|
8211
8211
|
super(http, {
|
|
8212
8212
|
key: "resource_time_off_additional",
|
|
@@ -8245,7 +8245,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkXSIY3WRRcjs.BaseReso
|
|
|
8245
8245
|
};
|
|
8246
8246
|
|
|
8247
8247
|
// src/resources/resource_time_off_approvers.ts
|
|
8248
|
-
var ResourceTimeOffApproversResource = class extends
|
|
8248
|
+
var ResourceTimeOffApproversResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8249
8249
|
constructor(http, pageSize) {
|
|
8250
8250
|
super(http, {
|
|
8251
8251
|
key: "resource_time_off_approvers",
|
|
@@ -8288,29 +8288,29 @@ var ResourceTimeOffApproversResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
8288
8288
|
|
|
8289
8289
|
// src/resources/special/resource_time_off_balances.ts
|
|
8290
8290
|
async function getByResource2(_resource, resourceId, http) {
|
|
8291
|
-
const numericResource =
|
|
8291
|
+
const numericResource = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8292
8292
|
const res = await http.request({
|
|
8293
8293
|
method: "GET",
|
|
8294
8294
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
|
|
8295
8295
|
operation: "resource_time_off_balances.getByResource"
|
|
8296
8296
|
});
|
|
8297
|
-
return
|
|
8297
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
|
|
8298
8298
|
}
|
|
8299
8299
|
async function getByYear(_resource, resourceId, year, http) {
|
|
8300
|
-
const numericResource =
|
|
8300
|
+
const numericResource = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
|
|
8301
8301
|
if (!Number.isSafeInteger(year) || year < 1) {
|
|
8302
|
-
throw new (0,
|
|
8302
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("getByYear: year must be a positive integer");
|
|
8303
8303
|
}
|
|
8304
8304
|
const res = await http.request({
|
|
8305
8305
|
method: "GET",
|
|
8306
8306
|
path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
|
|
8307
8307
|
operation: "resource_time_off_balances.getByYear"
|
|
8308
8308
|
});
|
|
8309
|
-
return
|
|
8309
|
+
return _chunkMAYYTYV5cjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear");
|
|
8310
8310
|
}
|
|
8311
8311
|
|
|
8312
8312
|
// src/resources/resource_time_off_balances.ts
|
|
8313
|
-
var ResourceTimeOffBalancesResource = class extends
|
|
8313
|
+
var ResourceTimeOffBalancesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8314
8314
|
constructor(http, pageSize) {
|
|
8315
8315
|
super(http, {
|
|
8316
8316
|
key: "resource_time_off_balances",
|
|
@@ -8348,7 +8348,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkXSIY3WRRcjs.BaseResour
|
|
|
8348
8348
|
};
|
|
8349
8349
|
|
|
8350
8350
|
// src/resources/roles.ts
|
|
8351
|
-
var RolesResource = class extends
|
|
8351
|
+
var RolesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8352
8352
|
constructor(http, pageSize) {
|
|
8353
8353
|
super(http, {
|
|
8354
8354
|
key: "roles",
|
|
@@ -8415,7 +8415,7 @@ var RolesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8415
8415
|
};
|
|
8416
8416
|
|
|
8417
8417
|
// src/resources/service_calls.ts
|
|
8418
|
-
var ServiceCallsResource = class extends
|
|
8418
|
+
var ServiceCallsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8419
8419
|
constructor(http, pageSize) {
|
|
8420
8420
|
super(http, {
|
|
8421
8421
|
key: "service_calls",
|
|
@@ -8484,7 +8484,7 @@ var ServiceCallsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8484
8484
|
};
|
|
8485
8485
|
|
|
8486
8486
|
// src/resources/service_call_task_resources.ts
|
|
8487
|
-
var ServiceCallTaskResourcesResource = class extends
|
|
8487
|
+
var ServiceCallTaskResourcesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8488
8488
|
constructor(http, pageSize) {
|
|
8489
8489
|
super(http, {
|
|
8490
8490
|
key: "service_call_task_resources",
|
|
@@ -8541,7 +8541,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
8541
8541
|
};
|
|
8542
8542
|
|
|
8543
8543
|
// src/resources/service_call_tasks.ts
|
|
8544
|
-
var ServiceCallTasksResource = class extends
|
|
8544
|
+
var ServiceCallTasksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8545
8545
|
constructor(http, pageSize) {
|
|
8546
8546
|
super(http, {
|
|
8547
8547
|
key: "service_call_tasks",
|
|
@@ -8598,7 +8598,7 @@ var ServiceCallTasksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8598
8598
|
};
|
|
8599
8599
|
|
|
8600
8600
|
// src/resources/service_call_ticket_resources.ts
|
|
8601
|
-
var ServiceCallTicketResourcesResource = class extends
|
|
8601
|
+
var ServiceCallTicketResourcesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8602
8602
|
constructor(http, pageSize) {
|
|
8603
8603
|
super(http, {
|
|
8604
8604
|
key: "service_call_ticket_resources",
|
|
@@ -8655,7 +8655,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkXSIY3WRRcjs.BaseRes
|
|
|
8655
8655
|
};
|
|
8656
8656
|
|
|
8657
8657
|
// src/resources/service_call_tickets.ts
|
|
8658
|
-
var ServiceCallTicketsResource = class extends
|
|
8658
|
+
var ServiceCallTicketsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8659
8659
|
constructor(http, pageSize) {
|
|
8660
8660
|
super(http, {
|
|
8661
8661
|
key: "service_call_tickets",
|
|
@@ -8712,7 +8712,7 @@ var ServiceCallTicketsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8712
8712
|
};
|
|
8713
8713
|
|
|
8714
8714
|
// src/resources/service_level_agreement_results.ts
|
|
8715
|
-
var ServiceLevelAgreementResultsResource = class extends
|
|
8715
|
+
var ServiceLevelAgreementResultsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8716
8716
|
constructor(http, pageSize) {
|
|
8717
8717
|
super(http, {
|
|
8718
8718
|
key: "service_level_agreement_results",
|
|
@@ -8751,7 +8751,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkXSIY3WRRcjs.BaseR
|
|
|
8751
8751
|
};
|
|
8752
8752
|
|
|
8753
8753
|
// src/resources/services.ts
|
|
8754
|
-
var ServicesResource = class extends
|
|
8754
|
+
var ServicesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8755
8755
|
constructor(http, pageSize) {
|
|
8756
8756
|
super(http, {
|
|
8757
8757
|
key: "services",
|
|
@@ -8819,7 +8819,7 @@ var ServicesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8819
8819
|
};
|
|
8820
8820
|
|
|
8821
8821
|
// src/resources/skills.ts
|
|
8822
|
-
var SkillsResource = class extends
|
|
8822
|
+
var SkillsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8823
8823
|
constructor(http, pageSize) {
|
|
8824
8824
|
super(http, {
|
|
8825
8825
|
key: "skills",
|
|
@@ -8863,7 +8863,7 @@ var SkillsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8863
8863
|
};
|
|
8864
8864
|
|
|
8865
8865
|
// src/resources/subscription_periods.ts
|
|
8866
|
-
var SubscriptionPeriodsResource = class extends
|
|
8866
|
+
var SubscriptionPeriodsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8867
8867
|
constructor(http, pageSize) {
|
|
8868
8868
|
super(http, {
|
|
8869
8869
|
key: "subscription_periods",
|
|
@@ -8902,7 +8902,7 @@ var SubscriptionPeriodsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8902
8902
|
};
|
|
8903
8903
|
|
|
8904
8904
|
// src/resources/subscriptions.ts
|
|
8905
|
-
var SubscriptionsResource = class extends
|
|
8905
|
+
var SubscriptionsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8906
8906
|
constructor(http, pageSize) {
|
|
8907
8907
|
super(http, {
|
|
8908
8908
|
key: "subscriptions",
|
|
@@ -8971,7 +8971,7 @@ var SubscriptionsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
8971
8971
|
};
|
|
8972
8972
|
|
|
8973
8973
|
// src/resources/survey_results.ts
|
|
8974
|
-
var SurveyResultsResource = class extends
|
|
8974
|
+
var SurveyResultsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
8975
8975
|
constructor(http, pageSize) {
|
|
8976
8976
|
super(http, {
|
|
8977
8977
|
key: "survey_results",
|
|
@@ -9010,7 +9010,7 @@ var SurveyResultsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9010
9010
|
};
|
|
9011
9011
|
|
|
9012
9012
|
// src/resources/surveys.ts
|
|
9013
|
-
var SurveysResource = class extends
|
|
9013
|
+
var SurveysResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9014
9014
|
constructor(http, pageSize) {
|
|
9015
9015
|
super(http, {
|
|
9016
9016
|
key: "surveys",
|
|
@@ -9054,7 +9054,7 @@ var SurveysResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9054
9054
|
};
|
|
9055
9055
|
|
|
9056
9056
|
// src/resources/tag_aliases.ts
|
|
9057
|
-
var TagAliasesResource = class extends
|
|
9057
|
+
var TagAliasesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9058
9058
|
constructor(http, pageSize) {
|
|
9059
9059
|
super(http, {
|
|
9060
9060
|
key: "tag_aliases",
|
|
@@ -9111,7 +9111,7 @@ var TagAliasesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9111
9111
|
};
|
|
9112
9112
|
|
|
9113
9113
|
// src/resources/tag_groups.ts
|
|
9114
|
-
var TagGroupsResource = class extends
|
|
9114
|
+
var TagGroupsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9115
9115
|
constructor(http, pageSize) {
|
|
9116
9116
|
super(http, {
|
|
9117
9117
|
key: "tag_groups",
|
|
@@ -9180,7 +9180,7 @@ var TagGroupsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9180
9180
|
};
|
|
9181
9181
|
|
|
9182
9182
|
// src/resources/tags.ts
|
|
9183
|
-
var TagsResource = class extends
|
|
9183
|
+
var TagsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9184
9184
|
constructor(http, pageSize) {
|
|
9185
9185
|
super(http, {
|
|
9186
9186
|
key: "tags",
|
|
@@ -9249,7 +9249,7 @@ var TagsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9249
9249
|
};
|
|
9250
9250
|
|
|
9251
9251
|
// src/resources/task_secondary_resources.ts
|
|
9252
|
-
var TaskSecondaryResourcesResource = class extends
|
|
9252
|
+
var TaskSecondaryResourcesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9253
9253
|
constructor(http, pageSize) {
|
|
9254
9254
|
super(http, {
|
|
9255
9255
|
key: "task_secondary_resources",
|
|
@@ -9306,7 +9306,7 @@ var TaskSecondaryResourcesResource = class extends _chunkXSIY3WRRcjs.BaseResourc
|
|
|
9306
9306
|
};
|
|
9307
9307
|
|
|
9308
9308
|
// src/resources/tasks.ts
|
|
9309
|
-
var TasksResource = class extends
|
|
9309
|
+
var TasksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9310
9310
|
constructor(http, pageSize) {
|
|
9311
9311
|
super(http, {
|
|
9312
9312
|
key: "tasks",
|
|
@@ -9394,7 +9394,7 @@ var ThresholdInformationResource = class {
|
|
|
9394
9394
|
};
|
|
9395
9395
|
|
|
9396
9396
|
// src/resources/ticket_additional_configuration_items.ts
|
|
9397
|
-
var TicketAdditionalConfigurationItemsResource = class extends
|
|
9397
|
+
var TicketAdditionalConfigurationItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9398
9398
|
constructor(http, pageSize) {
|
|
9399
9399
|
super(http, {
|
|
9400
9400
|
key: "ticket_additional_configuration_items",
|
|
@@ -9451,7 +9451,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkXSIY3WRRcjs
|
|
|
9451
9451
|
};
|
|
9452
9452
|
|
|
9453
9453
|
// src/resources/ticket_additional_contacts.ts
|
|
9454
|
-
var TicketAdditionalContactsResource = class extends
|
|
9454
|
+
var TicketAdditionalContactsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9455
9455
|
constructor(http, pageSize) {
|
|
9456
9456
|
super(http, {
|
|
9457
9457
|
key: "ticket_additional_contacts",
|
|
@@ -9508,7 +9508,7 @@ var TicketAdditionalContactsResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
9508
9508
|
};
|
|
9509
9509
|
|
|
9510
9510
|
// src/resources/ticket_attachments.ts
|
|
9511
|
-
var TicketAttachmentsResource = class extends
|
|
9511
|
+
var TicketAttachmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9512
9512
|
constructor(http, pageSize) {
|
|
9513
9513
|
super(http, {
|
|
9514
9514
|
key: "ticket_attachments",
|
|
@@ -9570,7 +9570,7 @@ var TicketAttachmentsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9570
9570
|
};
|
|
9571
9571
|
|
|
9572
9572
|
// src/resources/ticket_categories.ts
|
|
9573
|
-
var TicketCategoriesResource = class extends
|
|
9573
|
+
var TicketCategoriesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9574
9574
|
constructor(http, pageSize) {
|
|
9575
9575
|
super(http, {
|
|
9576
9576
|
key: "ticket_categories",
|
|
@@ -9629,7 +9629,7 @@ var TicketCategoriesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9629
9629
|
};
|
|
9630
9630
|
|
|
9631
9631
|
// src/resources/ticket_category_field_defaults.ts
|
|
9632
|
-
var TicketCategoryFieldDefaultsResource = class extends
|
|
9632
|
+
var TicketCategoryFieldDefaultsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9633
9633
|
constructor(http, pageSize) {
|
|
9634
9634
|
super(http, {
|
|
9635
9635
|
key: "ticket_category_field_defaults",
|
|
@@ -9671,7 +9671,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkXSIY3WRRcjs.BaseRe
|
|
|
9671
9671
|
};
|
|
9672
9672
|
|
|
9673
9673
|
// src/resources/ticket_change_request_approvals.ts
|
|
9674
|
-
var TicketChangeRequestApprovalsResource = class extends
|
|
9674
|
+
var TicketChangeRequestApprovalsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9675
9675
|
constructor(http, pageSize) {
|
|
9676
9676
|
super(http, {
|
|
9677
9677
|
key: "ticket_change_request_approvals",
|
|
@@ -9728,7 +9728,7 @@ var TicketChangeRequestApprovalsResource = class extends _chunkXSIY3WRRcjs.BaseR
|
|
|
9728
9728
|
};
|
|
9729
9729
|
|
|
9730
9730
|
// src/resources/ticket_charges.ts
|
|
9731
|
-
var TicketChargesResource = class extends
|
|
9731
|
+
var TicketChargesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9732
9732
|
constructor(http, pageSize) {
|
|
9733
9733
|
super(http, {
|
|
9734
9734
|
key: "ticket_charges",
|
|
@@ -9799,7 +9799,7 @@ var TicketChargesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9799
9799
|
};
|
|
9800
9800
|
|
|
9801
9801
|
// src/resources/ticket_checklist_items.ts
|
|
9802
|
-
var TicketChecklistItemsResource = class extends
|
|
9802
|
+
var TicketChecklistItemsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9803
9803
|
constructor(http, pageSize) {
|
|
9804
9804
|
super(http, {
|
|
9805
9805
|
key: "ticket_checklist_items",
|
|
@@ -9865,7 +9865,7 @@ var TicketChecklistItemsResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
9865
9865
|
};
|
|
9866
9866
|
|
|
9867
9867
|
// src/resources/ticket_checklist_libraries.ts
|
|
9868
|
-
var TicketChecklistLibrariesResource = class extends
|
|
9868
|
+
var TicketChecklistLibrariesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9869
9869
|
constructor(http, pageSize) {
|
|
9870
9870
|
super(http, {
|
|
9871
9871
|
key: "ticket_checklist_libraries",
|
|
@@ -9889,9 +9889,9 @@ var TicketChecklistLibrariesResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
9889
9889
|
* `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
|
|
9890
9890
|
* surface — no documents read op — and never issues the POST). */
|
|
9891
9891
|
async attachToDocument(documentID, data, opts = {}) {
|
|
9892
|
-
const n =
|
|
9892
|
+
const n = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, documentID, "documentID");
|
|
9893
9893
|
if (opts.dryRun === true) {
|
|
9894
|
-
return
|
|
9894
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
9895
9895
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
9896
9896
|
method: "POST",
|
|
9897
9897
|
path: `/V1.0/Documents/${n}/ChecklistLibraries`,
|
|
@@ -9909,7 +9909,7 @@ var TicketChecklistLibrariesResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
9909
9909
|
operation: "ticket_checklist_libraries.attachToDocument",
|
|
9910
9910
|
maxRetries: opts.maxRetries
|
|
9911
9911
|
});
|
|
9912
|
-
return
|
|
9912
|
+
return _chunkMAYYTYV5cjs.unwrapOperation.call(void 0, res);
|
|
9913
9913
|
}
|
|
9914
9914
|
/** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
|
|
9915
9915
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9925,7 +9925,7 @@ var TicketChecklistLibrariesResource = class extends _chunkXSIY3WRRcjs.BaseResou
|
|
|
9925
9925
|
};
|
|
9926
9926
|
|
|
9927
9927
|
// src/resources/ticket_history.ts
|
|
9928
|
-
var TicketHistoryResource = class extends
|
|
9928
|
+
var TicketHistoryResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9929
9929
|
constructor(http, pageSize) {
|
|
9930
9930
|
super(http, {
|
|
9931
9931
|
key: "ticket_history",
|
|
@@ -9964,7 +9964,7 @@ var TicketHistoryResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
9964
9964
|
};
|
|
9965
9965
|
|
|
9966
9966
|
// src/resources/ticket_note_attachments.ts
|
|
9967
|
-
var TicketNoteAttachmentsResource = class extends
|
|
9967
|
+
var TicketNoteAttachmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
9968
9968
|
constructor(http, pageSize) {
|
|
9969
9969
|
super(http, {
|
|
9970
9970
|
key: "ticket_note_attachments",
|
|
@@ -10026,7 +10026,7 @@ var TicketNoteAttachmentsResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
10026
10026
|
};
|
|
10027
10027
|
|
|
10028
10028
|
// src/resources/ticket_notes.ts
|
|
10029
|
-
var TicketNotesResource = class extends
|
|
10029
|
+
var TicketNotesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
10030
10030
|
constructor(http, pageSize) {
|
|
10031
10031
|
super(http, {
|
|
10032
10032
|
key: "ticket_notes",
|
|
@@ -10085,7 +10085,7 @@ var TicketNotesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
10085
10085
|
};
|
|
10086
10086
|
|
|
10087
10087
|
// src/resources/ticket_note_webhooks.ts
|
|
10088
|
-
var TicketNoteWebhooksResource = class extends
|
|
10088
|
+
var TicketNoteWebhooksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
10089
10089
|
constructor(http, pageSize) {
|
|
10090
10090
|
super(http, {
|
|
10091
10091
|
key: "ticket_note_webhooks",
|
|
@@ -10161,7 +10161,7 @@ var TicketNoteWebhooksResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
10161
10161
|
};
|
|
10162
10162
|
|
|
10163
10163
|
// src/resources/ticket_secondary_resources.ts
|
|
10164
|
-
var TicketSecondaryResourcesResource = class extends
|
|
10164
|
+
var TicketSecondaryResourcesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
10165
10165
|
constructor(http, pageSize) {
|
|
10166
10166
|
super(http, {
|
|
10167
10167
|
key: "ticket_secondary_resources",
|
|
@@ -10228,9 +10228,9 @@ async function fetchTicket(http, id, operation) {
|
|
|
10228
10228
|
});
|
|
10229
10229
|
const body = res;
|
|
10230
10230
|
if (body === null || !("item" in body)) {
|
|
10231
|
-
throw new (0,
|
|
10231
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id] });
|
|
10232
10232
|
}
|
|
10233
|
-
if (body.item === null || body.item === void 0) throw new (0,
|
|
10233
|
+
if (body.item === null || body.item === void 0) throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id] });
|
|
10234
10234
|
return body.item;
|
|
10235
10235
|
}
|
|
10236
10236
|
async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
@@ -10241,16 +10241,16 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
|
|
|
10241
10241
|
body: { MaxRecords: maxRecords, filter },
|
|
10242
10242
|
operation
|
|
10243
10243
|
});
|
|
10244
|
-
return
|
|
10244
|
+
return _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res).items;
|
|
10245
10245
|
}
|
|
10246
10246
|
function isRouteUnavailable(err) {
|
|
10247
|
-
return
|
|
10247
|
+
return _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
|
|
10248
10248
|
}
|
|
10249
10249
|
function routeFact(route, path, err) {
|
|
10250
10250
|
return {
|
|
10251
10251
|
route,
|
|
10252
10252
|
path,
|
|
10253
|
-
httpStatus:
|
|
10253
|
+
httpStatus: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
|
|
10254
10254
|
};
|
|
10255
10255
|
}
|
|
10256
10256
|
function childDeclaresQuery(resourceKey) {
|
|
@@ -10260,10 +10260,10 @@ function childDeclaresQuery(resourceKey) {
|
|
|
10260
10260
|
}
|
|
10261
10261
|
function planScopedPath(resourceKey, ticketId) {
|
|
10262
10262
|
if (!childDeclaresQuery(resourceKey)) return null;
|
|
10263
|
-
const entry =
|
|
10263
|
+
const entry = _chunkMAYYTYV5cjs.RELATIONSHIP_MAP[resourceKey];
|
|
10264
10264
|
const parent = entry === void 0 ? null : entry.parent;
|
|
10265
10265
|
if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
|
|
10266
|
-
const parentPath = _optionalChain([
|
|
10266
|
+
const parentPath = _optionalChain([_chunkMAYYTYV5cjs.RELATIONSHIP_MAP, 'access', _56 => _56[parent.resource], 'optionalAccess', _57 => _57.path]);
|
|
10267
10267
|
if (parentPath === null || parentPath === void 0) return null;
|
|
10268
10268
|
return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
|
|
10269
10269
|
}
|
|
@@ -10302,14 +10302,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
|
|
|
10302
10302
|
break;
|
|
10303
10303
|
}
|
|
10304
10304
|
const body = await http.request({ method: "GET", path: target, operation });
|
|
10305
|
-
const { items: pageItems, pageDetails } =
|
|
10305
|
+
const { items: pageItems, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, body, operation);
|
|
10306
10306
|
nextCursor = pageDetails.nextPageUrl;
|
|
10307
10307
|
pages += 1;
|
|
10308
10308
|
const window = pageItems.slice(0, Math.max(0, limit - items.length));
|
|
10309
10309
|
for (const row of window) if (accept(row)) items.push(row);
|
|
10310
10310
|
if (items.length >= limit) break;
|
|
10311
10311
|
if (nextCursor === null || pageItems.length === 0) break;
|
|
10312
|
-
target =
|
|
10312
|
+
target = _chunkMAYYTYV5cjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
|
|
10313
10313
|
}
|
|
10314
10314
|
const capped = items.length >= limit || guard && nextCursor !== null;
|
|
10315
10315
|
return { items, capped };
|
|
@@ -10343,7 +10343,7 @@ function truncate(text, limit) {
|
|
|
10343
10343
|
}
|
|
10344
10344
|
async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
10345
10345
|
void opts;
|
|
10346
|
-
const ticketId =
|
|
10346
|
+
const ticketId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
10347
10347
|
await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
|
|
10348
10348
|
const rows = await ticketQueryItems(
|
|
10349
10349
|
http,
|
|
@@ -10368,9 +10368,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
|
|
|
10368
10368
|
async function summary(_resource, id, opts = {}, http) {
|
|
10369
10369
|
const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
|
|
10370
10370
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
10371
|
-
throw new (0,
|
|
10371
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
|
|
10372
10372
|
}
|
|
10373
|
-
const ticketId =
|
|
10373
|
+
const ticketId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
10374
10374
|
const ticket = await fetchTicket(http, ticketId, "tickets.summary");
|
|
10375
10375
|
const desc = truncate(ticket.description, limit);
|
|
10376
10376
|
const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
|
|
@@ -10397,13 +10397,13 @@ async function summary(_resource, id, opts = {}, http) {
|
|
|
10397
10397
|
}
|
|
10398
10398
|
async function timeline(_resource, id, opts = {}, http) {
|
|
10399
10399
|
const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
|
|
10400
|
-
if (!Number.isInteger(limit) || limit < 1) throw new (0,
|
|
10400
|
+
if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
|
|
10401
10401
|
const bounded = Math.min(limit, 500);
|
|
10402
10402
|
const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
|
|
10403
10403
|
if (!Number.isInteger(textLimit) || textLimit < 1) {
|
|
10404
|
-
throw new (0,
|
|
10404
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
|
|
10405
10405
|
}
|
|
10406
|
-
const ticketId =
|
|
10406
|
+
const ticketId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
10407
10407
|
await fetchTicket(http, ticketId, "tickets.timeline");
|
|
10408
10408
|
const dateFilters = (field) => {
|
|
10409
10409
|
const f = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -10490,14 +10490,14 @@ function isPositiveInt(v) {
|
|
|
10490
10490
|
return typeof v === "number" && Number.isInteger(v) && v > 0;
|
|
10491
10491
|
}
|
|
10492
10492
|
function namedVendorFields(err) {
|
|
10493
|
-
if (!
|
|
10494
|
-
const entries = _nullishCoalesce(
|
|
10493
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
|
|
10494
|
+
const entries = _nullishCoalesce(_chunkMAYYTYV5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
|
|
10495
10495
|
const out = /* @__PURE__ */ new Set();
|
|
10496
10496
|
for (const e of entries) if (e.field !== void 0) out.add(e.field);
|
|
10497
10497
|
return [...out];
|
|
10498
10498
|
}
|
|
10499
10499
|
function vendorDetailOf(err) {
|
|
10500
|
-
return
|
|
10500
|
+
return _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? _chunkMAYYTYV5cjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
|
|
10501
10501
|
}
|
|
10502
10502
|
async function fetchItem(http, path, operation, readOpts) {
|
|
10503
10503
|
const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _58 => _58.maxRetries]) });
|
|
@@ -10518,8 +10518,8 @@ function operationId(res) {
|
|
|
10518
10518
|
return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
|
|
10519
10519
|
}
|
|
10520
10520
|
function discoveryMerge(err, body, defaults) {
|
|
10521
|
-
if (!
|
|
10522
|
-
const entries =
|
|
10521
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
10522
|
+
const entries = _chunkMAYYTYV5cjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
10523
10523
|
if (entries === void 0) return null;
|
|
10524
10524
|
for (const entry of entries) {
|
|
10525
10525
|
const field = entry.field;
|
|
@@ -10531,7 +10531,7 @@ function discoveryMerge(err, body, defaults) {
|
|
|
10531
10531
|
}
|
|
10532
10532
|
function stepErrorText(code, err) {
|
|
10533
10533
|
const detail = vendorDetailOf(err);
|
|
10534
|
-
const base =
|
|
10534
|
+
const base = _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
|
|
10535
10535
|
return detail ? `${code}: ${detail}` : `${code}: ${base}`;
|
|
10536
10536
|
}
|
|
10537
10537
|
var DEFAULT_TICKET_PRIORITY = 3;
|
|
@@ -10540,7 +10540,7 @@ var DEFAULT_NOTE_TYPE = 1;
|
|
|
10540
10540
|
var DEFAULT_PUBLISH = 1;
|
|
10541
10541
|
var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
|
|
10542
10542
|
var SAFE_TICKET_CREATE_DEFAULTS = {};
|
|
10543
|
-
var QueueRequiredError = class extends
|
|
10543
|
+
var QueueRequiredError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
10544
10544
|
constructor(message, options = {}) {
|
|
10545
10545
|
super(message, {
|
|
10546
10546
|
code: "QUEUE_REQUIRED",
|
|
@@ -10551,13 +10551,13 @@ var QueueRequiredError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
10551
10551
|
this.name = "QueueRequiredError";
|
|
10552
10552
|
}
|
|
10553
10553
|
};
|
|
10554
|
-
var TicketResourceInvalidError = class extends
|
|
10554
|
+
var TicketResourceInvalidError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
10555
10555
|
constructor(message, options = {}) {
|
|
10556
10556
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
10557
10557
|
this.name = "TicketResourceInvalidError";
|
|
10558
10558
|
}
|
|
10559
10559
|
};
|
|
10560
|
-
var TicketCreateValidationFailedError = class extends
|
|
10560
|
+
var TicketCreateValidationFailedError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
10561
10561
|
/** The vendor-named fields (empty when the 500 body named nothing parseable). */
|
|
10562
10562
|
|
|
10563
10563
|
constructor(message, vendorFields, options = {}) {
|
|
@@ -10567,43 +10567,43 @@ var TicketCreateValidationFailedError = class extends _chunkXSIY3WRRcjs.Autotask
|
|
|
10567
10567
|
}
|
|
10568
10568
|
};
|
|
10569
10569
|
async function openWithNoteAndAssign(resource, params, note, assign, opts, http) {
|
|
10570
|
-
const companyID =
|
|
10570
|
+
const companyID = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _60 => _60.companyID]), "params.companyID");
|
|
10571
10571
|
const title = _optionalChain([params, 'optionalAccess', _61 => _61.title]);
|
|
10572
10572
|
if (typeof title !== "string" || title.trim() === "") {
|
|
10573
|
-
throw new (0,
|
|
10573
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
|
|
10574
10574
|
}
|
|
10575
10575
|
const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
|
|
10576
10576
|
const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
|
|
10577
10577
|
if (!isPositiveInt(priority)) {
|
|
10578
|
-
throw new (0,
|
|
10578
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
|
|
10579
10579
|
}
|
|
10580
10580
|
if (!isPositiveInt(status)) {
|
|
10581
|
-
throw new (0,
|
|
10581
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
|
|
10582
10582
|
}
|
|
10583
10583
|
if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
|
|
10584
|
-
throw new (0,
|
|
10584
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
|
|
10585
10585
|
}
|
|
10586
10586
|
if (note !== void 0) {
|
|
10587
10587
|
if (typeof note.description !== "string" || note.description.trim() === "") {
|
|
10588
|
-
throw new (0,
|
|
10588
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
|
|
10589
10589
|
}
|
|
10590
10590
|
if (typeof note.title !== "string" || note.title.trim() === "") {
|
|
10591
|
-
throw new (0,
|
|
10591
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
10592
10592
|
}
|
|
10593
10593
|
if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
|
|
10594
|
-
throw new (0,
|
|
10594
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
|
|
10595
10595
|
}
|
|
10596
10596
|
if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
|
|
10597
|
-
throw new (0,
|
|
10597
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
|
|
10598
10598
|
}
|
|
10599
10599
|
}
|
|
10600
|
-
const assignee = assign === void 0 ? void 0 :
|
|
10600
|
+
const assignee = assign === void 0 ? void 0 : _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
|
|
10601
10601
|
if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
|
|
10602
|
-
throw new (0,
|
|
10602
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
|
|
10603
10603
|
}
|
|
10604
10604
|
const roleID = _optionalChain([assign, 'optionalAccess', _62 => _62.roleID]);
|
|
10605
10605
|
if (assign !== void 0 && !isPositiveInt(roleID)) {
|
|
10606
|
-
throw new (0,
|
|
10606
|
+
throw new (0, _chunkMAYYTYV5cjs.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 });
|
|
10607
10607
|
}
|
|
10608
10608
|
if (assign !== void 0 && assignee !== void 0) {
|
|
10609
10609
|
const rid = assignee;
|
|
@@ -10638,7 +10638,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10638
10638
|
if (assign !== void 0) {
|
|
10639
10639
|
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).`);
|
|
10640
10640
|
}
|
|
10641
|
-
return
|
|
10641
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
10642
10642
|
{
|
|
10643
10643
|
operation: OP_OPEN,
|
|
10644
10644
|
method: "POST",
|
|
@@ -10680,8 +10680,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10680
10680
|
`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}` : ""}`,
|
|
10681
10681
|
{
|
|
10682
10682
|
operation: OP_OPEN,
|
|
10683
|
-
httpStatus:
|
|
10684
|
-
vendorError:
|
|
10683
|
+
httpStatus: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10684
|
+
vendorError: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
|
|
10685
10685
|
}
|
|
10686
10686
|
);
|
|
10687
10687
|
}
|
|
@@ -10696,8 +10696,8 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10696
10696
|
named,
|
|
10697
10697
|
{
|
|
10698
10698
|
operation: OP_OPEN,
|
|
10699
|
-
httpStatus:
|
|
10700
|
-
vendorError:
|
|
10699
|
+
httpStatus: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10700
|
+
vendorError: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
10701
10701
|
resourceIds: [companyID]
|
|
10702
10702
|
}
|
|
10703
10703
|
);
|
|
@@ -10719,10 +10719,10 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10719
10719
|
try {
|
|
10720
10720
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
|
|
10721
10721
|
if (current === null) {
|
|
10722
|
-
throw new (0,
|
|
10722
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId] });
|
|
10723
10723
|
}
|
|
10724
10724
|
ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
|
|
10725
|
-
const merged =
|
|
10725
|
+
const merged = _chunkMAYYTYV5cjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
|
|
10726
10726
|
merged.id = ticketId;
|
|
10727
10727
|
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
|
|
10728
10728
|
assigned = true;
|
|
@@ -10743,7 +10743,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10743
10743
|
var STATUS_REQUIRED_FIELDS = {
|
|
10744
10744
|
// <discovery output lands here — e.g. 8: { requiredFields: ['dueDateTime'], safeDefaults: { dueDateTime: '<now>' } }>
|
|
10745
10745
|
};
|
|
10746
|
-
var StatusUnknownError = class extends
|
|
10746
|
+
var StatusUnknownError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
10747
10747
|
/** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
|
|
10748
10748
|
|
|
10749
10749
|
constructor(message, options = {}) {
|
|
@@ -10757,7 +10757,7 @@ var StatusUnknownError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
10757
10757
|
this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
|
|
10758
10758
|
}
|
|
10759
10759
|
};
|
|
10760
|
-
var StatusFieldsRequiredError = class extends
|
|
10760
|
+
var StatusFieldsRequiredError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
10761
10761
|
|
|
10762
10762
|
|
|
10763
10763
|
|
|
@@ -10786,16 +10786,16 @@ async function readLiveStatusSet(resource) {
|
|
|
10786
10786
|
}
|
|
10787
10787
|
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";
|
|
10788
10788
|
async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
10789
|
-
const ticketId =
|
|
10789
|
+
const ticketId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
10790
10790
|
if (!isPositiveInt(targetStatus)) {
|
|
10791
|
-
throw new (0,
|
|
10791
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
|
|
10792
10792
|
}
|
|
10793
10793
|
let liveStatus = null;
|
|
10794
10794
|
try {
|
|
10795
10795
|
const ids = await readLiveStatusSet(resource);
|
|
10796
10796
|
if (ids.size > 0) liveStatus = ids;
|
|
10797
10797
|
} catch (err) {
|
|
10798
|
-
if (!
|
|
10798
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
10799
10799
|
}
|
|
10800
10800
|
if (liveStatus !== null && !liveStatus.has(targetStatus)) {
|
|
10801
10801
|
_optionalChain([http, 'access', _63 => _63.fieldCache, 'optionalAccess', _64 => _64.invalidate, 'call', _65 => _65("tickets")]);
|
|
@@ -10805,7 +10805,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10805
10805
|
const freshIds = await readLiveStatusSet(resource);
|
|
10806
10806
|
if (freshIds.size > 0) freshStatus = freshIds;
|
|
10807
10807
|
} catch (err) {
|
|
10808
|
-
if (!
|
|
10808
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
10809
10809
|
freshStatus = null;
|
|
10810
10810
|
reReadFailed = true;
|
|
10811
10811
|
}
|
|
@@ -10822,16 +10822,16 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10822
10822
|
}
|
|
10823
10823
|
const guardDegraded = liveStatus === null;
|
|
10824
10824
|
if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
|
|
10825
|
-
throw new (0,
|
|
10825
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
|
|
10826
10826
|
}
|
|
10827
10827
|
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10828
10828
|
if (current === null) {
|
|
10829
|
-
throw new (0,
|
|
10829
|
+
throw new (0, _chunkMAYYTYV5cjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId] });
|
|
10830
10830
|
}
|
|
10831
10831
|
const previousStatus = typeof current.status === "number" ? current.status : null;
|
|
10832
10832
|
if (previousStatus === targetStatus) {
|
|
10833
10833
|
if (opts.dryRun === true) {
|
|
10834
|
-
return
|
|
10834
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
10835
10835
|
{
|
|
10836
10836
|
operation: OP_STATUS,
|
|
10837
10837
|
method: "PUT",
|
|
@@ -10885,7 +10885,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10885
10885
|
if (mapEntry === void 0) {
|
|
10886
10886
|
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).`);
|
|
10887
10887
|
}
|
|
10888
|
-
return
|
|
10888
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
10889
10889
|
{
|
|
10890
10890
|
operation: OP_STATUS,
|
|
10891
10891
|
method: "PUT",
|
|
@@ -10904,7 +10904,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10904
10904
|
);
|
|
10905
10905
|
}
|
|
10906
10906
|
const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _68 => _68.safeDefaults]), () => ( {}));
|
|
10907
|
-
const body =
|
|
10907
|
+
const body = _chunkMAYYTYV5cjs.mergePartialBody.call(void 0, current, mergeData);
|
|
10908
10908
|
body.id = ticketId;
|
|
10909
10909
|
let merges = 0;
|
|
10910
10910
|
for (; ; ) {
|
|
@@ -10928,8 +10928,8 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10928
10928
|
{ vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
|
|
10929
10929
|
{
|
|
10930
10930
|
operation: OP_STATUS,
|
|
10931
|
-
httpStatus:
|
|
10932
|
-
vendorError:
|
|
10931
|
+
httpStatus: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
|
|
10932
|
+
vendorError: _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
|
|
10933
10933
|
resourceIds: [ticketId]
|
|
10934
10934
|
}
|
|
10935
10935
|
);
|
|
@@ -10939,7 +10939,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10939
10939
|
}
|
|
10940
10940
|
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10941
10941
|
if (verify === null) {
|
|
10942
|
-
throw new (0,
|
|
10942
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
|
|
10943
10943
|
code: "INVALID_RESPONSE",
|
|
10944
10944
|
category: "server",
|
|
10945
10945
|
operation: OP_STATUS,
|
|
@@ -10948,7 +10948,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10948
10948
|
}
|
|
10949
10949
|
const finalStatus = typeof verify.status === "number" ? verify.status : null;
|
|
10950
10950
|
if (finalStatus !== targetStatus) {
|
|
10951
|
-
throw new (0,
|
|
10951
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
|
|
10952
10952
|
`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)`,
|
|
10953
10953
|
{
|
|
10954
10954
|
code: "INVALID_RESPONSE",
|
|
@@ -10966,7 +10966,7 @@ var DEFAULT_PART_LIMIT = 50;
|
|
|
10966
10966
|
function partLimit(value, name) {
|
|
10967
10967
|
const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
|
|
10968
10968
|
if (!Number.isInteger(n) || n < 1) {
|
|
10969
|
-
throw new (0,
|
|
10969
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
|
|
10970
10970
|
}
|
|
10971
10971
|
return n;
|
|
10972
10972
|
}
|
|
@@ -10982,7 +10982,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
10982
10982
|
const noteLimit = partLimit(opts.noteLimit, "noteLimit");
|
|
10983
10983
|
const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
|
|
10984
10984
|
const textLimit = partLimit(opts.textLimit, "textLimit");
|
|
10985
|
-
const ticketId =
|
|
10985
|
+
const ticketId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
10986
10986
|
const ctx = await resource.getContext(ticketId);
|
|
10987
10987
|
const op = "tickets.fullContext";
|
|
10988
10988
|
const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
@@ -11036,7 +11036,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11036
11036
|
result.truncated = result.truncated || part.capped || historyRows.some((h) => h.detailTruncated === true);
|
|
11037
11037
|
}
|
|
11038
11038
|
if (opts.names === true) {
|
|
11039
|
-
const builder =
|
|
11039
|
+
const builder = _chunkMAYYTYV5cjs.createNamePlan.call(void 0, _chunkMAYYTYV5cjs.TICKET_LABEL_FIELDS);
|
|
11040
11040
|
const t = ctx.ticket;
|
|
11041
11041
|
builder.addResource(t["creatorResourceID"]);
|
|
11042
11042
|
builder.addFk("contract", t["contractID"]);
|
|
@@ -11048,20 +11048,20 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11048
11048
|
builder.addFk("billingCode", e["billingCodeID"]);
|
|
11049
11049
|
builder.addFk("contract", e["contractID"]);
|
|
11050
11050
|
}
|
|
11051
|
-
const names = await
|
|
11051
|
+
const names = await _chunkMAYYTYV5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
|
|
11052
11052
|
const ticketRow = { ...ctx.ticket };
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
for (const f of
|
|
11053
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
|
|
11054
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
|
|
11055
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11056
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
|
|
11057
|
+
for (const f of _chunkMAYYTYV5cjs.TICKET_LABEL_FIELDS) _chunkMAYYTYV5cjs.addLabelSibling.call(void 0, ticketRow, f, names);
|
|
11058
11058
|
result.ticket = ticketRow;
|
|
11059
11059
|
result.timeEntries.items = entriesPart.items.map((e) => {
|
|
11060
11060
|
const row = { ...e };
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11061
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
|
|
11062
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
|
|
11063
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
|
|
11064
|
+
_chunkMAYYTYV5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
|
|
11065
11065
|
return row;
|
|
11066
11066
|
});
|
|
11067
11067
|
result.names = names.section;
|
|
@@ -11071,7 +11071,7 @@ async function fullContext(resource, id, opts = {}, http) {
|
|
|
11071
11071
|
}
|
|
11072
11072
|
|
|
11073
11073
|
// src/resources/tickets.ts
|
|
11074
|
-
var TicketsResource = class extends
|
|
11074
|
+
var TicketsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
11075
11075
|
constructor(http, pageSize) {
|
|
11076
11076
|
super(http, {
|
|
11077
11077
|
key: "tickets",
|
|
@@ -11177,7 +11177,7 @@ var TicketsResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
11177
11177
|
};
|
|
11178
11178
|
|
|
11179
11179
|
// src/resources/ticket_webhooks.ts
|
|
11180
|
-
var TicketWebhooksResource = class extends
|
|
11180
|
+
var TicketWebhooksResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
11181
11181
|
constructor(http, pageSize) {
|
|
11182
11182
|
super(http, {
|
|
11183
11183
|
key: "ticket_webhooks",
|
|
@@ -11263,7 +11263,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
|
|
|
11263
11263
|
body: { MaxRecords: limit, filter },
|
|
11264
11264
|
operation
|
|
11265
11265
|
});
|
|
11266
|
-
const { items, pageDetails } =
|
|
11266
|
+
const { items, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res);
|
|
11267
11267
|
return { items, hasMore: pageDetails.nextPageUrl != null };
|
|
11268
11268
|
}
|
|
11269
11269
|
async function windowQuery3(_resource, kind, http, opts) {
|
|
@@ -11282,7 +11282,7 @@ async function customRange3(_resource, from, to, http, opts) {
|
|
|
11282
11282
|
const fromB = customRangeDay(from, "from", zone, "customRange");
|
|
11283
11283
|
const toB = customRangeDay(to, "to", zone, "customRange");
|
|
11284
11284
|
if (fromB.ms > toB.ms) {
|
|
11285
|
-
throw new (0,
|
|
11285
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("customRange: from must not be after to");
|
|
11286
11286
|
}
|
|
11287
11287
|
const toEndMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
11288
11288
|
const filter = [
|
|
@@ -11307,7 +11307,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
|
|
|
11307
11307
|
const fromB = customRangeDay(from, "from", zone, OP2);
|
|
11308
11308
|
const toB = customRangeDay(to, "to", zone, OP2);
|
|
11309
11309
|
if (fromB.ms > toB.ms) {
|
|
11310
|
-
throw new (0,
|
|
11310
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`${OP2}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP2 });
|
|
11311
11311
|
}
|
|
11312
11312
|
const windowToMs = zone === void 0 ? toB.ms + DAY_MS2 - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
|
|
11313
11313
|
const filter = [
|
|
@@ -11374,13 +11374,13 @@ var LINKAGE_OWNED_FIELDS = /* @__PURE__ */ new Set([
|
|
|
11374
11374
|
"roleID"
|
|
11375
11375
|
]);
|
|
11376
11376
|
var TIME_WINDOW_FIELDS = /* @__PURE__ */ new Set(["dateWorked", "startDateTime", "endDateTime", "hoursWorked"]);
|
|
11377
|
-
var ResourceInvalidError = class extends
|
|
11377
|
+
var ResourceInvalidError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
11378
11378
|
constructor(message, options = {}) {
|
|
11379
11379
|
super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
|
|
11380
11380
|
this.name = "ResourceInvalidError";
|
|
11381
11381
|
}
|
|
11382
11382
|
};
|
|
11383
|
-
var AllocationCodeError = class extends
|
|
11383
|
+
var AllocationCodeError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
11384
11384
|
/** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
|
|
11385
11385
|
|
|
11386
11386
|
constructor(kind, message, options = {}) {
|
|
@@ -11389,7 +11389,7 @@ var AllocationCodeError = class extends _chunkXSIY3WRRcjs.AutotaskError {
|
|
|
11389
11389
|
this.kind = kind;
|
|
11390
11390
|
}
|
|
11391
11391
|
};
|
|
11392
|
-
var NoApplicableAllocationCodeError = class extends
|
|
11392
|
+
var NoApplicableAllocationCodeError = class extends _chunkMAYYTYV5cjs.AutotaskError {
|
|
11393
11393
|
/** The structured blocker details (filters tried + department sets). */
|
|
11394
11394
|
|
|
11395
11395
|
constructor(details, options = {}) {
|
|
@@ -11415,7 +11415,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
11415
11415
|
let pages = 0;
|
|
11416
11416
|
for (; ; ) {
|
|
11417
11417
|
if (pages >= PAGE_GUARD) {
|
|
11418
|
-
throw new (0,
|
|
11418
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
|
|
11419
11419
|
code: "RESOLUTION_TRUNCATED",
|
|
11420
11420
|
category: "resolution",
|
|
11421
11421
|
operation,
|
|
@@ -11426,11 +11426,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
|
|
|
11426
11426
|
const res = await http.request({
|
|
11427
11427
|
method: "POST",
|
|
11428
11428
|
idempotent: true,
|
|
11429
|
-
path: isFirst ? path :
|
|
11429
|
+
path: isFirst ? path : _chunkMAYYTYV5cjs.cursorToPath.call(void 0, http.baseUrl, cursor),
|
|
11430
11430
|
body: { MaxRecords: pageSize, filter },
|
|
11431
11431
|
operation
|
|
11432
11432
|
});
|
|
11433
|
-
const { items: pageItems, pageDetails } =
|
|
11433
|
+
const { items: pageItems, pageDetails } = _chunkMAYYTYV5cjs.unwrapItems.call(void 0, res, operation);
|
|
11434
11434
|
items.push(...pageItems);
|
|
11435
11435
|
pages += 1;
|
|
11436
11436
|
if (items.length >= totalCap) break;
|
|
@@ -11543,8 +11543,8 @@ function windowDefaults(params) {
|
|
|
11543
11543
|
};
|
|
11544
11544
|
}
|
|
11545
11545
|
async function createForResource(resource, resourceID, params, opts = {}, http) {
|
|
11546
|
-
const rid =
|
|
11547
|
-
const pin = (value, label) => typeof value === "number" ?
|
|
11546
|
+
const rid = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, resourceID, "resourceID");
|
|
11547
|
+
const pin = (value, label) => typeof value === "number" ? _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, value, label) : void 0;
|
|
11548
11548
|
const pins = {
|
|
11549
11549
|
code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
|
|
11550
11550
|
ticket: pin(params.ticketID, "ticketID"),
|
|
@@ -11553,19 +11553,19 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11553
11553
|
};
|
|
11554
11554
|
const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
|
|
11555
11555
|
if (pinCount > 1) {
|
|
11556
|
-
throw new (0,
|
|
11556
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
11557
11557
|
"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)",
|
|
11558
11558
|
{ operation: OP }
|
|
11559
11559
|
);
|
|
11560
11560
|
}
|
|
11561
11561
|
if (pins.role !== void 0 && pins.code !== void 0) {
|
|
11562
|
-
throw new (0,
|
|
11562
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
11563
11563
|
"createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
|
|
11564
11564
|
{ operation: OP }
|
|
11565
11565
|
);
|
|
11566
11566
|
}
|
|
11567
11567
|
if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
|
|
11568
|
-
throw new (0,
|
|
11568
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
|
|
11569
11569
|
`createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
|
|
11570
11570
|
{ operation: OP }
|
|
11571
11571
|
);
|
|
@@ -11642,7 +11642,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11642
11642
|
if (usedLinkage === "internal" && linkage === "task") {
|
|
11643
11643
|
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).");
|
|
11644
11644
|
}
|
|
11645
|
-
return
|
|
11645
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0,
|
|
11646
11646
|
{
|
|
11647
11647
|
operation: OP,
|
|
11648
11648
|
method: "POST",
|
|
@@ -11681,7 +11681,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11681
11681
|
};
|
|
11682
11682
|
} catch (err) {
|
|
11683
11683
|
lastError = err;
|
|
11684
|
-
const text =
|
|
11684
|
+
const text = _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkMAYYTYV5cjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
|
|
11685
11685
|
const gate3 = ROLE_REJECTION_PATTERN.test(text);
|
|
11686
11686
|
if (usedLinkage !== "internal" && gate3) {
|
|
11687
11687
|
if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
|
|
@@ -11701,14 +11701,14 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11701
11701
|
throw err;
|
|
11702
11702
|
}
|
|
11703
11703
|
}
|
|
11704
|
-
if (
|
|
11704
|
+
if (_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, lastError)) {
|
|
11705
11705
|
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.`;
|
|
11706
11706
|
}
|
|
11707
11707
|
throw lastError;
|
|
11708
11708
|
}
|
|
11709
11709
|
function discoveryField(err, body, defaults) {
|
|
11710
|
-
if (!
|
|
11711
|
-
const entries =
|
|
11710
|
+
if (!_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
|
|
11711
|
+
const entries = _chunkMAYYTYV5cjs.parseVendorErrors.call(void 0, err.vendorError);
|
|
11712
11712
|
if (entries === void 0) return null;
|
|
11713
11713
|
for (const entry of entries) {
|
|
11714
11714
|
const field = entry.field;
|
|
@@ -11721,7 +11721,7 @@ function discoveryField(err, body, defaults) {
|
|
|
11721
11721
|
}
|
|
11722
11722
|
|
|
11723
11723
|
// src/resources/time_entries.ts
|
|
11724
|
-
var TimeEntriesResource = class extends
|
|
11724
|
+
var TimeEntriesResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
11725
11725
|
constructor(http, pageSize) {
|
|
11726
11726
|
super(http, {
|
|
11727
11727
|
key: "time_entries",
|
|
@@ -11858,7 +11858,7 @@ var TimeEntriesResource = class extends _chunkXSIY3WRRcjs.BaseResource {
|
|
|
11858
11858
|
};
|
|
11859
11859
|
|
|
11860
11860
|
// src/resources/time_entry_attachments.ts
|
|
11861
|
-
var TimeEntryAttachmentsResource = class extends
|
|
11861
|
+
var TimeEntryAttachmentsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
11862
11862
|
constructor(http, pageSize) {
|
|
11863
11863
|
super(http, {
|
|
11864
11864
|
key: "time_entry_attachments",
|
|
@@ -11921,9 +11921,9 @@ var TimeEntryAttachmentsResource = class extends _chunkXSIY3WRRcjs.BaseResource
|
|
|
11921
11921
|
|
|
11922
11922
|
// src/resources/special/time_off_requests.ts
|
|
11923
11923
|
async function approve(_resource, id, opts = {}, http) {
|
|
11924
|
-
const numericId =
|
|
11924
|
+
const numericId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
11925
11925
|
if (opts.dryRun === true) {
|
|
11926
|
-
return
|
|
11926
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
11927
11927
|
operation: "time_off_requests.approve",
|
|
11928
11928
|
method: "GET",
|
|
11929
11929
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
@@ -11939,16 +11939,16 @@ async function approve(_resource, id, opts = {}, http) {
|
|
|
11939
11939
|
operation: "time_off_requests.approve",
|
|
11940
11940
|
maxRetries: opts.maxRetries
|
|
11941
11941
|
});
|
|
11942
|
-
return
|
|
11942
|
+
return _chunkMAYYTYV5cjs.unwrapOperation.call(void 0, res);
|
|
11943
11943
|
}
|
|
11944
11944
|
async function reject(_resource, id, reason, opts = {}, http) {
|
|
11945
|
-
const numericId =
|
|
11945
|
+
const numericId = _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, id, "id");
|
|
11946
11946
|
const text = reason.trim();
|
|
11947
11947
|
if (text === "") {
|
|
11948
|
-
throw new (0,
|
|
11948
|
+
throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
|
|
11949
11949
|
}
|
|
11950
11950
|
if (opts.dryRun === true) {
|
|
11951
|
-
return
|
|
11951
|
+
return _chunkMAYYTYV5cjs.buildDryRunResult.call(void 0, {
|
|
11952
11952
|
operation: "time_off_requests.reject",
|
|
11953
11953
|
method: "POST",
|
|
11954
11954
|
path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
|
|
@@ -11966,11 +11966,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
|
|
|
11966
11966
|
operation: "time_off_requests.reject",
|
|
11967
11967
|
maxRetries: opts.maxRetries
|
|
11968
11968
|
});
|
|
11969
|
-
return
|
|
11969
|
+
return _chunkMAYYTYV5cjs.unwrapOperation.call(void 0, res);
|
|
11970
11970
|
}
|
|
11971
11971
|
|
|
11972
11972
|
// src/resources/time_off_requests.ts
|
|
11973
|
-
var TimeOffRequestsResource = class extends
|
|
11973
|
+
var TimeOffRequestsResource = class extends _chunkMAYYTYV5cjs.BaseResource {
|
|
11974
11974
|
constructor(http, pageSize) {
|
|
11975
11975
|
super(http, {
|
|
11976
11976
|
key: "time_off_requests",
|