node-autotask 0.92.1 → 0.93.1

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/MCP_TOOL_CATALOG.json +255 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +1042 -222
  5. package/dist/capabilities-data.js +1296 -476
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-2MC3LDZU.js → chunk-DCISF6AG.js} +3 -3
  9. package/dist/{chunk-JY6BQUPO.cjs → chunk-I75N5VVE.cjs} +202 -202
  10. package/dist/{chunk-C7KZ7PB3.js → chunk-L7SWLH3U.js} +4 -2
  11. package/dist/{chunk-QVDXIXY4.js → chunk-NDGMPMCW.js} +2 -2
  12. package/dist/{chunk-LYAHXYZR.cjs → chunk-NRO2NJAZ.cjs} +202 -19
  13. package/dist/{chunk-QC45KFQQ.cjs → chunk-RYPG3K4Y.cjs} +32 -30
  14. package/dist/{chunk-QXJQIZCT.cjs → chunk-SBHQIPCJ.cjs} +3 -3
  15. package/dist/{chunk-4BICEQ4S.js → chunk-TWQQ3EER.js} +197 -14
  16. package/dist/{index-B0p5O-2e.d.cts → index-Cbos4Wgx.d.cts} +71 -1
  17. package/dist/{index-B0p5O-2e.d.ts → index-Cbos4Wgx.d.ts} +71 -1
  18. package/dist/{index-opnSlg90.d.cts → index-CnNxnu7M.d.cts} +9 -2
  19. package/dist/{index-it9IqLsM.d.ts → index-coyFHSSF.d.ts} +9 -2
  20. package/dist/index.cjs +86 -86
  21. package/dist/index.d.cts +4 -4
  22. package/dist/index.d.ts +4 -4
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +10 -4
  26. package/dist/operations/index.d.ts +10 -4
  27. package/dist/operations/index.js +2 -2
  28. package/dist/pool.cjs +24 -15
  29. package/dist/pool.d.cts +10 -7
  30. package/dist/pool.d.ts +10 -7
  31. package/dist/pool.js +17 -8
  32. package/dist/resources/index.cjs +27 -27
  33. package/dist/resources/index.d.cts +2 -2
  34. package/dist/resources/index.d.ts +2 -2
  35. package/dist/resources/index.js +3 -3
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/docs/API.md +4 -2
  39. package/examples/mcp-server-http.ts +6 -3
  40. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-QVDXIXY4.js';
2
- import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-4BICEQ4S.js';
1
+ import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-NDGMPMCW.js';
2
+ import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-TWQQ3EER.js';
3
3
 
4
4
  // src/client.ts
5
5
  var AutotaskClient = class {
@@ -95,6 +95,7 @@ var AutotaskClient = class {
95
95
  organizationalLevel1s;
96
96
  organizationalLevel2s;
97
97
  organizationalLevelAssociations;
98
+ organizationalResources;
98
99
  phases;
99
100
  products;
100
101
  productVendors;
@@ -112,6 +113,7 @@ var AutotaskClient = class {
112
113
  quotes;
113
114
  quoteTemplates;
114
115
  resourceAttachments;
116
+ resourceDailyAvailabilities;
115
117
  resourceRoleQueues;
116
118
  resourceRoles;
117
119
  resources;
@@ -1,5 +1,5 @@
1
- import { GenericResource, readTasks, OperationNotSupportedError, rejectInventoryFactsOption, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-4BICEQ4S.js';
2
- import { loadCapabilityRecords } from './chunk-2MC3LDZU.js';
1
+ import { GenericResource, readTasks, OperationNotSupportedError, rejectInventoryFactsOption, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-TWQQ3EER.js';
2
+ import { loadCapabilityRecords } from './chunk-DCISF6AG.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQXJQIZCT_cjs = require('./chunk-QXJQIZCT.cjs');
3
+ var chunkSBHQIPCJ_cjs = require('./chunk-SBHQIPCJ.cjs');
4
4
  var chunkCM5O672I_cjs = require('./chunk-CM5O672I.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
@@ -6053,7 +6053,26 @@ var RELATIONSHIP_MAP = {
6053
6053
  "workflowResource": false,
6054
6054
  "group": "B",
6055
6055
  "parent": null,
6056
- "children": [],
6056
+ "children": [
6057
+ {
6058
+ "resource": "organizational_resources",
6059
+ "apiEntity": "OrganizationalResource",
6060
+ "parentField": "organizationalLevelAssociationID",
6061
+ "parentSegment": "Resources",
6062
+ "tier": "advanced",
6063
+ "workflowResource": false,
6064
+ "specialOps": [
6065
+ "listByParent"
6066
+ ],
6067
+ "searchCovers": null,
6068
+ "scopedOps": {
6069
+ "create": false,
6070
+ "query": true,
6071
+ "update": false,
6072
+ "delete": false
6073
+ }
6074
+ }
6075
+ ],
6057
6076
  "naturalKeys": {
6058
6077
  "hasSearch": false,
6059
6078
  "searchCovers": null,
@@ -7304,6 +7323,24 @@ var RELATIONSHIP_MAP = {
7304
7323
  "delete": true
7305
7324
  }
7306
7325
  },
7326
+ {
7327
+ "resource": "resource_daily_availabilities",
7328
+ "apiEntity": "ResourceDailyAvailability",
7329
+ "parentField": "resourceID",
7330
+ "parentSegment": "DailyAvailabilities",
7331
+ "tier": "advanced",
7332
+ "workflowResource": false,
7333
+ "specialOps": [
7334
+ "listByParent"
7335
+ ],
7336
+ "searchCovers": null,
7337
+ "scopedOps": {
7338
+ "create": false,
7339
+ "query": true,
7340
+ "update": false,
7341
+ "delete": false
7342
+ }
7343
+ },
7307
7344
  {
7308
7345
  "resource": "resource_role_queues",
7309
7346
  "apiEntity": "ResourceRoleQueue",
@@ -11127,6 +11164,56 @@ var RELATIONSHIP_MAP = {
11127
11164
  "zoneFacts": null,
11128
11165
  "deleteBoundary": null,
11129
11166
  "markerField": null
11167
+ },
11168
+ "resource_daily_availabilities": {
11169
+ "resource": "resource_daily_availabilities",
11170
+ "apiEntity": "ResourceDailyAvailability",
11171
+ "kind": "entity",
11172
+ "path": "ResourceDailyAvailabilities",
11173
+ "parentScoped": true,
11174
+ "tier": "advanced",
11175
+ "workflowResource": false,
11176
+ "group": "B",
11177
+ "parent": {
11178
+ "resource": "resources",
11179
+ "segment": "DailyAvailabilities",
11180
+ "field": "resourceID"
11181
+ },
11182
+ "children": [],
11183
+ "naturalKeys": {
11184
+ "hasSearch": false,
11185
+ "searchCovers": null,
11186
+ "findBy": []
11187
+ },
11188
+ "blindSurfaces": null,
11189
+ "zoneFacts": null,
11190
+ "deleteBoundary": null,
11191
+ "markerField": null
11192
+ },
11193
+ "organizational_resources": {
11194
+ "resource": "organizational_resources",
11195
+ "apiEntity": "OrganizationalResource",
11196
+ "kind": "entity",
11197
+ "path": "OrganizationalResources",
11198
+ "parentScoped": true,
11199
+ "tier": "advanced",
11200
+ "workflowResource": false,
11201
+ "group": "B",
11202
+ "parent": {
11203
+ "resource": "organizational_level_associations",
11204
+ "segment": "Resources",
11205
+ "field": "organizationalLevelAssociationID"
11206
+ },
11207
+ "children": [],
11208
+ "naturalKeys": {
11209
+ "hasSearch": false,
11210
+ "searchCovers": null,
11211
+ "findBy": []
11212
+ },
11213
+ "blindSurfaces": null,
11214
+ "zoneFacts": null,
11215
+ "deleteBoundary": null,
11216
+ "markerField": null
11130
11217
  }
11131
11218
  };
11132
11219
  var BLIND_SURFACE_STAMPS = {
@@ -16606,6 +16693,9 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
16606
16693
  "shipping_types": [
16607
16694
  "description",
16608
16695
  "name"
16696
+ ],
16697
+ "resource_daily_availabilities": [
16698
+ "travelAvailability"
16609
16699
  ]
16610
16700
  };
16611
16701
 
@@ -17064,11 +17154,22 @@ function auditReadTarget(path, operation) {
17064
17154
  function isKnowledgeBaseRootResource(resource) {
17065
17155
  return resource === "knowledge_base_categories" || resource === "knowledge_base_articles";
17066
17156
  }
17157
+ var STAFF_COLLECTION_PATHS = {
17158
+ organizational_resources: /^\/v1\.0\/OrganizationalLevelAssociations\/\d+\/Resources\/?$/i,
17159
+ resource_daily_availabilities: /^\/v1\.0\/Resources\/\d+\/DailyAvailabilities\/?$/i
17160
+ };
17161
+ function hasNativeStaffCollection(resource) {
17162
+ return Object.hasOwn(STAFF_COLLECTION_PATHS, resource);
17163
+ }
17067
17164
  function isExactRecordResource(resource) {
17068
- return resource === "inventory_locations" || resource === "inventory_items" || resource === "internal_locations" || resource === "shipping_types" || isKnowledgeBaseRootResource(resource);
17165
+ return hasNativeStaffCollection(resource) || resource === "inventory_locations" || resource === "inventory_items" || resource === "internal_locations" || resource === "shipping_types" || isKnowledgeBaseRootResource(resource);
17069
17166
  }
17070
- var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|InventoryItems|InternalLocations|ShippingTypes|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
17167
+ var EXACT_RECORD_PATH = /^\/v1\.0\/(?:OrganizationalResources|ResourceDailyAvailabilities|InventoryLocations|InventoryItems|InternalLocations|ShippingTypes|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
17071
17168
  function exactRecordResponseTarget(path, method, operation) {
17169
+ if (method === "GET" && operation?.endsWith(".listByParent")) {
17170
+ const resource = operation.slice(0, -".listByParent".length);
17171
+ if (hasNativeStaffCollection(resource) && STAFF_COLLECTION_PATHS[resource].test(path)) return "query";
17172
+ }
17072
17173
  const match = EXACT_RECORD_PATH.exec(path);
17073
17174
  if (match === null) return void 0;
17074
17175
  const suffix = match[1]?.toLowerCase();
@@ -17136,7 +17237,7 @@ function validateExactRecordResponse(body, target, path, method, requestBody, op
17136
17237
  if (String(id) !== expectedId) {
17137
17238
  throw new AutotaskConfigError(`returned ${resource} id must match the requested id`, { operation });
17138
17239
  }
17139
- if (parts.length === 6) {
17240
+ if (entity === "knowledgebasearticles" && parts.length === 6) {
17140
17241
  const parent = ownField(item, "articleCategoryID");
17141
17242
  if (typeof parent !== "number" || !Number.isInteger(parent) || parent <= 0 || parent > 2147483647) {
17142
17243
  invalid("Expected a valid category ID in the Knowledge Base article response");
@@ -17162,13 +17263,22 @@ function decodeResponseJson(text, auditTarget, recordTarget, path) {
17162
17263
  }
17163
17264
  const idTokens = /* @__PURE__ */ new WeakMap();
17164
17265
  const receiptTokens = /* @__PURE__ */ new WeakMap();
17165
- const holidaySetTokens = /* @__PURE__ */ new WeakMap();
17166
- const internalLocations = path !== void 0 && /^\/v1\.0\/InternalLocations\//i.test(path);
17266
+ const signedIdTokens = /* @__PURE__ */ new WeakMap();
17267
+ const nativeStaffQuery = recordTarget === "query" && path !== void 0;
17268
+ const organizationalList = nativeStaffQuery && STAFF_COLLECTION_PATHS.organizational_resources.test(path);
17269
+ const nativeParentField = organizationalList ? "organizationalLevelAssociationID" : nativeStaffQuery && STAFF_COLLECTION_PATHS.resource_daily_availabilities.test(path) ? "resourceID" : void 0;
17270
+ const invalidNativeParents = nativeParentField === void 0 ? void 0 : /* @__PURE__ */ new WeakSet();
17271
+ const organizationalRead = organizationalList || path !== void 0 && (target === "query" || target === "item") && /^\/v1\.0\/OrganizationalResources\//i.test(path);
17272
+ const signedIdField = organizationalRead ? "soapParentPropertyId" : path !== void 0 && /^\/v1\.0\/InternalLocations\//i.test(path) ? "holidaySetId" : void 0;
17167
17273
  const body = JSON.parse(text, function(key, value, context) {
17168
17274
  if (typeof value === "number" && context?.source !== void 0) {
17169
- if (key === "id") idTokens.set(this, context.source);
17170
- if (key === "itemId" && target === "mutation") receiptTokens.set(this, context.source);
17171
- if (internalLocations && key === "holidaySetId") holidaySetTokens.set(this, context.source);
17275
+ const token = context.source;
17276
+ if (key === "id") idTokens.set(this, token);
17277
+ if (key === "itemId" && target === "mutation") receiptTokens.set(this, token);
17278
+ if (key === signedIdField) signedIdTokens.set(this, token);
17279
+ if (key === nativeParentField && (!isAuditDecimalId(token) || value > 2147483647)) {
17280
+ invalidNativeParents?.add(this);
17281
+ }
17172
17282
  }
17173
17283
  return value;
17174
17284
  });
@@ -17176,9 +17286,12 @@ function decodeResponseJson(text, auditTarget, recordTarget, path) {
17176
17286
  if (Array.isArray(rows)) {
17177
17287
  for (const row of rows) {
17178
17288
  if (!isRecord2(row)) continue;
17179
- const holidaySet = holidaySetTokens.get(row);
17180
- if (holidaySet !== void 0 && !Number.isSafeInteger(row.holidaySetId) && isSignedInt64Token(holidaySet)) {
17181
- row.holidaySetId = holidaySet;
17289
+ if (nativeParentField !== void 0 && invalidNativeParents?.has(row)) {
17290
+ row[nativeParentField] = null;
17291
+ }
17292
+ const signedId = signedIdTokens.get(row);
17293
+ if (signedIdField !== void 0 && signedId !== void 0 && !Number.isSafeInteger(row[signedIdField]) && isSignedInt64Token(signedId)) {
17294
+ row[signedIdField] = signedId;
17182
17295
  }
17183
17296
  const key = target === "mutation" && ownField(row, "itemId") !== void 0 ? "itemId" : "id";
17184
17297
  const value = ownField(row, key);
@@ -17228,6 +17341,16 @@ function attachEmptyReasonDetails(err) {
17228
17341
  err.details = { ...err.details ?? {} };
17229
17342
  if (stamp !== void 0) {
17230
17343
  err.details.emptyReason = stamp;
17344
+ } else if (isGetMiss && hasNativeStaffCollection(resource)) {
17345
+ const remedy = `Verify the ID with ${resource}.query and an exact id filter, or use ${resource}.listByParent with the known parent ID. Check the API user's permissions.`;
17346
+ err.suggestedAction = remedy;
17347
+ err.details.emptyReason = {
17348
+ surface,
17349
+ kind: "not-found",
17350
+ authority: `${resource}.query`,
17351
+ note: "No record at this ID was visible to this API user.",
17352
+ remedy
17353
+ };
17231
17354
  } else if (isGetMiss) {
17232
17355
  const blind = BLIND_SURFACE_STAMPS[resource]?.query;
17233
17356
  err.details.emptyReason = blind !== void 0 ? {
@@ -19197,7 +19320,7 @@ async function capabilitySets() {
19197
19320
  const fieldOps = /* @__PURE__ */ new Map();
19198
19321
  const udfCapable = /* @__PURE__ */ new Set();
19199
19322
  const resources = /* @__PURE__ */ new Set();
19200
- for (const rec of await chunkQXJQIZCT_cjs.loadCapabilityRecords()) {
19323
+ for (const rec of await chunkSBHQIPCJ_cjs.loadCapabilityRecords()) {
19201
19324
  if (rec.resource === "operations") continue;
19202
19325
  resources.add(rec.resource);
19203
19326
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -19208,7 +19331,7 @@ async function capabilitySets() {
19208
19331
  var derivedIndexPromise = null;
19209
19332
  function derivedIndexLoad() {
19210
19333
  if (derivedIndexPromise === null) {
19211
- derivedIndexPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => {
19334
+ derivedIndexPromise = chunkSBHQIPCJ_cjs.loadCapabilityRecords().then((records) => {
19212
19335
  const index = /* @__PURE__ */ new Map();
19213
19336
  for (const rec of records) {
19214
19337
  const declared = rec.metadata?.derivedFields;
@@ -19406,6 +19529,7 @@ function kindFetches(holder, resource) {
19406
19529
  udf: () => holder?.getUdfInfo?.() ?? Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))
19407
19530
  };
19408
19531
  }
19532
+ var KIND_OPERATIONS = { info: "getEntityInfo", fields: "getFieldInfo", udf: "getUdfInfo" };
19409
19533
  function catalogProjector(kind, ctx) {
19410
19534
  if (ctx.compact) {
19411
19535
  const keepValues = ctx.labels && ctx.fieldsFilter !== void 0;
@@ -19461,6 +19585,11 @@ async function sweepResource(ctx, resource, tally, reads) {
19461
19585
  } else if (peek.age !== null) ages.push(peek.age);
19462
19586
  if (outcome.status === "rejected") {
19463
19587
  const error = outcome.reason;
19588
+ const { category, httpStatus } = error;
19589
+ const operation = `${resource}.${KIND_OPERATIONS[kind]}`;
19590
+ if (category === "auth" && error.operation === operation && (httpStatus === 401 || httpStatus === 403) && (tally.authFailure === void 0 || httpStatus < tally.authFailure.httpStatus)) {
19591
+ tally.authFailure = { httpStatus, operation };
19592
+ }
19464
19593
  if (row.error === null) row.error = { code: error.code, message: error.message };
19465
19594
  continue;
19466
19595
  }
@@ -19543,6 +19672,7 @@ async function fieldCatalog(client, opts) {
19543
19672
  ttlMs: cache?.ttlMs ?? null,
19544
19673
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
19545
19674
  rows,
19675
+ ...tally.authFailure === void 0 ? {} : { authFailure: tally.authFailure },
19546
19676
  wireUsed: tally.wireUsed,
19547
19677
  cap: MAX_FIELD_CATALOG_WIRE,
19548
19678
  truncated: false,
@@ -20635,6 +20765,7 @@ var MODEL_FIELD_SETS = {
20635
20765
  "organizational_level1s": ["id", "description", "isActive", "name"],
20636
20766
  "organizational_level2s": ["id", "description", "isActive", "name"],
20637
20767
  "organizational_level_associations": ["id", "isActive", "organizationalLevel1ID", "organizationalLevel2ID"],
20768
+ "organizational_resources": ["id", "organizationalLevelAssociationID", "resourceID", "soapParentPropertyId"],
20638
20769
  "phases": ["id", "createDate", "creatorResourceID", "description", "dueDate", "estimatedHours", "externalID", "isScheduled", "lastActivityDateTime", "parentPhaseID", "phaseNumber", "projectID", "startDate", "title", "soapParentPropertyId"],
20639
20770
  "product_vendors": ["id", "isActive", "isDefault", "productID", "vendorCost", "vendorID", "vendorPartNumber", "soapParentPropertyId"],
20640
20771
  "products": ["id", "billingType", "chargeBillingCodeID", "createdByResourceID", "createdTime", "defaultVendorID", "description", "doesNotRequireProcurement", "externalProductID", "impersonatorCreatorResourceID", "internalProductID", "isActive", "isEligibleForRma", "isSerialized", "link", "manufacturerName", "manufacturerProductName", "markupRate", "msrp", "name", "periodType", "priceCostMethod", "productBillingCodeID", "productCategory", "sku", "unitCost", "unitPrice", "vendorProductNumber", "defaultInstalledProductCategoryID", "userDefinedFields"],
@@ -20652,6 +20783,7 @@ var MODEL_FIELD_SETS = {
20652
20783
  "quote_templates": ["id", "calculateTaxSeparately", "createDate", "createdBy", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "description", "displayTaxCategorySuperscripts", "isActive", "lastActivityBy", "lastActivityDate", "name", "numberFormat", "pageLayout", "pageNumberFormat", "showEachTaxInGroup", "showGridHeader", "showTaxCategory", "showVerticalGridLines"],
20653
20784
  "quotes": ["id", "approvalStatus", "approvalStatusChangedByResourceID", "approvalStatusChangedDate", "billToLocationID", "calculateTaxSeparately", "comment", "companyID", "contactID", "createDate", "creatorResourceID", "description", "effectiveDate", "expirationDate", "extApprovalContactResponse", "extApprovalResponseDate", "extApprovalResponseSignature", "externalQuoteNumber", "groupByID", "impersonatorCreatorResourceID", "isActive", "lastActivityDate", "lastModifiedBy", "lastPublishedByResourceID", "lastPublishedDateTime", "name", "opportunityID", "paymentTerm", "paymentType", "primaryQuote", "proposalProjectID", "purchaseOrderNumber", "quoteNumber", "quoteTemplateID", "shippingType", "shipToLocationID", "showEachTaxInGroup", "showTaxCategory", "soldToLocationID", "taxRegionID"],
20654
20785
  "resource_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "resourceID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
20786
+ "resource_daily_availabilities": ["id", "resourceID", "sundayAvailableHours", "mondayAvailableHours", "tuesdayAvailableHours", "wednesdayAvailableHours", "thursdayAvailableHours", "fridayAvailableHours", "saturdayAvailableHours", "weeklyBillableHoursGoal", "travelAvailability", "soapParentPropertyId"],
20655
20787
  "resource_role_queues": ["id", "queueID", "resourceID", "soapParentPropertyId"],
20656
20788
  "resource_roles": ["id", "departmentID", "isActive", "queueID", "resourceID", "roleID", "soapParentPropertyId"],
20657
20789
  "resource_skills": ["id", "resourceID", "skillDescription", "skillID", "skillLevel", "soapParentPropertyId"],
@@ -24521,6 +24653,19 @@ var SIMPLE_RESOURCES = [
24521
24653
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
24522
24654
  opForms: { get: "global", create: "global", update: "global" }
24523
24655
  },
24656
+ {
24657
+ key: "organizational_resources",
24658
+ accessor: "organizationalResources",
24659
+ resourcePath: "/V1.0/OrganizationalResources",
24660
+ parentScopedPath: "/V1.0/OrganizationalLevelAssociations/{parentId}/Resources",
24661
+ parentPath: "/V1.0/OrganizationalLevelAssociations",
24662
+ parentField: "organizationalLevelAssociationID",
24663
+ deletable: false,
24664
+ udfCapable: false,
24665
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
24666
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
24667
+ opForms: { get: "global" }
24668
+ },
24524
24669
  {
24525
24670
  key: "phases",
24526
24671
  accessor: "phases",
@@ -24730,6 +24875,19 @@ var SIMPLE_RESOURCES = [
24730
24875
  helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
24731
24876
  opForms: { get: "scoped", create: "scoped", delete: "scoped" }
24732
24877
  },
24878
+ {
24879
+ key: "resource_daily_availabilities",
24880
+ accessor: "resourceDailyAvailabilities",
24881
+ resourcePath: "/V1.0/ResourceDailyAvailabilities",
24882
+ parentScopedPath: "/V1.0/Resources/{parentId}/DailyAvailabilities",
24883
+ parentPath: "/V1.0/Resources",
24884
+ parentField: "resourceID",
24885
+ deletable: false,
24886
+ udfCapable: false,
24887
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
24888
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
24889
+ opForms: { get: "global" }
24890
+ },
24733
24891
  {
24734
24892
  key: "resource_role_queues",
24735
24893
  accessor: "resourceRoleQueues",
@@ -25386,6 +25544,23 @@ var GenericResource = class extends BaseResource {
25386
25544
  this.requireOp("count");
25387
25545
  return this.countGlobal(params);
25388
25546
  }
25547
+ /** Read one native staff-association page; raw continuations are neither returned nor followed. */
25548
+ async listByParent(parentId) {
25549
+ if (!["organizational_resources", "resource_daily_availabilities"].includes(this.config.key)) throw new OperationNotSupportedError(this.config.key, "listByParent");
25550
+ const operation = `${this.config.key}.listByParent`;
25551
+ const parent = parseIdentifier(parentId, "parentId");
25552
+ if (!isAuditDecimalId(String(parent))) throw new AutotaskConfigError("parentId must be a non-negative signed 64-bit integer", { operation });
25553
+ const page = unwrapItems(await this.http.request({ method: "GET", path: this.scopedCollectionPath(parent), operation }), operation);
25554
+ const next = Object.hasOwn(page.pageDetails, "nextPageUrl") ? page.pageDetails.nextPageUrl : void 0;
25555
+ if (next !== null && (typeof next !== "string" || next.length === 0)) throw new AutotaskError("Expected explicit native page continuation metadata", { code: "INVALID_RESPONSE", category: "server", operation });
25556
+ const field = this.config.parentField;
25557
+ const hasInvalidParent = page.items.some((row) => {
25558
+ const value = isRecord2(row) && Object.hasOwn(row, field) ? row[field] : void 0;
25559
+ return typeof value !== "number" || !Number.isInteger(value) || value > 2147483647 || String(value) !== String(parent);
25560
+ });
25561
+ if (hasInvalidParent) throw new AutotaskError("Native page rows must bind the requested parent through the int32 model field", { code: "INVALID_RESPONSE", category: "server", operation });
25562
+ return { items: page.items, hasMore: next !== null };
25563
+ }
25389
25564
  async get(a, b = void 0, c = void 0) {
25390
25565
  this.requireOp("get");
25391
25566
  if (isIdentifier(b)) {
@@ -27195,7 +27370,7 @@ function dateBucketLabel(value, bucket) {
27195
27370
  var queryResourceKeysPromise = null;
27196
27371
  function queryResourceKeys() {
27197
27372
  if (queryResourceKeysPromise === null) {
27198
- queryResourceKeysPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => {
27373
+ queryResourceKeysPromise = chunkSBHQIPCJ_cjs.loadCapabilityRecords().then((records) => {
27199
27374
  const s = /* @__PURE__ */ new Set();
27200
27375
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
27201
27376
  return s;
@@ -27317,7 +27492,7 @@ function parseTopAndLimit(opts, problems) {
27317
27492
  return { top, limit };
27318
27493
  }
27319
27494
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
27320
- const records = resourceKey === void 0 ? [] : await chunkQXJQIZCT_cjs.loadCapabilityRecords();
27495
+ const records = resourceKey === void 0 ? [] : await chunkSBHQIPCJ_cjs.loadCapabilityRecords();
27321
27496
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
27322
27497
  if (record === void 0) return void 0;
27323
27498
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -27506,6 +27681,13 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
27506
27681
  );
27507
27682
  continue;
27508
27683
  }
27684
+ if (hasNativeStaffCollection(resourceKey)) {
27685
+ const clientResource = `client.${camelKey(resourceKey)}`;
27686
+ problems.push(
27687
+ `${at}.resource: "${resourceKey}" is a parent-scoped child outside ${opName}; use ${clientResource}.get(id) or ${clientResource}.listByParent(parentId)`
27688
+ );
27689
+ continue;
27690
+ }
27509
27691
  const rel = RELATIONSHIP_MAP[resourceKey];
27510
27692
  const globalRead = resourceKey === "time_off_requests" || resourceKey === "knowledge_base_articles";
27511
27693
  if (rel !== void 0 && rel.parentScoped && !globalRead) {
@@ -27813,7 +27995,7 @@ async function uiLink(client, input) {
27813
27995
  var indexPromise = null;
27814
27996
  function operationIndex() {
27815
27997
  if (indexPromise === null) {
27816
- indexPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27998
+ indexPromise = chunkSBHQIPCJ_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
27817
27999
  }
27818
28000
  return indexPromise;
27819
28001
  }
@@ -31944,7 +32126,8 @@ async function guardUnscopedQueryWalk(holder, operation, bag) {
31944
32126
  counted = await holder.count({ filter: conditions === void 0 ? void 0 : conditions });
31945
32127
  } catch (err) {
31946
32128
  const code = err?.code;
31947
- if (typeof code === "string" && PROPAGATE_CODES.has(code)) throw err;
32129
+ const denied = isAutotaskError(err) && err.category === "auth" && (err.httpStatus === 401 || err.httpStatus === 403);
32130
+ if (denied || typeof code === "string" && PROPAGATE_CODES.has(code)) throw err;
31948
32131
  const label = typeof code === "string" && /^[A-Z][A-Z_]{2,40}$/.test(code) ? ` (${code})` : "";
31949
32132
  return { note: `scope check skipped: the pre-flight count failed${label}; this unscoped walk was not guarded.` };
31950
32133
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkJY6BQUPO_cjs = require('./chunk-JY6BQUPO.cjs');
4
- var chunkLYAHXYZR_cjs = require('./chunk-LYAHXYZR.cjs');
3
+ var chunkI75N5VVE_cjs = require('./chunk-I75N5VVE.cjs');
4
+ var chunkNRO2NJAZ_cjs = require('./chunk-NRO2NJAZ.cjs');
5
5
 
6
6
  // src/client.ts
7
7
  var AutotaskClient = class {
@@ -97,6 +97,7 @@ var AutotaskClient = class {
97
97
  organizationalLevel1s;
98
98
  organizationalLevel2s;
99
99
  organizationalLevelAssociations;
100
+ organizationalResources;
100
101
  phases;
101
102
  products;
102
103
  productVendors;
@@ -114,6 +115,7 @@ var AutotaskClient = class {
114
115
  quotes;
115
116
  quoteTemplates;
116
117
  resourceAttachments;
118
+ resourceDailyAvailabilities;
117
119
  resourceRoleQueues;
118
120
  resourceRoles;
119
121
  resources;
@@ -178,34 +180,34 @@ var AutotaskClient = class {
178
180
  * anything is wired. Construction issues NO request.
179
181
  */
180
182
  constructor(options) {
181
- this.config = chunkLYAHXYZR_cjs.resolveConfig(options);
182
- this.http = new chunkLYAHXYZR_cjs.HttpClient(this.config);
183
+ this.config = chunkNRO2NJAZ_cjs.resolveConfig(options);
184
+ this.http = new chunkNRO2NJAZ_cjs.HttpClient(this.config);
183
185
  this.http.client = this;
184
- for (const entry of chunkLYAHXYZR_cjs.SIMPLE_RESOURCES) {
185
- this[entry.accessor] = new chunkLYAHXYZR_cjs.GenericResource(this.http, entry, this.config.pageSize);
186
+ for (const entry of chunkNRO2NJAZ_cjs.SIMPLE_RESOURCES) {
187
+ this[entry.accessor] = new chunkNRO2NJAZ_cjs.GenericResource(this.http, entry, this.config.pageSize);
186
188
  }
187
- this.companies = new chunkLYAHXYZR_cjs.CompaniesResource(this.http, this.config.pageSize);
188
- this.configurationItems = new chunkJY6BQUPO_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
189
- this.contacts = new chunkJY6BQUPO_cjs.ContactsResource(this.http, this.config.pageSize);
190
- this.contracts = new chunkLYAHXYZR_cjs.ContractsResource(this.http, this.config.pageSize);
191
- this.inventoryProducts = new chunkJY6BQUPO_cjs.InventoryProductsResource(this.http, this.config.pageSize);
192
- this.invoices = new chunkLYAHXYZR_cjs.InvoicesResource(this.http, this.config.pageSize);
193
- this.quotes = new chunkJY6BQUPO_cjs.QuotesResource(this.http, this.config.pageSize);
194
- this.resourceTimeOffAdditional = new chunkJY6BQUPO_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
195
- this.resourceTimeOffBalances = new chunkJY6BQUPO_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
196
- this.resources = new chunkJY6BQUPO_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
197
- this.serviceCalls = new chunkJY6BQUPO_cjs.ServiceCallsResource(this.http, this.config.pageSize);
198
- this.ticketCharges = new chunkJY6BQUPO_cjs.TicketChargesResource(this.http, this.config.pageSize);
199
- this.tickets = new chunkJY6BQUPO_cjs.TicketsResource(this.http, this.config.pageSize);
200
- this.timeEntries = new chunkLYAHXYZR_cjs.TimeEntriesResource(this.http, this.config.pageSize);
201
- this.timeOffRequests = new chunkJY6BQUPO_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
202
- this.authenticateResource = new chunkJY6BQUPO_cjs.AuthenticateResource(this.http);
203
- this.entityInformation = new chunkJY6BQUPO_cjs.EntityInformationResource(this.http);
204
- this.modules = new chunkJY6BQUPO_cjs.ModulesResource(this.http);
205
- this.thresholdInformation = new chunkJY6BQUPO_cjs.ThresholdInformationResource(this.http);
206
- this.version = new chunkJY6BQUPO_cjs.VersionResource(this.http);
207
- this.versionInformation = new chunkJY6BQUPO_cjs.VersionInformationResource(this.http);
208
- this.zoneInformation = new chunkJY6BQUPO_cjs.ZoneInformationResource(this.http);
189
+ this.companies = new chunkNRO2NJAZ_cjs.CompaniesResource(this.http, this.config.pageSize);
190
+ this.configurationItems = new chunkI75N5VVE_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
191
+ this.contacts = new chunkI75N5VVE_cjs.ContactsResource(this.http, this.config.pageSize);
192
+ this.contracts = new chunkNRO2NJAZ_cjs.ContractsResource(this.http, this.config.pageSize);
193
+ this.inventoryProducts = new chunkI75N5VVE_cjs.InventoryProductsResource(this.http, this.config.pageSize);
194
+ this.invoices = new chunkNRO2NJAZ_cjs.InvoicesResource(this.http, this.config.pageSize);
195
+ this.quotes = new chunkI75N5VVE_cjs.QuotesResource(this.http, this.config.pageSize);
196
+ this.resourceTimeOffAdditional = new chunkI75N5VVE_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
197
+ this.resourceTimeOffBalances = new chunkI75N5VVE_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
198
+ this.resources = new chunkI75N5VVE_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
199
+ this.serviceCalls = new chunkI75N5VVE_cjs.ServiceCallsResource(this.http, this.config.pageSize);
200
+ this.ticketCharges = new chunkI75N5VVE_cjs.TicketChargesResource(this.http, this.config.pageSize);
201
+ this.tickets = new chunkI75N5VVE_cjs.TicketsResource(this.http, this.config.pageSize);
202
+ this.timeEntries = new chunkNRO2NJAZ_cjs.TimeEntriesResource(this.http, this.config.pageSize);
203
+ this.timeOffRequests = new chunkI75N5VVE_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
204
+ this.authenticateResource = new chunkI75N5VVE_cjs.AuthenticateResource(this.http);
205
+ this.entityInformation = new chunkI75N5VVE_cjs.EntityInformationResource(this.http);
206
+ this.modules = new chunkI75N5VVE_cjs.ModulesResource(this.http);
207
+ this.thresholdInformation = new chunkI75N5VVE_cjs.ThresholdInformationResource(this.http);
208
+ this.version = new chunkI75N5VVE_cjs.VersionResource(this.http);
209
+ this.versionInformation = new chunkI75N5VVE_cjs.VersionInformationResource(this.http);
210
+ this.zoneInformation = new chunkI75N5VVE_cjs.ZoneInformationResource(this.http);
209
211
  }
210
212
  /**
211
213
  * `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
@@ -239,10 +241,10 @@ var AutotaskClient = class {
239
241
  * parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
240
242
  */
241
243
  withSignal(signal, fn) {
242
- return chunkLYAHXYZR_cjs.runWithSignal(signal, fn);
244
+ return chunkNRO2NJAZ_cjs.runWithSignal(signal, fn);
243
245
  }
244
246
  async batch(fn, items, opts = {}) {
245
- return chunkLYAHXYZR_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
247
+ return chunkNRO2NJAZ_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
246
248
  }
247
249
  };
248
250
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  // src/capabilities.ts
4
4
  var CAPABILITY_PLAN_HASHES = {
5
- "B": "21e75d0f8bf9986b21c6b7996dfb1fec78b3aaa9afa86f50f5351c54c733d4ac",
6
- "A": "21e75d0f8bf9986b21c6b7996dfb1fec78b3aaa9afa86f50f5351c54c733d4ac",
7
- "operations": "21e75d0f8bf9986b21c6b7996dfb1fec78b3aaa9afa86f50f5351c54c733d4ac"
5
+ "B": "51888554f455b96e13c50591342fa516b095065762430b783201ac7a995a0901",
6
+ "A": "51888554f455b96e13c50591342fa516b095065762430b783201ac7a995a0901",
7
+ "operations": "51888554f455b96e13c50591342fa516b095065762430b783201ac7a995a0901"
8
8
  };
9
9
  var cached = null;
10
10
  function loadCapabilities() {