node-autotask 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MCP_TOOL_CATALOG.json +27 -9
- package/MCP_TOOL_MANIFEST.md +13 -12
- package/N8N_MCP_MANIFEST.json +3 -3
- package/N8N_MCP_MANIFEST.md +4 -4
- package/README.md +1 -1
- package/capabilities.json +1460 -1250
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-NVJ2PTN3.js → chunk-3WIDDEHP.js} +2 -2
- package/dist/{chunk-6KFP5HV3.js → chunk-4A6XLQHE.js} +1459 -1249
- package/dist/{chunk-WTVLHMZA.cjs → chunk-5N6DYKXO.cjs} +519 -39
- package/dist/{chunk-HWC2WPX2.js → chunk-GD4JRPYF.js} +498 -18
- package/dist/{chunk-WTVD2JZN.cjs → chunk-JKZVCFRY.cjs} +1459 -1249
- package/dist/{chunk-3VB6N44U.js → chunk-MY7ZSXY3.js} +1075 -6
- package/dist/{chunk-QUM74WLQ.cjs → chunk-SRJI5XUZ.cjs} +135 -135
- package/dist/{chunk-S7VMY5KN.cjs → chunk-TELBX6HK.cjs} +1462 -393
- package/dist/{index-DGgMD8aq.d.ts → index-D8I6taEo.d.cts} +200 -2
- package/dist/{index-BOyh7S65.d.cts → index-uAxAcRol.d.ts} +200 -2
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +213 -529
- package/dist/operations/index.d.cts +24 -6
- package/dist/operations/index.d.ts +24 -6
- package/dist/operations/index.js +102 -418
- package/dist/pool.cjs +8 -8
- package/dist/pool.d.cts +2 -2
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/API.md +192 -2
- package/docs/N8N-ADAPTER.md +1 -1
- package/package.json +1 -1
- package/dist/{index-cQ6CRexR.d.cts → index-BXtKN1M5.d.cts} +201 -201
- package/dist/{index-cQ6CRexR.d.ts → index-BXtKN1M5.d.ts} +201 -201
package/dist/operations/index.js
CHANGED
|
@@ -8,10 +8,15 @@ import {
|
|
|
8
8
|
DELETE_BOUNDARY_NOTES,
|
|
9
9
|
DeleteBoundaryError,
|
|
10
10
|
EXPAND_RESOURCE_NAMES_MAX_IDS,
|
|
11
|
+
FETCH_BY_IDS_CHUNK_SIZE,
|
|
12
|
+
FETCH_BY_IDS_MAX_ITEMS,
|
|
13
|
+
FETCH_MANY_MAX_ITEMS,
|
|
11
14
|
FIELD_CACHE_KINDS,
|
|
12
15
|
FIELD_CATALOG_HONESTY_NOTE,
|
|
13
16
|
MARKER_FIELDS,
|
|
14
17
|
MAX_FIELD_CATALOG_WIRE,
|
|
18
|
+
MODEL_DATE_FIELDS,
|
|
19
|
+
MODEL_FIELD_SETS,
|
|
15
20
|
MarkerUnsafeIdError,
|
|
16
21
|
NotFoundError,
|
|
17
22
|
PICKLIST_VALUE_NOT_SERVED_NOTE,
|
|
@@ -21,19 +26,20 @@ import {
|
|
|
21
26
|
RecoveryTruncatedError,
|
|
22
27
|
WORKFLOW_RESOURCES,
|
|
23
28
|
buildFilter,
|
|
24
|
-
buildQueryRequest,
|
|
25
29
|
camelKey,
|
|
26
30
|
clampPageSize,
|
|
27
31
|
expandResourceNames,
|
|
32
|
+
fetchByIds,
|
|
33
|
+
fetchMany,
|
|
28
34
|
fieldCatalog,
|
|
29
35
|
isAutotaskError,
|
|
30
36
|
isRecord,
|
|
31
37
|
parseIdentifier,
|
|
32
|
-
|
|
33
|
-
} from "../chunk-
|
|
38
|
+
validateFetchManyItems
|
|
39
|
+
} from "../chunk-GD4JRPYF.js";
|
|
34
40
|
import {
|
|
35
41
|
CAPABILITIES
|
|
36
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-4A6XLQHE.js";
|
|
37
43
|
|
|
38
44
|
// src/operations/searchAcrossResources.ts
|
|
39
45
|
var DEFAULT_LIMIT = 25;
|
|
@@ -138,298 +144,64 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
138
144
|
return { identifier, results, matches };
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
// src/
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"configuration_item_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
|
|
165
|
-
"configuration_items": ["id", "apiVendorID", "configurationItemCategoryID", "companyID", "companyLocationID", "configurationItemType", "contactID", "contractID", "contractServiceBundleID", "contractServiceID", "createDate", "createdByPersonID", "dailyCost", "dattoAvailableKilobytes", "dattoDeviceMemoryMegabytes", "dattoDrivesErrors", "dattoHostname", "dattoInternalIP", "dattoKernelVersionID", "dattoLastCheckInDateTime", "dattoNICSpeedKilobitsPerSecond", "dattoNumberOfAgents", "dattoNumberOfDrives", "dattoNumberOfVolumes", "dattoOffsiteUsedBytes", "dattoOSVersionID", "dattoPercentageUsed", "dattoProtectedKilobytes", "dattoRemoteIP", "dattoSerialNumber", "dattoUptimeSeconds", "dattoUsedKilobytes", "dattoZFSVersionID", "deviceNetworkingID", "domain", "domainRegistrarID", "domainRegistrationDateTime", "domainLastUpdatedDateTime", "domainExpirationDateTime", "hourlyCost", "impersonatorCreatorResourceID", "installDate", "installedByContactID", "installedByID", "isActive", "lastActivityPersonID", "lastActivityPersonType", "lastModifiedTime", "location", "monthlyCost", "notes", "numberOfUsers", "parentConfigurationItemID", "perUseCost", "productID", "referenceNumber", "referenceTitle", "rmmDeviceAuditAntivirusStatusID", "rmmDeviceAuditArchitectureID", "rmmDeviceAuditBackupStatusID", "rmmDeviceAuditDescription", "rmmDeviceAuditDeviceTypeID", "rmmDeviceAuditDisplayAdaptorID", "rmmDeviceAuditDomainID", "rmmDeviceAuditExternalIPAddress", "rmmDeviceAuditHostname", "rmmDeviceAuditIPAddress", "rmmDeviceAuditLastUser", "rmmDeviceAuditMacAddress", "rmmDeviceAuditManufacturerID", "rmmDeviceAuditFirmwareID", "rmmDeviceAuditMemoryBytes", "rmmDeviceAuditMissingPatchCount", "rmmDeviceAuditMobileNetworkOperatorID", "rmmDeviceAuditMobileNumber", "rmmDeviceAuditModelID", "rmmDeviceAuditMotherboardID", "rmmDeviceAuditOperatingSystem", "rmmDeviceAuditPatchStatusID", "rmmDeviceAuditProcessorID", "rmmDeviceAuditServicePackID", "rmmDeviceAuditSNMPContact", "rmmDeviceAuditSNMPLocation", "rmmDeviceAuditSNMPName", "rmmDeviceAuditSoftwareStatusID", "rmmDeviceAuditStorageBytes", "rmmDeviceID", "rmmDeviceUID", "rmmVsaxDeviceID", "rmmOpenAlertCount", "serialNumber", "serviceBundleID", "serviceID", "serviceLevelAgreementID", "setupFee", "sourceChargeID", "sourceChargeType", "sslSource", "sslCommonName", "sslValidFromDateTime", "sslValidUntilDateTime", "sslIssuedBy", "sslOrganization", "sslOrganizationUnit", "sslLocation", "sslSerialNumber", "sslSignatureAlgorithm", "vendorID", "warrantyExpirationDate", "rmmIsInMaintenanceMode", "rmmIsMobileDeviceManagementEnrolled", "rmmDeviceUrl", "userDefinedFields"],
|
|
166
|
-
"contact_group_contacts": ["id", "contactId", "contactGroupId", "soapParentPropertyId"],
|
|
167
|
-
"contact_groups": ["id", "name", "isActive"],
|
|
168
|
-
"contact_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
|
|
169
|
-
"contacts": ["id", "additionalAddressInformation", "addressLine", "addressLine1", "alternatePhone", "apiVendorID", "bulkEmailOptOutTime", "city", "companyID", "companyLocationID", "countryID", "createDate", "emailAddress", "emailAddress2", "emailAddress3", "extension", "externalID", "facebookUrl", "faxNumber", "firstName", "impersonatorCreatorResourceID", "isActive", "isOptedOutFromBulkEmail", "lastActivityDate", "lastModifiedDate", "lastName", "linkedInUrl", "middleInitial", "mobilePhone", "namePrefix", "nameSuffix", "note", "receivesEmailNotifications", "phone", "primaryContact", "roomNumber", "solicitationOptOut", "solicitationOptOutTime", "state", "surveyOptOut", "title", "twitterUrl", "zipCode", "soapParentPropertyId", "userDefinedFields"],
|
|
170
|
-
"contract_billing_rules": ["id", "contractID", "createChargesAsBillable", "dailyProratedCost", "dailyProratedPrice", "determineUnits", "endDate", "executionMethod", "includeItemsInChargeDescription", "invoiceDescription", "isActive", "isDailyProrationEnabled", "maximumUnits", "minimumUnits", "productID", "startDate", "soapParentPropertyId"],
|
|
171
|
-
"contract_block_hour_factors": ["id", "blockHourMultiplier", "contractHourlyRate", "contractID", "internalCurrencyContractHourlyRate", "roleID", "soapParentPropertyId"],
|
|
172
|
-
"contract_blocks": ["id", "contractID", "datePurchased", "endDate", "hourlyRate", "hours", "hoursApproved", "invoiceNumber", "isPaid", "paymentNumber", "paymentType", "startDate", "status", "soapParentPropertyId"],
|
|
173
|
-
"contract_charges": ["id", "billableAmount", "billingCodeID", "chargeType", "contractID", "contractServiceBundleID", "contractServiceID", "createDate", "creatorResourceID", "datePurchased", "description", "extendedCost", "internalCurrencyBillableAmount", "internalCurrencyUnitPrice", "internalPurchaseOrderNumber", "isBillableToCompany", "isBilled", "name", "notes", "organizationalLevelAssociationID", "productID", "purchaseOrderNumber", "status", "statusLastModifiedBy", "statusLastModifiedDate", "unitCost", "unitPrice", "unitQuantity", "soapParentPropertyId"],
|
|
174
|
-
"contract_exclusion_billing_codes": ["id", "billingCodeID", "contractID", "soapParentPropertyId"],
|
|
175
|
-
"contract_exclusion_roles": ["id", "contractID", "roleID", "soapParentPropertyId"],
|
|
176
|
-
"contract_exclusion_set_excluded_roles": ["id", "contractExclusionSetID", "excludedRoleID", "soapParentPropertyId"],
|
|
177
|
-
"contract_exclusion_set_excluded_work_types": ["id", "contractExclusionSetID", "excludedWorkTypeID", "soapParentPropertyId"],
|
|
178
|
-
"contract_exclusion_sets": ["id", "description", "isActive", "name"],
|
|
179
|
-
"contract_milestones": ["id", "amount", "billingCodeID", "contractID", "createDate", "creatorResourceID", "dateDue", "description", "internalCurrencyAmount", "isInitialPayment", "organizationalLevelAssociationID", "status", "title", "soapParentPropertyId"],
|
|
180
|
-
"contract_notes": ["id", "contractID", "createDateTime", "creatorResourceID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "title", "soapParentPropertyId"],
|
|
181
|
-
"contract_rates": ["id", "contractHourlyRate", "contractID", "internalCurrencyContractHourlyRate", "roleID", "soapParentPropertyId"],
|
|
182
|
-
"contract_retainers": ["id", "amount", "amountApproved", "contractID", "datePurchased", "endDate", "internalCurrencyAmount", "internalCurrencyAmountApproved", "invoiceNumber", "isPaid", "paymentID", "paymentNumber", "startDate", "status", "soapParentPropertyId"],
|
|
183
|
-
"contract_role_costs": ["id", "contractID", "rate", "resourceID", "roleID", "soapParentPropertyId"],
|
|
184
|
-
"contract_service_bundle_units": ["id", "approveAndPostDate", "contractID", "contractServiceBundleID", "cost", "endDate", "internalCurrencyPrice", "organizationalLevelAssociationID", "price", "serviceBundleID", "startDate", "units", "soapParentPropertyId"],
|
|
185
|
-
"contract_service_bundles": ["id", "adjustedPrice", "contractID", "internalCurrencyAdjustedPrice", "internalCurrencyUnitPrice", "internalDescription", "invoiceDescription", "quoteItemID", "serviceBundleID", "unitPrice", "soapParentPropertyId"],
|
|
186
|
-
"contract_service_units": ["id", "approveAndPostDate", "contractID", "contractServiceID", "cost", "endDate", "internalCurrencyPrice", "organizationalLevelAssociationID", "price", "serviceID", "startDate", "units", "vendorCompanyID", "soapParentPropertyId"],
|
|
187
|
-
"contract_services": ["id", "contractID", "internalCurrencyAdjustedPrice", "internalCurrencyUnitPrice", "internalDescription", "invoiceDescription", "quoteItemID", "serviceID", "unitCost", "unitPrice", "soapParentPropertyId"],
|
|
188
|
-
"contract_ticket_purchases": ["id", "contractID", "datePurchased", "endDate", "invoiceNumber", "isPaid", "paymentNumber", "paymentType", "perTicketRate", "startDate", "status", "ticketsPurchased", "ticketsUsed", "soapParentPropertyId"],
|
|
189
|
-
"contracts": ["id", "billingPreference", "billToCompanyContactID", "billToCompanyID", "companyID", "contactID", "contactName", "contractCategory", "contractExclusionSetID", "contractName", "contractNumber", "contractPeriodType", "contractType", "description", "endDate", "estimatedCost", "estimatedHours", "estimatedRevenue", "exclusionContractID", "internalCurrencyOverageBillingRate", "internalCurrencySetupFee", "isCompliant", "isDefaultContract", "lastModifiedDateTime", "opportunityID", "organizationalLevelAssociationID", "overageBillingRate", "purchaseOrderNumber", "renewedContractID", "serviceLevelAgreementID", "setupFee", "setupFeeBillingCodeID", "startDate", "status", "timeReportingRequiresStartAndStopTimes", "userDefinedFields"],
|
|
190
|
-
"countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
|
|
191
|
-
"departments": ["id", "description", "name", "number", "primaryLocationID"],
|
|
192
|
-
"domain_registrars": ["id", "name", "url"],
|
|
193
|
-
"expense_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
194
|
-
"expense_items": ["id", "companyID", "description", "destination", "entertainmentLocation", "expenseCategory", "expenseCurrencyExpenseAmount", "expenseCurrencyID", "expenseDate", "expenseReportID", "glCode", "haveReceipt", "internalCurrencyExpenseAmount", "internalCurrencyReimbursementAmount", "isBillableToCompany", "isReimbursable", "isRejected", "miles", "odometerEnd", "odometerStart", "origin", "paymentType", "projectID", "purchaseOrderNumber", "reimbursementCurrencyReimbursementAmount", "taskID", "ticketID", "workType", "soapParentPropertyId"],
|
|
195
|
-
"expense_reports": ["id", "amountDue", "approvedDate", "approverID", "departmentNumber", "internalCurrencyCashAdvanceAmount", "internalCurrencyExpenseTotal", "name", "organizationalLevelAssociationID", "quickBooksReferenceNumber", "reimbursementCurrencyAmountDue", "reimbursementCurrencyCashAdvanceAmount", "reimbursementCurrencyID", "rejectionReason", "status", "submit", "submitDate", "submitterID", "weekEnding"],
|
|
196
|
-
"holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
|
|
197
|
-
"holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
|
|
198
|
-
"inventory_products": ["id", "availableUnits", "backOrderQuantity", "bin", "createDateTime", "createdByResourceID", "inventoryLocationID", "onHandUnits", "pickedUnits", "productID", "quantityMaximum", "quantityMinimum", "referenceNumber", "reservedUnits", "unitsOnOrder"],
|
|
199
|
-
"invoices": ["id", "batchID", "comments", "companyID", "createDateTime", "creatorResourceID", "dueDate", "fromDate", "invoiceDateTime", "invoiceEditorTemplateID", "invoiceNumber", "invoiceTotal", "isVoided", "orderNumber", "paidDate", "paymentTerm", "taxGroup", "taxRegionName", "toDate", "totalTaxValue", "voidedByResourceID", "voidedDate", "webServiceDate"],
|
|
200
|
-
"notification_history": ["id", "companyID", "entityNumber", "entityTitle", "initiatingContactID", "initiatingResourceID", "isActive", "isDeleted", "isTemplateJob", "notificationHistoryTypeID", "notificationSentTime", "opportunityID", "projectID", "quoteID", "recipientDisplayName", "recipientEmailAddress", "taskID", "templateName", "ticketID", "timeEntryID"],
|
|
201
|
-
"opportunities": ["id", "advancedField1", "advancedField2", "advancedField3", "advancedField4", "advancedField5", "amount", "assessmentScore", "barriers", "closedDate", "companyID", "contactID", "cost", "createDate", "creatorResourceID", "description", "helpNeeded", "impersonatorCreatorResourceID", "lastActivity", "leadSource", "lossReason", "lossReasonDetail", "lostDate", "market", "monthlyCost", "monthlyRevenue", "nextStep", "onetimeCost", "onetimeRevenue", "opportunityCategoryID", "organizationalLevelAssociationID", "ownerResourceID", "primaryCompetitor", "probability", "productID", "projectedCloseDate", "promisedFulfillmentDate", "promotionName", "quarterlyCost", "quarterlyRevenue", "rating", "relationshipAssessmentScore", "revenueSpread", "revenueSpreadUnit", "salesOrderID", "salesProcessPercentComplete", "semiannualCost", "semiannualRevenue", "stage", "startDate", "status", "technicalAssessmentScore", "throughDate", "title", "totalAmountMonths", "useQuoteTotals", "winReason", "winReasonDetail", "yearlyCost", "yearlyRevenue", "userDefinedFields"],
|
|
202
|
-
"opportunity_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
203
|
-
"opportunity_categories": ["id", "displayColorRGB", "isActive", "isGlobalDefault", "name", "nickname"],
|
|
204
|
-
"phases": ["id", "createDate", "creatorResourceID", "description", "dueDate", "estimatedHours", "externalID", "isScheduled", "lastActivityDateTime", "parentPhaseID", "phaseNumber", "projectID", "startDate", "title", "soapParentPropertyId"],
|
|
205
|
-
"product_vendors": ["id", "isActive", "isDefault", "productID", "vendorCost", "vendorID", "vendorPartNumber", "soapParentPropertyId"],
|
|
206
|
-
"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"],
|
|
207
|
-
"project_charges": ["id", "billableAmount", "billingCodeID", "chargeType", "contractServiceBundleID", "contractServiceID", "createDate", "creatorResourceID", "datePurchased", "description", "estimatedCost", "extendedCost", "internalCurrencyBillableAmount", "internalCurrencyUnitPrice", "internalPurchaseOrderNumber", "isBillableToCompany", "isBilled", "name", "notes", "organizationalLevelAssociationID", "productID", "projectID", "purchaseOrderNumber", "status", "statusLastModifiedBy", "statusLastModifiedDate", "unitCost", "unitPrice", "unitQuantity", "soapParentPropertyId"],
|
|
208
|
-
"project_notes": ["id", "createDateTime", "createdByContactID", "creatorResourceID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "isAnnouncement", "lastActivityDate", "noteType", "projectID", "publish", "title", "soapParentPropertyId"],
|
|
209
|
-
"projects": ["id", "actualBilledHours", "actualHours", "changeOrdersBudget", "changeOrdersRevenue", "companyID", "companyOwnerResourceID", "completedDateTime", "completedPercentage", "contractID", "createDateTime", "creatorResourceID", "department", "description", "duration", "endDateTime", "estimatedSalesCost", "estimatedTime", "extProjectNumber", "extProjectType", "impersonatorCreatorResourceID", "laborEstimatedCosts", "laborEstimatedMarginPercentage", "laborEstimatedRevenue", "lastActivityDateTime", "lastActivityPersonType", "lastActivityResourceID", "opportunityID", "organizationalLevelAssociationID", "originalEstimatedRevenue", "projectCostEstimatedMarginPercentage", "projectCostsBudget", "projectCostsRevenue", "projectLeadResourceID", "projectName", "projectNumber", "projectType", "purchaseOrderNumber", "sgda", "startDateTime", "status", "statusDateTime", "statusDetail", "userDefinedFields"],
|
|
210
|
-
"purchase_approvals": ["id", "costType", "isApproved", "rejectNote"],
|
|
211
|
-
"purchase_order_item_receiving": ["id", "purchaseOrderItemID", "quantityBackOrdered", "quantityNowReceiving", "quantityPreviouslyReceived", "receiveDate", "receivedByResourceID", "serialNumber", "vendorInvoiceNumber", "soapParentPropertyId"],
|
|
212
|
-
"purchase_order_items": ["id", "chargeID", "contractID", "estimatedArrivalDate", "internalCurrencyUnitCost", "inventoryLocationID", "memo", "orderID", "productID", "projectID", "quantity", "salesOrderID", "ticketID", "unitCost", "soapParentPropertyId"],
|
|
213
|
-
"purchase_orders": ["id", "cancelDateTime", "createDateTime", "creatorResourceID", "externalPONumber", "fax", "freight", "generalMemo", "impersonatorCreatorResourceID", "internalCurrencyFreight", "latestEstimatedArrivalDate", "paymentTerm", "phone", "purchaseForCompanyID", "purchaseOrderNumber", "purchaseOrderTemplateID", "shippingDate", "shippingType", "shipToAddress1", "shipToAddress2", "shipToCity", "shipToName", "shipToPostalCode", "shipToState", "showEachTaxInGroup", "showTaxCategory", "status", "submitDateTime", "taxRegionID", "useItemDescriptionsFrom", "vendorID", "vendorInvoiceNumber", "additionalVendorInvoiceNumbers"],
|
|
214
|
-
"quote_items": ["id", "averageCost", "chargeID", "description", "expenseID", "highestCost", "internalCurrencyLineDiscount", "internalCurrencyUnitDiscount", "internalCurrencyUnitPrice", "isOptional", "isTaxable", "laborID", "lineDiscount", "markupRate", "name", "percentageDiscount", "periodType", "productID", "quantity", "quoteID", "quoteItemType", "serviceBundleID", "serviceID", "shippingID", "sortOrderID", "taxCategoryID", "totalEffectiveTax", "unitCost", "unitDiscount", "unitPrice", "soapParentPropertyId"],
|
|
215
|
-
"quote_locations": ["id", "address1", "address2", "city", "postalCode", "state"],
|
|
216
|
-
"quote_templates": ["id", "calculateTaxSeparately", "createDate", "createdBy", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "description", "displayTaxCategorySuperscripts", "isActive", "lastActivityBy", "lastActivityDate", "name", "numberFormat", "pageLayout", "pageNumberFormat", "showEachTaxInGroup", "showGridHeader", "showTaxCategory", "showVerticalGridLines"],
|
|
217
|
-
"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"],
|
|
218
|
-
"resource_role_queues": ["id", "queueID", "resourceID", "soapParentPropertyId"],
|
|
219
|
-
"resource_roles": ["id", "departmentID", "isActive", "queueID", "resourceID", "roleID", "soapParentPropertyId"],
|
|
220
|
-
"resource_skills": ["id", "resourceID", "skillDescription", "skillID", "skillLevel", "soapParentPropertyId"],
|
|
221
|
-
"resource_time_off_approvers": ["id", "resourceID", "approverResourceID", "approvalLevel", "soapParentPropertyId"],
|
|
222
|
-
"resource_time_off_balances": ["id", "resourceID", "floatingHolidayAnnualAllowance", "floatingHolidayBalance", "floatingHolidayPlanned", "floatingHolidayUsed", "floatingHolidayWaitingApproval", "personalTimeAnnualAllowance", "personalTimeBalance", "personalTimePlanned", "personalTimeUsed", "personalTimeWaitingApproval", "sickTimeAnnualAllowance", "sickTimeBalance", "sickTimePlanned", "sickTimeUsed", "sickTimeWaitingApproval", "vacationTimeAnnualAllowance", "vacationTimeBalance", "vacationTimePlanned", "vacationTimeUsed", "vacationTimeWaitingApproval", "year", "soapParentPropertyId"],
|
|
223
|
-
"resources": ["id", "accountingReferenceID", "dateFormat", "defaultServiceDeskRoleID", "email", "email2", "email3", "emailTypeCode", "emailTypeCode2", "emailTypeCode3", "firstName", "gender", "greeting", "hireDate", "homePhone", "initials", "internalCost", "isActive", "lastName", "licenseType", "locationID", "middleName", "mobilePhone", "numberFormat", "officeExtension", "officePhone", "payrollIdentifier", "payrollType", "resourceType", "suffix", "surveyResourceRating", "timeFormat", "title", "travelAvailabilityPct", "userName", "userType"],
|
|
224
|
-
"roles": ["id", "description", "hourlyFactor", "hourlyRate", "isActive", "isExcludedFromNewContracts", "isSystemRole", "name", "quoteItemDefaultTaxCategoryId", "roleType"],
|
|
225
|
-
"service_call_task_resources": ["id", "resourceID", "serviceCallTaskID", "soapParentPropertyId"],
|
|
226
|
-
"service_call_tasks": ["id", "serviceCallID", "taskID", "soapParentPropertyId"],
|
|
227
|
-
"service_call_ticket_resources": ["id", "resourceID", "serviceCallTicketID", "soapParentPropertyId"],
|
|
228
|
-
"service_call_tickets": ["id", "serviceCallID", "ticketID", "soapParentPropertyId"],
|
|
229
|
-
"service_calls": ["id", "cancelationNoticeHours", "canceledByResourceID", "canceledDateTime", "companyID", "companyLocationID", "createDateTime", "creatorResourceID", "description", "duration", "endDateTime", "impersonatorCreatorResourceID", "isComplete", "lastModifiedDateTime", "startDateTime", "status"],
|
|
230
|
-
"service_level_agreement_results": ["id", "firstResponseElapsedHours", "firstResponseInitiatingResourceID", "firstResponseResourceID", "isFirstResponseMet", "isResolutionMet", "isResolutionPlanMet", "resolutionElapsedHours", "resolutionPlanElapsedHours", "resolutionPlanResourceID", "resolutionResourceID", "serviceLevelAgreementName", "ticketID", "soapParentPropertyId"],
|
|
231
|
-
"services": ["id", "billingCodeID", "createDate", "creatorResourceID", "description", "invoiceDescription", "isActive", "lastModifiedDate", "markupRate", "name", "periodType", "serviceLevelAgreementID", "unitCost", "unitPrice", "updateResourceID", "vendorCompanyID", "manufacturerServiceProvider", "manufacturerServiceProviderProductNumber", "catalogNumberPartNumber", "sku", "internalID", "externalID", "url", "userDefinedFields"],
|
|
232
|
-
"skills": ["id", "categoryID", "description", "isActive", "name"],
|
|
233
|
-
"subscription_periods": ["id", "periodCost", "periodDate", "periodPrice", "postedDate", "purchaseOrderNumber", "subscriptionID", "soapParentPropertyId"],
|
|
234
|
-
"subscriptions": ["id", "configurationItemID", "description", "effectiveDate", "expirationDate", "impersonatorCreatorResourceID", "materialCodeID", "organizationalLevelAssociationID", "periodCost", "periodPrice", "periodType", "purchaseOrderNumber", "status", "subscriptionName", "totalCost", "totalPrice", "vendorID", "userDefinedFields"],
|
|
235
|
-
"survey_results": ["id", "companyID", "companyRating", "completeDate", "contactID", "contactRating", "resourceRating", "sendDate", "surveyID", "surveyRating", "ticketID"],
|
|
236
|
-
"surveys": ["id", "description", "displayName", "name"],
|
|
237
|
-
"tag_aliases": ["id", "alias", "tagID", "soapParentPropertyId"],
|
|
238
|
-
"tag_groups": ["id", "displayColor", "isActive", "isSystem", "label"],
|
|
239
|
-
"tags": ["id", "createDateTime", "isActive", "isExcludedFromAutomaticTagging", "isSystem", "label", "lastModifiedDateTime", "tagGroupID"],
|
|
240
|
-
"task_secondary_resources": ["id", "resourceID", "roleID", "taskID", "soapParentPropertyId"],
|
|
241
|
-
"tasks": ["id", "assignedResourceID", "assignedResourceRoleID", "billingCodeID", "canClientPortalUserCompleteTask", "companyLocationID", "completedByResourceID", "completedByType", "completedDateTime", "createDateTime", "creatorResourceID", "creatorType", "departmentID", "description", "endDateTime", "estimatedHours", "externalID", "hoursToBeScheduled", "isTaskBillable", "isVisibleInClientPortal", "lastActivityDateTime", "lastActivityPersonType", "lastActivityResourceID", "phaseID", "priority", "priorityLabel", "projectID", "purchaseOrderNumber", "remainingHours", "startDateTime", "status", "taskCategoryID", "taskNumber", "taskType", "title", "soapParentPropertyId", "userDefinedFields"],
|
|
242
|
-
"ticket_additional_configuration_items": ["id", "configurationItemID", "ticketID", "soapParentPropertyId"],
|
|
243
|
-
"ticket_additional_contacts": ["id", "contactID", "ticketID", "soapParentPropertyId"],
|
|
244
|
-
"ticket_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentAttachmentID", "parentID", "publish", "ticketID", "ticketNoteID", "timeEntryID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
245
|
-
"ticket_categories": ["id", "displayColorRGB", "isActive", "isApiOnly", "isGlobalDefault", "name", "nickname"],
|
|
246
|
-
"ticket_category_field_defaults": ["id", "description", "estimatedHours", "issueTypeID", "organizationalLevelAssociationID", "priority", "purchaseOrderNumber", "queueID", "resolution", "serviceLevelAgreementID", "sourceID", "status", "subIssueTypeID", "ticketCategoryID", "ticketTypeID", "title", "workTypeID", "soapParentPropertyId"],
|
|
247
|
-
"ticket_change_request_approvals": ["id", "approveRejectDateTime", "approveRejectNote", "contactID", "isApproved", "resourceID", "ticketID", "soapParentPropertyId"],
|
|
248
|
-
"ticket_charges": ["id", "billableAmount", "billingCodeID", "chargeType", "contractServiceBundleID", "contractServiceID", "createDate", "creatorResourceID", "datePurchased", "description", "extendedCost", "internalCurrencyBillableAmount", "internalCurrencyUnitPrice", "internalPurchaseOrderNumber", "isBillableToCompany", "isBilled", "name", "notes", "organizationalLevelAssociationID", "productID", "purchaseOrderNumber", "status", "statusLastModifiedBy", "statusLastModifiedDate", "ticketID", "unitCost", "unitPrice", "unitQuantity", "soapParentPropertyId"],
|
|
249
|
-
"ticket_checklist_items": ["id", "completedByResourceID", "completedDateTime", "isCompleted", "isImportant", "itemName", "knowledgebaseArticleID", "position", "ticketID", "soapParentPropertyId"],
|
|
250
|
-
"ticket_history": ["id", "action", "date", "detail", "resourceID", "ticketID", "soapParentPropertyId"],
|
|
251
|
-
"ticket_note_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "ticketID", "ticketNoteID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
252
|
-
"ticket_note_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
|
|
253
|
-
"ticket_notes": ["id", "createDateTime", "createdByContactID", "creatorResourceID", "description", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "lastActivityDate", "noteType", "publish", "ticketID", "title", "soapParentPropertyId"],
|
|
254
|
-
"ticket_secondary_resources": ["id", "resourceID", "roleID", "ticketID", "soapParentPropertyId"],
|
|
255
|
-
"ticket_webhooks": ["id", "deactivationUrl", "isActive", "isReady", "isSubscribedToCreateEvents", "isSubscribedToDeleteEvents", "isSubscribedToUpdateEvents", "name", "notificationEmailAddress", "ownerResourceID", "secretKey", "sendThresholdExceededNotification", "webhookGUID", "webhookUrl"],
|
|
256
|
-
"tickets": ["id", "apiVendorID", "assignedResourceID", "assignedResourceRoleID", "billingCodeID", "changeApprovalBoard", "changeApprovalStatus", "changeApprovalType", "changeInfoField1", "changeInfoField2", "changeInfoField3", "changeInfoField4", "changeInfoField5", "companyID", "companyLocationID", "completedByResourceID", "completedDate", "configurationItemID", "contactID", "contractID", "contractServiceBundleID", "contractServiceID", "createDate", "createdByContactID", "creatorResourceID", "creatorType", "currentServiceThermometerRating", "description", "dueDateTime", "estimatedHours", "externalID", "firstResponseAssignedResourceID", "firstResponseDateTime", "firstResponseDueDateTime", "firstResponseInitiatingResourceID", "hoursToBeScheduled", "impersonatorCreatorResourceID", "isAssignedToComanaged", "issueType", "isVisibleToComanaged", "lastActivityDate", "lastActivityPersonType", "lastActivityResourceID", "lastCustomerNotificationDateTime", "lastCustomerVisibleActivityDateTime", "lastTrackedModificationDateTime", "monitorID", "monitorTypeID", "opportunityID", "organizationalLevelAssociationID", "previousServiceThermometerRating", "priority", "problemTicketId", "projectID", "purchaseOrderNumber", "queueID", "resolution", "resolutionPlanDateTime", "resolutionPlanDueDateTime", "resolvedDateTime", "resolvedDueDateTime", "rmaStatus", "rmaType", "rmmAlertID", "serviceLevelAgreementHasBeenMet", "serviceLevelAgreementID", "serviceLevelAgreementPausedNextEventHours", "serviceThermometerTemperature", "source", "status", "subIssueType", "ticketCategory", "ticketNumber", "ticketType", "title", "userDefinedFields"],
|
|
257
|
-
"time_entries": ["id", "billingApprovalDateTime", "billingApprovalLevelMostRecent", "billingApprovalResourceID", "billingCodeID", "contractID", "contractServiceBundleID", "contractServiceID", "createDateTime", "creatorUserID", "dateWorked", "endDateTime", "hoursToBill", "hoursWorked", "impersonatorCreatorResourceID", "impersonatorUpdaterResourceID", "internalBillingCodeID", "internalNotes", "isInternalNotesVisibleToComanaged", "isNonBillable", "lastModifiedDateTime", "lastModifiedUserID", "offsetHours", "resourceID", "roleID", "showOnInvoice", "startDateTime", "summaryNotes", "taskID", "ticketID", "timeEntryType"],
|
|
258
|
-
"time_entry_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "taskID", "ticketID", "timeEntryID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
259
|
-
"time_off_requests": ["id", "approvedDateTime", "approveRejectResourceID", "createdByResourceID", "createDateTime", "endTime", "hours", "impersonatorApproveRejectResourceID", "lastModifiedByResourceID", "lastModifiedDateTime", "lastApprovedLevel", "reason", "rejectReason", "requestDate", "resourceID", "startTime", "status", "timeOffRequestType", "soapParentPropertyId"]
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// src/operations/fetchMany.ts
|
|
263
|
-
var FETCH_MANY_MAX_ITEMS = 20;
|
|
264
|
-
function validateFetchManyItems(items, cap, opName = "fetchMany", capRef = `FETCH_MANY_MAX_ITEMS = ${FETCH_MANY_MAX_ITEMS}`, validation) {
|
|
265
|
-
if (!Array.isArray(items)) {
|
|
266
|
-
throw new AutotaskConfigError(
|
|
267
|
-
`${opName}: items must be the items ARRAY \u2014 one positional arg, [{ resource: string, id: number, fields?: string[] }] (got ${Array.isArray(items) ? "an array" : typeof items})`,
|
|
268
|
-
{
|
|
269
|
-
suggestedAction: 'Pass args = [[{ resource: "tickets", id: 123 }, { resource: "projects", id: 456 }]] \u2014 the items array is the single positional argument.'
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
if (items.length === 0) {
|
|
274
|
-
throw new AutotaskConfigError(`${opName}: items must not be empty (a zero-item batch is a shape error, not a no-op)`, {
|
|
275
|
-
suggestedAction: "Pass at least one { resource, id } item \u2014 or use the resource's query op for a filtered read."
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
if (items.length > cap) {
|
|
279
|
-
throw new AutotaskConfigError(
|
|
280
|
-
`${opName}: ${items.length} items over the ${cap}-item cap (${capRef}) \u2014 zero items were fetched (pre-request)`,
|
|
281
|
-
{
|
|
282
|
-
suggestedAction: `Split the batch into groups of <= ${cap} items \u2014 or, for more than ${cap} records / a filtered set, use the resource's bounded query op (<resource>.query).`
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
const problems = [];
|
|
287
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
288
|
-
const it = items[i];
|
|
289
|
-
const at = `items[${i}]`;
|
|
290
|
-
if (typeof it !== "object" || it === null || Array.isArray(it)) {
|
|
291
|
-
problems.push(`${at}: must be an object { resource: string, id: number, fields?: string[] }`);
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
const item = it;
|
|
295
|
-
if (typeof item.resource !== "string" || item.resource.trim() === "") {
|
|
296
|
-
problems.push(`${at}.resource: required \u2014 the plan resource key (string, e.g. 'tickets'; see autotask_catalog)`);
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
const resourceKey = item.resource;
|
|
300
|
-
const fields = MODEL_FIELD_SETS[resourceKey];
|
|
301
|
-
if (fields === void 0) {
|
|
302
|
-
problems.push(
|
|
303
|
-
`${at}.resource: "${resourceKey}" is not a single-record GETtable resource (${Object.keys(MODEL_FIELD_SETS).length} known) \u2014 see autotask_catalog for the exact plan keys`
|
|
304
|
-
);
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
const rel = RELATIONSHIP_MAP[resourceKey];
|
|
308
|
-
if (rel !== void 0 && rel.parentScoped) {
|
|
309
|
-
problems.push(
|
|
310
|
-
`${at}.resource: "${resourceKey}" is a parent-scoped child \u2014 its get needs (parentId, id); fetchMany takes single numeric ids of TOP-LEVEL records (scoped reads: client.${camelKey(resourceKey)}.get(parentId, id))`
|
|
311
|
-
);
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
try {
|
|
315
|
-
parseIdentifier(item.id, `${at}.id`);
|
|
316
|
-
} catch {
|
|
317
|
-
if (typeof item.id === "string") {
|
|
318
|
-
problems.push(
|
|
319
|
-
`${at}.id: "${item.id}" is not a vendor numeric id \u2014 non-numeric string identifiers are autotask_resolve_any territory (resolveAny / the resource's findBy* helpers)`
|
|
320
|
-
);
|
|
321
|
-
} else if (typeof item.id === "number") {
|
|
322
|
-
problems.push(
|
|
323
|
-
`${at}.id: ${item.id} is not a non-negative safe integer (a JS number this large is already corrupted \u2014 pass the canonical integer string form)`
|
|
324
|
-
);
|
|
325
|
-
} else {
|
|
326
|
-
problems.push(`${at}.id: required \u2014 the vendor numeric id (safe integer, or the canonical integer string for ids above 2^53)`);
|
|
327
|
-
}
|
|
328
|
-
continue;
|
|
329
|
-
}
|
|
330
|
-
if (item.fields !== void 0) {
|
|
331
|
-
if (!Array.isArray(item.fields) || item.fields.some((f) => typeof f !== "string")) {
|
|
332
|
-
problems.push(`${at}.fields: must be an array of exact vendor field names (discover them via operations.fieldCatalog)`);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
if (validation?.fieldCheck !== false) {
|
|
336
|
-
const authoritative = validation?.fieldSetsByResource?.get(resourceKey) ?? fields;
|
|
337
|
-
for (const f of item.fields) {
|
|
338
|
-
if (!authoritative.includes(f)) {
|
|
339
|
-
problems.push(
|
|
340
|
-
`${at}.fields: "${f}" is not a field of ${resourceKey} \u2014 a hallucinated field is a shape error, not a silent projection-miss (exact vendor field names via operations.fieldCatalog)`
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (problems.length > 0) {
|
|
348
|
-
throw new AutotaskConfigError(
|
|
349
|
-
`${opName}: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
350
|
-
- ` + problems.join("\n- "),
|
|
351
|
-
{ suggestedAction: "Fix every item above and call again \u2014 validation covers the whole batch up-front (one round, zero wire)." }
|
|
352
|
-
);
|
|
147
|
+
// src/operations/aggregate.ts
|
|
148
|
+
var AGGREGATE_TOP_MAX = 100;
|
|
149
|
+
var AGGREGATE_DEFAULT_TOP = 25;
|
|
150
|
+
var AGGREGATE_DEFAULT_LIMIT = BOUNDED_QUERY_MAX_LIMIT;
|
|
151
|
+
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
152
|
+
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
153
|
+
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
154
|
+
function parseDateInstant(v) {
|
|
155
|
+
if (typeof v !== "string") return null;
|
|
156
|
+
let m = v.match(DATE_ONLY_RE);
|
|
157
|
+
if (m) {
|
|
158
|
+
return validUtc(Number(m[1]), Number(m[2]), Number(m[3])) ?? null;
|
|
159
|
+
}
|
|
160
|
+
m = v.match(DATETIME_RE);
|
|
161
|
+
if (m) {
|
|
162
|
+
const t = validUtc(Number(m[1]), Number(m[2]), Number(m[3]), Number(m[4]), Number(m[5]), Number(m[6]));
|
|
163
|
+
if (t === null) return null;
|
|
164
|
+
const zone = m[8];
|
|
165
|
+
if (zone === void 0 || zone === "Z") return t;
|
|
166
|
+
const sign = zone[0] === "-" ? -1 : 1;
|
|
167
|
+
const hh = Number(zone.slice(1, 3));
|
|
168
|
+
const mm = Number(zone.slice(zone.length - 2));
|
|
169
|
+
return t - sign * (hh * 60 + mm) * 6e4;
|
|
353
170
|
}
|
|
171
|
+
return null;
|
|
354
172
|
}
|
|
355
|
-
function
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
173
|
+
function validUtc(y, mo, d, h = 0, mi = 0, s = 0) {
|
|
174
|
+
const dt = new Date(Date.UTC(y, mo - 1, d, h, mi, s));
|
|
175
|
+
if (y >= 0 && y < 100) dt.setUTCFullYear(y);
|
|
176
|
+
if (dt.getUTCFullYear() !== y || dt.getUTCMonth() !== mo - 1 || dt.getUTCDate() !== d || dt.getUTCHours() !== h || dt.getUTCMinutes() !== mi || dt.getUTCSeconds() !== s) {
|
|
177
|
+
return null;
|
|
359
178
|
}
|
|
360
|
-
return
|
|
179
|
+
return dt.getTime();
|
|
361
180
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
try {
|
|
385
|
-
const rows = await holder.getFieldInfo();
|
|
386
|
-
const names = [];
|
|
387
|
-
for (const row of rows) {
|
|
388
|
-
if (typeof row.name === "string") names.push(row.name);
|
|
389
|
-
}
|
|
390
|
-
liveFieldSets.set(key, names.length > 0 ? names : null);
|
|
391
|
-
} catch (err) {
|
|
392
|
-
if (!isAutotaskError(err) || err.code === "ABORTED") throw err;
|
|
393
|
-
liveFieldSets.set(key, null);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
validateFetchManyItems(items, cap, void 0, void 0, { fieldSetsByResource: liveFieldSets });
|
|
397
|
-
} else {
|
|
398
|
-
validateFetchManyItems(items, cap);
|
|
399
|
-
}
|
|
400
|
-
const results = [];
|
|
401
|
-
for (const item of items) {
|
|
402
|
-
const key = item.resource;
|
|
403
|
-
const id = parseIdentifier(item.id, `items[${results.length}].id`);
|
|
404
|
-
const holder = client[camelKey(key)];
|
|
405
|
-
if (holder === void 0) {
|
|
406
|
-
throw new AutotaskConfigError(`fetchMany: the client exposes no accessor for resource "${key}"`, {
|
|
407
|
-
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
try {
|
|
411
|
-
const value = await holder.get(id);
|
|
412
|
-
results.push({ resource: key, id, found: true, value: item.fields !== void 0 ? project(value, item.fields) : value });
|
|
413
|
-
} catch (err) {
|
|
414
|
-
if (err instanceof NotFoundError) {
|
|
415
|
-
results.push({ resource: key, id, found: false, value: null, error: { code: "NOT_FOUND", message: err.message } });
|
|
416
|
-
} else if (isAutotaskError(err) && err.code !== "ABORTED") {
|
|
417
|
-
const e = { code: err.code, message: err.message };
|
|
418
|
-
if (err.httpStatus !== void 0) e.httpStatus = err.httpStatus;
|
|
419
|
-
results.push({ resource: key, id, found: false, value: null, error: e });
|
|
420
|
-
} else {
|
|
421
|
-
throw err;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
181
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
182
|
+
function isoWeekLabel(ms) {
|
|
183
|
+
const d = new Date(ms);
|
|
184
|
+
const dow = d.getUTCDay() || 7;
|
|
185
|
+
const S = d.getUTCFullYear() < 200 ? 100 : 0;
|
|
186
|
+
const thu = new Date(Date.UTC(d.getUTCFullYear() + S, d.getUTCMonth(), d.getUTCDate() + (4 - dow)));
|
|
187
|
+
const isoYear = thu.getUTCFullYear() - S;
|
|
188
|
+
const week = Math.ceil(((thu.getTime() - Date.UTC(thu.getUTCFullYear(), 0, 1)) / 864e5 + 1) / 7);
|
|
189
|
+
return `${isoYear}-W${pad2(week)}`;
|
|
190
|
+
}
|
|
191
|
+
function dateBucketLabel(value, bucket) {
|
|
192
|
+
if (value === null || value === void 0) return null;
|
|
193
|
+
const t = parseDateInstant(value);
|
|
194
|
+
if (t === null) return value;
|
|
195
|
+
const d = new Date(t);
|
|
196
|
+
switch (bucket) {
|
|
197
|
+
case "month":
|
|
198
|
+
return `${d.getUTCFullYear()}-${pad2(d.getUTCMonth() + 1)}`;
|
|
199
|
+
case "year":
|
|
200
|
+
return `${d.getUTCFullYear()}`;
|
|
201
|
+
case "week":
|
|
202
|
+
return isoWeekLabel(t);
|
|
424
203
|
}
|
|
425
|
-
const ok = results.filter((r) => r.found).length;
|
|
426
|
-
return { results, ok, failed: results.length - ok };
|
|
427
204
|
}
|
|
428
|
-
|
|
429
|
-
// src/operations/aggregate.ts
|
|
430
|
-
var AGGREGATE_TOP_MAX = 100;
|
|
431
|
-
var AGGREGATE_DEFAULT_TOP = 25;
|
|
432
|
-
var AGGREGATE_DEFAULT_LIMIT = BOUNDED_QUERY_MAX_LIMIT;
|
|
433
205
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
434
206
|
const s = /* @__PURE__ */ new Set();
|
|
435
207
|
for (const rec of CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
@@ -485,6 +257,7 @@ function validateAggregate(operation, filter, opts) {
|
|
|
485
257
|
}
|
|
486
258
|
}
|
|
487
259
|
const fieldSets = resourceKey !== void 0 ? MODEL_FIELD_SETS[resourceKey] : void 0;
|
|
260
|
+
const dateSets = resourceKey !== void 0 ? MODEL_DATE_FIELDS[resourceKey] : void 0;
|
|
488
261
|
const checkFields = (name, fields) => {
|
|
489
262
|
if (fields === void 0) return [];
|
|
490
263
|
if (!Array.isArray(fields) || fields.length === 0 || fields.some((f) => typeof f !== "string" || f.trim() === "")) {
|
|
@@ -501,7 +274,39 @@ function validateAggregate(operation, filter, opts) {
|
|
|
501
274
|
}
|
|
502
275
|
return out;
|
|
503
276
|
};
|
|
504
|
-
const groupBy =
|
|
277
|
+
const groupBy = [];
|
|
278
|
+
if (opts.groupBy !== void 0) {
|
|
279
|
+
if (!Array.isArray(opts.groupBy) || opts.groupBy.length === 0 || opts.groupBy.some((f) => typeof f !== "string" || f.trim() === "")) {
|
|
280
|
+
problems.push("groupBy must be a non-empty array of exact vendor field names (a date-typed field may carry the closed bucket suffix @month | @week | @year \u2014 discover them via operations.fieldCatalog)");
|
|
281
|
+
} else {
|
|
282
|
+
for (const f of opts.groupBy) {
|
|
283
|
+
const at = f.indexOf("@");
|
|
284
|
+
if (at === -1) {
|
|
285
|
+
if (fieldSets === void 0 || !fieldSets.includes(f)) {
|
|
286
|
+
problems.push(`groupBy: "${f}" is not a field of ${resourceKey} \u2014 a hallucinated field is a shape error, not a silent fold-miss (exact vendor field names via operations.fieldCatalog)`);
|
|
287
|
+
} else {
|
|
288
|
+
groupBy.push({ name: f, base: f });
|
|
289
|
+
}
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const base = f.slice(0, at);
|
|
293
|
+
const suffix = f.slice(at + 1);
|
|
294
|
+
if (!AGGREGATE_DATE_BUCKETS.includes(suffix)) {
|
|
295
|
+
problems.push(`groupBy: "${f}": unknown bucket suffix "${suffix}" \u2014 the closed set is month | week | year (the suffix applies to date-typed fields only)`);
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (fieldSets === void 0 || !fieldSets.includes(base)) {
|
|
299
|
+
problems.push(`groupBy: "${f}": "${base}" is not a field of ${resourceKey} \u2014 a hallucinated field is a shape error, not a silent fold-miss (exact vendor field names via operations.fieldCatalog)`);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (dateSets === void 0 || !dateSets.includes(base)) {
|
|
303
|
+
problems.push(`groupBy: "${f}": "${base}" is not a date field of ${resourceKey} (the @month/@week/@year bucket suffix applies to date-typed fields of the resource's vendored model \u2014 exact vendor field names via operations.fieldCatalog)`);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
groupBy.push({ name: f, base, bucket: suffix });
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
505
310
|
const sum = checkFields("sum", opts.sum);
|
|
506
311
|
let top = AGGREGATE_DEFAULT_TOP;
|
|
507
312
|
if (opts.top !== void 0) {
|
|
@@ -551,9 +356,10 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
551
356
|
for (const item of res.items) {
|
|
552
357
|
const key = {};
|
|
553
358
|
const values = [];
|
|
554
|
-
for (const
|
|
555
|
-
const
|
|
556
|
-
|
|
359
|
+
for (const spec of v.groupBy) {
|
|
360
|
+
const raw = item[spec.base] === void 0 ? null : item[spec.base];
|
|
361
|
+
const value = spec.bucket === void 0 ? raw : dateBucketLabel(raw, spec.bucket);
|
|
362
|
+
key[spec.name] = value;
|
|
557
363
|
values.push(value);
|
|
558
364
|
}
|
|
559
365
|
const keyOrder = JSON.stringify(values);
|
|
@@ -582,130 +388,6 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
582
388
|
return result;
|
|
583
389
|
}
|
|
584
390
|
|
|
585
|
-
// src/operations/fetchByIds.ts
|
|
586
|
-
var FETCH_BY_IDS_MAX_ITEMS = 500;
|
|
587
|
-
var FETCH_BY_IDS_CHUNK_SIZE = 250;
|
|
588
|
-
function project2(value, fields) {
|
|
589
|
-
const out = {};
|
|
590
|
-
for (const f of fields) {
|
|
591
|
-
if (f in value) out[f] = value[f];
|
|
592
|
-
}
|
|
593
|
-
return out;
|
|
594
|
-
}
|
|
595
|
-
function resourcePathOf(key, holder) {
|
|
596
|
-
const path = holder?.resourcePath;
|
|
597
|
-
if (typeof path !== "string" || path === "") {
|
|
598
|
-
throw new AutotaskConfigError(`fetchByIds: the client exposes no ${key} resource path (registry drift)`, {
|
|
599
|
-
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
return path;
|
|
603
|
-
}
|
|
604
|
-
async function fetchByIds(client, items, opts = {}) {
|
|
605
|
-
if (opts.maxItems !== void 0) {
|
|
606
|
-
if (!Number.isInteger(opts.maxItems) || opts.maxItems < 1) {
|
|
607
|
-
throw new AutotaskConfigError(`fetchByIds: maxItems must be an integer >= 1 (got ${String(opts.maxItems)})`);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
const cap = Math.min(FETCH_BY_IDS_MAX_ITEMS, opts.maxItems ?? FETCH_BY_IDS_MAX_ITEMS);
|
|
611
|
-
validateFetchManyItems(items, cap, "fetchByIds", `FETCH_BY_IDS_MAX_ITEMS = ${FETCH_BY_IDS_MAX_ITEMS}`);
|
|
612
|
-
const groups = /* @__PURE__ */ new Map();
|
|
613
|
-
const canonical = [];
|
|
614
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
615
|
-
const item = items[i];
|
|
616
|
-
const id = parseIdentifier(item.id, `items[${i}].id`);
|
|
617
|
-
canonical[i] = id;
|
|
618
|
-
const g = groups.get(item.resource) ?? { indices: [], fields: /* @__PURE__ */ new Set(), anyFields: false };
|
|
619
|
-
g.indices.push(i);
|
|
620
|
-
if (item.fields !== void 0) {
|
|
621
|
-
g.anyFields = true;
|
|
622
|
-
for (const f of item.fields) g.fields.add(f);
|
|
623
|
-
}
|
|
624
|
-
groups.set(item.resource, g);
|
|
625
|
-
}
|
|
626
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
627
|
-
for (const [key, group] of groups) {
|
|
628
|
-
const holder = client[camelKey(key)];
|
|
629
|
-
if (holder === void 0) {
|
|
630
|
-
throw new AutotaskConfigError(`fetchByIds: the client exposes no accessor for resource "${key}"`, {
|
|
631
|
-
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
const resourcePath = resourcePathOf(key, holder);
|
|
635
|
-
const unique = [];
|
|
636
|
-
const seen = /* @__PURE__ */ new Set();
|
|
637
|
-
for (const i of group.indices) {
|
|
638
|
-
const k = String(canonical[i]);
|
|
639
|
-
if (!seen.has(k)) {
|
|
640
|
-
seen.add(k);
|
|
641
|
-
unique.push(canonical[i]);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
const includeFields = group.anyFields && group.indices.every((i) => items[i].fields !== void 0) ? [...group.fields] : void 0;
|
|
645
|
-
const kOf = (id) => `${key}:${String(id)}`;
|
|
646
|
-
for (let c = 0; c < unique.length; c += FETCH_BY_IDS_CHUNK_SIZE) {
|
|
647
|
-
const chunk = unique.slice(c, c + FETCH_BY_IDS_CHUNK_SIZE);
|
|
648
|
-
const chunkKeys = new Set(chunk.map((id) => String(id)));
|
|
649
|
-
try {
|
|
650
|
-
const req = buildQueryRequest(client.http.baseUrl, resourcePath, {
|
|
651
|
-
filter: [{ field: "id", op: "in", value: chunk }],
|
|
652
|
-
maxRecords: FETCH_BY_IDS_CHUNK_SIZE,
|
|
653
|
-
includeFields
|
|
654
|
-
});
|
|
655
|
-
const res = await client.http.request({ ...req, operation: `${key}.fetchByIds` });
|
|
656
|
-
const { items: rows } = unwrapItems(res, `${key}.fetchByIds`);
|
|
657
|
-
for (const row of rows) {
|
|
658
|
-
const k = String(row.id);
|
|
659
|
-
if (!chunkKeys.has(k)) continue;
|
|
660
|
-
const q = kOf(k);
|
|
661
|
-
if (!byKey.has(q)) byKey.set(q, { found: true, value: row });
|
|
662
|
-
}
|
|
663
|
-
} catch (err) {
|
|
664
|
-
if (isAutotaskError(err) && err.code !== "ABORTED") {
|
|
665
|
-
const e = { code: err.code, message: err.message };
|
|
666
|
-
if (err.httpStatus !== void 0) e.httpStatus = err.httpStatus;
|
|
667
|
-
for (const u of chunk) {
|
|
668
|
-
const q = kOf(u);
|
|
669
|
-
if (!byKey.has(q)) byKey.set(q, { found: false, value: null, error: e });
|
|
670
|
-
}
|
|
671
|
-
continue;
|
|
672
|
-
}
|
|
673
|
-
throw err;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
for (const id of unique) {
|
|
677
|
-
const k = kOf(id);
|
|
678
|
-
if (byKey.has(k)) continue;
|
|
679
|
-
try {
|
|
680
|
-
const value = await holder.get(id);
|
|
681
|
-
byKey.set(k, { found: true, value });
|
|
682
|
-
} catch (err) {
|
|
683
|
-
if (err instanceof NotFoundError) {
|
|
684
|
-
byKey.set(k, { found: false, value: null, error: { code: "NOT_FOUND", message: err.message } });
|
|
685
|
-
} else if (isAutotaskError(err) && err.code !== "ABORTED") {
|
|
686
|
-
const e = { code: err.code, message: err.message };
|
|
687
|
-
if (err.httpStatus !== void 0) e.httpStatus = err.httpStatus;
|
|
688
|
-
byKey.set(k, { found: false, value: null, error: e });
|
|
689
|
-
} else {
|
|
690
|
-
throw err;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
const results = [];
|
|
696
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
697
|
-
const item = items[i];
|
|
698
|
-
const id = canonical[i];
|
|
699
|
-
const out = byKey.get(`${item.resource}:${String(id)}`);
|
|
700
|
-
const value = out.found ? item.fields !== void 0 ? project2(out.value, item.fields) : out.value : null;
|
|
701
|
-
results.push(
|
|
702
|
-
out.found ? { resource: item.resource, id, found: true, value } : { resource: item.resource, id, found: false, value: null, error: out.error }
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
const ok = results.filter((r) => r.found).length;
|
|
706
|
-
return { results, ok, failed: results.length - ok };
|
|
707
|
-
}
|
|
708
|
-
|
|
709
391
|
// src/operations/relationshipMap.ts
|
|
710
392
|
async function relationshipMap(client, resourceKey) {
|
|
711
393
|
void client;
|
|
@@ -1537,6 +1219,7 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1537
1219
|
return invokeMode(client, operation, args, { ...opts, mode: "delete" });
|
|
1538
1220
|
}
|
|
1539
1221
|
export {
|
|
1222
|
+
AGGREGATE_DATE_BUCKETS,
|
|
1540
1223
|
AGGREGATE_DEFAULT_LIMIT,
|
|
1541
1224
|
AGGREGATE_DEFAULT_TOP,
|
|
1542
1225
|
AGGREGATE_TOP_MAX,
|
|
@@ -1559,6 +1242,7 @@ export {
|
|
|
1559
1242
|
aggregate,
|
|
1560
1243
|
blindSurfaces,
|
|
1561
1244
|
createGuidance,
|
|
1245
|
+
dateBucketLabel,
|
|
1562
1246
|
expandResourceNames,
|
|
1563
1247
|
fetchByIds,
|
|
1564
1248
|
fetchMany,
|