node-autotask 0.8.3 → 0.10.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.
Files changed (84) hide show
  1. package/ARCHITECTURE.md +13 -10
  2. package/MCP_TOOL_CATALOG.json +733 -251
  3. package/MCP_TOOL_MANIFEST.md +162 -133
  4. package/MCP_TOOL_OVERRIDES.json +2 -2
  5. package/N8N_MCP_MANIFEST.json +88 -25
  6. package/N8N_MCP_MANIFEST.md +26 -24
  7. package/README.md +12 -4
  8. package/capabilities.json +12503 -9316
  9. package/dist/capabilities.cjs +2 -3
  10. package/dist/capabilities.js +1 -2
  11. package/dist/{chunk-4WJCXIY2.js → chunk-3VB6N44U.js} +1141 -2977
  12. package/dist/{chunk-32AKZMY4.js → chunk-6KFP5HV3.js} +12502 -9316
  13. package/dist/chunk-DMMMWO6A.js +0 -0
  14. package/dist/chunk-FLB2X6O5.cjs +1 -0
  15. package/dist/{chunk-GYI4ZQID.js → chunk-HWC2WPX2.js} +4781 -89
  16. package/dist/chunk-IDPB4N2Q.cjs +1 -0
  17. package/dist/{chunk-F6YSQRZV.js → chunk-NVJ2PTN3.js} +7 -7
  18. package/dist/{chunk-5UGSQLLO.cjs → chunk-QUM74WLQ.cjs} +136 -136
  19. package/dist/{chunk-LAKEIYET.cjs → chunk-S7VMY5KN.cjs} +1468 -3304
  20. package/dist/chunk-UPQIUWOS.js +0 -0
  21. package/dist/{chunk-KNTUX3RR.cjs → chunk-WTVD2JZN.cjs} +12502 -9316
  22. package/dist/{chunk-V3XPLTIR.cjs → chunk-WTVLHMZA.cjs} +4784 -92
  23. package/dist/{index-B6JeThrY.d.ts → index-BOyh7S65.d.cts} +870 -79
  24. package/dist/{index-B0I2bGtx.d.cts → index-DGgMD8aq.d.ts} +870 -79
  25. package/dist/{index-DOCRp_83.d.cts → index-cQ6CRexR.d.cts} +158 -90
  26. package/dist/{index-DOCRp_83.d.ts → index-cQ6CRexR.d.ts} +158 -90
  27. package/dist/index.cjs +37 -22
  28. package/dist/index.d.cts +46 -5
  29. package/dist/index.d.ts +46 -5
  30. package/dist/index.js +48 -33
  31. package/dist/operations/index.cjs +480 -359
  32. package/dist/operations/index.d.cts +195 -16
  33. package/dist/operations/index.d.ts +195 -16
  34. package/dist/operations/index.js +370 -249
  35. package/dist/pool.cjs +36 -12
  36. package/dist/pool.d.cts +2 -3
  37. package/dist/pool.d.ts +2 -3
  38. package/dist/pool.js +33 -9
  39. package/dist/resources/index.cjs +5 -6
  40. package/dist/resources/index.d.cts +2 -2
  41. package/dist/resources/index.d.ts +2 -2
  42. package/dist/resources/index.js +4 -5
  43. package/dist/types/index.cjs +1 -2
  44. package/dist/types/index.d.cts +1 -1
  45. package/dist/types/index.d.ts +1 -1
  46. package/dist/types/index.js +1 -2
  47. package/dist/untrusted.cjs +0 -1
  48. package/dist/untrusted.js +0 -1
  49. package/docs/API.md +693 -48
  50. package/docs/N8N-ADAPTER.md +4 -4
  51. package/examples/basic.ts +1 -1
  52. package/package.json +5 -3
  53. package/dist/capabilities.cjs.map +0 -1
  54. package/dist/capabilities.js.map +0 -1
  55. package/dist/chunk-32AKZMY4.js.map +0 -1
  56. package/dist/chunk-4WJCXIY2.js.map +0 -1
  57. package/dist/chunk-5UGSQLLO.cjs.map +0 -1
  58. package/dist/chunk-CXM35TEC.cjs +0 -1
  59. package/dist/chunk-CXM35TEC.cjs.map +0 -1
  60. package/dist/chunk-F6YSQRZV.js.map +0 -1
  61. package/dist/chunk-GIVD2CQ3.js +0 -1
  62. package/dist/chunk-GIVD2CQ3.js.map +0 -1
  63. package/dist/chunk-GYI4ZQID.js.map +0 -1
  64. package/dist/chunk-KNTUX3RR.cjs.map +0 -1
  65. package/dist/chunk-LAKEIYET.cjs.map +0 -1
  66. package/dist/chunk-MHBMSBTA.js +0 -1
  67. package/dist/chunk-MHBMSBTA.js.map +0 -1
  68. package/dist/chunk-NZUFSSIZ.cjs +0 -1
  69. package/dist/chunk-NZUFSSIZ.cjs.map +0 -1
  70. package/dist/chunk-V3XPLTIR.cjs.map +0 -1
  71. package/dist/client-DHmr0Oyx.d.ts +0 -203
  72. package/dist/client-Q6NoqinP.d.cts +0 -203
  73. package/dist/index.cjs.map +0 -1
  74. package/dist/index.js.map +0 -1
  75. package/dist/operations/index.cjs.map +0 -1
  76. package/dist/operations/index.js.map +0 -1
  77. package/dist/pool.cjs.map +0 -1
  78. package/dist/pool.js.map +0 -1
  79. package/dist/resources/index.cjs.map +0 -1
  80. package/dist/resources/index.js.map +0 -1
  81. package/dist/types/index.cjs.map +0 -1
  82. package/dist/types/index.js.map +0 -1
  83. package/dist/untrusted.cjs.map +0 -1
  84. package/dist/untrusted.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auth.ts","../src/query.ts","../src/http.ts","../src/cache-ttl-tables.ts","../src/resources/base.ts","../src/resources/appointments.ts","../src/resources/authenticate.ts","../src/resources/billing_codes.ts","../src/resources/billing_items.ts","../src/resources/change_request_links.ts","../src/resources/checklist_libraries.ts","../src/resources/checklist_library_checklist_items.ts","../src/resources/classification_icons.ts","../src/resources/special/companies.ts","../src/resources/companies.ts","../src/resources/company_alerts.ts","../src/resources/company_locations.ts","../src/resources/company_notes.ts","../src/resources/company_site_configurations.ts","../src/resources/company_webhooks.ts","../src/resources/configuration_item_billing_product_associations.ts","../src/resources/configuration_item_categories.ts","../src/resources/configuration_item_category_udf_associations.ts","../src/resources/configuration_item_dns_records.ts","../src/resources/configuration_item_notes.ts","../src/resources/configuration_item_related_items.ts","../src/resources/special/configuration_items.ts","../src/resources/configuration_items.ts","../src/resources/configuration_item_ssl_subject_alternative_names.ts","../src/resources/configuration_item_types.ts","../src/resources/configuration_item_webhooks.ts","../src/resources/contact_group_contacts.ts","../src/resources/contact_groups.ts","../src/resources/special/contacts.ts","../src/resources/contacts.ts","../src/resources/contact_webhooks.ts","../src/resources/contract_billing_rules.ts","../src/resources/contract_block_hour_factors.ts","../src/resources/contract_blocks.ts","../src/resources/contract_charges.ts","../src/resources/contract_exclusion_billing_codes.ts","../src/resources/contract_exclusion_roles.ts","../src/resources/contract_exclusion_set_excluded_roles.ts","../src/resources/contract_exclusion_set_excluded_work_types.ts","../src/resources/contract_exclusion_sets.ts","../src/resources/contract_milestones.ts","../src/resources/contract_notes.ts","../src/resources/contract_rates.ts","../src/resources/contract_retainers.ts","../src/resources/contract_role_costs.ts","../src/resources/contract_service_adjustments.ts","../src/resources/contract_service_bundle_adjustments.ts","../src/resources/contract_service_bundles.ts","../src/resources/contract_service_bundle_units.ts","../src/resources/contract_services.ts","../src/resources/contract_service_units.ts","../src/resources/contracts.ts","../src/resources/contract_ticket_purchases.ts","../src/resources/countries.ts","../src/resources/departments.ts","../src/resources/domain_registrars.ts","../src/resources/entity_information.ts","../src/resources/expense_item_attachments.ts","../src/resources/expense_items.ts","../src/resources/expense_reports.ts","../src/resources/holiday_sets.ts","../src/resources/holidays.ts","../src/resources/special/inventory_products.ts","../src/resources/inventory_products.ts","../src/resources/special/invoices.ts","../src/resources/invoices.ts","../src/resources/modules.ts","../src/resources/notification_history.ts","../src/resources/opportunities.ts","../src/resources/opportunity_attachments.ts","../src/resources/opportunity_categories.ts","../src/resources/phases.ts","../src/resources/products.ts","../src/resources/product_vendors.ts","../src/resources/project_charges.ts","../src/resources/project_notes.ts","../src/resources/projects.ts","../src/resources/purchase_approvals.ts","../src/resources/purchase_order_item_receiving.ts","../src/resources/purchase_order_items.ts","../src/resources/purchase_orders.ts","../src/resources/quote_items.ts","../src/resources/quote_locations.ts","../src/resources/quotes.ts","../src/resources/quote_templates.ts","../src/resources/resource_role_queues.ts","../src/resources/resource_roles.ts","../src/resources/resource_skills.ts","../src/resources/special/resources.ts","../src/resources/resources.ts","../src/resources/special/resource_time_off_additional.ts","../src/resources/resource_time_off_additional.ts","../src/resources/resource_time_off_approvers.ts","../src/resources/special/resource_time_off_balances.ts","../src/resources/resource_time_off_balances.ts","../src/resources/roles.ts","../src/resources/service_calls.ts","../src/resources/service_call_task_resources.ts","../src/resources/service_call_tasks.ts","../src/resources/service_call_ticket_resources.ts","../src/resources/service_call_tickets.ts","../src/resources/service_level_agreement_results.ts","../src/resources/services.ts","../src/resources/skills.ts","../src/resources/subscription_periods.ts","../src/resources/subscriptions.ts","../src/resources/survey_results.ts","../src/resources/surveys.ts","../src/resources/tag_aliases.ts","../src/resources/tag_groups.ts","../src/resources/tags.ts","../src/resources/task_secondary_resources.ts","../src/resources/tasks.ts","../src/resources/threshold_information.ts","../src/resources/ticket_additional_configuration_items.ts","../src/resources/ticket_additional_contacts.ts","../src/resources/ticket_attachments.ts","../src/resources/ticket_categories.ts","../src/resources/ticket_category_field_defaults.ts","../src/resources/ticket_change_request_approvals.ts","../src/resources/ticket_charges.ts","../src/resources/ticket_checklist_items.ts","../src/resources/ticket_checklist_libraries.ts","../src/resources/ticket_history.ts","../src/resources/ticket_note_attachments.ts","../src/resources/ticket_notes.ts","../src/resources/ticket_note_webhooks.ts","../src/resources/ticket_secondary_resources.ts","../src/resources/special/tickets.ts","../src/resources/tickets.ts","../src/resources/ticket_webhooks.ts","../src/resources/special/time_entries.ts","../src/resources/time_entries.ts","../src/resources/time_entry_attachments.ts","../src/resources/special/time_off_requests.ts","../src/resources/time_off_requests.ts","../src/resources/version_information.ts","../src/resources/version.ts","../src/resources/zone_information.ts"],"sourcesContent":["/**\n * Three-header auth (ARCHITECTURE section 9).\n *\n * Header names use the SWAGGER casing — `ApiIntegrationCode` / `UserName` /\n * `Secret` (the n8n node's `APIIntegrationcode` / `Username` spellings work\n * against the API because HTTP header names are case-insensitive per RFC 7230;\n * the SDK does not emit those spellings). `ImpersonationResourceId` is emitted\n * only when configured non-empty. The SDK produces request headers only — no\n * OAuth flow, no cookie auth, no token exchange; `authenticate()` is a probe.\n */\n\n/** The four auth header names, swagger casing (pinned). */\nexport const AUTH_HEADERS = {\n integrationCode: 'ApiIntegrationCode',\n userName: 'UserName',\n secret: 'Secret',\n impersonation: 'ImpersonationResourceId',\n} as const;\n\n/** Trimmed credentials as stored on the resolved config. */\nexport interface ResolvedAuth {\n apiIntegrationCode: string;\n userName: string;\n secret: string;\n /** When set (non-empty), the `ImpersonationResourceId` header is sent on every request. */\n impersonationResourceId?: string;\n}\n\n/**\n * The auth headers for one request: always the 3-header set;\n * `ImpersonationResourceId` only when configured non-empty.\n */\nexport function buildAuthHeaders(cfg: ResolvedAuth): Record<string, string> {\n const headers: Record<string, string> = {\n [AUTH_HEADERS.integrationCode]: cfg.apiIntegrationCode,\n [AUTH_HEADERS.userName]: cfg.userName,\n [AUTH_HEADERS.secret]: cfg.secret,\n };\n if (cfg.impersonationResourceId !== undefined && cfg.impersonationResourceId.length > 0) {\n headers[AUTH_HEADERS.impersonation] = cfg.impersonationResourceId;\n }\n return headers;\n}\n\n/**\n * Merge auth headers into a caller header map. The SDK OWNS the four auth\n * header names: caller entries for those names are overridden, all other\n * caller headers are preserved. Returns a new object (inputs untouched).\n */\nexport function withAuthHeaders(\n headers: Record<string, string> | undefined,\n cfg: ResolvedAuth,\n): Record<string, string> {\n const merged: Record<string, string> = { ...(headers ?? {}) };\n const auth = buildAuthHeaders(cfg);\n const owned = new Set<string>(Object.keys(auth));\n for (const key of Object.keys(merged)) {\n if (owned.has(key)) delete merged[key];\n }\n return { ...merged, ...auth };\n}\n","/**\n * Filter builder (ARCHITECTURE section 7, G1 api-behavior section 4).\n *\n * 13 leaf operators + `and`/`or` grouping — there is NO `not` grouping\n * operator (negation is `noteq` / `notExist` / `notIn`; G1 pinned).\n * `buildFilter` wraps the caller's conditions; multiple top-level conditions\n * are `and`-wrapped (the node's behaviour). `validateFilter` enforces the\n * vendor caps: <=500 OR-conditions (sum of items across all `or` groups at any\n * depth), <=1 UDF condition per query (`udf: true`), field names <=128 chars,\n * serialised filter <=8000 chars.\n */\nimport { AutotaskConfigError } from './errors.js';\nimport { isRecord } from './utils/index.js';\nimport type { Filter, FilterCondition, FilterOperator } from './types/common.js';\n\n/** The 15 operators (13 leaf + 2 grouping). */\nexport const FILTER_OPERATORS: readonly FilterOperator[] = [\n 'eq', 'noteq', 'gt', 'gte', 'lt', 'lte',\n 'beginsWith', 'endsWith', 'contains',\n 'exist', 'notExist', 'in', 'notIn',\n 'and', 'or',\n];\n\n/** Grouping operators. */\nexport const GROUPING_OPERATORS: readonly FilterOperator[] = ['and', 'or'];\n\n/** Max OR-conditions per query (sum of items across all `or` groups). */\nexport const MAX_OR_CONDITIONS = 500;\n/** Max UDF filter items per query (`udf: true`). */\nexport const MAX_UDF_PER_QUERY = 1;\n/** Max serialised filter length in chars. */\nexport const MAX_QUERY_LENGTH = 8000;\n/** Max GET query URL length in chars (API-side cap; the default POST path is unaffected). */\nexport const MAX_GET_LENGTH = 2048;\n/** Max filter field name length in chars. */\nexport const MAX_FIELD_LENGTH = 128;\n\n/** Type guard for the operator set (exact casing — `EQ` is not an operator). */\nexport function isFilterOperator(op: unknown): op is FilterOperator {\n return typeof op === 'string' && (FILTER_OPERATORS as readonly string[]).includes(op);\n}\n\n/** Validate one condition structurally (operator known, field present, group has items, in/notIn array). */\nfunction validateCondition(cond: FilterCondition, path: string): void {\n if (!isRecord(cond)) {\n throw new AutotaskConfigError(`Filter condition at ${path} must be an object`);\n }\n const op = cond.op;\n if (!isFilterOperator(op)) {\n throw new AutotaskConfigError(\n `Unknown filter operator \"${String(op)}\" at ${path}; expected one of: ${FILTER_OPERATORS.join(', ')}`,\n );\n }\n if (op === 'and' || op === 'or') {\n if (!Array.isArray(cond.items) || cond.items.length === 0) {\n throw new AutotaskConfigError(`Grouping operator \"${op}\" requires a non-empty \"items\" array at ${path}`);\n }\n cond.items.forEach((item, i) => validateCondition(item, `${path}.items[${i}]`));\n return;\n }\n // Leaf operator.\n if (typeof cond.field !== 'string' || cond.field.trim().length === 0) {\n throw new AutotaskConfigError(`Filter condition at ${path} requires a non-empty \"field\"`);\n }\n if (cond.field.length > MAX_FIELD_LENGTH) {\n throw new AutotaskConfigError(\n `Filter field name at ${path} is ${cond.field.length} chars; the cap is ${MAX_FIELD_LENGTH}`,\n );\n }\n if (op === 'in' || op === 'notIn') {\n if (!Array.isArray(cond.value)) {\n throw new AutotaskConfigError(`Operator \"${op}\" requires an array \"value\" at ${path}`);\n }\n }\n if (cond.value !== undefined) {\n const values = Array.isArray(cond.value) ? cond.value : [cond.value];\n for (const value of values) {\n if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {\n throw new AutotaskConfigError(`Filter value at ${path} must be a string, number or boolean`);\n }\n }\n }\n}\n\n/** Sum of items across all `or` groups, at any nesting depth. */\nfunction countOrConditions(conditions: FilterCondition[]): number {\n let n = 0;\n for (const cond of conditions) {\n if (!isRecord(cond)) continue;\n if (cond.op === 'or' && Array.isArray(cond.items)) n += cond.items.length;\n if (Array.isArray(cond.items)) n += countOrConditions(cond.items);\n }\n return n;\n}\n\n/** Count of conditions carrying `udf: true`, at any nesting depth. */\nfunction countUdfConditions(conditions: FilterCondition[]): number {\n let n = 0;\n for (const cond of conditions) {\n if (!isRecord(cond)) continue;\n if (cond.udf === true) n += 1;\n if (Array.isArray(cond.items)) n += countUdfConditions(cond.items);\n }\n return n;\n}\n\n/** `JSON.stringify(filter)` — the wire shape for the GET `search` param root. */\nexport function serializeFilter(filter: Filter): string {\n return JSON.stringify(filter);\n}\n\n/**\n * Enforce the vendor caps on a built filter. Throws `AutotaskConfigError` for\n * a malformed shape, an unknown operator, a structural violation, or a cap\n * (OR-conditions, UDF conditions, field length, serialised length).\n */\nexport function validateFilter(filter: Filter): void {\n if (!isRecord(filter) || !Array.isArray(filter.filter)) {\n throw new AutotaskConfigError('Filter must be the shape { filter: FilterCondition[] }');\n }\n filter.filter.forEach((condition, i) => validateCondition(condition, `filter[${i}]`));\n\n const orCount = countOrConditions(filter.filter);\n if (orCount > MAX_OR_CONDITIONS) {\n throw new AutotaskConfigError(\n `Query has ${orCount} OR-conditions; the vendor cap is ${MAX_OR_CONDITIONS} — split the query`,\n );\n }\n const udfCount = countUdfConditions(filter.filter);\n if (udfCount > MAX_UDF_PER_QUERY) {\n throw new AutotaskConfigError(\n `Query has ${udfCount} UDF conditions (udf: true); the vendor allows at most ${MAX_UDF_PER_QUERY} per query`,\n );\n }\n const length = serializeFilter(filter).length;\n if (length > MAX_QUERY_LENGTH) {\n throw new AutotaskConfigError(\n `Serialised filter is ${length} chars; the vendor cap is ${MAX_QUERY_LENGTH} — narrow the query`,\n );\n }\n}\n\n/**\n * Wrap the caller's conditions into a `Filter`. A single condition (including\n * a single group) is passed through; multiple top-level conditions are\n * `and`-wrapped. Throws `AutotaskConfigError` for any structural or cap\n * violation (same validation as `validateFilter`).\n */\nexport function buildFilter(conditions: FilterCondition | FilterCondition[]): Filter {\n const list = Array.isArray(conditions) ? conditions : [conditions];\n if (list.length === 0) {\n throw new AutotaskConfigError('buildFilter requires at least one condition');\n }\n const root: FilterCondition = list.length === 1 ? list[0]! : { op: 'and', items: list };\n const filter: Filter = { filter: [root] };\n validateFilter(filter);\n return filter;\n}\n","/**\n * HttpClient — fetch transport (ARCHITECTURE section 8).\n *\n * Native global `fetch`, zero runtime dependencies. One transport primitive\n * (`request`) + the pinned envelope unwrap helpers + the query transport\n * (POST-always default; GET opt-in with the 2048-char measurement that THROWS\n * `QueryTooLongError` — the SDK never silently degrades a caller-requested\n * GET).\n *\n * Behaviour: auth headers are the only headers the transport adds\n * automatically (the SDK owns the four auth names); `application/json`\n * whenever a body is set; a whole-call `AbortSignal.timeout` budget bounds\n * the ENTIRE request (connection, all retries, backoff); only idempotent\n * methods (GET/PUT/DELETE) retry on 429/5xx with exponential backoff + jitter\n * (base 200 ms, cap 30 s, honouring `Retry-After`); a FIFO semaphore bounds\n * in-flight requests to `maxConcurrent`. `request` returns the RAW parsed\n * body — envelope unwrapping is an explicit per-call decision (the helpers).\n * Logging is method + path only: never query values, never header values.\n */\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ReadCache } from './cache.js';\nimport type { FieldCache } from './fieldCache.js';\nimport { buildAuthHeaders, withAuthHeaders, type ResolvedAuth } from './auth.js';\nimport {\n buildBreakerKey,\n defaultCircuitBreakerStore,\n isBreakerFailure,\n type CircuitBreakerState,\n type CircuitBreakerStore,\n} from './circuit-breaker.js';\nimport {\n buildTenantKey,\n cooldownDurationMs,\n defaultCooldownStore,\n type CooldownStore,\n} from './cooldown.js';\nimport type { ResolvedAutotaskConfig, ZoneName } from './config.js';\nimport { decideHostPolicy } from './host-policy.js';\nimport {\n AutotaskAbortError,\n AutotaskError,\n AutotaskNetworkError,\n CircuitBreakerError,\n ResponseRejectedError,\n AutotaskTimeoutError,\n QueryTooLongError,\n NotFoundError,\n RateLimitError,\n errorFromStatus,\n EmptyResponseError,\n isDeterministicVendor500,\n parseVendorErrors,\n UnexpectedContentTypeError,\n type CredentialShapeExpectation,\n AutotaskConfigError,\n} from './errors.js';\nimport { CREDENTIAL_ENV_LOAD_ACTION, credentialShapeProblem } from './credential-shape.js';\nimport type { Logger } from './logger.js';\nimport { MAX_GET_LENGTH, buildFilter } from './query.js';\nimport { BLIND_SURFACE_STAMPS, EMPTY_REASON_STAMPS, POINTER_NOTES } from './relationships.js';\nimport { redactResponseBody } from './redact.js';\nimport type { AuditEvent, Identifier, OperationResult, PagingModel, QueryParams, ResolutionCaps } from './types/common.js';\nimport { isRecord, newCorrelationId, redactAuditBody } from './utils/index.js';\n\nexport interface RequestOptions {\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n /** Path after the base URL, already interpolated, e.g. '/V1.0/Companies/42'. */\n path: string;\n /** URLSearchParams-style params; null/undefined/'' values are omitted. */\n query?: Record<string, unknown>;\n /** JSON-encoded (application/json) when present. */\n body?: unknown;\n /** Extra headers (cannot override the SDK-owned auth names). */\n headers?: Record<string, string>;\n /** Registry operation name for error context. */\n operation?: string;\n /** Per-request timeout override (default: config.timeoutMs). */\n timeoutMs?: number;\n /**\n * INTERNAL (SDK-only, never a caller surface): per-request retry-budget\n * override (default: config.maxRetries). Used by the doctor preflight\n * (src/doctor.ts) to report failures fast — retries off, shortened\n * timeout. Does not change the transport chain order.\n */\n maxRetries?: number;\n /**\n * Issue #25: does this call expect a non-empty 2xx body? Default:\n * `method !== 'DELETE'` (computed in `request`) — a blank 2xx on a\n * non-DELETE throws the typed `EMPTY_RESPONSE` (a blank 200 from a proxy\n * or maintenance edge is a transport fault, not \"no data\"); DELETE (and\n * any explicit `expectBody: false`) keeps returning `undefined` (the\n * vendor answers 204 / an empty body on deletes; the delete callers\n * synthesize the result from the path id).\n */\n expectBody?: boolean;\n /** Caller abort signal, combined with the deadline; aborting throws `AutotaskAbortError` (never retried). */\n signal?: AbortSignal;\n /** Safe to retry on 429/5xx even though it is not GET/PUT/DELETE (e.g. the `/query` POST reads). Default: by method. */\n idempotent?: boolean;\n /**\n * INTERNAL (SDK-only, never a caller surface): skip the INV-A1 response\n * redaction for this one response. Used by the V2 partial-update merge\n * read: the record's own current values round-trip back to the SAME\n * vendor endpoint (the PUT response is `{ id }` — the caller never sees\n * them, and the G10b request-body audit keeps request logging redacted).\n * Redacting this read would put literal '[REDACTED]' markers into the\n * merged PUT body (data corruption on live records).\n */\n skipResponseRedaction?: boolean;\n /**\n * INTERNAL (SDK-only, never a caller surface): bypass the tenant 429\n * cooldown gate for this one call. Used by `thresholdInformation.get()`\n * so a throttled tenant can still read its own headroom (a 2xx from the\n * call clears the gate; a 429 re-arms it).\n */\n bypassCooldown?: boolean;\n /**\n * INTERNAL (SDK-only, never a caller surface): bypass the host circuit\n * breaker's REFUSAL for this one call (issue #26 — the #6\n * ThresholdInformation bypass applies). Used by\n * `thresholdInformation.get()` so a downed host can still be probed for\n * headroom. The call's outcome is still RECORDED against the circuit\n * (a 2xx counts toward closing; a counted failure re-arms the open\n * period).\n */\n bypassCircuitBreaker?: boolean;\n}\n\n/** Idempotent methods the transport may retry (POST/PATCH are never retried). */\nexport const IDEMPOTENT_METHODS: readonly string[] = ['GET', 'PUT', 'DELETE'];\n\nconst BACKOFF_BASE_MS = 200;\nconst BACKOFF_CAP_MS = 30_000;\n/** Longest single retry wait; a larger `Retry-After` surfaces the error instead of sleeping. */\nconst MAX_RETRY_DELAY_MS = 60_000;\nconst HOUR_MS = 3_600_000;\n\n/**\n * Issue #54: the request-path guard. Refuses (typed CONFIG_ERROR, zero wire)\n * a path that does not start with `/`, or whose path part (before `?`)\n * carries `#`, `\\`, a control character, or a `.`/`..` segment (also\n * percent-encoded, e.g. `%2e%2e`) — the shapes that move a request off the\n * intended endpoint.\n */\nfunction assertSafePath(path: string): void {\n const pathPart = path.split('?', 1)[0]!;\n // eslint-disable-next-line no-control-regex\n const bad = !path.startsWith('/') || /[#\\\\\\u0000-\\u001f\\u007f]/.test(pathPart) || pathPart.split('/').some((segment) => {\n let decoded: string;\n try {\n decoded = decodeURIComponent(segment);\n } catch {\n return true; // malformed percent-encoding\n }\n return decoded === '.' || decoded === '..' || /[/\\\\]/.test(decoded);\n });\n if (bad) {\n throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: not a plain absolute API path (dot segment, '#', '\\\\', control character or missing leading '/')`);\n }\n}\n\n/**\n * Build the absolute request URL (base + path + query). Issue #54: the path\n * is guarded ({@link assertSafePath}) and the built URL must stay on the\n * base's origin — the credential headers never leave the configured host.\n */\nexport function buildUrl(baseUrl: string, path: string, query?: Record<string, unknown>): string {\n assertSafePath(path);\n let url = baseUrl + path;\n if (new URL(url).origin !== new URL(baseUrl).origin) {\n throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: it leaves the configured origin`);\n }\n if (query !== undefined) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n params.set(key, String(value));\n }\n const qs = params.toString();\n if (qs.length > 0) url += `?${qs}`;\n }\n return url;\n}\n\n/**\n * Map the vendor's `nextPageUrl` cursor to a request path for `baseUrl`.\n * Issue #54: the cursor is server-supplied, so it is resolved against the\n * base and REFUSED (ResponseRejectedError, zero wire) when its origin\n * differs — page 2 never goes to another host with the credentials. The\n * base pathname (e.g. `/atservicesrest`) is stripped so `buildUrl` does not\n * double it.\n */\nexport function cursorToPath(baseUrl: string, cursor: string): string {\n const base = new URL(baseUrl);\n let url: URL;\n try {\n url = new URL(cursor, base);\n } catch {\n throw new ResponseRejectedError('Refused the pagination cursor: not a parseable URL');\n }\n if (url.origin !== base.origin) {\n throw new ResponseRejectedError(`Refused the pagination cursor: it points off the configured origin (${url.origin})`);\n }\n const basePath = base.pathname.replace(/\\/+$/, '');\n const path = basePath !== '' && url.pathname.startsWith(`${basePath}/`) ? url.pathname.slice(basePath.length) : url.pathname;\n return path + url.search;\n}\n\n/**\n * Issue #43: the vendor's UNAUTHENTICATED zone-discovery endpoint (the\n * leftover #37 prior art — WYRE-AI/autotask-mcp). The tenant's actual zone\n * is published here without credentials, which is what makes it usable as\n * a recovery signal from inside the client. The response's `url` is the\n * ONLY accepted re-point target (a 401 body-injected URL must never\n * receive the credentials).\n */\nconst ZONE_DISCOVERY_URL = 'https://webservices.autotask.net/atservicesrest/v1.0/zoneInformation';\n\n/**\n * Issue #43: validate + normalize a discovery-provided zone base URL\n * (http/https only, trailing slashes stripped — the same contract as the\n * configured baseUrl). undefined when the value is not an http(s) base: a\n * discovery fault, never a re-point target (the credentials never travel to\n * a non-http(s) host).\n */\nfunction normalizeZoneBase(raw: string): string | undefined {\n let url: URL;\n try {\n url = new URL(raw);\n } catch {\n return undefined;\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return undefined;\n return `${url.origin}${url.pathname.replace(/\\/+$/, '')}`;\n}\n\n/**\n * Build the RequestOptions for a `/query` call (ARCHITECTURE section 8.2).\n * POST-always by default — body `{ MaxRecords?, IncludeFields?, filter }` (the `filter` field is ALWAYS sent — an empty array when absent — node parity; some zone versions 500 on its absence)\n * (the node's production wire shape; `filter` is the conditions array).\n * `via: 'get'` — GET `?search=<json>` with the FULL measured URL checked\n * against the 2048-char cap; above it the call THROWS `QueryTooLongError`\n * (never a silent switch to POST).\n */\nexport function buildQueryRequest(baseUrl: string, resourcePath: string, params: QueryParams): RequestOptions {\n const queryPath = `${resourcePath}/query`;\n const raw = params.filter;\n const conditions = raw === undefined ? undefined : Array.isArray(raw) ? raw : raw.filter;\n const filter = conditions === undefined ? undefined : buildFilter(conditions);\n\n if (params.via === 'get') {\n const search: Record<string, unknown> = {};\n if (filter !== undefined) search.filter = filter.filter;\n if (params.maxRecords !== undefined) search.maxRecords = params.maxRecords;\n if (params.includeFields !== undefined) search.includeFields = params.includeFields;\n const req: RequestOptions = {\n method: 'GET',\n path: queryPath,\n query: { search: JSON.stringify(search) },\n };\n const url = buildUrl(baseUrl, queryPath, req.query);\n if (url.length > MAX_GET_LENGTH) {\n throw new QueryTooLongError(\n `GET query URL is ${url.length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`,\n );\n }\n return req;\n }\n\n const body: Record<string, unknown> = {};\n if (params.maxRecords !== undefined) body.MaxRecords = params.maxRecords;\n if (params.includeFields !== undefined) body.IncludeFields = params.includeFields;\n // ALWAYS send a `filter` field — node parity: the node initializes\n // `filters.filter = []` before every query POST (get-many.ts\n // \"Ensure filters.filter is initialized\"). Some zone API versions NRE\n // on a missing filter field (live-verified 2026-10-01 against the\n // AU03/ww29 tenant: 500 `{\"errors\":[\"Value cannot be null. Parameter\n // name: filters\"]}`); an empty array is the vendor-accepted no-filter\n // shape (the swagger marks it optional, the live zone does not).\n body.filter = filter === undefined ? [] : filter.filter;\n return { method: 'POST', path: queryPath, body, idempotent: true };\n}\n\n/**\n * Ambient caller signal (`AsyncLocalStorage`): every request issued inside\n * {@link runWithSignal} is cancelled by it, so a host (an MCP request handler)\n * can abort an in-flight SDK call without every method growing a signal\n * parameter. An explicit `RequestOptions.signal` wins over the ambient one.\n */\nconst ambientSignal = new AsyncLocalStorage<AbortSignal>();\n\n/** Run `fn` with `signal` cancelling every SDK request it starts (and their retry waits). */\nexport function runWithSignal<T>(signal: AbortSignal, fn: () => T): T {\n return ambientSignal.run(signal, fn);\n}\n\n/** Sleep that rejects as soon as `signal` aborts (the timer is always cleared). */\nfunction sleep(ms: number, signal: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal.aborted) return reject(signal.reason);\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(signal.reason);\n };\n const timer = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal.addEventListener('abort', onAbort, { once: true });\n });\n}\n\n/** Read the body as text, refusing (Content-Length pre-check, then a streaming count) above `max` bytes. */\nasync function readBodyText(\n res: Response,\n max: number,\n what: string,\n ctx: { operation?: string; url: string; correlationId: string; httpStatus: number },\n): Promise<string> {\n const tooLarge = (): ResponseRejectedError =>\n new ResponseRejectedError(`Response for ${what} exceeds maxResponseBytes (${max})`, {\n ...ctx,\n code: 'RESPONSE_TOO_LARGE',\n suggestedAction: 'Narrow the query (filter/includeFields) or raise maxResponseBytes.',\n });\n const declared = Number(res.headers.get('Content-Length'));\n if (Number.isFinite(declared) && declared > max) {\n await res.body?.cancel().catch(() => undefined);\n throw tooLarge();\n }\n if (res.body === null) return '';\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let total = 0;\n let text = '';\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n total += value.byteLength;\n if (total > max) {\n await reader.cancel().catch(() => undefined);\n throw tooLarge();\n }\n text += decoder.decode(value, { stream: true });\n }\n return text + decoder.decode();\n}\n\n/** Exponential backoff with equal jitter: base 200 ms, doubled per attempt, capped at 30 s. */\nfunction backoffDelay(attempt: number): number {\n const exp = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);\n return Math.floor(exp / 2 + Math.random() * (exp / 2));\n}\n\n/** Parse `Retry-After` (integer seconds or an HTTP date) into seconds. */\nfunction parseRetryAfter(value: string | null): number | undefined {\n if (value === null || value.length === 0) return undefined;\n const trimmed = value.trim();\n if (/^\\d+$/.test(trimmed)) return Number.parseInt(trimmed, 10);\n // A signed number is neither an integer-second count nor an HTTP date.\n // (Date.parse is lenient: it happily parses '-5' as a year, which would\n // surface as a 0-second cooldown for a hostile header.)\n if (/^[+-]?\\d+$/.test(trimmed)) return undefined;\n const asDate = Date.parse(trimmed);\n if (Number.isFinite(asDate)) {\n const secs = Math.ceil((asDate - Date.now()) / 1000);\n return Math.max(secs, 0);\n }\n return undefined;\n}\n\nfunction isAbortLike(err: unknown): boolean {\n return typeof err === 'object' && err !== null && 'name' in err && (err as { name?: unknown }).name === 'AbortError';\n}\n\n/**\n * #24: a JSON-ish media type (parameters stripped, case-insensitive):\n * `application/json*` or any plus-json-suffixed type. `text/*` — including\n * `text/json` — is NOT json-ish: a wrong CONTENT TYPE on a non-JSON 2xx is\n * the maintenance-page signal (UNEXPECTED_CONTENT_TYPE); only the JSON-ish\n * and the header-LESS cases keep the status-quo INVALID_RESPONSE.\n */\nfunction isJsonMediaType(header: string): boolean {\n const mediaType = header.split(';')[0]?.trim().toLowerCase() ?? '';\n return mediaType.startsWith('application/json') || mediaType.endsWith('+json');\n}\n\n/**\n * #24: the first 256 BYTES of the raw body (UTF-8 — a codepoint cut in the\n * middle is completed by Node's decoder as U+FFFD: the cut never throws and\n * never emits an invalid sequence), then the response-redaction transform.\n * The transform is name-based and a documented no-op on free text (a raw\n * string carries no key names to match) — the honest semantics are\n * truncation-only.\n */\nfunction bodySnippet(text: string, redactPersonalData: boolean): string {\n const bytes = Buffer.from(text, 'utf8').subarray(0, 256).toString('utf8');\n return redactResponseBody(bytes, { redactPersonalData }) as string;\n}\n\n/** The transport. */\n/** The header names the SDK owns as credentials (the auth header builder's output). */\nconst CREDENTIAL_HEADER_NAMES: ReadonlySet<string> = new Set<string>([\n 'ApiIntegrationCode',\n 'UserName',\n 'Secret',\n 'ImpersonationResourceId',\n]);\n\n/**\n * C1 credential shape gate at the wire boundary: every OWNED credential header is checked BEFORE\n * the request is built. A value from a quote-preserving env load is printable ASCII, so it passes\n * the transport's non-printable guard and would reach the vendor verbatim; refusing it here yields\n * a typed, value-free `INVALID_CREDENTIAL_SHAPE` error and NO request. Value-free: the message\n * names the header and the env-load pitfall, never the value.\n */\nfunction assertCredentialShape(\n headers: Record<string, string>,\n auth: ResolvedAuth,\n): void {\n const owned = new Set<string>(CREDENTIAL_HEADER_NAMES);\n for (const name of Object.keys(buildAuthHeaders(auth))) owned.add(name);\n for (const name of Object.keys(headers)) {\n if (!owned.has(name)) continue;\n const value = headers[name] as string;\n const shape = credentialShapeProblem(value.trim(), { skipEdgeWhitespace: true });\n if (shape === undefined) continue;\n throw new AutotaskConfigError(\n `${name} ${CREDENTIAL_ENV_LOAD_ACTION} (${shape})`,\n {\n code: 'INVALID_CREDENTIAL_SHAPE',\n suggestedAction:\n 'Load the credential with the shell (`set -a; . ./.env; set +a`) or with ' +\n 'loadAutotaskCredentialsFromEnv() from node-autotask; single-quoted values must be ' +\n 'shell-sourced, not parsed by a quote-preserving loader. No request was sent.',\n },\n );\n }\n}\n\n/**\n * The credential shape of the values that were actually SENT for this attempt. Only the header\n * NAMES (plus a boolean) cross this boundary — a value never leaves the transport. Returns\n * `undefined` when no owned credential header is present, so there is nothing to annotate.\n */\nfunction credentialShapeExpectation(\n headers: Record<string, string>,\n auth: ResolvedAuth,\n): CredentialShapeExpectation | undefined {\n const owned = new Set<string>(CREDENTIAL_HEADER_NAMES);\n for (const name of Object.keys(buildAuthHeaders(auth))) owned.add(name);\n const names = Object.keys(headers).filter((name) => owned.has(name));\n if (names.length === 0) return undefined;\n let problem: string | undefined;\n for (const name of names) {\n const value = headers[name] as string;\n problem = credentialShapeProblem(value.trim(), { skipEdgeWhitespace: true });\n if (problem !== undefined) break;\n }\n return {\n headerNames: names,\n allValuesClean: problem === undefined,\n ...(problem !== undefined ? { problem } : {}),\n };\n}\n\nexport class HttpClient {\n /**\n * The LIVE base URL (issue #43): the construction-time value until a zone\n * re-point happens, then the tenant's newly resolved zone base. Reads are\n * source-compatible with the pre-#43 readonly field; the ONLY write site\n * is the 401 recovery's `repointZoneBase` (process-lifetime, never\n * persisted — like a cache). The configured base (`config.baseUrl`)\n * stays the construction-time value; `baseUrl` is where the client\n * TALKS.\n */\n get baseUrl(): string {\n return this.liveBaseUrl;\n }\n readonly maxConcurrent: number;\n readonly timeoutMs: number;\n /** Bounded client-scan caps for resolution (section 19.2; per-client). */\n readonly resolution: ResolutionCaps;\n /** Opt-in single-record read cache (undefined = off, the default). */\n readonly readCache: ReadCache | undefined;\n /** Opt-in field-metadata cache for the entityInformation trio (undefined = off, the default). */\n readonly fieldCache: FieldCache | undefined;\n /** Resolved update fallback gate (issue #34; OFF by default). */\n readonly update: { putFallback: boolean };\n private readonly auth: ResolvedAuth;\n private readonly maxRetries: number;\n private readonly maxResponseBytes: number;\n private readonly perHour: number | undefined;\n /** The resolved profile (issue #4) — the agent profile changes the\n * exhaustion `suggestedAction` (stop/narrow, never \"raise the limit\"). */\n private readonly profile: 'library' | 'agent';\n /** Request timestamps inside the trailing hour (only used when `rateLimit.perHour` is set). */\n private readonly hourStamps: number[] = [];\n /** Tenant 429 cooldown gate store (undefined when the gate is disabled). */\n private readonly cooldownStore: CooldownStore | undefined;\n private readonly cooldownMaxMs: number;\n private readonly cooldownDefaultMs: number;\n /** The live base URL (issue #43 — the `baseUrl` getter's backing field;\n * re-pointed by the 401 recovery's `repointZoneBase`). */\n private liveBaseUrl: string;\n /** The resolved named zone (issue #43): the CATALOG-base marker for the\n * re-point gate — `undefined` for a bare explicit baseUrl, `'other'` for\n * an explicit baseUrl named \"other\"; neither class is re-pointable.\n * (The construction-time value — a re-point changes the live base, not\n * the configured zone.) */\n readonly zone: ZoneName | undefined;\n /** The resolved zone re-resolution gate (issue #43; OFF by default). */\n readonly reResolveZoneOn401: boolean;\n /** The resolved opt-in host bounds (skill 3.5.0 / L2, finding A1; absent\n * when the caller supplied no `hostPolicy` — the byte-identical default).\n * Gates the issue-#43 re-point target: a refused host is a discovery\n * fault (the original 401 propagates byte-identically, zero wire). */\n private readonly hostPolicy: { blockPrivate: boolean; allowedOrigins: readonly string[] } | undefined;\n /** The gate key for this client's tenant (lowercased userName + host).\n * Re-derived on a zone re-point (issue #43 — the re-pointed host starts\n * with fresh per-host state). */\n private tenantKey: string;\n /** The host circuit breaker settings (issue #26; undefined when the\n * breaker is off — the default, in which case the gate/recording sites\n * are skipped and no store entry is ever written). */\n private readonly breaker: {\n failureWindowMs: number;\n failureThreshold: number;\n openTimeoutMs: number;\n successesToClose: number;\n halfOpenProbes: number;\n store: CircuitBreakerStore;\n isFailure: (err: AutotaskError) => boolean;\n } | undefined;\n /** The breaker key for this client's host (lowercased host of the base\n * URL — host-only: vendor health is host-scoped, issue #26). Re-derived\n * on a zone re-point (issue #43). */\n private breakerKey: string;\n private readonly logger: Logger;\n /** Response redaction policy (the INV-A1 hotfix; PII/CONFIDENTIAL default on, SECRET always).\n * Public read so the single dry-run envelope builder (base.ts `buildDryRunResult`)\n * threads the SAME resolved policy (INV-E M3 — the in-process input echo). */\n readonly redactPersonalData: boolean;\n /** The configured UserName (the authenticated user). Public read so the\n * ZoneInformation resource can send the swagger-required `user` query\n * param (the same public-read precedent as redactPersonalData — the value\n * already travels in every auth header; nothing new crosses the boundary). */\n readonly userName: string;\n private readonly onAudit: ((event: AuditEvent) => void) | undefined;\n private inFlight = 0;\n private readonly waitQueue: Array<() => void> = [];\n\n constructor(config: ResolvedAutotaskConfig) {\n this.liveBaseUrl = config.baseUrl;\n this.resolution = config.resolution;\n this.readCache = config.readCache;\n this.fieldCache = config.fieldCache;\n this.update = config.update;\n this.zone = config.zone;\n this.reResolveZoneOn401 = config.reResolveZoneOn401;\n this.hostPolicy = config.hostPolicy;\n this.onAudit = config.onAudit;\n this.auth = {\n apiIntegrationCode: config.apiIntegrationCode,\n userName: config.userName,\n secret: config.secret,\n impersonationResourceId: config.impersonationResourceId,\n };\n this.maxRetries = config.maxRetries;\n this.maxResponseBytes = config.maxResponseBytes;\n this.perHour = config.rateLimit?.perHour;\n this.tenantKey = buildTenantKey(config.userName, config.baseUrl);\n this.cooldownStore = config.cooldown.enabled ? (config.cooldown.store ?? defaultCooldownStore()) : undefined;\n this.cooldownMaxMs = config.cooldown.maxMs;\n this.cooldownDefaultMs = config.cooldown.defaultMs;\n this.breakerKey = buildBreakerKey(config.baseUrl);\n this.breaker = config.circuitBreaker.enabled\n ? {\n failureWindowMs: config.circuitBreaker.failureWindowMs,\n failureThreshold: config.circuitBreaker.failureThreshold,\n openTimeoutMs: config.circuitBreaker.openTimeoutMs,\n successesToClose: config.circuitBreaker.successesToClose,\n halfOpenProbes: config.circuitBreaker.halfOpenProbes,\n store: config.circuitBreaker.store ?? defaultCircuitBreakerStore(),\n isFailure: config.circuitBreaker.isFailure ?? isBreakerFailure,\n }\n : undefined;\n this.profile = config.profile;\n this.maxConcurrent = config.maxConcurrent;\n this.timeoutMs = config.timeoutMs;\n this.logger = config.logger;\n this.redactPersonalData = config.redactPersonalData;\n this.userName = config.userName;\n }\n\n /**\n * The LOCAL hourly-budget state (the sliding window this client counts):\n * `{ perHour, used, remaining }` — `undefined` when `rateLimit.perHour`\n * is off. The limiter is PER PROCESS (issue #4): it cannot see other\n * instances or integrations on the tenant — the tenant-wide count is\n * `thresholdInformation.get()`.\n */\n hourlyBudget(): { perHour: number; used: number; remaining: number } | undefined {\n if (this.perHour === undefined) return undefined;\n const now = Date.now();\n while (this.hourStamps.length > 0 && (this.hourStamps[0] as number) <= now - HOUR_MS) this.hourStamps.shift();\n return { perHour: this.perHour, used: this.hourStamps.length, remaining: Math.max(0, this.perHour - this.hourStamps.length) };\n }\n\n /**\n * Breaker success recording (issue #26): a 2xx that got through counts\n * toward `successesToClose` whenever the host has an armed state (open or\n * half-open — a half-open probe, or a threshold-bypass probe of a downed\n * host; decision Q10). A probe completion decrements the admitted-probe\n * budget. On reaching `successesToClose` the circuit CLOSES: counters\n * reset and the entry is DELETED (a healthy host leaves no trace — the\n * #6 delete-on-2xx precedent). A success while closed (or with no entry)\n * is a no-op: the closed failure window is a rate window that prunes\n * itself lazily, not a gate a success clears early.\n */\n private recordBreakerSuccess(probe: boolean, probeKey?: string): void {\n const breaker = this.breaker;\n if (breaker === undefined) return;\n // A probe admitted on one host must never record onto another: if the\n // call re-pointed (issue #43) the outcome was measured on a different\n // host — void the probe (the admitted budget on the original host\n // dangles for the rest of the open period; bounded, conservative,\n // nothing crosses hosts).\n if (probe && (probeKey === undefined || probeKey !== this.breakerKey)) return;\n const key = probe && probeKey !== undefined ? probeKey : this.breakerKey;\n const st = breaker.store.get(key);\n if (st === undefined || st.openedAt === null) return;\n const next: CircuitBreakerState = {\n failures: st.failures,\n openedAt: st.openedAt,\n successes: st.successes + 1,\n probes: probe ? Math.max(0, st.probes - 1) : st.probes,\n };\n if (next.successes >= breaker.successesToClose) {\n breaker.store.delete(key);\n this.logger.warn?.(\n `[autotask] circuit breaker CLOSED for ${key} (${next.successes} probe successes)`,\n undefined,\n );\n return;\n }\n breaker.store.set(key, next);\n }\n\n /**\n * Breaker failure recording (issue #26): called from the outer catch (the\n * single choke point every surfaced failure passes through) for errors\n * the failure predicate counts. While closed, a counted failure appends\n * to the window-pruned `failures` (keeping only timestamps strictly inside\n * `failureWindowMs`) and OPENS the circuit at `failureThreshold`. While\n * open / half-open (a probe failure, a racy late probe failure, or a\n * threshold-bypass failure) it RE-ARMS the open period from now and\n * resets the success count (the #6 \"a 429 re-arms\" precedent — a bypass\n * failure never fails silently).\n */\n private recordBreakerFailure(probe: boolean, probeKey?: string, correlationId?: string): void {\n const breaker = this.breaker;\n if (breaker === undefined) return;\n // Issue #43: same host-pinning as the success recorder — a probe\n // admitted on one host never records onto another after a re-point.\n if (probe && (probeKey === undefined || probeKey !== this.breakerKey)) return;\n const key = probe && probeKey !== undefined ? probeKey : this.breakerKey;\n const now = Date.now();\n const st = breaker.store.get(key) ?? { failures: [], openedAt: null, successes: 0, probes: 0 };\n if (st.openedAt === null) {\n // closed: keep only the failures strictly inside the window, then append.\n const failures = [...st.failures.filter((t) => t > now - breaker.failureWindowMs), now];\n if (failures.length >= breaker.failureThreshold) {\n breaker.store.set(key, { failures, openedAt: now, successes: 0, probes: 0 });\n this.logger.warn?.(\n `[autotask] circuit breaker OPEN for ${key} (${failures.length} counted failures in ${Math.round(breaker.failureWindowMs / 1000)}s) — refusing locally for ${Math.round(breaker.openTimeoutMs / 1000)}s`,\n correlationId,\n );\n return;\n }\n breaker.store.set(key, { ...st, failures });\n return;\n }\n // open / half-open: re-arm the open period from now.\n breaker.store.set(key, {\n failures: st.failures,\n openedAt: now,\n successes: 0,\n probes: probe ? Math.max(0, st.probes - 1) : st.probes,\n });\n }\n\n private acquire(): Promise<void> {\n if (this.inFlight < this.maxConcurrent) {\n this.inFlight += 1;\n return Promise.resolve();\n }\n return new Promise<void>((resolve) => {\n this.waitQueue.push(() => {\n this.inFlight += 1;\n resolve();\n });\n });\n }\n\n private release(): void {\n this.inFlight -= 1;\n const next = this.waitQueue.shift();\n if (next !== undefined) next();\n }\n\n /**\n * One request: build URL/headers, apply the whole-call deadline, retry\n * idempotent methods on 429/5xx, map failures to the typed errors.\n * Returns the RAW parsed body (2xx); `undefined` for an empty 2xx body.\n */\n /**\n * One audit event per settled request (section 19.3): the correlation id,\n * the redacted request body, the outcome. An audit hook that throws never\n * breaks the request.\n */\n private emitAudit(event: AuditEvent): void {\n if (this.onAudit === undefined) return;\n try {\n this.onAudit(event);\n } catch {\n // an audit sink is best-effort; a faulty hook must not break requests\n }\n }\n\n /** Sliding-window `rateLimit.perHour` limiter: waits for a slot within the call budget, else throws. */\n private async takeHourlySlot(\n deadlineAt: number,\n signal: AbortSignal,\n ctx: { operation?: string; url: string; correlationId: string },\n ): Promise<void> {\n if (this.perHour === undefined) return;\n for (;;) {\n const now = Date.now();\n while (this.hourStamps.length > 0 && (this.hourStamps[0] as number) <= now - HOUR_MS) this.hourStamps.shift();\n if (this.hourStamps.length < this.perHour) {\n this.hourStamps.push(now);\n return;\n }\n const waitMs = (this.hourStamps[0] as number) + HOUR_MS - now;\n if (waitMs >= deadlineAt - now) {\n // Fail fast (issue #4): the LOCAL budget is exhausted. The agent\n // profile's suggestedAction tells the LLM to stop or narrow the\n // query — never to raise the limit (raising it just burns more of\n // the tenant's shared vendor budget).\n const err = new RateLimitError(`Client-side rateLimit.perHour (${this.perHour}) exhausted; next slot in ${Math.ceil(waitMs / 1000)}s`, {\n ...ctx,\n suggestedAction:\n this.profile === 'agent'\n ? 'Stop or narrow the query — the LOCAL hourly budget is exhausted (per-process: it cannot see other instances or integrations on the tenant). Do NOT raise rateLimit.perHour; the window frees in about an hour.'\n : 'Back off until the hourly window frees a slot, or raise rateLimit.perHour.',\n });\n err.retryAfter = Math.ceil(waitMs / 1000);\n throw err;\n }\n await sleep(waitMs, signal);\n }\n }\n\n /**\n * Issue #43: the re-point gate — the zone re-resolution is available for\n * this request. ALL gates must hold (the WYRE prior art, adopted\n * verbatim): the flag is ON (strict `true`, off by default), the live\n * base is CATALOG-derived (an explicit baseUrl — a bare one, or\n * `zone: 'other'` + baseUrl — is NEVER re-pointed: the operator said\n * where to go), and the path is RELATIVE (an absolute path, e.g. a\n * cursor `nextPageUrl`, is already baked to a host we do not own and\n * cannot be rewritten). The fourth gate — \"this is not already the\n * recovery retry\" (exactly ONE retry, never a loop) — is enforced at the\n * call site by the request-local `zoneRetry` flag.\n */\n private canReResolveZone(opts: RequestOptions): boolean {\n if (!this.reResolveZoneOn401) return false;\n if (this.zone === undefined || this.zone === 'other') return false;\n if (!opts.path.startsWith('/') || /^https?:\\/\\//i.test(opts.path)) return false;\n return true;\n }\n\n /**\n * Issue #43: one UNAUTHENTICATED vendor zone-discovery call\n * (`GET https://webservices.autotask.net/atservicesrest/v1.0/zoneInformation?user=<userName>`\n * — NO auth headers: the recovery signal must not leak credentials to a\n * host that is not the configured API base). Returns the tenant's\n * resolved zone base URL, or undefined on ANY fault (network, non-2xx,\n * redirect, malformed body, missing/invalid `url`) — the caller then\n * propagates the original 401 untouched (zero retry). Bounded by the\n * SAME whole-call deadline as the request it recovers.\n */\n private async discoverZoneBase(\n signal: AbortSignal,\n ctx: { operation?: string; url: string; correlationId: string },\n ): Promise<string | undefined> {\n const discoveryUrl = `${ZONE_DISCOVERY_URL}?user=${encodeURIComponent(this.userName)}`;\n let res: Response;\n try {\n res = await fetch(discoveryUrl, {\n method: 'GET',\n headers: { Accept: 'application/json' },\n redirect: 'manual', // a redirect off the discovery host is a fault, not a target\n signal,\n });\n } catch {\n return undefined; // a network fault — the 401 propagates, zero retry\n }\n if (res.status < 200 || res.status >= 300) {\n await res.body?.cancel().catch(() => undefined);\n return undefined;\n }\n let text: string;\n try {\n text = await readBodyText(res, this.maxResponseBytes, 'zone discovery', { ...ctx, httpStatus: res.status });\n } catch {\n return undefined;\n }\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n return undefined; // malformed — a discovery fault, not a re-point\n }\n if (!isRecord(body) || typeof body.url !== 'string' || body.url.trim().length === 0) {\n return undefined; // missing/empty `url` — a discovery fault\n }\n return normalizeZoneBase(body.url);\n }\n\n /**\n * Issue #43: re-point the client to the tenant's newly resolved zone\n * base. The transport's PER-HOST state is RE-DERIVED, so the re-pointed\n * host starts FRESH: no cooldown/breaker/tenant-rate inheritance from\n * the stale host (conservative — the stale host's armed entries stay in\n * the shared stores for the other clients that still talk to it; nothing\n * is copied across). The configured base (config.baseUrl) is untouched;\n * the LIVE base is `baseUrl` (the getter over liveBaseUrl), and the\n * re-point is logged (a transport fact — the success path is unchanged,\n * no envelope change).\n */\n private repointZoneBase(to: string): void {\n const from = this.liveBaseUrl;\n this.liveBaseUrl = to;\n this.tenantKey = buildTenantKey(this.auth.userName, to);\n this.breakerKey = buildBreakerKey(to);\n this.logger.warn?.(\n `[autotask] zone re-point ${from} -> ${to} (a 401 on the stale zone base; the vendor's unauthenticated zone discovery named the tenant's current zone) — retrying the request once against the new base`,\n undefined,\n );\n }\n\n async request<T>(opts: RequestOptions): Promise<T> {\n const method = opts.method;\n // `let`: the issue-#43 zone recovery re-points the live base mid-call\n // and rebuilds the URL against it before the ONE retry.\n let url = buildUrl(this.baseUrl, opts.path, opts.query);\n // Issue #43: the zone-recovery state for THIS call (the no-loop flag —\n // set once the recovery fires; a second 401 then surfaces with the\n // `zoneRecovery` detail and no third attempt).\n let zoneRetry: { from: string; to: string } | undefined;\n const headers = withAuthHeaders(opts.headers, this.auth);\n // C1 credential shape gate at the wire boundary (2026-10-07 incident class): the resolved auth\n // headers are the LAST point before the wire, so a value that survived a quote-preserving load\n // is refused here instead of being sent and answered with an opaque vendor 401. The gate is\n // cheap and zero-wire; the standard non-printable guard in `withAuthHeaders` is untouched.\n assertCredentialShape(headers, this.auth);\n if (opts.body !== undefined) headers['Content-Type'] = 'application/json';\n const bodyText = opts.body !== undefined ? JSON.stringify(opts.body) : undefined;\n const correlationId = newCorrelationId();\n const timeoutMs = opts.timeoutMs ?? this.timeoutMs;\n const maxRetries = opts.maxRetries ?? this.maxRetries;\n const started = Date.now();\n const deadlineAt = started + timeoutMs;\n const callerSignal = opts.signal ?? ambientSignal.getStore();\n const signal = AbortSignal.any(\n callerSignal === undefined ? [AbortSignal.timeout(timeoutMs)] : [AbortSignal.timeout(timeoutMs), callerSignal],\n );\n const auditBody = opts.body !== undefined ? redactAuditBody(opts.body) : undefined;\n const retriable = opts.idempotent ?? IDEMPOTENT_METHODS.includes(method);\n // Issue #25: method-based default — every non-DELETE call expects a body\n // (a blank 2xx throws EMPTY_RESPONSE); DELETE keeps the status-quo\n // undefined (the vendor's 204 / empty delete answer; the delete callers\n // synthesize the result from the path id).\n const expectBody = opts.expectBody ?? (method !== 'DELETE');\n const ctx = { operation: opts.operation, url, correlationId };\n let lastStatus: number | undefined;\n\n // The caller's signal wins over the deadline when both fired.\n const interrupted = (): AutotaskError =>\n callerSignal?.aborted\n ? new AutotaskAbortError(`Request aborted: ${method} ${opts.path}`, { ...ctx, suggestedAction: 'The caller aborted; re-issue the call if still needed.' })\n : new AutotaskTimeoutError(`Request timed out after ${timeoutMs}ms: ${method} ${opts.path}`, ctx);\n // A retry only runs when its wait fits inside what is left of the call budget.\n const canWait = (delay: number): boolean => delay <= MAX_RETRY_DELAY_MS && delay < deadlineAt - Date.now();\n const pause = async (delay: number): Promise<void> => {\n try {\n await sleep(delay, signal);\n } catch {\n throw interrupted();\n }\n };\n\n // Tenant 429 cooldown gate (issue #6): a 429 armed the gate for this\n // tenant — fail LOCALLY (before the semaphore, the hourly limiter and\n // fetch: zero upstream calls) until the deadline passes.\n if (this.cooldownStore !== undefined && !opts.bypassCooldown) {\n const deadline = this.cooldownStore.get(this.tenantKey);\n if (deadline !== undefined) {\n const remainingMs = deadline - Date.now();\n if (remainingMs > 0) {\n // An already-aborted caller signal still produces the abort error.\n if (callerSignal?.aborted) throw interrupted();\n const seconds = Math.ceil(remainingMs / 1000);\n const err = new RateLimitError(\n `Tenant is in a rate-limit cooldown; the call was NOT sent. ${seconds}s remain — do not retry before then, and narrow the query (filter/includeFields) before retrying.`,\n {\n ...ctx,\n code: 'RATE_LIMITED_COOLDOWN',\n retryable: false,\n suggestedAction: `Wait ${seconds}s (per-tenant 429 cooldown) and retry with a narrower query; the call was not sent and consumed no vendor budget.`,\n },\n );\n err.retryAfter = seconds;\n err.notSent = true;\n this.emitAudit({\n correlationId,\n operation: opts.operation,\n method,\n path: opts.path,\n durationMs: Date.now() - started,\n body: auditBody,\n notSent: true,\n errorCode: 'RATE_LIMITED_COOLDOWN',\n });\n throw err;\n }\n // Lazy expiry: the first call after the deadline deletes the entry and proceeds.\n this.cooldownStore.delete(this.tenantKey);\n }\n }\n\n // Host circuit breaker gate (issue #26): the SAME pre-send slot as the\n // #6 cooldown gate (cooldown first — existing code, minimal diff):\n // OUTSIDE the retry loop, before the hourly limiter, the semaphore and\n // fetch — a refusal makes zero fetches, consumes no hourly stamp and no\n // concurrency slot. Timer-free: the state is derived from Date.now()\n // (closed = no armed state; open = until openedAt + openTimeoutMs;\n // half-open = the lazy transition after). `thresholdInformation.get()`\n // bypasses the REFUSAL (`bypassCircuitBreaker`) but its outcome is still\n // recorded.\n let breakerProbe = false;\n // Issue #43: the host key the probe was ADMISSIONED against. The\n // recorders pin to it: a zone re-point mid-call re-derives\n // `this.breakerKey` to the NEW host, so recording a stale-host probe\n // against the live key would decrement the new host's probe budget\n // (or close its circuit early) — bookkeeping from one host must not\n // leak onto another (the #43 hygiene rule).\n let breakerProbeKey: string | undefined;\n if (this.breaker !== undefined && !opts.bypassCircuitBreaker) {\n // An already-aborted caller signal still produces the abort error.\n if (callerSignal?.aborted) throw interrupted();\n const now = Date.now();\n const st = this.breaker.store.get(this.breakerKey);\n if (st !== undefined && st.openedAt !== null) {\n const openUntil = st.openedAt + this.breaker.openTimeoutMs;\n if (now < openUntil) {\n // OPEN — refuse locally (zero upstream calls). `retryable: true`\n // is the deliberate divergence from #6's cooldown refusal (the\n // open period is bounded and advertised via retryAfter — retry the\n // SAME call after the wait; no narrowing needed).\n const remainingMs = openUntil - now;\n const seconds = Math.ceil(remainingMs / 1000);\n const err = new CircuitBreakerError(\n `The circuit breaker for ${this.breakerKey} is open; the call was NOT sent. ${seconds}s remain — retry the same call after the wait (a host-scoped vendor fault, not the request).`,\n {\n ...ctx,\n details: { state: 'open', retryAfterMs: remainingMs, failureCount: st.failures.length },\n suggestedAction: `Wait ${seconds}s (the circuit is open for ${this.breakerKey}) and retry the SAME call; the call was not sent and consumed no vendor budget.`,\n },\n );\n err.retryAfter = seconds;\n err.notSent = true;\n this.emitAudit({\n correlationId,\n operation: opts.operation,\n method,\n path: opts.path,\n durationMs: Date.now() - started,\n body: auditBody,\n notSent: true,\n errorCode: 'CIRCUIT_BREAKER_OPEN',\n });\n throw err;\n }\n // HALF-OPEN (the lazy transition — no timers): admit up to\n // halfOpenProbes probes; a verdict-pending budget is a refusal too\n // (the bounded-probes contract — the circuit may not let unbounded\n // calls through while probing).\n if (st.probes >= this.breaker.halfOpenProbes) {\n const err = new CircuitBreakerError(\n `The circuit breaker for ${this.breakerKey} is half-open and its probes are in flight; the call was NOT sent — retry once a probe settles.`,\n {\n ...ctx,\n details: { state: 'half-open', retryAfterMs: 0, failureCount: st.failures.length },\n suggestedAction: 'A half-open probe is settling; retry shortly — the call was not sent and consumed no vendor budget.',\n },\n );\n err.notSent = true;\n this.emitAudit({\n correlationId,\n operation: opts.operation,\n method,\n path: opts.path,\n durationMs: Date.now() - started,\n body: auditBody,\n notSent: true,\n errorCode: 'CIRCUIT_BREAKER_OPEN',\n });\n throw err;\n }\n const admitted: CircuitBreakerState = { ...st, probes: st.probes + 1 };\n this.breaker.store.set(this.breakerKey, admitted);\n breakerProbe = true;\n breakerProbeKey = this.breakerKey;\n }\n // closed (or nothing recorded for the host): admit — a healthy host\n // leaves no store entry.\n }\n\n this.logger.debug?.(`[autotask] ${method} ${opts.path}`, correlationId);\n\n try {\n let attempt = 0;\n let outcome: { value: T; status: number } | null = null;\n for (;;) {\n try {\n await this.takeHourlySlot(deadlineAt, signal, ctx);\n } catch (err) {\n if (signal.aborted) throw interrupted();\n throw err;\n }\n await this.acquire();\n let res: Response;\n try {\n res = await fetch(url, { method, headers, body: bodyText, signal, redirect: 'manual' });\n } catch (err) {\n this.release();\n if (signal.aborted || isAbortLike(err)) throw interrupted();\n const delay = backoffDelay(attempt);\n if (attempt < maxRetries && retriable && canWait(delay)) {\n this.logger.warn?.(\n `[autotask] network error on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,\n correlationId,\n );\n attempt += 1;\n await pause(delay);\n continue;\n }\n throw new AutotaskNetworkError(\n `Network error during ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,\n ctx,\n );\n }\n\n let status: number;\n let text: string;\n try {\n status = res.status;\n if (status >= 300 && status < 400) {\n // Never follow: auth headers must not travel to another origin.\n await res.body?.cancel().catch(() => undefined);\n throw new ResponseRejectedError(\n `Refused to follow a ${status} redirect for ${method} ${opts.path}`,\n { ...ctx, code: 'REDIRECT_BLOCKED', httpStatus: status, suggestedAction: 'Check the configured zone/baseUrl; the API does not redirect.' },\n );\n }\n text = await readBodyText(res, this.maxResponseBytes, `${method} ${opts.path}`, { ...ctx, httpStatus: status });\n } catch (err) {\n this.release();\n if (err instanceof AutotaskError) throw err;\n if (signal.aborted || isAbortLike(err)) throw interrupted();\n throw new AutotaskNetworkError(\n `Network error reading the response of ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,\n ctx,\n );\n }\n this.release();\n lastStatus = status;\n\n if (status >= 200 && status < 300) {\n // A 2xx proves the tenant has headroom: clear the cooldown gate early\n // (a no-op when nothing is armed).\n if (this.cooldownStore !== undefined) this.cooldownStore.delete(this.tenantKey);\n if (text.length === 0) {\n if (expectBody) {\n // Issue #25: a blank 2xx on a call that expects a result is a\n // transport fault (proxy / maintenance edge), not \"no data\" —\n // throw the typed EMPTY_RESPONSE BEFORE any unwrap helper runs.\n // `retryable` is advisory (the loop never retries 2xx): true for\n // non-DELETE reads. The typed empty-reason stamp (issue #14) is\n // attached here, mirroring the errorFromStatus site, so a pinned\n // blind surface (e.g. companies.query) keeps it.\n const err = new EmptyResponseError(`Empty ${status} response for ${method} ${opts.path}`, {\n ...ctx,\n httpStatus: status,\n retryable: method !== 'DELETE',\n details: { httpStatus: status, method },\n });\n attachEmptyReasonDetails(err);\n throw err;\n }\n outcome = { value: undefined as T, status };\n break;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n // #24: the decode attempt above is UNCONDITIONAL (JSON under an odd\n // Content-Type still decodes and never lands here). Classify the\n // non-JSON 2xx by the response Content-Type — the FIRST time the\n // transport reads it:\n // - JSON-ish media type (application/json*, */*+json) → the status-\n // quo INVALID_RESPONSE (the W-A7 / #13 marker-recovery key — a\n // wrong-shape 2xx is a shape-level failure, not a transport one);\n // - NO header → INVALID_RESPONSE too (conservative — the maintenance\n // page premise carries a header; a header-less wire fact would\n // flip this row);\n // - anything else (text/* and friends) → the typed, retryable\n // UNEXPECTED_CONTENT_TYPE (an edge/maintenance page — the vendor\n // never processed the request).\n const contentType = res.headers.get('Content-Type');\n const err =\n contentType !== null && contentType !== '' && !isJsonMediaType(contentType)\n ? new UnexpectedContentTypeError(\n `Non-JSON response body for ${method} ${opts.path} (HTTP ${status})`,\n {\n ...ctx,\n httpStatus: status,\n details: {\n httpStatus: status,\n contentType,\n bodySnippet: bodySnippet(text, this.redactPersonalData),\n },\n // The content-type is host-sourced (a host-supplied\n // baseUrl can serve arbitrary HTML) — capped, never prose;\n // the raw snippet rides details only.\n suggestedAction: retriable\n ? `The zone answered with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the zone is likely in a maintenance window — retry after the window, or verify baseUrl points at the REST API.`\n : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect — verify the record before re-issuing (writes are never auto-retried).`,\n },\n )\n : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {\n ...ctx,\n code: 'INVALID_RESPONSE',\n category: 'server',\n httpStatus: status,\n suggestedAction: 'The zone returned a non-JSON 2xx body; verify baseUrl points at the REST API.',\n });\n // #24 retry leg: the maintenance page is served by the EDGE (the\n // vendor never processed the request), so retrying an IDEMPOTENT\n // method is safe — per the loop's existing condition (GET/PUT/\n // DELETE + idempotent-flagged POST) with the same Retry-After /\n // backoff / wait-budget rules as the 5xx leg. A non-idempotent call\n // makes ONE request and throws at once (the residue concern, #13\n // precedent). An INVALID_RESPONSE 2xx (JSON-ish or header-less) is\n // NEVER retried — a real contract break is not transient.\n if (err.code === 'UNEXPECTED_CONTENT_TYPE' && retriable && attempt < maxRetries) {\n const retryAfter = parseRetryAfter(res.headers.get('Retry-After'));\n const delay = retryAfter !== undefined ? retryAfter * 1000 : backoffDelay(attempt);\n if (canWait(delay)) {\n this.logger.warn?.(\n `[autotask] non-JSON 2xx on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,\n correlationId,\n );\n attempt += 1;\n await pause(delay);\n continue;\n }\n }\n attachEmptyReasonDetails(err); // issue #14 channel: uniform across transport-thrown errors\n throw err;\n }\n // The INV-A1 hotfix: one deep transform of the parsed body — every\n // JSON response surface (dedicated tools, invoke, compositions)\n // crosses the SDK boundary already redacted (SECRET always;\n // PII/CONFIDENTIAL per the resolved policy; request bodies are\n // never touched — see src/redact.ts). The single internal bypass is\n // the V2 merge round-trip read (skipResponseRedaction — see\n // RequestOptions; the values go back to the same vendor endpoint,\n // never to a caller).\n outcome = {\n value: opts.skipResponseRedaction\n ? (parsed as T)\n : (redactResponseBody(parsed, { redactPersonalData: this.redactPersonalData }) as T),\n status,\n };\n break;\n }\n\n let body: unknown;\n if (text.length > 0) {\n try {\n body = JSON.parse(text);\n } catch {\n body = text;\n }\n }\n\n // #23: a deterministic vendor field-validation 500 (a known phrase over\n // the parsed errors[] — the body is already parsed at the retry site)\n // can never succeed on retry: break out BEFORE the retry decision\n // (exactly one upstream call). The mapping below keeps the ServerError\n // class + status 500 and marks it non-retryable.\n const deterministic500 = status >= 500 && isDeterministicVendor500(parseVendorErrors(body));\n const retryableStatus = status === 429 || status >= 500;\n if (retryableStatus && !deterministic500 && attempt < maxRetries && retriable) {\n const retryAfter = parseRetryAfter(res.headers.get('Retry-After'));\n const delay = retryAfter !== undefined ? retryAfter * 1000 : backoffDelay(attempt);\n if (canWait(delay)) {\n this.logger.warn?.(\n `[autotask] ${status} on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,\n correlationId,\n );\n attempt += 1;\n await pause(delay);\n continue;\n }\n }\n\n // Issue #43: the zone re-resolution (gates in canReResolveZone — the\n // request-local `zoneRetry` flag is the fourth, no-loop gate): one\n // UNAUTHENTICATED vendor zone-discovery call, and if the tenant's\n // resolved zone base DIFFERS from the live base, re-point the client\n // and retry the SAME request ONCE against it. The re-point target\n // comes ONLY from the discovery response (the 401 body is never\n // consulted for a URL). A discovery fault, or a resolved base\n // IDENTICAL to the live one, falls through to today's typed 401\n // byte-identically (zero retry — the recovery must never turn a\n // credential fault into a discovery fault).\n if (status === 401 && zoneRetry === undefined && this.canReResolveZone(opts)) {\n const target = await this.discoverZoneBase(signal, ctx);\n // Skill 3.5.0 / L2 (finding A1): when hostPolicy is active the\n // discovery-provided re-point target must pass the SAME bounds\n // (private first, then the allow-list). A refused host is a\n // DISCOVERY FAULT — the re-point never happens and the original\n // 401 propagates byte-identically (zero wire to the refused host,\n // credentials never sent there).\n const targetViolation =\n target === undefined || this.hostPolicy === undefined\n ? null\n : decideHostPolicy(target, this.hostPolicy);\n if (targetViolation !== null) {\n this.logger.warn?.(\n `[autotask] zone re-point refused by hostPolicy (${targetViolation.bound}): ${targetViolation.origin} — the original 401 propagates, zero wire to the refused host`,\n undefined,\n );\n }\n if (target !== undefined && targetViolation === null && target !== this.baseUrl) {\n zoneRetry = { from: this.baseUrl, to: target };\n this.repointZoneBase(target);\n // The retry is the SAME request (method/path/query/body/\n // operation) against the new base — rebuild the URL against the\n // re-pointed live base and re-enter the loop. The `zoneRetry`\n // flag now holds the no-loop gate for the retry itself.\n url = buildUrl(this.baseUrl, opts.path, opts.query);\n continue;\n }\n // target === undefined (a discovery fault) or target === this.baseUrl\n // (the zone did not move — genuinely bad credentials): today's typed\n // 401 propagates byte-identically — zero retry.\n }\n\n const retryAfterSecs = parseRetryAfter(res.headers.get('Retry-After'));\n const err = errorFromStatus(\n status,\n body,\n url,\n opts.operation,\n this.redactPersonalData,\n credentialShapeExpectation(headers, this.auth),\n );\n err.correlationId = correlationId;\n // Issue #43: the recovery fired and the retried request 401'd again —\n // the typed 401 keeps its identity and gains the self-explaining\n // detail (the zone moved and the retry was attempted; the credentials\n // still fail — this is not a discovery fault). Additive only: the\n // status / code / message / retryability never change.\n if (status === 401 && zoneRetry !== undefined) {\n err.details = {\n ...(err.details ?? {}),\n zoneRecovery: { from: zoneRetry.from, to: zoneRetry.to, retried: true },\n };\n }\n attachEmptyReasonDetails(err); // issue #14: the typed reason/pointer rides the details\n if (err instanceof RateLimitError && retryAfterSecs !== undefined) err.retryAfter = retryAfterSecs;\n // Arm the tenant cooldown when the 429 is about to surface (retries\n // spent, Retry-After beyond the wait budget, or a non-retriable\n // method) — never while the same call is still retrying.\n if (status === 429 && this.cooldownStore !== undefined) {\n const threadThreshold = err.code.toLowerCase() === 'itgenatr005';\n const durationMs = cooldownDurationMs(retryAfterSecs, {\n maxMs: this.cooldownMaxMs,\n defaultMs: this.cooldownDefaultMs,\n threadThreshold,\n });\n this.cooldownStore.set(this.tenantKey, Date.now() + durationMs);\n this.logger.warn?.(\n `[autotask] 429 on ${method} ${opts.path} surfaces after ${attempt + 1} attempt(s); tenant cooldown armed for ${Math.round(durationMs / 1000)}s`,\n correlationId,\n );\n }\n throw err;\n }\n if (outcome !== null) {\n this.emitAudit({\n correlationId,\n operation: opts.operation,\n method,\n path: opts.path,\n status: outcome.status,\n durationMs: Date.now() - started,\n body: auditBody,\n });\n // Breaker success recording (issue #26): a 2xx that got through\n // counts toward closing the host circuit (a half-open probe, or a\n // threshold-bypass probe of a downed host — decision Q10; a no-op\n // while closed and when nothing is recorded for the host).\n if (this.breaker !== undefined) {\n try {\n this.recordBreakerSuccess(breakerProbe, breakerProbeKey);\n } catch {\n // breaker bookkeeping is best-effort; a faulty store must never\n // break a successful request\n }\n }\n return outcome.value;\n }\n } catch (err) {\n // Breaker failure recording (issue #26): the outer catch is the\n // single choke point every surfaced failure passes through. The\n // notSent guard keeps a LOCAL refusal (the cooldown's, or the\n // breaker's own — both are thrown pre-loop and never reach here;\n // the guard is defense in depth) out of the counted failures, and\n // the predicate decides the rest (never ABORTED, a 4xx, the\n // deterministic validation 500, or a policy refusal).\n if (this.breaker !== undefined && err instanceof AutotaskError && (err as { notSent?: boolean }).notSent !== true) {\n try {\n if (this.breaker.isFailure(err)) this.recordBreakerFailure(breakerProbe, breakerProbeKey, correlationId);\n } catch {\n // breaker bookkeeping is best-effort; a faulty store must never\n // break the error path\n }\n }\n this.emitAudit({\n correlationId,\n operation: opts.operation,\n method,\n path: opts.path,\n status: lastStatus,\n durationMs: Date.now() - started,\n body: auditBody,\n errorCode: err instanceof AutotaskError ? err.code : 'NETWORK_ERROR',\n });\n // Issue #31: a drift signal invalidates the ONE entity the call named\n // (the entity's field-cache entries, if any — the next metadata read\n // refetches): a deterministic vendor field-validation 500 (the vendor\n // just said a field belief is wrong), or an INVALID_RESPONSE on the\n // metadata trio (the catalog shape moved). An ordinary record write\n // says nothing about the field catalog and never invalidates; the TTL\n // is the other expiry path. Attribution: the operation's resource\n // prefix (`tickets.create` -> `tickets`); an unattributable call\n // leaves the TTL to do its job.\n if (this.fieldCache !== undefined && err instanceof AutotaskError) {\n const op = typeof opts.operation === 'string' ? opts.operation : undefined;\n const verb = op !== undefined ? op.slice(op.lastIndexOf('.') + 1) : '';\n const drift =\n (err.details?.deterministic === true) ||\n (err.code === 'INVALID_RESPONSE' && META_TRIO_VERBS.has(verb));\n if (drift && op !== undefined) {\n const dot = op.indexOf('.');\n if (dot > 0) this.fieldCache.invalidate(op.slice(0, dot));\n }\n }\n throw err;\n } finally {\n // A real write (even a failed one — it may have partly applied) voids cached reads.\n if (!(method === 'GET' || opts.idempotent === true)) this.readCache?.clear();\n }\n // The loop only exits via an outcome (returned above) or a throw — the\n // tail is unreachable, but the type needs a terminus.\n throw new AutotaskError('unreachable: the request loop ended without an outcome');\n }\n}\n\nconst INVALID_SHAPE_ACTION = 'Report the unexpected response shape; verify baseUrl points at the REST API.';\n\n/** Issue #31: the metadata trio verbs whose INVALID_RESPONSE is a field-catalog\n * drift signal (the shape moved) — a record read's INVALID_RESPONSE is not. */\nconst META_TRIO_VERBS: ReadonlySet<string> = new Set(['getEntityInfo', 'getFieldInfo', 'getUdfInfo']);\n\n/** query: expects `{ items: T[], pageDetails: PagingModel }`; validates both present (no re-wrap). */\n/**\n * Issue #14: attach the typed empty-reason / pointer-note details to a\n * typed error (ADDITIVE — the error code / status / message /\n * retryability are never mutated). The surface key is the error's\n * `operation` (the caller passes it on every request/unwrap):\n * - a pinned `EMPTY_REASON_STAMPS` row → `details.emptyReason` (the pinned\n * info: kind + note + authority + remedy);\n * - a pinned `POINTER_NOTES` row → `details.pointerNote` (the pointer\n * sentence — the op is a known wall; the status/code are untouched);\n * - the generic `.get` miss (item === null, no pin) → a synthesized\n * `not-found` reason.\n * Non-pinned surfaces stay unattached (no speculation).\n */\nfunction attachEmptyReasonDetails(err: AutotaskError): void {\n if (err.operation === undefined) return;\n const dot = err.operation.indexOf('.');\n if (dot <= 0) return;\n const resource = err.operation.slice(0, dot);\n const op = err.operation.slice(dot + 1);\n const surface = err.operation;\n const stamp = EMPTY_REASON_STAMPS[resource]?.[op];\n const pointer = POINTER_NOTES[surface];\n const isGetMiss = err instanceof NotFoundError && op === 'get';\n if (stamp === undefined && pointer === undefined && !isGetMiss) return;\n err.details = { ...(err.details ?? {}) };\n if (stamp !== undefined) {\n err.details.emptyReason = stamp;\n } else if (isGetMiss) {\n // Blind-aware (post-verification F3): on a plan-pinned blind surface a\n // `.get` miss proves nothing about existence — the record may exist and\n // be invisible to this API user, so \"no record exists\" is a claim the\n // surface cannot support; the pin's note is the honest reason (the\n // shape mirrors base.ts blindEmptyReason byte-for-byte — base.ts imports\n // this module, so the shape is inlined here instead of imported).\n const blindOps = BLIND_SURFACE_STAMPS[resource];\n const blind =\n blindOps !== undefined ? Object.values(blindOps).find((v) => v !== undefined) : undefined;\n err.details.emptyReason =\n blind !== undefined\n ? {\n surface,\n kind: 'blind-surface',\n note: blind.note,\n authority: blind.authority,\n remedy: 'the note is the remedy — the authority op answers for a record',\n }\n : {\n surface,\n kind: 'not-found',\n note: `no ${resource} record exists at this id (a miss is the data, not an error condition)`,\n authority: `${resource}.query`,\n remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface — do not retry the same get`,\n };\n }\n if (pointer !== undefined) err.details.pointerNote = pointer;\n}\n\nexport function unwrapItems<T>(body: unknown, operation?: string): { items: T[]; pageDetails: PagingModel } {\n if (!isRecord(body) || !Array.isArray(body.items) || !isRecord(body.pageDetails)) {\n const err = new AutotaskError('Expected the query envelope { items, pageDetails }; got a different shape', {\n code: 'INVALID_RESPONSE',\n category: 'server',\n operation,\n suggestedAction: INVALID_SHAPE_ACTION,\n });\n attachEmptyReasonDetails(err); // issue #14: the pinned shape-drift note (if any) rides the details\n throw err;\n }\n return { items: body.items as T[], pageDetails: body.pageDetails as unknown as PagingModel };\n}\n\n/**\n * get: expects `{ item: T }`. `item === null` THROWS `NotFoundError` (the\n * vendor not-found signal — HTTP may be 200) with `httpStatus: 200` and\n * `resourceIds: [id]` when `id` is given.\n */\nexport function unwrapItem<T>(body: unknown, id?: Identifier, operation?: string): T {\n if (!isRecord(body) || !('item' in body)) {\n throw new AutotaskError('Expected the item envelope { item }; got a different shape', {\n code: 'INVALID_RESPONSE',\n category: 'server',\n operation,\n suggestedAction: INVALID_SHAPE_ACTION,\n });\n }\n const item = body.item;\n if (item === null) {\n const err = new NotFoundError(\n id !== undefined ? `The record with ID ${id} was not found` : 'The record was not found',\n {\n httpStatus: 200,\n resourceIds: id !== undefined ? [id] : undefined,\n operation,\n suggestedAction: 'Verify the id, or resolve the record by name first.',\n },\n );\n attachEmptyReasonDetails(err); // issue #14: the pinned reason (or the generic not-found) rides the details\n throw err;\n }\n return item as T;\n}\n\n/** count: expects `{ queryCount: number }` (an object, not a bare number) → the plain number. */\nexport function unwrapQueryCount(body: unknown, operation?: string): number {\n if (!isRecord(body) || typeof body.queryCount !== 'number') {\n const err = new AutotaskError('Expected the count envelope { queryCount: number }; got a different shape', {\n code: 'INVALID_RESPONSE',\n category: 'server',\n operation,\n suggestedAction: INVALID_SHAPE_ACTION,\n });\n attachEmptyReasonDetails(err); // issue #14: the pinned reason (if any) rides the details\n throw err;\n }\n return body.queryCount;\n}\n\n/** create/update/delete: expects `{ itemId }` (accepts `{ id }` too) → `{ id }`. */\nexport function unwrapOperation(body: unknown, operation?: string): OperationResult {\n const value = isRecord(body) ? (body.itemId !== undefined ? body.itemId : body.id) : undefined;\n const idValue = toIdentifierId(value);\n if (idValue === undefined) {\n const err = new AutotaskError(\n 'Expected OperationResultModel { itemId } (or { id }); got a different shape',\n { code: 'INVALID_RESPONSE', category: 'server', operation, suggestedAction: INVALID_SHAPE_ACTION },\n );\n attachEmptyReasonDetails(err); // issue #14: the pinned shape-drift note (if any) rides the details\n throw err;\n }\n return { id: idValue };\n}\n\n/** swagger types `itemId` as generic `Object`; accept integers and numeric\n * strings. An all-digit string beyond the safe range keeps its exact digits\n * (the string form is the only lossless carrier for vendor ids above 2^53). */\nfunction toIdentifierId(value: unknown): Identifier | undefined {\n if (typeof value === 'number' && Number.isInteger(value)) return value;\n if (typeof value === 'string' && /^\\d+$/.test(value.trim())) {\n const trimmed = value.trim();\n const parsed = Number.parseInt(trimmed, 10);\n return Number.isSafeInteger(parsed) ? parsed : trimmed;\n }\n return undefined;\n}\n\n/** invoice markup/pdf + attachment downloads: raw pass-through (no re-wrap). */\nexport function passthrough<T>(body: unknown): T {\n return body as T;\n}\n","/**\n * Per-resource read-cache TTL tables (issue #32).\n * GENERATED by scripts/generate-capabilities.mjs from capabilities.plan.json\n * (the 7th generated artifact; the plan is the ONLY input). Do not\n * hand-edit; re-run the generator. The drift guard is\n * scripts/check-capabilities.mjs (clause 8a) +\n * test/scripts/cache-ttl-artifact.test.ts.\n *\n * Consumers:\n * - DEFAULT_PER_RESOURCE_TTL_MS: the plan-derived DEFAULT per-resource\n * table for `cache.perResourceTtlMs` — reference-class resources\n * (the human-timescale lookup tables: CACHE_TTL_REFERENCE_KEYS, pinned\n * in scripts/lib/cache-ttl.mjs) carry the 1h class, every other plan\n * resource the 5min class. One row per plan resource so the operator's\n * map keys are always valid against the plan; the table is a REFERENCE\n * for building the map (spread + per-operator pins), never an implicit\n * default: an absent perResourceTtlMs means every resource uses\n * cache.ttlMs (the R-F3a off-by-default contract).\n * - RESOURCE_KEY_BY_PATH: `/V1.0/<Entity>` -> plan key (the 121\n * entity-kind resources). BaseResource.fetchRecordRaw uses it to key a\n * cross-entity read's cache entry by the READ ENTITY's plan key (a\n * contact read through tickets.getContext expires on the contact's\n * TTL, not the ticket's).\n *\n * planHash: e229200fc177d4428a3d73e75be413c91338876fdc1224bc3c9469788f96d975\n */\n// [GENERATED:CACHETTL:START]\nexport const CACHE_TTL_REFERENCE_KEYS: readonly string[] = [\"billing_codes\",\"countries\",\"departments\",\"phases\",\"roles\",\"services\"];\nexport const CACHE_TTL_REFERENCE_MS = 3600000;\nexport const CACHE_TTL_DEFAULT_MS = 300000;\nexport const DEFAULT_PER_RESOURCE_TTL_MS: Readonly<Record<string, number>> = {\n \"appointments\": 300000,\n \"authenticate\": 300000,\n \"billing_codes\": 3600000,\n \"billing_items\": 300000,\n \"change_request_links\": 300000,\n \"checklist_libraries\": 300000,\n \"checklist_library_checklist_items\": 300000,\n \"classification_icons\": 300000,\n \"companies\": 300000,\n \"company_alerts\": 300000,\n \"company_locations\": 300000,\n \"company_notes\": 300000,\n \"company_site_configurations\": 300000,\n \"company_webhooks\": 300000,\n \"configuration_item_billing_product_associations\": 300000,\n \"configuration_item_categories\": 300000,\n \"configuration_item_category_udf_associations\": 300000,\n \"configuration_item_dns_records\": 300000,\n \"configuration_item_notes\": 300000,\n \"configuration_item_related_items\": 300000,\n \"configuration_item_ssl_subject_alternative_names\": 300000,\n \"configuration_item_types\": 300000,\n \"configuration_item_webhooks\": 300000,\n \"configuration_items\": 300000,\n \"contact_group_contacts\": 300000,\n \"contact_groups\": 300000,\n \"contact_webhooks\": 300000,\n \"contacts\": 300000,\n \"contract_billing_rules\": 300000,\n \"contract_block_hour_factors\": 300000,\n \"contract_blocks\": 300000,\n \"contract_charges\": 300000,\n \"contract_exclusion_billing_codes\": 300000,\n \"contract_exclusion_roles\": 300000,\n \"contract_exclusion_set_excluded_roles\": 300000,\n \"contract_exclusion_set_excluded_work_types\": 300000,\n \"contract_exclusion_sets\": 300000,\n \"contract_milestones\": 300000,\n \"contract_notes\": 300000,\n \"contract_rates\": 300000,\n \"contract_retainers\": 300000,\n \"contract_role_costs\": 300000,\n \"contract_service_adjustments\": 300000,\n \"contract_service_bundle_adjustments\": 300000,\n \"contract_service_bundle_units\": 300000,\n \"contract_service_bundles\": 300000,\n \"contract_service_units\": 300000,\n \"contract_services\": 300000,\n \"contract_ticket_purchases\": 300000,\n \"contracts\": 300000,\n \"countries\": 3600000,\n \"departments\": 3600000,\n \"domain_registrars\": 300000,\n \"entity_information\": 300000,\n \"expense_item_attachments\": 300000,\n \"expense_items\": 300000,\n \"expense_reports\": 300000,\n \"holiday_sets\": 300000,\n \"holidays\": 300000,\n \"inventory_products\": 300000,\n \"invoices\": 300000,\n \"modules\": 300000,\n \"notification_history\": 300000,\n \"opportunities\": 300000,\n \"opportunity_attachments\": 300000,\n \"opportunity_categories\": 300000,\n \"phases\": 3600000,\n \"product_vendors\": 300000,\n \"products\": 300000,\n \"project_charges\": 300000,\n \"project_notes\": 300000,\n \"projects\": 300000,\n \"purchase_approvals\": 300000,\n \"purchase_order_item_receiving\": 300000,\n \"purchase_order_items\": 300000,\n \"purchase_orders\": 300000,\n \"quote_items\": 300000,\n \"quote_locations\": 300000,\n \"quote_templates\": 300000,\n \"quotes\": 300000,\n \"resource_role_queues\": 300000,\n \"resource_roles\": 300000,\n \"resource_skills\": 300000,\n \"resource_time_off_additional\": 300000,\n \"resource_time_off_approvers\": 300000,\n \"resource_time_off_balances\": 300000,\n \"resources\": 300000,\n \"roles\": 3600000,\n \"service_call_task_resources\": 300000,\n \"service_call_tasks\": 300000,\n \"service_call_ticket_resources\": 300000,\n \"service_call_tickets\": 300000,\n \"service_calls\": 300000,\n \"service_level_agreement_results\": 300000,\n \"services\": 3600000,\n \"skills\": 300000,\n \"subscription_periods\": 300000,\n \"subscriptions\": 300000,\n \"survey_results\": 300000,\n \"surveys\": 300000,\n \"tag_aliases\": 300000,\n \"tag_groups\": 300000,\n \"tags\": 300000,\n \"task_secondary_resources\": 300000,\n \"tasks\": 300000,\n \"threshold_information\": 300000,\n \"ticket_additional_configuration_items\": 300000,\n \"ticket_additional_contacts\": 300000,\n \"ticket_attachments\": 300000,\n \"ticket_categories\": 300000,\n \"ticket_category_field_defaults\": 300000,\n \"ticket_change_request_approvals\": 300000,\n \"ticket_charges\": 300000,\n \"ticket_checklist_items\": 300000,\n \"ticket_checklist_libraries\": 300000,\n \"ticket_history\": 300000,\n \"ticket_note_attachments\": 300000,\n \"ticket_note_webhooks\": 300000,\n \"ticket_notes\": 300000,\n \"ticket_secondary_resources\": 300000,\n \"ticket_webhooks\": 300000,\n \"tickets\": 300000,\n \"time_entries\": 300000,\n \"time_entry_attachments\": 300000,\n \"time_off_requests\": 300000,\n \"version\": 300000,\n \"version_information\": 300000,\n \"zone_information\": 300000\n};\nexport const RESOURCE_KEY_BY_PATH: Readonly<Record<string, string>> = {\n \"/V1.0/Appointments\": \"appointments\",\n \"/V1.0/BillingCodes\": \"billing_codes\",\n \"/V1.0/BillingItems\": \"billing_items\",\n \"/V1.0/ChangeRequestLinks\": \"change_request_links\",\n \"/V1.0/ChecklistLibraries\": \"checklist_libraries\",\n \"/V1.0/ChecklistLibraryChecklistItems\": \"checklist_library_checklist_items\",\n \"/V1.0/ClassificationIcons\": \"classification_icons\",\n \"/V1.0/Companies\": \"companies\",\n \"/V1.0/CompanyAlerts\": \"company_alerts\",\n \"/V1.0/CompanyLocations\": \"company_locations\",\n \"/V1.0/CompanyNotes\": \"company_notes\",\n \"/V1.0/CompanySiteConfigurations\": \"company_site_configurations\",\n \"/V1.0/CompanyWebhooks\": \"company_webhooks\",\n \"/V1.0/ConfigurationItemBillingProductAssociations\": \"configuration_item_billing_product_associations\",\n \"/V1.0/ConfigurationItemCategories\": \"configuration_item_categories\",\n \"/V1.0/ConfigurationItemCategoryUdfAssociations\": \"configuration_item_category_udf_associations\",\n \"/V1.0/ConfigurationItemDnsRecords\": \"configuration_item_dns_records\",\n \"/V1.0/ConfigurationItemNotes\": \"configuration_item_notes\",\n \"/V1.0/ConfigurationItemRelatedItems\": \"configuration_item_related_items\",\n \"/V1.0/ConfigurationItemSslSubjectAlternativeNames\": \"configuration_item_ssl_subject_alternative_names\",\n \"/V1.0/ConfigurationItemTypes\": \"configuration_item_types\",\n \"/V1.0/ConfigurationItemWebhooks\": \"configuration_item_webhooks\",\n \"/V1.0/ConfigurationItems\": \"configuration_items\",\n \"/V1.0/ContactGroupContacts\": \"contact_group_contacts\",\n \"/V1.0/ContactGroups\": \"contact_groups\",\n \"/V1.0/ContactWebhooks\": \"contact_webhooks\",\n \"/V1.0/Contacts\": \"contacts\",\n \"/V1.0/ContractBillingRules\": \"contract_billing_rules\",\n \"/V1.0/ContractBlockHourFactors\": \"contract_block_hour_factors\",\n \"/V1.0/ContractBlocks\": \"contract_blocks\",\n \"/V1.0/ContractCharges\": \"contract_charges\",\n \"/V1.0/ContractExclusionBillingCodes\": \"contract_exclusion_billing_codes\",\n \"/V1.0/ContractExclusionRoles\": \"contract_exclusion_roles\",\n \"/V1.0/ContractExclusionSetExcludedRoles\": \"contract_exclusion_set_excluded_roles\",\n \"/V1.0/ContractExclusionSetExcludedWorkTypes\": \"contract_exclusion_set_excluded_work_types\",\n \"/V1.0/ContractExclusionSets\": \"contract_exclusion_sets\",\n \"/V1.0/ContractMilestones\": \"contract_milestones\",\n \"/V1.0/ContractNotes\": \"contract_notes\",\n \"/V1.0/ContractRates\": \"contract_rates\",\n \"/V1.0/ContractRetainers\": \"contract_retainers\",\n \"/V1.0/ContractRoleCosts\": \"contract_role_costs\",\n \"/V1.0/ContractServiceAdjustments\": \"contract_service_adjustments\",\n \"/V1.0/ContractServiceBundleAdjustments\": \"contract_service_bundle_adjustments\",\n \"/V1.0/ContractServiceBundleUnits\": \"contract_service_bundle_units\",\n \"/V1.0/ContractServiceBundles\": \"contract_service_bundles\",\n \"/V1.0/ContractServiceUnits\": \"contract_service_units\",\n \"/V1.0/ContractServices\": \"contract_services\",\n \"/V1.0/ContractTicketPurchases\": \"contract_ticket_purchases\",\n \"/V1.0/Contracts\": \"contracts\",\n \"/V1.0/Countries\": \"countries\",\n \"/V1.0/Departments\": \"departments\",\n \"/V1.0/DomainRegistrars\": \"domain_registrars\",\n \"/V1.0/ExpenseItemAttachments\": \"expense_item_attachments\",\n \"/V1.0/ExpenseItems\": \"expense_items\",\n \"/V1.0/ExpenseReports\": \"expense_reports\",\n \"/V1.0/HolidaySets\": \"holiday_sets\",\n \"/V1.0/Holidays\": \"holidays\",\n \"/V1.0/InventoryProducts\": \"inventory_products\",\n \"/V1.0/Invoices\": \"invoices\",\n \"/V1.0/NotificationHistory\": \"notification_history\",\n \"/V1.0/Opportunities\": \"opportunities\",\n \"/V1.0/OpportunityAttachments\": \"opportunity_attachments\",\n \"/V1.0/OpportunityCategories\": \"opportunity_categories\",\n \"/V1.0/Phases\": \"phases\",\n \"/V1.0/ProductVendors\": \"product_vendors\",\n \"/V1.0/Products\": \"products\",\n \"/V1.0/ProjectCharges\": \"project_charges\",\n \"/V1.0/ProjectNotes\": \"project_notes\",\n \"/V1.0/Projects\": \"projects\",\n \"/V1.0/PurchaseApprovals\": \"purchase_approvals\",\n \"/V1.0/PurchaseOrderItemReceiving\": \"purchase_order_item_receiving\",\n \"/V1.0/PurchaseOrderItems\": \"purchase_order_items\",\n \"/V1.0/PurchaseOrders\": \"purchase_orders\",\n \"/V1.0/QuoteItems\": \"quote_items\",\n \"/V1.0/QuoteLocations\": \"quote_locations\",\n \"/V1.0/QuoteTemplates\": \"quote_templates\",\n \"/V1.0/Quotes\": \"quotes\",\n \"/V1.0/ResourceRoleQueues\": \"resource_role_queues\",\n \"/V1.0/ResourceRoles\": \"resource_roles\",\n \"/V1.0/ResourceSkills\": \"resource_skills\",\n \"/V1.0/ResourceTimeOffAdditional\": \"resource_time_off_additional\",\n \"/V1.0/ResourceTimeOffApprovers\": \"resource_time_off_approvers\",\n \"/V1.0/ResourceTimeOffBalances\": \"resource_time_off_balances\",\n \"/V1.0/Resources\": \"resources\",\n \"/V1.0/Roles\": \"roles\",\n \"/V1.0/ServiceCallTaskResources\": \"service_call_task_resources\",\n \"/V1.0/ServiceCallTasks\": \"service_call_tasks\",\n \"/V1.0/ServiceCallTicketResources\": \"service_call_ticket_resources\",\n \"/V1.0/ServiceCallTickets\": \"service_call_tickets\",\n \"/V1.0/ServiceCalls\": \"service_calls\",\n \"/V1.0/ServiceLevelAgreementResults\": \"service_level_agreement_results\",\n \"/V1.0/Services\": \"services\",\n \"/V1.0/Skills\": \"skills\",\n \"/V1.0/SubscriptionPeriods\": \"subscription_periods\",\n \"/V1.0/Subscriptions\": \"subscriptions\",\n \"/V1.0/SurveyResults\": \"survey_results\",\n \"/V1.0/Surveys\": \"surveys\",\n \"/V1.0/TagAliases\": \"tag_aliases\",\n \"/V1.0/TagGroups\": \"tag_groups\",\n \"/V1.0/Tags\": \"tags\",\n \"/V1.0/TaskSecondaryResources\": \"task_secondary_resources\",\n \"/V1.0/Tasks\": \"tasks\",\n \"/V1.0/TicketAdditionalConfigurationItems\": \"ticket_additional_configuration_items\",\n \"/V1.0/TicketAdditionalContacts\": \"ticket_additional_contacts\",\n \"/V1.0/TicketAttachments\": \"ticket_attachments\",\n \"/V1.0/TicketCategories\": \"ticket_categories\",\n \"/V1.0/TicketCategoryFieldDefaults\": \"ticket_category_field_defaults\",\n \"/V1.0/TicketChangeRequestApprovals\": \"ticket_change_request_approvals\",\n \"/V1.0/TicketCharges\": \"ticket_charges\",\n \"/V1.0/TicketChecklistItems\": \"ticket_checklist_items\",\n \"/V1.0/TicketChecklistLibraries\": \"ticket_checklist_libraries\",\n \"/V1.0/TicketHistory\": \"ticket_history\",\n \"/V1.0/TicketNoteAttachments\": \"ticket_note_attachments\",\n \"/V1.0/TicketNoteWebhooks\": \"ticket_note_webhooks\",\n \"/V1.0/TicketNotes\": \"ticket_notes\",\n \"/V1.0/TicketSecondaryResources\": \"ticket_secondary_resources\",\n \"/V1.0/TicketWebhooks\": \"ticket_webhooks\",\n \"/V1.0/Tickets\": \"tickets\",\n \"/V1.0/TimeEntries\": \"time_entries\",\n \"/V1.0/TimeEntryAttachments\": \"time_entry_attachments\",\n \"/V1.0/TimeOffRequests\": \"time_off_requests\"\n};\n// [GENERATED:CACHETTL:END]\n","/**\n * BaseResource — shared scaffolding for every resource client\n * (ARCHITECTURE section 11).\n *\n * Concrete resources extend `BaseResource` and expose narrowly-typed public\n * methods that delegate to the protected primitives here. The base stays\n * generic about filters (the G3 `query.ts` builder is the single filter\n * surface; resources pass user filters through, never invent per-resource\n * filter sets).\n *\n * Wire contract (pinned, node-proven, UNVERIFIED-live — see G4 report):\n * - page 1: `POST /V1.0/<E>/query` with the `QueryModel` body\n * (`{ MaxRecords, IncludeFields?, filter }` — G3 `buildQueryRequest`).\n * - subsequent pages: the vendor returns an ABSOLUTE `pageDetails.nextPageUrl`\n * cursor; the walk POSTs the preserved filter to the cursor verbatim\n * (same-origin: stripped of the client base; cross-origin: re-based onto the\n * client base URL, mirroring the node's custom-zone behaviour) until\n * `nextPageUrl` is null. The 1000-page guard (`MAX_PAGES`) is enforced by\n * the G3 walker (`PaginationLimitError` before the 1001st fetch).\n * - `item: null` on a single GET is the vendor not-found signal →\n * `NotFoundError` (G3 `unwrapItem`).\n * - create/update/delete normalise `OperationResultModel { itemId }` (or\n * `{ id }`) to `{ id }`; attachment deletes return the deleted model.\n */\nimport {\n AutotaskConfigError,\n AutotaskError,\n isAutotaskError,\n NotFoundError,\n ResolutionError,\n StaleObjectError,\n} from '../errors.js';\nimport {\n buildQueryRequest,\n cursorToPath,\n unwrapItem,\n unwrapItems,\n unwrapOperation,\n unwrapQueryCount,\n type HttpClient,\n} from '../http.js';\nimport type { FieldCacheKind } from '../fieldCache.js';\nimport { DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE } from '../config.js';\nimport {\n MAX_PAGES,\n clampPageSize,\n paginate,\n paginateItems,\n collectAll,\n totalPagesFor,\n type PageFetcher,\n} from '../pagination.js';\nimport { buildFilter } from '../query.js';\nimport { REDACTED } from '../logger.js';\nimport { isRedactedFieldName, redactResponseBody, type RedactionPolicy } from '../redact.js';\nimport { isIdentifierCandidate, isRecord, parseIdentifier } from '../utils/index.js';\nimport { BLIND_SURFACE_STAMPS, DELETE_BOUNDARY_NOTES, EMPTY_REASON_STAMPS, RESPONSE_DRIFT_MARKERS, type BlindSurfaceInfo } from '../relationships.js';\nimport { RESOURCE_KEY_BY_PATH } from '../cache-ttl-tables.js';\nimport type {\n DryRunResult,\n EmptyReasonInfo,\n EntityInformationModel,\n Field,\n FieldDiff,\n FieldInformationModel,\n FilterCondition,\n FilterValue,\n Identifier,\n OperationResult,\n OperationShapeDrift,\n Page,\n QueryParams,\n Resolution,\n ResolutionCaps,\n UdfField,\n} from '../types/common.js';\n\n/** Resource description handed to `BaseResource` (one instance per resource). */\nexport interface BaseResourceConfig {\n /** Plan key / registry name, e.g. 'companies'. */\n key: string;\n /** Versioned global URL segment, e.g. '/V1.0/Companies'. */\n resourcePath: string;\n /** Versioned parent-scoped template, e.g. '/V1.0/Companies/{parentId}/Notes'. Absent for top-level. */\n parentScopedPath?: string;\n /** Parent field used to narrow the global query, e.g. 'companyID'. */\n parentField?: string;\n /** Whether the vendor defines DELETE for this entity (documented; the generated\n * surface decides method presence from the plan rows). */\n deletable?: boolean;\n /** Whether the entity is UDF-capable (create/update normalise a UDF map to\n * `userDefinedFields: [{ name, value }]`). */\n udfCapable?: boolean;\n /** Primary text fields the vendor indexes (plan `searchCovers`): `resolve`\n * (bare value) and `search` (bounded contains) query them; `[]` = id-only. */\n searchFields?: string[];\n /** The vendor field compared before a mutation (plan `staleCheck` column);\n * absent when the model lacks the field (`\"unavailable\"`). */\n staleField?: string;\n /** The parent entity's global path (parent-scoped resources only):\n * dry-run referenced-resource verification fetches `parentPath/{parentId}`. */\n parentPath?: string;\n /** Attachment models answer a bare MODEL on GET (quirk #9): dry-run and\n * stale-check current-record fetches use the model-shaped read for these. */\n attachmentGet?: boolean;\n /** D1: confirmed updates hit the COLLECTION path (`PUT /V1.0/<E>`, the\n * record id merged into the body) instead of the item path — the vendored\n * spec defines no put/patch on the item path for these resources (it is\n * GET-only; a PUT to it 405s). Derived from api-docs.json by\n * scripts/generate-batch.mjs; the drift guard is\n * test/resources/collection-update.test.ts (the flag set must equal the\n * spec-derived set). Absent/false = the item path (`PUT /V1.0/<E>/{id}`).\n * Top-level resources only (parent-scoped updates always route to the\n * scoped collection in `updateScopedRaw`). */\n collectionUpdate?: boolean;\n}\n\n/** The `queryBounded` default TOTAL record cap (server-side pagination). */\nexport const BOUNDED_QUERY_DEFAULT_LIMIT = 500;\n/** The `queryBounded` hard TOTAL record cap (an AutotaskConfigError above it). */\nexport const BOUNDED_QUERY_MAX_LIMIT = 2500;\n\n/** Issue #13: the marker-recovery search cap — ONE bounded query, this many matches max (a full page + a next cursor = truncated — never a guessed id). */\nexport const MARKER_RECOVERY_LIMIT = 5;\n\n/**\n * Issue #13: the deterministic shape descriptor of a drifted 2xx body —\n * the top-level keys (sorted) with their type classes, ONE level deep. No\n * vendor VALUES ride in it (the redaction-safe \"snippet\": a raw value could\n * be PII; the shape names the drift, the values never leave the tenant\n * except through the normal envelope).\n */\nexport function describeResponseShape(body: unknown): string {\n if (body === null) return 'null';\n if (Array.isArray(body)) return `array(len=${body.length})`;\n if (typeof body !== 'object') return typeof body;\n const rec = body as Record<string, unknown>;\n const keys = Object.keys(rec).sort();\n const typeOf = (v: unknown): string => (v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v);\n const parts = keys.slice(0, 16).map((k) => `${k}:${typeOf(rec[k])}`);\n const more = keys.length > 16 ? `, +${keys.length - 16} more` : '';\n return `{ ${parts.join(', ')}${more} }`;\n}\n\n/**\n * Issue #13: the default marker token from the request body — the `name`\n * value first, else the `title` value (the caller already knows the name it\n * sent; the campaign's drifted creates carried their marker there). Non-\n * empty string only; null = nothing to search (the typed error stands).\n */\nexport function defaultMarkerToken(data: Record<string, unknown>): string | null {\n for (const field of ['name', 'title'] as const) {\n const v = data[field];\n if (typeof v === 'string' && v.trim() !== '') return v.trim();\n }\n return null;\n}\n\n/**\n * Issue #36: the FK 'absent' negative-cache marker for the composite context\n * fetch (`BaseResource.contextFetch`). The marker lives in the SAME ReadCache\n * (no second cache) under a namespaced key the positive get path never\n * constructs — the normal `.get`/`resolve` 404 behaviour is bit-for-bit\n * untouched. Any defined value under the marker key means the FK target\n * answered a vendor not-found within the read entity's TTL.\n */\nconst CONTEXT_ABSENT_MARKER = '#context-absent';\n\n/** The marker key for a read path (the `\\u0000` suffix is unencodable in a wire path — no collision). */\nfunction contextAbsentKey(path: string): string {\n return path + '\\u0000context-absent';\n}\n\n/** Params for `queryBounded`: the query params + the TOTAL record cap. */\nexport interface BoundedQueryParams extends QueryParams {\n /**\n * TOTAL records to return (NOT a page size): default 500, hard max 2500\n * (above it throws AutotaskConfigError). The internal walk chooses the\n * page size (min(500, limit)); `maxRecords` is ignored by this method.\n */\n limit?: number;\n}\n\n/** The bounded, complete-enough result of `queryBounded`. */\nexport interface BoundedQueryResult<T> {\n items: T[];\n /** Total records returned (= items.length). */\n fetched: number;\n /**\n * True when the walk was truncated (by the limit or the 1000-page guard)\n * AND more records exist past the stop point: a non-null next cursor was\n * seen at the stop, or the final page had to be sliced to meet the limit.\n */\n hasMore: boolean;\n /** Pages fetched by the internal walk. */\n pagesWalked: number;\n /**\n * Deliberately always omitted: the vendor documents `pageDetails.count` as\n * the CURRENT PAGE's record count (not a total), so it must never be\n * surfaced as a total here — `<resource>.count` is the total.\n */\n count?: number;\n /**\n * S12-C (T10): the typed blind-surface sentinel — present ONLY when the\n * walk returned zero items on a plan-pinned blind surface (`unfiltered-blind`\n * surfaces additionally require the call to be unfiltered). Additive: the\n * walk values above are never mutated. The stamp derives from\n * plan.blindSurfaces (generated src/relationships.ts) and carries the zone\n * fact + the `get(id)`-is-the-authority remedy (docs/API.md §11.7).\n */\n blindSurface?: BlindSurfaceInfo;\n /**\n * Issue #14: the typed empty-reason on a 0-item walk — the blind pin\n * synthesizes the `blind-surface` reason (the sentinel's byte-identical\n * note); a plan-pinned empty-for-user surface rides its reason directly.\n * Additive: items/fetched/hasMore are never mutated.\n */\n emptyReason?: EmptyReasonInfo;\n}\n\n/**\n * Issue #14: synthesize the `blind-surface` empty-reason from a pinned\n * sentinel — the note is the pin's BYTE-IDENTICAL note (the six existing\n * sentinels keep their current wording; the reason field is additive).\n */\nfunction blindEmptyReason(stamp: BlindSurfaceInfo): EmptyReasonInfo {\n return {\n surface: stamp.surface,\n kind: 'blind-surface',\n note: stamp.note,\n authority: stamp.authority,\n remedy: 'the note is the remedy — the authority op answers for a record',\n };\n}\n\n/**\n * Issue #14: override a target-miss error's empty-reason with the pinned\n * UPDATE row (the update's own target read — the merge read / the stale\n * guard's read — is the op's own step; the generic `.get` not-found reason\n * the transport attached does not explain an UPDATE miss). Additive: the\n * error code / status / message are untouched.\n */\nfunction attachUpdateTargetMissReason(err: AutotaskError, key: string): void {\n const pinned = EMPTY_REASON_STAMPS[key]?.update;\n if (pinned === undefined) return;\n err.details = { ...(err.details ?? {}), emptyReason: pinned };\n}\n\n/**\n * S12-C (T10): the result of `count` on a plan-pinned blind surface — the\n * ONE case where `count` returns an object instead of a plain number. The\n * value is always 0 (a non-zero count is returned as the plain number), and\n * the typed sentinel states the zone fact + the `get(id)`-is-the-authority\n * remedy (a 0/empty result on a blind surface proves nothing).\n */\nexport interface BlindCountResult {\n /** The count value (always 0 when the sentinel is present). */\n count: number;\n /** The typed blind-surface sentinel (the zone fact + the authority remedy). */\n blindSurface: BlindSurfaceInfo;\n}\n\n/** Per-walk cursor state (one closure per `query`/`queryAll`/`queryBounded` call — walks never share state). */\ninterface QueryWalkState {\n /** Absolute `pageDetails.nextPageUrl` from the previous page. */\n cursor: string | null;\n}\n\n/** Normalised result of a `createIfNotExists` composition. */\nexport interface CreateIfNotExistsResult<T> {\n /** The existing (match) or newly created record id. */\n id: Identifier;\n /** `false` when a dedup match short-circuited the create. */\n created: boolean;\n /** The matched record (present when `created` is false). */\n existing?: T;\n}\n\n/**\n * Mutation options accepted by EVERY mutation (section 19.3): the dry-run\n * flag and the caller-observed `lastModifiedDate` for the stale-object guard.\n */\nexport interface MutationOpts {\n /**\n * Simulate: the mutating request is NEVER issued. The op performs input\n * validation, referenced-resource verification, duplicate detection where\n * a reliable lookup exists and the stale-object check, then returns the\n * pinned `DryRunResult` envelope (`simulated: true` is mandatory).\n */\n dryRun?: boolean;\n /**\n * The `lastModifiedDate` last observed by the caller. When the resource's\n * model carries the plan's `staleCheck` field, the vendor's current value\n * is compared before the mutation; a mismatch throws `STALE_OBJECT`.\n * Ignored where the model lacks the field.\n */\n lastModifiedDate?: string;\n /**\n * `update` only, `collectionUpdate` resources: send the caller's body RAW\n * (as-is, after the usual UDF normalisation) — NO merge into the current\n * record and no merge read. The compatibility escape hatch: full models\n * and intentional partials that the vendor accepts pass straight through,\n * exactly the pre-merge wire. With a `lastModifiedDate` token the stale\n * guard still performs its own verification read. Ignored by create/delete\n * and by non-collectionUpdate updates (their item-path PUT has no merge to\n * switch off).\n */\n raw?: boolean;\n}\n\n/**\n * Issue #13: the create-path response-shape-drift recovery options\n * (create only — update/delete take the plain `MutationOpts`). When the plan\n * pins a `responseDrift` marker field for the resource and a create answers\n * 2xx with a body that is NOT the specced envelope (or an `{ id }` /\n * `{ itemId }` alternative), ONE bounded read-only query on the resource's\n * own surface looks for the caller's marker; exactly one numeric match\n * yields the normal success result stamped `idFrom: 'marker-recovery'` +\n * `shapeDrift`, anything else keeps the existing `INVALID_RESPONSE` with the\n * drift detail (candidate ids listed — never a guessed id).\n *\n * PRECONDITION (the honest scope, post-verification): recovery can only find\n * what the caller stamped. The default `markerToken` is the request body's\n * `name` (else `title`) — the campaign convention, where drift-creating\n * callers stamp a unique marker there; a create with no unique marker yields\n * 0 or many matches and the typed refusal stands (recovery declines to\n * guess). Callers with a marker elsewhere pass `markerToken`/`markerField`\n * explicitly.\n *\n * The search is COLLECTION-LEVEL on purpose: the single condition is\n * `markerField contains token` — it is NOT narrowed by the parent (e.g.\n * ticketID) because this resource's query filter field set is not\n * live-verifiable here (the pinned field `name` is itself absent from the\n * vendored model — an unverified filter field would risk a vendor 500 and\n * convert a working recovery into a failure). A unique marker token makes\n * the collection-wide contains functionally scoped; a non-unique marker is\n * exactly the 0/many case the refusal contract covers (never a guessed id).\n * The option bag reaches create through the typed client API;\n * the governed/MCP create path (`operations.invoke` / `autotask_write`) has\n * no options slot, so there recovery is always on where the plan pins a\n * marker field (the opt-out is typed-client-only).\n */\nexport interface CreateRecoveryOpts {\n /** The marker field to search (default: the plan-pinned `responseDrift` marker field for the resource). */\n markerField?: string;\n /** The marker token to search for (default: the request body's `name`, else `title`, value). */\n markerToken?: string;\n /** Run the bounded marker recovery on a drifted create response (default: true where the plan pins a marker field; `false` restores the pre-recovery behaviour exactly — the typed error stands, zero extra requests). */\n recoverIdFromMarker?: boolean;\n}\n\n/** The mutation options accepted by a `create` (the shared `MutationOpts` + the issue #13 recovery bag). */\nexport type CreateOpts = MutationOpts & CreateRecoveryOpts;\n\n/** One dry-run check entry (`checks: [{ name, ok, note? }]` in the envelope). */\nexport interface DryRunCheck {\n name: string;\n ok: boolean;\n /**\n * Issue #14: the deterministic one-line note for the check (e.g. the\n * pinned empty-reason note on a `current-record-exists` miss) — additive.\n */\n note?: string;\n}\n\n/** Input to the pinned dry-run envelope builder (per-op paths assemble it). */\nexport interface DryRunSpec<TData> {\n /** The registry operation name, e.g. `companies.update`. */\n operation: string;\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n /** The path that WOULD be hit. */\n path: string;\n /** The affected record ids (empty for a create that targets no id yet). */\n ids: Identifier[];\n checks: DryRunCheck[];\n impact: { affected: number; scope: string; reversible: boolean };\n /** Present only when the current record is fetchable (updates). */\n diff?: FieldDiff[];\n /** The typed input that would be applied (present for writes). */\n data?: TData;\n warnings?: string[];\n /** Issue #14: the typed empty-reason for a target-miss dry run (additive). */\n emptyReason?: EmptyReasonInfo;\n}\n\n/**\n * Assemble the pinned dry-run envelope (section 19.3). `simulated: true` is\n * mandatory and the builder cannot produce anything else; `wouldApply` is\n * derived from the checks (any failing check refuses the would-be mutation).\n *\n * Input-echo redaction (INV-E M3): the caller-input fields (`data` and\n * `diff[].to`) are assembled IN-PROCESS — they never cross the 2xx choke\n * point — so the SAME shared transform (`redactResponseBody`) with the SAME\n * resolved policy applies at this single envelope site, before the envelope\n * is returned: SECRET is always redacted (no opt-out), PII + CONFIDENTIAL per\n * `redactPersonalData`. The parameter defaults to `true` — the safe\n * direction: a call site that does not thread the resolved policy redacts\n * MORE, never less. `diff[].from` is the vendor-fetched current value\n * (already redacted at the choke point); the remaining envelope fields are\n * derived, not caller input.\n */\nexport function buildDryRunResult<TData>(\n spec: DryRunSpec<TData>,\n policy: RedactionPolicy = { redactPersonalData: true },\n): DryRunResult<TData> {\n if (spec.operation === '') {\n throw new AutotaskConfigError('dry-run: the operation name is required');\n }\n const wouldApply = spec.checks.every((check) => check.ok);\n const resource = spec.operation.split('.')[0] ?? spec.operation;\n const diffPart =\n spec.diff !== undefined\n ? {\n diff: spec.diff.map((entry) => {\n if (entry.to === undefined) return entry;\n // `to` is the caller's input VALUE for `entry.field`: the transform\n // is key-name based, so a pinned field name carries the marker\n // directly; a non-pinned field's value gets the same deep scan the\n // response transform applies (nested pinned keys inside objects/\n // arrays are still caught).\n const to = isRedactedFieldName(entry.field, policy)\n ? REDACTED\n : redactResponseBody(entry.to, policy);\n return { ...entry, to };\n }),\n }\n : {};\n const dataPart = spec.data !== undefined ? { data: redactResponseBody(spec.data, policy) as TData } : {};\n return {\n operation: spec.operation,\n wouldApply,\n target: { resource, ids: spec.ids },\n request: { method: spec.method, path: spec.path },\n ...diffPart,\n checks: spec.checks,\n impact: spec.impact,\n simulated: true,\n warnings: spec.warnings ?? [],\n ...dataPart,\n ...(spec.emptyReason !== undefined ? { emptyReason: spec.emptyReason } : {}),\n };\n}\n\n/**\n * Best-effort before/after diff for an update dry-run: one entry per field\n * the caller would set (the always-present `id` is excluded; fields whose\n * value would not change are omitted).\n */\nexport function computeFieldDiff(current: Record<string, unknown>, data: object): FieldDiff[] {\n const out: FieldDiff[] = [];\n for (const [field, to] of Object.entries(data as Record<string, unknown>)) {\n if (field === 'id' || to === undefined) continue;\n const from = current[field];\n if (from !== undefined && JSON.stringify(from) === JSON.stringify(to)) continue;\n out.push({ field, from: from === undefined ? null : from, to });\n }\n return out;\n}\n\n/**\n * V2 partial-update merge: overlay a caller's partial `data` onto the\n * record's CURRENT full model (the vendor's top-level collection PUT\n * validates the FULL model — a partial body is rejected with 500 'Missing\n * Required Field'). Pinned semantics:\n * - an explicit `null` in `data` sends null (caller intent to clear);\n * - an `undefined` value (or a key the caller omitted) keeps the current\n * value — it is never written to the merged body;\n * - every other key overrides the current value wholesale (no per-name\n * merge inside `userDefinedFields` or other nested fields);\n * - pure: neither argument is mutated; `id` is re-asserted by the caller\n * (`updateGlobal`) after the merge.\n */\nexport function mergePartialBody(\n current: Record<string, unknown>,\n data: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...current };\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) continue; // keep the current value\n merged[key] = value; // explicit null sends null; anything else overrides\n }\n return merged;\n}\n\n/** Normalise a user UDF input (map or array) to `userDefinedFields: [{ name, value }]`. */\nfunction normalizeUdfInput(value: unknown): UdfField[] {\n if (Array.isArray(value)) {\n return value.map((entry) => {\n if (!isRecord(entry) || typeof entry.name !== 'string' || entry.name === '') {\n throw new AutotaskConfigError('userDefinedFields array entries must be { name, value } objects');\n }\n return { name: entry.name, value: entry.value };\n });\n }\n if (isRecord(value)) {\n return Object.entries(value).map(([name, entryValue]) => ({ name, value: entryValue }));\n }\n throw new AutotaskConfigError('userDefinedFields must be an array of { name, value } entries or a name-to-value map');\n}\n\n/** Extract the bare conditions array from a user `filter` param (Filter or conditions[]). */\nfunction normalizedConditions(filter: QueryParams['filter']): FilterCondition[] | undefined {\n if (filter === undefined) return undefined;\n return Array.isArray(filter) ? filter : filter.filter;\n}\n\n/**\n * S12-C (T10) post-merge P1: the single filter-aware stamp predicate for the\n * blind-surface sentinel — the ONE place the `kind` → stamp decision lives\n * (the query wrap, the count wrap, and the `companies.fullProfile`\n * open-tickets part all use it, so no consumer can drift):\n * - `unowned-blind` / `fully-blind`: stamps regardless of filter — the\n * surface is blind in every scope (companies not owned by the caller are\n * invisible to count/query no matter the filter).\n * - `unfiltered-blind`: stamps ONLY the unfiltered call — the vendor's\n * filtered query returns data (live-verified S12-B P1: 3 open tickets via\n * a companyID+status filter), so a filtered empty result is a TRUE\n * ABSENCE, never a sentinel.\n */\nexport function blindStampFor(\n stamp: BlindSurfaceInfo | undefined,\n filter: QueryParams['filter'] | undefined,\n): BlindSurfaceInfo | undefined {\n if (stamp === undefined) return undefined;\n if (stamp.kind !== 'unfiltered-blind') return stamp;\n const conditions = normalizedConditions(filter);\n return conditions === undefined || conditions.length === 0 ? stamp : undefined;\n}\n\n/** Decode a file envelope (FileQueryResultModel) or a top-level base64 string into a Buffer. */\nexport function decodeFileData(body: unknown): Buffer {\n if (isRecord(body)) {\n const data = body.data;\n if (typeof data === 'string') return Buffer.from(data, 'base64');\n if (Array.isArray(data) && data.every((b) => typeof b === 'number')) {\n return Buffer.from(data as number[]);\n }\n }\n if (typeof body === 'string') return Buffer.from(body, 'base64');\n throw new AutotaskError(\n 'Expected the file envelope FileQueryResultModel { data } (or a base64 string); got a different shape',\n { code: 'INVALID_RESPONSE', category: 'server' },\n );\n}\n\nexport abstract class BaseResource<\n T = Record<string, unknown>,\n TCreate = Record<string, unknown>,\n TUpdate = Record<string, unknown>,\n> {\n protected readonly http: HttpClient;\n protected readonly config: BaseResourceConfig;\n /** Default page size for query walks (the client's resolved `pageSize`). */\n protected readonly defaultPageSize: number;\n\n /** Versioned global URL segment (from the config), e.g. '/V1.0/Companies'. */\n protected get resourcePath(): string {\n return this.config.resourcePath;\n }\n\n /** Parent-scoped template (from the config); undefined for top-level resources. */\n protected get parentScopedPath(): string | undefined {\n return this.config.parentScopedPath;\n }\n\n /** Parent field used to narrow the global query (from the config). */\n protected get parentField(): string | undefined {\n return this.config.parentField;\n }\n\n /** The bounded client-scan caps (section 19.2; resolved per client). */\n protected get resolutionCaps(): ResolutionCaps {\n return this.http.resolution;\n }\n\n constructor(http: HttpClient, config: BaseResourceConfig, pageSize?: number) {\n if (config.key === '' || config.resourcePath === '') {\n throw new AutotaskConfigError('BaseResource requires a non-empty key and resourcePath');\n }\n this.http = http;\n this.config = config;\n this.defaultPageSize = clampPageSize(pageSize ?? DEFAULT_PAGE_SIZE);\n }\n\n // ------------------------------------------------------------------\n // Query walk (wired to the G3 walker; cursor-follow per the pinned wire)\n // ------------------------------------------------------------------\n\n /** One page fetch: page 1 POSTs the QueryModel body; later pages POST the filter to the absolute cursor. */\n protected async fetchPage(params: QueryParams, page: number, pageSize: number, state: QueryWalkState): Promise<Page<T>> {\n const operation = `${this.config.key}.query`;\n if (page === 1) {\n const req = buildQueryRequest(this.http.baseUrl, this.resourcePath, { ...params, maxRecords: pageSize });\n const body = await this.http.request<unknown>({ ...req, operation });\n return this.readPage(body, page, pageSize, state);\n }\n const cursor = state.cursor;\n if (cursor === null) {\n throw new AutotaskError(`No pagination cursor available for page ${page} of ${operation}`, {\n code: 'INVALID_RESPONSE',\n category: 'server',\n operation,\n });\n }\n const conditions = normalizedConditions(params.filter);\n const body: Record<string, unknown> = { filter: conditions === undefined ? [] : buildFilter(conditions).filter };\n const res = await this.http.request<unknown>({\n method: 'POST',\n path: cursorToPath(this.http.baseUrl, cursor),\n body,\n operation,\n idempotent: true,\n });\n return this.readPage(res, page, pageSize, state);\n }\n\n private readPage(body: unknown, page: number, pageSize: number, state: QueryWalkState): Page<T> {\n const { items, pageDetails } = unwrapItems<T>(body, `${this.config.key}.query`);\n state.cursor = pageDetails.nextPageUrl;\n const totalPages = totalPagesFor(pageDetails.requestCount, pageSize);\n return {\n items,\n page,\n pageSize,\n requestCount: pageDetails.requestCount,\n totalPages,\n // The vendor's nextPageUrl is the continuation signal (node-proven: the walk\n // follows the cursor until it is null; the 1000-page guard caps pathological loops).\n hasMore: state.cursor !== null,\n };\n }\n\n /** Build the per-walk fetcher (closure keeps cursor state private to this walk). */\n protected pageFetcher(params?: QueryParams): PageFetcher<T> {\n const state: QueryWalkState = { cursor: null };\n const p = params ?? {};\n return (page, pageSize) => this.fetchPage(p, page, pageSize, state);\n }\n\n private walkPageSize(params?: QueryParams): number {\n return clampPageSize(params?.maxRecords ?? this.defaultPageSize);\n }\n\n /** Stream items across pages (the resource `query` surface). */\n protected queryItems(params?: QueryParams): AsyncIterable<T> {\n return paginateItems<T>(this.pageFetcher(params), { pageSize: this.walkPageSize(params) });\n }\n\n /** Stream page objects (the resource `queryPages` surface). */\n protected queryPageIter(params?: QueryParams): AsyncIterable<Page<T>> {\n return paginate<T>(this.pageFetcher(params), { pageSize: this.walkPageSize(params) });\n }\n\n /** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded). */\n protected async queryAllItems(params?: QueryParams): Promise<T[]> {\n return collectAll<T>(this.pageFetcher(params), { pageSize: this.walkPageSize(params), maxRecords: params?.maxTotalRecords });\n }\n\n /**\n * `queryBounded` — server-side pagination (the MCP query surface): ONE call\n * walks the vendor cursor internally until `limit` TOTAL records are\n * collected or the cursor is exhausted, and returns a bounded,\n * complete-enough result. The client never owns the walk:\n * - `limit` = total records (default 500, hard max 2500 — above it throws\n * AutotaskConfigError; it is NOT a page size). The page-1 request uses\n * the internal page size min(500, limit); follow-up pages POST the\n * preserved filter to the absolute cursor verbatim (the pinned wire:\n * MaxRecords/IncludeFields are baked into the cursor — never changed\n * mid-walk), so the walk reuses `fetchPage` (the shared cursor machinery)\n * with a per-walk closure state (walks never share state).\n * - The 1000-page guard still applies as a SOFT stop: a walk that would\n * fetch a 1001st page stops with `hasMore: true` (never a throw — this\n * is a bounded read, not the `paginate` generator's error path).\n * - `hasMore` = (truncated by limit OR guard) AND (a non-null next cursor\n * was seen at the stop point OR the final page was sliced to meet the\n * limit). Cursor exhausted, or a short/empty page with no truncation →\n * false (never claims more than the cursor + the slice say exist).\n * - `count` is always omitted: `pageDetails.count` is the current page's\n * record count (vendor-documented), never a total — `<resource>.count`\n * is the total.\n * Pure read; no mutation paths involved.\n */\n async queryBounded(params?: BoundedQueryParams): Promise<BoundedQueryResult<T>> {\n if (Array.isArray(params)) {\n throw new AutotaskConfigError(\n 'queryBounded: params must be an object { filter?, limit?, includeFields? } — a bare conditions array is not accepted (wrap it: { filter: [...] })',\n );\n }\n const limit = params?.limit ?? BOUNDED_QUERY_DEFAULT_LIMIT;\n if (!Number.isInteger(limit) || limit < 1 || limit > BOUNDED_QUERY_MAX_LIMIT) {\n throw new AutotaskConfigError(\n `queryBounded: limit must be an integer 1..${BOUNDED_QUERY_MAX_LIMIT} (got ${String(limit)}) — it is the TOTAL record cap, not a page size`,\n );\n }\n const state: QueryWalkState = { cursor: null }; // per-walk closure (walks never share state)\n const p: QueryParams = params ?? {}; // fetchPage reads params.filter on follow-up pages\n const items: T[] = [];\n let pages = 0;\n let sliced = 0;\n let guard = false;\n const pageSize = Math.min(MAX_PAGE_SIZE, limit);\n for (;;) {\n if (pages >= MAX_PAGES) {\n guard = true; // the 1000-page guard: refuse the 1001st fetch, report hasMore\n break;\n }\n const page = await this.fetchPage(p, pages + 1, pageSize, state);\n pages += 1;\n const remaining = limit - items.length;\n const take = page.items.slice(0, remaining);\n sliced += Math.max(0, page.items.length - remaining);\n items.push(...take);\n if (items.length >= limit) break; // the limit was met (possibly mid-page)\n if (!page.hasMore || page.items.length === 0) break; // cursor exhausted (or a short empty page ends the walk, like paginate)\n }\n const hasMore = (items.length >= limit || guard) && (sliced > 0 || state.cursor !== null);\n const result: BoundedQueryResult<T> = { items, fetched: items.length, hasMore, pagesWalked: pages };\n // S12-C (T10): the typed blind-surface sentinel (additive — the walk\n // values are never mutated). Stamped only on the blind shape (zero\n // items) for a plan-pinned surface, through the filter-aware predicate\n // `blindStampFor` (`unfiltered-blind` surfaces stamp ONLY the unfiltered\n // call — a filtered empty result is a true absence; live-verified\n // S12-B P1: the filtered tickets.query returns data on ww29).\n if (items.length === 0) {\n result.blindSurface = blindStampFor(BLIND_SURFACE_STAMPS[this.config.key]?.query, params?.filter);\n // Issue #14: the typed empty-reason (the SAME source as the sentinel —\n // the blind pin synthesizes the `blind-surface` reason; a plan-pinned\n // empty-for-user surface rides its reason directly). Additive: the\n // walk values above are never mutated.\n // The PINNED reason is filter-aware like the blind stamps (post-\n // verification F1): a FILTERED empty walk on a pinned surface is a\n // true absence in that filter's scope, never a tenant-scope claim —\n // the pin states \"EMPTY FOR THIS API USER\" across the whole surface,\n // which a filter-scope 0 does not establish (no speculation).\n const pinnedReason =\n normalizedConditions(params?.filter) === undefined\n ? EMPTY_REASON_STAMPS[this.config.key]?.query\n : undefined;\n if (result.blindSurface !== undefined || pinnedReason !== undefined) {\n result.emptyReason =\n result.blindSurface !== undefined ? blindEmptyReason(result.blindSurface) : pinnedReason;\n }\n }\n return result;\n }\n\n // ------------------------------------------------------------------\n // Count\n // ------------------------------------------------------------------\n\n /** `POST /V1.0/<E>/query/count` → `queryCount` unwrapped to a plain number —\n * or, on a plan-pinned blind surface, the `{ count: 0, blindSurface }`\n * typed sentinel (S12-C T10; see `BlindCountResult`). */\n protected async countGlobal(params?: QueryParams): Promise<number> {\n const conditions = normalizedConditions(params?.filter);\n const body: Record<string, unknown> = {};\n // ALWAYS send a `filter` field — node parity: the n8n node defaults the\n // count filter to `{ filter: [] }` (executeCount in base-operation.ts).\n // Some zone API versions NRE on a missing filter field (live-verified\n // 2026-10-01 against the AU03/ww29 tenant: 500 `{\"errors\":[\"Value\n // cannot be null. Parameter name: filters\"]}`); an empty array is the\n // vendor-accepted no-filter shape (the swagger marks it optional, the\n // live zone does not).\n body.filter = conditions === undefined ? [] : buildFilter(conditions).filter;\n const res = await this.http.request<unknown>({\n method: 'POST',\n path: `${this.resourcePath}/query/count`,\n body,\n operation: `${this.config.key}.count`,\n idempotent: true,\n });\n const count = unwrapQueryCount(res, `${this.config.key}.count`);\n // S12-C (T10): the typed blind-surface sentinel (plan pin: the served\n // `count` op takes no filter arg — a 0 on a plan-pinned surface is always\n // the blind shape, so it is always stamped). Additive +\n // classification-neutral: a non-zero count returns the plain number;\n // the sentinel only replaces a 0 and its `count` value is that same 0.\n // The declared `number` return is a deliberate under-type: the 116\n // generated concrete `count()` methods declare `Promise<number>` and\n // S12-C touches base.ts only (the runtime union is `BlindCountResult`,\n // pinned by test/resources/blind-surface.test.ts).\n // Post-merge P1: the SAME filter-aware predicate as the query wrap —\n // the vendor count takes the same filter shape, so a FILTERED count=0\n // on an `unfiltered-blind` surface is a true absence, never a sentinel.\n const stamp = blindStampFor(BLIND_SURFACE_STAMPS[this.config.key]?.count, params?.filter);\n if (count === 0) {\n // Issue #14: the typed empty-reason channel. The blind pin synthesizes\n // the `blind-surface` reason (the sentinel's byte-identical note); a\n // plan-pinned empty-for-user surface (no blind pin) rides its reason\n // directly. Additive + classification-neutral: the count value is that\n // same 0 — the reason only replaces the plain 0 in the pinned cases.\n // The pinned reason is filter-aware (post-verification F1): a FILTERED\n // count=0 on a pinned surface is a true absence in that scope, never\n // the tenant-scope claim the pin makes — the pin rides only the\n // unfiltered call (the same predicate as the blind stamps).\n const pinnedReason =\n conditions === undefined ? EMPTY_REASON_STAMPS[this.config.key]?.count : undefined;\n if (stamp !== undefined || pinnedReason !== undefined) {\n return {\n count,\n ...(stamp !== undefined ? { blindSurface: stamp } : {}),\n emptyReason: stamp !== undefined ? blindEmptyReason(stamp) : pinnedReason,\n } as unknown as number;\n }\n }\n return count;\n }\n\n // ------------------------------------------------------------------\n // Single-record reads\n // ------------------------------------------------------------------\n\n /** Single-record GET through the opt-in read cache (off by default: with\n * no cache this is exactly one `http.request`). Only the successful\n * (already redacted) body is stored — errors throw before `set`.\n * `fresh` skips the lookup (the read still refreshes the entry for the\n * other callers): mutation-path reads (stale-object guard, dry-run diff)\n * and the composite ROOT read of a hot resource (issue #36 — the\n * ticket-composite root) must see the live record, never a snapshot.\n * `resource` (issue #32) is the plan key of the entity this path\n * points to: the stored entry's TTL is the per-resource override for\n * that key when `cache.perResourceTtlMs` names it, else `ttlMs`. */\n private async cachedGet(path: string, operation: string, fresh = false, resource?: string): Promise<unknown> {\n const cache = this.http.readCache;\n if (cache !== undefined && !fresh) {\n const hit = cache.get(path);\n if (hit !== undefined) return hit;\n }\n const res = await this.http.request<unknown>({ method: 'GET', path, operation });\n cache?.set(path, res, resource);\n return res;\n }\n\n /**\n * Entity-metadata read through the opt-in field cache (issue #31; off by\n * default: with no fieldCache this is exactly one `http.request` — the\n * bit-for-bit uncached trio path). One private helper beside `cachedGet`,\n * for the same three reasons the read cache exists: a vendor drift\n * (deterministic 500, INVALID_RESPONSE) must not be served stale, repeat\n * reads must not pay the wire, and concurrent callers must not issue\n * duplicate requests. The UNWRAPPED value is stored (never the raw\n * envelope); an EMPTY or FAILED result is never cached (a failure\n * rejects before any `set`; an empty is refused by the cache itself);\n * concurrent callers share ONE in-flight wire request; the drift signal\n * (the INVALID_RESPONSE shape drift, the deterministic validation 500)\n * invalidates THIS entity's entries so the next call refetches\n * (transport-level signals are also invalidated in the transport's own\n * catch — the two sites cover the 2xx and non-2xx halves). `fresh`\n * skips the lookup: fetch live and refresh the entries.\n */\n private async cachedMeta<T>(\n kind: FieldCacheKind,\n path: string,\n operation: string,\n unwrap: (body: unknown) => T,\n fresh = false,\n ): Promise<T> {\n const cache = this.http.fieldCache;\n if (cache === undefined) {\n const res = await this.http.request<unknown>({ method: 'GET', path, operation });\n return unwrap(res);\n }\n const key = this.config.key;\n if (!fresh) {\n const shared = cache.inflight(key, kind);\n if (shared !== undefined) return shared as Promise<T>;\n const hit = cache.get(key, kind);\n if (hit !== undefined) return hit as T;\n }\n const work = this.http\n .request<unknown>({ method: 'GET', path, operation })\n .then((body) => {\n const value = unwrap(body);\n cache.set(key, kind, value); // a no-op for an empty value (never cached)\n return value;\n });\n // The drift signal: a rejection (the INVALID_RESPONSE shape drift, the\n // deterministic validation 500) drops this entity's entries — the next\n // call refetches. A failure is never cached (the promise rejects; the\n // in-flight entry is dropped on settle).\n work.catch((err: unknown) => {\n if (err instanceof AutotaskError && (err.code === 'INVALID_RESPONSE' || err.details?.deterministic === true)) {\n cache.invalidate(key);\n }\n });\n return cache.track(key, kind, work) as Promise<T>;\n }\n\n /** `GET /V1.0/<E>/{id}` → `{ item }` unwrapped (`item: null` → NotFoundError). */\n protected async getGlobal(id: Identifier, fresh = false): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.cachedGet(`${this.resourcePath}/${numeric}`, `${this.config.key}.get`, fresh, this.config.key);\n return unwrapItem<T>(res, numeric, `${this.config.key}.get`);\n }\n\n /**\n * V2 merge read: a FRESH single-record GET that skips response redaction\n * (the `skipResponseRedaction` transport flag). The merge round-trips the\n * record's own current values back to the same vendor endpoint in the\n * confirmed PUT — redacting this read would write literal '[REDACTED]'\n * markers into the merged body (corruption on live records; the caller\n * never sees the values: the PUT answers `{ id }`, and the request-body\n * audit keeps logging redacted). Never cached: mutation-path reads must\n * see the live record, and an unredacted body must not enter the\n * (redacted-view) read cache.\n */\n protected async getGlobalUnredacted(id: Identifier): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.http.request<unknown>({\n method: 'GET',\n path: `${this.resourcePath}/${numeric}`,\n operation: `${this.config.key}.get`,\n skipResponseRedaction: true,\n });\n return unwrapItem<T>(res, numeric, `${this.config.key}.get`);\n }\n\n /**\n * Issue #34 fallback merge read: a FRESH parent-scoped single-record GET\n * that skips response redaction and is never cached (the same invariants\n * as `getGlobalUnredacted`, on the scoped item path — the spec's readable\n * route for parent-scoped children). The merged retry body round-trips the\n * record's own current values: a redacted read would write literal\n * '[REDACTED]' markers into the fallback PUT (corruption on live records).\n */\n protected async getScopedUnredacted(parentId: Identifier, id: Identifier): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.http.request<unknown>({\n method: 'GET',\n path: this.scopedItemPath(parentId, numeric),\n operation: `${this.config.key}.get`,\n skipResponseRedaction: true,\n });\n return unwrapItem<T>(res, numeric, `${this.config.key}.get`);\n }\n\n /** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */\n protected async getScopedRaw(parentId: Identifier, id: Identifier, fresh = false): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh, this.config.key);\n return unwrapItem<T>(res, numeric, `${this.config.key}.get`);\n }\n\n /**\n * Attachment single-read: the vendor answers the model DIRECTLY (swagger),\n * while the node observed `{ items: [model] }` for some attachment GETs —\n * accept all three shapes; empty/null → NotFoundError.\n */\n protected async getScopedModel(parentId: Identifier, id: Identifier, fresh = false): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.cachedGet(this.scopedItemPath(parentId, id), `${this.config.key}.get`, fresh, this.config.key);\n return this.unwrapModelLike<T>(res, numeric);\n }\n\n private unwrapModelLike<U>(body: unknown, id: Identifier): U {\n if (!isRecord(body)) {\n throw new AutotaskError(\n `Expected an attachment model (or { item } / { items }) envelope for ID ${id}; got a different shape`,\n { code: 'INVALID_RESPONSE', category: 'server', resourceIds: [id] },\n );\n }\n // FULL100 F5: the vendor's 200 empty-object miss shape (the global\n // attachment item path answers missing ids 200 + `{}`) is a TYPED miss —\n // a miss is never a bare zero (the S12-E2E D1 contract).\n if (Object.keys(body).length === 0) {\n throw new NotFoundError(`The record with ID ${id} was not found`, { httpStatus: 200, resourceIds: [id] });\n }\n if ('item' in body) return unwrapItem<U>(body, id);\n if (Array.isArray(body.items)) {\n const first = body.items[0];\n if (first === null || first === undefined) {\n throw new NotFoundError(`The record with ID ${id} was not found`, { httpStatus: 200, resourceIds: [id] });\n }\n return first as U;\n }\n return body as U;\n }\n\n // ------------------------------------------------------------------\n // Mutations\n // ------------------------------------------------------------------\n\n /** Normalise a mutation body: `id` OR `itemId` → `id`; UDF map → UDF array (UDF-capable only). */\n protected normalizeMutationBody(data: Record<string, unknown>): Record<string, unknown> {\n const body: Record<string, unknown> = { ...data };\n if (body.itemId !== undefined && body.id === undefined) {\n body.id = body.itemId;\n delete body.itemId;\n }\n if (this.config.udfCapable && body.userDefinedFields !== undefined) {\n body.userDefinedFields = normalizeUdfInput(body.userDefinedFields);\n }\n return body;\n }\n\n /** `POST /V1.0/<E>` → `{ id }` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */\n protected async createGlobal(data: TCreate, opts: CreateOpts = {}): Promise<OperationResult> {\n const body = this.normalizeMutationBody(data as Record<string, unknown>);\n const res = await this.http.request<unknown>({\n method: 'POST',\n path: this.resourcePath,\n body,\n operation: `${this.config.key}.create`,\n });\n return this.unwrapCreateOperation(res, body, opts);\n }\n\n /**\n * Issue #13: the create-response envelope unwrap with the bounded marker\n * recovery. The fast path is the plain `unwrapOperation` (a well-formed\n * envelope costs ZERO extra requests and returns the byte-identical\n * `{ id }` result). Only a typed `INVALID_RESPONSE` (a 2xx body that is\n * not the specced envelope / `{ id }` / `{ itemId }` alternative) with a\n * plan-pinned marker field AND `recoverIdFromMarker !== false` runs the\n * fallback — and it can only run on the APPLY path: a dry run returns the\n * pinned envelope BEFORE the mutating request, so the fallback never sees\n * a dry-run response (skipped entirely by construction).\n */\n private async unwrapCreateOperation(body: unknown, wireBody: Record<string, unknown>, opts: CreateOpts): Promise<OperationResult> {\n const operation = `${this.config.key}.create`;\n try {\n return unwrapOperation(body, operation);\n } catch (err) {\n if (!isAutotaskError(err) || err.code !== 'INVALID_RESPONSE') throw err;\n const pin = RESPONSE_DRIFT_MARKERS[this.config.key];\n if (pin === undefined || opts.recoverIdFromMarker === false) throw err;\n return this.recoverCreatedIdByMarker(err, body, wireBody, opts, pin);\n }\n }\n\n /**\n * Issue #13: the ONE bounded marker read on the resource's own query\n * surface (`POST <collection>/query`, MaxRecords 5 — a read: idempotent,\n * zero mutating wire; the fallback never issues anything else). Outcomes:\n * exactly ONE numeric match → the normal success result stamped\n * `idFrom: 'marker-recovery'` + the `shapeDrift` note; zero matches, more\n * than one, or a cap-tripped search (a full 5 + a next cursor) → the\n * existing `INVALID_RESPONSE` with the drift detail + the failed search\n * (candidate ids listed — never a guessed id).\n */\n private async recoverCreatedIdByMarker(\n err: AutotaskError,\n body: unknown,\n wireBody: Record<string, unknown>,\n opts: CreateOpts,\n pin: (typeof RESPONSE_DRIFT_MARKERS)[string],\n ): Promise<OperationResult> {\n const operation = `${this.config.key}.create`;\n const markerField = typeof opts.markerField === 'string' && opts.markerField.trim() !== '' ? opts.markerField.trim() : pin.markerField;\n const markerToken =\n typeof opts.markerToken === 'string' && opts.markerToken.trim() !== '' ? opts.markerToken.trim() : defaultMarkerToken(wireBody);\n if (markerToken === null) throw err; // nothing to search — the typed error stands unchanged\n const observedShape = describeResponseShape(body);\n const res = await this.http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: `${this.resourcePath}/query`,\n body: { MaxRecords: MARKER_RECOVERY_LIMIT, filter: [{ field: markerField, op: 'contains', value: markerToken }] },\n operation: `${operation}.marker-recovery`,\n });\n const { items, pageDetails } = unwrapItems<Record<string, unknown>>(res, operation);\n const truncated = items.length >= MARKER_RECOVERY_LIMIT && pageDetails.nextPageUrl !== null;\n const drift: Record<string, unknown> = {\n observedShape,\n speccedEnvelope: 'OperationResultModel',\n markerField,\n markerToken,\n matches: items.length,\n truncated,\n note: pin.note,\n };\n const numericIds = items.map((row) => {\n const id = row.id;\n if (typeof id === 'number' && Number.isInteger(id) && id >= 0) return id;\n if (typeof id === 'string' && /^\\d+$/.test(id.trim())) {\n const parsed = Number.parseInt(id.trim(), 10);\n // An all-digit string beyond the safe range keeps its exact digits\n // (the string form is the only lossless carrier for vendor ids\n // above 2^53 — never re-parse to a corrupted number).\n return Number.isSafeInteger(parsed) ? parsed : id.trim();\n }\n return null;\n });\n if (items.length === 1 && !truncated && numericIds[0] !== null) {\n const id = numericIds[0] as Identifier;\n const shapeDrift: OperationShapeDrift = {\n observedShape,\n speccedEnvelope: 'OperationResultModel',\n note: `The create answered 2xx with a body that is not the specced OperationResultModel (observed: ${observedShape}); the id was recovered by ONE bounded marker read (${markerField} contains the caller's marker, limit ${MARKER_RECOVERY_LIMIT}) — exactly one numeric match.`,\n };\n return { id, idFrom: 'marker-recovery', shapeDrift };\n }\n // Zero / multiple / truncated: the existing code + the drift detail (never a guessed id).\n const candidateIds = numericIds.map((n, i) => n ?? String(items[i]!.id ?? 'unknown'));\n const outcome = items.length === 0 ? 'found 0 matches' : truncated ? `found ${items.length} matches at the limit ${MARKER_RECOVERY_LIMIT} cap (truncated — more may exist)` : `found ${items.length} matches`;\n err.details = { ...err.details, responseDrift: { ...drift, candidateIds } };\n err.suggestedAction =\n `The create answered 2xx with a body that is not the specced OperationResultModel (observed shape: ${observedShape}); ` +\n `the bounded marker recovery (${markerField} contains the caller's marker, limit ${MARKER_RECOVERY_LIMIT}) ${outcome} — ` +\n (items.length === 0\n ? 'the record may exist with an unfindable marker; report the vendor response-shape drift and locate the record in the UI.'\n : 'refusing to guess an id — disambiguate with an exact-field query (or the UI) and recover the id before retrying.');\n throw err;\n }\n\n /** `PUT /V1.0/<E>/{id}` (the vendor tolerates PATCH at the same path) → `{ id }`.\n * For collection-only-writable resources (`collectionUpdate`, D1) the\n * vendor spec defines no put/patch on the item path (it is GET-only; the\n * item-path PUT 405s), so the confirmed update hits the COLLECTION\n * `PUT /V1.0/<E>` with the record id merged into the mutation body — the\n * vendor keys the record by the id in the body (the same convention the\n * parent-scoped `updateScopedRaw` PATCH uses).\n *\n * V2 partial-update merge: the vendor's collection PUT validates the FULL\n * model (a partial body 500s 'Missing Required Field'), so a\n * collectionUpdate update MERGES the caller's partial body into the\n * record's current full model before the PUT: ONE fresh GET serves both\n * the merge source and the stale-object guard's read (a `lastModifiedDate`\n * mismatch throws STALE_OBJECT before the PUT; the guard semantics are\n * unchanged — it is a no-op where the model lacks the field or the caller\n * supplied no token). `opts.raw === true` sends the caller body as-is\n * instead (the pre-merge wire; the guard keeps its own verification read\n * when a token is supplied).\n *\n * Issue #34: with `update.putFallback: true` (OFF by default), a TYPED\n * 404 on the pinned route retries ONCE as `PUT /{Entity}/{id}` where the\n * gate holds — never a collectionUpdate route (the spec defines no\n * item-path update there), never a `raw: true` update, never a non-404\n * fault; the retry body runs the same fresh-read merge (see\n * `putFallbackMergedBody`), so the fallback is never a null-clearing\n * partial. A declined gate (a collectionUpdate route 404s, or the retry\n * itself 404s) throws the self-explaining typed error (the route tried,\n * the status, the opt-in; `details.putFallback`). */\n /**\n * Issue #34 gate: the fallback may fire only while `update.putFallback`\n * is ON and the pinned update route answered a TYPED 404 (a transport\n * `NotFoundError` with `httpStatus: 404`) — never a 400/405/422/5xx, and\n * never a 2xx shape fault (those keep today's typed error byte-identical).\n */\n private putFallbackEligible(err: unknown): err is AutotaskError {\n // Class-keyed, not code-keyed: a 404 body carrying a machine-like vendor code\n // ADOPTS it into `err.code` (the errors.ts adoption rule), but the transport\n // class identity holds — the opt-in recovery must not be skippable by a body.\n return this.http.update.putFallback === true && err instanceof NotFoundError && err.httpStatus === 404;\n }\n\n /**\n * Issue #34: the fallback retry body — the caller's (normalised) fields\n * merged onto a FRESH unredacted read of the current record (the same\n * merge the collection-update path performs; the read is the live record,\n * never cached). A target miss on the merge read surfaces with the pinned\n * update-target reason (the issue-#14 convention) — the recovery has\n * nothing to merge onto, and no retry is issued.\n */\n private async putFallbackMergedBody(\n read: () => Promise<unknown>,\n callerBody: Record<string, unknown>,\n id: Identifier,\n ): Promise<Record<string, unknown>> {\n let current: unknown;\n try {\n current = await read();\n } catch (err) {\n if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);\n throw err;\n }\n const merged = mergePartialBody(current as Record<string, unknown>, callerBody);\n merged.id = id; // the record is keyed by the id (re-asserted after the merge)\n return merged;\n }\n\n /**\n * Issue #34: the self-explaining typed error a DECLINED gate throws. The\n * original transport error keeps its identity (class / code / httpStatus);\n * the message names the route tried, the status and the opt-in, and the\n * structured detail rides under `details.putFallback`\n * (`{ route, status, retried, optIn }`).\n */\n private putFallbackDeclined(err: AutotaskError, route: string, retried: boolean): AutotaskError {\n err.message =\n `${route} answered 404 on the pinned update route; ` +\n (retried\n ? `the update.putFallback retry ${route} also answered 404 — the zone drops the item route as well, so no further recovery is possible`\n : `the opt-in update.putFallback declines to retry this route (collectionUpdate resources have no spec-defined item-path update; raw updates send exactly what they were told) — no fallback was issued`);\n err.details = { ...(err.details ?? {}), putFallback: { route, status: 404, retried, optIn: 'update.putFallback' } };\n err.suggestedAction = retried\n ? 'The zone answers 404 for both the pinned update route and the item route — verify the zone route registration for this entity before retrying.'\n : 'The zone drops the pinned update route and the spec defines no item-path update for this resource — verify the zone route registration, or issue the update against the collection route raw.';\n return err;\n }\n\n protected async updateGlobal(\n id: Identifier,\n data: TUpdate,\n opts: MutationOpts = {},\n ): Promise<OperationResult> {\n const numeric = parseIdentifier(id, 'id');\n const operation = `${this.config.key}.update`;\n let body = this.normalizeMutationBody(data as Record<string, unknown>);\n const collectionUpdate = this.config.collectionUpdate === true;\n if (collectionUpdate) {\n if (opts.raw !== true) {\n // The merge: one read doubles as the guard's read (never the cache —\n // a mutation-path read must see the live record). The read skips\n // response redaction (getGlobalUnredacted): the merged PUT body must\n // carry the record's own true current values, never '[REDACTED]'\n // markers (the values round-trip to the same vendor endpoint only).\n // Issue #14: a target miss on the UPDATE's own merge read carries\n // the pinned update-row reason (the generic .get not-found reason\n // the transport attached does not explain an UPDATE miss).\n let current: Record<string, unknown>;\n try {\n current = (await this.getGlobalUnredacted(numeric)) as unknown as Record<string, unknown>;\n } catch (err) {\n if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);\n throw err;\n }\n this.staleObjectCheck(current, opts, operation);\n body = mergePartialBody(current, body);\n } else {\n // Raw: the caller's body goes out as-is (no merge). The stale guard\n // keeps today's semantics (its own read only when a token is given).\n await this.guardStaleBeforeMutation(numeric, opts, operation);\n }\n body.id = numeric; // the record is keyed by the id in the body\n }\n const route = collectionUpdate ? `PUT ${this.resourcePath}` : `PUT ${this.resourcePath}/${numeric}`;\n let res: unknown;\n try {\n res = await this.http.request<unknown>({\n method: 'PUT',\n path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`,\n body,\n operation,\n });\n } catch (err) {\n if (!this.putFallbackEligible(err)) throw err; // never a non-404 fault; OFF by default\n if (collectionUpdate) {\n // Issue #34: the spec defines NO item-path update for this resource\n // (the item path is GET-only; a PUT to it 405s), and a raw update\n // sends exactly what it was told — the gate declines, and the typed\n // error is self-explaining (the route tried, the status, the opt-in).\n throw this.putFallbackDeclined(err, route, false);\n }\n // Issue #34: the item path is the universal fallback route — retry\n // ONCE as PUT /{Entity}/{id} with the caller's fields merged onto a\n // fresh unredacted read of the current record, so the retry is never\n // a null-clearing partial. A 404 that also 404s the retry declines\n // with the self-explaining typed error (exactly one retry — no loop).\n const merged = await this.putFallbackMergedBody(\n () => this.getGlobalUnredacted(numeric),\n body,\n numeric,\n );\n let retry: unknown;\n try {\n retry = await this.http.request<unknown>({\n method: 'PUT',\n path: `${this.resourcePath}/${numeric}`,\n body: merged,\n operation,\n });\n } catch (rerr) {\n if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, route, true);\n throw rerr;\n }\n return unwrapOperation(retry, operation);\n }\n return unwrapOperation(res, operation);\n }\n\n /** `DELETE /V1.0/<E>/{id}` → `{ id }` (OperationResultModel). A blank 2xx\n * (204 / empty body) is a valid vendor delete answer — synthesize the\n * result from the path id (issue #25: the transport returns undefined\n * for it; a non-blank wrong shape still throws via unwrapOperation). */\n protected async deleteGlobal(id: Identifier): Promise<OperationResult> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.http.request<unknown>({\n method: 'DELETE',\n path: `${this.resourcePath}/${numeric}`,\n operation: `${this.config.key}.delete`,\n });\n return res === undefined ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);\n }\n\n protected scopedCollectionPath(parentId: Identifier): string {\n if (this.config.parentScopedPath === undefined) {\n throw new AutotaskConfigError(`Resource ${this.config.key} is not parent-scoped; there is no parent-scoped path`);\n }\n const p = parseIdentifier(parentId, 'parentId');\n return this.config.parentScopedPath.replace('{parentId}', String(p));\n }\n\n protected scopedItemPath(parentId: Identifier, id: Identifier): string {\n return `${this.scopedCollectionPath(parentId)}/${parseIdentifier(id, 'id')}`;\n }\n\n /** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */\n protected async createScopedRaw(parentId: Identifier, data: TCreate, opts: CreateOpts = {}): Promise<OperationResult> {\n const body = this.normalizeMutationBody(data as Record<string, unknown>);\n const res = await this.http.request<unknown>({\n method: 'POST',\n path: this.scopedCollectionPath(parentId),\n body,\n operation: `${this.config.key}.create`,\n });\n return this.unwrapCreateOperation(res, body, opts);\n }\n\n /** Parent-scoped update: `PATCH .../{parentId}/<Child>` — the COLLECTION.\n * Swagger documents put+patch on the scoped collection and has NO put/patch on\n * the item path anywhere in the spec; the node strips the id from the path and\n * PATCHes the collection, and the vendor keys the record by the id in the body. */\n protected async updateScopedRaw(parentId: Identifier, id: Identifier, data: TUpdate): Promise<OperationResult> {\n const numeric = parseIdentifier(id, 'id');\n const body = this.normalizeMutationBody(data as Record<string, unknown>);\n body.id = numeric; // the record is keyed by the id in the body\n const path = this.scopedCollectionPath(parentId);\n const operation = `${this.config.key}.update`;\n let res: unknown;\n try {\n res = await this.http.request<unknown>({\n method: 'PATCH',\n path,\n body,\n operation,\n });\n } catch (err) {\n if (!this.putFallbackEligible(err)) throw err; // never a non-404 fault; OFF by default\n // Issue #34: the zone dropped the scoped collection route — retry\n // ONCE as PUT on the scoped item path (the spec's readable route for\n // these children) with the caller's fields merged onto a fresh\n // unredacted read of the current record, so the fallback is never a\n // null-clearing partial. A 404 that also 404s the retry declines with\n // the self-explaining typed error (exactly one retry — no loop).\n const merged = await this.putFallbackMergedBody(\n () => this.getScopedUnredacted(parentId, numeric),\n body,\n numeric,\n );\n let retry: unknown;\n try {\n retry = await this.http.request<unknown>({\n method: 'PUT',\n path: `${path}/${numeric}`,\n body: merged,\n operation,\n });\n } catch (rerr) {\n if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric}`, true);\n throw rerr;\n }\n return unwrapOperation(retry, operation);\n }\n return unwrapOperation(res, operation);\n }\n\n /** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`\n * (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */\n protected async deleteScopedRaw(parentId: Identifier, id: Identifier): Promise<OperationResult> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.http.request<unknown>({\n method: 'DELETE',\n path: this.scopedItemPath(parentId, id),\n operation: `${this.config.key}.delete`,\n });\n return res === undefined ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);\n }\n\n /**\n * Attachment delete: the vendor returns the deleted attachment MODEL, not\n * OperationResultModel (G1 envelope.md) — pass it through typed.\n */\n protected async deleteScopedModel(parentId: Identifier, id: Identifier): Promise<T> {\n const numeric = parseIdentifier(id, 'id');\n const res = await this.http.request<unknown>({\n method: 'DELETE',\n path: this.scopedItemPath(parentId, id),\n operation: `${this.config.key}.delete`,\n });\n // Issue #25: a blank 2xx (204 / empty body) delete answer carries no\n // model — return the EMPTY model (never throw); a non-blank wrong\n // shape still refuses.\n if (res === undefined) return {} as T;\n if (!isRecord(res)) {\n throw new AutotaskError(\n `Expected the deleted attachment model for ID ${numeric}; got a different shape`,\n { code: 'INVALID_RESPONSE', category: 'server', resourceIds: [numeric] },\n );\n }\n return res as T;\n }\n\n // ------------------------------------------------------------------\n // Entity metadata trio (global paths; the vendor defines them for children too)\n // ------------------------------------------------------------------\n\n /** `GET /V1.0/<E>/entityInformation` → `{ info }` unwrapped.\n * Goes through the opt-in field cache when `fieldCache` is configured\n * (off by default: the bit-for-bit uncached wire path). A fresh\n * (bypass + refresh) metadata read is the caller's act: drop the\n * entity's entries via the fieldCache's `invalidate` first — the trio\n * keeps its no-arg surface (the registry/MCP arity pin). */\n async getEntityInfo(): Promise<EntityInformationModel> {\n return (await this.cachedMeta(\n 'info',\n `${this.resourcePath}/entityInformation`,\n `${this.config.key}.getEntityInfo`,\n (res): EntityInformationModel => {\n const body = isRecord(res) ? res : undefined;\n if (body === undefined || !isRecord(body.info)) {\n throw new AutotaskError('Expected the entityInformation envelope { info }; got a different shape', {\n code: 'INVALID_RESPONSE',\n category: 'server',\n });\n }\n return body.info as unknown as EntityInformationModel;\n },\n )) as EntityInformationModel;\n }\n\n /** `GET /V1.0/<E>/entityInformation/fields` → `{ fields }` unwrapped.\n * Goes through the opt-in field cache when `fieldCache` is configured\n * (off by default: the bit-for-bit uncached wire path). A fresh\n * (bypass + refresh) metadata read is the caller's act: drop the\n * entity's entries via the fieldCache's `invalidate` first — the trio\n * keeps its no-arg surface (the registry/MCP arity pin). */\n async getFieldInfo(): Promise<FieldInformationModel[]> {\n return (await this.cachedMeta(\n 'fields',\n `${this.resourcePath}/entityInformation/fields`,\n `${this.config.key}.getFieldInfo`,\n (res) => this.unwrapFields(res, 'FieldInformationResultModel'),\n )) as FieldInformationModel[];\n }\n\n /** `GET /V1.0/<E>/entityInformation/userDefinedFields` → `{ fields }` unwrapped.\n * Goes through the opt-in field cache when `fieldCache` is configured\n * (off by default: the bit-for-bit uncached wire path). A fresh\n * (bypass + refresh) metadata read is the caller's act: drop the\n * entity's entries via the fieldCache's `invalidate` first — the trio\n * keeps its no-arg surface (the registry/MCP arity pin). */\n async getUdfInfo(): Promise<Field[]> {\n return (await this.cachedMeta(\n 'udf',\n `${this.resourcePath}/entityInformation/userDefinedFields`,\n `${this.config.key}.getUdfInfo`,\n (res) => this.unwrapFields(res, 'UserDefinedFieldInformationResultModel') as unknown as Field[],\n )) as Field[];\n }\n\n private unwrapFields(body: unknown, envelopeName: string): FieldInformationModel[] {\n if (!isRecord(body) || !Array.isArray(body.fields)) {\n throw new AutotaskError(`Expected the ${envelopeName} envelope { fields: [] }; got a different shape`, {\n code: 'INVALID_RESPONSE',\n category: 'server',\n });\n }\n return body.fields as FieldInformationModel[];\n }\n\n // ------------------------------------------------------------------\n // Compositions used by special ops (node-parity flows)\n // ------------------------------------------------------------------\n\n /**\n * Bounded read against another entity's global `query` endpoint (special-op\n * compositions only; the primary surface stays the resource's own ops).\n */\n protected async queryEntity<TItem>(\n entityPath: string,\n conditions: FilterCondition[],\n opts: { maxRecords?: number; includeFields?: string[] } = {},\n ): Promise<TItem[]> {\n const body: Record<string, unknown> = { filter: buildFilter(conditions).filter };\n if (opts.maxRecords !== undefined) body.MaxRecords = clampPageSize(opts.maxRecords);\n if (opts.includeFields !== undefined) body.IncludeFields = opts.includeFields;\n const res = await this.http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: entityPath,\n body,\n operation: `${this.config.key}.cross-query`,\n });\n return unwrapItems<TItem>(res, `${this.config.key}.cross-query`).items;\n }\n\n /**\n * `createIfNotExists` — the node's dedup composition: query by the caller's\n * dedup fields (eq conditions, and-wrapped); a match short-circuits the\n * create and returns the existing record; otherwise create. With no\n * `dedupFields` this is a plain create (`created: true`).\n *\n * Top-level resources: `createIfNotExists(data, opts)` — the create POSTs\n * the global collection. Parent-scoped resources:\n * `createIfNotExists(parentId, data, opts)` — parentId is REQUIRED. Their\n * global collection has no POST in the swagger; the only documented create\n * is the scoped collection (`POST .../{parentId}/<Child>`), so a missing\n * parentId throws a config error instead of issuing a wrong-path request.\n * The dedup lookup stays a GLOBAL query (the entity carries the parent id\n * field): the filter is the dedup fields + `parentField eq parentId`, which\n * narrows the match set to the parent.\n *\n * (The node additionally verifies the parent exists for configuration items;\n * the SDK omits that preflight — a missing parent surfaces as the vendor's\n * 4xx on the create.)\n */\n createIfNotExists(\n data: TCreate,\n opts?: { dedupFields?: string[]; dryRun?: boolean },\n ): Promise<CreateIfNotExistsResult<T> | DryRunResult<TCreate>>;\n createIfNotExists(\n parentId: Identifier,\n data: TCreate,\n opts?: { dedupFields?: string[]; dryRun?: boolean },\n ): Promise<CreateIfNotExistsResult<T> | DryRunResult<TCreate>>;\n async createIfNotExists(\n dataOrParentId: TCreate | Identifier,\n dataOrOpts?: TCreate | { dedupFields?: string[]; dryRun?: boolean },\n opts: { dedupFields?: string[]; dryRun?: boolean } = {},\n ): Promise<CreateIfNotExistsResult<T> | DryRunResult<TCreate>> {\n const isObject = (v: unknown): v is Record<string, unknown> =>\n isRecord(v) && !Array.isArray(v);\n const scoped = this.config.parentScopedPath !== undefined;\n let parentId: Identifier | undefined;\n let data: TCreate;\n let cinOpts: { dedupFields?: string[]; dryRun?: boolean };\n if (scoped) {\n const dataIsOptsBag = isObject(dataOrOpts) && ('dedupFields' in dataOrOpts || 'dryRun' in dataOrOpts);\n if (!isIdentifierCandidate(dataOrParentId) || !isObject(dataOrOpts) || dataIsOptsBag) {\n throw new AutotaskConfigError(\n `createIfNotExists for parent-scoped resource ${this.config.key} requires (parentId, data[, opts]) — the global collection has no create; a missing parentId would be a wrong-path request`,\n );\n }\n parentId = parseIdentifier(dataOrParentId, 'parentId');\n data = dataOrOpts as TCreate;\n cinOpts = opts;\n } else {\n if (!isObject(dataOrParentId)) {\n throw new AutotaskConfigError(\n `createIfNotExists for top-level resource ${this.config.key} takes (data[, opts]) — got a non-record first argument`,\n );\n }\n data = dataOrParentId;\n cinOpts = isObject(dataOrOpts) ? dataOrOpts : {};\n }\n const record: Record<string, unknown> = isRecord(data) ? data : {};\n const dedupFields = (cinOpts.dedupFields ?? []).filter((field) => field in record);\n let existing: T | undefined;\n let existingId: Identifier | undefined;\n if (dedupFields.length > 0) {\n const conditions: FilterCondition[] = dedupFields.map((field) => ({\n field,\n op: 'eq',\n value: record[field] as FilterValue | FilterValue[],\n }));\n // The dedup lookup stays a GLOBAL query; scoping it to the parent\n // narrows (never widens) the match set for a scoped create.\n if (parentId !== undefined && this.config.parentField !== undefined) {\n conditions.unshift({ field: this.config.parentField, op: 'eq', value: parentId });\n }\n const matches = await this.queryEntity<T>(`${this.resourcePath}/query`, conditions, { maxRecords: 10 });\n const first = matches[0];\n if (first !== undefined) {\n const firstId = (first as Record<string, unknown>).id;\n if (typeof firstId === 'number') {\n existing = first;\n existingId = firstId;\n }\n }\n }\n if (cinOpts.dryRun === true) {\n // The dedup lookup is a read (allowed in dry-run); the create is never\n // issued. A duplicate match short-circuits: wouldApply is false.\n const checks: DryRunCheck[] = [\n { name: 'input-validation', ok: isRecord(data) && Object.keys(data).length > 0 },\n ];\n if (dedupFields.length > 0) {\n checks.push({ name: 'duplicate-detection', ok: existingId === undefined });\n }\n const warnings =\n existingId !== undefined\n ? [`duplicate match on ${dedupFields.join(', ')} (id ${existingId}); the create would be skipped`]\n : [];\n return buildDryRunResult({\n operation: `${this.config.key}.createIfNotExists`,\n method: 'POST',\n path:\n parentId !== undefined\n ? this.scopedCollectionPath(parentId)\n : this.resourcePath,\n ids: existingId !== undefined ? [existingId] : [],\n checks,\n warnings,\n impact: { affected: 1, scope: 'single-record', reversible: true },\n data,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n if (existing !== undefined && existingId !== undefined) {\n return { id: existingId, created: false, existing };\n }\n const op =\n parentId !== undefined\n ? await this.createScopedRaw(parentId, data)\n : await this.createGlobal(data);\n return { id: op.id, created: true };\n }\n\n // ------------------------------------------------------------------\n // Dry-run scaffolding + stale-object guard (mutation safety, section 19.3)\n // ------------------------------------------------------------------\n\n /**\n * Stale-object guard (section 19.3): compare the plan's `staleCheck` field\n * (vendor `lastModifiedDate`) against the caller-observed value. Mismatch\n * throws `STALE_OBJECT`. Returns true when a comparison was actually made\n * (the resource model carries the field AND the vendor answered it AND the\n * caller supplied an expected value); false when the check is unavailable.\n */\n protected staleObjectCheck(\n current: Record<string, unknown>,\n opts: MutationOpts,\n operation: string,\n ): boolean {\n const field = this.config.staleField;\n const expected = opts.lastModifiedDate;\n if (field === undefined || expected === undefined) return false;\n const actual = current[field];\n if (typeof actual !== 'string') return false; // vendor omitted the field on this record\n if (actual !== expected) {\n throw new StaleObjectError(\n `stale object: ${this.config.key} ${field} changed since the caller read it (expected ${expected}, current ${actual})`,\n {\n code: 'STALE_OBJECT',\n operation,\n suggestedAction: 'Re-read the record and retry with the fresh lastModifiedDate.',\n },\n );\n }\n return true;\n }\n\n /**\n * Stale-object guard for a REAL mutation: the caller supplied an expected\n * `lastModifiedDate` and the model carries the field → fetch the current\n * record and compare before the mutating request (mismatch throws\n * STALE_OBJECT; a vanished record propagates the vendor's NotFoundError).\n */\n protected async guardStaleBeforeMutation(\n id: Identifier,\n opts: MutationOpts,\n operation: string,\n parentId?: Identifier,\n ): Promise<void> {\n if (opts.lastModifiedDate === undefined || this.config.staleField === undefined) return;\n // Issue #14: the guard's own verification read is the UPDATE's step — a\n // target miss carries the pinned update-row reason (additive).\n let current: unknown;\n try {\n current =\n parentId === undefined\n ? await this.getGlobal(id, true)\n : this.config.attachmentGet\n ? await this.getScopedModel(parentId, id, true)\n : await this.getScopedRaw(parentId, id, true);\n } catch (err) {\n if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);\n throw err;\n }\n this.staleObjectCheck(current as unknown as Record<string, unknown>, opts, operation);\n }\n\n /**\n * `create` dry-run: input validation + parent verification (scoped\n * resources) + the pinned envelope. NO request is issued (scoped parent\n * verification is a read). Duplicate detection has no reliable lookup for\n * a plain create (that is `createIfNotExists`), so it is not claimed.\n */\n protected async runCreateDryRun<TData extends object>(\n data: TData,\n parentId?: Identifier,\n ): Promise<DryRunResult<TData>> {\n const checks: DryRunCheck[] = [];\n const warnings: string[] = [];\n checks.push({ name: 'input-validation', ok: isRecord(data) && Object.keys(data).length > 0 });\n // Issue #9: the spec-derived delete boundary (plan.deleteBoundaries — the\n // vendored spec defines NO DELETE on the entity's paths). REPORT-ONLY:\n // the check is ok: true (the write itself is valid — wouldApply is\n // preserved; the design's ok:false example would break the pinned\n // companies/tickets create-dry-run contract) and the WARNING carries\n // the boundary note + the UI-only cleanup pointer. Zero wire: the note\n // is generated plan data (the SAME note the record's\n // metadata.deleteBoundary stamp serves via the describe channel — the\n // two channels cannot drift).\n const deleteBoundaryNote = DELETE_BOUNDARY_NOTES[this.config.key];\n if (deleteBoundaryNote !== undefined) {\n checks.push({ name: 'delete-boundary', ok: true });\n warnings.push(deleteBoundaryNote);\n }\n let path = this.resourcePath;\n if (parentId !== undefined) {\n path = this.scopedCollectionPath(parentId);\n const parentPath = this.config.parentPath;\n if (parentPath === undefined) {\n throw new AutotaskConfigError(\n `dry-run: ${this.config.key} is parent-scoped but has no parentPath configured`,\n );\n }\n const parent = await this.contextFetch<Record<string, unknown>>(parentPath, parentId);\n checks.push({ name: 'parent-exists', ok: parent !== null });\n if (parent === null) {\n warnings.push(`parent ${parentId} not found; the vendor would reject the create`);\n }\n }\n return buildDryRunResult({\n operation: `${this.config.key}.create`,\n method: 'POST',\n path,\n ids: [],\n checks,\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings,\n data,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n\n /**\n * `update` dry-run: input validation + current-record fetch (a missing\n * record carries `warnings` and no `diff` — pinned), the stale-object\n * check (mismatch throws STALE_OBJECT) and the best-effort `diff`. NO\n * mutating request is issued.\n */\n protected async runUpdateDryRun<TData extends object>(\n id: Identifier,\n data: TData,\n opts: MutationOpts = {},\n parentId?: Identifier,\n ): Promise<DryRunResult<TData>> {\n const operation = `${this.config.key}.update`;\n const checks: DryRunCheck[] = [];\n const warnings: string[] = [];\n checks.push({ name: 'input-validation', ok: isRecord(data) && Object.keys(data).length > 0 });\n // The envelope must report the route the CONFIRMED write issues (D1):\n // scoped updates PATCH the scoped collection; collection-only-writable\n // top-level updates PUT the global collection (id in the body) — the\n // item path is GET-only in the vendored spec for those. The\n // current-record fetch below stays item-based (GET /V1.0/<E>/{id}).\n const scopedUpdate = parentId !== undefined && this.config.parentScopedPath !== undefined;\n const collectionUpdate = scopedUpdate || this.config.collectionUpdate === true;\n const path = scopedUpdate\n ? this.scopedCollectionPath(parentId)\n : collectionUpdate\n ? this.resourcePath\n : `${this.resourcePath}/${id}`;\n const method: 'PUT' | 'PATCH' = scopedUpdate ? 'PATCH' : 'PUT';\n let current: Record<string, unknown> | null = null;\n try {\n current = (\n parentId === undefined\n ? await this.getGlobal(id, true)\n : this.config.attachmentGet\n ? await this.getScopedModel(parentId, id, true)\n : await this.getScopedRaw(parentId, id, true)\n ) as unknown as Record<string, unknown>;\n } catch (err) {\n if (err instanceof NotFoundError) {\n // Issue #14: the pinned UPDATE-row reason (tenant-empty-for-user /\n // unreadable-scoped-child) rides the envelope (additive: wouldApply\n // stays false — the check fails either way) + the check note, so a\n // target miss reads as the typed reason, not a bare \"not fetchable\".\n const updateReason = EMPTY_REASON_STAMPS[this.config.key]?.update;\n checks.push({\n name: 'current-record-exists',\n ok: false,\n ...(updateReason !== undefined ? { note: updateReason.note } : {}),\n });\n warnings.push(`current record ${id} not fetchable; no diff`);\n return buildDryRunResult({\n operation,\n method,\n path,\n ids: [id],\n checks,\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings,\n data,\n ...(updateReason !== undefined ? { emptyReason: updateReason } : {}),\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n throw err;\n }\n checks.push({ name: 'current-record-exists', ok: true });\n if (this.staleObjectCheck(current, opts, operation)) {\n checks.push({ name: 'stale-check', ok: true });\n }\n // V2 partial-update merge: for a top-level collectionUpdate non-raw\n // update the envelope `data` is the MERGED body — exactly what the\n // confirmed collection PUT would send. The current record fetched above\n // doubles as the merge source: the ONE shared read serves the diff, the\n // stale-object check and the merge (no second request). Raw dry runs\n // report the caller's body as-is (pre-merge behaviour).\n let envelopeData: TData = data;\n if (parentId === undefined && this.config.collectionUpdate === true && opts.raw !== true) {\n envelopeData = mergePartialBody(\n current,\n this.normalizeMutationBody(data as Record<string, unknown>),\n ) as unknown as TData;\n }\n return buildDryRunResult({\n operation,\n method,\n path,\n ids: [id],\n checks,\n diff: computeFieldDiff(current, data),\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings,\n data: envelopeData,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n\n /**\n * `delete` dry-run: current-record verification + the stale-object check +\n * the pinned envelope (no diff — a delete has no before/after fields). NO\n * mutating request is issued.\n */\n protected async runDeleteDryRun(\n id: Identifier,\n opts: MutationOpts = {},\n parentId?: Identifier,\n ): Promise<DryRunResult<Record<string, unknown>>> {\n const operation = `${this.config.key}.delete`;\n const checks: DryRunCheck[] = [];\n const warnings: string[] = [];\n const path =\n parentId === undefined ? `${this.resourcePath}/${id}` : this.scopedItemPath(parentId, id);\n let current: Record<string, unknown> | null = null;\n try {\n current = (\n parentId === undefined\n ? await this.getGlobal(id, true)\n : this.config.attachmentGet\n ? await this.getScopedModel(parentId, id, true)\n : await this.getScopedRaw(parentId, id, true)\n ) as unknown as Record<string, unknown>;\n } catch (err) {\n if (err instanceof NotFoundError) {\n checks.push({ name: 'current-record-exists', ok: false });\n warnings.push(`record ${id} not fetchable; the vendor would reject the delete`);\n return buildDryRunResult({\n operation,\n method: 'DELETE',\n path,\n ids: [id],\n checks,\n impact: { affected: 1, scope: 'single-record', reversible: false },\n warnings,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n throw err;\n }\n checks.push({ name: 'current-record-exists', ok: true });\n if (this.staleObjectCheck(current, opts, operation)) {\n checks.push({ name: 'stale-check', ok: true });\n }\n return buildDryRunResult({\n operation,\n method: 'DELETE',\n path,\n ids: [id],\n checks,\n impact: { affected: 1, scope: 'single-record', reversible: false },\n warnings,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n\n /**\n * Attachment `download`: `GET .../{parentId}/<Child>/{id}/data` → Buffer\n * (node-proven `/data` path, quirk #9; the metadata GET is `get`).\n */\n protected async downloadScoped(parentId: Identifier, id: Identifier): Promise<Buffer> {\n const res = await this.http.request<unknown>({\n method: 'GET',\n path: `${this.scopedItemPath(parentId, id)}/data`,\n operation: `${this.config.key}.download`,\n });\n return decodeFileData(res);\n }\n\n // ------------------------------------------------------------------\n // Cross-entity reads + resolution helpers (helper-floor ops, G4)\n // ------------------------------------------------------------------\n\n /** Raw single-record read on ANY entity path: `GET <path>/{id}` → `{ item }`\n * unwrapped (`item: null` → NotFoundError). Used by `resolve` (id branch)\n * and `getContext` (the cross-entity parts); the operation tag is scoped to\n * the resource + call site so errors stay attributable. `fresh` skips the\n * cache lookup (the read still refreshes the entry for the other callers):\n * the composite ROOT of a hot resource (issue #36) must see the live\n * record, never a snapshot. */\n protected async fetchRecordRaw<TRec>(entityPath: string, id: Identifier, fresh = false): Promise<TRec> {\n const numeric = parseIdentifier(id, 'id');\n // issue #32: the entry takes the READ ENTITY's TTL — the plan key of\n // the entity this path points to (a cross-entity context part expires\n // on its own resource's override, never the caller's). A path the\n // plan does not name is undefined -> the base ttlMs.\n const resource = RESOURCE_KEY_BY_PATH[entityPath];\n const res = await this.cachedGet(`${entityPath}/${numeric}`, `${this.config.key}.fetchRecord`, fresh, resource);\n // FULL100 F5: model-direct resources (the *_attachments family — the spec\n // 200 schema is the raw model) answer the item path without the { item }\n // envelope; parse with the tolerant model-or-envelope rule, or every\n // numeric resolve on the family crashed INVALID_RESPONSE.\n if (this.config.attachmentGet) {\n return this.unwrapModelLike<TRec>(res, numeric);\n }\n return unwrapItem<TRec>(res, numeric, `${this.config.key}.fetchRecord`);\n }\n\n /**\n * `getContext` part fetch: a single-record read that degrades to `null`\n * when the reference id is absent (or the vendor answers not-found).\n * Other errors propagate — a part that fails on a real fault is not a\n * \"missing reference\".\n *\n * Issue #36 (negative caching, the pinned hazard): the vendor's true\n * not-found (the HTTP 404 or the 200 `item: null` signal — both surface\n * as `NotFoundError`) is stored as an ABSENT marker in the SAME ReadCache\n * under a namespaced key the positive get path never constructs, so a\n * repeat composite call serves 'absent' with zero wire for that part.\n * The marker expires on the READ entity's TTL (the #32 per-resource\n * table / `perResourceTtlMs` override, via `set`'s resource key) and is\n * cleared by any real write through the client (the ReadCache clear).\n * A transient fault (5xx, shape drift, network) is NEVER stored as an\n * ABSENT marker — it propagates and the next call re-wires (no\n * poisoning; a malformed 200 body may still land under the POSITIVE\n * key — pre-existing ReadCache behaviour, out of this mechanism's\n * scope). The marker is consulted BEFORE the positive lookup, but a\n * POSITIVE entry that exists alongside a live marker means a newer\n * positive outcome (this client read/created the record after the\n * not-found) — the marker is dropped and the positive entry serves\n * (the newest outcome wins in both directions). A record created\n * ELSEWHERE may serve 'absent' until the marker TTL expires (or a write\n * through this client lands) — the opt-in staleness contract, same\n * trade as the positive entries.\n */\n protected async contextFetch<TRec>(entityPath: string, referenceId: unknown): Promise<TRec | null> {\n if (typeof referenceId !== 'number' || !Number.isInteger(referenceId) || referenceId < 0) {\n return null;\n }\n const cache = this.http.readCache;\n const absentKey = contextAbsentKey(`${entityPath}/${referenceId}`);\n if (cache !== undefined && cache.get(absentKey) !== undefined) {\n if (cache.get(`${entityPath}/${referenceId}`) !== undefined) {\n // A POSITIVE outcome landed after the marker (this client read or\n // created the record): the newest outcome wins — drop the stale\n // marker and fall through to the positive entry. A `{item: null}`\n // positive entry re-raises the marker on the unwrap below, so this\n // never serves a not-found record as present (issue #36 QA).\n cache.delete(absentKey);\n } else {\n return null; // the FK 'absent' marker is live (issue #36): zero wire\n }\n }\n try {\n return await this.fetchRecordRaw<TRec>(entityPath, referenceId);\n } catch (err) {\n if (err instanceof NotFoundError) {\n // A vendor not-found (never a fault): store the marker under the\n // READ entity's resource key so the #32 TTL governs its expiry.\n cache?.set(absentKey, CONTEXT_ABSENT_MARKER, RESOURCE_KEY_BY_PATH[entityPath]);\n return null;\n }\n throw err;\n }\n }\n\n /**\n * `resolve` — the helper-floor resolution (section 19.2), with cost and\n * truncation tracking (`resolveDetailed`); the plain `resolveBase` is its\n * value projection. Pinned semantics:\n * - numeric id (number or all-digit string) → single record read; a miss\n * throws NotFoundError (the vendor's own not-found, cost `direct`);\n * - bare value → SERVER FILTER FIRST: exact (`eq`) on the `searchFields`\n * (OR-grouped when the entity covers several), bounded to 2 records —\n * 1 → the record (cost `server-filter`), ≥2 → RESOLUTION_AMBIGUOUS with\n * the candidate ids;\n * - zero items + zero `requestCount` is a COMPLETE non-match (the vendor\n * filters every model field; the server answer is authoritative) → null;\n * - zero items + positive `requestCount` is an INCONCLUSIVE server answer\n * (an index gap the server could not reconcile) → the bounded CLIENT\n * SCAN fallback: an unfiltered walk, exact match on the `searchFields`,\n * capped by the client caps (`maxScanRecords` / `maxScanPages`). A hit\n * is cost `client-scan`; a completed scan with no match → null; a\n * cap-tripped scan THROWS RESOLUTION_TRUNCATED — never a silent null.\n * - bare value on an id-only resource → AutotaskConfigError (CONFIG_ERROR).\n */\n async resolveDetailed(identifier: number | string): Promise<Resolution<T>> {\n let numeric: Identifier | null = null;\n if (isIdentifierCandidate(identifier)) {\n // A numeric id: a safe integer number, or an all-digit string.\n // parseIdentifier refuses a corrupted (unsafe) JS number and KEEPS an\n // all-digit string beyond the safe range as its exact digits — the\n // string passthrough is the only lossless carrier for vendor ids above\n // 2^53 (a Number here would silently lose precision in the URL path).\n numeric = parseIdentifier(identifier, 'id');\n }\n if (numeric !== null) {\n // A miss here is the vendor's own NOT_FOUND (fetchRecordRaw throws it).\n const record = await this.fetchRecordRaw<T>(this.resourcePath, numeric);\n return { value: record, resolutionCost: 'direct', scanned: 0, scanTruncated: false };\n }\n if (typeof identifier !== 'string' || identifier.trim() === '') {\n throw new AutotaskConfigError('resolve: identifier must be a numeric id or a non-empty value');\n }\n const value = identifier.trim();\n const fields = this.config.searchFields ?? [];\n if (fields.length === 0) {\n throw new AutotaskConfigError(\n `resolve: ${this.config.key} has no primary text field (ids only)`,\n );\n }\n const leaf: FilterCondition[] = fields.map((field) => ({ field, op: 'eq', value }));\n const root: FilterCondition = leaf.length === 1 ? leaf[0]! : { op: 'or', items: leaf };\n const { items, requestCount } = await this.queryPage1<T>([root], 2);\n if (items.length === 1) {\n return { value: items[0]!, resolutionCost: 'server-filter', scanned: 0, scanTruncated: false };\n }\n if (items.length >= 2) {\n const ids = items\n .map((m) => (m as Record<string, unknown>).id)\n .filter((id): id is number => typeof id === 'number');\n throw new ResolutionError(\n `resolve: \"${value}\" is ambiguous on ${this.config.key} (matched ${items.length} records)`,\n { code: 'RESOLUTION_AMBIGUOUS', resourceIds: ids },\n );\n }\n if (requestCount === 0) {\n // Complete non-match: the server's index says no record matches.\n return { value: null, resolutionCost: 'server-filter', scanned: 0, scanTruncated: false, triedFields: fields };\n }\n const scan = await this.scanForExactMatch(value, fields);\n if (scan.found !== null) {\n return {\n value: scan.found,\n resolutionCost: 'client-scan',\n scanned: scan.scanned,\n scanTruncated: false,\n };\n }\n if (scan.truncated) {\n throw new ResolutionError(\n `resolve: \"${value}\" is unverified on ${this.config.key} — the bounded client scan read ${scan.scanned} records (cap) without completing; a complete non-match cannot be proven`,\n {\n code: 'RESOLUTION_TRUNCATED',\n suggestedAction:\n 'Retry with a more specific identifier, or narrow the search to fewer records.',\n },\n );\n }\n return { value: null, resolutionCost: 'client-scan', scanned: scan.scanned, scanTruncated: false, triedFields: fields };\n }\n\n /** The plain value projection of `resolveDetailed` (the `resolve` floor). */\n protected async resolveBase(identifier: number | string): Promise<T | null> {\n return (await this.resolveDetailed(identifier)).value;\n }\n\n /** One page of the resource's own `/query` with items + total match count. */\n protected async queryPage1<TItem>(\n conditions: FilterCondition[],\n maxRecords: number,\n ): Promise<{ items: TItem[]; requestCount: number }> {\n const body: Record<string, unknown> = {\n filter: buildFilter(conditions).filter,\n MaxRecords: maxRecords,\n };\n const res = await this.http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: `${this.resourcePath}/query`,\n body,\n operation: `${this.config.key}.resolve`,\n });\n const { items, pageDetails } = unwrapItems<TItem>(res, `${this.config.key}.resolve`);\n return { items, requestCount: pageDetails.requestCount };\n }\n\n /**\n * The bounded client-scan fallback (section 19.2): an unfiltered walk of\n * the resource's own query endpoint, exact match on `fields`, bounded by\n * BOTH client caps (records AND pages). `truncated` is true when the caps\n * were hit before the walk completed (a complete non-match is unproven).\n */\n protected async scanForExactMatch(\n value: string,\n fields: string[],\n ): Promise<{ found: T | null; scanned: number; truncated: boolean }> {\n const caps = this.resolutionCaps;\n const pageSize = Math.max(1, Math.floor(caps.maxScanRecords / caps.maxScanPages));\n const state: QueryWalkState = { cursor: null };\n let scanned = 0;\n let pages = 0;\n let found: T | null = null;\n let exhausted = false;\n for (;;) {\n const page = await this.fetchPage({ maxRecords: pageSize }, pages + 1, pageSize, state);\n pages += 1;\n for (const item of page.items) {\n scanned += 1;\n const rec = item as unknown as Record<string, unknown>;\n if (fields.some((field) => rec[field] === value)) {\n found = item;\n break;\n }\n }\n if (found !== null) break;\n if (!page.hasMore) {\n exhausted = true;\n break;\n }\n if (pages >= caps.maxScanPages || scanned >= caps.maxScanRecords) break;\n }\n return { found, scanned, truncated: found === null && !exhausted };\n }\n\n /**\n * `findBy<field>` helpers: exact (`eq`) filter on one vendor field, bounded\n * to 2 records — 0 → null, 1 → the record, ≥2 → ResolutionError with the\n * candidate ids.\n */\n protected async findByField(field: string, value: string): Promise<T | null> {\n if (value.trim() === '') throw new AutotaskConfigError(`findBy${field}: empty value`);\n const matches = await this.queryEntity<T>(\n `${this.resourcePath}/query`,\n [{ field, op: 'eq', value: value.trim() }],\n { maxRecords: 2 },\n );\n if (matches.length === 0) return null;\n if (matches.length > 1) {\n const ids = matches\n .map((m) => (m as Record<string, unknown>).id)\n .filter((id): id is number => typeof id === 'number');\n throw new ResolutionError(\n `findBy${field}: \"${value}\" is ambiguous on ${this.config.key} (matched ${matches.length} records)`,\n { code: 'RESOLUTION_AMBIGUOUS', resourceIds: ids },\n );\n }\n return matches[0]!;\n }\n\n /**\n * `search` — the bounded contains surface (no vendor free-text search):\n * `contains` on every `searchFields` field (OR-grouped), `MaxRecords` =\n * `limit` (default 25, clamped to 1..500). Empty query → AutotaskConfigError.\n */\n protected async searchBase(query: string, opts: { limit?: number } = {}): Promise<T[]> {\n const text = query.trim();\n if (text === '') throw new AutotaskConfigError('search: empty query');\n const fields = this.config.searchFields ?? [];\n if (fields.length === 0) {\n throw new AutotaskConfigError(`search: ${this.config.key} has no searchable field`);\n }\n const limit = opts.limit === undefined ? 25 : clampPageSize(opts.limit);\n const leaf: FilterCondition[] = fields.map((field) => ({ field, op: 'contains', value: text }));\n const root: FilterCondition = leaf.length === 1 ? leaf[0]! : { op: 'or', items: leaf };\n return this.queryEntity<T>(`${this.resourcePath}/query`, [root], { maxRecords: limit });\n }\n}\n","/**\n * AppointmentsResource — Appointment resource (G5 batch B, plan key 'appointments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Appointment, AppointmentCreate, AppointmentUpdate, AppointmentSummary } from '../types/appointments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for AppointmentsResource (the G3 filter surface; no per-resource invention). */\nexport type AppointmentsResourceQueryParams = QueryParams;\n\nexport class AppointmentsResource extends BaseResource<Appointment, AppointmentCreate, AppointmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'appointments',\n resourcePath: '/V1.0/Appointments',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query Appointment records with the G3 filter surface (server-side JSON filter). */\n query(params?: AppointmentsResourceQueryParams): AsyncIterable<Appointment> {\n return this.queryItems(params);\n }\n\n /** Get every Appointment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: AppointmentsResourceQueryParams): Promise<Appointment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: AppointmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Appointment> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: AppointmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<AppointmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: AppointmentUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<AppointmentUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'appointments.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a Appointment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<AppointmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { AuthTokenResultModel } from '../types/common.js';\n\n/**\n * AuthenticateResource — integration endpoint (G5 batch B, plan key 'authenticate').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class AuthenticateResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `/V1.0/Authenticate` → `AuthTokenResultModel` as-is. */\n get(): Promise<AuthTokenResultModel> {\n return this.http.request<AuthTokenResultModel>({\n method: 'GET',\n path: '/V1.0/Authenticate',\n operation: 'authenticate.get',\n });\n }\n}\n","/**\n * BillingCodesResource — BillingCode resource (G5 batch B, plan key 'billing_codes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { BillingCode, BillingCodeCreate, BillingCodeUpdate, BillingCodeSummary } from '../types/billing_codes.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for BillingCodesResource (the G3 filter surface; no per-resource invention). */\nexport type BillingCodesResourceQueryParams = QueryParams;\n\nexport class BillingCodesResource extends BaseResource<BillingCode, BillingCodeCreate, BillingCodeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'billing_codes',\n resourcePath: '/V1.0/BillingCodes',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query BillingCode records with the G3 filter surface (server-side JSON filter). */\n query(params?: BillingCodesResourceQueryParams): AsyncIterable<BillingCode> {\n return this.queryItems(params);\n }\n\n /** Get every BillingCode record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: BillingCodesResourceQueryParams): Promise<BillingCode[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: BillingCodesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<BillingCode> {\n return this.getGlobal(id);\n }\n\n /** Resolve a BillingCode from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<BillingCodeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search BillingCode records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<BillingCodeSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * BillingItemsResource — BillingItems resource (G5 batch B, plan key 'billing_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { BillingItems, BillingItemsCreate, BillingItemsUpdate, BillingItemsSummary } from '../types/billing_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for BillingItemsResource (the G3 filter surface; no per-resource invention). */\nexport type BillingItemsResourceQueryParams = QueryParams;\n\nexport class BillingItemsResource extends BaseResource<BillingItems, BillingItemsCreate, BillingItemsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'billing_items',\n resourcePath: '/V1.0/BillingItems',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query BillingItems records with the G3 filter surface (server-side JSON filter). */\n query(params?: BillingItemsResourceQueryParams): AsyncIterable<BillingItems> {\n return this.queryItems(params);\n }\n\n /** Get every BillingItems record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: BillingItemsResourceQueryParams): Promise<BillingItems[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: BillingItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<BillingItems> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: BillingItemsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<BillingItemsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a BillingItems from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<BillingItemsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ChangeRequestLinksResource — ChangeRequestLink resource (G5 batch B, plan key 'change_request_links').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ChangeRequestLink, ChangeRequestLinkCreate, ChangeRequestLinkUpdate, ChangeRequestLinkSummary } from '../types/change_request_links.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ChangeRequestLinksResource (the G3 filter surface; no per-resource invention). */\nexport type ChangeRequestLinksResourceQueryParams = QueryParams;\n\nexport class ChangeRequestLinksResource extends BaseResource<ChangeRequestLink, ChangeRequestLinkCreate, ChangeRequestLinkUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'change_request_links',\n resourcePath: '/V1.0/ChangeRequestLinks',\n deletable: true,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query ChangeRequestLink records with the G3 filter surface (server-side JSON filter). */\n query(params?: ChangeRequestLinksResourceQueryParams): AsyncIterable<ChangeRequestLink> {\n return this.queryItems(params);\n }\n\n /** Get every ChangeRequestLink record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ChangeRequestLinksResourceQueryParams): Promise<ChangeRequestLink[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ChangeRequestLinksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ChangeRequestLink> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ChangeRequestLinkCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ChangeRequestLinkCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'change_request_links.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ChangeRequestLink from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ChangeRequestLinkSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ChecklistLibrariesResource — ChecklistLibrary resource (G5 batch B, plan key 'checklist_libraries').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ChecklistLibrary, ChecklistLibraryCreate, ChecklistLibraryUpdate, ChecklistLibrarySummary } from '../types/checklist_libraries.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ChecklistLibrariesResource (the G3 filter surface; no per-resource invention). */\nexport type ChecklistLibrariesResourceQueryParams = QueryParams;\n\nexport class ChecklistLibrariesResource extends BaseResource<ChecklistLibrary, ChecklistLibraryCreate, ChecklistLibraryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'checklist_libraries',\n resourcePath: '/V1.0/ChecklistLibraries',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ChecklistLibrary records with the G3 filter surface (server-side JSON filter). */\n query(params?: ChecklistLibrariesResourceQueryParams): AsyncIterable<ChecklistLibrary> {\n return this.queryItems(params);\n }\n\n /** Get every ChecklistLibrary record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ChecklistLibrariesResourceQueryParams): Promise<ChecklistLibrary[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ChecklistLibrariesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ChecklistLibrary> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ChecklistLibraryCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ChecklistLibraryCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ChecklistLibraryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ChecklistLibraryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'checklist_libraries.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ChecklistLibrarySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ChecklistLibrary records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ChecklistLibrarySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ChecklistLibraryChecklistItemsResource — ChecklistLibraryChecklistItem resource (G5 batch B, plan key 'checklist_library_checklist_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'checklist_libraries': CRUD under /V1.0/ChecklistLibraries/{parentId}/ChecklistItems —\n * the global query/count stay unscoped (narrow with the 'checklistLibraryID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ChecklistLibraryChecklistItem, ChecklistLibraryChecklistItemCreate, ChecklistLibraryChecklistItemUpdate, ChecklistLibraryChecklistItemSummary } from '../types/checklist_library_checklist_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ChecklistLibraryChecklistItemsResource (the G3 filter surface; no per-resource invention). */\nexport type ChecklistLibraryChecklistItemsResourceQueryParams = QueryParams;\n\nexport class ChecklistLibraryChecklistItemsResource extends BaseResource<ChecklistLibraryChecklistItem, ChecklistLibraryChecklistItemCreate, ChecklistLibraryChecklistItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'checklist_library_checklist_items',\n resourcePath: '/V1.0/ChecklistLibraryChecklistItems',\n parentScopedPath: '/V1.0/ChecklistLibraries/{parentId}/ChecklistItems',\n parentField: 'checklistLibraryID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ChecklistLibraries',\n }, pageSize);\n }\n\n /** Query ChecklistLibraryChecklistItem records (global; narrow with the checklistLibraryID filter). */\n query(params?: ChecklistLibraryChecklistItemsResourceQueryParams): AsyncIterable<ChecklistLibraryChecklistItem> {\n return this.queryItems(params);\n }\n\n /** Get every ChecklistLibraryChecklistItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ChecklistLibraryChecklistItemsResourceQueryParams): Promise<ChecklistLibraryChecklistItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ChecklistLibraryChecklistItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ChecklistLibraries/{parentId}/ChecklistItems/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ChecklistLibraryChecklistItem> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ChecklistLibraryChecklistItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ChecklistLibraryChecklistItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ChecklistLibraryChecklistItemUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ChecklistLibraryChecklistItemUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'checklist_library_checklist_items.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'checklist_library_checklist_items.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ChecklistLibraryChecklistItem from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ChecklistLibraryChecklistItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ClassificationIconsResource — ClassificationIcon resource (G5 batch B, plan key 'classification_icons').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ClassificationIcon, ClassificationIconCreate, ClassificationIconUpdate, ClassificationIconSummary } from '../types/classification_icons.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ClassificationIconsResource (the G3 filter surface; no per-resource invention). */\nexport type ClassificationIconsResourceQueryParams = QueryParams;\n\nexport class ClassificationIconsResource extends BaseResource<ClassificationIcon, ClassificationIconCreate, ClassificationIconUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'classification_icons',\n resourcePath: '/V1.0/ClassificationIcons',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ClassificationIcon records with the G3 filter surface (server-side JSON filter). */\n query(params?: ClassificationIconsResourceQueryParams): AsyncIterable<ClassificationIcon> {\n return this.queryItems(params);\n }\n\n /** Get every ClassificationIcon record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ClassificationIconsResourceQueryParams): Promise<ClassificationIcon[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ClassificationIconsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ClassificationIcon> {\n return this.getGlobal(id);\n }\n\n /** Resolve a ClassificationIcon from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ClassificationIconSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ClassificationIcon records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ClassificationIconSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * Companies special ops — node-parity search compositions (G4 batch A).\n *\n * Node parity (n8n autotask nodes `searchCompanyByDomain` / identity search):\n * the vendor has no free-text or domain search — domain lookups are\n * `contains` filters on `webAddress`, with a contact-email fallback. The\n * node's `searchType: 'eq'` request is mapped to `contains` (there is no\n * exact-domain operator that fits a substring of a URL); the mapping is\n * pinned, not a preference.\n */\nimport { AutotaskConfigError, AutotaskError, formatVendorDetail, isAutotaskError, NotFoundError, parseVendorErrors } from '../../errors.js';\nimport type { HttpClient } from '../../http.js';\nimport { unwrapItems } from '../../http.js';\nimport type { Company, CompanyCreate } from '../../types/companies.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport { blindStampFor, buildDryRunResult, type MutationOpts } from '../base.js';\nimport { BLIND_SURFACE_STAMPS } from '../../relationships.js';\nimport type { BlindSurfaceInfo } from '../../relationships.js';\nimport type { CompanyLocation } from '../../types/company_locations.js';\nimport type { CompanyNote } from '../../types/company_notes.js';\nimport type { Contact } from '../../types/contacts.js';\nimport type { Project } from '../../types/projects.js';\nimport type { Ticket } from '../../types/tickets.js';\nimport type { CompaniesResource } from '../companies.js';\n\nexport interface CompaniesDomainSearchOptions {\n /** Node-parity knob: `'eq'` is mapped to `contains` (vendor has no exact\n * domain operator for URL fields). Both values behave identically. */\n searchType?: 'contains' | 'eq';\n /** Max companies to return (default 25, clamped to 1..500). */\n limit?: number;\n}\n\nexport interface CompaniesIdentitySignals {\n companyName?: string;\n email?: string;\n website?: string;\n}\n\nconst DEFAULT_LIMIT = 25;\nconst MAX_LIMIT = 500;\n\nfunction clampLimit(limit: number | undefined): number {\n const n = limit === undefined ? DEFAULT_LIMIT : Math.trunc(limit);\n if (!Number.isInteger(n) || n < 1) throw new AutotaskConfigError(`limit must be an integer >= 1 (got ${String(limit)})`);\n return Math.min(n, MAX_LIMIT);\n}\n\nasync function queryCompanies(http: HttpClient, filter: unknown, limit: number): Promise<Company[]> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Companies/query',\n body: { MaxRecords: limit, filter },\n operation: 'companies.searchByDomain',\n });\n return unwrapItems<Company>(res).items;\n}\n\nasync function queryContacts(http: HttpClient, filter: unknown, limit: number): Promise<Array<Record<string, unknown>>> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Contacts/query',\n body: { MaxRecords: limit, filter },\n operation: 'companies.searchByDomain',\n });\n return unwrapItems<Record<string, unknown>>(res).items;\n}\n\nasync function fetchCompanies(http: HttpClient, ids: number[], limit: number): Promise<Company[]> {\n const out: Company[] = [];\n for (const id of ids.slice(0, limit)) {\n try {\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Companies/${id}`,\n operation: 'companies.searchByDomain',\n });\n const body = res as { item?: Company | null } | null;\n const item = body && 'item' in body ? body.item : null;\n if (item) out.push(item);\n } catch (err) {\n if (err instanceof NotFoundError) continue;\n throw err;\n }\n }\n return out;\n}\n\n/**\n * `searchByDomain` — companies whose `webAddress` contains the domain; when\n * nothing matches, fall back to contacts whose email contains the domain and\n * resolve their companies (bounded by `limit`; missing companies are skipped).\n */\nexport async function searchByDomain(\n _resource: CompaniesResource,\n domain: string,\n opts: CompaniesDomainSearchOptions = {},\n http: HttpClient,\n): Promise<Company[]> {\n const text = domain.trim();\n if (text === '') throw new AutotaskConfigError('searchByDomain: empty domain');\n const limit = clampLimit(opts.limit);\n // Node `searchType: 'eq'` → contains (vendor URL fields have no exact domain match).\n const filter = [{ field: 'webAddress', op: 'contains', value: text }];\n const direct = await queryCompanies(http, filter, limit);\n if (direct.length > 0) return direct;\n const contacts = await queryContacts(http, [{ field: 'emailAddress', op: 'contains', value: text }], limit);\n const ids = [...new Set(contacts.map((c) => c.companyID).filter((id): id is number => typeof id === 'number' && id >= 0))];\n return fetchCompanies(http, ids, limit);\n}\n\n/**\n * `searchByIdentity` — merge the identity signals (companyName + website on\n * Companies, email via Contacts) into one bounded candidate list. Empty\n * signals reject (an identity search with nothing to search is a caller bug).\n */\nexport async function searchByIdentity(\n _resource: CompaniesResource,\n identity: CompaniesIdentitySignals,\n opts: { limit?: number } = {},\n http: HttpClient,\n): Promise<Company[]> {\n const name = identity.companyName?.trim() ?? '';\n const email = identity.email?.trim() ?? '';\n const website = identity.website?.trim() ?? '';\n if (name === '' && email === '' && website === '') {\n throw new AutotaskConfigError('searchByIdentity: at least one of companyName / email / website is required');\n }\n const limit = clampLimit(opts.limit);\n const found = new Map<number, Company>();\n const add = (items: Company[]) => {\n for (const item of items) if (typeof item.id === 'number' && !found.has(item.id)) found.set(item.id, item);\n return [...found.values()].slice(0, limit);\n };\n if (website !== '') add(await queryCompanies(http, [{ field: 'webAddress', op: 'contains', value: website }], limit));\n if (name !== '') add(await queryCompanies(http, [{ field: 'companyName', op: 'contains', value: name }], limit));\n if (email !== '') {\n const contacts = await queryContacts(http, [{ field: 'emailAddress', op: 'contains', value: email }], limit);\n const ids = [...new Set(contacts.map((c) => c.companyID).filter((id): id is number => typeof id === 'number' && id >= 0))];\n add(await fetchCompanies(http, ids, limit));\n }\n return [...found.values()].slice(0, limit);\n}\n\n// =============================================================================\n// S12-A (run mcp-fix-20261003, plan T5) — upsertByName: the find-or-create\n// by company name, BLIND-SURFACE-AWARE. The blind surface bites the dedup:\n// companies.query sees only companies the API user can enumerate (unowned →\n// invisible, docs/API.md §11.2) — a query-miss is NOT proof of absence. The\n// op carries that boundary IN THE RESULT (the typed blindSurface caveat on\n// BOTH the EXISTS and the CREATED results) instead of pretending total\n// visibility; the dedup read rides the SDK queryBounded, so the S12-C typed\n// blind-surface sentinel stamps a blind-shape miss for free (the sentinel is\n// on the base — consumed, not re-implemented).\n//\n// Zone facts (live-verified ww29, receipts in .run/mcp-fix-20261003/reports/):\n// - the ww29 live-required set { companyName, companyType, phone,\n// ownerResourceID (a non-API-only resource) } (the spec declares no\n// required fields; a create missing any 500s with a typed field-level\n// error);\n// - ownerResourceID: the node CANNOT enumerate candidates (the resources\n// table is blind to the API user — count/query return 0; whoAmI returns\n// the API-only identity that S7b proved unusable as owner) → the id is a\n// REQUIRED caller param on the create path, validated via resources.get\n// (blind-surface-safe: get is the authority); the typed\n// OWNER_RESOURCE_REQUIRED remedy names the fixture-free fix;\n// - V5: companies.create auto-creates a vendor 'Primary Address' location\n// under the new company (UI-only cleanup — the delete 405 gap).\n// =============================================================================\n\nconst OP_UPSERT_NAME = 'companies.upsertByName';\n\n/** Max discovery-loop field merges (the createForResource pattern, pinned). */\nconst UPSERT_NAME_MAX_DISCOVERY_MERGES = 3;\n\n/** The default companyType (ww29-proven: 1). */\nconst DEFAULT_COMPANY_TYPE = 1;\n\n/** The dedup query bound (createIfNotExists parity: MaxRecords 10). */\nconst DEDUP_NAME_LIMIT = 10;\n\n/**\n * The blind-surface caveat that travels IN the typed result (both the EXISTS\n * and the CREATED results) — the dedup boundary the op cannot claim past.\n */\nexport const BLIND_SURFACE_CAVEAT =\n 'dedup only covers companies this API user can enumerate (the unowned surface is blind); a same-name company outside that scope is not detected';\n\n/** Safe create-body defaults the discovery loop may merge on a 500.\n * DELIBERATELY EMPTY: the ww29 required set { companyName, companyType, phone,\n * ownerResourceID } is fully filled by the node — any other vendor-named\n * field has no proven-safe default → COMPANY_CREATE_FAILED (vendor fields). */\nconst SAFE_COMPANY_CREATE_DEFAULTS: Record<string, unknown> = {};\n\n/** Create-path fault: no ownerResourceID (ZERO wire — the node cannot enumerate candidates). */\nexport class OwnerResourceRequiredError extends AutotaskError {\n constructor(message: string, options: { operation?: string } = {}) {\n super(message, {\n code: 'OWNER_RESOURCE_REQUIRED',\n category: 'validation',\n suggestedAction:\n 'pass params.ownerResourceID = an active non-API-only resource id (e.g. a ticket assignedResourceID via tickets.fullContext) — the resources table is blind to this API user (count/query return 0), so the node cannot enumerate candidates',\n ...options,\n });\n this.name = 'OwnerResourceRequiredError';\n }\n}\n\n/** Create-path fault: the owner resource is missing or inactive (resources.get is the blind-surface authority). */\nexport class CompanyResourceInvalidError extends AutotaskError {\n constructor(message: string, options: { resourceIds?: number[]; operation?: string; category?: AutotaskError['category']; suggestedAction?: string } = {}) {\n super(message, { code: 'RESOURCE_INVALID', category: 'validation', ...options });\n this.name = 'CompanyResourceInvalidError';\n }\n}\n\n/** The company-create 500 that survived the discovery loop (no safe default for the vendor-named field). */\nexport class CompanyCreateFailedError extends AutotaskError {\n /** The vendor-named fields (empty when the 500 body named nothing parseable). */\n readonly vendorFields: string[];\n\n constructor(message: string, vendorFields: string[], options: { operation?: string; httpStatus?: number; vendorError?: unknown; resourceIds?: number[] } = {}) {\n super(message, { code: 'COMPANY_CREATE_FAILED', category: 'validation', ...options });\n this.name = 'CompanyCreateFailedError';\n this.vendorFields = vendorFields;\n }\n}\n\nexport interface CompaniesUpsertByNameParams {\n /** The company phone (live-required on the ww29 create). */\n phone: string;\n /**\n * The owner resource (REQUIRED on the create path — an active NON-API-only\n * resource; the node cannot enumerate candidates: the resources table is\n * blind to the API user). Absent + a dedup miss → the typed\n * OWNER_RESOURCE_REQUIRED (zero wire, the remedy names the fixture-free fix).\n */\n ownerResourceID?: number;\n /** The company type picklist (default 1 — the ww29-proven value). */\n companyType?: number;\n}\n\n/** The typed blindSurface caveat (both the EXISTS and the CREATED results). */\nexport interface CompaniesBlindSurfaceCaveat {\n companies: true;\n caveat: string;\n /**\n * The S12-C base-level typed sentinel (additive) — present when the dedup\n * read hit the plan-pinned blind shape (zero items on companies.query).\n */\n sentinel?: BlindSurfaceInfo;\n}\n\n/** The typed EXISTS/CREATED result (blind-surface-aware). */\nexport interface CompaniesUpsertByNameResult {\n /** The company id (existing match or newly created). */\n id: number;\n /** False when the dedup match short-circuited the create. */\n created: boolean;\n /** The matched record (present when created is false). */\n existing?: Record<string, unknown>;\n /** The dedup boundary carried IN the result (a query-miss is NOT proof of absence). */\n blindSurface: CompaniesBlindSurfaceCaveat;\n /** The vendor side effects reported on the created result (the V5 auto-location). */\n sideEffects?: string[];\n}\n\n/**\n * `upsertByName` — find-or-create a company by name (blind-surface-aware).\n * Steps: (1) validate (zero wire); (2) the dedup query { companyName eq }\n * (1 wire, bounded, through the SDK queryBounded — the S12-C sentinel stamps\n * a blind-shape miss for free) → match → the typed EXISTS (with the caveat);\n * (3) miss + no ownerResourceID: the APPLY path throws the typed\n * OWNER_RESOURCE_REQUIRED (zero wire — the node cannot enumerate candidates);\n * the DRY path returns the simulated create envelope (the owner check is\n * APPLY-path only — pinned: a dry run never validates the owner); (4) miss +\n * owner → resources.get(ownerResourceID) (1 wire; get is the authority on\n * the blind resources table) → RESOURCE_INVALID on missing/inactive → the\n * create (1 wire) with { companyName, companyType (default 1), phone,\n * isActive: true, ownerResourceID } — a 500 (no safe default) →\n * COMPANY_CREATE_FAILED (vendor fields); (5) the created result reports the\n * V5 auto-location side effect + the blindSurface caveat.\n * `dryRun: true` = the dedup read + the simulated create; zero mutating wire.\n */\nexport async function upsertByName(\n resource: CompaniesResource,\n companyName: string,\n params: CompaniesUpsertByNameParams,\n opts: MutationOpts,\n http: HttpClient,\n): Promise<CompaniesUpsertByNameResult | DryRunResult<Record<string, unknown>>> {\n // (1) input validation (zero wire).\n if (typeof companyName !== 'string' || companyName.trim() === '') {\n throw new AutotaskConfigError('upsertByName: companyName is required (a non-empty string)', { operation: OP_UPSERT_NAME });\n }\n if (typeof params?.phone !== 'string' || params.phone.trim() === '') {\n throw new AutotaskConfigError('upsertByName: params.phone is required (a non-empty string — the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })', { operation: OP_UPSERT_NAME });\n }\n const companyType = params.companyType ?? DEFAULT_COMPANY_TYPE;\n if (typeof companyType !== 'number' || !Number.isSafeInteger(companyType) || companyType < 1) {\n throw new AutotaskConfigError(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 — the ww29-proven value)`, { operation: OP_UPSERT_NAME });\n }\n const owner = params.ownerResourceID;\n if (owner !== undefined && (typeof owner !== 'number' || !Number.isSafeInteger(owner) || owner < 1)) {\n throw new AutotaskConfigError(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });\n }\n\n // (2) the dedup query — { companyName eq }, bounded, through the SDK\n // queryBounded so the S12-C typed blind-surface sentinel stamps a blind-\n // shape miss for free (additive: the walk values are never mutated).\n const q = await resource.queryBounded({ filter: [{ field: 'companyName', op: 'eq', value: companyName }], limit: DEDUP_NAME_LIMIT });\n const caveat: CompaniesBlindSurfaceCaveat = {\n companies: true,\n caveat: BLIND_SURFACE_CAVEAT,\n ...(q.blindSurface !== undefined ? { sentinel: q.blindSurface } : {}),\n };\n const match = q.items[0];\n if (match !== undefined) {\n // FULL100 F6: the DRY caller takes the simulated envelope — the raw\n // EXISTS result carries no `simulated` mark, and the mode tool derives\n // the flag from `result.simulated === true` (an unmarked dry call\n // misreported simulated:false on the served surface — the same D4 class\n // F4 fixed on the changeStatus NO_CHANGE path; zero mutating wire\n // either way, the create is skipped by the dedup match).\n if (opts.dryRun === true) {\n return buildDryRunResult(\n {\n operation: OP_UPSERT_NAME,\n method: 'POST',\n path: '/V1.0/Companies',\n ids: [Number(match.id)],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'duplicate-detection', ok: true },\n ],\n impact: { affected: 0, scope: 'no write — the company already exists (dedup match; the create is skipped)', reversible: true },\n warnings: [`EXISTS: company '${companyName}' already exists (id ${Number(match.id)}) — the apply would skip the create (zero mutating wire).`],\n data: { reason: 'EXISTS', id: Number(match.id) } as unknown as Record<string, unknown>,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n return { id: Number(match.id), created: false, existing: match as unknown as Record<string, unknown>, blindSurface: caveat };\n }\n\n // The create body (the required set filled by the node — the owner is the\n // caller's param; the V5 auto-location side effect is reported below).\n const body: Record<string, unknown> = {\n companyName,\n companyType,\n phone: params.phone,\n isActive: true,\n ...(owner !== undefined ? { ownerResourceID: owner } : {}),\n };\n\n // Dry-run (section 19.3): the dedup read ran; the create is NEVER issued.\n // The owner check is APPLY-path only — pinned: a dry run never validates\n // the owner (the sweep dry row needs no live resource id).\n if (opts.dryRun === true) {\n const warnings: string[] = [\n `the vendor auto-creates a \"Primary Address\" location under the new company (V5 — UI-only cleanup; the delete 405 gap)`,\n ];\n if (owner === undefined) {\n warnings.push(\n 'ownerResourceID is REQUIRED on the apply path (the vendor requires it; the node cannot enumerate candidates — the resources table is blind to this API user (count/query return 0)): the apply throws the typed OWNER_RESOURCE_REQUIRED if it is still absent',\n );\n }\n return buildDryRunResult(\n {\n operation: OP_UPSERT_NAME,\n method: 'POST',\n path: '/V1.0/Companies',\n ids: [],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'duplicate-detection', ok: true },\n ],\n impact: { affected: 2, scope: 'company + the vendor auto-created Primary Address location', reversible: false },\n warnings,\n data: body,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n\n // (3) miss + no owner (APPLY path): the typed remedy (ZERO wire).\n if (owner === undefined) {\n throw new OwnerResourceRequiredError(\n `upsertByName: no company '${companyName}' is enumerable to this API user (the dedup query returned nothing — a miss is NOT proof of absence: the unowned surface is blind) and the create path requires ownerResourceID — companies.create requires ownerResourceID = an active non-API-only resource id; the resources table is blind to this API user (count/query return 0)`,\n { operation: OP_UPSERT_NAME },\n );\n }\n\n // (4) the owner precheck (1 wire — get is the authority on the blind\n // resources table).\n const ownerRes = await http.request<unknown>({ method: 'GET', path: `/V1.0/Resources/${owner}`, operation: OP_UPSERT_NAME });\n const ownerBody = ownerRes as { item?: Record<string, unknown> | null } | null;\n if (ownerBody === null || !('item' in ownerBody) || ownerBody.item === null || ownerBody.item === undefined) {\n throw new CompanyResourceInvalidError(\n `upsertByName: owner resource ${owner} was not found (resources.get returned item: null — the resources table is blind to this API user; get is the authority)`,\n { resourceIds: [owner], operation: OP_UPSERT_NAME, category: 'not_found', suggestedAction: 'Pass a known active non-API-only resource id (e.g. a ticket assignedResourceID via tickets.fullContext).' },\n );\n }\n if (ownerBody.item.isActive !== true) {\n throw new CompanyResourceInvalidError(\n `upsertByName: owner resource ${owner} is not active (isActive !== true) — the vendor requires an active NON-API-only owner`,\n { resourceIds: [owner], operation: OP_UPSERT_NAME, suggestedAction: 'Activate the resource or pass an active non-API-only one.' },\n );\n }\n\n // The create (the ≤3 discovery loop — SAFE_COMPANY_CREATE_DEFAULTS is\n // empty: a 500 is typed, never a blind retry).\n let merges = 0;\n for (;;) {\n try {\n const created = (await resource.create(body as unknown as CompanyCreate, {})) as { id: number };\n return {\n id: created.id,\n created: true,\n blindSurface: caveat,\n sideEffects: ['vendor auto-creates a \"Primary Address\" location under the new company (UI-only cleanup — the delete 405 gap, §11.5)'],\n };\n } catch (err) {\n if (!isAutotaskError(err) || err.vendorError === undefined) throw err; // network/auth/etc. propagate\n const named = (parseVendorErrors(err.vendorError) ?? []).map((e) => e.field).filter((f): f is string => f !== undefined);\n const seen = new Set<string>();\n const unique = [...named].filter((f) => (seen.has(f) ? false : (seen.add(f), true)));\n const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== undefined);\n if (hasDefault && merges < UPSERT_NAME_MAX_DISCOVERY_MERGES) {\n for (const f of unique) {\n if (body[f] === undefined && SAFE_COMPANY_CREATE_DEFAULTS[f] !== undefined) {\n body[f] = SAFE_COMPANY_CREATE_DEFAULTS[f];\n merges += 1;\n break;\n }\n }\n continue;\n }\n const detail = formatVendorDetail(err.vendorError);\n throw new CompanyCreateFailedError(\n `upsertByName: the vendor rejected the company create${unique.length > 0 ? ` naming field(s) ${unique.join(', ')}` : ''} (no proven-safe default — the ww29 required set is fully filled by the node)${detail ? ` — ${detail}` : ''}`,\n unique,\n {\n operation: OP_UPSERT_NAME,\n httpStatus: err.httpStatus,\n vendorError: err.vendorError,\n resourceIds: [owner],\n },\n );\n }\n }\n\n\n}\n// ---------------------------------------------------------------------------\n// S12-B (run mcp-fix-20261003): companies.fullProfile — the one-call company\n// profile.\n// ---------------------------------------------------------------------------\n\n/** Options for `fullProfile` (all optional; the pinned defaults). */\nexport interface CompanyFullProfileOptions {\n /** Max contact records (default 50). */\n contactLimit?: number;\n /** Max note records (default 50). */\n noteLimit?: number;\n /** Max open-ticket records (default 50). */\n ticketLimit?: number;\n /** Max project records (default 50). */\n projectLimit?: number;\n}\n\n/** One capped list part (a full page sets `capped: true` — more may exist). */\nexport interface CompanyFullProfilePart<TItem> {\n items: TItem[];\n capped: boolean;\n}\n\n/**\n * The open-tickets part (plan T6): the filtered `tickets.query`\n * (companyID eq + status noteq 5). S12-B P1 settled the blind-surface probe\n * live: the tickets count/query surface is blind UNFILTERED on ww29 (0 before\n * AND after a proven live create), but FILTERED tickets queries RETURN DATA\n * (3 open tickets via a companyID+status filter). So an EMPTY answer degrades\n * to the TYPED blind part (`blind: true` + the S12-C sentinel + the note)\n * ONLY when the filter-aware `blindStampFor` predicate stamps THIS call — on\n * the `unfiltered-blind` tickets surface a filtered empty answer is a TRUE\n * zero (the company has no open tickets), never a sentinel; a non-empty\n * answer is data and clears the flag. Never an error, never a misleading\n * empty list.\n */\nexport interface CompanyFullProfileOpenTickets {\n items: Ticket[];\n capped: boolean;\n /** True when the typed blind-surface sentinel stamps the empty answer. */\n blind: boolean;\n /** The open-status assumption (always) + the sentinel note when blind. */\n note: string;\n /** The S12-C typed sentinel, present exactly when `blind` is true. */\n blindSurface?: BlindSurfaceInfo;\n}\n\n/** The full company profile in ONE call (6 bounded reads: get + 5 queries). */\nexport interface CompanyFullProfile {\n company: Company;\n locations: CompanyFullProfilePart<CompanyLocation>;\n contacts: CompanyFullProfilePart<Contact>;\n notes: CompanyFullProfilePart<CompanyNote>;\n openTickets: CompanyFullProfileOpenTickets;\n projects: CompanyFullProfilePart<Project>;\n /** Per-part status: 'ok', or `openTickets: 'blind'` when the sentinel stamps. */\n parts: {\n company: 'ok';\n locations: 'ok';\n contacts: 'ok';\n notes: 'ok';\n openTickets: 'ok' | 'blind';\n projects: 'ok';\n };\n}\n\n/** The pinned open-status assumption (the ww29 picklist has no 'Closed'). */\nexport const OPEN_TICKETS_NOTE =\n 'open = status != 5 (Complete) — the ww29 ticket-status picklist has no Closed value; tickets in any other status count as open';\n\nconst PROFILE_PART_LIMIT = 50;\n\nfunction profilePartLimit(value: number | undefined, name: string): number {\n const n = value === undefined ? PROFILE_PART_LIMIT : Math.trunc(value);\n if (!Number.isInteger(n) || n < 1) {\n throw new AutotaskConfigError(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);\n }\n return n;\n}\n\nasync function scopedCompanyQuery<TItem>(http: HttpClient, path: string, companyID: Identifier, limit: number): Promise<TItem[]> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body: { MaxRecords: limit, filter: [{ field: 'companyID', op: 'eq', value: companyID }] },\n operation: 'companies.fullProfile',\n });\n return unwrapItems<TItem>(res).items;\n}\n\nexport async function fullProfile(\n resource: CompaniesResource,\n id: Identifier,\n opts: CompanyFullProfileOptions = {},\n http: HttpClient,\n): Promise<CompanyFullProfile> {\n const contactLimit = profilePartLimit(opts.contactLimit, 'contactLimit');\n const noteLimit = profilePartLimit(opts.noteLimit, 'noteLimit');\n const ticketLimit = profilePartLimit(opts.ticketLimit, 'ticketLimit');\n const projectLimit = profilePartLimit(opts.projectLimit, 'projectLimit');\n // parseIdentifier BEFORE the wire (QA F1 audit): an unsafe JS number is\n // already corrupted (the caller lost a digit) — refuse it typed, never send.\n const companyID = parseIdentifier(id, 'id');\n // 1) the company record (get is the authority even on the blind companies\n // surface; company missing → NOT_FOUND propagates).\n const company = await resource.get(companyID);\n // 2) the five companyID-filtered queries (scoped children via their global\n // query narrowed by companyID; tickets/projects carry the companyID FK\n // on the global table — they are NOT scoped children).\n const locations = await scopedCompanyQuery<CompanyLocation>(http, '/V1.0/CompanyLocations/query', companyID, PROFILE_PART_LIMIT);\n const contacts = await scopedCompanyQuery<Contact>(http, '/V1.0/Contacts/query', companyID, contactLimit);\n const notes = await scopedCompanyQuery<CompanyNote>(http, '/V1.0/CompanyNotes/query', companyID, noteLimit);\n const projects = await scopedCompanyQuery<Project>(http, '/V1.0/Projects/query', companyID, projectLimit);\n const openRows = await (async (): Promise<Ticket[]> => {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Tickets/query',\n body: {\n MaxRecords: ticketLimit,\n filter: [{ field: 'companyID', op: 'eq', value: companyID }, { field: 'status', op: 'noteq', value: 5 }],\n },\n operation: 'companies.fullProfile',\n });\n return unwrapItems<Ticket>(res).items;\n })();\n // 3) the typed blind-part degradation (the S12-C sentinel semantics,\n // post-merge P1 filter-aware): the pinned `tickets.query` stamp\n // attaches to the EMPTY answer only when the filter-aware predicate\n // says the blind surface covers THIS (filtered) call; a non-empty\n // answer — or a filtered empty answer on an `unfiltered-blind`\n // surface — is data (a true zero), no stamp.\n let openTickets: CompanyFullProfileOpenTickets = {\n items: openRows,\n capped: openRows.length >= ticketLimit,\n blind: false,\n note: OPEN_TICKETS_NOTE,\n };\n if (openRows.length === 0) {\n // Post-merge P1: the filter-aware stamp predicate (the SAME one the base\n // wraps use) applied to the filter this call actually sent — it is\n // ALWAYS filtered (companyID + status), and S12-B P1 live-verified the\n // filtered tickets.query RETURNS DATA on ww29: a filtered empty answer\n // is a TRUE zero (the company has no open tickets), never a sentinel.\n // Only an `unowned-blind`/`fully-blind` class could stamp this call.\n const stamp = blindStampFor(BLIND_SURFACE_STAMPS['tickets']?.query, [\n { field: 'companyID', op: 'eq', value: companyID },\n { field: 'status', op: 'noteq', value: 5 },\n ]);\n if (stamp !== undefined) {\n openTickets = {\n items: openRows,\n capped: openRows.length >= ticketLimit,\n blind: true,\n note: `${stamp.note} ${OPEN_TICKETS_NOTE}`,\n blindSurface: stamp,\n };\n }\n }\n return {\n company,\n locations: { items: locations, capped: locations.length >= PROFILE_PART_LIMIT },\n contacts: { items: contacts, capped: contacts.length >= contactLimit },\n notes: { items: notes, capped: notes.length >= noteLimit },\n openTickets,\n projects: { items: projects, capped: projects.length >= projectLimit },\n parts: {\n company: 'ok',\n locations: 'ok',\n contacts: 'ok',\n notes: 'ok',\n openTickets: openTickets.blind ? 'blind' : 'ok',\n projects: 'ok',\n },\n };\n}\n","/**\n * CompaniesResource — Company resource (G4 batch A, plan key 'companies').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Company, CompanyCreate, CompanyUpdate, CompanySummary, CompanyContext } from '../types/companies.js';\nimport type { Resource } from '../types/resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as companiesSpecial from './special/companies.js';\nimport type { CompaniesDomainSearchOptions, CompaniesUpsertByNameParams, CompaniesUpsertByNameResult, CompanyFullProfile, CompanyFullProfileOptions } from './special/companies.js';\n\n/** Query params for CompaniesResource (the G3 filter surface; no per-resource invention). */\nexport type CompaniesResourceQueryParams = QueryParams;\n\nexport class CompaniesResource extends BaseResource<Company, CompanyCreate, CompanyUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'companies',\n resourcePath: '/V1.0/Companies',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['companyName'],\n }, pageSize);\n }\n\n /** Query Company records with the G3 filter surface (server-side JSON filter). */\n query(params?: CompaniesResourceQueryParams): AsyncIterable<Company> {\n return this.queryItems(params);\n }\n\n /** Get every Company record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompaniesResourceQueryParams): Promise<Company[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompaniesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Company> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: CompanyCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<CompanyCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: CompanyUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanyUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Company from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on companyName). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Company records: bounded contains on companyName (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<CompanySummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Get the Company with its primary context records in one call (each part a single-record\n * fetch; no sub-lists; absent/dangling references come back null). */\n async getContext(id: Identifier): Promise<CompanyContext> {\n const company = await this.fetchRecordRaw<Company>('/V1.0/Companies', id);\n const root = company as unknown as Record<string, unknown>;\n const ownerResource = await this.contextFetch<Resource>('/V1.0/Resources', (root as Record<string, unknown>)['ownerResourceID'] as number | undefined);\n const parentCompany = await this.contextFetch<Company>('/V1.0/Companies', (root as Record<string, unknown>)['parentCompanyID'] as number | undefined);\n return { company, ownerResource, parentCompany };\n }\n\n /** Node-parity special op (hand-written in src/resources/special/companies.ts). */\n searchByDomain(domain: string, opts?: CompaniesDomainSearchOptions): Promise<Company[]> {\n return companiesSpecial.searchByDomain(this, domain, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/companies.ts). */\n searchByIdentity(identity: { companyName?: string; email?: string; website?: string }, opts?: { limit?: number }): Promise<Company[]> {\n return companiesSpecial.searchByIdentity(this, identity, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/companies.ts). */\n upsertByName(companyName: string, params: CompaniesUpsertByNameParams, opts: MutationOpts = {}): Promise<CompaniesUpsertByNameResult | DryRunResult<Record<string, unknown>>> {\n return companiesSpecial.upsertByName(this, companyName, params, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/companies.ts). */\n fullProfile(id: Identifier, opts?: CompanyFullProfileOptions): Promise<CompanyFullProfile> {\n return companiesSpecial.fullProfile(this, id, opts, this.http);\n }\n}\n","/**\n * CompanyAlertsResource — CompanyAlert resource (G4 batch A, plan key 'company_alerts').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/Alerts —\n * the global query/count stay unscoped (narrow with the 'companyID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { CompanyAlert, CompanyAlertCreate, CompanyAlertUpdate, CompanyAlertSummary } from '../types/company_alerts.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CompanyAlertsResource (the G3 filter surface; no per-resource invention). */\nexport type CompanyAlertsResourceQueryParams = QueryParams;\n\nexport class CompanyAlertsResource extends BaseResource<CompanyAlert, CompanyAlertCreate, CompanyAlertUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'company_alerts',\n resourcePath: '/V1.0/CompanyAlerts',\n parentScopedPath: '/V1.0/Companies/{parentId}/Alerts',\n parentField: 'companyID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query CompanyAlert records (global; narrow with the companyID filter). */\n query(params?: CompanyAlertsResourceQueryParams): AsyncIterable<CompanyAlert> {\n return this.queryItems(params);\n }\n\n /** Get every CompanyAlert record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompanyAlertsResourceQueryParams): Promise<CompanyAlert[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompanyAlertsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Companies/{parentId}/Alerts/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<CompanyAlert> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: CompanyAlertCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<CompanyAlertCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: CompanyAlertUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanyAlertUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_alerts.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_alerts.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a CompanyAlert from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanyAlertSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * CompanyLocationsResource — CompanyLocation resource (G4 batch A, plan key 'company_locations').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/Locations —\n * the global query/count stay unscoped (narrow with the 'companyID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { CompanyLocation, CompanyLocationCreate, CompanyLocationUpdate, CompanyLocationSummary } from '../types/company_locations.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CompanyLocationsResource (the G3 filter surface; no per-resource invention). */\nexport type CompanyLocationsResourceQueryParams = QueryParams;\n\nexport class CompanyLocationsResource extends BaseResource<CompanyLocation, CompanyLocationCreate, CompanyLocationUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'company_locations',\n resourcePath: '/V1.0/CompanyLocations',\n parentScopedPath: '/V1.0/Companies/{parentId}/Locations',\n parentField: 'companyID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query CompanyLocation records (global; narrow with the companyID filter). */\n query(params?: CompanyLocationsResourceQueryParams): AsyncIterable<CompanyLocation> {\n return this.queryItems(params);\n }\n\n /** Get every CompanyLocation record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompanyLocationsResourceQueryParams): Promise<CompanyLocation[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompanyLocationsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Companies/{parentId}/Locations/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<CompanyLocation> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: CompanyLocationCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<CompanyLocationCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: CompanyLocationUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanyLocationUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_locations.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_locations.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a CompanyLocation from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanyLocationSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search CompanyLocation records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<CompanyLocationSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * CompanyNotesResource — CompanyNote resource (G4 batch A, plan key 'company_notes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/Notes —\n * the global query/count stay unscoped (narrow with the 'companyID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { CompanyNote, CompanyNoteCreate, CompanyNoteUpdate, CompanyNoteSummary } from '../types/company_notes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CompanyNotesResource (the G3 filter surface; no per-resource invention). */\nexport type CompanyNotesResourceQueryParams = QueryParams;\n\nexport class CompanyNotesResource extends BaseResource<CompanyNote, CompanyNoteCreate, CompanyNoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'company_notes',\n resourcePath: '/V1.0/CompanyNotes',\n parentScopedPath: '/V1.0/Companies/{parentId}/Notes',\n parentField: 'companyID',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n staleField: 'lastModifiedDate',\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query CompanyNote records (global; narrow with the companyID filter). */\n query(params?: CompanyNotesResourceQueryParams): AsyncIterable<CompanyNote> {\n return this.queryItems(params);\n }\n\n /** Get every CompanyNote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompanyNotesResourceQueryParams): Promise<CompanyNote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompanyNotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Companies/{parentId}/Notes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<CompanyNote> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: CompanyNoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<CompanyNoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: CompanyNoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanyNoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_notes.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a CompanyNote from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanyNoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search CompanyNote records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<CompanyNoteSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * CompanySiteConfigurationsResource — CompanySiteConfigurations resource (G4 batch A, plan key 'company_site_configurations').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/SiteConfigurations —\n * the global query/count stay unscoped (narrow with the 'companyID' filter).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { CompanySiteConfigurations, CompanySiteConfigurationsCreate, CompanySiteConfigurationsUpdate, CompanySiteConfigurationsSummary } from '../types/company_site_configurations.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CompanySiteConfigurationsResource (the G3 filter surface; no per-resource invention). */\nexport type CompanySiteConfigurationsResourceQueryParams = QueryParams;\n\nexport class CompanySiteConfigurationsResource extends BaseResource<CompanySiteConfigurations, CompanySiteConfigurationsCreate, CompanySiteConfigurationsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'company_site_configurations',\n resourcePath: '/V1.0/CompanySiteConfigurations',\n parentScopedPath: '/V1.0/Companies/{parentId}/SiteConfigurations',\n parentField: 'companyID',\n deletable: false,\n udfCapable: true,\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query CompanySiteConfigurations records (global; narrow with the companyID filter). */\n query(params?: CompanySiteConfigurationsResourceQueryParams): AsyncIterable<CompanySiteConfigurations> {\n return this.queryItems(params);\n }\n\n /** Get every CompanySiteConfigurations record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompanySiteConfigurationsResourceQueryParams): Promise<CompanySiteConfigurations[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompanySiteConfigurationsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Companies/{parentId}/SiteConfigurations/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<CompanySiteConfigurations> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: CompanySiteConfigurationsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanySiteConfigurationsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'company_site_configurations.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a CompanySiteConfigurations from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanySiteConfigurationsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * CompanyWebhooksResource — CompanyWebhook resource (G4 batch A, plan key 'company_webhooks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/Webhook —\n * the global query/count stay unscoped (narrow with the 'parent' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { CompanyWebhook, CompanyWebhookCreate, CompanyWebhookUpdate, CompanyWebhookSummary } from '../types/company_webhooks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CompanyWebhooksResource (the G3 filter surface; no per-resource invention). */\nexport type CompanyWebhooksResourceQueryParams = QueryParams;\n\nexport class CompanyWebhooksResource extends BaseResource<CompanyWebhook, CompanyWebhookCreate, CompanyWebhookUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'company_webhooks',\n resourcePath: '/V1.0/CompanyWebhooks',\n parentScopedPath: '/V1.0/Companies/{parentId}/Webhook',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query CompanyWebhook records (global; narrow with the parent filter). */\n query(params?: CompanyWebhooksResourceQueryParams): AsyncIterable<CompanyWebhook> {\n return this.queryItems(params);\n }\n\n /** Get every CompanyWebhook record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CompanyWebhooksResourceQueryParams): Promise<CompanyWebhook[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CompanyWebhooksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<CompanyWebhook> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: CompanyWebhookCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<CompanyWebhookCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: CompanyWebhookUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CompanyWebhookUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'company_webhooks.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a CompanyWebhook from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CompanyWebhookSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search CompanyWebhook records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<CompanyWebhookSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ConfigurationItemBillingProductAssociationsResource — ConfigurationItemBillingProductAssociations resource (G4 batch A, plan key 'configuration_item_billing_product_associations').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/BillingProductAssociations —\n * the global query/count stay unscoped (narrow with the 'configurationItemID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemBillingProductAssociations, ConfigurationItemBillingProductAssociationsCreate, ConfigurationItemBillingProductAssociationsUpdate, ConfigurationItemBillingProductAssociationsSummary } from '../types/configuration_item_billing_product_associations.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemBillingProductAssociationsResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemBillingProductAssociationsResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemBillingProductAssociationsResource extends BaseResource<ConfigurationItemBillingProductAssociations, ConfigurationItemBillingProductAssociationsCreate, ConfigurationItemBillingProductAssociationsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_billing_product_associations',\n resourcePath: '/V1.0/ConfigurationItemBillingProductAssociations',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/BillingProductAssociations',\n parentField: 'configurationItemID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemBillingProductAssociations records (global; narrow with the configurationItemID filter). */\n query(params?: ConfigurationItemBillingProductAssociationsResourceQueryParams): AsyncIterable<ConfigurationItemBillingProductAssociations> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemBillingProductAssociations record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemBillingProductAssociationsResourceQueryParams): Promise<ConfigurationItemBillingProductAssociations[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemBillingProductAssociationsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItems/{parentId}/BillingProductAssociations/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemBillingProductAssociations> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ConfigurationItemBillingProductAssociationsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemBillingProductAssociationsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ConfigurationItemBillingProductAssociationsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemBillingProductAssociationsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_billing_product_associations.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_billing_product_associations.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ConfigurationItemBillingProductAssociations from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemBillingProductAssociationsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ConfigurationItemCategoriesResource — ConfigurationItemCategory resource (G5 batch B, plan key 'configuration_item_categories').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemCategory, ConfigurationItemCategoryCreate, ConfigurationItemCategoryUpdate, ConfigurationItemCategorySummary } from '../types/configuration_item_categories.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemCategoriesResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemCategoriesResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemCategoriesResource extends BaseResource<ConfigurationItemCategory, ConfigurationItemCategoryCreate, ConfigurationItemCategoryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_categories',\n resourcePath: '/V1.0/ConfigurationItemCategories',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ConfigurationItemCategory records with the G3 filter surface (server-side JSON filter). */\n query(params?: ConfigurationItemCategoriesResourceQueryParams): AsyncIterable<ConfigurationItemCategory> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemCategory record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemCategoriesResourceQueryParams): Promise<ConfigurationItemCategory[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemCategoriesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ConfigurationItemCategory> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ConfigurationItemCategoryCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemCategoryCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ConfigurationItemCategoryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemCategoryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a ConfigurationItemCategory from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemCategorySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ConfigurationItemCategory records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ConfigurationItemCategorySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ConfigurationItemCategoryUdfAssociationsResource — ConfigurationItemCategoryUdfAssociation resource (G5 batch B, plan key 'configuration_item_category_udf_associations').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_item_categories': CRUD under /V1.0/ConfigurationItemCategories/{parentId}/UdfAssociations —\n * the global query/count stay unscoped (narrow with the 'configurationItemCategoryID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemCategoryUdfAssociation, ConfigurationItemCategoryUdfAssociationCreate, ConfigurationItemCategoryUdfAssociationUpdate, ConfigurationItemCategoryUdfAssociationSummary } from '../types/configuration_item_category_udf_associations.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemCategoryUdfAssociationsResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemCategoryUdfAssociationsResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemCategoryUdfAssociationsResource extends BaseResource<ConfigurationItemCategoryUdfAssociation, ConfigurationItemCategoryUdfAssociationCreate, ConfigurationItemCategoryUdfAssociationUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_category_udf_associations',\n resourcePath: '/V1.0/ConfigurationItemCategoryUdfAssociations',\n parentScopedPath: '/V1.0/ConfigurationItemCategories/{parentId}/UdfAssociations',\n parentField: 'configurationItemCategoryID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ConfigurationItemCategories',\n }, pageSize);\n }\n\n /** Query ConfigurationItemCategoryUdfAssociation records (global; narrow with the configurationItemCategoryID filter). */\n query(params?: ConfigurationItemCategoryUdfAssociationsResourceQueryParams): AsyncIterable<ConfigurationItemCategoryUdfAssociation> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemCategoryUdfAssociation record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemCategoryUdfAssociationsResourceQueryParams): Promise<ConfigurationItemCategoryUdfAssociation[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemCategoryUdfAssociationsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItemCategories/{parentId}/UdfAssociations/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemCategoryUdfAssociation> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ConfigurationItemCategoryUdfAssociationCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemCategoryUdfAssociationCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ConfigurationItemCategoryUdfAssociationUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemCategoryUdfAssociationUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_category_udf_associations.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_category_udf_associations.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ConfigurationItemCategoryUdfAssociation from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemCategoryUdfAssociationSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ConfigurationItemDnsRecordsResource — ConfigurationItemDnsRecord resource (G4 batch A, plan key 'configuration_item_dns_records').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/DnsRecords —\n * the global query/count stay unscoped (narrow with the 'configurationItemID' filter).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemDnsRecord, ConfigurationItemDnsRecordCreate, ConfigurationItemDnsRecordUpdate, ConfigurationItemDnsRecordSummary } from '../types/configuration_item_dns_records.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemDnsRecordsResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemDnsRecordsResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemDnsRecordsResource extends BaseResource<ConfigurationItemDnsRecord, ConfigurationItemDnsRecordCreate, ConfigurationItemDnsRecordUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_dns_records',\n resourcePath: '/V1.0/ConfigurationItemDnsRecords',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/DnsRecords',\n parentField: 'configurationItemID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemDnsRecord records (global; narrow with the configurationItemID filter). */\n query(params?: ConfigurationItemDnsRecordsResourceQueryParams): AsyncIterable<ConfigurationItemDnsRecord> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemDnsRecord record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemDnsRecordsResourceQueryParams): Promise<ConfigurationItemDnsRecord[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemDnsRecordsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItems/{parentId}/DnsRecords/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemDnsRecord> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_dns_records.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ConfigurationItemDnsRecord from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemDnsRecordSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ConfigurationItemNotesResource — ConfigurationItemNote resource (G4 batch A, plan key 'configuration_item_notes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/Notes —\n * the global query/count stay unscoped (narrow with the 'configurationItemID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemNote, ConfigurationItemNoteCreate, ConfigurationItemNoteUpdate, ConfigurationItemNoteSummary } from '../types/configuration_item_notes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemNotesResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemNotesResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemNotesResource extends BaseResource<ConfigurationItemNote, ConfigurationItemNoteCreate, ConfigurationItemNoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_notes',\n resourcePath: '/V1.0/ConfigurationItemNotes',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/Notes',\n parentField: 'configurationItemID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemNote records (global; narrow with the configurationItemID filter). */\n query(params?: ConfigurationItemNotesResourceQueryParams): AsyncIterable<ConfigurationItemNote> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemNote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemNotesResourceQueryParams): Promise<ConfigurationItemNote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemNotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItems/{parentId}/Notes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemNote> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ConfigurationItemNoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemNoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ConfigurationItemNoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemNoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_notes.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ConfigurationItemNote from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemNoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ConfigurationItemRelatedItemsResource — ConfigurationItemRelatedItem resource (G4 batch A, plan key 'configuration_item_related_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/RelatedItems —\n * the global query/count stay unscoped (narrow with the 'configurationItemID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemRelatedItem, ConfigurationItemRelatedItemCreate, ConfigurationItemRelatedItemUpdate, ConfigurationItemRelatedItemSummary } from '../types/configuration_item_related_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemRelatedItemsResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemRelatedItemsResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemRelatedItemsResource extends BaseResource<ConfigurationItemRelatedItem, ConfigurationItemRelatedItemCreate, ConfigurationItemRelatedItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_related_items',\n resourcePath: '/V1.0/ConfigurationItemRelatedItems',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/RelatedItems',\n parentField: 'configurationItemID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemRelatedItem records (global; narrow with the configurationItemID filter). */\n query(params?: ConfigurationItemRelatedItemsResourceQueryParams): AsyncIterable<ConfigurationItemRelatedItem> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemRelatedItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemRelatedItemsResourceQueryParams): Promise<ConfigurationItemRelatedItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemRelatedItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItems/{parentId}/RelatedItems/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemRelatedItem> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ConfigurationItemRelatedItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemRelatedItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_related_items.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ConfigurationItemRelatedItem from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemRelatedItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Configuration items special ops — node-parity `moveConfigurationItem`\n * (G4 batch A).\n *\n * The node's \"move configuration item\" composition: CIs are global records\n * carrying a `companyID`, so a \"move\" is a copy-under-destination-company +\n * deactivate-source composition (the vendor has no re-parent op).\n */\nimport { AutotaskConfigError, NotFoundError, StaleObjectError } from '../../errors.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport type { HttpClient } from '../../http.js';\nimport { buildDryRunResult } from '../base.js';\nimport { unwrapItems } from '../../http.js';\nimport { RELATIONSHIP_MAP } from '../../relationships.js';\nimport type { ConfigurationItemsResource } from '../configuration_items.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\nimport type { ConfigurationItem } from '../../types/configuration_items.js';\nimport type { ConfigurationItemCategory } from '../../types/configuration_item_categories.js';\nimport type { ConfigurationItemType } from '../../types/configuration_item_types.js';\nimport type { ConfigurationItemNote } from '../../types/configuration_item_notes.js';\nimport type { ConfigurationItemRelatedItem } from '../../types/configuration_item_related_items.js';\nimport type { ConfigurationItemBillingProductAssociations } from '../../types/configuration_item_billing_product_associations.js';\n\nexport interface MoveConfigurationItemOptions {\n /** The company the item is copied under (required; number, or a canonical integer string for ids above 2^53). */\n destinationCompanyId: Identifier;\n /** Copy the source's userDefinedFields (default true). */\n copyUdfs?: boolean;\n /** Reference title for the copy (defaults to the source title). */\n newReferenceTitle?: string;\n /** Deactivate the source after the copy (default true). */\n deactivateSource?: boolean;\n /** Dry-run: verify + enumerate the copy/deactivate and return the pinned\n * envelope instead of issuing the mutation (section 19.3). */\n dryRun?: boolean;\n /** The caller's snapshot of the source's lastModifiedDate; a mismatch\n * throws STALE_OBJECT before the mutation. */\n lastModifiedDate?: string;\n}\n\nexport interface MoveConfigurationItemResult {\n sourceId: Identifier;\n /** The new configuration item's id under the destination company. */\n newId: number;\n destinationCompanyId: Identifier;\n sourceDeactivated: boolean;\n}\n\nasync function fetchRecord(http: HttpClient, path: string, label: string): Promise<Record<string, unknown>> {\n const res = await http.request<unknown>({ method: 'GET', path, operation: 'configuration_items.moveConfigurationItem' });\n const body = res as { item?: Record<string, unknown> | null } | null;\n if (body === null || !('item' in body) || body.item === null || body.item === undefined) {\n throw new NotFoundError(`${label} not found`, { code: 'NOT_FOUND', category: 'not_found' });\n }\n return body.item;\n}\n\n/** Copy the source CI under `destinationCompanyId` and deactivate the source. */\nexport async function moveConfigurationItem(\n _resource: ConfigurationItemsResource,\n sourceId: Identifier,\n opts: MoveConfigurationItemOptions,\n http: HttpClient,\n): Promise<MoveConfigurationItemResult | DryRunResult<Record<string, unknown>>> {\n const numericSource = parseIdentifier(sourceId, 'sourceId');\n if (opts?.destinationCompanyId === undefined) {\n throw new AutotaskConfigError('moveConfigurationItem: destinationCompanyId is required');\n }\n const destId = parseIdentifier(opts.destinationCompanyId, 'destinationCompanyId');\n\n const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`);\n await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`);\n\n const body: Record<string, unknown> = { ...source };\n delete body.id;\n delete body.soapParentPropertyId;\n if (opts.copyUdfs === false) delete body.userDefinedFields;\n body.companyID = destId;\n body.isActive = true;\n if (opts.newReferenceTitle !== undefined) {\n if (opts.newReferenceTitle.trim() === '') throw new AutotaskConfigError('moveConfigurationItem: newReferenceTitle must be non-empty');\n body.referenceTitle = opts.newReferenceTitle.trim();\n }\n\n // Stale-object guard (section 19.3): the caller's snapshot of the source's\n // lastModifiedDate must match before the copy-under-destination proceeds.\n if (opts.lastModifiedDate !== undefined) {\n const current = (source as { lastModifiedDate?: string }).lastModifiedDate;\n if (current !== opts.lastModifiedDate) {\n throw new StaleObjectError(\n `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${current ?? 'unknown'})`,\n { operation: 'configuration_items.moveConfigurationItem', resourceIds: [numericSource] },\n );\n }\n }\n if (opts.dryRun === true) {\n return buildDryRunResult({\n operation: 'configuration_items.moveConfigurationItem',\n method: 'POST',\n path: '/V1.0/ConfigurationItems',\n ids: [numericSource],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'source-exists', ok: true },\n { name: 'destination-exists', ok: true },\n ],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings: opts.deactivateSource === false ? [] : ['source item will be deactivated after the copy'],\n data: body,\n }, { redactPersonalData: http.redactPersonalData });\n }\n\n const created = await http.request<unknown>({\n method: 'POST',\n path: '/V1.0/ConfigurationItems',\n body,\n operation: 'configuration_items.moveConfigurationItem',\n });\n const createdBody = created as { itemId?: number; id?: number } | null;\n const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : undefined;\n if (typeof newId !== 'number') {\n throw new AutotaskConfigError('moveConfigurationItem: vendor create response has no itemId');\n }\n\n let sourceDeactivated = false;\n if (opts.deactivateSource !== false) {\n // D1: configuration items are collection-only-writable (the spec's item\n // path is GET-only; the item-path PUT 405s) — the deactivate PUT hits\n // the COLLECTION with the source id in the body.\n await http.request<unknown>({\n method: 'PUT',\n path: '/V1.0/ConfigurationItems',\n body: { id: numericSource, isActive: false },\n operation: 'configuration_items.moveConfigurationItem',\n });\n sourceDeactivated = true;\n }\n return { sourceId: numericSource, newId, destinationCompanyId: destId, sourceDeactivated };\n}\n\n\n// ---------------------------------------------------------------------------\n// S12-B (run mcp-fix-20261003): configuration_items.profile — the one-call\n// CI profile.\n// ---------------------------------------------------------------------------\n\n/** Options for `profile` (all optional; the pinned defaults). */\nexport interface ConfigurationItemProfileOptions {\n /** Max note records (default 50). */\n noteLimit?: number;\n /** Max related-item records (default 50). */\n relatedLimit?: number;\n}\n\n/** One capped list part (a full page sets `capped: true` — more may exist). */\nexport interface ConfigurationItemProfilePart<TItem> {\n items: TItem[];\n capped: boolean;\n}\n\n/**\n * The billing-product associations part (plan T7): the raw association rows\n * (billingProductID FK) + the TYPED product-wall annotation. On a productless\n * tenant (ww29: products.count = 0, live-verified — the wall that blocked\n * every CI create) the association's product references cannot be\n * enumerated: the served zone-facts quirk annotates the part\n * (`blind: true` + `note`) — NEVER an error.\n */\nexport interface ConfigurationItemProfileProductAssociations {\n items: ConfigurationItemBillingProductAssociations[];\n capped: boolean;\n /** True when the served zone facts pin the product wall for this tenant. */\n blind: boolean;\n /** The served zone-facts quirk text (present exactly when `blind`). */\n note?: string;\n}\n\n/** The full configuration-item profile in ONE call (<=6 bounded reads). */\nexport interface ConfigurationItemProfile {\n ci: ConfigurationItem;\n /** Null when the item carries no configurationItemType (or the record misses). */\n type: ConfigurationItemType | null;\n /** Null when the item carries no configurationItemCategoryID (or the record misses). */\n category: ConfigurationItemCategory | null;\n notes: ConfigurationItemProfilePart<ConfigurationItemNote>;\n relatedItems: ConfigurationItemProfilePart<ConfigurationItemRelatedItem>;\n productAssociations: ConfigurationItemProfileProductAssociations;\n /** Per-part status: FK parts 'ok' | 'absent' (dangling/missing FK); list parts 'ok'; productAssociations 'ok' | 'blind' (the typed wall annotation). */\n parts: {\n ci: 'ok';\n type: 'ok' | 'absent';\n category: 'ok' | 'absent';\n notes: 'ok';\n relatedItems: 'ok';\n productAssociations: 'ok' | 'blind';\n };\n}\n\nconst PROFILE_PART_LIMIT = 50;\n\nfunction profilePartLimit(value: number | undefined, name: string): number {\n const n = value === undefined ? PROFILE_PART_LIMIT : Math.trunc(value);\n if (!Number.isInteger(n) || n < 1) {\n throw new AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);\n }\n return n;\n}\n\n/**\n * A profile part fetch: a single-record read that degrades to `null` when\n * the reference id is absent (or the vendor answers not-found). Other errors\n * propagate — a part that fails on a real fault is not a \"missing reference\".\n */\nasync function contextFetchPart<TRec>(http: HttpClient, entityPath: string, referenceId: unknown): Promise<TRec | null> {\n if (typeof referenceId !== 'number' || !Number.isSafeInteger(referenceId) || referenceId < 0) {\n return null;\n }\n try {\n const res = await http.request<unknown>({\n method: 'GET',\n path: `${entityPath}/${referenceId}`,\n operation: 'configuration_items.profile',\n });\n const body = res as { item?: TRec | null } | null;\n if (body === null || !('item' in body)) {\n throw new NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId] });\n }\n if (body.item === null || body.item === undefined) {\n throw new NotFoundError('context part not found', { resourceIds: [referenceId] });\n }\n return body.item;\n } catch (err) {\n if (err instanceof NotFoundError) return null;\n throw err;\n }\n}\n\nasync function ciScopedQuery<TItem>(http: HttpClient, path: string, itemID: Identifier, limit: number): Promise<TItem[]> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body: { MaxRecords: limit, filter: [{ field: 'configurationItemID', op: 'eq', value: itemID }] },\n operation: 'configuration_items.profile',\n });\n return unwrapItems<TItem>(res).items;\n}\n\nexport async function profile(\n resource: ConfigurationItemsResource,\n id: Identifier,\n opts: ConfigurationItemProfileOptions = {},\n http: HttpClient,\n): Promise<ConfigurationItemProfile> {\n const noteLimit = profilePartLimit(opts.noteLimit, 'noteLimit');\n const relatedLimit = profilePartLimit(opts.relatedLimit, 'relatedLimit');\n // 1) the item record (get is the authority; item missing → NOT_FOUND propagates).\n const ci = await resource.get(id);\n const root = ci as unknown as Record<string, unknown>;\n // 2) the type / category parts (a dangling FK skips its read → null part).\n const type = await contextFetchPart<ConfigurationItemType>(http, '/V1.0/ConfigurationItemTypes', root['configurationItemType']);\n const category = await contextFetchPart<ConfigurationItemCategory>(http, '/V1.0/ConfigurationItemCategories', root['configurationItemCategoryID']);\n // 3) the item-scoped child queries (notes / related items / billing-product\n // associations) — 3 of the <=6 reads.\n const notes = await ciScopedQuery<ConfigurationItemNote>(http, '/V1.0/ConfigurationItemNotes/query', id, noteLimit);\n const relatedItems = await ciScopedQuery<ConfigurationItemRelatedItem>(http, '/V1.0/ConfigurationItemRelatedItems/query', id, relatedLimit);\n const associations = await ciScopedQuery<ConfigurationItemBillingProductAssociations>(http, '/V1.0/ConfigurationItemBillingProductAssociations/query', id, PROFILE_PART_LIMIT);\n // 4) the TYPED product-wall annotation: derived from the SERVED zone facts\n // (the plan-pinned, live-verified quirk) — zero wire, never an error.\n const wallQuirk = RELATIONSHIP_MAP['configuration_items']?.zoneFacts?.quirks?.find((q) => q.startsWith('product wall'));\n const productAssociations: ConfigurationItemProfileProductAssociations = {\n items: associations,\n capped: associations.length >= PROFILE_PART_LIMIT,\n blind: wallQuirk !== undefined,\n };\n if (wallQuirk !== undefined) productAssociations.note = wallQuirk;\n return {\n ci,\n type,\n category,\n notes: { items: notes, capped: notes.length >= noteLimit },\n relatedItems: { items: relatedItems, capped: relatedItems.length >= relatedLimit },\n productAssociations,\n parts: {\n ci: 'ok',\n type: type !== null ? 'ok' : 'absent',\n category: category !== null ? 'ok' : 'absent',\n notes: 'ok',\n relatedItems: 'ok',\n productAssociations: wallQuirk !== undefined ? 'blind' : 'ok',\n },\n };\n}\n","/**\n * ConfigurationItemsResource — ConfigurationItem resource (G4 batch A, plan key 'configuration_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItem, ConfigurationItemCreate, ConfigurationItemUpdate, ConfigurationItemSummary, ConfigurationItemContext } from '../types/configuration_items.js';\nimport type { Company } from '../types/companies.js';\nimport type { Contact } from '../types/contacts.js';\nimport type { Contract } from '../types/contracts.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as configurationitemsSpecial from './special/configuration_items.js';\nimport type { MoveConfigurationItemOptions, MoveConfigurationItemResult, ConfigurationItemProfile, ConfigurationItemProfileOptions } from './special/configuration_items.js';\n\n/** Query params for ConfigurationItemsResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemsResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemsResource extends BaseResource<ConfigurationItem, ConfigurationItemCreate, ConfigurationItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_items',\n resourcePath: '/V1.0/ConfigurationItems',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['referenceTitle'],\n }, pageSize);\n }\n\n /** Query ConfigurationItem records with the G3 filter surface (server-side JSON filter). */\n query(params?: ConfigurationItemsResourceQueryParams): AsyncIterable<ConfigurationItem> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemsResourceQueryParams): Promise<ConfigurationItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ConfigurationItem> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ConfigurationItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ConfigurationItemUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a ConfigurationItem from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on referenceTitle). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** findBySerial — exact 'serialNumber' filter; ambiguity throws RESOLUTION_AMBIGUOUS with the candidate ids. */\n async findBySerial(value: string): Promise<ConfigurationItemSummary | null> {\n return this.findByField('serialNumber', value);\n }\n\n /** Search ConfigurationItem records: bounded contains on referenceTitle (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ConfigurationItemSummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Get the ConfigurationItem with its primary context records in one call (each part a single-record\n * fetch; no sub-lists; absent/dangling references come back null). */\n async getContext(id: Identifier): Promise<ConfigurationItemContext> {\n const configurationItem = await this.fetchRecordRaw<ConfigurationItem>('/V1.0/ConfigurationItems', id);\n const root = configurationItem as unknown as Record<string, unknown>;\n const company = await this.contextFetch<Company>('/V1.0/Companies', (root as Record<string, unknown>)['companyID'] as number | undefined);\n const contact = await this.contextFetch<Contact>('/V1.0/Contacts', (root as Record<string, unknown>)['contactID'] as number | undefined);\n const contract = await this.contextFetch<Contract>('/V1.0/Contracts', (root as Record<string, unknown>)['contractID'] as number | undefined);\n return { configurationItem, company, contact, contract };\n }\n\n /** Node-parity special op (hand-written in src/resources/special/configuration_items.ts). */\n moveConfigurationItem(sourceId: Identifier, opts: MoveConfigurationItemOptions): Promise<MoveConfigurationItemResult | DryRunResult<Record<string, unknown>>> {\n return configurationitemsSpecial.moveConfigurationItem(this, sourceId, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/configuration_items.ts). */\n profile(id: Identifier, opts?: ConfigurationItemProfileOptions): Promise<ConfigurationItemProfile> {\n return configurationitemsSpecial.profile(this, id, opts, this.http);\n }\n}\n","/**\n * ConfigurationItemSslSubjectAlternativeNamesResource — ConfigurationItemSslSubjectAlternativeName resource (G4 batch A, plan key 'configuration_item_ssl_subject_alternative_names').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/SslSubjectAlternativeNames —\n * the global query/count stay unscoped (narrow with the 'configurationItemID' filter).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemSslSubjectAlternativeName, ConfigurationItemSslSubjectAlternativeNameCreate, ConfigurationItemSslSubjectAlternativeNameUpdate, ConfigurationItemSslSubjectAlternativeNameSummary } from '../types/configuration_item_ssl_subject_alternative_names.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemSslSubjectAlternativeNamesResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemSslSubjectAlternativeNamesResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemSslSubjectAlternativeNamesResource extends BaseResource<ConfigurationItemSslSubjectAlternativeName, ConfigurationItemSslSubjectAlternativeNameCreate, ConfigurationItemSslSubjectAlternativeNameUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_ssl_subject_alternative_names',\n resourcePath: '/V1.0/ConfigurationItemSslSubjectAlternativeNames',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/SslSubjectAlternativeNames',\n parentField: 'configurationItemID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemSslSubjectAlternativeName records (global; narrow with the configurationItemID filter). */\n query(params?: ConfigurationItemSslSubjectAlternativeNamesResourceQueryParams): AsyncIterable<ConfigurationItemSslSubjectAlternativeName> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemSslSubjectAlternativeName record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemSslSubjectAlternativeNamesResourceQueryParams): Promise<ConfigurationItemSslSubjectAlternativeName[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemSslSubjectAlternativeNamesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ConfigurationItems/{parentId}/SslSubjectAlternativeNames/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ConfigurationItemSslSubjectAlternativeName> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ConfigurationItemSslSubjectAlternativeNameUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemSslSubjectAlternativeNameUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_ssl_subject_alternative_names.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_ssl_subject_alternative_names.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ConfigurationItemSslSubjectAlternativeName from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemSslSubjectAlternativeNameSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ConfigurationItemSslSubjectAlternativeName records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ConfigurationItemSslSubjectAlternativeNameSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ConfigurationItemTypesResource — ConfigurationItemType resource (G5 batch B, plan key 'configuration_item_types').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemType, ConfigurationItemTypeCreate, ConfigurationItemTypeUpdate, ConfigurationItemTypeSummary } from '../types/configuration_item_types.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemTypesResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemTypesResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemTypesResource extends BaseResource<ConfigurationItemType, ConfigurationItemTypeCreate, ConfigurationItemTypeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_types',\n resourcePath: '/V1.0/ConfigurationItemTypes',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ConfigurationItemType records with the G3 filter surface (server-side JSON filter). */\n query(params?: ConfigurationItemTypesResourceQueryParams): AsyncIterable<ConfigurationItemType> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemType record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemTypesResourceQueryParams): Promise<ConfigurationItemType[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemTypesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ConfigurationItemType> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ConfigurationItemTypeCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemTypeCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ConfigurationItemTypeUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemTypeUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_types.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ConfigurationItemType from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemTypeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ConfigurationItemType records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ConfigurationItemTypeSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ConfigurationItemWebhooksResource — ConfigurationItemWebhook resource (G4 batch A, plan key 'configuration_item_webhooks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'configuration_items': CRUD under /V1.0/ConfigurationItems/{parentId}/Webhook —\n * the global query/count stay unscoped (narrow with the 'parent' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ConfigurationItemWebhook, ConfigurationItemWebhookCreate, ConfigurationItemWebhookUpdate, ConfigurationItemWebhookSummary } from '../types/configuration_item_webhooks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ConfigurationItemWebhooksResource (the G3 filter surface; no per-resource invention). */\nexport type ConfigurationItemWebhooksResourceQueryParams = QueryParams;\n\nexport class ConfigurationItemWebhooksResource extends BaseResource<ConfigurationItemWebhook, ConfigurationItemWebhookCreate, ConfigurationItemWebhookUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'configuration_item_webhooks',\n resourcePath: '/V1.0/ConfigurationItemWebhooks',\n parentScopedPath: '/V1.0/ConfigurationItems/{parentId}/Webhook',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n parentPath: '/V1.0/ConfigurationItems',\n }, pageSize);\n }\n\n /** Query ConfigurationItemWebhook records (global; narrow with the parent filter). */\n query(params?: ConfigurationItemWebhooksResourceQueryParams): AsyncIterable<ConfigurationItemWebhook> {\n return this.queryItems(params);\n }\n\n /** Get every ConfigurationItemWebhook record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ConfigurationItemWebhooksResourceQueryParams): Promise<ConfigurationItemWebhook[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ConfigurationItemWebhooksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ConfigurationItemWebhook> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ConfigurationItemWebhookCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemWebhookCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ConfigurationItemWebhookUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ConfigurationItemWebhookUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'configuration_item_webhooks.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ConfigurationItemWebhook from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ConfigurationItemWebhookSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ConfigurationItemWebhook records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ConfigurationItemWebhookSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ContactGroupContactsResource — ContactGroupContacts resource (G5 batch B, plan key 'contact_group_contacts').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContactGroupContacts, ContactGroupContactsCreate, ContactGroupContactsUpdate, ContactGroupContactsSummary } from '../types/contact_group_contacts.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContactGroupContactsResource (the G3 filter surface; no per-resource invention). */\nexport type ContactGroupContactsResourceQueryParams = QueryParams;\n\nexport class ContactGroupContactsResource extends BaseResource<ContactGroupContacts, ContactGroupContactsCreate, ContactGroupContactsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contact_group_contacts',\n resourcePath: '/V1.0/ContactGroupContacts',\n deletable: true,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query ContactGroupContacts records with the G3 filter surface (server-side JSON filter). */\n query(params?: ContactGroupContactsResourceQueryParams): AsyncIterable<ContactGroupContacts> {\n return this.queryItems(params);\n }\n\n /** Get every ContactGroupContacts record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContactGroupContactsResourceQueryParams): Promise<ContactGroupContacts[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContactGroupContactsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ContactGroupContacts> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ContactGroupContactsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContactGroupContactsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'contact_group_contacts.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ContactGroupContacts from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContactGroupContactsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContactGroupsResource — ContactGroups resource (G5 batch B, plan key 'contact_groups').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContactGroups, ContactGroupsCreate, ContactGroupsUpdate, ContactGroupsSummary } from '../types/contact_groups.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContactGroupsResource (the G3 filter surface; no per-resource invention). */\nexport type ContactGroupsResourceQueryParams = QueryParams;\n\nexport class ContactGroupsResource extends BaseResource<ContactGroups, ContactGroupsCreate, ContactGroupsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contact_groups',\n resourcePath: '/V1.0/ContactGroups',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ContactGroups records with the G3 filter surface (server-side JSON filter). */\n query(params?: ContactGroupsResourceQueryParams): AsyncIterable<ContactGroups> {\n return this.queryItems(params);\n }\n\n /** Get every ContactGroups record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContactGroupsResourceQueryParams): Promise<ContactGroups[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContactGroupsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ContactGroups> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ContactGroupsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContactGroupsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ContactGroupsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContactGroupsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'contact_groups.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ContactGroups from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContactGroupsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ContactGroups records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContactGroupsSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * Contacts special ops — node-parity `moveToCompany` (G4 batch A).\n *\n * The node's \"move contact to company\" composition: read the source contact,\n * verify the destination company, abort when the email already exists under\n * that company (the vendor's duplicate-email rule), create the contact under\n * the destination, and optionally delete the source.\n */\nimport { AutotaskConfigError, AutotaskError, formatVendorDetail, isAutotaskError, ConflictError, NotFoundError, parseVendorErrors, StaleObjectError } from '../../errors.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport { buildDryRunResult } from '../base.js';\nimport type { MutationOpts } from '../base.js';\nimport { unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { ContactCreate, ContactSummary } from '../../types/contacts.js';\nimport type { ContactsResource } from '../contacts.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\n\n/**\n * `moveToCompany` options. Extends `MutationOpts` (G10b F1): `dryRun` and\n * `lastModifiedDate` were advertised by the plan/registry/MCP manifest but\n * silently discarded — the op now honours the dry-run-first guarantee (the\n * pinned envelope, no create POST, no source DELETE) and the plan's\n * contacts `staleCheck` (lastModifiedDate) on the source contact fetch.\n */\nexport interface MoveToCompanyOptions extends MutationOpts {\n /** Copy the source's userDefinedFields to the new contact (default true). */\n copyUdfs?: boolean;\n /** DELETE the source contact after the destination create succeeds (default false). */\n deleteSource?: boolean;\n}\n\nexport interface MoveToCompanyResult {\n sourceId: Identifier;\n /** The new contact's id under the destination company. */\n newId: number;\n destinationCompanyId: Identifier;\n created: true;\n sourceDeleted: boolean;\n}\n\nasync function fetchRecord(http: HttpClient, path: string, label: string): Promise<Record<string, unknown>> {\n const res = await http.request<unknown>({ method: 'GET', path, operation: 'contacts.moveToCompany' });\n const body = res as { item?: Record<string, unknown> | null } | null;\n if (body === null || !('item' in body) || body.item === null || body.item === undefined) {\n throw new NotFoundError(`${label} not found`, { code: 'NOT_FOUND', category: 'not_found' });\n }\n return body.item;\n}\n\n/**\n * Move a contact to a destination company (create-under-destination\n * composition; the vendor has no direct re-parent op). Aborts with\n * ConflictError when the email is already taken under the destination.\n */\nexport async function moveToCompany(\n _resource: ContactsResource,\n sourceContactId: Identifier,\n destinationCompanyId: Identifier,\n opts: MoveToCompanyOptions = {},\n http: HttpClient,\n): Promise<MoveToCompanyResult | DryRunResult<Record<string, unknown>>> {\n const sourceId = parseIdentifier(sourceContactId, 'sourceContactId');\n const destId = parseIdentifier(destinationCompanyId, 'destinationCompanyId');\n\n const source = await fetchRecord(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`);\n const companyID = source.companyID;\n if (typeof companyID !== 'number' || companyID < 0) {\n throw new NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);\n }\n\n // Stale-object guard (section 19.3): the plan's staleCheck for contacts is\n // lastModifiedDate — the caller's snapshot of the SOURCE contact is\n // compared against the vendor's current value immediately after the source\n // fetch (mismatch throws STALE_OBJECT; dry-run and apply mode alike).\n if (opts.lastModifiedDate !== undefined) {\n const current = source.lastModifiedDate;\n if (current !== opts.lastModifiedDate) {\n throw new StaleObjectError(\n `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === 'string' ? current : 'unknown'})`,\n { operation: 'contacts.moveToCompany', resourceIds: [sourceId, destId] },\n );\n }\n }\n\n await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`);\n\n // Duplicate-email abort: the vendor blocks a second contact with the same\n // email under one company — surface it as ConflictError before the create.\n const email = typeof source.emailAddress === 'string' ? source.emailAddress : '';\n if (email !== '') {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Contacts/query',\n body: {\n MaxRecords: 2,\n filter: [\n { field: 'companyID', op: 'eq', value: destId },\n { field: 'emailAddress', op: 'eq', value: email },\n ],\n },\n operation: 'contacts.moveToCompany',\n });\n const items = unwrapItems<Record<string, unknown>>(res).items;\n // String-form comparison: the source id may be the exact-digit string form (ids above 2^53) — the numeric form has already lost a digit.\n const clash = items.find((c) => String(c.id) !== String(sourceId));\n if (clash !== undefined) {\n throw new ConflictError(\n `Contact email \"${email}\" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,\n { resourceIds: [sourceId, destId] },\n );\n }\n }\n\n const body: Record<string, unknown> = { ...source };\n delete body.id;\n delete body.soapParentPropertyId;\n if (opts.copyUdfs === false) delete body.userDefinedFields;\n body.companyID = destId;\n\n // Dry-run (section 19.3): every read pre-check above ran (source read,\n // destination read, the duplicate-email abort — a clash already threw\n // ConflictError, so a returned envelope is never a green preview). The\n // create POST and the optional source DELETE are NEVER issued.\n if (opts.dryRun === true) {\n const warnings: string[] = [];\n if (opts.deleteSource === true) warnings.push('the source contact will be deleted after the move');\n return buildDryRunResult({\n operation: 'contacts.moveToCompany',\n method: 'POST',\n path: `/V1.0/Companies/${destId}/Contacts`,\n ids: [companyID, destId], // from/to company ids (plan usage)\n checks: [\n { name: 'source-exists', ok: true },\n { name: 'destination-exists', ok: true },\n { name: 'duplicate-email', ok: true },\n ],\n impact: { affected: opts.deleteSource === true ? 2 : 1, scope: 'single-record', reversible: true },\n warnings,\n data: body,\n }, { redactPersonalData: http.redactPersonalData });\n }\n\n const created = await http.request<unknown>({\n method: 'POST',\n path: `/V1.0/Companies/${destId}/Contacts`,\n body,\n operation: 'contacts.moveToCompany',\n });\n const createdBody = created as { itemId?: number; id?: number } | null;\n const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : undefined;\n if (typeof newId !== 'number') {\n throw new AutotaskConfigError('contacts.moveToCompany: vendor create response has no itemId');\n }\n\n let sourceDeleted = false;\n if (opts.deleteSource === true) {\n await http.request<unknown>({\n method: 'DELETE',\n path: `/V1.0/Companies/${companyID}/Contacts/${sourceId}`,\n operation: 'contacts.moveToCompany',\n });\n sourceDeleted = true;\n }\n return { sourceId, newId, destinationCompanyId: destId, created: true, sourceDeleted };\n}\n\n// =============================================================================\n// S12-A (run mcp-fix-20261003, plan T4) — upsertByEmail: the find-or-create\n// on the createIfNotExists dedup semantics (eq conditions + parent narrowing;\n// the generic primitive stays generic — the op pins the zone knowledge: the\n// natural key, the required-set defaults, the isActive quirk, the blind-safe\n// parent precheck). The global /V1.0/Contacts collection is read-only — the\n// create MUST be the scoped Companies/{parentId}/Contacts (the base\n// createIfNotExists scoped contract).\n//\n// Zone facts (live-verified ww29, receipts in .run/mcp-fix-20261003/reports/):\n// - the ww29 live-required set { firstName, lastName, companyID, isActive }\n// (the spec declares no required fields; a create missing any 500s with a\n// typed field-level error);\n// - isActive is a NUMBER (1/0) in this zone — a JSON boolean 500s at the\n// vendor parse layer (ContactModel); the op ACCEPTS a boolean and sends\n// the zone-correct number (true→1 / false→0); a raw number passes through;\n// - the companies count/query surface is blind to this API user (unowned →\n// 0/empty) — the parent precheck uses companies.get (the authority).\n// =============================================================================\n\nconst OP_UPSERT_EMAIL = 'contacts.upsertByEmail';\n\n/** Max discovery-loop field merges (the createForResource pattern, pinned). */\nconst UPSERT_MAX_DISCOVERY_MERGES = 3;\n\n/** The natural-key email shape (non-empty local part + non-empty domain). */\nconst EMAIL_SHAPE = /^.+@.+/;\n\n/**\n * Safe create-body defaults the discovery loop may merge on a 500.\n * DELIBERATELY EMPTY: the ww29 required set { firstName, lastName, companyID,\n * isActive } is fully filled by the node (firstName defaults to the email\n * local-part, lastName to '') — any other vendor-named field has no\n * proven-safe default → CONTACT_CREATE_FAILED (vendor fields).\n */\nconst SAFE_CONTACT_CREATE_DEFAULTS: Record<string, unknown> = {};\n\n/** The dedup query bound (createIfNotExists parity: MaxRecords 10). */\nconst DEDUP_LIMIT = 10;\n\n/** Pre-create fault: the parent company is missing (companies.get is the blind-surface authority). */\nexport class CompanyNotFoundError extends AutotaskError {\n constructor(message: string, options: { resourceIds?: (number | string)[]; operation?: string } = {}) {\n super(message, {\n code: 'COMPANY_NOT_FOUND',\n category: 'not_found',\n suggestedAction: 'Resolve the company id (companies.get on a known id, or a ticket contactID/companyID via tickets.fullContext) and retry.',\n ...options,\n });\n this.name = 'CompanyNotFoundError';\n }\n}\n\n/** The contact-create 500 that survived the discovery loop (no safe default for the vendor-named field). */\nexport class ContactCreateFailedError extends AutotaskError {\n /** The vendor-named fields (empty when the 500 body named nothing parseable). */\n readonly vendorFields: string[];\n\n constructor(message: string, vendorFields: string[], options: { operation?: string; httpStatus?: number; vendorError?: unknown; resourceIds?: (number | string)[] } = {}) {\n super(message, { code: 'CONTACT_CREATE_FAILED', category: 'validation', ...options });\n this.name = 'ContactCreateFailedError';\n this.vendorFields = vendorFields;\n }\n}\n\nexport interface ContactsUpsertByEmailExtra {\n /** Contact first name (default: the email local-part — the required-set gap the node fills). */\n firstName?: string;\n /** Contact last name (default: the non-empty neutral 'Unknown' — the ww29 create 500s on an empty lastName; S12-A live-verified). */\n lastName?: string;\n /**\n * The zone quirk ABSORBED: a JSON boolean is ACCEPTED and mapped to the\n * zone-correct number (true→1 / false→0); a raw 0/1 number passes through.\n * Default: active (1).\n */\n isActive?: boolean | number;\n}\n\n/** The typed EXISTS/CREATED result (the requested taxonomy). */\nexport interface ContactsUpsertByEmailResult {\n /** The contact id (existing match or newly created). */\n id: number;\n /** False when the dedup match short-circuited the create. */\n created: boolean;\n /**\n * The matched record (present when created is false). NOTE: emailAddress\n * arrives [REDACTED] under the default redaction policy (the PII set) —\n * the result is equality-proof by the server-side match, NOT by reading\n * the email back.\n */\n existing?: ContactSummary;\n}\n\n/**\n * `upsertByEmail` — find-or-create a contact by its natural key (email under\n * a company). Steps: (1) validate (zero wire, CONFIG_ERROR shape-teaching);\n * (2) companies.get(companyID) — the blind-surface authority — miss →\n * COMPANY_NOT_FOUND; (3) the dedup query { emailAddress eq, companyID eq }\n * (1 wire — parent-narrowed, NEVER widens; the SAME filter semantics as\n * contacts.findByEmail) → match → the typed EXISTS; (4) miss → the scoped\n * create (1 wire) with the required set filled by the node (firstName\n * default: the email local-part; isActive boolean→number absorbed) — a 500\n * (no safe default) → CONTACT_CREATE_FAILED (vendor fields).\n * `dryRun: true` performs the parent precheck + the dedup read (2 reads) and\n * returns the simulated create envelope; zero mutating wire.\n */\nexport async function upsertByEmail(\n resource: ContactsResource,\n companyID: Identifier,\n email: string,\n extra: ContactsUpsertByEmailExtra | undefined,\n opts: MutationOpts,\n http: HttpClient,\n): Promise<ContactsUpsertByEmailResult | DryRunResult<Record<string, unknown>>> {\n // (1) input validation (zero wire).\n const cid = parseIdentifier(companyID, 'companyID');\n if (typeof email !== 'string' || !EMAIL_SHAPE.test(email)) {\n throw new AutotaskConfigError(\n `upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,\n { operation: OP_UPSERT_EMAIL },\n );\n }\n if (extra !== undefined) {\n if (extra.isActive !== undefined && typeof extra.isActive !== 'boolean' && extra.isActive !== 0 && extra.isActive !== 1) {\n throw new AutotaskConfigError(\n `upsertByEmail: extra.isActive must be a boolean (mapped to the zone-correct number 1/0) or a raw 0/1 number (got ${String(extra.isActive)})`,\n { operation: OP_UPSERT_EMAIL },\n );\n }\n if (extra.firstName !== undefined && (typeof extra.firstName !== 'string' || extra.firstName === '')) {\n throw new AutotaskConfigError('upsertByEmail: extra.firstName must be a non-empty string (or omitted — the node defaults it to the email local-part)', { operation: OP_UPSERT_EMAIL });\n }\n if (extra.lastName !== undefined && typeof extra.lastName !== 'string') {\n throw new AutotaskConfigError(\"upsertByEmail: extra.lastName must be a string (or omitted — the node defaults it to the non-empty neutral value Unknown)\", { operation: OP_UPSERT_EMAIL });\n }\n }\n\n // (2) the blind-safe parent precheck: the companies count/query surface is\n // blind to this API user (unowned → 0/empty) — get is the authority.\n const parentRes = await http.request<unknown>({ method: 'GET', path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL });\n const parentBody = parentRes as { item?: Record<string, unknown> | null } | null;\n if (parentBody === null || !('item' in parentBody) || parentBody.item === null || parentBody.item === undefined) {\n throw new CompanyNotFoundError(\n `upsertByEmail: company ${cid} was not found (companies.get returned item: null — the companies count/query surface is blind to this API user; get is the authority)`,\n { resourceIds: [cid], operation: OP_UPSERT_EMAIL },\n );\n }\n\n // (3) the dedup query — parent-narrowed, never widens (the createIfNotExists\n // eq-conditions semantics; exact-case matching — case-folding UNVERIFIED).\n const q = await resource.queryBounded({\n filter: [\n { field: 'emailAddress', op: 'eq', value: email },\n { field: 'companyID', op: 'eq', value: cid },\n ],\n limit: DEDUP_LIMIT,\n });\n const match = q.items[0];\n if (match !== undefined) {\n // FULL100 F6: the DRY caller takes the simulated envelope — the raw\n // EXISTS result carries no `simulated` mark, and the mode tool derives\n // the flag from `result.simulated === true` (an unmarked dry call\n // misreported simulated:false on the served surface — the same D4 class\n // F4 fixed on the changeStatus NO_CHANGE path; zero mutating wire\n // either way, the create is skipped by the dedup match).\n if (opts.dryRun === true) {\n return buildDryRunResult(\n {\n operation: OP_UPSERT_EMAIL,\n method: 'POST',\n path: `/V1.0/Companies/${cid}/Contacts`,\n ids: [cid],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'parent-exists', ok: true },\n { name: 'duplicate-detection', ok: true },\n ],\n impact: { affected: 0, scope: 'no write — the contact already exists (dedup match; the create is skipped)', reversible: true },\n warnings: [`EXISTS: a contact with the address is already on company ${cid} (id ${Number(match.id)}) — the apply would skip the create (zero mutating wire).`],\n data: { reason: 'EXISTS', id: Number(match.id) } as unknown as Record<string, unknown>,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n return { id: Number(match.id), created: false, existing: match as unknown as ContactSummary };\n }\n\n // (4) the create body — the required set filled by the node (the zone quirk\n // absorbed: boolean → the zone-correct number). lastName must be NON-EMPTY\n // (S12-A live-verified on ww29: the create 500s with\n // `Missing Required Field: lastName. ; on record number [1].` when it is\n // empty) — the node fills the gap with the neutral non-empty default.\n const localPart = email.split('@')[0];\n const isActive = extra?.isActive === undefined ? true : extra.isActive;\n const body: Record<string, unknown> = {\n emailAddress: email,\n companyID: cid,\n firstName: extra?.firstName ?? localPart,\n lastName: extra?.lastName ?? 'Unknown',\n isActive: typeof isActive === 'boolean' ? (isActive ? 1 : 0) : isActive,\n };\n\n // Dry-run (section 19.3): the precheck + the dedup read ran; the create is\n // NEVER issued.\n if (opts.dryRun === true) {\n return buildDryRunResult(\n {\n operation: OP_UPSERT_EMAIL,\n method: 'POST',\n path: `/V1.0/Companies/${cid}/Contacts`,\n ids: [cid],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'parent-exists', ok: true },\n { name: 'duplicate-detection', ok: true },\n ],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n data: body,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n\n // The create (the ≤3 discovery loop — SAFE_CONTACT_CREATE_DEFAULTS is\n // empty: a 500 is typed, never a blind retry).\n let merges = 0;\n for (;;) {\n try {\n const created = (await resource.create(cid, body as unknown as ContactCreate, {})) as { id: number };\n return { id: created.id, created: true };\n } catch (err) {\n if (!isAutotaskError(err) || err.vendorError === undefined) throw err; // network/auth/etc. propagate\n const named = (parseVendorErrors(err.vendorError) ?? []).map((e) => e.field).filter((f): f is string => f !== undefined);\n const seen = new Set<string>();\n const unique = [...named].filter((f) => (seen.has(f) ? false : (seen.add(f), true)));\n const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== undefined);\n if (hasDefault && merges < UPSERT_MAX_DISCOVERY_MERGES) {\n for (const f of unique) {\n if (body[f] === undefined && SAFE_CONTACT_CREATE_DEFAULTS[f] !== undefined) {\n body[f] = SAFE_CONTACT_CREATE_DEFAULTS[f];\n merges += 1;\n break;\n }\n }\n continue;\n }\n const detail = formatVendorDetail(err.vendorError);\n throw new ContactCreateFailedError(\n `upsertByEmail: the vendor rejected the contact create${unique.length > 0 ? ` naming field(s) ${unique.join(', ')}` : ''} (no proven-safe default — the required set is fully filled by the node)${detail ? ` — ${detail}` : ''}`,\n unique,\n {\n operation: OP_UPSERT_EMAIL,\n httpStatus: err.httpStatus,\n vendorError: err.vendorError,\n resourceIds: [cid],\n },\n );\n }\n }\n}\n","/**\n * ContactsResource — Contact resource (G4 batch A, plan key 'contacts').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'companies': CRUD under /V1.0/Companies/{parentId}/Contacts —\n * the global query/count stay unscoped (narrow with the 'companyID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Contact, ContactCreate, ContactUpdate, ContactSummary, ContactContext } from '../types/contacts.js';\nimport type { Company } from '../types/companies.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as contactsSpecial from './special/contacts.js';\nimport type { MoveToCompanyOptions, MoveToCompanyResult, ContactsUpsertByEmailExtra, ContactsUpsertByEmailResult } from './special/contacts.js';\n\n/** Query params for ContactsResource (the G3 filter surface; no per-resource invention). */\nexport type ContactsResourceQueryParams = QueryParams;\n\nexport class ContactsResource extends BaseResource<Contact, ContactCreate, ContactUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contacts',\n resourcePath: '/V1.0/Contacts',\n parentScopedPath: '/V1.0/Companies/{parentId}/Contacts',\n parentField: 'companyID',\n deletable: true,\n udfCapable: true,\n searchFields: ['firstName', 'lastName'],\n staleField: 'lastModifiedDate',\n parentPath: '/V1.0/Companies',\n }, pageSize);\n }\n\n /** Query Contact records (global; narrow with the companyID filter). */\n query(params?: ContactsResourceQueryParams): AsyncIterable<Contact> {\n return this.queryItems(params);\n }\n\n /** Get every Contact record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContactsResourceQueryParams): Promise<Contact[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContactsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Companies/{parentId}/Contacts/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<Contact> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContactCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContactCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContactUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContactUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contacts.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contacts.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a Contact from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on firstName / lastName). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContactSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** findByEmail — exact 'emailAddress' filter; ambiguity throws RESOLUTION_AMBIGUOUS with the candidate ids. */\n async findByEmail(value: string): Promise<ContactSummary | null> {\n return this.findByField('emailAddress', value);\n }\n\n /** Search Contact records: bounded contains on firstName + lastName (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContactSummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Get the Contact with its primary context records in one call (each part a single-record\n * fetch; no sub-lists; absent/dangling references come back null). */\n async getContext(id: Identifier): Promise<ContactContext> {\n const contact = await this.fetchRecordRaw<Contact>('/V1.0/Contacts', id);\n const root = contact as unknown as Record<string, unknown>;\n const company = await this.contextFetch<Company>('/V1.0/Companies', (root as Record<string, unknown>)['companyID'] as number | undefined);\n return { contact, company };\n }\n\n /** Node-parity special op (hand-written in src/resources/special/contacts.ts). */\n moveToCompany(sourceContactId: Identifier, destinationCompanyId: Identifier, opts: MoveToCompanyOptions = {}): Promise<MoveToCompanyResult | DryRunResult<Record<string, unknown>>> {\n return contactsSpecial.moveToCompany(this, sourceContactId, destinationCompanyId, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/contacts.ts). */\n upsertByEmail(companyID: Identifier, email: string, extra?: ContactsUpsertByEmailExtra, opts: MutationOpts = {}): Promise<ContactsUpsertByEmailResult | DryRunResult<Record<string, unknown>>> {\n return contactsSpecial.upsertByEmail(this, companyID, email, extra, opts, this.http);\n }\n}\n","/**\n * ContactWebhooksResource — ContactWebhook resource (G4 batch A, plan key 'contact_webhooks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contacts': CRUD under /V1.0/Contacts/{parentId}/Webhook —\n * the global query/count stay unscoped (narrow with the 'parent' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContactWebhook, ContactWebhookCreate, ContactWebhookUpdate, ContactWebhookSummary } from '../types/contact_webhooks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContactWebhooksResource (the G3 filter surface; no per-resource invention). */\nexport type ContactWebhooksResourceQueryParams = QueryParams;\n\nexport class ContactWebhooksResource extends BaseResource<ContactWebhook, ContactWebhookCreate, ContactWebhookUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contact_webhooks',\n resourcePath: '/V1.0/ContactWebhooks',\n parentScopedPath: '/V1.0/Contacts/{parentId}/Webhook',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n parentPath: '/V1.0/Contacts',\n }, pageSize);\n }\n\n /** Query ContactWebhook records (global; narrow with the parent filter). */\n query(params?: ContactWebhooksResourceQueryParams): AsyncIterable<ContactWebhook> {\n return this.queryItems(params);\n }\n\n /** Get every ContactWebhook record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContactWebhooksResourceQueryParams): Promise<ContactWebhook[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContactWebhooksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ContactWebhook> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ContactWebhookCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContactWebhookCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ContactWebhookUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContactWebhookUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'contact_webhooks.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ContactWebhook from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContactWebhookSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ContactWebhook records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContactWebhookSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ContractBillingRulesResource — ContractBillingRule resource (G4 batch A, plan key 'contract_billing_rules').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/BillingRules —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractBillingRule, ContractBillingRuleCreate, ContractBillingRuleUpdate, ContractBillingRuleSummary } from '../types/contract_billing_rules.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractBillingRulesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractBillingRulesResourceQueryParams = QueryParams;\n\nexport class ContractBillingRulesResource extends BaseResource<ContractBillingRule, ContractBillingRuleCreate, ContractBillingRuleUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_billing_rules',\n resourcePath: '/V1.0/ContractBillingRules',\n parentScopedPath: '/V1.0/Contracts/{parentId}/BillingRules',\n parentField: 'contractID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractBillingRule records (global; narrow with the contractID filter). */\n query(params?: ContractBillingRulesResourceQueryParams): AsyncIterable<ContractBillingRule> {\n return this.queryItems(params);\n }\n\n /** Get every ContractBillingRule record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractBillingRulesResourceQueryParams): Promise<ContractBillingRule[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractBillingRulesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/BillingRules/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractBillingRule> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractBillingRuleCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractBillingRuleCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractBillingRuleUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractBillingRuleUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_billing_rules.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_billing_rules.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractBillingRule from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractBillingRuleSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractBlockHourFactorsResource — ContractBlockHourFactor resource (G4 batch A, plan key 'contract_block_hour_factors').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/BlockHourFactors —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractBlockHourFactor, ContractBlockHourFactorCreate, ContractBlockHourFactorUpdate, ContractBlockHourFactorSummary } from '../types/contract_block_hour_factors.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractBlockHourFactorsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractBlockHourFactorsResourceQueryParams = QueryParams;\n\nexport class ContractBlockHourFactorsResource extends BaseResource<ContractBlockHourFactor, ContractBlockHourFactorCreate, ContractBlockHourFactorUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_block_hour_factors',\n resourcePath: '/V1.0/ContractBlockHourFactors',\n parentScopedPath: '/V1.0/Contracts/{parentId}/BlockHourFactors',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractBlockHourFactor records (global; narrow with the contractID filter). */\n query(params?: ContractBlockHourFactorsResourceQueryParams): AsyncIterable<ContractBlockHourFactor> {\n return this.queryItems(params);\n }\n\n /** Get every ContractBlockHourFactor record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractBlockHourFactorsResourceQueryParams): Promise<ContractBlockHourFactor[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractBlockHourFactorsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/BlockHourFactors/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractBlockHourFactor> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractBlockHourFactorCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractBlockHourFactorCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractBlockHourFactorUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractBlockHourFactorUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_block_hour_factors.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractBlockHourFactor from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractBlockHourFactorSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractBlocksResource — ContractBlock resource (G4 batch A, plan key 'contract_blocks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Blocks —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractBlock, ContractBlockCreate, ContractBlockUpdate, ContractBlockSummary } from '../types/contract_blocks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractBlocksResource (the G3 filter surface; no per-resource invention). */\nexport type ContractBlocksResourceQueryParams = QueryParams;\n\nexport class ContractBlocksResource extends BaseResource<ContractBlock, ContractBlockCreate, ContractBlockUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_blocks',\n resourcePath: '/V1.0/ContractBlocks',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Blocks',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractBlock records (global; narrow with the contractID filter). */\n query(params?: ContractBlocksResourceQueryParams): AsyncIterable<ContractBlock> {\n return this.queryItems(params);\n }\n\n /** Get every ContractBlock record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractBlocksResourceQueryParams): Promise<ContractBlock[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractBlocksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Blocks/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractBlock> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractBlockCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractBlockCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractBlockUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractBlockUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_blocks.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractBlock from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractBlockSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractChargesResource — ContractCharge resource (G4 batch A, plan key 'contract_charges').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Charges —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractCharge, ContractChargeCreate, ContractChargeUpdate, ContractChargeSummary } from '../types/contract_charges.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractChargesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractChargesResourceQueryParams = QueryParams;\n\nexport class ContractChargesResource extends BaseResource<ContractCharge, ContractChargeCreate, ContractChargeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_charges',\n resourcePath: '/V1.0/ContractCharges',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Charges',\n parentField: 'contractID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractCharge records (global; narrow with the contractID filter). */\n query(params?: ContractChargesResourceQueryParams): AsyncIterable<ContractCharge> {\n return this.queryItems(params);\n }\n\n /** Get every ContractCharge record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractChargesResourceQueryParams): Promise<ContractCharge[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractChargesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Charges/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractCharge> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractChargeCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractChargeCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractChargeUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractChargeUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_charges.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_charges.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractCharge from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractChargeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ContractCharge records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContractChargeSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ContractExclusionBillingCodesResource — ContractExclusionBillingCode resource (G4 batch A, plan key 'contract_exclusion_billing_codes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ExclusionBillingCodes —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractExclusionBillingCode, ContractExclusionBillingCodeCreate, ContractExclusionBillingCodeUpdate, ContractExclusionBillingCodeSummary } from '../types/contract_exclusion_billing_codes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractExclusionBillingCodesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractExclusionBillingCodesResourceQueryParams = QueryParams;\n\nexport class ContractExclusionBillingCodesResource extends BaseResource<ContractExclusionBillingCode, ContractExclusionBillingCodeCreate, ContractExclusionBillingCodeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_exclusion_billing_codes',\n resourcePath: '/V1.0/ContractExclusionBillingCodes',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ExclusionBillingCodes',\n parentField: 'contractID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractExclusionBillingCode records (global; narrow with the contractID filter). */\n query(params?: ContractExclusionBillingCodesResourceQueryParams): AsyncIterable<ContractExclusionBillingCode> {\n return this.queryItems(params);\n }\n\n /** Get every ContractExclusionBillingCode record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractExclusionBillingCodesResourceQueryParams): Promise<ContractExclusionBillingCode[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractExclusionBillingCodesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/ExclusionBillingCodes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractExclusionBillingCode> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractExclusionBillingCodeCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionBillingCodeCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_exclusion_billing_codes.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractExclusionBillingCode from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractExclusionBillingCodeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractExclusionRolesResource — ContractExclusionRoles resource (G4 batch A, plan key 'contract_exclusion_roles').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ExclusionRoles —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractExclusionRoles, ContractExclusionRolesCreate, ContractExclusionRolesUpdate, ContractExclusionRolesSummary } from '../types/contract_exclusion_roles.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractExclusionRolesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractExclusionRolesResourceQueryParams = QueryParams;\n\nexport class ContractExclusionRolesResource extends BaseResource<ContractExclusionRoles, ContractExclusionRolesCreate, ContractExclusionRolesUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_exclusion_roles',\n resourcePath: '/V1.0/ContractExclusionRoles',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ExclusionRoles',\n parentField: 'contractID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractExclusionRoles records (global; narrow with the contractID filter). */\n query(params?: ContractExclusionRolesResourceQueryParams): AsyncIterable<ContractExclusionRoles> {\n return this.queryItems(params);\n }\n\n /** Get every ContractExclusionRoles record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractExclusionRolesResourceQueryParams): Promise<ContractExclusionRoles[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractExclusionRolesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/ExclusionRoles/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractExclusionRoles> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractExclusionRolesCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionRolesCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_exclusion_roles.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractExclusionRoles from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractExclusionRolesSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractExclusionSetExcludedRolesResource — ContractExclusionSetExcludedRoles resource (G5 batch B, plan key 'contract_exclusion_set_excluded_roles').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contract_exclusion_sets': CRUD under /V1.0/ContractExclusionSets/{parentId}/ExcludedRoles —\n * the global query/count stay unscoped (narrow with the 'contractExclusionSetID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractExclusionSetExcludedRoles, ContractExclusionSetExcludedRolesCreate, ContractExclusionSetExcludedRolesUpdate, ContractExclusionSetExcludedRolesSummary } from '../types/contract_exclusion_set_excluded_roles.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractExclusionSetExcludedRolesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractExclusionSetExcludedRolesResourceQueryParams = QueryParams;\n\nexport class ContractExclusionSetExcludedRolesResource extends BaseResource<ContractExclusionSetExcludedRoles, ContractExclusionSetExcludedRolesCreate, ContractExclusionSetExcludedRolesUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_exclusion_set_excluded_roles',\n resourcePath: '/V1.0/ContractExclusionSetExcludedRoles',\n parentScopedPath: '/V1.0/ContractExclusionSets/{parentId}/ExcludedRoles',\n parentField: 'contractExclusionSetID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ContractExclusionSets',\n }, pageSize);\n }\n\n /** Query ContractExclusionSetExcludedRoles records (global; narrow with the contractExclusionSetID filter). */\n query(params?: ContractExclusionSetExcludedRolesResourceQueryParams): AsyncIterable<ContractExclusionSetExcludedRoles> {\n return this.queryItems(params);\n }\n\n /** Get every ContractExclusionSetExcludedRoles record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractExclusionSetExcludedRolesResourceQueryParams): Promise<ContractExclusionSetExcludedRoles[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractExclusionSetExcludedRolesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ContractExclusionSets/{parentId}/ExcludedRoles/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractExclusionSetExcludedRoles> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractExclusionSetExcludedRolesCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionSetExcludedRolesCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_exclusion_set_excluded_roles.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractExclusionSetExcludedRoles from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractExclusionSetExcludedRolesSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractExclusionSetExcludedWorkTypesResource — ContractExclusionSetExcludedWorkTypes resource (G5 batch B, plan key 'contract_exclusion_set_excluded_work_types').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contract_exclusion_sets': CRUD under /V1.0/ContractExclusionSets/{parentId}/ExcludedWorkTypes —\n * the global query/count stay unscoped (narrow with the 'contractExclusionSetID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractExclusionSetExcludedWorkTypes, ContractExclusionSetExcludedWorkTypesCreate, ContractExclusionSetExcludedWorkTypesUpdate, ContractExclusionSetExcludedWorkTypesSummary } from '../types/contract_exclusion_set_excluded_work_types.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractExclusionSetExcludedWorkTypesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractExclusionSetExcludedWorkTypesResourceQueryParams = QueryParams;\n\nexport class ContractExclusionSetExcludedWorkTypesResource extends BaseResource<ContractExclusionSetExcludedWorkTypes, ContractExclusionSetExcludedWorkTypesCreate, ContractExclusionSetExcludedWorkTypesUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_exclusion_set_excluded_work_types',\n resourcePath: '/V1.0/ContractExclusionSetExcludedWorkTypes',\n parentScopedPath: '/V1.0/ContractExclusionSets/{parentId}/ExcludedWorkTypes',\n parentField: 'contractExclusionSetID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ContractExclusionSets',\n }, pageSize);\n }\n\n /** Query ContractExclusionSetExcludedWorkTypes records (global; narrow with the contractExclusionSetID filter). */\n query(params?: ContractExclusionSetExcludedWorkTypesResourceQueryParams): AsyncIterable<ContractExclusionSetExcludedWorkTypes> {\n return this.queryItems(params);\n }\n\n /** Get every ContractExclusionSetExcludedWorkTypes record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractExclusionSetExcludedWorkTypesResourceQueryParams): Promise<ContractExclusionSetExcludedWorkTypes[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractExclusionSetExcludedWorkTypesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ContractExclusionSets/{parentId}/ExcludedWorkTypes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractExclusionSetExcludedWorkTypes> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractExclusionSetExcludedWorkTypesCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionSetExcludedWorkTypesCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_exclusion_set_excluded_work_types.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractExclusionSetExcludedWorkTypes from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractExclusionSetExcludedWorkTypesSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractExclusionSetsResource — ContractExclusionSets resource (G5 batch B, plan key 'contract_exclusion_sets').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractExclusionSets, ContractExclusionSetsCreate, ContractExclusionSetsUpdate, ContractExclusionSetsSummary } from '../types/contract_exclusion_sets.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractExclusionSetsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractExclusionSetsResourceQueryParams = QueryParams;\n\nexport class ContractExclusionSetsResource extends BaseResource<ContractExclusionSets, ContractExclusionSetsCreate, ContractExclusionSetsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_exclusion_sets',\n resourcePath: '/V1.0/ContractExclusionSets',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ContractExclusionSets records with the G3 filter surface (server-side JSON filter). */\n query(params?: ContractExclusionSetsResourceQueryParams): AsyncIterable<ContractExclusionSets> {\n return this.queryItems(params);\n }\n\n /** Get every ContractExclusionSets record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractExclusionSetsResourceQueryParams): Promise<ContractExclusionSets[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractExclusionSetsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ContractExclusionSets> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ContractExclusionSetsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionSetsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ContractExclusionSetsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractExclusionSetsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'contract_exclusion_sets.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ContractExclusionSets from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractExclusionSetsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ContractExclusionSets records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContractExclusionSetsSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ContractMilestonesResource — ContractMilestone resource (G4 batch A, plan key 'contract_milestones').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Milestones —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractMilestone, ContractMilestoneCreate, ContractMilestoneUpdate, ContractMilestoneSummary } from '../types/contract_milestones.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractMilestonesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractMilestonesResourceQueryParams = QueryParams;\n\nexport class ContractMilestonesResource extends BaseResource<ContractMilestone, ContractMilestoneCreate, ContractMilestoneUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_milestones',\n resourcePath: '/V1.0/ContractMilestones',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Milestones',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractMilestone records (global; narrow with the contractID filter). */\n query(params?: ContractMilestonesResourceQueryParams): AsyncIterable<ContractMilestone> {\n return this.queryItems(params);\n }\n\n /** Get every ContractMilestone record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractMilestonesResourceQueryParams): Promise<ContractMilestone[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractMilestonesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Milestones/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractMilestone> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractMilestoneCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractMilestoneCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractMilestoneUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractMilestoneUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_milestones.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractMilestone from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractMilestoneSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractNotesResource — ContractNote resource (G4 batch A, plan key 'contract_notes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Notes —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractNote, ContractNoteCreate, ContractNoteUpdate, ContractNoteSummary } from '../types/contract_notes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractNotesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractNotesResourceQueryParams = QueryParams;\n\nexport class ContractNotesResource extends BaseResource<ContractNote, ContractNoteCreate, ContractNoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_notes',\n resourcePath: '/V1.0/ContractNotes',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Notes',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractNote records (global; narrow with the contractID filter). */\n query(params?: ContractNotesResourceQueryParams): AsyncIterable<ContractNote> {\n return this.queryItems(params);\n }\n\n /** Get every ContractNote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractNotesResourceQueryParams): Promise<ContractNote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractNotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Notes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractNote> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractNoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractNoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractNoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractNoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_notes.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractNote from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractNoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractRatesResource — ContractRate resource (G4 batch A, plan key 'contract_rates').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Rates —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractRate, ContractRateCreate, ContractRateUpdate, ContractRateSummary } from '../types/contract_rates.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractRatesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractRatesResourceQueryParams = QueryParams;\n\nexport class ContractRatesResource extends BaseResource<ContractRate, ContractRateCreate, ContractRateUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_rates',\n resourcePath: '/V1.0/ContractRates',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Rates',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractRate records (global; narrow with the contractID filter). */\n query(params?: ContractRatesResourceQueryParams): AsyncIterable<ContractRate> {\n return this.queryItems(params);\n }\n\n /** Get every ContractRate record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractRatesResourceQueryParams): Promise<ContractRate[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractRatesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Rates/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractRate> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractRateCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractRateCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractRateUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractRateUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_rates.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractRate from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractRateSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractRetainersResource — ContractRetainers resource (G4 batch A, plan key 'contract_retainers').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Retainers —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractRetainers, ContractRetainersCreate, ContractRetainersUpdate, ContractRetainersSummary } from '../types/contract_retainers.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractRetainersResource (the G3 filter surface; no per-resource invention). */\nexport type ContractRetainersResourceQueryParams = QueryParams;\n\nexport class ContractRetainersResource extends BaseResource<ContractRetainers, ContractRetainersCreate, ContractRetainersUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_retainers',\n resourcePath: '/V1.0/ContractRetainers',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Retainers',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractRetainers records (global; narrow with the contractID filter). */\n query(params?: ContractRetainersResourceQueryParams): AsyncIterable<ContractRetainers> {\n return this.queryItems(params);\n }\n\n /** Get every ContractRetainers record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractRetainersResourceQueryParams): Promise<ContractRetainers[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractRetainersResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Retainers/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractRetainers> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractRetainersCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractRetainersCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractRetainersUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractRetainersUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_retainers.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractRetainers from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractRetainersSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractRoleCostsResource — ContractRoleCosts resource (G4 batch A, plan key 'contract_role_costs').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/RoleCosts —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractRoleCosts, ContractRoleCostsCreate, ContractRoleCostsUpdate, ContractRoleCostsSummary } from '../types/contract_role_costs.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractRoleCostsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractRoleCostsResourceQueryParams = QueryParams;\n\nexport class ContractRoleCostsResource extends BaseResource<ContractRoleCosts, ContractRoleCostsCreate, ContractRoleCostsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_role_costs',\n resourcePath: '/V1.0/ContractRoleCosts',\n parentScopedPath: '/V1.0/Contracts/{parentId}/RoleCosts',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractRoleCosts records (global; narrow with the contractID filter). */\n query(params?: ContractRoleCostsResourceQueryParams): AsyncIterable<ContractRoleCosts> {\n return this.queryItems(params);\n }\n\n /** Get every ContractRoleCosts record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractRoleCostsResourceQueryParams): Promise<ContractRoleCosts[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractRoleCostsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/RoleCosts/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractRoleCosts> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractRoleCostsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractRoleCostsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractRoleCostsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractRoleCostsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_role_costs.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractRoleCosts from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractRoleCostsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServiceAdjustmentsResource — ContractServiceAdjustment resource (G4 batch A, plan key 'contract_service_adjustments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ServiceAdjustments —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractServiceAdjustment, ContractServiceAdjustmentCreate, ContractServiceAdjustmentUpdate, ContractServiceAdjustmentSummary } from '../types/contract_service_adjustments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServiceAdjustmentsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServiceAdjustmentsResourceQueryParams = QueryParams;\n\nexport class ContractServiceAdjustmentsResource extends BaseResource<ContractServiceAdjustment, ContractServiceAdjustmentCreate, ContractServiceAdjustmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_service_adjustments',\n resourcePath: '/V1.0/ContractServiceAdjustments',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ServiceAdjustments',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractServiceAdjustmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceAdjustmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Resolve a ContractServiceAdjustment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceAdjustmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServiceBundleAdjustmentsResource — ContractServiceBundleAdjustment resource (G4 batch A, plan key 'contract_service_bundle_adjustments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ServiceBundleAdjustments —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractServiceBundleAdjustment, ContractServiceBundleAdjustmentCreate, ContractServiceBundleAdjustmentUpdate, ContractServiceBundleAdjustmentSummary } from '../types/contract_service_bundle_adjustments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServiceBundleAdjustmentsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServiceBundleAdjustmentsResourceQueryParams = QueryParams;\n\nexport class ContractServiceBundleAdjustmentsResource extends BaseResource<ContractServiceBundleAdjustment, ContractServiceBundleAdjustmentCreate, ContractServiceBundleAdjustmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_service_bundle_adjustments',\n resourcePath: '/V1.0/ContractServiceBundleAdjustments',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ServiceBundleAdjustments',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractServiceBundleAdjustmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceBundleAdjustmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Resolve a ContractServiceBundleAdjustment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceBundleAdjustmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServiceBundlesResource — ContractServiceBundle resource (G4 batch A, plan key 'contract_service_bundles').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ServiceBundles —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractServiceBundle, ContractServiceBundleCreate, ContractServiceBundleUpdate, ContractServiceBundleSummary } from '../types/contract_service_bundles.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServiceBundlesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServiceBundlesResourceQueryParams = QueryParams;\n\nexport class ContractServiceBundlesResource extends BaseResource<ContractServiceBundle, ContractServiceBundleCreate, ContractServiceBundleUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_service_bundles',\n resourcePath: '/V1.0/ContractServiceBundles',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ServiceBundles',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractServiceBundle records (global; narrow with the contractID filter). */\n query(params?: ContractServiceBundlesResourceQueryParams): AsyncIterable<ContractServiceBundle> {\n return this.queryItems(params);\n }\n\n /** Get every ContractServiceBundle record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractServiceBundlesResourceQueryParams): Promise<ContractServiceBundle[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractServiceBundlesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/ServiceBundles/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractServiceBundle> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractServiceBundleCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceBundleCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractServiceBundleUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceBundleUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_service_bundles.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractServiceBundle from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceBundleSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServiceBundleUnitsResource — ContractServiceBundleUnit resource (G4 batch A, plan key 'contract_service_bundle_units').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ServiceBundleUnits —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractServiceBundleUnit, ContractServiceBundleUnitCreate, ContractServiceBundleUnitUpdate, ContractServiceBundleUnitSummary } from '../types/contract_service_bundle_units.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServiceBundleUnitsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServiceBundleUnitsResourceQueryParams = QueryParams;\n\nexport class ContractServiceBundleUnitsResource extends BaseResource<ContractServiceBundleUnit, ContractServiceBundleUnitCreate, ContractServiceBundleUnitUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_service_bundle_units',\n resourcePath: '/V1.0/ContractServiceBundleUnits',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ServiceBundleUnits',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractServiceBundleUnit records (global; narrow with the contractID filter). */\n query(params?: ContractServiceBundleUnitsResourceQueryParams): AsyncIterable<ContractServiceBundleUnit> {\n return this.queryItems(params);\n }\n\n /** Get every ContractServiceBundleUnit record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractServiceBundleUnitsResourceQueryParams): Promise<ContractServiceBundleUnit[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractServiceBundleUnitsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/ServiceBundleUnits/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractServiceBundleUnit> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractServiceBundleUnit from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceBundleUnitSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServicesResource — ContractService resource (G4 batch A, plan key 'contract_services').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/Services —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractService, ContractServiceCreate, ContractServiceUpdate, ContractServiceSummary } from '../types/contract_services.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServicesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServicesResourceQueryParams = QueryParams;\n\nexport class ContractServicesResource extends BaseResource<ContractService, ContractServiceCreate, ContractServiceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_services',\n resourcePath: '/V1.0/ContractServices',\n parentScopedPath: '/V1.0/Contracts/{parentId}/Services',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractService records (global; narrow with the contractID filter). */\n query(params?: ContractServicesResourceQueryParams): AsyncIterable<ContractService> {\n return this.queryItems(params);\n }\n\n /** Get every ContractService record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractServicesResourceQueryParams): Promise<ContractService[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractServicesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/Services/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractService> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractServiceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractServiceUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractServiceUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_services.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractService from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractServiceUnitsResource — ContractServiceUnit resource (G4 batch A, plan key 'contract_service_units').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/ServiceUnits —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractServiceUnit, ContractServiceUnitCreate, ContractServiceUnitUpdate, ContractServiceUnitSummary } from '../types/contract_service_units.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ContractServiceUnitsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractServiceUnitsResourceQueryParams = QueryParams;\n\nexport class ContractServiceUnitsResource extends BaseResource<ContractServiceUnit, ContractServiceUnitCreate, ContractServiceUnitUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_service_units',\n resourcePath: '/V1.0/ContractServiceUnits',\n parentScopedPath: '/V1.0/Contracts/{parentId}/ServiceUnits',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractServiceUnit records (global; narrow with the contractID filter). */\n query(params?: ContractServiceUnitsResourceQueryParams): AsyncIterable<ContractServiceUnit> {\n return this.queryItems(params);\n }\n\n /** Get every ContractServiceUnit record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractServiceUnitsResourceQueryParams): Promise<ContractServiceUnit[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractServiceUnitsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/ServiceUnits/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractServiceUnit> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a ContractServiceUnit from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractServiceUnitSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ContractsResource — Contract resource (G4 batch A, plan key 'contracts').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Contract, ContractCreate, ContractUpdate, ContractSummary } from '../types/contracts.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractsResource (the G3 filter surface; no per-resource invention). */\nexport type ContractsResourceQueryParams = QueryParams;\n\nexport class ContractsResource extends BaseResource<Contract, ContractCreate, ContractUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contracts',\n resourcePath: '/V1.0/Contracts',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['contractName'],\n }, pageSize);\n }\n\n /** Query Contract records with the G3 filter surface (server-side JSON filter). */\n query(params?: ContractsResourceQueryParams): AsyncIterable<Contract> {\n return this.queryItems(params);\n }\n\n /** Get every Contract record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractsResourceQueryParams): Promise<Contract[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Contract> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ContractCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ContractUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Contract from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on contractName). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Contract records: bounded contains on contractName (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ContractSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ContractTicketPurchasesResource — ContractTicketPurchases resource (G4 batch A, plan key 'contract_ticket_purchases').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'contracts': CRUD under /V1.0/Contracts/{parentId}/TicketPurchases —\n * the global query/count stay unscoped (narrow with the 'contractID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ContractTicketPurchases, ContractTicketPurchasesCreate, ContractTicketPurchasesUpdate, ContractTicketPurchasesSummary } from '../types/contract_ticket_purchases.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ContractTicketPurchasesResource (the G3 filter surface; no per-resource invention). */\nexport type ContractTicketPurchasesResourceQueryParams = QueryParams;\n\nexport class ContractTicketPurchasesResource extends BaseResource<ContractTicketPurchases, ContractTicketPurchasesCreate, ContractTicketPurchasesUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'contract_ticket_purchases',\n resourcePath: '/V1.0/ContractTicketPurchases',\n parentScopedPath: '/V1.0/Contracts/{parentId}/TicketPurchases',\n parentField: 'contractID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Contracts',\n }, pageSize);\n }\n\n /** Query ContractTicketPurchases records (global; narrow with the contractID filter). */\n query(params?: ContractTicketPurchasesResourceQueryParams): AsyncIterable<ContractTicketPurchases> {\n return this.queryItems(params);\n }\n\n /** Get every ContractTicketPurchases record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ContractTicketPurchasesResourceQueryParams): Promise<ContractTicketPurchases[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ContractTicketPurchasesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Contracts/{parentId}/TicketPurchases/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ContractTicketPurchases> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ContractTicketPurchasesCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ContractTicketPurchasesCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ContractTicketPurchasesUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ContractTicketPurchasesUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'contract_ticket_purchases.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ContractTicketPurchases from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ContractTicketPurchasesSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * CountriesResource — Country resource (G5 batch B, plan key 'countries').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Country, CountryCreate, CountryUpdate, CountrySummary } from '../types/countries.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for CountriesResource (the G3 filter surface; no per-resource invention). */\nexport type CountriesResourceQueryParams = QueryParams;\n\nexport class CountriesResource extends BaseResource<Country, CountryCreate, CountryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'countries',\n resourcePath: '/V1.0/Countries',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Country records with the G3 filter surface (server-side JSON filter). */\n query(params?: CountriesResourceQueryParams): AsyncIterable<Country> {\n return this.queryItems(params);\n }\n\n /** Get every Country record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: CountriesResourceQueryParams): Promise<Country[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: CountriesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Country> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: CountryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<CountryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Country from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<CountrySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Country records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<CountrySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * DepartmentsResource — Department resource (G5 batch B, plan key 'departments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Department, DepartmentCreate, DepartmentUpdate, DepartmentSummary } from '../types/departments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for DepartmentsResource (the G3 filter surface; no per-resource invention). */\nexport type DepartmentsResourceQueryParams = QueryParams;\n\nexport class DepartmentsResource extends BaseResource<Department, DepartmentCreate, DepartmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'departments',\n resourcePath: '/V1.0/Departments',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Department records with the G3 filter surface (server-side JSON filter). */\n query(params?: DepartmentsResourceQueryParams): AsyncIterable<Department> {\n return this.queryItems(params);\n }\n\n /** Get every Department record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: DepartmentsResourceQueryParams): Promise<Department[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: DepartmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Department> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: DepartmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<DepartmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: DepartmentUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<DepartmentUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Department from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<DepartmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Department records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<DepartmentSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * DomainRegistrarsResource — DomainRegistrar resource (G5 batch B, plan key 'domain_registrars').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { DomainRegistrar, DomainRegistrarCreate, DomainRegistrarUpdate, DomainRegistrarSummary } from '../types/domain_registrars.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for DomainRegistrarsResource (the G3 filter surface; no per-resource invention). */\nexport type DomainRegistrarsResourceQueryParams = QueryParams;\n\nexport class DomainRegistrarsResource extends BaseResource<DomainRegistrar, DomainRegistrarCreate, DomainRegistrarUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'domain_registrars',\n resourcePath: '/V1.0/DomainRegistrars',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query DomainRegistrar records with the G3 filter surface (server-side JSON filter). */\n query(params?: DomainRegistrarsResourceQueryParams): AsyncIterable<DomainRegistrar> {\n return this.queryItems(params);\n }\n\n /** Get every DomainRegistrar record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: DomainRegistrarsResourceQueryParams): Promise<DomainRegistrar[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: DomainRegistrarsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<DomainRegistrar> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: DomainRegistrarCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<DomainRegistrarCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: DomainRegistrarUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<DomainRegistrarUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a DomainRegistrar from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<DomainRegistrarSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search DomainRegistrar records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<DomainRegistrarSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { GlobalEntityInformationResultModel } from '../types/entity_information.js';\n\n/**\n * EntityInformationResource — integration endpoint (G5 batch B, plan key 'entity_information').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class EntityInformationResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `/V1.0/EntityInformation` → `GlobalEntityInformationResultModel` as-is. */\n get(): Promise<GlobalEntityInformationResultModel> {\n return this.http.request<GlobalEntityInformationResultModel>({\n method: 'GET',\n path: '/V1.0/EntityInformation',\n operation: 'entity_information.get',\n });\n }\n}\n","/**\n * ExpenseItemAttachmentsResource — ExpenseItemAttachment resource (G5 batch B, plan key 'expense_item_attachments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'expense_items': CRUD under /V1.0/ExpenseItems/{parentId}/Attachments —\n * the global query/count stay unscoped (narrow with the 'expenseItemID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ExpenseItemAttachment, ExpenseItemAttachmentCreate, ExpenseItemAttachmentUpdate, ExpenseItemAttachmentSummary } from '../types/expense_item_attachments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ExpenseItemAttachmentsResource (the G3 filter surface; no per-resource invention). */\nexport type ExpenseItemAttachmentsResourceQueryParams = QueryParams;\n\nexport class ExpenseItemAttachmentsResource extends BaseResource<ExpenseItemAttachment, ExpenseItemAttachmentCreate, ExpenseItemAttachmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'expense_item_attachments',\n resourcePath: '/V1.0/ExpenseItemAttachments',\n parentScopedPath: '/V1.0/ExpenseItems/{parentId}/Attachments',\n parentField: 'expenseItemID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ExpenseItems',\n attachmentGet: true,\n }, pageSize);\n }\n\n /** Query ExpenseItemAttachment records (global; narrow with the expenseItemID filter). */\n query(params?: ExpenseItemAttachmentsResourceQueryParams): AsyncIterable<ExpenseItemAttachment> {\n return this.queryItems(params);\n }\n\n /** Get every ExpenseItemAttachment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ExpenseItemAttachmentsResourceQueryParams): Promise<ExpenseItemAttachment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ExpenseItemAttachmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ExpenseItems/{parentId}/Attachments/{id} — vendor answers the model directly). */\n async get(parentId: Identifier, id: Identifier): Promise<ExpenseItemAttachment> {\n return this.getScopedModel(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ExpenseItemAttachmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ExpenseItemAttachmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete an attachment — the vendor returns the deleted attachment MODEL (not OperationResultModel).\n * `dryRun: true` returns the pinned envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<ExpenseItemAttachment | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'expense_item_attachments.delete', parentId);\n return this.deleteScopedModel(parentId, id);\n }\n\n /** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */\n async download(parentId: Identifier, id: Identifier): Promise<Buffer> {\n return this.downloadScoped(parentId, id);\n }\n\n /** Resolve a ExpenseItemAttachment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ExpenseItemAttachmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ExpenseItemsResource — ExpenseItem resource (G5 batch B, plan key 'expense_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'expense_reports': CRUD under /V1.0/Expenses/{parentId}/Items —\n * the global query/count stay unscoped (narrow with the 'expenseReportID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ExpenseItem, ExpenseItemCreate, ExpenseItemUpdate, ExpenseItemSummary } from '../types/expense_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ExpenseItemsResource (the G3 filter surface; no per-resource invention). */\nexport type ExpenseItemsResourceQueryParams = QueryParams;\n\nexport class ExpenseItemsResource extends BaseResource<ExpenseItem, ExpenseItemCreate, ExpenseItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'expense_items',\n resourcePath: '/V1.0/ExpenseItems',\n parentScopedPath: '/V1.0/Expenses/{parentId}/Items',\n parentField: 'expenseReportID',\n deletable: false,\n udfCapable: true,\n parentPath: '/V1.0/Expenses',\n }, pageSize);\n }\n\n /** Query ExpenseItem records (global; narrow with the expenseReportID filter). */\n query(params?: ExpenseItemsResourceQueryParams): AsyncIterable<ExpenseItem> {\n return this.queryItems(params);\n }\n\n /** Get every ExpenseItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ExpenseItemsResourceQueryParams): Promise<ExpenseItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ExpenseItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ExpenseItem> {\n return this.getGlobal(id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ExpenseItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ExpenseItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ExpenseItemUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ExpenseItemUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'expense_items.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ExpenseItem from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ExpenseItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ExpenseReportsResource — ExpenseReport resource (G5 batch B, plan key 'expense_reports').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ExpenseReport, ExpenseReportCreate, ExpenseReportUpdate, ExpenseReportSummary } from '../types/expense_reports.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ExpenseReportsResource (the G3 filter surface; no per-resource invention). */\nexport type ExpenseReportsResourceQueryParams = QueryParams;\n\nexport class ExpenseReportsResource extends BaseResource<ExpenseReport, ExpenseReportCreate, ExpenseReportUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'expense_reports',\n resourcePath: '/V1.0/ExpenseReports',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query ExpenseReport records with the G3 filter surface (server-side JSON filter). */\n query(params?: ExpenseReportsResourceQueryParams): AsyncIterable<ExpenseReport> {\n return this.queryItems(params);\n }\n\n /** Get every ExpenseReport record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ExpenseReportsResourceQueryParams): Promise<ExpenseReport[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ExpenseReportsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ExpenseReport> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ExpenseReportCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ExpenseReportCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ExpenseReportUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ExpenseReportUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a ExpenseReport from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ExpenseReportSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ExpenseReport records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ExpenseReportSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * HolidaySetsResource — HolidaySet resource (G5 batch B, plan key 'holiday_sets').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { HolidaySet, HolidaySetCreate, HolidaySetUpdate, HolidaySetSummary } from '../types/holiday_sets.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for HolidaySetsResource (the G3 filter surface; no per-resource invention). */\nexport type HolidaySetsResourceQueryParams = QueryParams;\n\nexport class HolidaySetsResource extends BaseResource<HolidaySet, HolidaySetCreate, HolidaySetUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'holiday_sets',\n resourcePath: '/V1.0/HolidaySets',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query HolidaySet records with the G3 filter surface (server-side JSON filter). */\n query(params?: HolidaySetsResourceQueryParams): AsyncIterable<HolidaySet> {\n return this.queryItems(params);\n }\n\n /** Get every HolidaySet record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: HolidaySetsResourceQueryParams): Promise<HolidaySet[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: HolidaySetsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<HolidaySet> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: HolidaySetCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<HolidaySetCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: HolidaySetUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<HolidaySetUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'holiday_sets.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a HolidaySet from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<HolidaySetSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * HolidaysResource — Holiday resource (G5 batch B, plan key 'holidays').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'holiday_sets': CRUD under /V1.0/HolidaySets/{parentId}/Holidays —\n * the global query/count stay unscoped (narrow with the 'holidaySetID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Holiday, HolidayCreate, HolidayUpdate, HolidaySummary } from '../types/holidays.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for HolidaysResource (the G3 filter surface; no per-resource invention). */\nexport type HolidaysResourceQueryParams = QueryParams;\n\nexport class HolidaysResource extends BaseResource<Holiday, HolidayCreate, HolidayUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'holidays',\n resourcePath: '/V1.0/Holidays',\n parentScopedPath: '/V1.0/HolidaySets/{parentId}/Holidays',\n parentField: 'holidaySetID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/HolidaySets',\n }, pageSize);\n }\n\n /** Query Holiday records (global; narrow with the holidaySetID filter). */\n query(params?: HolidaysResourceQueryParams): AsyncIterable<Holiday> {\n return this.queryItems(params);\n }\n\n /** Get every Holiday record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: HolidaysResourceQueryParams): Promise<Holiday[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: HolidaysResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/HolidaySets/{parentId}/Holidays/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<Holiday> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: HolidayCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<HolidayCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: HolidayUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<HolidayUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'holidays.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'holidays.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a Holiday from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<HolidaySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Inventory product special ops — STOCKED-ITEMS MOVEMENTS (G5 batch B).\n *\n * SWAGGER-ONLY ops: these are NOT implemented in the n8n node (verified: no\n * inventoryProducts resource dir in the node) — the exact paths, verbs and\n * bodies are pinned from the vendored api-docs.json:\n * - `POST /V1.0/InventoryProducts/{productID}/StockedItemsAdd`\n * body InventoryStockedItemAddModel\n * - `POST /V1.0/InventoryProducts/{productID}/StockedItemsRemove`\n * body InventoryStockedItemRemoveModel\n * - `POST /V1.0/InventoryProducts/{productID}/StockedItemsTransfer`\n * body InventoryStockedItemTransferModel\n * All answer OperationResultModel → { id }.\n *\n * UNVERIFIED-live: no REST credentials this run — the pinned shapes come from\n * the vendored spec only (the live sweep at G9 covers the rest).\n */\nimport { unwrapOperation } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport { buildDryRunResult, type MutationOpts } from '../base.js';\nimport type { InventoryProductsResource } from '../inventory_products.js';\nimport type {\n InventoryStockedItemAdd,\n InventoryStockedItemRemove,\n InventoryStockedItemTransfer,\n} from '../../types/inventory_products.js';\nimport type { DryRunResult, Identifier, OperationResult } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\n\nexport type { InventoryStockedItemAdd, InventoryStockedItemRemove, InventoryStockedItemTransfer };\n\ntype StockedKind = 'add' | 'remove' | 'transfer';\n\nconst PATH_SUFFIX: Record<StockedKind, string> = {\n add: 'StockedItemsAdd',\n remove: 'StockedItemsRemove',\n transfer: 'StockedItemsTransfer',\n};\n\n/** One pinned swagger-only stocked-items op (parent-scoped POST → { id }). */\nexport async function stockedItems(\n _resource: InventoryProductsResource,\n kind: StockedKind,\n parentId: Identifier,\n data: InventoryStockedItemAdd | InventoryStockedItemRemove | InventoryStockedItemTransfer,\n opts: MutationOpts = {},\n http: HttpClient,\n): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericParent = parseIdentifier(parentId, 'parentId');\n const suffix = PATH_SUFFIX[kind];\n if (opts.dryRun === true) {\n return buildDryRunResult<Record<string, unknown>>({\n operation: `inventory_products.stockedItems${suffix.slice('StockedItems'.length)}`,\n method: 'POST',\n path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,\n ids: [numericParent],\n checks: [{ name: 'input-validation', ok: true }],\n impact: { affected: 1, scope: 'single-record', reversible: kind !== 'add' },\n data: { ...data } as Record<string, unknown>,\n });\n }\n const res = await http.request<unknown>({\n method: 'POST',\n path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,\n body: data,\n operation: `inventory_products.stockedItems${suffix.slice('StockedItems'.length)}`,\n });\n return unwrapOperation(res);\n}\n","/**\n * InventoryProductsResource — InventoryProduct resource (G5 batch B, plan key 'inventory_products').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { InventoryProduct, InventoryProductCreate, InventoryProductUpdate, InventoryProductSummary } from '../types/inventory_products.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as inventoryproductsSpecial from './special/inventory_products.js';\nimport type { InventoryStockedItemAdd, InventoryStockedItemRemove, InventoryStockedItemTransfer } from './special/inventory_products.js';\n\n/** Query params for InventoryProductsResource (the G3 filter surface; no per-resource invention). */\nexport type InventoryProductsResourceQueryParams = QueryParams;\n\nexport class InventoryProductsResource extends BaseResource<InventoryProduct, InventoryProductCreate, InventoryProductUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'inventory_products',\n resourcePath: '/V1.0/InventoryProducts',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query InventoryProduct records with the G3 filter surface (server-side JSON filter). */\n query(params?: InventoryProductsResourceQueryParams): AsyncIterable<InventoryProduct> {\n return this.queryItems(params);\n }\n\n /** Get every InventoryProduct record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: InventoryProductsResourceQueryParams): Promise<InventoryProduct[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: InventoryProductsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<InventoryProduct> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: InventoryProductCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<InventoryProductCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: InventoryProductUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<InventoryProductUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'inventory_products.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a InventoryProduct from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<InventoryProductSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/inventory_products.ts). */\n stockedItemsAdd(parentId: Identifier, data: InventoryStockedItemAdd, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n return inventoryproductsSpecial.stockedItems(this, 'add', parentId, data, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/inventory_products.ts). */\n stockedItemsRemove(parentId: Identifier, data: InventoryStockedItemRemove, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n return inventoryproductsSpecial.stockedItems(this, 'remove', parentId, data, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/inventory_products.ts). */\n stockedItemsTransfer(parentId: Identifier, data: InventoryStockedItemTransfer, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n return inventoryproductsSpecial.stockedItems(this, 'transfer', parentId, data, opts, this.http);\n }\n}\n","/**\n * Invoices special ops — node-parity document renders (G4 batch A).\n *\n * The vendor exposes the invoice as rendered documents under pinned swagger\n * casings (`InvoiceMarkupHtml` / `InvoiceMarkupXml` / `InvoicePdf`). The SDK\n * surfaces them as `markupHtml` / `markupXml` / `pdf` (node method names).\n */\nimport { AutotaskError } from '../../errors.js';\nimport { decodeFileData } from '../base.js';\nimport type { HttpClient } from '../../http.js';\nimport type { Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport type { InvoicesResource } from '../invoices.js';\n\n/** `GET /V1.0/Invoices/{id}/InvoiceMarkup{Html|Xml}` → the `invoiceMarkup` string. */\nexport async function markup(\n _resource: InvoicesResource,\n id: Identifier,\n format: 'html' | 'xml',\n http: HttpClient,\n): Promise<string> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericId = parseIdentifier(id, 'id');\n const suffix = format === 'html' ? 'InvoiceMarkupHtml' : 'InvoiceMarkupXml';\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Invoices/${numericId}/${suffix}`,\n operation: `invoices.markup${format === 'html' ? 'Html' : 'Xml'}`,\n });\n const body = res as { invoiceMarkup?: unknown } | null;\n if (body === null || typeof body !== 'object' || typeof body.invoiceMarkup !== 'string') {\n throw new AutotaskError(\n `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,\n { code: 'INVALID_RESPONSE', category: 'server', resourceIds: [numericId] },\n );\n }\n return body.invoiceMarkup;\n}\n\n/** `GET /V1.0/Invoices/{id}/InvoicePdf` → decoded Buffer (FileQueryResultModel). */\nexport async function pdf(_resource: InvoicesResource, id: Identifier, http: HttpClient): Promise<Buffer> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericId = parseIdentifier(id, 'id');\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Invoices/${numericId}/InvoicePdf`,\n operation: 'invoices.pdf',\n });\n return decodeFileData(res);\n}\n","/**\n * InvoicesResource — Invoice resource (G4 batch A, plan key 'invoices').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Invoice, InvoiceCreate, InvoiceUpdate, InvoiceSummary } from '../types/invoices.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as invoicesSpecial from './special/invoices.js';\n\n/** Query params for InvoicesResource (the G3 filter surface; no per-resource invention). */\nexport type InvoicesResourceQueryParams = QueryParams;\n\nexport class InvoicesResource extends BaseResource<Invoice, InvoiceCreate, InvoiceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'invoices',\n resourcePath: '/V1.0/Invoices',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query Invoice records with the G3 filter surface (server-side JSON filter). */\n query(params?: InvoicesResourceQueryParams): AsyncIterable<Invoice> {\n return this.queryItems(params);\n }\n\n /** Get every Invoice record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: InvoicesResourceQueryParams): Promise<Invoice[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: InvoicesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Invoice> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: InvoiceUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<InvoiceUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Invoice from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<InvoiceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n markupHtml(id: Identifier): Promise<string> {\n return invoicesSpecial.markup(this, id, 'html', this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n markupXml(id: Identifier): Promise<string> {\n return invoicesSpecial.markup(this, id, 'xml', this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n pdf(id: Identifier): Promise<Buffer> {\n return invoicesSpecial.pdf(this, id, this.http);\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { ModuleAccessResultModel } from '../types/modules.js';\n\n/**\n * ModulesResource — integration endpoint (G5 batch B, plan key 'modules').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class ModulesResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `/V1.0/Modules` → `ModuleAccessResultModel` as-is. */\n get(): Promise<ModuleAccessResultModel> {\n return this.http.request<ModuleAccessResultModel>({\n method: 'GET',\n path: '/V1.0/Modules',\n operation: 'modules.get',\n });\n }\n}\n","/**\n * NotificationHistoryResource — NotificationHistory resource (G5 batch B, plan key 'notification_history').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { NotificationHistory, NotificationHistoryCreate, NotificationHistoryUpdate, NotificationHistorySummary } from '../types/notification_history.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for NotificationHistoryResource (the G3 filter surface; no per-resource invention). */\nexport type NotificationHistoryResourceQueryParams = QueryParams;\n\nexport class NotificationHistoryResource extends BaseResource<NotificationHistory, NotificationHistoryCreate, NotificationHistoryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'notification_history',\n resourcePath: '/V1.0/NotificationHistory',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query NotificationHistory records with the G3 filter surface (server-side JSON filter). */\n query(params?: NotificationHistoryResourceQueryParams): AsyncIterable<NotificationHistory> {\n return this.queryItems(params);\n }\n\n /** Get every NotificationHistory record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: NotificationHistoryResourceQueryParams): Promise<NotificationHistory[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: NotificationHistoryResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<NotificationHistory> {\n return this.getGlobal(id);\n }\n\n /** Resolve a NotificationHistory from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<NotificationHistorySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * OpportunitiesResource — Opportunity resource (G4 batch A, plan key 'opportunities').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Opportunity, OpportunityCreate, OpportunityUpdate, OpportunitySummary } from '../types/opportunities.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for OpportunitiesResource (the G3 filter surface; no per-resource invention). */\nexport type OpportunitiesResourceQueryParams = QueryParams;\n\nexport class OpportunitiesResource extends BaseResource<Opportunity, OpportunityCreate, OpportunityUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'opportunities',\n resourcePath: '/V1.0/Opportunities',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query Opportunity records with the G3 filter surface (server-side JSON filter). */\n query(params?: OpportunitiesResourceQueryParams): AsyncIterable<Opportunity> {\n return this.queryItems(params);\n }\n\n /** Get every Opportunity record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: OpportunitiesResourceQueryParams): Promise<Opportunity[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: OpportunitiesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Opportunity> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: OpportunityCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<OpportunityCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: OpportunityUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<OpportunityUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Opportunity from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<OpportunitySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * OpportunityAttachmentsResource — OpportunityAttachment resource (G4 batch A, plan key 'opportunity_attachments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'opportunities': CRUD under /V1.0/Opportunities/{parentId}/Attachments —\n * the global query/count stay unscoped (narrow with the 'opportunityID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { OpportunityAttachment, OpportunityAttachmentCreate, OpportunityAttachmentUpdate, OpportunityAttachmentSummary } from '../types/opportunity_attachments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for OpportunityAttachmentsResource (the G3 filter surface; no per-resource invention). */\nexport type OpportunityAttachmentsResourceQueryParams = QueryParams;\n\nexport class OpportunityAttachmentsResource extends BaseResource<OpportunityAttachment, OpportunityAttachmentCreate, OpportunityAttachmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'opportunity_attachments',\n resourcePath: '/V1.0/OpportunityAttachments',\n parentScopedPath: '/V1.0/Opportunities/{parentId}/Attachments',\n parentField: 'opportunityID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Opportunities',\n attachmentGet: true,\n }, pageSize);\n }\n\n /** Query OpportunityAttachment records (global; narrow with the opportunityID filter). */\n query(params?: OpportunityAttachmentsResourceQueryParams): AsyncIterable<OpportunityAttachment> {\n return this.queryItems(params);\n }\n\n /** Get every OpportunityAttachment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: OpportunityAttachmentsResourceQueryParams): Promise<OpportunityAttachment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: OpportunityAttachmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Opportunities/{parentId}/Attachments/{id} — vendor answers the model directly). */\n async get(parentId: Identifier, id: Identifier): Promise<OpportunityAttachment> {\n return this.getScopedModel(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: OpportunityAttachmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<OpportunityAttachmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete an attachment — the vendor returns the deleted attachment MODEL (not OperationResultModel).\n * `dryRun: true` returns the pinned envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OpportunityAttachment | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'opportunity_attachments.delete', parentId);\n return this.deleteScopedModel(parentId, id);\n }\n\n /** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */\n async download(parentId: Identifier, id: Identifier): Promise<Buffer> {\n return this.downloadScoped(parentId, id);\n }\n\n /** Resolve a OpportunityAttachment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<OpportunityAttachmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * OpportunityCategoriesResource — OpportunityCategory resource (G5 batch B, plan key 'opportunity_categories').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { OpportunityCategory, OpportunityCategoryCreate, OpportunityCategoryUpdate, OpportunityCategorySummary } from '../types/opportunity_categories.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for OpportunityCategoriesResource (the G3 filter surface; no per-resource invention). */\nexport type OpportunityCategoriesResourceQueryParams = QueryParams;\n\nexport class OpportunityCategoriesResource extends BaseResource<OpportunityCategory, OpportunityCategoryCreate, OpportunityCategoryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'opportunity_categories',\n resourcePath: '/V1.0/OpportunityCategories',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query OpportunityCategory records with the G3 filter surface (server-side JSON filter). */\n query(params?: OpportunityCategoriesResourceQueryParams): AsyncIterable<OpportunityCategory> {\n return this.queryItems(params);\n }\n\n /** Get every OpportunityCategory record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: OpportunityCategoriesResourceQueryParams): Promise<OpportunityCategory[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: OpportunityCategoriesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<OpportunityCategory> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: OpportunityCategoryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<OpportunityCategoryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a OpportunityCategory from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<OpportunityCategorySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search OpportunityCategory records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<OpportunityCategorySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * PhasesResource — Phase resource (G4 batch A, plan key 'phases').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'projects': CRUD under /V1.0/Projects/{parentId}/Phases —\n * the global query/count stay unscoped (narrow with the 'projectID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Phase, PhaseCreate, PhaseUpdate, PhaseSummary } from '../types/phases.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for PhasesResource (the G3 filter surface; no per-resource invention). */\nexport type PhasesResourceQueryParams = QueryParams;\n\nexport class PhasesResource extends BaseResource<Phase, PhaseCreate, PhaseUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'phases',\n resourcePath: '/V1.0/Phases',\n parentScopedPath: '/V1.0/Projects/{parentId}/Phases',\n parentField: 'projectID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Projects',\n }, pageSize);\n }\n\n /** Query Phase records (global; narrow with the projectID filter). */\n query(params?: PhasesResourceQueryParams): AsyncIterable<Phase> {\n return this.queryItems(params);\n }\n\n /** Get every Phase record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: PhasesResourceQueryParams): Promise<Phase[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: PhasesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Projects/{parentId}/Phases/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<Phase> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: PhaseCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<PhaseCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: PhaseUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<PhaseUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'phases.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a Phase from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<PhaseSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ProductsResource — Product resource (G5 batch B, plan key 'products').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Product, ProductCreate, ProductUpdate, ProductSummary } from '../types/products.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ProductsResource (the G3 filter surface; no per-resource invention). */\nexport type ProductsResourceQueryParams = QueryParams;\n\nexport class ProductsResource extends BaseResource<Product, ProductCreate, ProductUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'products',\n resourcePath: '/V1.0/Products',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Product records with the G3 filter surface (server-side JSON filter). */\n query(params?: ProductsResourceQueryParams): AsyncIterable<Product> {\n return this.queryItems(params);\n }\n\n /** Get every Product record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ProductsResourceQueryParams): Promise<Product[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ProductsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Product> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ProductCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ProductCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ProductUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ProductUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Product from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ProductSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Product records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ProductSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ProductVendorsResource — ProductVendors resource (G5 batch B, plan key 'product_vendors').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'products': CRUD under /V1.0/Products/{parentId}/Vendors —\n * the global query/count stay unscoped (narrow with the 'productID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ProductVendors, ProductVendorsCreate, ProductVendorsUpdate, ProductVendorsSummary } from '../types/product_vendors.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ProductVendorsResource (the G3 filter surface; no per-resource invention). */\nexport type ProductVendorsResourceQueryParams = QueryParams;\n\nexport class ProductVendorsResource extends BaseResource<ProductVendors, ProductVendorsCreate, ProductVendorsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'product_vendors',\n resourcePath: '/V1.0/ProductVendors',\n parentScopedPath: '/V1.0/Products/{parentId}/Vendors',\n parentField: 'productID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Products',\n }, pageSize);\n }\n\n /** Query ProductVendors records (global; narrow with the productID filter). */\n query(params?: ProductVendorsResourceQueryParams): AsyncIterable<ProductVendors> {\n return this.queryItems(params);\n }\n\n /** Get every ProductVendors record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ProductVendorsResourceQueryParams): Promise<ProductVendors[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ProductVendorsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Products/{parentId}/Vendors/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ProductVendors> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ProductVendorsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ProductVendorsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ProductVendorsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ProductVendorsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'product_vendors.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ProductVendors from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ProductVendorsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ProjectChargesResource — ProjectCharge resource (G4 batch A, plan key 'project_charges').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'projects': CRUD under /V1.0/Projects/{parentId}/Charges —\n * the global query/count stay unscoped (narrow with the 'projectID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ProjectCharge, ProjectChargeCreate, ProjectChargeUpdate, ProjectChargeSummary } from '../types/project_charges.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ProjectChargesResource (the G3 filter surface; no per-resource invention). */\nexport type ProjectChargesResourceQueryParams = QueryParams;\n\nexport class ProjectChargesResource extends BaseResource<ProjectCharge, ProjectChargeCreate, ProjectChargeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'project_charges',\n resourcePath: '/V1.0/ProjectCharges',\n parentScopedPath: '/V1.0/Projects/{parentId}/Charges',\n parentField: 'projectID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/Projects',\n }, pageSize);\n }\n\n /** Query ProjectCharge records (global; narrow with the projectID filter). */\n query(params?: ProjectChargesResourceQueryParams): AsyncIterable<ProjectCharge> {\n return this.queryItems(params);\n }\n\n /** Get every ProjectCharge record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ProjectChargesResourceQueryParams): Promise<ProjectCharge[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ProjectChargesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Projects/{parentId}/Charges/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ProjectCharge> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ProjectChargeCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ProjectChargeCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ProjectChargeUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ProjectChargeUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'project_charges.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'project_charges.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ProjectCharge from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ProjectChargeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search ProjectCharge records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ProjectChargeSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ProjectNotesResource — ProjectNote resource (G4 batch A, plan key 'project_notes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'projects': CRUD under /V1.0/Projects/{parentId}/Notes —\n * the global query/count stay unscoped (narrow with the 'projectID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ProjectNote, ProjectNoteCreate, ProjectNoteUpdate, ProjectNoteSummary } from '../types/project_notes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ProjectNotesResource (the G3 filter surface; no per-resource invention). */\nexport type ProjectNotesResourceQueryParams = QueryParams;\n\nexport class ProjectNotesResource extends BaseResource<ProjectNote, ProjectNoteCreate, ProjectNoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'project_notes',\n resourcePath: '/V1.0/ProjectNotes',\n parentScopedPath: '/V1.0/Projects/{parentId}/Notes',\n parentField: 'projectID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Projects',\n }, pageSize);\n }\n\n /** Query ProjectNote records (global; narrow with the projectID filter). */\n query(params?: ProjectNotesResourceQueryParams): AsyncIterable<ProjectNote> {\n return this.queryItems(params);\n }\n\n /** Get every ProjectNote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ProjectNotesResourceQueryParams): Promise<ProjectNote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ProjectNotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Projects/{parentId}/Notes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ProjectNote> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ProjectNoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ProjectNoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ProjectNoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ProjectNoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'project_notes.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ProjectNote from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ProjectNoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ProjectsResource — Project resource (G4 batch A, plan key 'projects').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Project, ProjectCreate, ProjectUpdate, ProjectSummary, ProjectContext } from '../types/projects.js';\nimport type { Company } from '../types/companies.js';\nimport type { Opportunity } from '../types/opportunities.js';\nimport type { Resource } from '../types/resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ProjectsResource (the G3 filter surface; no per-resource invention). */\nexport type ProjectsResourceQueryParams = QueryParams;\n\nexport class ProjectsResource extends BaseResource<Project, ProjectCreate, ProjectUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'projects',\n resourcePath: '/V1.0/Projects',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['projectName'],\n }, pageSize);\n }\n\n /** Query Project records with the G3 filter surface (server-side JSON filter). */\n query(params?: ProjectsResourceQueryParams): AsyncIterable<Project> {\n return this.queryItems(params);\n }\n\n /** Get every Project record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ProjectsResourceQueryParams): Promise<Project[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ProjectsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Project> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ProjectCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ProjectCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ProjectUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ProjectUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Project from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on projectName). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ProjectSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Project records: bounded contains on projectName (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ProjectSummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Get the Project with its primary context records in one call (each part a single-record\n * fetch; no sub-lists; absent/dangling references come back null). */\n async getContext(id: Identifier): Promise<ProjectContext> {\n const project = await this.fetchRecordRaw<Project>('/V1.0/Projects', id);\n const root = project as unknown as Record<string, unknown>;\n const company = await this.contextFetch<Company>('/V1.0/Companies', (root as Record<string, unknown>)['companyID'] as number | undefined);\n const opportunity = await this.contextFetch<Opportunity>('/V1.0/Opportunities', (root as Record<string, unknown>)['opportunityID'] as number | undefined);\n const leadResource = await this.contextFetch<Resource>('/V1.0/Resources', (root as Record<string, unknown>)['projectLeadResourceID'] as number | undefined);\n return { project, company, opportunity, leadResource };\n }\n}\n","/**\n * PurchaseApprovalsResource — PurchaseApprovals resource (G5 batch B, plan key 'purchase_approvals').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { PurchaseApprovals, PurchaseApprovalsCreate, PurchaseApprovalsUpdate, PurchaseApprovalsSummary } from '../types/purchase_approvals.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for PurchaseApprovalsResource (the G3 filter surface; no per-resource invention). */\nexport type PurchaseApprovalsResourceQueryParams = QueryParams;\n\nexport class PurchaseApprovalsResource extends BaseResource<PurchaseApprovals, PurchaseApprovalsCreate, PurchaseApprovalsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'purchase_approvals',\n resourcePath: '/V1.0/PurchaseApprovals',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query PurchaseApprovals records with the G3 filter surface (server-side JSON filter). */\n query(params?: PurchaseApprovalsResourceQueryParams): AsyncIterable<PurchaseApprovals> {\n return this.queryItems(params);\n }\n\n /** Get every PurchaseApprovals record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: PurchaseApprovalsResourceQueryParams): Promise<PurchaseApprovals[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: PurchaseApprovalsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<PurchaseApprovals> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: PurchaseApprovalsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<PurchaseApprovalsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a PurchaseApprovals from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<PurchaseApprovalsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * PurchaseOrderItemReceivingResource — PurchaseOrderItemReceiving resource (G5 batch B, plan key 'purchase_order_item_receiving').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'purchase_order_items': CRUD under /V1.0/PurchaseOrderItems/{parentId}/Receiving —\n * the global query/count stay unscoped (narrow with the 'purchaseOrderItemID' filter).\n */\nimport { BaseResource, type CreateOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { PurchaseOrderItemReceiving, PurchaseOrderItemReceivingCreate, PurchaseOrderItemReceivingUpdate, PurchaseOrderItemReceivingSummary } from '../types/purchase_order_item_receiving.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for PurchaseOrderItemReceivingResource (the G3 filter surface; no per-resource invention). */\nexport type PurchaseOrderItemReceivingResourceQueryParams = QueryParams;\n\nexport class PurchaseOrderItemReceivingResource extends BaseResource<PurchaseOrderItemReceiving, PurchaseOrderItemReceivingCreate, PurchaseOrderItemReceivingUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'purchase_order_item_receiving',\n resourcePath: '/V1.0/PurchaseOrderItemReceiving',\n parentScopedPath: '/V1.0/PurchaseOrderItems/{parentId}/Receiving',\n parentField: 'purchaseOrderItemID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/PurchaseOrderItems',\n }, pageSize);\n }\n\n /** Query PurchaseOrderItemReceiving records (global; narrow with the purchaseOrderItemID filter). */\n query(params?: PurchaseOrderItemReceivingResourceQueryParams): AsyncIterable<PurchaseOrderItemReceiving> {\n return this.queryItems(params);\n }\n\n /** Get every PurchaseOrderItemReceiving record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: PurchaseOrderItemReceivingResourceQueryParams): Promise<PurchaseOrderItemReceiving[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: PurchaseOrderItemReceivingResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/PurchaseOrderItems/{parentId}/Receiving/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<PurchaseOrderItemReceiving> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: PurchaseOrderItemReceivingCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<PurchaseOrderItemReceivingCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Resolve a PurchaseOrderItemReceiving from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<PurchaseOrderItemReceivingSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * PurchaseOrderItemsResource — PurchaseOrderItems resource (G5 batch B, plan key 'purchase_order_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'purchase_orders': CRUD under /V1.0/PurchaseOrders/{parentId}/Items —\n * the global query/count stay unscoped (narrow with the 'orderID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { PurchaseOrderItems, PurchaseOrderItemsCreate, PurchaseOrderItemsUpdate, PurchaseOrderItemsSummary } from '../types/purchase_order_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for PurchaseOrderItemsResource (the G3 filter surface; no per-resource invention). */\nexport type PurchaseOrderItemsResourceQueryParams = QueryParams;\n\nexport class PurchaseOrderItemsResource extends BaseResource<PurchaseOrderItems, PurchaseOrderItemsCreate, PurchaseOrderItemsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'purchase_order_items',\n resourcePath: '/V1.0/PurchaseOrderItems',\n parentScopedPath: '/V1.0/PurchaseOrders/{parentId}/Items',\n parentField: 'orderID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/PurchaseOrders',\n }, pageSize);\n }\n\n /** Query PurchaseOrderItems records (global; narrow with the orderID filter). */\n query(params?: PurchaseOrderItemsResourceQueryParams): AsyncIterable<PurchaseOrderItems> {\n return this.queryItems(params);\n }\n\n /** Get every PurchaseOrderItems record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: PurchaseOrderItemsResourceQueryParams): Promise<PurchaseOrderItems[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: PurchaseOrderItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/PurchaseOrders/{parentId}/Items/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<PurchaseOrderItems> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: PurchaseOrderItemsCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<PurchaseOrderItemsCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: PurchaseOrderItemsUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<PurchaseOrderItemsUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'purchase_order_items.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a PurchaseOrderItems from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<PurchaseOrderItemsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * PurchaseOrdersResource — PurchaseOrders resource (G5 batch B, plan key 'purchase_orders').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { PurchaseOrders, PurchaseOrdersCreate, PurchaseOrdersUpdate, PurchaseOrdersSummary } from '../types/purchase_orders.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for PurchaseOrdersResource (the G3 filter surface; no per-resource invention). */\nexport type PurchaseOrdersResourceQueryParams = QueryParams;\n\nexport class PurchaseOrdersResource extends BaseResource<PurchaseOrders, PurchaseOrdersCreate, PurchaseOrdersUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'purchase_orders',\n resourcePath: '/V1.0/PurchaseOrders',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query PurchaseOrders records with the G3 filter surface (server-side JSON filter). */\n query(params?: PurchaseOrdersResourceQueryParams): AsyncIterable<PurchaseOrders> {\n return this.queryItems(params);\n }\n\n /** Get every PurchaseOrders record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: PurchaseOrdersResourceQueryParams): Promise<PurchaseOrders[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: PurchaseOrdersResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<PurchaseOrders> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: PurchaseOrdersCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<PurchaseOrdersCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: PurchaseOrdersUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<PurchaseOrdersUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a PurchaseOrders from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<PurchaseOrdersSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * QuoteItemsResource — QuoteItem resource (G4 batch A, plan key 'quote_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'quotes': CRUD under /V1.0/Quotes/{parentId}/Items —\n * the global query/count stay unscoped (narrow with the 'quoteID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { QuoteItem, QuoteItemCreate, QuoteItemUpdate, QuoteItemSummary } from '../types/quote_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for QuoteItemsResource (the G3 filter surface; no per-resource invention). */\nexport type QuoteItemsResourceQueryParams = QueryParams;\n\nexport class QuoteItemsResource extends BaseResource<QuoteItem, QuoteItemCreate, QuoteItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'quote_items',\n resourcePath: '/V1.0/QuoteItems',\n parentScopedPath: '/V1.0/Quotes/{parentId}/Items',\n parentField: 'quoteID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/Quotes',\n }, pageSize);\n }\n\n /** Query QuoteItem records (global; narrow with the quoteID filter). */\n query(params?: QuoteItemsResourceQueryParams): AsyncIterable<QuoteItem> {\n return this.queryItems(params);\n }\n\n /** Get every QuoteItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: QuoteItemsResourceQueryParams): Promise<QuoteItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: QuoteItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Quotes/{parentId}/Items/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<QuoteItem> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: QuoteItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<QuoteItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: QuoteItemUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<QuoteItemUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'quote_items.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'quote_items.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a QuoteItem from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<QuoteItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search QuoteItem records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<QuoteItemSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * QuoteLocationsResource — QuoteLocation resource (G4 batch A, plan key 'quote_locations').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'quotes': CRUD under /V1.0/Quotes/{parentId}/Locations —\n * the global query/count stay unscoped (narrow with the 'quoteID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { QuoteLocation, QuoteLocationCreate, QuoteLocationUpdate, QuoteLocationSummary } from '../types/quote_locations.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for QuoteLocationsResource (the G3 filter surface; no per-resource invention). */\nexport type QuoteLocationsResourceQueryParams = QueryParams;\n\nexport class QuoteLocationsResource extends BaseResource<QuoteLocation, QuoteLocationCreate, QuoteLocationUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'quote_locations',\n resourcePath: '/V1.0/QuoteLocations',\n parentScopedPath: '/V1.0/Quotes/{parentId}/Locations',\n parentField: 'quoteID',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n parentPath: '/V1.0/Quotes',\n }, pageSize);\n }\n\n /** Query QuoteLocation records (global; narrow with the quoteID filter). */\n query(params?: QuoteLocationsResourceQueryParams): AsyncIterable<QuoteLocation> {\n return this.queryItems(params);\n }\n\n /** Get every QuoteLocation record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: QuoteLocationsResourceQueryParams): Promise<QuoteLocation[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: QuoteLocationsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<QuoteLocation> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: QuoteLocationCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<QuoteLocationCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: QuoteLocationUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<QuoteLocationUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a QuoteLocation from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<QuoteLocationSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * QuotesResource — Quote resource (G4 batch A, plan key 'quotes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Quote, QuoteCreate, QuoteUpdate, QuoteSummary } from '../types/quotes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for QuotesResource (the G3 filter surface; no per-resource invention). */\nexport type QuotesResourceQueryParams = QueryParams;\n\nexport class QuotesResource extends BaseResource<Quote, QuoteCreate, QuoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'quotes',\n resourcePath: '/V1.0/Quotes',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Quote records with the G3 filter surface (server-side JSON filter). */\n query(params?: QuotesResourceQueryParams): AsyncIterable<Quote> {\n return this.queryItems(params);\n }\n\n /** Get every Quote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: QuotesResourceQueryParams): Promise<Quote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: QuotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Quote> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: QuoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<QuoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: QuoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<QuoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Quote from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<QuoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Quote records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<QuoteSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * QuoteTemplatesResource — QuoteTemplate resource (G5 batch B, plan key 'quote_templates').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { QuoteTemplate, QuoteTemplateCreate, QuoteTemplateUpdate, QuoteTemplateSummary } from '../types/quote_templates.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for QuoteTemplatesResource (the G3 filter surface; no per-resource invention). */\nexport type QuoteTemplatesResourceQueryParams = QueryParams;\n\nexport class QuoteTemplatesResource extends BaseResource<QuoteTemplate, QuoteTemplateCreate, QuoteTemplateUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'quote_templates',\n resourcePath: '/V1.0/QuoteTemplates',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query QuoteTemplate records with the G3 filter surface (server-side JSON filter). */\n query(params?: QuoteTemplatesResourceQueryParams): AsyncIterable<QuoteTemplate> {\n return this.queryItems(params);\n }\n\n /** Get every QuoteTemplate record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: QuoteTemplatesResourceQueryParams): Promise<QuoteTemplate[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: QuoteTemplatesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<QuoteTemplate> {\n return this.getGlobal(id);\n }\n\n /** Resolve a QuoteTemplate from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<QuoteTemplateSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search QuoteTemplate records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<QuoteTemplateSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ResourceRoleQueuesResource — ResourceRoleQueue resource (G5 batch B, plan key 'resource_role_queues').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/RoleQueues —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceRoleQueue, ResourceRoleQueueCreate, ResourceRoleQueueUpdate, ResourceRoleQueueSummary } from '../types/resource_role_queues.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ResourceRoleQueuesResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceRoleQueuesResourceQueryParams = QueryParams;\n\nexport class ResourceRoleQueuesResource extends BaseResource<ResourceRoleQueue, ResourceRoleQueueCreate, ResourceRoleQueueUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_role_queues',\n resourcePath: '/V1.0/ResourceRoleQueues',\n parentScopedPath: '/V1.0/Resources/{parentId}/RoleQueues',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Query ResourceRoleQueue records (global; narrow with the resourceID filter). */\n query(params?: ResourceRoleQueuesResourceQueryParams): AsyncIterable<ResourceRoleQueue> {\n return this.queryItems(params);\n }\n\n /** Get every ResourceRoleQueue record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ResourceRoleQueuesResourceQueryParams): Promise<ResourceRoleQueue[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ResourceRoleQueuesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Resources/{parentId}/RoleQueues/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ResourceRoleQueue> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ResourceRoleQueueCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ResourceRoleQueueCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ResourceRoleQueueUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ResourceRoleQueueUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'resource_role_queues.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ResourceRoleQueue from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceRoleQueueSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ResourceRolesResource — ResourceRole resource (G5 batch B, plan key 'resource_roles').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/Roles —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceRole, ResourceRoleCreate, ResourceRoleUpdate, ResourceRoleSummary } from '../types/resource_roles.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ResourceRolesResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceRolesResourceQueryParams = QueryParams;\n\nexport class ResourceRolesResource extends BaseResource<ResourceRole, ResourceRoleCreate, ResourceRoleUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_roles',\n resourcePath: '/V1.0/ResourceRoles',\n parentScopedPath: '/V1.0/Resources/{parentId}/Roles',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Query ResourceRole records (global; narrow with the resourceID filter). */\n query(params?: ResourceRolesResourceQueryParams): AsyncIterable<ResourceRole> {\n return this.queryItems(params);\n }\n\n /** Get every ResourceRole record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ResourceRolesResourceQueryParams): Promise<ResourceRole[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ResourceRolesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Resources/{parentId}/Roles/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ResourceRole> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a ResourceRole from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceRoleSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ResourceSkillsResource — ResourceSkill resource (G5 batch B, plan key 'resource_skills').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/Skills —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceSkill, ResourceSkillCreate, ResourceSkillUpdate, ResourceSkillSummary } from '../types/resource_skills.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ResourceSkillsResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceSkillsResourceQueryParams = QueryParams;\n\nexport class ResourceSkillsResource extends BaseResource<ResourceSkill, ResourceSkillCreate, ResourceSkillUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_skills',\n resourcePath: '/V1.0/ResourceSkills',\n parentScopedPath: '/V1.0/Resources/{parentId}/Skills',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Query ResourceSkill records (global; narrow with the resourceID filter). */\n query(params?: ResourceSkillsResourceQueryParams): AsyncIterable<ResourceSkill> {\n return this.queryItems(params);\n }\n\n /** Get every ResourceSkill record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ResourceSkillsResourceQueryParams): Promise<ResourceSkill[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ResourceSkillsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Resources/{parentId}/Skills/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ResourceSkill> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ResourceSkillUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ResourceSkillUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'resource_skills.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ResourceSkill from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceSkillSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Resources special ops (G5 batch B) — whoAmI + transferOwnership.\n *\n * whoAmI: there is no vendor who-am-I endpoint (plan rationale). The\n * deterministic lookup is a bounded `userName` eq query on Resources with the\n * AUTHENTICATED UserName — the node derives the same from its credentials\n * (the part before `@`). The SDK acts as the configured client UserName: the\n * transport keeps credentials private, so the generated ResourcesResource\n * receives the client's resolved config and passes it here. Bounded to 2:\n * 0 → null, 1 → the record, ≥2 → ResolutionError (RESOLUTION_AMBIGUOUS).\n *\n * transferOwnership: node parity reduced to the plan's bounded composite —\n * a bulk `ownerResourceID` update across explicitly named COMPANY ids (the\n * node's ownership entity of record; the vendor defines ownerResourceID on\n * Company/Opportunity, not on Resource). Max 500 ids (plan bound), sequential\n * fan-out (never unbounded Promise.all), dry-run (default) lists every\n * ownerResourceID change without issuing any update.\n */\nimport { AutotaskConfigError, AutotaskError, ResolutionError } from '../../errors.js';\nimport { buildDryRunResult } from '../base.js';\nimport { unwrapItem, unwrapItems, unwrapOperation } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { Company } from '../../types/companies.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport type { ResourceSummary } from '../../types/resources.js';\nimport type { ResourcesResource } from '../resources.js';\n\nexport interface TransferOwnershipOptions {\n /** Default `true`: list the changes, issue no update. */\n dryRun?: boolean;\n}\n\nexport interface OwnershipChange {\n /** The company id being re-owned. */\n id: Identifier;\n /** Current owner (null when the vendor omits it). */\n fromOwnerResourceID: number | null;\n /** The destination resource id every change applies. */\n toOwnerResourceID: Identifier;\n}\n\nexport interface TransferOwnershipResult {\n /** `true` when no update was issued. */\n dryRun: boolean;\n /** One entry per id, in the given order. */\n changes: OwnershipChange[];\n}\n\n/**\n * The pinned dry-run envelope for `transferOwnership` (G10b F2) + the\n * from→to list the gateway wants (`changes` — an additive field on top of\n * the pinned shape, present in both modes).\n */\nexport interface TransferOwnershipDryRunResult extends DryRunResult<OwnershipChange[]> {\n /** One entry per id, in the given order (the from→to list). */\n changes: OwnershipChange[];\n}\n\nconst MAX_TRANSFER_IDS = 500;\n\n/** Validate the bulk id list (QA F1 audit): every id runs parseIdentifier\n * BEFORE the wire (an unsafe JS number is already corrupted — typed refusal,\n * never sent) and is positive (record ids start at 1; a digit string is\n * intrinsically positive, '0' normalises to the number 0 and is refused). */\nfunction requirePositiveIds(ids: Identifier[], label: string): Identifier[] {\n if (!Array.isArray(ids) || ids.length === 0) {\n throw new AutotaskConfigError(`${label}: at least one positive integer id is required`);\n }\n if (ids.length > MAX_TRANSFER_IDS) {\n throw new AutotaskConfigError(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);\n }\n const out: Identifier[] = [];\n for (const raw of ids) {\n const id = parseIdentifier(raw, `${label} id`);\n if (typeof id === 'number' && id < 1) {\n throw new AutotaskConfigError(`${label}: every id must be a positive integer (got ${String(raw)})`);\n }\n out.push(id);\n }\n return out;\n}\n\n/** whoAmI — the resource the configured credentials act as (userName eq). */\nexport async function whoAmI(\n _resource: ResourcesResource,\n userName: string,\n http: HttpClient,\n): Promise<ResourceSummary | null> {\n const user = userName.trim();\n if (user === '') throw new AutotaskConfigError('whoAmI: the configured UserName is empty');\n // Node parity: credentials carry an email; the vendor indexes the local part.\n const value = user.includes('@') ? (user.split('@')[0] ?? '') : user;\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Resources/query',\n body: { MaxRecords: 2, filter: [{ field: 'userName', op: 'eq', value }] },\n operation: 'resources.whoAmI',\n });\n const matches = unwrapItems<ResourceSummary>(res).items;\n if (matches.length === 0) return null;\n if (matches.length > 1) {\n const ids = matches\n .map((m) => m.id)\n .filter((id): id is number => typeof id === 'number');\n throw new ResolutionError(\n `whoAmI: \"${value}\" is ambiguous (matched ${matches.length} resources)`,\n { code: 'RESOLUTION_AMBIGUOUS', resourceIds: ids },\n );\n }\n return matches[0]!;\n}\n\n/**\n * transferOwnership — bulk ownerResourceID update on named companies.\n * Sequential: read each company (a miss is the vendor's NotFoundError and the\n * dry-run needs the current owner), then — only when `dryRun` is false — PUT\n * the new owner. Returns every change in the given id order.\n */\nexport async function transferOwnership(\n _resource: ResourcesResource,\n companyIds: Identifier[],\n destinationResourceId: Identifier,\n http: HttpClient,\n opts?: TransferOwnershipOptions,\n): Promise<TransferOwnershipResult | TransferOwnershipDryRunResult> {\n const ids = requirePositiveIds(companyIds, 'transferOwnership');\n // parseIdentifier BEFORE the wire (QA F1 audit): an unsafe JS number is\n // already corrupted (the caller lost a digit) — refuse it typed, never send.\n const destination = parseIdentifier(destinationResourceId, 'destinationResourceId');\n if (typeof destination === 'number' && destination < 1) {\n throw new AutotaskConfigError('transferOwnership: destinationResourceId must be a positive integer');\n }\n const dryRun = opts?.dryRun ?? true;\n const changes: OwnershipChange[] = [];\n const applied: Identifier[] = [];\n for (const id of ids) {\n try {\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Companies/${id}`,\n operation: 'resources.transferOwnership',\n });\n const company = unwrapItem<Company>(res, id);\n const current = typeof company.ownerResourceID === 'number' ? company.ownerResourceID : null;\n changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });\n if (!dryRun) {\n // D1: companies are collection-only-writable (the spec's item path is\n // GET-only; the item-path PUT 405s) — the PUT hits the COLLECTION\n // with the company id in the body (the vendor keys the record there).\n const update = await http.request<unknown>({\n method: 'PUT',\n path: '/V1.0/Companies',\n body: { id, ownerResourceID: destination },\n operation: 'resources.transferOwnership',\n });\n unwrapOperation(update);\n applied.push(id);\n }\n } catch (err) {\n // A mid-run failure leaves the earlier ids re-owned: say exactly which,\n // so the caller can resume with the rest instead of guessing.\n if (!dryRun && err instanceof AutotaskError) {\n err.resourceIds = [id];\n err.suggestedAction =\n `Partial transfer: ${applied.length} of ${ids.length} companies were re-owned (ids: ${applied.join(', ') || 'none'}); ` +\n `id ${id} failed. Re-run transferOwnership for the remaining ids (from ${id} on).`;\n }\n throw err;\n }\n }\n if (dryRun) {\n // The per-id GETs above are the only requests (the PUTs are gated on\n // !dryRun in the loop). The request preview is the PER-RECORD shape —\n // it fans out to one PUT per id (bounded 500), hence the warning.\n // wouldApply is builder-derived from the checks: the\n // owner-change-pending check is false when no PUT would change anything.\n const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);\n // The builder derives target.resource from the operation name\n // (`resources`); the AFFECTED entity is companies (the pinned\n // `target: { resource: 'companies', ids }`), so it is set explicitly.\n return {\n ...buildDryRunResult({\n operation: 'resources.transferOwnership',\n method: 'PUT',\n path: '/V1.0/Companies', // the collection (D1: the item path is GET-only)\n ids,\n checks: [\n { name: 'ids-positive-integer', ok: true },\n { name: 'destination-valid', ok: true },\n { name: 'owner-change-pending', ok: anyChange },\n ],\n impact: { affected: ids.length, scope: 'companies ownerResourceID', reversible: true },\n warnings: [\n `the per-record request fans out to ${ids.length} id${ids.length === 1 ? '' : 's'} (bounded ${MAX_TRANSFER_IDS})`,\n ],\n }, { redactPersonalData: http.redactPersonalData }),\n target: { resource: 'companies', ids },\n changes,\n };\n }\n return { dryRun: false, changes };\n}\n","/**\n * ResourcesResource — Resource resource (G5 batch B, plan key 'resources').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResolvedAutotaskConfig } from '../config.js';\nimport type { Resource, ResourceCreate, ResourceUpdate, ResourceSummary } from '../types/resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as resourcesSpecial from './special/resources.js';\nimport type { TransferOwnershipDryRunResult, TransferOwnershipOptions, TransferOwnershipResult } from './special/resources.js';\n\n/** Query params for ResourcesResource (the G3 filter surface; no per-resource invention). */\nexport type ResourcesResourceQueryParams = QueryParams;\n\nexport class ResourcesResource extends BaseResource<Resource, ResourceCreate, ResourceUpdate> {\n private readonly clientConfig: ResolvedAutotaskConfig;\n constructor(http: HttpClient, clientConfig: ResolvedAutotaskConfig, pageSize: number) {\n super(http, {\n key: 'resources',\n resourcePath: '/V1.0/Resources',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['firstName', 'lastName'],\n }, pageSize);\n this.clientConfig = clientConfig;\n }\n\n /** Query Resource records with the G3 filter surface (server-side JSON filter). */\n query(params?: ResourcesResourceQueryParams): AsyncIterable<Resource> {\n return this.queryItems(params);\n }\n\n /** Get every Resource record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ResourcesResourceQueryParams): Promise<Resource[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ResourcesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Resource> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ResourceUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ResourceUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Resource from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on firstName / lastName). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Resource records: bounded contains on firstName + lastName (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ResourceSummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/resources.ts). */\n transferOwnership(sourceResourceIds: Identifier[], destinationResourceId: Identifier, opts: TransferOwnershipOptions = {}): Promise<TransferOwnershipResult | TransferOwnershipDryRunResult> {\n return resourcesSpecial.transferOwnership(this, sourceResourceIds, destinationResourceId, this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/resources.ts). */\n whoAmI(): Promise<ResourceSummary | null> {\n return resourcesSpecial.whoAmI(this, this.clientConfig.userName, this.http);\n }\n}\n","/**\n * Resource time-off additional special op (G5 batch B) — getByResource.\n *\n * Node parity (nodes/Autotask/resources/resourceTimeOffAdditional/execute.ts):\n * the resource's additional time-off entries are read from the parent-scoped\n * collection `GET /V1.0/Resources/{resourceID}/TimeOffAdditional`\n * (QueryActionResult → items; the global entity has no item-level reads).\n */\nimport { unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { ResourceTimeOffAdditional } from '../../types/resource_time_off_additional.js';\nimport type { ResourceTimeOffAdditionalResource } from '../resource_time_off_additional.js';\nimport type { Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\n\n/** Get the additional time-off entries for a resource (parent-scoped collection). */\nexport async function getByResource(\n _resource: ResourceTimeOffAdditionalResource,\n resourceId: Identifier,\n http: HttpClient,\n): Promise<ResourceTimeOffAdditional[]> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericResource = parseIdentifier(resourceId, 'resourceId');\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,\n operation: 'resource_time_off_additional.getByResource',\n });\n return unwrapItems<ResourceTimeOffAdditional>(res, 'resource_time_off_additional.getByResource').items;\n}\n","/**\n * ResourceTimeOffAdditionalResource — ResourceTimeOffAdditional resource (G5 batch B, plan key 'resource_time_off_additional').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/TimeOffAdditional —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceTimeOffAdditional, ResourceTimeOffAdditionalCreate, ResourceTimeOffAdditionalUpdate, ResourceTimeOffAdditionalSummary } from '../types/resource_time_off_additional.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as resourcetimeoffadditionalSpecial from './special/resource_time_off_additional.js';\n\n/** Query params for ResourceTimeOffAdditionalResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceTimeOffAdditionalResourceQueryParams = QueryParams;\n\nexport class ResourceTimeOffAdditionalResource extends BaseResource<ResourceTimeOffAdditional, ResourceTimeOffAdditionalCreate, ResourceTimeOffAdditionalUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_time_off_additional',\n resourcePath: '/V1.0/ResourceTimeOffAdditional',\n parentScopedPath: '/V1.0/Resources/{parentId}/TimeOffAdditional',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: ResourceTimeOffAdditionalUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ResourceTimeOffAdditionalUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'resource_time_off_additional.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a ResourceTimeOffAdditional from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceTimeOffAdditionalSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/resource_time_off_additional.ts). */\n getByResource(resourceId: Identifier): Promise<ResourceTimeOffAdditional[]> {\n return resourcetimeoffadditionalSpecial.getByResource(this, resourceId, this.http);\n }\n}\n","/**\n * ResourceTimeOffApproversResource — ResourceTimeOffApprover resource (G5 batch B, plan key 'resource_time_off_approvers').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/TimeOffApprovers —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceTimeOffApprover, ResourceTimeOffApproverCreate, ResourceTimeOffApproverUpdate, ResourceTimeOffApproverSummary } from '../types/resource_time_off_approvers.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ResourceTimeOffApproversResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceTimeOffApproversResourceQueryParams = QueryParams;\n\nexport class ResourceTimeOffApproversResource extends BaseResource<ResourceTimeOffApprover, ResourceTimeOffApproverCreate, ResourceTimeOffApproverUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_time_off_approvers',\n resourcePath: '/V1.0/ResourceTimeOffApprovers',\n parentScopedPath: '/V1.0/Resources/{parentId}/TimeOffApprovers',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Query ResourceTimeOffApprover records (global; narrow with the resourceID filter). */\n query(params?: ResourceTimeOffApproversResourceQueryParams): AsyncIterable<ResourceTimeOffApprover> {\n return this.queryItems(params);\n }\n\n /** Get every ResourceTimeOffApprover record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ResourceTimeOffApproversResourceQueryParams): Promise<ResourceTimeOffApprover[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ResourceTimeOffApproversResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Resources/{parentId}/TimeOffApprovers/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ResourceTimeOffApprover> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a ResourceTimeOffApprover from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceTimeOffApproverSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Resource time-off balances special ops (G5 batch B) — getByResource /\n * getByYear.\n *\n * Node parity (nodes/Autotask/resources/resourceTimeOffBalances/execute.ts):\n * - getByResource: `GET /V1.0/Resources/{resourceID}/TimeOffBalances`\n * (QueryActionResult → items).\n * - getByYear: `GET /V1.0/Resources/{resourceID}/TimeOffBalances/{year}`\n * (item envelope; item: null → NotFoundError).\n * The vendor defines neither the global entity's item read nor the scoped\n * {id} read in swagger — the scoped collection + {year} paths are pinned\n * (the {id} path is a known node-parity gap, UNVERIFIED-live).\n */\nimport { AutotaskConfigError } from '../../errors.js';\nimport { unwrapItem, unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { ResourceTimeOffBalance } from '../../types/resource_time_off_balances.js';\nimport type { ResourceTimeOffBalancesResource } from '../resource_time_off_balances.js';\nimport type { Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\n\n/** Get the time-off balances for a resource (parent-scoped collection). */\nexport async function getByResource(\n _resource: ResourceTimeOffBalancesResource,\n resourceId: Identifier,\n http: HttpClient,\n): Promise<ResourceTimeOffBalance[]> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericResource = parseIdentifier(resourceId, 'resourceId');\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,\n operation: 'resource_time_off_balances.getByResource',\n });\n return unwrapItems<ResourceTimeOffBalance>(res, 'resource_time_off_balances.getByResource').items;\n}\n\n/** Get the time-off balances for a resource in a year (scoped {year} item). */\nexport async function getByYear(\n _resource: ResourceTimeOffBalancesResource,\n resourceId: Identifier,\n year: number,\n http: HttpClient,\n): Promise<ResourceTimeOffBalance> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericResource = parseIdentifier(resourceId, 'resourceId');\n if (!Number.isSafeInteger(year) || year < 1) {\n throw new AutotaskConfigError('getByYear: year must be a positive integer');\n }\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,\n operation: 'resource_time_off_balances.getByYear',\n });\n return unwrapItem<ResourceTimeOffBalance>(res, year, 'resource_time_off_balances.getByYear');\n}\n","/**\n * ResourceTimeOffBalancesResource — ResourceTimeOffBalance resource (G5 batch B, plan key 'resource_time_off_balances').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'resources': CRUD under /V1.0/Resources/{parentId}/TimeOffBalances —\n * the global query/count stay unscoped (narrow with the 'resourceID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ResourceTimeOffBalance, ResourceTimeOffBalanceCreate, ResourceTimeOffBalanceUpdate, ResourceTimeOffBalanceSummary } from '../types/resource_time_off_balances.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\nimport * as resourcetimeoffbalancesSpecial from './special/resource_time_off_balances.js';\n\n/** Query params for ResourceTimeOffBalancesResource (the G3 filter surface; no per-resource invention). */\nexport type ResourceTimeOffBalancesResourceQueryParams = QueryParams;\n\nexport class ResourceTimeOffBalancesResource extends BaseResource<ResourceTimeOffBalance, ResourceTimeOffBalanceCreate, ResourceTimeOffBalanceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'resource_time_off_balances',\n resourcePath: '/V1.0/ResourceTimeOffBalances',\n parentScopedPath: '/V1.0/Resources/{parentId}/TimeOffBalances',\n parentField: 'resourceID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Resources',\n }, pageSize);\n }\n\n /** Get one record by parent + id (/V1.0/Resources/{parentId}/TimeOffBalances/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ResourceTimeOffBalance> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a ResourceTimeOffBalance from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ResourceTimeOffBalanceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/resource_time_off_balances.ts). */\n getByResource(resourceId: Identifier): Promise<ResourceTimeOffBalance[]> {\n return resourcetimeoffbalancesSpecial.getByResource(this, resourceId, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/resource_time_off_balances.ts). */\n getByYear(resourceId: Identifier, year: number): Promise<ResourceTimeOffBalance> {\n return resourcetimeoffbalancesSpecial.getByYear(this, resourceId, year, this.http);\n }\n}\n","/**\n * RolesResource — Role resource (G5 batch B, plan key 'roles').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Role, RoleCreate, RoleUpdate, RoleSummary } from '../types/roles.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for RolesResource (the G3 filter surface; no per-resource invention). */\nexport type RolesResourceQueryParams = QueryParams;\n\nexport class RolesResource extends BaseResource<Role, RoleCreate, RoleUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'roles',\n resourcePath: '/V1.0/Roles',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Role records with the G3 filter surface (server-side JSON filter). */\n query(params?: RolesResourceQueryParams): AsyncIterable<Role> {\n return this.queryItems(params);\n }\n\n /** Get every Role record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: RolesResourceQueryParams): Promise<Role[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: RolesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Role> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: RoleCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<RoleCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: RoleUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<RoleUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Role from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<RoleSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Role records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<RoleSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * ServiceCallsResource — ServiceCall resource (G5 batch B, plan key 'service_calls').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceCall, ServiceCallCreate, ServiceCallUpdate, ServiceCallSummary } from '../types/service_calls.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceCallsResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceCallsResourceQueryParams = QueryParams;\n\nexport class ServiceCallsResource extends BaseResource<ServiceCall, ServiceCallCreate, ServiceCallUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_calls',\n resourcePath: '/V1.0/ServiceCalls',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query ServiceCall records with the G3 filter surface (server-side JSON filter). */\n query(params?: ServiceCallsResourceQueryParams): AsyncIterable<ServiceCall> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceCall record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceCallsResourceQueryParams): Promise<ServiceCall[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceCallsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ServiceCall> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ServiceCallCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ServiceCallUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'service_calls.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a ServiceCall from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceCallSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServiceCallTaskResourcesResource — ServiceCallTaskResource resource (G5 batch B, plan key 'service_call_task_resources').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'service_call_tasks': CRUD under /V1.0/ServiceCallTasks/{parentId}/Resources —\n * the global query/count stay unscoped (narrow with the 'serviceCallTaskID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceCallTaskResource, ServiceCallTaskResourceCreate, ServiceCallTaskResourceUpdate, ServiceCallTaskResourceSummary } from '../types/service_call_task_resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceCallTaskResourcesResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceCallTaskResourcesResourceQueryParams = QueryParams;\n\nexport class ServiceCallTaskResourcesResource extends BaseResource<ServiceCallTaskResource, ServiceCallTaskResourceCreate, ServiceCallTaskResourceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_call_task_resources',\n resourcePath: '/V1.0/ServiceCallTaskResources',\n parentScopedPath: '/V1.0/ServiceCallTasks/{parentId}/Resources',\n parentField: 'serviceCallTaskID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ServiceCallTasks',\n }, pageSize);\n }\n\n /** Query ServiceCallTaskResource records (global; narrow with the serviceCallTaskID filter). */\n query(params?: ServiceCallTaskResourcesResourceQueryParams): AsyncIterable<ServiceCallTaskResource> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceCallTaskResource record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceCallTaskResourcesResourceQueryParams): Promise<ServiceCallTaskResource[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceCallTaskResourcesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ServiceCallTasks/{parentId}/Resources/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ServiceCallTaskResource> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ServiceCallTaskResourceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallTaskResourceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'service_call_task_resources.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ServiceCallTaskResource from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceCallTaskResourceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServiceCallTasksResource — ServiceCallTask resource (G5 batch B, plan key 'service_call_tasks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'service_calls': CRUD under /V1.0/ServiceCalls/{parentId}/Tasks —\n * the global query/count stay unscoped (narrow with the 'serviceCallID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceCallTask, ServiceCallTaskCreate, ServiceCallTaskUpdate, ServiceCallTaskSummary } from '../types/service_call_tasks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceCallTasksResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceCallTasksResourceQueryParams = QueryParams;\n\nexport class ServiceCallTasksResource extends BaseResource<ServiceCallTask, ServiceCallTaskCreate, ServiceCallTaskUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_call_tasks',\n resourcePath: '/V1.0/ServiceCallTasks',\n parentScopedPath: '/V1.0/ServiceCalls/{parentId}/Tasks',\n parentField: 'serviceCallID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ServiceCalls',\n }, pageSize);\n }\n\n /** Query ServiceCallTask records (global; narrow with the serviceCallID filter). */\n query(params?: ServiceCallTasksResourceQueryParams): AsyncIterable<ServiceCallTask> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceCallTask record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceCallTasksResourceQueryParams): Promise<ServiceCallTask[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceCallTasksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ServiceCalls/{parentId}/Tasks/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ServiceCallTask> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ServiceCallTaskCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallTaskCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'service_call_tasks.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ServiceCallTask from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceCallTaskSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServiceCallTicketResourcesResource — ServiceCallTicketResource resource (G5 batch B, plan key 'service_call_ticket_resources').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'service_call_tickets': CRUD under /V1.0/ServiceCallTickets/{parentId}/Resources —\n * the global query/count stay unscoped (narrow with the 'serviceCallTicketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceCallTicketResource, ServiceCallTicketResourceCreate, ServiceCallTicketResourceUpdate, ServiceCallTicketResourceSummary } from '../types/service_call_ticket_resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceCallTicketResourcesResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceCallTicketResourcesResourceQueryParams = QueryParams;\n\nexport class ServiceCallTicketResourcesResource extends BaseResource<ServiceCallTicketResource, ServiceCallTicketResourceCreate, ServiceCallTicketResourceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_call_ticket_resources',\n resourcePath: '/V1.0/ServiceCallTicketResources',\n parentScopedPath: '/V1.0/ServiceCallTickets/{parentId}/Resources',\n parentField: 'serviceCallTicketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ServiceCallTickets',\n }, pageSize);\n }\n\n /** Query ServiceCallTicketResource records (global; narrow with the serviceCallTicketID filter). */\n query(params?: ServiceCallTicketResourcesResourceQueryParams): AsyncIterable<ServiceCallTicketResource> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceCallTicketResource record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceCallTicketResourcesResourceQueryParams): Promise<ServiceCallTicketResource[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceCallTicketResourcesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ServiceCallTickets/{parentId}/Resources/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ServiceCallTicketResource> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ServiceCallTicketResourceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallTicketResourceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'service_call_ticket_resources.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ServiceCallTicketResource from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceCallTicketResourceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServiceCallTicketsResource — ServiceCallTicket resource (G5 batch B, plan key 'service_call_tickets').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'service_calls': CRUD under /V1.0/ServiceCalls/{parentId}/Tickets —\n * the global query/count stay unscoped (narrow with the 'serviceCallID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceCallTicket, ServiceCallTicketCreate, ServiceCallTicketUpdate, ServiceCallTicketSummary } from '../types/service_call_tickets.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceCallTicketsResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceCallTicketsResourceQueryParams = QueryParams;\n\nexport class ServiceCallTicketsResource extends BaseResource<ServiceCallTicket, ServiceCallTicketCreate, ServiceCallTicketUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_call_tickets',\n resourcePath: '/V1.0/ServiceCallTickets',\n parentScopedPath: '/V1.0/ServiceCalls/{parentId}/Tickets',\n parentField: 'serviceCallID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/ServiceCalls',\n }, pageSize);\n }\n\n /** Query ServiceCallTicket records (global; narrow with the serviceCallID filter). */\n query(params?: ServiceCallTicketsResourceQueryParams): AsyncIterable<ServiceCallTicket> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceCallTicket record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceCallTicketsResourceQueryParams): Promise<ServiceCallTicket[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceCallTicketsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/ServiceCalls/{parentId}/Tickets/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<ServiceCallTicket> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: ServiceCallTicketCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCallTicketCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'service_call_tickets.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a ServiceCallTicket from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceCallTicketSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServiceLevelAgreementResultsResource — ServiceLevelAgreementResults resource (G5 batch B, plan key 'service_level_agreement_results').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { ServiceLevelAgreementResults, ServiceLevelAgreementResultsCreate, ServiceLevelAgreementResultsUpdate, ServiceLevelAgreementResultsSummary } from '../types/service_level_agreement_results.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for ServiceLevelAgreementResultsResource (the G3 filter surface; no per-resource invention). */\nexport type ServiceLevelAgreementResultsResourceQueryParams = QueryParams;\n\nexport class ServiceLevelAgreementResultsResource extends BaseResource<ServiceLevelAgreementResults, ServiceLevelAgreementResultsCreate, ServiceLevelAgreementResultsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'service_level_agreement_results',\n resourcePath: '/V1.0/ServiceLevelAgreementResults',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query ServiceLevelAgreementResults records with the G3 filter surface (server-side JSON filter). */\n query(params?: ServiceLevelAgreementResultsResourceQueryParams): AsyncIterable<ServiceLevelAgreementResults> {\n return this.queryItems(params);\n }\n\n /** Get every ServiceLevelAgreementResults record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServiceLevelAgreementResultsResourceQueryParams): Promise<ServiceLevelAgreementResults[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServiceLevelAgreementResultsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<ServiceLevelAgreementResults> {\n return this.getGlobal(id);\n }\n\n /** Resolve a ServiceLevelAgreementResults from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceLevelAgreementResultsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * ServicesResource — Service resource (G5 batch B, plan key 'services').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Service, ServiceCreate, ServiceUpdate, ServiceSummary } from '../types/services.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for ServicesResource (the G3 filter surface; no per-resource invention). */\nexport type ServicesResourceQueryParams = QueryParams;\n\nexport class ServicesResource extends BaseResource<Service, ServiceCreate, ServiceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'services',\n resourcePath: '/V1.0/Services',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n staleField: 'lastModifiedDate',\n }, pageSize);\n }\n\n /** Query Service records with the G3 filter surface (server-side JSON filter). */\n query(params?: ServicesResourceQueryParams): AsyncIterable<Service> {\n return this.queryItems(params);\n }\n\n /** Get every Service record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: ServicesResourceQueryParams): Promise<Service[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: ServicesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Service> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: ServiceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<ServiceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: ServiceUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<ServiceUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Service from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<ServiceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Service records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<ServiceSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * SkillsResource — Skill resource (G5 batch B, plan key 'skills').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Skill, SkillCreate, SkillUpdate, SkillSummary } from '../types/skills.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for SkillsResource (the G3 filter surface; no per-resource invention). */\nexport type SkillsResourceQueryParams = QueryParams;\n\nexport class SkillsResource extends BaseResource<Skill, SkillCreate, SkillUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'skills',\n resourcePath: '/V1.0/Skills',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Skill records with the G3 filter surface (server-side JSON filter). */\n query(params?: SkillsResourceQueryParams): AsyncIterable<Skill> {\n return this.queryItems(params);\n }\n\n /** Get every Skill record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: SkillsResourceQueryParams): Promise<Skill[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: SkillsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Skill> {\n return this.getGlobal(id);\n }\n\n /** Resolve a Skill from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<SkillSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Skill records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<SkillSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * SubscriptionPeriodsResource — SubscriptionPeriod resource (G5 batch B, plan key 'subscription_periods').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { SubscriptionPeriod, SubscriptionPeriodCreate, SubscriptionPeriodUpdate, SubscriptionPeriodSummary } from '../types/subscription_periods.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for SubscriptionPeriodsResource (the G3 filter surface; no per-resource invention). */\nexport type SubscriptionPeriodsResourceQueryParams = QueryParams;\n\nexport class SubscriptionPeriodsResource extends BaseResource<SubscriptionPeriod, SubscriptionPeriodCreate, SubscriptionPeriodUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'subscription_periods',\n resourcePath: '/V1.0/SubscriptionPeriods',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query SubscriptionPeriod records with the G3 filter surface (server-side JSON filter). */\n query(params?: SubscriptionPeriodsResourceQueryParams): AsyncIterable<SubscriptionPeriod> {\n return this.queryItems(params);\n }\n\n /** Get every SubscriptionPeriod record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: SubscriptionPeriodsResourceQueryParams): Promise<SubscriptionPeriod[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: SubscriptionPeriodsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<SubscriptionPeriod> {\n return this.getGlobal(id);\n }\n\n /** Resolve a SubscriptionPeriod from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<SubscriptionPeriodSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * SubscriptionsResource — Subscription resource (G4 batch A, plan key 'subscriptions').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Subscription, SubscriptionCreate, SubscriptionUpdate, SubscriptionSummary } from '../types/subscriptions.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for SubscriptionsResource (the G3 filter surface; no per-resource invention). */\nexport type SubscriptionsResourceQueryParams = QueryParams;\n\nexport class SubscriptionsResource extends BaseResource<Subscription, SubscriptionCreate, SubscriptionUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'subscriptions',\n resourcePath: '/V1.0/Subscriptions',\n deletable: true,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query Subscription records with the G3 filter surface (server-side JSON filter). */\n query(params?: SubscriptionsResourceQueryParams): AsyncIterable<Subscription> {\n return this.queryItems(params);\n }\n\n /** Get every Subscription record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: SubscriptionsResourceQueryParams): Promise<Subscription[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: SubscriptionsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Subscription> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: SubscriptionCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<SubscriptionCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: SubscriptionUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<SubscriptionUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'subscriptions.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a Subscription from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<SubscriptionSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * SurveyResultsResource — SurveyResults resource (G5 batch B, plan key 'survey_results').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { SurveyResults, SurveyResultsCreate, SurveyResultsUpdate, SurveyResultsSummary } from '../types/survey_results.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for SurveyResultsResource (the G3 filter surface; no per-resource invention). */\nexport type SurveyResultsResourceQueryParams = QueryParams;\n\nexport class SurveyResultsResource extends BaseResource<SurveyResults, SurveyResultsCreate, SurveyResultsUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'survey_results',\n resourcePath: '/V1.0/SurveyResults',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query SurveyResults records with the G3 filter surface (server-side JSON filter). */\n query(params?: SurveyResultsResourceQueryParams): AsyncIterable<SurveyResults> {\n return this.queryItems(params);\n }\n\n /** Get every SurveyResults record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: SurveyResultsResourceQueryParams): Promise<SurveyResults[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: SurveyResultsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<SurveyResults> {\n return this.getGlobal(id);\n }\n\n /** Resolve a SurveyResults from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<SurveyResultsSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * SurveysResource — Survey resource (G5 batch B, plan key 'surveys').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Survey, SurveyCreate, SurveyUpdate, SurveySummary } from '../types/surveys.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for SurveysResource (the G3 filter surface; no per-resource invention). */\nexport type SurveysResourceQueryParams = QueryParams;\n\nexport class SurveysResource extends BaseResource<Survey, SurveyCreate, SurveyUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'surveys',\n resourcePath: '/V1.0/Surveys',\n deletable: false,\n udfCapable: false,\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query Survey records with the G3 filter surface (server-side JSON filter). */\n query(params?: SurveysResourceQueryParams): AsyncIterable<Survey> {\n return this.queryItems(params);\n }\n\n /** Get every Survey record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: SurveysResourceQueryParams): Promise<Survey[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: SurveysResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Survey> {\n return this.getGlobal(id);\n }\n\n /** Resolve a Survey from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<SurveySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Survey records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<SurveySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * TagAliasesResource — TagAlias resource (G5 batch B, plan key 'tag_aliases').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tags': CRUD under /V1.0/Tags/{parentId}/Aliases —\n * the global query/count stay unscoped (narrow with the 'tagID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TagAlias, TagAliasCreate, TagAliasUpdate, TagAliasSummary } from '../types/tag_aliases.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TagAliasesResource (the G3 filter surface; no per-resource invention). */\nexport type TagAliasesResourceQueryParams = QueryParams;\n\nexport class TagAliasesResource extends BaseResource<TagAlias, TagAliasCreate, TagAliasUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'tag_aliases',\n resourcePath: '/V1.0/TagAliases',\n parentScopedPath: '/V1.0/Tags/{parentId}/Aliases',\n parentField: 'tagID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tags',\n }, pageSize);\n }\n\n /** Query TagAlias records (global; narrow with the tagID filter). */\n query(params?: TagAliasesResourceQueryParams): AsyncIterable<TagAlias> {\n return this.queryItems(params);\n }\n\n /** Get every TagAlias record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TagAliasesResourceQueryParams): Promise<TagAlias[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TagAliasesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tags/{parentId}/Aliases/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TagAlias> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TagAliasCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TagAliasCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'tag_aliases.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TagAlias from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TagAliasSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TagGroupsResource — TagGroup resource (G5 batch B, plan key 'tag_groups').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TagGroup, TagGroupCreate, TagGroupUpdate, TagGroupSummary } from '../types/tag_groups.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TagGroupsResource (the G3 filter surface; no per-resource invention). */\nexport type TagGroupsResourceQueryParams = QueryParams;\n\nexport class TagGroupsResource extends BaseResource<TagGroup, TagGroupCreate, TagGroupUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'tag_groups',\n resourcePath: '/V1.0/TagGroups',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query TagGroup records with the G3 filter surface (server-side JSON filter). */\n query(params?: TagGroupsResourceQueryParams): AsyncIterable<TagGroup> {\n return this.queryItems(params);\n }\n\n /** Get every TagGroup record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TagGroupsResourceQueryParams): Promise<TagGroup[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TagGroupsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TagGroup> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TagGroupCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TagGroupCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TagGroupUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TagGroupUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'tag_groups.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a TagGroup from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TagGroupSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TagsResource — Tag resource (G5 batch B, plan key 'tags').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Tag, TagCreate, TagUpdate, TagSummary } from '../types/tags.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TagsResource (the G3 filter surface; no per-resource invention). */\nexport type TagsResourceQueryParams = QueryParams;\n\nexport class TagsResource extends BaseResource<Tag, TagCreate, TagUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'tags',\n resourcePath: '/V1.0/Tags',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query Tag records with the G3 filter surface (server-side JSON filter). */\n query(params?: TagsResourceQueryParams): AsyncIterable<Tag> {\n return this.queryItems(params);\n }\n\n /** Get every Tag record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TagsResourceQueryParams): Promise<Tag[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TagsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Tag> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TagCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TagCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TagUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TagUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'tags.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a Tag from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TagSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TaskSecondaryResourcesResource — TaskSecondaryResource resource (G4 batch A, plan key 'task_secondary_resources').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tasks': CRUD under /V1.0/Tasks/{parentId}/SecondaryResources —\n * the global query/count stay unscoped (narrow with the 'taskID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TaskSecondaryResource, TaskSecondaryResourceCreate, TaskSecondaryResourceUpdate, TaskSecondaryResourceSummary } from '../types/task_secondary_resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TaskSecondaryResourcesResource (the G3 filter surface; no per-resource invention). */\nexport type TaskSecondaryResourcesResourceQueryParams = QueryParams;\n\nexport class TaskSecondaryResourcesResource extends BaseResource<TaskSecondaryResource, TaskSecondaryResourceCreate, TaskSecondaryResourceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'task_secondary_resources',\n resourcePath: '/V1.0/TaskSecondaryResources',\n parentScopedPath: '/V1.0/Tasks/{parentId}/SecondaryResources',\n parentField: 'taskID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tasks',\n }, pageSize);\n }\n\n /** Query TaskSecondaryResource records (global; narrow with the taskID filter). */\n query(params?: TaskSecondaryResourcesResourceQueryParams): AsyncIterable<TaskSecondaryResource> {\n return this.queryItems(params);\n }\n\n /** Get every TaskSecondaryResource record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TaskSecondaryResourcesResourceQueryParams): Promise<TaskSecondaryResource[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TaskSecondaryResourcesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tasks/{parentId}/SecondaryResources/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TaskSecondaryResource> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TaskSecondaryResourceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TaskSecondaryResourceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'task_secondary_resources.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TaskSecondaryResource from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TaskSecondaryResourceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TasksResource — Task resource (G4 batch A, plan key 'tasks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'projects': CRUD under /V1.0/Projects/{parentId}/Tasks —\n * the global query/count stay unscoped (narrow with the 'projectID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Task, TaskCreate, TaskUpdate, TaskSummary } from '../types/tasks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TasksResource (the G3 filter surface; no per-resource invention). */\nexport type TasksResourceQueryParams = QueryParams;\n\nexport class TasksResource extends BaseResource<Task, TaskCreate, TaskUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'tasks',\n resourcePath: '/V1.0/Tasks',\n parentScopedPath: '/V1.0/Projects/{parentId}/Tasks',\n parentField: 'projectID',\n deletable: false,\n udfCapable: true,\n searchFields: ['title'],\n parentPath: '/V1.0/Projects',\n }, pageSize);\n }\n\n /** Query Task records (global; narrow with the projectID filter). */\n query(params?: TasksResourceQueryParams): AsyncIterable<Task> {\n return this.queryItems(params);\n }\n\n /** Get every Task record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TasksResourceQueryParams): Promise<Task[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TasksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Projects/{parentId}/Tasks/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<Task> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TaskCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TaskCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: TaskUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TaskUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'tasks.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a Task from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on title). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TaskSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search Task records: bounded contains on title (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TaskSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { ThresholdStatusResultModel } from '../types/threshold_information.js';\n\n/**\n * ThresholdInformationResource — integration endpoint (G5 batch B, plan key 'threshold_information').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class ThresholdInformationResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `/V1.0/ThresholdInformation` → `ThresholdStatusResultModel` as-is. */\n get(): Promise<ThresholdStatusResultModel> {\n return this.http.request<ThresholdStatusResultModel>({\n method: 'GET',\n path: '/V1.0/ThresholdInformation',\n operation: 'threshold_information.get',\n // Bypass the tenant 429 cooldown gate so a throttled tenant can still\n // read its own headroom (a 2xx clears the gate; a 429 re-arms it).\n bypassCooldown: true,\n // Bypass the host circuit breaker's REFUSAL so a downed host can\n // still be probed for headroom (issue #26 — the #6 bypass applies);\n // the outcome is still recorded (a 2xx closes toward recovery; a\n // counted failure re-arms).\n bypassCircuitBreaker: true,\n });\n }\n}\n","/**\n * TicketAdditionalConfigurationItemsResource — TicketAdditionalConfigurationItem resource (G4 batch A, plan key 'ticket_additional_configuration_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/AdditionalConfigurationItems —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketAdditionalConfigurationItem, TicketAdditionalConfigurationItemCreate, TicketAdditionalConfigurationItemUpdate, TicketAdditionalConfigurationItemSummary } from '../types/ticket_additional_configuration_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketAdditionalConfigurationItemsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketAdditionalConfigurationItemsResourceQueryParams = QueryParams;\n\nexport class TicketAdditionalConfigurationItemsResource extends BaseResource<TicketAdditionalConfigurationItem, TicketAdditionalConfigurationItemCreate, TicketAdditionalConfigurationItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_additional_configuration_items',\n resourcePath: '/V1.0/TicketAdditionalConfigurationItems',\n parentScopedPath: '/V1.0/Tickets/{parentId}/AdditionalConfigurationItems',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketAdditionalConfigurationItem records (global; narrow with the ticketID filter). */\n query(params?: TicketAdditionalConfigurationItemsResourceQueryParams): AsyncIterable<TicketAdditionalConfigurationItem> {\n return this.queryItems(params);\n }\n\n /** Get every TicketAdditionalConfigurationItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketAdditionalConfigurationItemsResourceQueryParams): Promise<TicketAdditionalConfigurationItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketAdditionalConfigurationItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/AdditionalConfigurationItems/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketAdditionalConfigurationItem> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketAdditionalConfigurationItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketAdditionalConfigurationItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_additional_configuration_items.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketAdditionalConfigurationItem from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketAdditionalConfigurationItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketAdditionalContactsResource — TicketAdditionalContact resource (G4 batch A, plan key 'ticket_additional_contacts').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/AdditionalContacts —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketAdditionalContact, TicketAdditionalContactCreate, TicketAdditionalContactUpdate, TicketAdditionalContactSummary } from '../types/ticket_additional_contacts.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketAdditionalContactsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketAdditionalContactsResourceQueryParams = QueryParams;\n\nexport class TicketAdditionalContactsResource extends BaseResource<TicketAdditionalContact, TicketAdditionalContactCreate, TicketAdditionalContactUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_additional_contacts',\n resourcePath: '/V1.0/TicketAdditionalContacts',\n parentScopedPath: '/V1.0/Tickets/{parentId}/AdditionalContacts',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketAdditionalContact records (global; narrow with the ticketID filter). */\n query(params?: TicketAdditionalContactsResourceQueryParams): AsyncIterable<TicketAdditionalContact> {\n return this.queryItems(params);\n }\n\n /** Get every TicketAdditionalContact record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketAdditionalContactsResourceQueryParams): Promise<TicketAdditionalContact[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketAdditionalContactsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/AdditionalContacts/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketAdditionalContact> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketAdditionalContactCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketAdditionalContactCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_additional_contacts.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketAdditionalContact from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketAdditionalContactSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketAttachmentsResource — TicketAttachment resource (G4 batch A, plan key 'ticket_attachments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/Attachments —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketAttachment, TicketAttachmentCreate, TicketAttachmentUpdate, TicketAttachmentSummary } from '../types/ticket_attachments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketAttachmentsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketAttachmentsResourceQueryParams = QueryParams;\n\nexport class TicketAttachmentsResource extends BaseResource<TicketAttachment, TicketAttachmentCreate, TicketAttachmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_attachments',\n resourcePath: '/V1.0/TicketAttachments',\n parentScopedPath: '/V1.0/Tickets/{parentId}/Attachments',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n attachmentGet: true,\n }, pageSize);\n }\n\n /** Query TicketAttachment records (global; narrow with the ticketID filter). */\n query(params?: TicketAttachmentsResourceQueryParams): AsyncIterable<TicketAttachment> {\n return this.queryItems(params);\n }\n\n /** Get every TicketAttachment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketAttachmentsResourceQueryParams): Promise<TicketAttachment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketAttachmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/Attachments/{id} — vendor answers the model directly). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketAttachment> {\n return this.getScopedModel(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketAttachmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketAttachmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete an attachment — the vendor returns the deleted attachment MODEL (not OperationResultModel).\n * `dryRun: true` returns the pinned envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<TicketAttachment | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_attachments.delete', parentId);\n return this.deleteScopedModel(parentId, id);\n }\n\n /** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */\n async download(parentId: Identifier, id: Identifier): Promise<Buffer> {\n return this.downloadScoped(parentId, id);\n }\n\n /** Resolve a TicketAttachment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketAttachmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketCategoriesResource — TicketCategory resource (G5 batch B, plan key 'ticket_categories').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketCategory, TicketCategoryCreate, TicketCategoryUpdate, TicketCategorySummary } from '../types/ticket_categories.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketCategoriesResource (the G3 filter surface; no per-resource invention). */\nexport type TicketCategoriesResourceQueryParams = QueryParams;\n\nexport class TicketCategoriesResource extends BaseResource<TicketCategory, TicketCategoryCreate, TicketCategoryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_categories',\n resourcePath: '/V1.0/TicketCategories',\n deletable: false,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n }, pageSize);\n }\n\n /** Query TicketCategory records with the G3 filter surface (server-side JSON filter). */\n query(params?: TicketCategoriesResourceQueryParams): AsyncIterable<TicketCategory> {\n return this.queryItems(params);\n }\n\n /** Get every TicketCategory record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketCategoriesResourceQueryParams): Promise<TicketCategory[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketCategoriesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TicketCategory> {\n return this.getGlobal(id);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TicketCategoryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketCategoryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a TicketCategory from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketCategorySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search TicketCategory records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TicketCategorySummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * TicketCategoryFieldDefaultsResource — TicketCategoryFieldDefault resource (G5 batch B, plan key 'ticket_category_field_defaults').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'ticket_categories': CRUD under /V1.0/TicketCategories/{parentId}/FieldDefaults —\n * the global query/count stay unscoped (narrow with the 'ticketCategoryID' filter).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketCategoryFieldDefault, TicketCategoryFieldDefaultCreate, TicketCategoryFieldDefaultUpdate, TicketCategoryFieldDefaultSummary } from '../types/ticket_category_field_defaults.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for TicketCategoryFieldDefaultsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketCategoryFieldDefaultsResourceQueryParams = QueryParams;\n\nexport class TicketCategoryFieldDefaultsResource extends BaseResource<TicketCategoryFieldDefault, TicketCategoryFieldDefaultCreate, TicketCategoryFieldDefaultUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_category_field_defaults',\n resourcePath: '/V1.0/TicketCategoryFieldDefaults',\n parentScopedPath: '/V1.0/TicketCategories/{parentId}/FieldDefaults',\n parentField: 'ticketCategoryID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/TicketCategories',\n }, pageSize);\n }\n\n /** Query TicketCategoryFieldDefault records (global; narrow with the ticketCategoryID filter). */\n query(params?: TicketCategoryFieldDefaultsResourceQueryParams): AsyncIterable<TicketCategoryFieldDefault> {\n return this.queryItems(params);\n }\n\n /** Get every TicketCategoryFieldDefault record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketCategoryFieldDefaultsResourceQueryParams): Promise<TicketCategoryFieldDefault[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketCategoryFieldDefaultsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/TicketCategories/{parentId}/FieldDefaults/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketCategoryFieldDefault> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketCategoryFieldDefault from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketCategoryFieldDefaultSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketChangeRequestApprovalsResource — TicketChangeRequestApproval resource (G4 batch A, plan key 'ticket_change_request_approvals').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/ChangeRequestApprovals —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketChangeRequestApproval, TicketChangeRequestApprovalCreate, TicketChangeRequestApprovalUpdate, TicketChangeRequestApprovalSummary } from '../types/ticket_change_request_approvals.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketChangeRequestApprovalsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketChangeRequestApprovalsResourceQueryParams = QueryParams;\n\nexport class TicketChangeRequestApprovalsResource extends BaseResource<TicketChangeRequestApproval, TicketChangeRequestApprovalCreate, TicketChangeRequestApprovalUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_change_request_approvals',\n resourcePath: '/V1.0/TicketChangeRequestApprovals',\n parentScopedPath: '/V1.0/Tickets/{parentId}/ChangeRequestApprovals',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketChangeRequestApproval records (global; narrow with the ticketID filter). */\n query(params?: TicketChangeRequestApprovalsResourceQueryParams): AsyncIterable<TicketChangeRequestApproval> {\n return this.queryItems(params);\n }\n\n /** Get every TicketChangeRequestApproval record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketChangeRequestApprovalsResourceQueryParams): Promise<TicketChangeRequestApproval[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketChangeRequestApprovalsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/ChangeRequestApprovals/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketChangeRequestApproval> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketChangeRequestApprovalCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketChangeRequestApprovalCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_change_request_approvals.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketChangeRequestApproval from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketChangeRequestApprovalSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketChargesResource — TicketCharge resource (G4 batch A, plan key 'ticket_charges').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/Charges —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketCharge, TicketChargeCreate, TicketChargeUpdate, TicketChargeSummary } from '../types/ticket_charges.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketChargesResource (the G3 filter surface; no per-resource invention). */\nexport type TicketChargesResourceQueryParams = QueryParams;\n\nexport class TicketChargesResource extends BaseResource<TicketCharge, TicketChargeCreate, TicketChargeUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_charges',\n resourcePath: '/V1.0/TicketCharges',\n parentScopedPath: '/V1.0/Tickets/{parentId}/Charges',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n searchFields: ['name'],\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketCharge records (global; narrow with the ticketID filter). */\n query(params?: TicketChargesResourceQueryParams): AsyncIterable<TicketCharge> {\n return this.queryItems(params);\n }\n\n /** Get every TicketCharge record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketChargesResourceQueryParams): Promise<TicketCharge[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketChargesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/Charges/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketCharge> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketChargeCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketChargeCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: TicketChargeUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketChargeUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_charges.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_charges.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketCharge from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketChargeSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search TicketCharge records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TicketChargeSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * TicketChecklistItemsResource — TicketChecklistItem resource (G4 batch A, plan key 'ticket_checklist_items').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/ChecklistItems —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketChecklistItem, TicketChecklistItemCreate, TicketChecklistItemUpdate, TicketChecklistItemSummary } from '../types/ticket_checklist_items.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketChecklistItemsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketChecklistItemsResourceQueryParams = QueryParams;\n\nexport class TicketChecklistItemsResource extends BaseResource<TicketChecklistItem, TicketChecklistItemCreate, TicketChecklistItemUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_checklist_items',\n resourcePath: '/V1.0/TicketChecklistItems',\n parentScopedPath: '/V1.0/Tickets/{parentId}/ChecklistItems',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketChecklistItem records (global; narrow with the ticketID filter). */\n query(params?: TicketChecklistItemsResourceQueryParams): AsyncIterable<TicketChecklistItem> {\n return this.queryItems(params);\n }\n\n /** Get every TicketChecklistItem record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketChecklistItemsResourceQueryParams): Promise<TicketChecklistItem[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketChecklistItemsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/ChecklistItems/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketChecklistItem> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketChecklistItemCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketChecklistItemCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: TicketChecklistItemUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketChecklistItemUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_checklist_items.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_checklist_items.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketChecklistItem from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketChecklistItemSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketChecklistLibrariesResource — TicketChecklistLibrary resource (G4 batch A, plan key 'ticket_checklist_libraries').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/ChecklistLibraries —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, buildDryRunResult, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketChecklistLibrary, TicketChecklistLibraryCreate, TicketChecklistLibraryUpdate, TicketChecklistLibrarySummary } from '../types/ticket_checklist_libraries.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport { unwrapOperation } from '../http.js';\nimport { parseIdentifier } from '../utils/index.js';\n\n/** Query params for TicketChecklistLibrariesResource (the G3 filter surface; no per-resource invention). */\nexport type TicketChecklistLibrariesResourceQueryParams = QueryParams;\n\nexport class TicketChecklistLibrariesResource extends BaseResource<TicketChecklistLibrary, TicketChecklistLibraryCreate, TicketChecklistLibraryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_checklist_libraries',\n resourcePath: '/V1.0/TicketChecklistLibraries',\n parentScopedPath: '/V1.0/Tickets/{parentId}/ChecklistLibraries',\n parentField: 'ticketID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketChecklistLibraryCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketChecklistLibraryCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Attach a checklist library to a document (POST /V1.0/Documents/{documentID}/ChecklistLibraries).\n * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP\n * surface — no documents read op — and never issues the POST). */\n async attachToDocument(documentID: Identifier, data: TicketChecklistLibrary, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketChecklistLibrary>> {\n // parseIdentifier BEFORE the wire (QA F1 audit): an unsafe JS number is\n // already corrupted (the caller lost a digit) — refuse it typed, never send.\n const n = parseIdentifier(documentID, 'documentID');\n if (opts.dryRun === true) {\n return buildDryRunResult({\n operation: 'ticket_checklist_libraries.attachToDocument',\n method: 'POST',\n path: `/V1.0/Documents/${n}/ChecklistLibraries`,\n ids: [],\n checks: [{ name: 'input-validation', ok: true }],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings: ['document existence not verified (no documents read op in the MVP surface)'],\n data,\n }, { redactPersonalData: this.http.redactPersonalData });\n }\n const res = await this.http.request<unknown>({\n method: 'POST',\n path: `/V1.0/Documents/${n}/ChecklistLibraries`,\n body: { ...data },\n operation: 'ticket_checklist_libraries.attachToDocument',\n });\n return unwrapOperation(res);\n }\n\n /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketChecklistLibrarySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketHistoryResource — TicketHistory resource (G5 batch B, plan key 'ticket_history').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketHistory, TicketHistoryCreate, TicketHistoryUpdate, TicketHistorySummary } from '../types/ticket_history.js';\nimport type { Identifier, QueryParams } from '../types/common.js';\n\n/** Query params for TicketHistoryResource (the G3 filter surface; no per-resource invention). */\nexport type TicketHistoryResourceQueryParams = QueryParams;\n\nexport class TicketHistoryResource extends BaseResource<TicketHistory, TicketHistoryCreate, TicketHistoryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_history',\n resourcePath: '/V1.0/TicketHistory',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query TicketHistory records with the G3 filter surface (server-side JSON filter). */\n query(params?: TicketHistoryResourceQueryParams): AsyncIterable<TicketHistory> {\n return this.queryItems(params);\n }\n\n /** Get every TicketHistory record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketHistoryResourceQueryParams): Promise<TicketHistory[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketHistoryResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TicketHistory> {\n return this.getGlobal(id);\n }\n\n /** Resolve a TicketHistory from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketHistorySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketNoteAttachmentsResource — TicketNoteAttachment resource (G5 batch B, plan key 'ticket_note_attachments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'ticket_notes': CRUD under /V1.0/TicketNotes/{parentId}/Attachments —\n * the global query/count stay unscoped (narrow with the 'ticketNoteID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketNoteAttachment, TicketNoteAttachmentCreate, TicketNoteAttachmentUpdate, TicketNoteAttachmentSummary } from '../types/ticket_note_attachments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketNoteAttachmentsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketNoteAttachmentsResourceQueryParams = QueryParams;\n\nexport class TicketNoteAttachmentsResource extends BaseResource<TicketNoteAttachment, TicketNoteAttachmentCreate, TicketNoteAttachmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_note_attachments',\n resourcePath: '/V1.0/TicketNoteAttachments',\n parentScopedPath: '/V1.0/TicketNotes/{parentId}/Attachments',\n parentField: 'ticketNoteID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/TicketNotes',\n attachmentGet: true,\n }, pageSize);\n }\n\n /** Query TicketNoteAttachment records (global; narrow with the ticketNoteID filter). */\n query(params?: TicketNoteAttachmentsResourceQueryParams): AsyncIterable<TicketNoteAttachment> {\n return this.queryItems(params);\n }\n\n /** Get every TicketNoteAttachment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketNoteAttachmentsResourceQueryParams): Promise<TicketNoteAttachment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketNoteAttachmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/TicketNotes/{parentId}/Attachments/{id} — vendor answers the model directly). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketNoteAttachment> {\n return this.getScopedModel(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketNoteAttachmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketNoteAttachmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete an attachment — the vendor returns the deleted attachment MODEL (not OperationResultModel).\n * `dryRun: true` returns the pinned envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<TicketNoteAttachment | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_note_attachments.delete', parentId);\n return this.deleteScopedModel(parentId, id);\n }\n\n /** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */\n async download(parentId: Identifier, id: Identifier): Promise<Buffer> {\n return this.downloadScoped(parentId, id);\n }\n\n /** Resolve a TicketNoteAttachment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketNoteAttachmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketNotesResource — TicketNote resource (G4 batch A, plan key 'ticket_notes').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/Notes —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketNote, TicketNoteCreate, TicketNoteUpdate, TicketNoteSummary } from '../types/ticket_notes.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketNotesResource (the G3 filter surface; no per-resource invention). */\nexport type TicketNotesResourceQueryParams = QueryParams;\n\nexport class TicketNotesResource extends BaseResource<TicketNote, TicketNoteCreate, TicketNoteUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_notes',\n resourcePath: '/V1.0/TicketNotes',\n parentScopedPath: '/V1.0/Tickets/{parentId}/Notes',\n parentField: 'ticketID',\n deletable: false,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketNote records (global; narrow with the ticketID filter). */\n query(params?: TicketNotesResourceQueryParams): AsyncIterable<TicketNote> {\n return this.queryItems(params);\n }\n\n /** Get every TicketNote record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketNotesResourceQueryParams): Promise<TicketNote[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketNotesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/Notes/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketNote> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketNoteCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketNoteCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Update a record under the parent (PATCH on the collection — swagger documents put+patch there;\n * the vendor keys the record by the id in the body; OperationResultModel → { id}). `dryRun: true` returns\n * the pinned envelope with the best-effort diff; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(parentId: Identifier, id: Identifier, data: TicketNoteUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketNoteUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_notes.update', parentId);\n return this.updateScopedRaw(parentId, id, data);\n }\n\n /** Resolve a TicketNote from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketNoteSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * TicketNoteWebhooksResource — TicketNoteWebhook resource (G5 batch B, plan key 'ticket_note_webhooks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'ticket_notes': CRUD under /V1.0/TicketNotes/{parentId}/Webhook —\n * the global query/count stay unscoped (narrow with the 'parent' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketNoteWebhook, TicketNoteWebhookCreate, TicketNoteWebhookUpdate, TicketNoteWebhookSummary } from '../types/ticket_note_webhooks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketNoteWebhooksResource (the G3 filter surface; no per-resource invention). */\nexport type TicketNoteWebhooksResourceQueryParams = QueryParams;\n\nexport class TicketNoteWebhooksResource extends BaseResource<TicketNoteWebhook, TicketNoteWebhookCreate, TicketNoteWebhookUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_note_webhooks',\n resourcePath: '/V1.0/TicketNoteWebhooks',\n parentScopedPath: '/V1.0/TicketNotes/{parentId}/Webhook',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n parentPath: '/V1.0/TicketNotes',\n }, pageSize);\n }\n\n /** Query TicketNoteWebhook records (global; narrow with the parent filter). */\n query(params?: TicketNoteWebhooksResourceQueryParams): AsyncIterable<TicketNoteWebhook> {\n return this.queryItems(params);\n }\n\n /** Get every TicketNoteWebhook record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketNoteWebhooksResourceQueryParams): Promise<TicketNoteWebhook[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketNoteWebhooksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TicketNoteWebhook> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TicketNoteWebhookCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketNoteWebhookCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TicketNoteWebhookUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketNoteWebhookUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_note_webhooks.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a TicketNoteWebhook from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketNoteWebhookSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search TicketNoteWebhook records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TicketNoteWebhookSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * TicketSecondaryResourcesResource — TicketSecondaryResource resource (G4 batch A, plan key 'ticket_secondary_resources').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/SecondaryResources —\n * the global query/count stay unscoped (narrow with the 'ticketID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketSecondaryResource, TicketSecondaryResourceCreate, TicketSecondaryResourceUpdate, TicketSecondaryResourceSummary } from '../types/ticket_secondary_resources.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketSecondaryResourcesResource (the G3 filter surface; no per-resource invention). */\nexport type TicketSecondaryResourcesResourceQueryParams = QueryParams;\n\nexport class TicketSecondaryResourcesResource extends BaseResource<TicketSecondaryResource, TicketSecondaryResourceCreate, TicketSecondaryResourceUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_secondary_resources',\n resourcePath: '/V1.0/TicketSecondaryResources',\n parentScopedPath: '/V1.0/Tickets/{parentId}/SecondaryResources',\n parentField: 'ticketID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketSecondaryResource records (global; narrow with the ticketID filter). */\n query(params?: TicketSecondaryResourcesResourceQueryParams): AsyncIterable<TicketSecondaryResource> {\n return this.queryItems(params);\n }\n\n /** Get every TicketSecondaryResource record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketSecondaryResourcesResourceQueryParams): Promise<TicketSecondaryResource[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketSecondaryResourcesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/Tickets/{parentId}/SecondaryResources/{id} — vendor item envelope; item: null → NotFoundError). */\n async get(parentId: Identifier, id: Identifier): Promise<TicketSecondaryResource> {\n return this.getScopedRaw(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TicketSecondaryResourceCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketSecondaryResourceCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_secondary_resources.delete', parentId);\n return this.deleteScopedRaw(parentId, id);\n }\n\n /** Resolve a TicketSecondaryResource from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketSecondaryResourceSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Tickets special ops — node-parity SLA / summary / timeline (G4 batch A).\n *\n * The node exposes three ticket compositions the vendor does not: an SLA\n * health rollup, a one-call summary with truncated long text, and a merged\n * chronological timeline (notes + time entries + optional histories). Each\n * composes bounded vendor queries; field names are pinned from api-docs.json.\n */\nimport { AutotaskConfigError, AutotaskError, formatVendorDetail, isAutotaskError, NotFoundError, parseVendorErrors } from '../../errors.js';\nimport { cursorToPath, unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { Ticket, TicketCreate } from '../../types/tickets.js';\nimport type { Company } from '../../types/companies.js';\nimport type { Contact } from '../../types/contacts.js';\nimport type { Resource } from '../../types/resources.js';\nimport type { Project } from '../../types/projects.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\nimport { buildDryRunResult, mergePartialBody, type MutationOpts } from '../base.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport { RELATIONSHIP_MAP } from '../../relationships.js';\nimport { CAPABILITIES } from '../../capabilities.js';\nimport type { TicketsResource } from '../tickets.js';\n\nexport interface TicketSlaHealth {\n ticketId: Identifier;\n /** SLA result rows found for the ticket. */\n slaCount: number;\n /** `true` when every milestone of every SLA is met (a ticket with no SLAs is healthy). */\n healthy: boolean;\n /** True when a full page of SLA rows came back (more may exist; `healthy` is a lower bound). */\n truncated: boolean;\n slas: Array<{\n id: number;\n name: string | null;\n milestones: Array<{\n name: 'firstResponse' | 'resolution' | 'resolutionPlan';\n met: boolean | null;\n elapsedHours: number | null;\n }>;\n }>;\n}\n\nexport interface TicketSummaryResult {\n ticketId: Identifier;\n ticketNumber: string | null;\n title: string | null;\n /** `description` truncated to `summaryTextLimit` (default 500 chars, '…' suffix). */\n description: string;\n /** Length of the ORIGINAL description. */\n descriptionLength: number;\n descriptionTruncated: boolean;\n status: number | null;\n priority: number | null;\n companyID: number | null;\n contactID: number | null;\n assignedResourceID: number | null;\n projectID: number | null;\n createDate: string | null;\n dueDateTime: string | null;\n /** floor((now - createDate) / day) — null when createDate is absent. */\n ageDays: number | null;\n}\n\nexport interface TicketTimelineEvent {\n kind: 'note' | 'timeEntry' | 'history';\n id: number;\n date: string | null;\n /** `description`/`detail` truncated to `textLimit` (default 500 chars). */\n text: string | null;\n /** Notes only. */\n title: string | null;\n /** Time entries only. */\n hours: number | null;\n /** Histories only. */\n action: string | null;\n /** True when `text` was cut at `textLimit` (the full text is on the source record). */\n textTruncated: boolean;\n}\n\nexport interface TicketTimeline {\n ticketId: Identifier;\n count: number;\n /** Ascending by date (null dates last), bounded by `limit` (default 100, max 500). */\n events: TicketTimelineEvent[];\n /**\n * True when events were left out: a source returned `limit` rows (the\n * vendor query has no sort, so more may exist) or the merged list was cut\n * to `limit`. Narrow `since`/`until` to page through the rest.\n */\n truncated: boolean;\n /** Which sources (`notes`, `timeEntries`, `histories`) returned a full page. */\n cappedSources: string[];\n /**\n * Present only when at least one source deviated from the default global\n * `/query` route (issue #35): per-source route status — 'ok' (the global\n * route served it), 'ok-scoped' (the plan-declared scoped route served it\n * because the global route 404/500'd in this zone), 'miss' (every declared\n * route failed; the source contributed no events). Absent in the working\n * zone (the shape is unchanged).\n */\n sourceRoutes?: {\n notes: 'ok' | 'ok-scoped' | 'miss';\n timeEntries: 'ok' | 'ok-scoped' | 'miss';\n histories?: 'ok' | 'ok-scoped' | 'miss';\n };\n}\n\nconst MS = 86_400_000;\n\n/** SLA result rows fetched per ticket (one page). */\nconst SLA_PAGE = 100;\n\nasync function fetchTicket(http: HttpClient, id: Identifier, operation: string): Promise<Ticket> {\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/Tickets/${id}`,\n operation,\n });\n const body = res as { item?: Ticket | null } | null;\n if (body === null || !('item' in body)) {\n throw new NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id] });\n }\n if (body.item === null || body.item === undefined) throw new NotFoundError(`Ticket ${id} not found`, { resourceIds: [id] });\n return body.item;\n}\n\n/**\n * One bounded server-filtered query (the timeline's source read). Exported\n * for the S12-B `fullContext` composite (the same machinery — do not\n * re-walk the queries with a second implementation).\n */\nexport async function ticketQueryItems<TItem>(\n http: HttpClient,\n path: string,\n filter: unknown,\n maxRecords: number,\n operation: string,\n): Promise<TItem[]> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body: { MaxRecords: maxRecords, filter },\n operation,\n });\n return unwrapItems<TItem>(res).items;\n}\n/**\n * One route fact on a composite child part that the default global `/query`\n * route did not serve (issue #35): the route attempted, the path it\n * attempted, and the HTTP status that failed it (null when the failure was\n * not an HTTP status — a shape or transport fault).\n */\nexport interface TicketChildRouteFact {\n /** The route that was attempted (the plan-declared scoped collection read is 'scoped'). */\n route: 'global' | 'scoped';\n /** The path the route attempted (e.g. '/V1.0/TicketNotes/query' or '/V1.0/Tickets/527119/Notes'). */\n path: string;\n /** The HTTP status that failed the route (null for a non-HTTP failure). */\n httpStatus: number | null;\n}\n\n/** The outcome of one composite child read (issue #35). */\ninterface ChildReadResult {\n items: Record<string, unknown>[];\n capped: boolean;\n /** 'ok' = the global /query route served the part; 'ok-scoped' = the plan-declared scoped route did (the global route 404/500'd in this zone); 'miss' = every declared route failed (the part serves no items). */\n status: 'ok' | 'ok-scoped' | 'miss';\n /** Non-empty only for 'miss': every route attempted, in attempt order. */\n routeFacts: TicketChildRouteFact[];\n}\n\n/** The zone-fault statuses that trigger the scoped-route recovery (issue #35): anything else propagates (no generic 404 fallback — that would mask real wrong-path bugs). */\nfunction isRouteUnavailable(err: unknown): boolean {\n return isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);\n}\n\nfunction routeFact(route: 'global' | 'scoped', path: string, err: unknown): TicketChildRouteFact {\n return {\n route,\n path,\n httpStatus: isAutotaskError(err) && typeof err.httpStatus === 'number' ? err.httpStatus : null,\n };\n}\n\n/**\n * The plan-declared scoped collection path under this ticket (issue #35).\n * Derived from the plan-derived relationship map (the plan is the source of\n * truth): the resource must be a plan-declared child of 'tickets' (parent\n * scope + segment + parentField). null when the plan declares no scoped\n * route for the resource — the fallback is NEVER a guess.\n */\n/**\n * The registry's own predicate for the scoped fallback (issue #35 QA\n * hardening): the child must DECLARE a query op in the registry — a child\n * with none has no declared global route to recover from, and issuing a\n * scoped read for it would be a guess. Same surface the relationship\n * artifact derives scopedOps from (implemented/tested rows only).\n */\n/** Exported for the guard pins (see the QA-minor pins in the composite-scoped suite). */\nexport function childDeclaresQuery(resourceKey: string): boolean {\n return CAPABILITIES.some(\n (c) => c.id === `${resourceKey}.query` && (c.status === 'implemented' || c.status === 'tested'),\n );\n}\n\n/** Exported for the guard wiring pins (see the QA-minor pins in the composite-scoped suite). */\nexport function planScopedPath(resourceKey: string, ticketId: Identifier): string | null {\n if (!childDeclaresQuery(resourceKey)) return null;\n const entry = RELATIONSHIP_MAP[resourceKey];\n const parent = entry === undefined ? null : entry.parent;\n if (parent === null || parent.resource !== 'tickets' || parent.segment === null || parent.field === null) return null;\n const parentPath = RELATIONSHIP_MAP[parent.resource]?.path;\n if (parentPath === null || parentPath === undefined) return null;\n return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;\n}\n\n/**\n * Apply the global `/query` filter client-side to a scoped-fallback row\n * (the scoped collection read has no server-side filter): the ticket-scoping\n * condition is intrinsic to the scoped path (the ticket id IS the path);\n * every other condition (the timeline date window) is evaluated on the row.\n * A condition the evaluator does not understand excludes the row (the\n * scoped fallback never widens the result set).\n *\n * Exported for the mutation-sensitive pins (the unknown-operator exclusion\n * is unreachable through the public API today — the composite filters only\n * use eq/gt/lt — so the contract is pinned directly).\n */\nexport function scopedRowMatches(row: Record<string, unknown>, filter: unknown): boolean {\n let conds: unknown[] | undefined;\n if (Array.isArray(filter)) conds = filter;\n else if (filter !== null && typeof filter === 'object' && Array.isArray((filter as { filter?: unknown }).filter)) {\n conds = (filter as { filter: unknown[] }).filter;\n }\n if (conds === undefined) return true;\n for (const raw of conds) {\n if (raw === null || typeof raw !== 'object') return false;\n const cond = raw as { field?: unknown; op?: unknown; value?: unknown };\n if (typeof cond.field !== 'string' || typeof cond.op !== 'string') return false;\n if (cond.field === 'ticketID') continue; // intrinsic to the scoped path\n const value = row[cond.field];\n if (typeof value !== 'string') return false;\n const want = String(cond.value ?? '');\n if (cond.op === 'eq' && value !== want) return false;\n if (cond.op === 'gt' && !(value > want)) return false;\n if (cond.op === 'lt' && !(value < want)) return false;\n if (cond.op !== 'eq' && cond.op !== 'gt' && cond.op !== 'lt') return false;\n }\n return true;\n}\n\n/** The scoped fallback walk is bounded: vendor page sizes are vendor-set; 10 pages is the hard stop. */\nconst SCOPED_FALLBACK_PAGE_CAP = 10;\n\n/**\n * One bounded read of a plan-declared scoped collection (issue #35):\n * `GET .../{parentId}/<Child>` (the vendor answers the same\n * `{ items, pageDetails }` envelope; the walk follows the vendor cursor up\n * to `limit` rows or the page cap). `accept` applies the client-side filter\n * to the fallback rows (the scoped read has no server-side filter).\n */\nasync function scopedCollectionRead(\n http: HttpClient,\n startPath: string,\n limit: number,\n operation: string,\n accept: (row: Record<string, unknown>) => boolean,\n): Promise<{ items: Record<string, unknown>[]; capped: boolean }> {\n let target = startPath;\n const items: Record<string, unknown>[] = [];\n let guard = false; // the page cap stopped the walk\n let pages = 0;\n let nextCursor: string | null = null;\n for (;;) {\n if (pages >= SCOPED_FALLBACK_PAGE_CAP) {\n guard = true;\n break;\n }\n const body = await http.request<unknown>({ method: 'GET', path: target, operation });\n const { items: pageItems, pageDetails } = unwrapItems<Record<string, unknown>>(body, operation);\n nextCursor = pageDetails.nextPageUrl;\n pages += 1;\n const window = pageItems.slice(0, Math.max(0, limit - items.length));\n for (const row of window) if (accept(row)) items.push(row);\n if (items.length >= limit) break;\n if (nextCursor === null || pageItems.length === 0) break;\n target = cursorToPath(http.baseUrl, nextCursor);\n }\n // The SAME capped rule as the global /query branch (items.length >=\n // limit — a full limit is a possible-truncation, even when the cursor\n // ran out exactly at the limit): the fallback never claims FEWER\n // truncations than the global route would for the same observed data\n // (issue #35 QA: the stricter scoped boundary contradicted the\n // same-limit-semantics contract). The page guard keeps the\n // capped=true case where the walk was stopped before the cursor end.\n const capped = items.length >= limit || (guard && nextCursor !== null);\n return { items, capped };\n}\n\n/**\n * One composite child read with the plan-declared scoped-route recovery\n * (issue #35): the global `/query` route is tried first (the working-zone\n * contract); on 404/500 — the route is unavailable in THIS zone — the read\n * recovers on the plan-declared parent-scoped collection route when the plan\n * declares one (never a guess), otherwise the miss is recorded with the\n * route facts. A route change is a status fact, never a silent downgrade.\n * Scoped narrowly to the composite child reads — NOT a transport-level\n * fallback (a generic 404 fallback would mask real wrong-path bugs).\n */\nasync function ticketChildRead(\n http: HttpClient,\n spec: {\n /** The plan-declared global route (e.g. '/V1.0/TicketNotes/query'). */\n globalPath: string;\n /** The plan resource key (the scoped route, if the plan declares one, is derived from it). */\n resourceKey: string;\n filter: unknown;\n limit: number;\n operation: string;\n },\n ticketId: Identifier,\n): Promise<ChildReadResult> {\n try {\n const items = await ticketQueryItems<Record<string, unknown>>(http, spec.globalPath, spec.filter, spec.limit, spec.operation);\n return { items, capped: items.length >= spec.limit, status: 'ok', routeFacts: [] };\n } catch (err) {\n if (!isRouteUnavailable(err)) throw err;\n const facts: TicketChildRouteFact[] = [routeFact('global', spec.globalPath, err)];\n const scopedPath = planScopedPath(spec.resourceKey, ticketId);\n if (scopedPath === null) return { items: [], capped: false, status: 'miss', routeFacts: facts };\n try {\n const read = await scopedCollectionRead(http, scopedPath, spec.limit, spec.operation, (row) => scopedRowMatches(row, spec.filter));\n return { ...read, status: 'ok-scoped', routeFacts: [] };\n } catch (scopedErr) {\n facts.push(routeFact('scoped', scopedPath, scopedErr));\n return { items: [], capped: false, status: 'miss', routeFacts: facts };\n }\n }\n}\n\n/** Stamp the route-status facts onto a served part (issue #35): 'route' on the scoped-recovery case, 'routeFacts' on the miss case. The working-zone part (global route) is untouched — the shape stays byte-identical. */\nfunction applyRouteStatus(part: { route?: 'scoped'; routeFacts?: TicketChildRouteFact[] }, read: ChildReadResult): void {\n if (read.status === 'ok-scoped') part.route = 'scoped';\n if (read.status === 'miss') part.routeFacts = read.routeFacts;\n}\n\nfunction truncate(text: string | null | undefined, limit: number): { value: string; truncated: boolean; length: number } {\n const full = text ?? '';\n if (full.length <= limit) return { value: full, truncated: false, length: full.length };\n return { value: `${full.slice(0, limit)}…`, truncated: true, length: full.length };\n}\n\n/**\n * `slaHealthCheck` — fetch the ticket + its ServiceLevelAgreementResults rows\n * and roll the three met-flags into per-SLA milestones. A missing met-flag\n * (null) is unmet for the rollup.\n */\nexport async function slaHealthCheck(\n _resource: TicketsResource,\n id: Identifier,\n opts: { now?: Date } = {},\n http: HttpClient,\n): Promise<TicketSlaHealth> {\n void opts; // `now` is unused by the rollup (the vendor flags are authoritative)\n // parseIdentifier BEFORE the wire: an unsafe JS number is already corrupted\n // (the caller lost a digit) — refuse it typed, never send it (QA F1).\n const ticketId = parseIdentifier(id, 'id');\n await fetchTicket(http, ticketId, 'tickets.slaHealthCheck');\n const rows = await ticketQueryItems<Record<string, unknown>>(\n http,\n '/V1.0/ServiceLevelAgreementResults/query',\n [{ field: 'ticketID', op: 'eq', value: ticketId }],\n SLA_PAGE,\n 'tickets.slaHealthCheck',\n );\n const slas = rows.map((row) => {\n const bool = (v: unknown) => (typeof v === 'boolean' ? v : null);\n const num = (v: unknown) => (typeof v === 'number' ? v : null);\n const milestones = [\n { name: 'firstResponse' as const, met: bool(row.isFirstResponseMet), elapsedHours: num(row.firstResponseElapsedHours) },\n { name: 'resolution' as const, met: bool(row.isResolutionMet), elapsedHours: num(row.resolutionElapsedHours) },\n { name: 'resolutionPlan' as const, met: bool(row.isResolutionPlanMet), elapsedHours: num(row.resolutionPlanElapsedHours) },\n ];\n return { id: Number(row.id), name: (row.serviceLevelAgreementName as string | undefined) ?? null, milestones };\n });\n const healthy = slas.every((sla) => sla.milestones.every((m) => m.met === true));\n // A full page means more SLA rows may exist: `healthy` is then only a lower bound.\n return { ticketId, slaCount: slas.length, healthy, slas, truncated: rows.length >= SLA_PAGE };\n}\n\n/**\n * `summary` — one record read + derived computed block; long text truncated\n * to `summaryTextLimit` (default 500). `now` is injectable for ageDays tests.\n */\nexport async function summary(\n _resource: TicketsResource,\n id: Identifier,\n opts: { summaryTextLimit?: number; now?: Date } = {},\n http: HttpClient,\n): Promise<TicketSummaryResult> {\n const limit = opts.summaryTextLimit === undefined ? 500 : Math.trunc(opts.summaryTextLimit);\n if (!Number.isInteger(limit) || limit < 1) {\n throw new AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);\n }\n // parseIdentifier BEFORE the wire: an unsafe JS number is already corrupted\n // (the caller lost a digit) — refuse it typed, never send it (QA F1).\n const ticketId = parseIdentifier(id, 'id');\n const ticket = await fetchTicket(http, ticketId, 'tickets.summary');\n const desc = truncate(ticket.description, limit);\n const now = opts.now ?? new Date();\n const ageDays =\n typeof ticket.createDate === 'string' && ticket.createDate !== ''\n ? Math.max(0, Math.floor((now.getTime() - Date.parse(ticket.createDate)) / MS))\n : null;\n const pick = (v: unknown) => (typeof v === 'number' ? v : null);\n const str = (v: unknown) => (typeof v === 'string' && v !== '' ? v : null);\n return {\n ticketId,\n ticketNumber: str(ticket.ticketNumber),\n title: str(ticket.title),\n description: desc.value,\n descriptionLength: desc.length,\n descriptionTruncated: desc.truncated,\n status: pick(ticket.status),\n priority: pick(ticket.priority),\n companyID: pick(ticket.companyID),\n contactID: pick(ticket.contactID),\n assignedResourceID: pick(ticket.assignedResourceID),\n projectID: pick(ticket.projectID),\n createDate: str(ticket.createDate),\n dueDateTime: str(ticket.dueDateTime),\n ageDays,\n };\n}\n\n/**\n * `timeline` — merge ticket notes, time entries and (optionally) histories\n * into one ascending event list. `since`/`until` are ISO dates applied as\n * gt/lt on each source's date field; text is truncated to `textLimit`.\n */\nexport async function timeline(\n _resource: TicketsResource,\n id: Identifier,\n opts: { since?: string; until?: string; limit?: number; textLimit?: number; includeHistories?: boolean } = {},\n http: HttpClient,\n): Promise<TicketTimeline> {\n const limit = opts.limit === undefined ? 100 : Math.trunc(opts.limit);\n if (!Number.isInteger(limit) || limit < 1) throw new AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);\n const bounded = Math.min(limit, 500);\n const textLimit = opts.textLimit === undefined ? 500 : Math.trunc(opts.textLimit);\n if (!Number.isInteger(textLimit) || textLimit < 1) {\n throw new AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);\n }\n // parseIdentifier BEFORE the wire: an unsafe JS number is already corrupted\n // (the caller lost a digit) — refuse it typed, never send it (QA F1).\n const ticketId = parseIdentifier(id, 'id');\n await fetchTicket(http, ticketId, 'tickets.timeline'); // existence check (NotFoundError propagates)\n\n const dateFilters = (field: string): unknown[] => {\n const f: unknown[] = [{ field: 'ticketID', op: 'eq', value: ticketId }];\n if (opts.since !== undefined) f.push({ field, op: 'gt', value: opts.since });\n if (opts.until !== undefined) f.push({ field, op: 'lt', value: opts.until });\n return f;\n };\n\n const events: TicketTimelineEvent[] = [];\n const cappedSources: string[] = [];\n const notes = await ticketChildRead(http, { globalPath: '/V1.0/TicketNotes/query', resourceKey: 'ticket_notes', filter: dateFilters('createDateTime'), limit: bounded, operation: 'tickets.timeline' }, ticketId);\n if (notes.capped) cappedSources.push('notes');\n for (const n of notes.items) {\n const text = truncate(typeof n.description === 'string' ? n.description : null, textLimit);\n events.push({\n kind: 'note',\n id: Number(n.id),\n date: typeof n.createDateTime === 'string' ? n.createDateTime : null,\n text: text.value || null,\n title: typeof n.title === 'string' ? n.title : null,\n hours: null,\n action: null,\n textTruncated: text.truncated,\n });\n }\n const entries = await ticketChildRead(http, { globalPath: '/V1.0/TimeEntries/query', resourceKey: 'time_entries', filter: dateFilters('dateWorked'), limit: bounded, operation: 'tickets.timeline' }, ticketId);\n if (entries.capped) cappedSources.push('timeEntries');\n for (const t of entries.items) {\n events.push({\n kind: 'timeEntry',\n id: Number(t.id),\n date: typeof t.dateWorked === 'string' ? t.dateWorked : null,\n text: null,\n title: null,\n hours: typeof t.hoursWorked === 'number' ? t.hoursWorked : null,\n action: null,\n textTruncated: false,\n });\n }\n let historiesRead: ChildReadResult | undefined;\n if (opts.includeHistories) {\n historiesRead = await ticketChildRead(http, { globalPath: '/V1.0/TicketHistory/query', resourceKey: 'ticket_history', filter: dateFilters('date'), limit: bounded, operation: 'tickets.timeline' }, ticketId);\n if (historiesRead.capped) cappedSources.push('histories');\n for (const h of historiesRead.items) {\n const text = truncate(typeof h.detail === 'string' ? h.detail : null, textLimit);\n events.push({\n kind: 'history',\n id: Number(h.id),\n date: typeof h.date === 'string' ? h.date : null,\n text: text.value || null,\n title: null,\n hours: null,\n action: typeof h.action === 'string' ? h.action : null,\n textTruncated: text.truncated,\n });\n }\n }\n events.sort((a, b) => {\n const da = a.date ?? '';\n const db = b.date ?? '';\n if (da === '' && db === '') return 0;\n if (da === '') return 1;\n if (db === '') return -1;\n return da < db ? -1 : da > db ? 1 : 0;\n });\n const capped = events.slice(0, bounded);\n const result: TicketTimeline = {\n ticketId,\n count: capped.length,\n events: capped,\n truncated: cappedSources.length > 0 || events.length > bounded,\n cappedSources,\n };\n // The route-status record (issue #35) exists only when a source deviated from\n // the default global route: a route change is a status fact, never a silent\n // downgrade; the working-zone shape is unchanged.\n if (notes.status !== 'ok' || entries.status !== 'ok' || (historiesRead !== undefined && historiesRead.status !== 'ok')) {\n const routes: NonNullable<TicketTimeline['sourceRoutes']> = { notes: notes.status, timeEntries: entries.status };\n if (historiesRead !== undefined) routes.histories = historiesRead.status;\n result.sourceRoutes = routes;\n }\n return result;\n}\n\n// =============================================================================\n// S12-A (run mcp-fix-20261003, plan T1/T2) — the write compositions:\n// openWithNoteAndAssign (open a ticket + optional note + optional assignment\n// in ONE op) and changeStatus (move a ticket to a target status; the node\n// carries the ww29 status picklist + the live-discovered per-status\n// required-field map). Both follow the createForResource pattern: the raw\n// ops stay underneath, the smart op is its own registry row, dry-run-first\n// (the governor appends the governed bag), typed errors name the gap.\n//\n// Zone facts (live-verified ww29, receipts in .run/mcp-fix-20261003/reports/):\n// - tickets live-required set { title, status, priority, companyID, queueID }\n// (the spec declares no required fields; a create missing any 500s with a\n// typed field-level error); queueID is TYPED NO-GUESS (the node never\n// guesses a queue — a wrong default queue misroutes real work);\n// - the scoped note body { description, noteType, publish } (S11-B N3:\n// ticketID is NOT in the body — the scoped path supplies it; publish is an\n// INTEGER picklist 1/2/4, a JSON boolean 500s);\n// - the assignment is the v0.6.0 MERGE update (a fresh UNREDACTED GET + the\n// collection PUT with the id in the body — the item path is GET-only);\n// - the status picklist (the live describeFields probe — 31 values, max id\n// 43; tenant-specific) + the per-status required-field map (LIVE-DISCOVERED\n// by the S12-A discovery protocol; pinned as a DATA TABLE below, not prose).\n// =============================================================================\n\nconst OP_OPEN = 'tickets.openWithNoteAndAssign';\nconst OP_STATUS = 'tickets.changeStatus';\n\n/** Max discovery-loop field merges (the createForResource pattern, pinned). */\nconst MAX_DISCOVERY_MERGES = 3;\n\nfunction isPositiveInt(v: unknown): v is number {\n return typeof v === 'number' && Number.isInteger(v) && v > 0;\n}\n\n/** The vendor field names a (500) error names (defensive; empty = unparseable). */\nfunction namedVendorFields(err: unknown): string[] {\n if (!isAutotaskError(err) || err.vendorError === undefined) return [];\n const entries = parseVendorErrors(err.vendorError) ?? [];\n const out = new Set<string>();\n for (const e of entries) if (e.field !== undefined) out.add(e.field);\n return [...out];\n}\n\n/** The vendor detail line for an error (defensive). */\nfunction vendorDetailOf(err: unknown): string | undefined {\n return isAutotaskError(err) ? formatVendorDetail(err.vendorError) : undefined;\n}\n\n/** `GET <path>` → the `item` (null on a 200 item-miss — the vendor's not-found signal). */\nasync function fetchItem(http: HttpClient, path: string, operation: string): Promise<Record<string, unknown> | null> {\n const res = await http.request<unknown>({ method: 'GET', path, operation });\n return unwrapItemOrNull(res);\n}\n\n/**\n * `GET <path>` → the `item` WITHOUT response redaction (the V2 merge-read\n * pattern): the merge PUT round-trips the record's own current values back to\n * the same vendor endpoint — redacting this read would put literal\n * '[REDACTED]' markers into the merged body (data corruption). The caller\n * never sees the values (the op reports derived fields only; the request-body\n * audit keeps logging redacted).\n */\nasync function fetchItemUnredacted(http: HttpClient, path: string, operation: string): Promise<Record<string, unknown> | null> {\n const res = await http.request<unknown>({ method: 'GET', path, operation, skipResponseRedaction: true });\n return unwrapItemOrNull(res);\n}\n\nfunction unwrapItemOrNull(res: unknown): Record<string, unknown> | null {\n const body = res as { item?: Record<string, unknown> | null } | null;\n if (body === null || !('item' in body) || body.item === null || body.item === undefined) return null;\n return body.item;\n}\n\n/** The `itemId`/`id` of an OperationResultModel (undefined when absent). */\nfunction operationId(res: unknown): number | undefined {\n const body = res as { itemId?: number; id?: number } | null;\n if (body === null) return undefined;\n return typeof body.itemId === 'number' ? body.itemId : typeof body.id === 'number' ? body.id : undefined;\n}\n\n/**\n * One discovery-loop merge: the FIRST vendor-named field that has a safe\n * default AND is not already in the body (idempotent — a merged field is\n * never re-merged). `defaults` is the per-op safe-default map (empty for the\n * create compositions — no proven-safe default exists there; the typed errors\n * are the design).\n */\nfunction discoveryMerge(err: unknown, body: Record<string, unknown>, defaults: Record<string, unknown>): { field: string; value: unknown } | null {\n if (!isAutotaskError(err) || err.vendorError === undefined) return null;\n const entries = parseVendorErrors(err.vendorError);\n if (entries === undefined) return null;\n for (const entry of entries) {\n const field = entry.field;\n if (field === undefined || body[field] !== undefined) continue;\n if (defaults[field] === undefined) continue;\n return { field, value: defaults[field] };\n }\n return null;\n}\n\n/** A typed step-failure text (the steps[] contract: the code + the vendor detail). */\nfunction stepErrorText(code: string, err: unknown): string {\n const detail = vendorDetailOf(err);\n const base = isAutotaskError(err) ? err.message : String(err);\n return detail ? `${code}: ${detail}` : `${code}: ${base}`;\n}\n\n// ---------------------------------------------------------------------------\n// T1 · openWithNoteAndAssign\n// ---------------------------------------------------------------------------\n\n/** The ww29-proven create defaults (live: priority 3 = Low, status 1 = New). */\nexport const DEFAULT_TICKET_PRIORITY = 3;\nexport const DEFAULT_TICKET_STATUS = 1;\nexport const DEFAULT_NOTE_TYPE = 1;\nexport const DEFAULT_PUBLISH = 1;\n/** The publish integer picklist (1/2/4 — a JSON boolean 500s at the vendor parse layer). */\nexport const PUBLISH_VALUES: ReadonlySet<number> = new Set([1, 2, 4]);\n\n/**\n * Safe create-body defaults the T1 discovery loop may merge on a 500.\n * DELIBERATELY EMPTY: the ww29 required set { title, status, priority,\n * companyID, queueID } is fully filled by the node, and queueID is TYPED\n * NO-GUESS (no safe default — a wrong queue misroutes real work; the typed\n * QUEUE_REQUIRED error is the design). Any other vendor-named field has no\n * proven-safe default → VALIDATION_FAILED (vendorFields).\n */\nconst SAFE_TICKET_CREATE_DEFAULTS: Record<string, unknown> = {};\n\nexport interface OpenWithNoteAndAssignParams {\n /** The company the ticket opens under (the vendor field companyID). */\n companyID: number;\n /** The ticket title (required). */\n title: string;\n /** Priority picklist (default 3 — the ww29-proven Low). */\n priority?: number;\n /** Status picklist (default 1 — New). */\n status?: number;\n /**\n * The queue (the vendor field queueID). The node NEVER guesses a queue:\n * omitted + the vendor 500 names it → the typed QUEUE_REQUIRED error\n * (vendor message + suggestedAction: discover via autotask_describe(tickets.create)).\n */\n queueID?: number;\n}\n\nexport interface OpenWithNoteAndAssignNote {\n /** The note text (required). */\n description: string;\n /**\n * The note title (REQUIRED — S12-A live-verified on ww29: the vendor 500s\n * the scoped note create without it — `Missing Required Field: title.`;\n * the S11-B proven note body is { title, description, noteType: 1,\n * publish: 1 }, ticketID supplied by the scoped path).\n */\n title: string;\n /** The note type integer picklist (default 1). */\n noteType?: number;\n /** The publish integer picklist 1/2/4 (default 1 — NOT a boolean). */\n publish?: number;\n}\n\nexport interface OpenWithNoteAndAssignAssign {\n /** The resource to assign (prechecked via resources.get — RESOURCE_INVALID on missing/inactive; number, or a canonical integer string for ids above 2^53). */\n resourceID: Identifier;\n /**\n * The resource role to assign (REQUIRED — S12-A live-verified on ww29:\n * the vendor REQUIRES both ids when assigning a resource —\n * `Data violation: When assigning a Resource, you must assign both a\n * assignedResourceID and assignedResourceRoleID.` — a roleID without a\n * resourceID (or vice versa) is a zero-wire config fault, never a\n * half-assignment on the wire).\n */\n roleID: number;\n}\n\n/** One step of the partial-failure contract (create/note/assign). */\nexport interface OpenStepResult {\n name: 'create' | 'note' | 'assign';\n ok: boolean;\n /** The typed failure (code + vendor detail) when ok is false. */\n error?: string;\n}\n\nexport interface OpenWithNoteAndAssignResult {\n /** The created ticket id (always present once the create settled). */\n ticketId: number;\n /** The vendor ticket number (from the assign merge read when assign ran; null otherwise). */\n ticketNumber: string | null;\n /** The created note id (null when no note was requested or the step failed). */\n noteId: number | null;\n /** True when the assignment was applied (the merge PUT settled 200). */\n assigned: boolean;\n /** The partial-failure contract: every step's outcome (a failure never throws — it lands here). */\n steps: OpenStepResult[];\n /**\n * Present when the assign precheck touched the resources surface (blind to\n * the API user — count/query return 0; get is the authority; docs/API.md §11).\n */\n blind?: { resources: true; note: string };\n}\n\n/** Pre-create fault: the vendor 500 named queueID and the caller omitted it (the node never guesses a queue). */\nexport class QueueRequiredError extends AutotaskError {\n constructor(message: string, options: { operation?: string; httpStatus?: number; vendorError?: unknown } = {}) {\n super(message, {\n code: 'QUEUE_REQUIRED',\n category: 'validation',\n suggestedAction: 'pass params.queueID (discover via autotask_describe(tickets.create) or a known queue id)',\n ...options,\n });\n this.name = 'QueueRequiredError';\n }\n}\n\n/** Pre-create fault: the assignee resource is missing or inactive (resources.get is the blind-surface authority). */\nexport class TicketResourceInvalidError extends AutotaskError {\n constructor(message: string, options: { resourceIds?: (number | string)[]; operation?: string; category?: AutotaskError['category']; suggestedAction?: string } = {}) {\n super(message, { code: 'RESOURCE_INVALID', category: 'validation', ...options });\n this.name = 'TicketResourceInvalidError';\n }\n}\n\n/** The ticket-create 500 that survived the discovery loop (no safe default for the vendor-named field). */\nexport class TicketCreateValidationFailedError extends AutotaskError {\n /** The vendor-named fields (empty when the 500 body named nothing parseable). */\n readonly vendorFields: string[];\n\n constructor(message: string, vendorFields: string[], options: { operation?: string; httpStatus?: number; vendorError?: unknown; resourceIds?: (number | string)[] } = {}) {\n super(message, { code: 'VALIDATION_FAILED', category: 'validation', ...options });\n this.name = 'TicketCreateValidationFailedError';\n this.vendorFields = vendorFields;\n }\n}\n\n/**\n * `openWithNoteAndAssign` — the write composition (S12-A plan T1).\n *\n * (1) input validation (zero wire); (2) when assign: resources.get(resourceID)\n * — missing/inactive → RESOURCE_INVALID (pre-create fault, zero further wire);\n * (3) POST /V1.0/Tickets (the ww29-proven required set — a 500 naming queueID\n * with queueID omitted → the typed QUEUE_REQUIRED; any other surviving 500 →\n * VALIDATION_FAILED with vendorFields); (4) when note: the scoped note POST\n * (failure → steps[] NOTE_CREATE_FAILED, no throw); (5) when assign: the\n * v0.6.0 MERGE update (failure → steps[] ASSIGN_FAILED, no throw).\n * `dryRun: true` performs the validation + the assignee precheck only and\n * returns the simulated envelope (ZERO mutating wire).\n */\nexport async function openWithNoteAndAssign(\n resource: TicketsResource,\n params: OpenWithNoteAndAssignParams,\n note: OpenWithNoteAndAssignNote | undefined,\n assign: OpenWithNoteAndAssignAssign | undefined,\n opts: MutationOpts,\n http: HttpClient,\n): Promise<OpenWithNoteAndAssignResult | DryRunResult<Record<string, unknown>>> {\n // (1) input validation (zero wire — shape-teaching per the governor style).\n const companyID = parseIdentifier(params?.companyID, 'params.companyID');\n const title = params?.title;\n if (typeof title !== 'string' || title.trim() === '') {\n throw new AutotaskConfigError('openWithNoteAndAssign: params.title is required (a non-empty string)', { operation: OP_OPEN });\n }\n const priority = params.priority ?? DEFAULT_TICKET_PRIORITY;\n const status = params.status ?? DEFAULT_TICKET_STATUS;\n if (!isPositiveInt(priority)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });\n }\n if (!isPositiveInt(status)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });\n }\n if (params.queueID !== undefined && !isPositiveInt(params.queueID)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });\n }\n if (note !== undefined) {\n if (typeof note.description !== 'string' || note.description.trim() === '') {\n throw new AutotaskConfigError('openWithNoteAndAssign: note.description is required (a non-empty string)', { operation: OP_OPEN });\n }\n if (typeof note.title !== 'string' || note.title.trim() === '') {\n throw new AutotaskConfigError('openWithNoteAndAssign: note.title is required (a non-empty string) — the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })', { operation: OP_OPEN });\n }\n if (note.noteType !== undefined && !isPositiveInt(note.noteType)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });\n }\n if (note.publish !== undefined && !PUBLISH_VALUES.has(note.publish)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} — NOT a boolean)`, { operation: OP_OPEN });\n }\n }\n // parseIdentifier BEFORE the wire (QA F1 audit): an unsafe JS number is\n // already corrupted (the caller lost a digit) — refuse it typed, never send.\n const assignee = assign === undefined ? undefined : parseIdentifier(assign.resourceID, 'assign.resourceID');\n if (assign !== undefined && assignee !== undefined && (typeof assignee === 'number' ? assignee < 1 : false)) {\n throw new AutotaskConfigError(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });\n }\n const roleID = assign?.roleID;\n if (assign !== undefined && !isPositiveInt(roleID)) {\n throw new AutotaskConfigError('openWithNoteAndAssign: assign.roleID is required (a positive integer) — the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)', { operation: OP_OPEN });\n }\n\n // (2) the assignee precheck (1 read; a PRE-CREATE fault — zero further wire).\n // The resources table is blind to the API user (count/query return 0) — get is the authority.\n // (validated above: assign defined ⇒ assignee is a positive integer)\n if (assign !== undefined && assignee !== undefined) {\n const rid: Identifier = assignee;\n const rec = await fetchItem(http, `/V1.0/Resources/${rid}`, OP_OPEN);\n if (rec === null) {\n throw new TicketResourceInvalidError(\n `openWithNoteAndAssign: assignee resource ${assignee} was not found (resources.get returned item: null — the resources table is blind to the API user; get is the authority)`,\n { resourceIds: [rid], operation: OP_OPEN, category: 'not_found', suggestedAction: 'Resolve the resource id (a ticket assignedResourceID via tickets.fullContext) and retry.' },\n );\n }\n if (rec.isActive !== true) {\n throw new TicketResourceInvalidError(\n `openWithNoteAndAssign: assignee resource ${assignee} is not active (isActive !== true) — the vendor would reject the assignment`,\n { resourceIds: [rid], operation: OP_OPEN, suggestedAction: 'Activate the resource or assign an active one.' },\n );\n }\n }\n\n // (3) the proven create body (the required set only — read-only / extra fields are never sent).\n const body: Record<string, unknown> = { title, status, priority, companyID };\n if (params.queueID !== undefined) body.queueID = params.queueID;\n const noteBody: Record<string, unknown> | null = note === undefined ? null : {\n title: note.title, // REQUIRED by the vendor (S12-A live-verified: Missing Required Field: title)\n description: note.description,\n noteType: note.noteType ?? DEFAULT_NOTE_TYPE,\n publish: note.publish ?? DEFAULT_PUBLISH,\n };\n\n // Dry-run (section 19.3): every precheck above ran; NO mutating request is\n // issued. The envelope data lists the exact requests the apply would issue.\n if (opts.dryRun === true) {\n const warnings: string[] = [];\n if (params.queueID === undefined) {\n warnings.push('queueID is omitted — the node NEVER guesses a queue: if the vendor 500 names it, the apply throws the typed QUEUE_REQUIRED (pass params.queueID — discover via autotask_describe(tickets.create)).');\n }\n if (assign !== undefined) {\n warnings.push(`the assignment is the v0.6.0 MERGE update (unredacted GET + collection PUT, 2 wire) setting assignedResourceID ${String(assignee)} + assignedResourceRoleID ${String(roleID)} (the vendor requires both — S12-A live-verified); a failure lands in steps[] as ASSIGN_FAILED (the applied ticketId is still returned).`);\n }\n return buildDryRunResult(\n {\n operation: OP_OPEN,\n method: 'POST',\n path: '/V1.0/Tickets',\n ids: [companyID],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'assignee-active', ok: true },\n ],\n impact: {\n affected: 1 + (noteBody !== null ? 1 : 0) + (assign !== undefined ? 1 : 0),\n scope: 'ticket (+ scoped note, + assignment merge)',\n reversible: false,\n },\n warnings,\n data: {\n ticket: body,\n note: noteBody,\n assign: assign !== undefined ? { method: 'GET+PUT', path: `/V1.0/Tickets/<newId>`, body: { assignedResourceID: assignee, assignedResourceRoleID: roleID } } : null,\n },\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n\n // (3) the create (the ≤3 discovery loop — SAFE_TICKET_CREATE_DEFAULTS is empty:\n // a surviving 500 is typed, never a blind retry).\n const steps: OpenStepResult[] = [];\n let ticketId: number;\n let merges = 0;\n for (;;) {\n try {\n const created = (await resource.create(body as unknown as TicketCreate, {})) as { id: number };\n ticketId = created.id;\n steps.push({ name: 'create', ok: true });\n break;\n } catch (err) {\n const named = namedVendorFields(err);\n if (params.queueID === undefined && named.includes('queueID')) {\n const detail = vendorDetailOf(err);\n throw new QueueRequiredError(\n `openWithNoteAndAssign: the vendor rejected the ticket create naming 'queueID' (the ww29 live-required set is { title, status, priority, companyID, queueID }) and the node never guesses a queue${detail ? ` — ${detail}` : ''}`,\n {\n operation: OP_OPEN,\n httpStatus: isAutotaskError(err) ? err.httpStatus : undefined,\n vendorError: isAutotaskError(err) ? err.vendorError : undefined,\n },\n );\n }\n const merge = discoveryMerge(err, body, SAFE_TICKET_CREATE_DEFAULTS);\n if (merge !== null && merges < MAX_DISCOVERY_MERGES) {\n body[merge.field] = merge.value;\n merges += 1;\n continue;\n }\n throw new TicketCreateValidationFailedError(\n `openWithNoteAndAssign: the vendor rejected the ticket create${named.length > 0 ? ` naming field(s) ${named.join(', ')}` : ''} (no proven-safe default — the discovery loop has no fill for a ticket create)${merges > 0 ? ` after ${merges} discovery merge(s)` : ''}`,\n named,\n {\n operation: OP_OPEN,\n httpStatus: isAutotaskError(err) ? err.httpStatus : undefined,\n vendorError: isAutotaskError(err) ? err.vendorError : undefined,\n resourceIds: [companyID],\n },\n );\n }\n }\n\n // (4) the scoped note (a failure lands in steps[] — NEVER a throw; the\n // applied ticketId is still returned — a composite that REPORTS its\n // half-success is the contract).\n let noteId: number | null = null;\n if (noteBody !== null) {\n try {\n const res = await http.request<unknown>({ method: 'POST', path: `/V1.0/Tickets/${ticketId}/Notes`, body: noteBody, operation: OP_OPEN });\n noteId = operationId(res) ?? null;\n steps.push({ name: 'note', ok: true });\n } catch (err) {\n steps.push({ name: 'note', ok: false, error: stepErrorText('NOTE_CREATE_FAILED', err) });\n }\n }\n\n // (5) the assignment — the v0.6.0 MERGE update (the unredacted GET + the\n // collection PUT with the id in the body; the merge keeps every other field).\n let assigned = false;\n let ticketNumber: string | null = null;\n if (assign !== undefined) {\n try {\n const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN);\n if (current === null) {\n throw new NotFoundError(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId] });\n }\n ticketNumber = typeof current.ticketNumber === 'string' ? current.ticketNumber : null;\n // BOTH ids — the ww29 vendor requires them together (S12-A live-verified\n // Data violation); the merge keeps every other current field.\n const merged = mergePartialBody(current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });\n merged.id = ticketId;\n await http.request<unknown>({ method: 'PUT', path: '/V1.0/Tickets', body: merged, operation: OP_OPEN });\n assigned = true;\n steps.push({ name: 'assign', ok: true });\n } catch (err) {\n steps.push({ name: 'assign', ok: false, error: stepErrorText('ASSIGN_FAILED', err) });\n }\n }\n\n return {\n ticketId,\n ticketNumber,\n noteId,\n assigned,\n steps,\n ...(assign !== undefined\n ? { blind: { resources: true, note: 'the resources table is blind to this API user (count/query return 0) — the assignee was verified via resources.get (the authority)' } }\n : {}),\n };\n}\n\n// ---------------------------------------------------------------------------\n// T2 · changeStatus\n// ---------------------------------------------------------------------------\n\n/**\n * The ww29 ticket status picklist — LIVE VERIFIED (the S11 describeFields\n * probe, reports/probe-ticket-describeFields.json; the live oracle). 31\n * values, max id 43 (the plan's \"43 values\" is the max id — the probe list is\n * the oracle; tenant-specific labels).\n */\nexport const STATUS_PICKLIST: ReadonlyArray<{ id: number; label: string }> = [\n { id: 1, label: 'New' },\n { id: 5, label: 'Complete' },\n { id: 7, label: 'Waiting Customer' },\n { id: 8, label: 'In Progress' },\n { id: 11, label: 'Escalated' },\n { id: 12, label: 'Waiting 3rd Party' },\n { id: 13, label: 'Waiting Approval' },\n { id: 14, label: 'Ticket Updated' },\n { id: 15, label: 'N-central Update' },\n { id: 17, label: 'Follow up time' },\n { id: 18, label: 'Allocated' },\n { id: 20, label: 'Idle' },\n { id: 21, label: 'Sales & Ordering' },\n { id: 24, label: 'RTN' },\n { id: 25, label: 'Waiting Internal' },\n { id: 27, label: 'Ready to Allocate' },\n { id: 28, label: 'Customer to Test' },\n { id: 29, label: 'Call Scheduled' },\n { id: 30, label: 'Call Requested' },\n { id: 31, label: 'Waiting Order' },\n { id: 33, label: 'Waiting to Invoice' },\n { id: 34, label: 'Stakeholder Update' },\n { id: 35, label: 'Stage 1 - OPP Identified' },\n { id: 36, label: 'Stage 2 - Qualification' },\n { id: 37, label: 'Stage 3 - Presales Scope' },\n { id: 38, label: 'Stage 4 - Quote Creation' },\n { id: 39, label: 'Stage 5 - Quote Prepared' },\n { id: 40, label: 'Stage 6 - Quote Presented' },\n { id: 41, label: 'Stage 7 - Quote Followed' },\n { id: 42, label: 'Stage 8 - Negotiation' },\n { id: 43, label: 'Stage 9 - Verbal Approval' },\n];\nconst STATUS_PICKLIST_SET: ReadonlySet<number> = new Set(STATUS_PICKLIST.map((v) => v.id));\n\n/**\n * The LIVE-DISCOVERED per-status required-field map (S12-A discovery\n * protocol: scratch ticket under 30132785 / queue 29683325, transitions\n * 1→8, 8→5, 5→1, 1→7; every 500's vendor-named field becomes the map entry;\n * a transition with no 500 = no extra required fields). Pinned as a DATA\n * TABLE (mirrored in the plan argNotes) — NOT prose.\n *\n * SAFE-WITHOUT-THE-MAP BY CONSTRUCTION: while the map is empty (or a status\n * has no safe default), the op NEVER fills the field and returns the typed\n * STATUS_FIELDS_REQUIRED (vendorFields + the current values) before the wire\n * — the caller (the MCP LLM) supplies the value; never a blind full update.\n */\nexport const STATUS_REQUIRED_FIELDS: Readonly<Record<number, { requiredFields: string[]; safeDefaults: Record<string, unknown> | null }>> = {\n // <discovery output lands here — e.g. 8: { requiredFields: ['dueDateTime'], safeDefaults: { dueDateTime: '<now>' } }>\n};\n\n/** Pre-request fault: targetStatus is outside the live-pinned picklist (zero wire). */\nexport class StatusUnknownError extends AutotaskError {\n /** The pinned picklist size (the message names it; the labels are via autotask_describe(tickets.describeFields)). */\n readonly picklistCount: number;\n\n constructor(message: string, options: { operation?: string } = {}) {\n super(message, {\n code: 'STATUS_UNKNOWN',\n category: 'validation',\n suggestedAction: 'Pass one of the pinned picklist values (autotask_describe(tickets.describeFields) lists the full labels).',\n ...options,\n });\n this.name = 'StatusUnknownError';\n this.picklistCount = STATUS_PICKLIST.length;\n }\n}\n\n/**\n * The per-status required-field gate (BEFORE the wire for the pre-PUT check;\n * on a PUT 500 for a field without a safe default): the caller supplies the\n * value — never a blind retry.\n */\nexport class StatusFieldsRequiredError extends AutotaskError {\n readonly vendorFields: string[];\n readonly currentStatus: number | null;\n readonly targetStatus: number;\n readonly currentValues: Record<string, unknown>;\n\n constructor(\n message: string,\n details: { vendorFields: string[]; currentStatus: number | null; targetStatus: number; currentValues: Record<string, unknown> },\n options: { operation?: string; httpStatus?: number; vendorError?: unknown; resourceIds?: (number | string)[] } = {},\n ) {\n super(message, { code: 'STATUS_FIELDS_REQUIRED', category: 'validation', suggestedAction: 'Pass the required field value(s) in the `fields` argument and retry (the node never fills a field without a proven-safe default).', ...options });\n this.name = 'StatusFieldsRequiredError';\n this.vendorFields = details.vendorFields;\n this.currentStatus = details.currentStatus;\n this.targetStatus = details.targetStatus;\n this.currentValues = details.currentValues;\n }\n}\n\nexport interface TicketChangeStatusResult {\n ticketId: Identifier;\n previousStatus: number | null;\n /** The post-PUT read-back value (verified === targetStatus or the op throws). */\n status: number;\n changed: true;\n /** The map-required fields the node filled with proven-safe defaults. */\n filledFields: string[];\n /** Discovery-merge count applied on PUT 500s (0 = first-try PUT). */\n discoveryMerges: number;\n}\n\nexport interface TicketChangeStatusNoChange {\n ticketId: Identifier;\n changed: false;\n status: number;\n reason: 'NO_CHANGE';\n}\n\n/**\n * `changeStatus` — the status-composition write op (S12-A plan T2).\n *\n * (1) targetStatus ∈ the live-pinned picklist else STATUS_UNKNOWN (zero wire);\n * (2) one UNREDACTED GET = the merge read (current status + the record — the\n * V2 pattern: the merge PUT round-trips the current values; a missing ticket\n * → NOT_FOUND); (3) current === target → the typed NO_CHANGE (zero mutating\n * wire); (4) merge body = { status: target } + the caller fields (the caller\n * wins) + the map-required fields the record lacks (proven-safe defaults only;\n * a map entry with no safe default → STATUS_FIELDS_REQUIRED BEFORE the wire);\n * (5) the collection PUT (2 wire with the GET; a 500 naming fields → ≤3\n * discovery merges of the map safe default only); (6) the post-PUT read-back\n * GET verifies the new status (the F-A1 lesson: the 200 proves nothing) →\n * { ticketId, previousStatus, status, changed: true, filledFields,\n * discoveryMerges } (3 wire typical; +2 per discovery merge ≤3 → 9 max).\n * `dryRun: true` performs the GET only and returns the simulated envelope\n * with the resolved merge body (zero mutating wire).\n */\nexport async function changeStatus(\n _resource: TicketsResource,\n id: Identifier,\n targetStatus: number,\n fields: Record<string, unknown> | undefined,\n opts: MutationOpts,\n http: HttpClient,\n): Promise<TicketChangeStatusResult | TicketChangeStatusNoChange | DryRunResult<Record<string, unknown>>> {\n // (1) the picklist guard (zero wire).\n const ticketId = parseIdentifier(id, 'id');\n if (!isPositiveInt(targetStatus)) {\n throw new AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });\n }\n if (!STATUS_PICKLIST_SET.has(targetStatus)) {\n throw new StatusUnknownError(\n `changeStatus: targetStatus ${targetStatus} is not in the ww29 status picklist (pinned: ${STATUS_PICKLIST.length} values, max id 43 — tenant-specific; the live describeFields probe is the oracle)`,\n { operation: OP_STATUS },\n );\n }\n if (fields !== undefined && (typeof fields !== 'object' || fields === null || Array.isArray(fields))) {\n throw new AutotaskConfigError('changeStatus: fields must be a plain object of ticket fields (or omitted)', { operation: OP_STATUS });\n }\n\n // (2) the merge read (ONE unredacted GET — it serves both the status check\n // and the merge source; the caller never sees the record's values).\n const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);\n if (current === null) {\n throw new NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId] });\n }\n const previousStatus: number | null = typeof current.status === 'number' ? current.status : null;\n\n // (3) the typed no-op (zero mutating wire). FULL100 F1b: the DRY caller takes\n // the simulated envelope — the raw no-op result carries no `simulated` mark,\n // and the mode tool derives the flag from `result.simulated === true` (an\n // unmarked dry call misreported simulated:false on the served surface, which\n // the stage-5 driver correctly reads as APPLIED-WHERE-DRY-EXPECTED).\n if (previousStatus === targetStatus) {\n if (opts.dryRun === true) {\n return buildDryRunResult(\n {\n operation: OP_STATUS,\n method: 'PUT',\n path: '/V1.0/Tickets',\n ids: [ticketId],\n checks: [\n { name: 'status-known', ok: true },\n { name: 'merge-read', ok: true },\n { name: 'no-op', ok: true },\n ],\n impact: { affected: 0, scope: 'single-record', reversible: true },\n warnings: [`NO_CHANGE: the ticket is already in the target status ${targetStatus} — the apply would be a zero-wire no-op.`],\n data: { reason: 'NO_CHANGE', status: targetStatus } as unknown as Record<string, unknown>,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n return { ticketId, changed: false, status: targetStatus, reason: 'NO_CHANGE' };\n }\n\n // (4) resolve the merge body: the caller wins; the map fills ONLY the\n // proven-safe defaults for the required fields the record lacks.\n const mapEntry = STATUS_REQUIRED_FIELDS[targetStatus];\n const mergeData: Record<string, unknown> = { status: targetStatus };\n for (const [k, v] of Object.entries(fields ?? {})) {\n if (v !== undefined) mergeData[k] = v;\n }\n const filled: string[] = [];\n if (mapEntry !== undefined) {\n for (const field of mapEntry.requiredFields) {\n if (mergeData[field] !== undefined) continue; // the caller supplied it (the caller wins)\n if (current[field] !== null && current[field] !== undefined) continue; // the record already has it\n const safe = mapEntry.safeDefaults?.[field];\n if (safe === undefined) {\n throw new StatusFieldsRequiredError(\n `changeStatus: status ${targetStatus} requires the field '${field}' and the live-discovered map has no proven-safe default for it — the op is safe-without-the-map (never a blind full update): supply the value in fields and retry`,\n { vendorFields: [field], currentStatus: previousStatus, targetStatus, currentValues: { [field]: current[field] ?? null } },\n { operation: OP_STATUS, resourceIds: [ticketId] },\n );\n }\n mergeData[field] = safe;\n filled.push(field);\n }\n }\n\n // Dry-run (section 19.3): the GET ran; the simulated envelope carries the\n // RESOLVED merge body (the exact field set the apply would PUT).\n if (opts.dryRun === true) {\n const warnings: string[] = [];\n if (filled.length > 0) {\n warnings.push(`the node will fill the map-required field(s) ${filled.join(', ')} with the proven-safe defaults (the live-discovered map); the caller value always wins.`);\n }\n if (mapEntry === undefined) {\n warnings.push(`status ${targetStatus} has no entry in the live-discovered required-field map yet — if the vendor 500 names a required field without a safe default, the apply throws the typed STATUS_FIELDS_REQUIRED (the caller supplies the value; never a blind retry).`);\n }\n return buildDryRunResult(\n {\n operation: OP_STATUS,\n method: 'PUT',\n path: '/V1.0/Tickets',\n ids: [ticketId],\n checks: [\n { name: 'status-known', ok: true },\n { name: 'merge-read', ok: true },\n { name: 'fields-resolved', ok: true },\n ],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings,\n data: mergeData,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n\n // (5) the merge PUT (the ≤3 discovery loop — the map safe default only).\n const safeDefaults = mapEntry?.safeDefaults ?? {};\n // const: the discovery loop mutates the body (field = value), never reassigns it\n const body = mergePartialBody(current, mergeData);\n body.id = ticketId;\n let merges = 0;\n for (;;) {\n try {\n await http.request<unknown>({ method: 'PUT', path: '/V1.0/Tickets', body, operation: OP_STATUS });\n break;\n } catch (err) {\n const named = namedVendorFields(err);\n const merge = discoveryMerge(err, body, safeDefaults);\n if (merge !== null && merges < MAX_DISCOVERY_MERGES) {\n body[merge.field] = merge.value;\n if (!filled.includes(merge.field)) filled.push(merge.field);\n merges += 1;\n continue;\n }\n if (named.length > 0 && named.every((f) => safeDefaults[f] === undefined)) {\n const currentValues: Record<string, unknown> = {};\n for (const f of named) currentValues[f] = current[f] ?? null;\n throw new StatusFieldsRequiredError(\n `changeStatus: the vendor rejected the status change ${previousStatus ?? '?'} → ${targetStatus} naming field(s) ${named.join(', ')} that have no proven-safe default — supply the value(s) in fields and retry (no blind retry)`,\n { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },\n {\n operation: OP_STATUS,\n httpStatus: isAutotaskError(err) ? err.httpStatus : undefined,\n vendorError: isAutotaskError(err) ? err.vendorError : undefined,\n resourceIds: [ticketId],\n },\n );\n }\n throw err; // merges exhausted (or unparseable 500) — surface the vendor error\n }\n }\n\n // (6) the post-PUT read-back (1 wire; the F-A1 lesson: the 200 proves nothing).\n const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);\n if (verify === null) {\n throw new AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {\n code: 'INVALID_RESPONSE',\n category: 'server',\n operation: OP_STATUS,\n resourceIds: [ticketId],\n });\n }\n const finalStatus: number | null = typeof verify.status === 'number' ? verify.status : null;\n if (finalStatus !== targetStatus) {\n throw new AutotaskError(\n `changeStatus: the post-PUT read-back shows status ${finalStatus ?? 'unknown'} (the vendor 200ed the PUT but did not apply ${targetStatus} — the F-A1 lesson: the 200 proves nothing)`,\n {\n code: 'INVALID_RESPONSE',\n category: 'server',\n httpStatus: 200,\n operation: OP_STATUS,\n resourceIds: [ticketId],\n suggestedAction: 'Re-run changeStatus (the merge re-reads the current record) or inspect the ticket (tickets.get).',\n },\n );\n }\n return { ticketId, previousStatus, status: targetStatus, changed: true, filledFields: filled, discoveryMerges: merges };\n\n}\n\n/** Options for `fullContext` (all optional; the pinned defaults). */\nexport interface TicketFullContextOptions {\n /** Max note records (default 50). */\n noteLimit?: number;\n /** Max time-entry records (default 50). */\n timeEntryLimit?: number;\n /** Include the attachments part (default true) — METADATA only (ids + names); data download stays a separate op. */\n includeAttachments?: boolean;\n /** Include the histories part (default false — budget control). */\n includeHistories?: boolean;\n /** Long note/history text is truncated to this many chars in the served copy and flagged (default 500). */\n textLimit?: number;\n}\n\n/** One capped list part (a full page sets `capped: true` — more may exist). */\nexport interface TicketFullContextPart<TItem = Record<string, unknown>> {\n items: TItem[];\n /** True when the part returned a full page (the vendor query has no sort — more may exist past the cap). */\n capped: boolean;\n /** Present only when the part was served by the plan-declared parent-scoped route (issue #35: the global /query route 404/500'd in this zone). Absent when the default global route served the part (working-zone shape unchanged). */\n route?: 'scoped';\n /** Present only when the part status is 'miss' (issue #35): every declared route attempted, in attempt order. The part serves no items; the call itself succeeds (a part miss never fails the op — the same rule as the FK 'absent' parts). */\n routeFacts?: TicketChildRouteFact[];\n}\n\n/** The attachments part is METADATA only (data download stays a separate op). */\nexport interface TicketFullContextAttachments {\n ids: number[];\n /** The attachment `title` (null when absent). */\n names: Array<string | null>;\n capped: boolean;\n route?: 'scoped';\n routeFacts?: TicketChildRouteFact[];\n}\n\n/**\n * The full ticket context in ONE call (plan T3): the ticket + its context\n * parts (the proven `getContext` 5-part composite — dangling FKs come back\n * null and are reported in `parts`, a part miss never fails the op) + its\n * notes, time entries, attachment metadata and (opt-in) histories via the\n * timeline's bounded query machinery. 8 bounded reads (10 with\n * `includeHistories`); zero mutating. The ticket itself missing → the\n * `getContext` NotFoundError propagates.\n */\nexport interface TicketFullContext {\n ticket: Ticket;\n /** Null when the ticket carries no companyID (or the record misses). */\n company: Company | null;\n /** Null when the ticket carries no contactID (or the record misses). */\n contact: Contact | null;\n /** Null when the ticket carries no assignedResourceID (or the record misses). */\n assignedResource: Resource | null;\n /** Null when the ticket carries no projectID (or the record misses). */\n project: Project | null;\n notes: TicketFullContextPart;\n timeEntries: TicketFullContextPart;\n /** Present when `includeAttachments` is not false (default: present). */\n attachments: TicketFullContextAttachments;\n /** Present only when `includeHistories: true`. */\n histories?: TicketFullContextPart;\n /** True when ANY part hit its cap (more may exist past the cap). */\n truncated: boolean;\n /** Per-part status: FK parts 'ok' | 'absent' (dangling/missing FK); list parts 'ok' (served by the global /query route — a 0-row filtered query is a legitimate answer), 'ok-scoped' (issue #35: the plan-declared scoped route served the part because the global route 404/500'd in this zone — only where the plan declares a scoped route), or 'miss' (issue #35: every declared route failed; the part serves no items, recorded in the part's routeFacts). */\n parts: {\n company: 'ok' | 'absent';\n contact: 'ok' | 'absent';\n assignedResource: 'ok' | 'absent';\n project: 'ok' | 'absent';\n notes: 'ok' | 'ok-scoped' | 'miss';\n timeEntries: 'ok' | 'ok-scoped' | 'miss';\n attachments: 'ok' | 'ok-scoped' | 'miss';\n histories?: 'ok' | 'ok-scoped' | 'miss';\n };\n}\n\nconst DEFAULT_PART_LIMIT = 50;\n\nfunction partLimit(value: number | undefined, name: string): number {\n const n = value === undefined ? DEFAULT_PART_LIMIT : Math.trunc(value);\n if (!Number.isInteger(n) || n < 1) {\n throw new AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);\n }\n return n;\n}\n\n/**\n * The served copy of a note/history record: long `description`/`detail`\n * text truncated to `textLimit` + a truncation flag (the full text stays on\n * the source record — the same semantics as `timeline`/`summary`). PII keys\n * ride the redaction choke point (the vendor body is redacted BEFORE this\n * copy is made).\n */\nfunction servedTextRecord(row: Record<string, unknown>, textField: 'description' | 'detail', limit: number): Record<string, unknown> {\n const text = row[textField];\n if (typeof text !== 'string' || text.length <= limit) return { ...row };\n const out: Record<string, unknown> = { ...row };\n out[`${textField}Truncated`] = true;\n out[textField] = `${text.slice(0, limit)}…`;\n return out;\n}\n\nexport async function fullContext(\n resource: TicketsResource,\n id: Identifier,\n opts: TicketFullContextOptions = {},\n http: HttpClient,\n): Promise<TicketFullContext> {\n const noteLimit = partLimit(opts.noteLimit, 'noteLimit');\n const timeEntryLimit = partLimit(opts.timeEntryLimit, 'timeEntryLimit');\n const textLimit = partLimit(opts.textLimit, 'textLimit');\n // parseIdentifier BEFORE the wire: an unsafe JS number is already corrupted\n // (the caller lost a digit) — refuse it typed, never send it (QA F1).\n const ticketId = parseIdentifier(id, 'id');\n // 1) the proven 5-part context composite (ticket + company + contact +\n // assignedResource + project; dangling FKs → null; ticket missing →\n // NotFoundError propagates). 1..5 wire.\n const ctx = await resource.getContext(ticketId);\n const op = 'tickets.fullContext';\n const ticketFilter = [{ field: 'ticketID', op: 'eq', value: ticketId }];\n // 2) the timeline's bounded query machinery for the list parts (3 wire;\n // the histories query only when opted in → 8-10 wire total). Each read\n // recovers on the plan-declared scoped route when the global route is\n // unavailable in the zone (issue #35 — the route change rides the part\n // status; the working-zone wire is unchanged).\n const notes = await ticketChildRead(http, { globalPath: '/V1.0/TicketNotes/query', resourceKey: 'ticket_notes', filter: ticketFilter, limit: noteLimit, operation: op }, ticketId);\n const entries = await ticketChildRead(http, { globalPath: '/V1.0/TimeEntries/query', resourceKey: 'time_entries', filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId);\n const notesRows = notes.items.map((n) => servedTextRecord(n, 'description', textLimit));\n const notesPart: TicketFullContextPart = { items: notesRows, capped: notes.capped };\n applyRouteStatus(notesPart, notes);\n const entriesPart: TicketFullContextPart = { items: entries.items, capped: entries.capped };\n applyRouteStatus(entriesPart, entries);\n // a text-truncated row is also a truncated result (the full text was not\n // served) — the top-level flag covers capping AND text truncation\n const notesTextTruncated = notesRows.some((n) => n.descriptionTruncated === true);\n let attachments: TicketFullContextAttachments = { ids: [], names: [], capped: false };\n let attachmentsStatus: 'ok' | 'ok-scoped' | 'miss' = 'ok';\n if (opts.includeAttachments !== false) {\n const read = await ticketChildRead(http, { globalPath: '/V1.0/TicketAttachments/query', resourceKey: 'ticket_attachments', filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId);\n attachmentsStatus = read.status;\n attachments = {\n ids: read.items.map((r) => Number(r.id)),\n names: read.items.map((r) => (typeof r.title === 'string' ? r.title : null)),\n capped: read.capped,\n };\n applyRouteStatus(attachments, read);\n }\n const result: TicketFullContext = {\n ticket: ctx.ticket,\n company: ctx.company,\n contact: ctx.contact,\n assignedResource: ctx.resource,\n project: ctx.project,\n notes: notesPart,\n timeEntries: entriesPart,\n attachments,\n truncated: notesPart.capped || entriesPart.capped || attachments.capped || notesTextTruncated,\n parts: {\n company: ctx.company !== null ? 'ok' : 'absent',\n contact: ctx.contact !== null ? 'ok' : 'absent',\n assignedResource: ctx.resource !== null ? 'ok' : 'absent',\n project: ctx.project !== null ? 'ok' : 'absent',\n notes: notes.status,\n timeEntries: entries.status,\n attachments: attachmentsStatus,\n },\n };\n if (opts.includeHistories === true) {\n const historiesRead = await ticketChildRead(http, { globalPath: '/V1.0/TicketHistory/query', resourceKey: 'ticket_history', filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId);\n const historyRows = historiesRead.items.map((h) => servedTextRecord(h, 'detail', textLimit));\n const part: TicketFullContextPart = { items: historyRows, capped: historiesRead.capped };\n applyRouteStatus(part, historiesRead);\n result.histories = part;\n result.parts.histories = historiesRead.status;\n result.truncated = result.truncated || part.capped || historyRows.some((h) => h.detailTruncated === true);\n }\n return result;\n}\n","/**\n * TicketsResource — Ticket resource (G4 batch A, plan key 'tickets').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { Ticket, TicketCreate, TicketUpdate, TicketSummary, TicketContext } from '../types/tickets.js';\nimport type { Company } from '../types/companies.js';\nimport type { Contact } from '../types/contacts.js';\nimport type { Resource } from '../types/resources.js';\nimport type { Project } from '../types/projects.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as ticketsSpecial from './special/tickets.js';\nimport type { TicketChangeStatusResult, TicketChangeStatusNoChange, OpenWithNoteAndAssignParams, OpenWithNoteAndAssignNote, OpenWithNoteAndAssignAssign, OpenWithNoteAndAssignResult, TicketSlaHealth, TicketSummaryResult, TicketTimeline, TicketFullContext, TicketFullContextOptions } from './special/tickets.js';\n\n/** Query params for TicketsResource (the G3 filter surface; no per-resource invention). */\nexport type TicketsResourceQueryParams = QueryParams;\n\nexport class TicketsResource extends BaseResource<Ticket, TicketCreate, TicketUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'tickets',\n resourcePath: '/V1.0/Tickets',\n deletable: false,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['title'],\n }, pageSize);\n }\n\n /** Query Ticket records with the G3 filter surface (server-side JSON filter). */\n query(params?: TicketsResourceQueryParams): AsyncIterable<Ticket> {\n return this.queryItems(params);\n }\n\n /** Get every Ticket record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketsResourceQueryParams): Promise<Ticket[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<Ticket> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TicketCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TicketUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Resolve a Ticket from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on title). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** findByTicketNumber — exact 'ticketNumber' filter; ambiguity throws RESOLUTION_AMBIGUOUS with the candidate ids. */\n async findByTicketNumber(value: string): Promise<TicketSummary | null> {\n return this.findByField('ticketNumber', value);\n }\n\n /** Search Ticket records: bounded contains on title (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TicketSummary[]> {\n return this.searchBase(query, opts);\n }\n\n /** Get the Ticket with its primary context records in one call (each part a single-record\n * fetch; no sub-lists; absent/dangling references come back null). */\n async getContext(id: Identifier): Promise<TicketContext> {\n const ticket = await this.fetchRecordRaw<Ticket>('/V1.0/Tickets', id, true);\n const root = ticket as unknown as Record<string, unknown>;\n const company = await this.contextFetch<Company>('/V1.0/Companies', (root as Record<string, unknown>)['companyID'] as number | undefined);\n const contact = await this.contextFetch<Contact>('/V1.0/Contacts', (root as Record<string, unknown>)['contactID'] as number | undefined);\n const resource = await this.contextFetch<Resource>('/V1.0/Resources', (root as Record<string, unknown>)['assignedResourceID'] as number | undefined);\n const project = await this.contextFetch<Project>('/V1.0/Projects', (root as Record<string, unknown>)['projectID'] as number | undefined);\n return { ticket, company, contact, resource, project };\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n changeStatus(id: Identifier, targetStatus: number, fields?: Record<string, unknown>, opts: MutationOpts = {}): Promise<TicketChangeStatusResult | TicketChangeStatusNoChange | DryRunResult<Record<string, unknown>>> {\n return ticketsSpecial.changeStatus(this, id, targetStatus, fields, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n openWithNoteAndAssign(params: OpenWithNoteAndAssignParams, note?: OpenWithNoteAndAssignNote, assign?: OpenWithNoteAndAssignAssign, opts: MutationOpts = {}): Promise<OpenWithNoteAndAssignResult | DryRunResult<Record<string, unknown>>> {\n return ticketsSpecial.openWithNoteAndAssign(this, params, note, assign, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n slaHealthCheck(id: Identifier, opts?: { now?: Date }): Promise<TicketSlaHealth> {\n return ticketsSpecial.slaHealthCheck(this, id, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n summary(id: Identifier, opts?: { summaryTextLimit?: number; now?: Date }): Promise<TicketSummaryResult> {\n return ticketsSpecial.summary(this, id, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n timeline(id: Identifier, opts?: { since?: string; until?: string; limit?: number; textLimit?: number; includeHistories?: boolean }): Promise<TicketTimeline> {\n return ticketsSpecial.timeline(this, id, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */\n fullContext(id: Identifier, opts?: TicketFullContextOptions): Promise<TicketFullContext> {\n return ticketsSpecial.fullContext(this, id, opts, this.http);\n }\n}\n","/**\n * TicketWebhooksResource — TicketWebhook resource (G4 batch A, plan key 'ticket_webhooks').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'tickets': CRUD under /V1.0/Tickets/{parentId}/Webhook —\n * the global query/count stay unscoped (narrow with the 'parent' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TicketWebhook, TicketWebhookCreate, TicketWebhookUpdate, TicketWebhookSummary } from '../types/ticket_webhooks.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TicketWebhooksResource (the G3 filter surface; no per-resource invention). */\nexport type TicketWebhooksResourceQueryParams = QueryParams;\n\nexport class TicketWebhooksResource extends BaseResource<TicketWebhook, TicketWebhookCreate, TicketWebhookUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'ticket_webhooks',\n resourcePath: '/V1.0/TicketWebhooks',\n parentScopedPath: '/V1.0/Tickets/{parentId}/Webhook',\n deletable: true,\n udfCapable: false,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n searchFields: ['name'],\n parentPath: '/V1.0/Tickets',\n }, pageSize);\n }\n\n /** Query TicketWebhook records (global; narrow with the parent filter). */\n query(params?: TicketWebhooksResourceQueryParams): AsyncIterable<TicketWebhook> {\n return this.queryItems(params);\n }\n\n /** Get every TicketWebhook record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TicketWebhooksResourceQueryParams): Promise<TicketWebhook[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TicketWebhooksResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TicketWebhook> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TicketWebhookCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TicketWebhookCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TicketWebhookUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TicketWebhookUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'ticket_webhooks.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a TicketWebhook from a numeric id (or, where the vendor indexes a primary text field,\n * from an exact match on name). A numeric id miss throws NOT_FOUND; a complete\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TicketWebhookSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Search TicketWebhook records: bounded contains on name (no vendor free-text search exists);\n * limit defaults to 25, max 500. */\n async search(query: string, opts?: { limit?: number }): Promise<TicketWebhookSummary[]> {\n return this.searchBase(query, opts);\n }\n}\n","/**\n * Time entry special ops — date windows + posting status (G5 batch B).\n *\n * Node parity (nodes/Autotask/resources/timeEntries/execute.ts): each window\n * is ONE bounded server-filtered query on `dateWorked` (gte/lte). The node\n * computes the bounds in the configured timezone; the SDK pins UTC (the API\n * is UTC — plan metadata) and the second-precision `YYYY-MM-DDTHH:mm:ssZ`\n * value format the node sends.\n *\n * `getPosted`/`getUnposted` keep their names and their documented meaning\n * (\"posted\" / \"not posted\") and the wire is the specification's own\n * `postedDate` presence (correct-by-spec, the way every op follows the\n * vendored contract). W-D3 (campaign adjudication 2026-10-04, RE-VERIFIED\n * LIVE against ww29 on 2026-10-04 with a field-existence oracle): this\n * zone's TimeEntry entity exposes NO posted-state filter field — the vendor\n * rejects `postingStatus`, `postedDate` AND `status` with \"Unable to find X\n * in the TimeEntry Entity\" (only dateWorked / resourceID / ticketID /\n * taskID resolve as filter fields). On such a zone a 500 from these ops is\n * the KNOWN wall, not a transient fault — the typed pointer note rides the\n * error (plan.pointerNotes, gate clause 13): the working window read on\n * those zones is `postedWithin` (the dateWorked window, live-verified).\n * Zones that honour the published spec answer `postedDate` filters normally.\n * The old `postingStatus eq` wire was the plan's G4-era picklist claim —\n * SUPERSEDED. The node's heavier client-side BillingItems composition is out\n * of scope (plan row = server filter).\n */\nimport { AutotaskConfigError, AutotaskError, formatVendorDetail, isAutotaskError, parseVendorErrors } from '../../errors.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport { buildDryRunResult, type MutationOpts } from '../base.js';\nimport type { DryRunResult, Identifier } from '../../types/common.js';\nimport { cursorToPath, unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport type { TimeEntry, TimeEntryCreate } from '../../types/time_entries.js';\nimport type { TimeEntriesResource } from '../time_entries.js';\n\nexport interface TimeEntriesWindowOptions {\n /** Window anchor (default: now) — tests pin it for determinism. */\n now?: Date;\n /** Max records (default 25, clamped to 1..500 — plan bound). */\n limit?: number;\n}\n\nexport interface TimeEntriesStatusOptions {\n /** Max records (default 25, clamped to 1..500 — plan bound). */\n limit?: number;\n /** Optional ticketID eq narrowing (node parity). */\n ticketID?: number;\n}\n\nconst DAY_MS = 86_400_000;\nconst DEFAULT_LIMIT = 25;\nconst MAX_LIMIT = 500;\n\nexport type TimeEntriesWindowKind =\n | 'today'\n | 'yesterday'\n | 'last24h'\n | 'last7'\n | 'last14'\n | 'last30'\n | 'last90'\n | 'lastFullWeek'\n | 'lastFullFortnight'\n | 'lastFullMonth'\n | 'lastFullQuarter';\n\nfunction clampLimit(limit: number | undefined): number {\n const n = limit === undefined ? DEFAULT_LIMIT : Math.trunc(limit);\n if (!Number.isInteger(n) || n < 1) {\n throw new AutotaskConfigError(`limit must be an integer >= 1 (got ${String(limit)})`);\n }\n return Math.min(n, MAX_LIMIT);\n}\n\nconst utcDayStart = (ms: number): number => {\n const d = new Date(ms);\n return Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());\n};\nconst utcDayEnd = (ms: number): number => utcDayStart(ms) + DAY_MS - 1;\n/** Second-precision UTC timestamp — the node's `YYYY-MM-DDTHH:mm:ss[Z]` wire format. */\nconst iso = (ms: number): string => new Date(ms).toISOString().slice(0, 19) + 'Z';\n\n/**\n * Window bounds (UTC, inclusive) — the node's moment-timezone math pinned in\n * UTC: rolling windows start at the day start N days back; full-period\n * windows cover the last COMPLETE ISO week / fortnight / month / quarter.\n */\nexport function timeEntriesWindowBounds(kind: TimeEntriesWindowKind, now: Date): { from: string; to: string } {\n const t = now.getTime();\n let from: number;\n let to: number;\n switch (kind) {\n case 'today':\n from = utcDayStart(t);\n to = utcDayEnd(t);\n break;\n case 'yesterday':\n from = utcDayStart(t - DAY_MS);\n to = utcDayEnd(t - DAY_MS);\n break;\n case 'last24h':\n from = t - DAY_MS;\n to = t;\n break;\n case 'last7':\n case 'last14':\n case 'last30':\n case 'last90': {\n const days = Number(kind.slice(4));\n from = utcDayStart(t - days * DAY_MS);\n to = utcDayEnd(t);\n break;\n }\n case 'lastFullWeek':\n case 'lastFullFortnight': {\n const d = new Date(t);\n const daysSinceMonday = (d.getUTCDay() + 6) % 7; // ISO week starts Monday\n const thisMonday = utcDayStart(t) - daysSinceMonday * DAY_MS;\n const daysBack = kind === 'lastFullWeek' ? 7 : 14;\n from = thisMonday - daysBack * DAY_MS;\n to = thisMonday - 1;\n break;\n }\n case 'lastFullMonth': {\n const d = new Date(t);\n const y = d.getUTCFullYear();\n const m = d.getUTCMonth() - 1; // previous month (January wraps to December)\n from = Date.UTC(y, m, 1);\n to = Date.UTC(y, m + 1, 1) - 1;\n break;\n }\n case 'lastFullQuarter': {\n const d = new Date(t);\n let q = Math.floor(d.getUTCMonth() / 3) - 1;\n let y = d.getUTCFullYear();\n if (q < 0) {\n q = 3;\n y -= 1;\n }\n const first = q * 3;\n from = Date.UTC(y, first, 1);\n to = Date.UTC(y, first + 3, 1) - 1;\n break;\n }\n }\n return { from: iso(from), to: iso(to) };\n}\n\nasync function queryTimeEntries(\n _resource: TimeEntriesResource,\n filter: unknown,\n limit: number,\n operation: string,\n http: HttpClient,\n): Promise<TimeEntry[]> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/TimeEntries/query',\n body: { MaxRecords: limit, filter },\n operation,\n });\n return unwrapItems<TimeEntry>(res).items;\n}\n\n/** Window op: bounded `dateWorked` gte/lte query over the pinned window. */\nexport async function windowQuery(\n _resource: TimeEntriesResource,\n kind: TimeEntriesWindowKind,\n http: HttpClient,\n opts?: TimeEntriesWindowOptions,\n): Promise<TimeEntry[]> {\n const now = opts?.now ?? new Date();\n const { from, to } = timeEntriesWindowBounds(kind, now);\n const filter = [\n { field: 'dateWorked', op: 'gte', value: from },\n { field: 'dateWorked', op: 'lte', value: to },\n ];\n return queryTimeEntries(_resource, filter, clampLimit(opts?.limit), `time_entries.${kind}`, http);\n}\n\n/** customRange: explicit inclusive [from, to] `dateWorked` bounds (both required, UTC). */\nexport async function customRange(\n _resource: TimeEntriesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: TimeEntriesWindowOptions,\n): Promise<TimeEntry[]> {\n const parseDay = (value: string, label: string): number => {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value.trim());\n if (!m) throw new AutotaskConfigError(`customRange: ${label} must be a UTC 'YYYY-MM-DD' date`);\n return Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n };\n const fromMs = parseDay(from, 'from');\n const toMs = parseDay(to, 'to');\n const filter = [\n { field: 'dateWorked', op: 'gte', value: iso(fromMs) },\n { field: 'dateWorked', op: 'lte', value: iso(toMs + DAY_MS - 1) },\n ];\n return queryTimeEntries(_resource, filter, clampLimit(opts?.limit), 'time_entries.customRange', http);\n}\n\n/**\n * getPosted/getUnposted: the `postedDate` presence predicate (W-D3 — the\n * vendor model has no `postingStatus`; `posted` = postedDate set,\n * `unposted` = postedDate empty) + optional ticketID eq.\n */\nexport async function postedDateStatusQuery(\n _resource: TimeEntriesResource,\n mode: 'posted' | 'unposted',\n http: HttpClient,\n opts?: TimeEntriesStatusOptions,\n): Promise<TimeEntry[]> {\n const filter: Array<{ field: string; op: string; value?: unknown }> = [\n { field: 'postedDate', op: mode === 'posted' ? 'exist' : 'notExist' },\n ];\n if (opts?.ticketID !== undefined) filter.push({ field: 'ticketID', op: 'eq', value: opts.ticketID });\n const operation = mode === 'posted' ? 'time_entries.getPosted' : 'time_entries.getUnposted';\n return queryTimeEntries(_resource, filter, clampLimit(opts?.limit), operation, http);\n}\n\n/** postedWithin options: the optional narrowing + the shared limit bound. */\nexport interface TimeEntriesPostedWindowOptions {\n /** Posted narrowing: `true` = posted rows only (postedDate exist), `false` = unposted rows only (postedDate notExist), omitted = both (the counts split the returned items). On a zone whose entity lacks the field (W-D3, e.g. ww29 — see the pointer note) the vendor 500s and the typed note explains. */\n posted?: boolean;\n /** Max records (default 25, clamped to 1..500 — plan bound). */\n limit?: number;\n /** Optional ticketID eq narrowing. */\n ticketID?: number;\n /** Optional resourceID eq narrowing. */\n resourceID?: number;\n}\n\n/** The posted-window read result (issue #10): the window's items + the two-direction count in one pass. */\nexport interface TimeEntriesPostedWindowResult {\n /** The window's entries (bounded by `limit`). */\n items: TimeEntry[];\n /** The items carrying a set `postedDate` (the live-entity field — W-D3). */\n postedCount: number;\n /** The items with an empty `postedDate`. */\n unpostedCount: number;\n /** The inclusive UTC window actually queried (wire bounds, second precision). */\n window: { from: string; to: string };\n}\n\n/**\n * postedWithin: a bounded read over an inclusive UTC `dateWorked` window\n * [from, to] that reports what is posted — ONE server-filtered query (the\n * `posted` narrowing is a server-side predicate, not a second query) and the\n * two-direction count over the returned items in that same pass. `from`/`to`\n * are UTC `YYYY-MM-DD` date strings (the customRange convention — string\n * positionals keep the S1c signature/schema contract); the window is\n * inclusive on both bounds (gte the from-day start, lte the to-day end). No\n * vendor values are invented: the counts reflect exactly the items the\n * vendor returned.\n */\nexport async function postedWithin(\n _resource: TimeEntriesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: TimeEntriesPostedWindowOptions,\n): Promise<TimeEntriesPostedWindowResult> {\n const OP = 'time_entries.postedWithin';\n const parseBound = (value: string, label: 'from' | 'to'): number => {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value.trim());\n if (!m) {\n throw new AutotaskConfigError(\n `postedWithin: ${label} must be a UTC 'YYYY-MM-DD' date string (got ${JSON.stringify(value)})`,\n { operation: OP },\n );\n }\n const ms = Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n if (!Number.isFinite(ms)) {\n throw new AutotaskConfigError(`postedWithin: ${label} is not a valid UTC date (${JSON.stringify(value)})`, { operation: OP });\n }\n return ms;\n };\n const fromMs = parseBound(from, 'from');\n const toMs = parseBound(to, 'to');\n if (fromMs > toMs) {\n throw new AutotaskConfigError(`postedWithin: from (${iso(fromMs)}) must not be after to (${iso(toMs)})`, { operation: OP });\n }\n const windowToMs = toMs + DAY_MS - 1; // inclusive to-day end (the customRange convention)\n const filter: Array<{ field: string; op: string; value?: unknown }> = [\n { field: 'dateWorked', op: 'gte', value: iso(fromMs) },\n { field: 'dateWorked', op: 'lte', value: iso(windowToMs) },\n ];\n if (opts?.posted === true) filter.push({ field: 'postedDate', op: 'exist' });\n else if (opts?.posted === false) filter.push({ field: 'postedDate', op: 'notExist' });\n if (opts?.ticketID !== undefined) filter.push({ field: 'ticketID', op: 'eq', value: opts.ticketID });\n if (opts?.resourceID !== undefined) filter.push({ field: 'resourceID', op: 'eq', value: opts.resourceID });\n const items = await queryTimeEntries(_resource, filter, clampLimit(opts?.limit), OP, http);\n // One pass: the live entity carries postedDate (W-D3) even though the\n // vendored TimeEntryModel omits it — count presence, never invent it.\n let postedCount = 0;\n for (const item of items) {\n const postedDate = (item as unknown as Record<string, unknown>).postedDate;\n if (typeof postedDate === 'string' ? postedDate.trim() !== '' : postedDate !== null && postedDate !== undefined) {\n postedCount += 1;\n }\n }\n return {\n items,\n postedCount,\n unpostedCount: items.length - postedCount,\n window: { from: iso(fromMs), to: iso(windowToMs) },\n };\n}\n\n// =============================================================================\n// createForResource (S9b, run mcp-fix-20261003) — the allocation-code-aware\n// \"smart\" time entry create. The design principle (user directive): bake the\n// API-dependency smarts into the node; prefer EXISTING tenant objects (the\n// API user can never create billing/allocation codes — userAccessForCreate\n// \"None\"); fail with a clear TYPED error naming what is missing; the raw\n// low-level create (time_entries.create) stays unchanged underneath.\n//\n// The vendor gates time_entries.create with live 500s (S7c + S9a, all\n// evidence in .run/mcp-fix-20261003/reports/te-smarts-logic.md):\n// gate 1 — exactly one linkage: ticketID | taskID | InternallAllocationCodeID\n// (the vendor typo spelling is the accepted POST key);\n// gate 2 — task/ticket linkage additionally requires roleID;\n// gate 3 — the roleID value is validated AS AN ALLOCATION CODE (must be an\n// active GENERAL one). H2 (primary): roleID = the CODE id; on a\n// gate-3 rejection the H1 demotion ladder applies (the task's\n// assignedResourceRoleID → the resource's active resource_roles\n// rows) — ≤ 4 create attempts total, the vendor 500 is the oracle.\n//\n// Resolution algorithm (spec §4):\n// 0. resources.get(resourceID) — active check (RESOURCE_INVALID on miss/inactive);\n// 1. linkage: the caller pin wins (internallAllocationCodeID → internal,\n// ticketID → ticket, taskID → task); no pin → INTERNAL (the cleanest:\n// no ticket/task existence or assignment constraint; the tenant has\n// 0 tickets);\n// 2. code: pinned → billing_codes.get + verify (active / right useType /\n// applicable — typed failures, never a silent substitute); unpinned →\n// billing_codes query ALWAYS with the family + active filter (the zone's\n// UNFILTERED billing_codes count/query surface is blind — a node rule),\n// filter department null-or-∈ D(R) (D(R) = the departmentIDs of the\n// resource's ACTIVE resource_roles rows), rank billingCodeType asc\n// (0=Normal first) then id asc — deterministic;\n// 3. assemble the vendor-valid body (EXACT vendor key spelling; the SDK\n// TimeEntryCreate types the model name, so the typo key is cast at the\n// boundary); read-only fields (hoursToBill, timeEntryType) are never\n// sent, even when the caller passes them;\n// 4. dispatch through the raw create (createGlobal) — on a 500\n// field-validation, ≤ 3 discovery-loop merges of the vendor-named\n// missing field with the safe time-window defaults (never re-sending\n// read-only fields);\n// 5. fallbacks: TASK with zero applicable general codes → INTERNAL (the\n// sanctioned \"fall back to another valid linkage\"); else throw\n// NO_APPLICABLE_ALLOCATION_CODE carrying the filters tried + the\n// department sets (a tenant-admin blocker — the node must NOT create\n// codes).\n// =============================================================================\n\n\n/** useType picklist (BillingCode.family): 1 = General Allocation Code. */\nconst USE_TYPE_GENERAL = 1;\n/** useType picklist: 3 = Internal Allocation Code (the InternallAllocationCodeID target). */\nconst USE_TYPE_INTERNAL = 3;\n/** The accepted POST key for the internal linkage. S9b live oracle (run mcp-fix-20261003):\n * the vendor's gate-1 error text spells the field `InternallAllocationCodeID` (the\n * validation-layer name), but the create DESERIALIZER accepts the model property\n * name `internalBillingCodeID` — a create with the typo key + a valid active\n * internal code id was rejected with the gate-1 \"requires one of the following\n * IDs\" text; the model name is the key that posts. */\nconst BODY_INTERNAL_CODE_KEY = 'internalBillingCodeID';\n/** The roleID-rejection texts that trigger the H1 demotion ladder (both live-observed):\n * - the gate-3 code text (S7c seq 57 — a Role value that is not an allocation code);\n * - the Role-reference text (S9b live — a code value that is not a Role). The vendor\n * double-validates roleID (active general allocation code AND a Role reference); a\n * rejection in EITHER style means the current candidate failed — demote the ladder. */\nconst ROLE_REJECTION_PATTERN = /not an active general allocation code|role does not exist or is invalid/i;\n/** TOTAL record cap for the resolver's bounded billing_codes walk (the family sizes are small — 5 active general / 22 active internal observed; the unfiltered surface is blind anyway, so the filter is mandatory regardless). */\nconst BILLING_CODE_CAP = 200;\n/** The vendor page cap (MaxRecords). */\nconst PAGE_SIZE = 500;\n/** Cursor-walk guard (mirrors the base.ts 1000-page guard, scaled to a bounded resolver read). */\nconst PAGE_GUARD = 100;\n/** Hard cap on create attempts (role ladder + discovery merges combined — spec §4.1 \"≤ 4 attempts\"). */\nconst MAX_CREATE_ATTEMPTS = 4;\n/** Max discovery-loop field merges (spec §4.1 step 5). */\nconst MAX_DISCOVERY_MERGES = 3;\n/** Read-only vendor-computed / vendor-managed TimeEntry fields — NEVER sent, even when the caller passes them. */\nconst READ_ONLY_TIME_ENTRY_FIELDS: ReadonlySet<string> = new Set([\n 'id',\n 'itemId',\n 'hoursToBill',\n 'timeEntryType',\n 'createDateTime',\n 'lastModifiedDateTime',\n 'lastModifiedUserID',\n 'creatorUserID',\n 'impersonatorCreatorResourceID',\n 'impersonatorUpdaterResourceID',\n 'soapParentPropertyId',\n 'billingApprovalDateTime',\n 'billingApprovalLevelMostRecent',\n 'billingApprovalResourceID',\n]);\n/** Resolver-owned linkage fields — the caller can pin them (typed params) but the passthrough can never override them. */\nconst LINKAGE_OWNED_FIELDS: ReadonlySet<string> = new Set([\n 'resourceID',\n 'InternallAllocationCodeID',\n 'internalBillingCodeID',\n 'billingCodeID',\n 'ticketID',\n 'taskID',\n 'roleID',\n]);\n/** The safe time-window fields the discovery loop may fill with defaults (spec §4.1 step 4 — the shape proven through S7c's gates). */\nconst TIME_WINDOW_FIELDS: ReadonlySet<string> = new Set(['dateWorked', 'startDateTime', 'endDateTime', 'hoursWorked']);\n\n/**\n * `createForResource` params. The typed linkage pins + the time window are\n * first-class; anything else passes through as a vendor TimeEntry field\n * (read-only + resolver-owned fields are stripped before the wire).\n */\nexport interface TimeEntriesCreateForResourceParams {\n /**\n * Pin the INTERNAL linkage: an EXISTING active internal allocation code\n * (useType 3). Verified by get (active / family / applicable) — typed\n * failures, never a silent substitute, and never a create.\n */\n internallAllocationCodeID?: number;\n /** Pin the TICKET linkage (vendor gate: roleID is also required — validated as an allocation code). */\n ticketID?: number;\n /** Pin the TASK linkage (vendor gate: roleID is also required — validated as an allocation code). */\n taskID?: number;\n /**\n * TASK/TICKET linkage: pin the roleID value. The vendor validates it as an\n * ALLOCATION CODE (gate 3) — it must be an active general code applicable\n * to the resource. Omit and the resolver picks one.\n */\n roleID?: number;\n /** Date worked, UTC `YYYY-MM-DD` (default: today). */\n dateWorked?: string;\n /** Window start, UTC ISO (default: today `T09:00:00.000Z`). */\n startDateTime?: string;\n /** Window end, UTC ISO (default: today `T18:00:00.000Z`). */\n endDateTime?: string;\n /** Hours worked (default: 8). */\n hoursWorked?: number;\n /** Clock for the window defaults (tests pin it for determinism; stripped before the wire — never sent). */\n now?: Date;\n /**\n * Any other vendor TimeEntry field (summaryNotes, internalNotes,\n * isNonBillable, offsetHours, showOnInvoice, …). Read-only and\n * resolver-owned fields are stripped and never sent.\n */\n [field: string]: unknown;\n}\n\n/** The allocation code the entry bills against (the resolver's pick or the caller pin). */\nexport interface TimeEntriesAllocationCodeInfo {\n id: number;\n name: string | null;\n department: number | null;\n billingCodeType: number | null;\n}\n\n/** Normalised `createForResource` result (the applied path). */\nexport interface TimeEntriesCreateForResourceResult {\n /** The created TimeEntry id (the vendor OperationResultModel itemId). */\n id: number;\n /** The linkage actually sent: 'internal' | 'task' | 'ticket'. */\n linkage: 'internal' | 'task' | 'ticket';\n /** The allocation code the entry bills against. */\n allocationCode: TimeEntriesAllocationCodeInfo;\n /** TASK/TICKET only: the roleID value actually sent (the H2 code id, or the demoted H1 role id). */\n roleID?: number;\n /** TASK/TICKET only: the 1-based role-ladder position of the successful attempt. */\n roleAttempts?: number;\n /** Discovery-loop field merges applied before success (0 = first-try create). */\n discoveryMerges: number;\n}\n\n// ---------------------------------------------------------------------------\n// Typed failure classes (spec §4.1 — clear, machine-readable, name the gap)\n// ---------------------------------------------------------------------------\n\n/** Gate 0: the resource is missing or not active — no time entry can attach to it. */\nexport class ResourceInvalidError extends AutotaskError {\n constructor(\n message: string,\n options: { code?: string; category?: AutotaskError['category'] } & { resourceIds?: (number | string)[]; operation?: string; suggestedAction?: string } = {},\n ) {\n super(message, { code: 'RESOURCE_INVALID', category: 'validation', ...options });\n this.name = 'ResourceInvalidError';\n }\n}\n\n/** The four pinned-code verification failures (one machine code each). */\nexport type AllocationCodeFailure = 'NOT_FOUND' | 'INACTIVE' | 'WRONG_TYPE' | 'NOT_APPLICABLE';\n\nexport class AllocationCodeError extends AutotaskError {\n /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */\n readonly kind: AllocationCodeFailure;\n\n constructor(kind: AllocationCodeFailure, message: string, options: { resourceIds?: number[]; operation?: string; suggestedAction?: string } = {}) {\n super(message, { code: `ALLOCATION_CODE_${kind}`, category: 'validation', ...options });\n this.name = 'AllocationCodeError';\n this.kind = kind;\n }\n}\n\n/**\n * No applicable allocation code for the resource in the tenant (every family\n * tried, every filter tried). A TENANT-ADMIN blocker: the API user cannot\n * create/activate allocation codes (userAccessForCreate \"None\",\n * canCreate=false) — the node reports the exact filters + department sets and\n * does NOT attempt creation.\n */\nexport class NoApplicableAllocationCodeError extends AutotaskError {\n /** The structured blocker details (filters tried + department sets). */\n readonly details: {\n resourceID: Identifier;\n families: Array<{ family: number; label: string; filters: Array<{ field: string; op: string; value: number | boolean }> }>;\n resourceDepartments: number[];\n };\n\n constructor(details: NoApplicableAllocationCodeError['details'], options: { operation?: string } = {}) {\n const families = details.families.map((f) => `${f.label} (useType eq ${f.family} + isActive eq true)`).join(', ');\n super(\n `No applicable allocation code for resource ${details.resourceID}: no active code passed the department applicability check for any family tried (${families}). The API user cannot create or activate allocation codes (userAccessForCreate \"None\") — this is a tenant-admin blocker.`,\n {\n code: 'NO_APPLICABLE_ALLOCATION_CODE',\n category: 'policy',\n resourceIds: [details.resourceID],\n suggestedAction:\n 'In the tenant administration, activate (or create, then activate) an allocation code that is tenant-wide (department null) or scoped to one of the resource departments ' +\n `[${details.resourceDepartments.join(', ')}] for a needed family, then retry.`,\n ...options,\n },\n );\n this.name = 'NoApplicableAllocationCodeError';\n this.details = details;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Read plumbing (the resolver's bounded walks — pure reads, dry-run-safe)\n// ---------------------------------------------------------------------------\n\n/**\n * ONE bounded server-filtered walk: page-1 POSTs `{ MaxRecords, filter }`;\n * follow-up pages POST the preserved filter to the re-based absolute cursor.\n * Stops at `totalCap` items, an exhausted cursor, or the page guard.\n */\nasync function boundedQuery(\n http: HttpClient,\n path: string,\n filter: Array<{ field: string; op: string; value: number | boolean | string }>,\n totalCap: number,\n operation: string,\n): Promise<Record<string, unknown>[]> {\n const items: Record<string, unknown>[] = [];\n const pageSize = Math.min(PAGE_SIZE, totalCap);\n let cursor: string | null = null;\n let pages = 0;\n for (;;) {\n if (pages >= PAGE_GUARD) {\n throw new AutotaskError(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {\n code: 'RESOLUTION_TRUNCATED',\n category: 'resolution',\n operation,\n suggestedAction: 'Narrow the resolver read (the tenant dataset is larger than the bounded walk allows).',\n });\n }\n const isFirst = pages === 0;\n const res: unknown = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: isFirst ? path : cursorToPath(http.baseUrl, cursor as string),\n body: { MaxRecords: pageSize, filter },\n operation,\n });\n const { items: pageItems, pageDetails } = unwrapItems<Record<string, unknown>>(res, operation);\n items.push(...pageItems);\n pages += 1;\n if (items.length >= totalCap) break;\n if (pageDetails.nextPageUrl === null || pageItems.length === 0) break;\n cursor = pageDetails.nextPageUrl;\n }\n return items.slice(0, totalCap);\n}\n\n/** `GET <path>` → the `item` (null on a 200 item-miss — the vendor's not-found signal). */\nasync function fetchItem(http: HttpClient, path: string, operation: string): Promise<Record<string, unknown> | null> {\n const res = await http.request<unknown>({ method: 'GET', path, operation });\n const body = res as { item?: Record<string, unknown> | null } | null;\n if (body === null || !('item' in body) || body.item === null || body.item === undefined) return null;\n return body.item;\n}\n\n/**\n * D(R) + the active resource_roles rows (one read): the department set a\n * code must fall in (null = tenant-wide always passes) AND the role-ladder\n * H1 fallback (the first active row's roleID).\n */\nasync function resourceRoleRows(\n http: HttpClient,\n resourceID: Identifier,\n operation: string,\n): Promise<{ departments: Set<number>; rows: Array<{ roleID?: number; departmentID?: number }> }> {\n const rows = await boundedQuery(\n http,\n '/V1.0/ResourceRoles/query',\n [\n { field: 'resourceID', op: 'eq', value: resourceID },\n { field: 'isActive', op: 'eq', value: true },\n ],\n PAGE_GUARD * PAGE_SIZE,\n operation,\n );\n const departments = new Set<number>();\n for (const row of rows) {\n if (typeof row.departmentID === 'number') departments.add(row.departmentID);\n }\n return { departments, rows: rows as Array<{ roleID?: number; departmentID?: number }> };\n}\n\n// ---------------------------------------------------------------------------\n// Code resolution (spec §4.1 steps 2–3)\n// ---------------------------------------------------------------------------\n\nfunction codeInfo(rec: Record<string, unknown>): TimeEntriesAllocationCodeInfo {\n return {\n id: Number(rec.id),\n name: typeof rec.name === 'string' ? rec.name : null,\n department: typeof rec.department === 'number' ? rec.department : null,\n billingCodeType: typeof rec.billingCodeType === 'number' ? rec.billingCodeType : null,\n };\n}\n\n/** The tie-break (documented, deterministic): billingCodeType asc (0=Normal first — absent ranks last), then id asc. */\nfunction rankCodes(codes: Record<string, unknown>[]): Record<string, unknown>[] {\n return [...codes].sort((a, b) => {\n const ta = typeof a.billingCodeType === 'number' ? a.billingCodeType : Number.MAX_SAFE_INTEGER;\n const tb = typeof b.billingCodeType === 'number' ? b.billingCodeType : Number.MAX_SAFE_INTEGER;\n if (ta !== tb) return ta - tb;\n return Number(a.id) - Number(b.id);\n });\n}\n\n/**\n * Resolve the code for one family (spec §4.1 step 2).\n * - pinned: billing_codes.get + verify (typed failures — never a silent\n * substitute; the caller chose this code);\n * - unpinned: the FILTERED walk (the unfiltered billing_codes surface is\n * blind in this zone — a node rule), department applicability, rank.\n */\nasync function resolveCode(\n http: HttpClient,\n family: number,\n familyLabel: string,\n pinnedId: number | undefined,\n departments: Set<number>,\n operation: string,\n): Promise<Record<string, unknown> | null> {\n const applicabilityFilters = [\n { field: 'useType', op: 'eq', value: family },\n { field: 'isActive', op: 'eq', value: true },\n ];\n if (pinnedId !== undefined) {\n const rec = await fetchItem(http, `/V1.0/BillingCodes/${pinnedId}`, operation);\n if (rec === null) {\n throw new AllocationCodeError(\n 'NOT_FOUND',\n `Pinned allocation code ${pinnedId} was not found (billing_codes.get returned item: null)`,\n { resourceIds: [pinnedId], operation, suggestedAction: `Resolve an existing ${familyLabel} allocation code id (billing_codes.query with a filter) and re-pin.` },\n );\n }\n if (rec.isActive !== true) {\n throw new AllocationCodeError(\n 'INACTIVE',\n `Pinned allocation code ${pinnedId} (${typeof rec.name === 'string' ? rec.name : 'unknown name'}) is not active (isActive !== true)`,\n { resourceIds: [pinnedId], operation, suggestedAction: 'Activate the code in the tenant administration or pin an active one.' },\n );\n }\n if (rec.useType !== family) {\n throw new AllocationCodeError(\n 'WRONG_TYPE',\n `Pinned allocation code ${pinnedId} is useType ${String(rec.useType ?? 'unknown')}, not the ${familyLabel} family (useType ${family})`,\n { resourceIds: [pinnedId], operation, suggestedAction: `Pin a code from the right family (billing_codes.query with useType eq ${family} + isActive eq true).` },\n );\n }\n const dept = typeof rec.department === 'number' ? rec.department : null;\n if (dept !== null && !departments.has(dept)) {\n throw new AllocationCodeError(\n 'NOT_APPLICABLE',\n `Pinned allocation code ${pinnedId} is scoped to department ${dept}, which is not among the resource's active role departments [${[...departments].sort((a, b) => a - b).join(', ')}] (and the code is not tenant-wide)`,\n { resourceIds: [pinnedId], operation, suggestedAction: 'Pin a tenant-wide (department null) code or one scoped to a resource department, or broaden the resource role assignments.' },\n );\n }\n return rec;\n }\n const candidates = await boundedQuery(http, '/V1.0/BillingCodes/query', applicabilityFilters, BILLING_CODE_CAP, operation);\n const applicable = candidates.filter((c) => (typeof c.department === 'number' ? departments.has(c.department) : true));\n return rankCodes(applicable)[0] ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// The smart create\n// ---------------------------------------------------------------------------\n\nconst OP = 'time_entries.createForResource';\n\n/** The params keys the resolver consumes itself (never vendor passthrough). */\nconst PARAM_KEYS: ReadonlySet<string> = new Set([\n 'internallAllocationCodeID',\n 'ticketID',\n 'taskID',\n 'roleID',\n 'dateWorked',\n 'startDateTime',\n 'endDateTime',\n 'hoursWorked',\n 'now',\n]);\n\nfunction windowDefaults(params: TimeEntriesCreateForResourceParams): Record<string, unknown> {\n const now = params.now instanceof Date ? params.now : new Date();\n const day = now.toISOString().slice(0, 10);\n return {\n dateWorked: day,\n startDateTime: `${day}T09:00:00.000Z`,\n endDateTime: `${day}T18:00:00.000Z`,\n hoursWorked: 8,\n };\n}\n\n/**\n * `createForResource` — the allocation-code-aware smart create (S9b).\n *\n * Runs the full resolution (reads) and posts the vendor-valid body through\n * the raw `time_entries.create` underneath. `dryRun: true` performs every\n * read, assembles the exact body, and returns the pinned DryRunResult\n * envelope (simulated: true) — the mutating POST is never issued.\n */\nexport async function createForResource(\n resource: TimeEntriesResource,\n resourceID: Identifier,\n params: TimeEntriesCreateForResourceParams,\n opts: MutationOpts = {},\n http: HttpClient,\n): Promise<TimeEntriesCreateForResourceResult | DryRunResult<Record<string, unknown>>> {\n const rid = parseIdentifier(resourceID, 'resourceID');\n // Issue #54: a numeric pin lands in a request path (BillingCodes/Tasks\n // reads), so it must be a safe non-negative integer (typed refusal, zero wire).\n const pin = (value: unknown, label: string): number | undefined =>\n typeof value === 'number' ? (parseIdentifier(value, label) as number) : undefined;\n const pins = {\n code: pin(params.internallAllocationCodeID, 'internallAllocationCodeID'),\n ticket: pin(params.ticketID, 'ticketID'),\n task: pin(params.taskID, 'taskID'),\n role: pin(params.roleID, 'roleID'),\n };\n const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== undefined).length;\n if (pinCount > 1) {\n throw new AutotaskConfigError(\n 'createForResource: exactly one linkage pin is honoured (internallAllocationCodeID | ticketID | taskID) — the vendor gate requires exactly one; pass one pin (or none for the default internal linkage)',\n { operation: OP },\n );\n }\n if (pins.role !== undefined && pins.code !== undefined) {\n throw new AutotaskConfigError(\n 'createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) — drop one',\n { operation: OP },\n );\n }\n if (params.hoursWorked !== undefined && (typeof params.hoursWorked !== 'number' || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {\n throw new AutotaskConfigError(\n `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,\n { operation: OP },\n );\n }\n\n // Gate 0 — the resource must exist and be active (1 read).\n const rec = await fetchItem(http, `/V1.0/Resources/${rid}`, OP);\n if (rec === null) {\n throw new ResourceInvalidError(`Resource ${rid} was not found — a time entry cannot attach to a missing resource`, {\n resourceIds: [rid],\n operation: OP,\n category: 'not_found',\n suggestedAction: 'Resolve the resource id (resources.get / resources.search) and retry.',\n });\n }\n if (rec.isActive !== true) {\n throw new ResourceInvalidError(`Resource ${rid} is not active (isActive !== true) — the vendor would reject a time entry for an inactive resource`, {\n resourceIds: [rid],\n operation: OP,\n suggestedAction: 'Activate the resource or pick an active one.',\n });\n }\n\n // Linkage pick: the caller pin wins, else the default (internal).\n const linkage: 'internal' | 'task' | 'ticket' = pins.code !== undefined ? 'internal' : pins.ticket !== undefined ? 'ticket' : pins.task !== undefined ? 'task' : 'internal';\n\n // D(R) + the role-ladder rows (1 read — reused for the H1 demotion).\n const roleRows = await resourceRoleRows(http, rid, OP);\n const departments = roleRows.departments;\n\n const familyOf = (l: 'internal' | 'task' | 'ticket') => (l === 'internal' ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL);\n const familyLabel = (f: number) => (f === USE_TYPE_GENERAL ? 'General Allocation Code' : 'Internal Allocation Code');\n\n // Step 2 — resolve the code (the TASK→INTERNAL fallback, spec §4.1).\n let usedLinkage: 'internal' | 'task' | 'ticket' = linkage;\n const pinnedForCode = pins.code !== undefined ? pins.code : pins.role;\n let code: Record<string, unknown> | null = null;\n const familiesTried: Array<{ family: number; label: string; filters: Array<{ field: string; op: string; value: number | boolean }> }> = [];\n // A pinned code's typed verification failure propagates (never a silent\n // substitute) — only the UNPINNED empty-set can fall back (task → internal).\n code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP);\n familiesTried.push({ family: familyOf(linkage), label: familyLabel(familyOf(linkage)), filters: [{ field: 'useType', op: 'eq', value: familyOf(linkage) }, { field: 'isActive', op: 'eq', value: true }] });\n if (code === null && linkage === 'task' && pins.role === undefined) {\n // The sanctioned fallback: the task's roleID gate cannot be satisfied by\n // any applicable general code → the entry becomes an internal one (the\n // cleanest linkage — no ticket/task constraint).\n usedLinkage = 'internal';\n code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), undefined, departments, OP);\n familiesTried.push({ family: USE_TYPE_INTERNAL, label: familyLabel(USE_TYPE_INTERNAL), filters: [{ field: 'useType', op: 'eq', value: USE_TYPE_INTERNAL }, { field: 'isActive', op: 'eq', value: true }] });\n }\n if (code === null) {\n throw new NoApplicableAllocationCodeError(\n {\n resourceID: rid,\n families: familiesTried,\n resourceDepartments: [...departments].sort((a, b) => a - b),\n },\n { operation: OP },\n );\n }\n const resolvedCode = codeInfo(code);\n\n // Step 3 — the vendor-valid body (the model-name wire key; the cast is the\n // boundary — the SDK types the field under the model name, which is exactly\n // the name the create deserializer accepts — S9b live oracle).\n const defaults = windowDefaults(params);\n const window: Record<string, unknown> = {};\n for (const field of ['dateWorked', 'startDateTime', 'endDateTime', 'hoursWorked'] as const) {\n const callerValue = params[field];\n // safe superset (spec §4.1 step 4): the caller's value wins, the default\n // fills every omission — the shape proven through S7c's gates.\n window[field] = callerValue !== undefined ? callerValue : defaults[field];\n }\n const passthrough: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined || PARAM_KEYS.has(key)) continue;\n if (READ_ONLY_TIME_ENTRY_FIELDS.has(key) || LINKAGE_OWNED_FIELDS.has(key)) continue; // never sent / resolver-owned\n passthrough[key] = value;\n }\n const body: Record<string, unknown> = { resourceID: rid, ...window, ...passthrough };\n if (usedLinkage === 'internal') {\n body[BODY_INTERNAL_CODE_KEY] = resolvedCode.id;\n } else {\n body[usedLinkage === 'task' ? 'taskID' : 'ticketID'] = usedLinkage === 'task' ? (pins.task as number) : (pins.ticket as number);\n body.roleID = resolvedCode.id; // H2 primary: roleID = the CODE id\n }\n\n // Dry-run (section 19.3): every read above ran; the mutating POST is NEVER\n // issued. The envelope data is the EXACT body the apply path would post\n // (the H2 roleID strategy — the H1 demotion ladder is an apply-time\n // vendor-oracle path and is documented in the warnings).\n if (opts.dryRun === true) {\n const warnings: string[] = [];\n if (usedLinkage !== 'internal') {\n warnings.push(\n `roleID strategy: the resolved ${familyLabel(familyOf(usedLinkage))} code id ${resolvedCode.id} (H2 primary); on a vendor gate-3 rejection (\"not an active general allocation code\") the H1 demotion ladder applies (task.assignedResourceRoleID → the resource's active resource_roles rows) — at most ${MAX_CREATE_ATTEMPTS} create attempts.`,\n );\n }\n if (usedLinkage === 'internal' && linkage === 'task') {\n warnings.push('the task had zero applicable general allocation codes — the linkage fell back to internal (the sanctioned fallback; no taskID/roleID in the body).');\n }\n return buildDryRunResult(\n {\n operation: OP,\n method: 'POST',\n path: '/V1.0/TimeEntries',\n ids: [rid],\n checks: [\n { name: 'input-validation', ok: true },\n { name: 'resource-active', ok: true },\n { name: 'allocation-code-resolved', ok: true },\n ],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings,\n data: body,\n },\n { redactPersonalData: http.redactPersonalData },\n );\n }\n\n // Step 4/5 — the create + the attempt budget (role ladder H1 + discovery\n // merges, ≤ MAX_CREATE_ATTEMPTS total; the vendor 500 is the oracle).\n const roleCandidates: number[] = [resolvedCode.id]; // H2\n let taskRoleFetched = false;\n const pushLadder = (value: unknown): void => {\n if (roleCandidates.length >= 3) return; // the budget (4 attempts) caps the ladder at 3 rungs\n if (typeof value === 'number' && Number.isInteger(value) && value > 0 && !roleCandidates.includes(value)) roleCandidates.push(value);\n };\n let merges = 0;\n let lastError: unknown = null;\n for (let attempt = 1; attempt <= MAX_CREATE_ATTEMPTS; attempt += 1) {\n if (usedLinkage !== 'internal') body.roleID = roleCandidates[Math.min(attempt, roleCandidates.length) - 1];\n try {\n // The apply path: dryRun was already checked above, so the raw create\n // returns the OperationResultModel normalised to { id } (never the\n // DryRunResult envelope).\n const created = (await resource.create(body as unknown as TimeEntryCreate, {})) as { id: number };\n return {\n id: created.id,\n linkage: usedLinkage,\n allocationCode: resolvedCode,\n ...(usedLinkage !== 'internal' ? { roleID: body.roleID as number, roleAttempts: Math.min(attempt, roleCandidates.length) } : {}),\n discoveryMerges: merges,\n };\n } catch (err) {\n lastError = err;\n // A vendor roleID rejection on the current candidate: demote the ladder\n // (task.assignedResourceRoleID → active resource_roles rows).\n const text = isAutotaskError(err) ? `${formatVendorDetail(err.vendorError) ?? ''} ${err.message}` : '';\n const gate3 = ROLE_REJECTION_PATTERN.test(text);\n if (usedLinkage !== 'internal' && gate3) {\n // Widen the H1 ladder lazily (the task read is one wire call, only\n // on a rejection): the task's assignedResourceRoleID first, then the\n // resource's active resource_roles rows (vendor order).\n if (!taskRoleFetched && usedLinkage === 'task' && pins.task !== undefined) {\n const task = await fetchItem(http, `/V1.0/Tasks/${pins.task}`, OP);\n taskRoleFetched = true;\n if (task !== null) pushLadder(task.assignedResourceRoleID);\n }\n for (const row of roleRows.rows) pushLadder(row.roleID);\n if (attempt < roleCandidates.length) continue; // a next rung exists\n }\n // Discovery loop: the vendor names a missing time-window field → merge\n // the safe default and retry (≤ MAX_DISCOVERY_MERGES; idempotent — a\n // merged field is never re-merged; read-only fields are never named\n // defaults and never sent).\n const merge = discoveryField(err, body, defaults);\n if (merge !== null && merges < MAX_DISCOVERY_MERGES) {\n body[merge.field] = merge.value;\n merges += 1;\n continue;\n }\n throw err;\n }\n }\n // Exhausted the attempt budget (gate-3 rejections on every ladder rung +\n // merges) — surface the last vendor error, annotated.\n if (isAutotaskError(lastError)) {\n lastError.suggestedAction =\n (lastError.suggestedAction ? `${lastError.suggestedAction} ` : '') +\n `The createForResource attempt budget (${MAX_CREATE_ATTEMPTS} attempts: the role ladder + ${MAX_DISCOVERY_MERGES} discovery merges) was exhausted — the vendor oracle rejected every candidate. Re-read the record/fields (time_entries.getFieldInfo, billing_codes.query with a filter) and retry with an explicit pin.`;\n }\n throw lastError;\n}\n\n/**\n * The discovery-loop merge (spec §4.1 step 5): the vendor's field-level error\n * names a missing time-window field → its safe default. Only fields the\n * resolver owns and the body lacks qualify (idempotent); anything else is\n * null (rethrow — the vendor may demand more, and we do not fabricate).\n */\nexport function discoveryField(\n err: unknown,\n body: Record<string, unknown>,\n defaults: Record<string, unknown>,\n): { field: string; value: unknown } | null {\n if (!isAutotaskError(err) || err.vendorError === undefined) return null;\n const entries = parseVendorErrors(err.vendorError);\n if (entries === undefined) return null;\n for (const entry of entries) {\n const field = entry.field;\n if (field === undefined || !TIME_WINDOW_FIELDS.has(field)) continue;\n if (body[field] !== undefined) continue; // idempotent: already merged\n if (defaults[field] === undefined) continue;\n return { field, value: defaults[field] };\n }\n return null;\n}\n","/**\n * TimeEntriesResource — TimeEntry resource (G5 batch B, plan key 'time_entries').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TimeEntry, TimeEntryCreate, TimeEntryUpdate, TimeEntrySummary } from '../types/time_entries.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as timeentriesSpecial from './special/time_entries.js';\nimport type { TimeEntriesCreateForResourceParams, TimeEntriesCreateForResourceResult, TimeEntriesWindowOptions, TimeEntriesStatusOptions, TimeEntriesPostedWindowOptions, TimeEntriesPostedWindowResult } from './special/time_entries.js';\n\n/** Query params for TimeEntriesResource (the G3 filter surface; no per-resource invention). */\nexport type TimeEntriesResourceQueryParams = QueryParams;\n\nexport class TimeEntriesResource extends BaseResource<TimeEntry, TimeEntryCreate, TimeEntryUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'time_entries',\n resourcePath: '/V1.0/TimeEntries',\n deletable: true,\n udfCapable: true,\n collectionUpdate: true, // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)\n }, pageSize);\n }\n\n /** Query TimeEntry records with the G3 filter surface (server-side JSON filter). */\n query(params?: TimeEntriesResourceQueryParams): AsyncIterable<TimeEntry> {\n return this.queryItems(params);\n }\n\n /** Get every TimeEntry record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TimeEntriesResourceQueryParams): Promise<TimeEntry[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TimeEntriesResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TimeEntry> {\n return this.getGlobal(id);\n }\n\n /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(data: TimeEntryCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TimeEntryCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data);\n return this.createGlobal(data, opts);\n }\n\n /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor\n * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a\n * partial body is merged into the CURRENT record first: one fresh GET (which also serves the\n * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the\n * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends\n * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).\n * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed\n * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that\n * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */\n async update(id: Identifier, data: TimeEntryUpdate, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<TimeEntryUpdate>> {\n if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);\n return this.updateGlobal(id, data, opts);\n }\n\n /** Delete a record (OperationResultModel → { id}). `dryRun: true` returns the pinned\n * envelope and never issues the delete. */\n async delete(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);\n await this.guardStaleBeforeMutation(id, opts, 'time_entries.delete');\n return this.deleteGlobal(id);\n }\n\n /** Resolve a TimeEntry from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TimeEntrySummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n createForResource(resourceID: Identifier, params: TimeEntriesCreateForResourceParams, opts: MutationOpts = {}): Promise<TimeEntriesCreateForResourceResult | DryRunResult<Record<string, unknown>>> {\n return timeentriesSpecial.createForResource(this, resourceID, params, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n customRange(from: string, to: string, opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.customRange(this, from, to, this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n getPosted(opts?: TimeEntriesStatusOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.postedDateStatusQuery(this, 'posted', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n getUnposted(opts?: TimeEntriesStatusOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.postedDateStatusQuery(this, 'unposted', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n last14(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'last14', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n last24h(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'last24h', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n last30(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'last30', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n last7(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'last7', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n last90(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'last90', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n lastFullFortnight(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'lastFullFortnight', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n lastFullMonth(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'lastFullMonth', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n lastFullQuarter(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'lastFullQuarter', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n lastFullWeek(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'lastFullWeek', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n postedWithin(from: string, to: string, opts?: TimeEntriesPostedWindowOptions): Promise<TimeEntriesPostedWindowResult> {\n return timeentriesSpecial.postedWithin(this, from, to, this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n today(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'today', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */\n yesterday(opts?: TimeEntriesWindowOptions): Promise<TimeEntry[]> {\n return timeentriesSpecial.windowQuery(this, 'yesterday', this.http, opts);\n }\n}\n","/**\n * TimeEntryAttachmentsResource — TimeEntryAttachment resource (G5 batch B, plan key 'time_entry_attachments').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n * Parent-scoped child of 'time_entries': CRUD under /V1.0/TimeEntries/{parentId}/Attachments —\n * the global query/count stay unscoped (narrow with the 'timeEntryID' filter).\n */\nimport { BaseResource, type CreateOpts, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TimeEntryAttachment, TimeEntryAttachmentCreate, TimeEntryAttachmentUpdate, TimeEntryAttachmentSummary } from '../types/time_entry_attachments.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\n\n/** Query params for TimeEntryAttachmentsResource (the G3 filter surface; no per-resource invention). */\nexport type TimeEntryAttachmentsResourceQueryParams = QueryParams;\n\nexport class TimeEntryAttachmentsResource extends BaseResource<TimeEntryAttachment, TimeEntryAttachmentCreate, TimeEntryAttachmentUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'time_entry_attachments',\n resourcePath: '/V1.0/TimeEntryAttachments',\n parentScopedPath: '/V1.0/TimeEntries/{parentId}/Attachments',\n parentField: 'timeEntryID',\n deletable: true,\n udfCapable: false,\n parentPath: '/V1.0/TimeEntries',\n attachmentGet: true,\n }, pageSize);\n }\n\n /** Query TimeEntryAttachment records (global; narrow with the timeEntryID filter). */\n query(params?: TimeEntryAttachmentsResourceQueryParams): AsyncIterable<TimeEntryAttachment> {\n return this.queryItems(params);\n }\n\n /** Get every TimeEntryAttachment record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TimeEntryAttachmentsResourceQueryParams): Promise<TimeEntryAttachment[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TimeEntryAttachmentsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by parent + id (/V1.0/TimeEntries/{parentId}/Attachments/{id} — vendor answers the model directly). */\n async get(parentId: Identifier, id: Identifier): Promise<TimeEntryAttachment> {\n return this.getScopedModel(parentId, id);\n }\n\n /** Create a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the\n * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the\n * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;\n * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */\n async create(parentId: Identifier, data: TimeEntryAttachmentCreate, opts: CreateOpts = {}): Promise<OperationResult | DryRunResult<TimeEntryAttachmentCreate>> {\n if (opts.dryRun === true) return this.runCreateDryRun(data, parentId);\n return this.createScopedRaw(parentId, data, opts);\n }\n\n /** Delete an attachment — the vendor returns the deleted attachment MODEL (not OperationResultModel).\n * `dryRun: true` returns the pinned envelope and never issues the delete. */\n async delete(parentId: Identifier, id: Identifier, opts: MutationOpts = {}): Promise<TimeEntryAttachment | DryRunResult<Record<string, unknown>>> {\n if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);\n await this.guardStaleBeforeMutation(id, opts, 'time_entry_attachments.delete', parentId);\n return this.deleteScopedModel(parentId, id);\n }\n\n /** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */\n async download(parentId: Identifier, id: Identifier): Promise<Buffer> {\n return this.downloadScoped(parentId, id);\n }\n\n /** Resolve a TimeEntryAttachment from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TimeEntryAttachmentSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n}\n","/**\n * Time-off request special ops — the pinned vendor method asymmetry (G5\n * batch B).\n *\n * Pinned from the vendored swagger (api-docs.json) + n8n node parity\n * (nodes/Autotask/resources/timeOffRequests/execute.ts):\n * - approve: `GET /V1.0/TimeOffRequests/{id}/Approve` — no body.\n * - reject: `POST /V1.0/TimeOffRequests/{id}/Reject` — body\n * TimeOffRequestRejectModel { timeOffRequestID, reason } (reason required).\n * Both answer OperationResultModel → { id }.\n */\nimport { AutotaskConfigError } from '../../errors.js';\nimport { unwrapOperation } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\nimport { buildDryRunResult, type MutationOpts } from '../base.js';\nimport type { TimeOffRequestsResource } from '../time_off_requests.js';\nimport type { DryRunResult, Identifier, OperationResult } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\n\n/** `GET /V1.0/TimeOffRequests/{id}/Approve` → { id } (the vendor asymmetry: approve is GET). */\nexport async function approve(\n _resource: TimeOffRequestsResource,\n id: Identifier,\n opts: MutationOpts = {},\n http: HttpClient,\n): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericId = parseIdentifier(id, 'id');\n if (opts.dryRun === true) {\n return buildDryRunResult({\n operation: 'time_off_requests.approve',\n method: 'GET',\n path: `/V1.0/TimeOffRequests/${numericId}/Approve`,\n ids: [numericId],\n checks: [{ name: 'input-validation', ok: true }],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n data: { timeOffRequestID: numericId },\n }, { redactPersonalData: http.redactPersonalData });\n }\n const res = await http.request<unknown>({\n method: 'GET',\n path: `/V1.0/TimeOffRequests/${numericId}/Approve`,\n operation: 'time_off_requests.approve',\n });\n return unwrapOperation(res);\n}\n\n/** `POST /V1.0/TimeOffRequests/{id}/Reject` with { timeOffRequestID, reason } → { id } (reject is POST). */\nexport async function reject(\n _resource: TimeOffRequestsResource,\n id: Identifier,\n reason: string,\n opts: MutationOpts = {},\n http: HttpClient,\n): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n // parseIdentifier BEFORE the wire (QA F1): an unsafe JS number is already\n // corrupted (the caller lost a digit) — refuse it typed, never send.\n const numericId = parseIdentifier(id, 'id');\n const text = reason.trim();\n if (text === '') {\n throw new AutotaskConfigError('reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)');\n }\n if (opts.dryRun === true) {\n return buildDryRunResult({\n operation: 'time_off_requests.reject',\n method: 'POST',\n path: `/V1.0/TimeOffRequests/${numericId}/Reject`,\n ids: [numericId],\n checks: [{ name: 'input-validation', ok: true }],\n impact: { affected: 1, scope: 'single-record', reversible: true },\n warnings: ['the request returns to draft after rejection (vendor behaviour)'],\n data: { timeOffRequestID: numericId, reason: text },\n }, { redactPersonalData: http.redactPersonalData });\n }\n const res = await http.request<unknown>({\n method: 'POST',\n path: `/V1.0/TimeOffRequests/${numericId}/Reject`,\n body: { timeOffRequestID: numericId, reason: text },\n operation: 'time_off_requests.reject',\n });\n return unwrapOperation(res);\n}\n","/**\n * TimeOffRequestsResource — TimeOffRequest resource (G5 batch B, plan key 'time_off_requests').\n * GENERATED by scripts/generate-batch.mjs from capabilities.plan.json + api-docs.json.\n * Do not hand-edit; re-run the generator (the plan is the source of truth).\n */\nimport { BaseResource, type MutationOpts } from './base.js';\nimport type { HttpClient } from '../http.js';\nimport type { TimeOffRequest, TimeOffRequestCreate, TimeOffRequestUpdate, TimeOffRequestSummary } from '../types/time_off_requests.js';\nimport type { DryRunResult, Identifier, OperationResult, QueryParams } from '../types/common.js';\nimport * as timeoffrequestsSpecial from './special/time_off_requests.js';\n\n/** Query params for TimeOffRequestsResource (the G3 filter surface; no per-resource invention). */\nexport type TimeOffRequestsResourceQueryParams = QueryParams;\n\nexport class TimeOffRequestsResource extends BaseResource<TimeOffRequest, TimeOffRequestCreate, TimeOffRequestUpdate> {\n constructor(http: HttpClient, pageSize: number) {\n super(http, {\n key: 'time_off_requests',\n resourcePath: '/V1.0/TimeOffRequests',\n deletable: false,\n udfCapable: false,\n }, pageSize);\n }\n\n /** Query TimeOffRequest records with the G3 filter surface (server-side JSON filter). */\n query(params?: TimeOffRequestsResourceQueryParams): AsyncIterable<TimeOffRequest> {\n return this.queryItems(params);\n }\n\n /** Get every TimeOffRequest record (the MCP-preferred read; 1000-page guarded). */\n async queryAll(params?: TimeOffRequestsResourceQueryParams): Promise<TimeOffRequest[]> {\n return this.queryAllItems(params);\n }\n\n /** Count matching records (queryCount envelope unwrapped to a plain number). */\n async count(params?: TimeOffRequestsResourceQueryParams): Promise<number> {\n return this.countGlobal(params);\n }\n\n /** Get one record by id (item envelope; item: null → NotFoundError). */\n async get(id: Identifier): Promise<TimeOffRequest> {\n return this.getGlobal(id);\n }\n\n /** Resolve a TimeOffRequest from a numeric id (or, where the vendor indexes a primary text field,\n * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;\n * a bare value rejects with a config error (ids only);\n * non-match returns null; ambiguity throws RESOLUTION_AMBIGUOUS (candidate ids) and a\n * cap-tripped bounded client scan throws RESOLUTION_TRUNCATED (never a silent null).\n * The compact shape is the structural alias of the full record; `expand: true` is the\n * type-level escape hatch. */\n async resolve(identifier: number | string, opts: { expand?: boolean } = {}): Promise<TimeOffRequestSummary | null> {\n void opts; // Summary is a structural alias of the full record (both return the vendor record)\n return this.resolveBase(identifier);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_off_requests.ts). */\n approve(id: Identifier, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n return timeoffrequestsSpecial.approve(this, id, opts, this.http);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/time_off_requests.ts). */\n reject(id: Identifier, reason: string, opts: MutationOpts = {}): Promise<OperationResult | DryRunResult<Record<string, unknown>>> {\n return timeoffrequestsSpecial.reject(this, id, reason, opts, this.http);\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { ApiVersionResultModel } from '../types/version_information.js';\n\n/**\n * VersionInformationResource — integration endpoint (G5 batch B, plan key 'version_information').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class VersionInformationResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `/VersionInformation` → `ApiVersionResultModel` as-is. */\n get(): Promise<ApiVersionResultModel> {\n return this.http.request<ApiVersionResultModel>({\n method: 'GET',\n path: '/VersionInformation',\n operation: 'version_information.get',\n });\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { AutotaskVersionResultModel } from '../types/version.js';\n\n/**\n * VersionResource — integration endpoint (G5 batch B, plan key 'version').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class VersionResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /** `GET /V1.0/Version` → `AutotaskVersionResultModel` as-is. */\n get(): Promise<AutotaskVersionResultModel> {\n return this.http.request<AutotaskVersionResultModel>({\n method: 'GET',\n path: '/V1.0/Version',\n operation: 'version.get',\n });\n }\n}\n","import type { HttpClient } from '../http.js';\nimport type { ZoneInformationResultModel } from '../types/zone_information.js';\n\n/**\n * ZoneInformationResource — integration endpoint (G5 batch B, plan key 'zone_information').\n *\n * Thin GET returning the raw vendor model as-is: no entity model, no\n * pagination, no BaseResource (the 7 integration endpoints are plan\n * kind=integration rows — the generator wires this class into the client and\n * seeds the plan test title; the file itself is hand-written).\n */\nexport class ZoneInformationResource {\n private readonly http: HttpClient;\n\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * `/V1.0/ZoneInformation?user=<user>` → `ZoneInformationResultModel` as-is.\n *\n * The vendor REQUIRES the `user` query param (swagger: required=true).\n * Omitted/blank arg -> the client's configured UserName (the authenticated\n * user — the endpoint's documented purpose: find the zone of the account\n * the client authenticates as). Live-verified 2026-10-01 against the ww29\n * tenant: the param-less call is a 404 (\"No action was found on the\n * controller 'ZoneInformationApiIntegration'\"); with the param, 200 +\n * `{ zoneName, url, webUrl, ci }`.\n */\n get(user?: string): Promise<ZoneInformationResultModel> {\n const resolved = (user ?? '').trim() || this.http.userName;\n return this.http.request<ZoneInformationResultModel>({\n method: 'GET',\n path: '/V1.0/ZoneInformation',\n query: { user: resolved },\n operation: 'zone_information.get',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,IAAM,eAAe;AAAA,EAC1B,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe;AACjB;AAeO,SAAS,iBAAiB,KA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AAC;AAAA,EACH;AACF;;;ACfO,IAAM,0BAAN,MAA8B;AAAA,EAClB;AAAA,EAEjB,YAAY,MAAkB;AAC5B,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,IAAI,MAAoD;AACtD,UAAM,YAAY,QAAQ,IAAI,KAAK,KAAK,KAAK,KAAK;AAClD,WAAO,KAAK,KAAK,QAAoC;AAAA,MACnD,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO,EAAE,MAAM,SAAS;AAAA,MACxB,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AACF;","names":["reject","err","body","PROFILE_PART_LIMIT","profilePartLimit","fetchRecord","getByResource","getByResource","DEFAULT_LIMIT","MAX_LIMIT","clampLimit","OP","MAX_DISCOVERY_MERGES","fetchItem","passthrough"]}