node-autotask 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MCP_TOOL_CATALOG.json +3 -3
- package/MCP_TOOL_MANIFEST.md +5 -5
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +1354 -1263
- package/dist/capabilities.cjs +2 -3
- package/dist/capabilities.js +1 -2
- package/dist/{chunk-53MC2QRQ.cjs → chunk-25ZUKHS4.cjs} +135 -136
- package/dist/{chunk-BZPFDRAE.js → chunk-7L23FDQW.js} +1353 -1263
- package/dist/{chunk-UYJ5V262.js → chunk-CJONZQ7E.js} +32 -182
- package/dist/chunk-DMMMWO6A.js +0 -0
- package/dist/chunk-FLB2X6O5.cjs +1 -0
- package/dist/chunk-IDPB4N2Q.cjs +1 -0
- package/dist/{chunk-UDWV4VVD.js → chunk-LNRN45XS.js} +214 -20
- package/dist/{chunk-OYHKIYVR.cjs → chunk-QAX222R6.cjs} +422 -572
- package/dist/{chunk-QJU2N32V.js → chunk-SXHPUQMB.js} +2 -3
- package/dist/{chunk-LTKMTXUR.cjs → chunk-T5FLSJOD.cjs} +1353 -1263
- package/dist/chunk-UPQIUWOS.js +0 -0
- package/dist/{chunk-RWLPTU67.cjs → chunk-YKEX4SK7.cjs} +235 -41
- package/dist/{index-ZknpNhtc.d.ts → index-B_xToSpq.d.ts} +8 -8
- package/dist/{index-CfU1JDgS.d.cts → index-Dv_GSZaN.d.cts} +8 -8
- package/dist/{index-O2zzIMcQ.d.cts → index-cQ6CRexR.d.cts} +3 -1
- package/dist/{index-O2zzIMcQ.d.ts → index-cQ6CRexR.d.ts} +3 -1
- package/dist/index.cjs +21 -22
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -7
- package/dist/operations/index.cjs +284 -131
- package/dist/operations/index.d.cts +28 -5
- package/dist/operations/index.d.ts +28 -5
- package/dist/operations/index.js +160 -7
- package/dist/pool.cjs +36 -12
- package/dist/pool.d.cts +2 -2
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +31 -7
- package/dist/resources/index.cjs +5 -6
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +4 -5
- package/dist/types/index.cjs +1 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -2
- package/dist/untrusted.cjs +0 -1
- package/dist/untrusted.js +0 -1
- package/docs/API.md +12 -6
- package/package.json +1 -1
- package/dist/capabilities.cjs.map +0 -1
- package/dist/capabilities.js.map +0 -1
- package/dist/chunk-53MC2QRQ.cjs.map +0 -1
- package/dist/chunk-BZPFDRAE.js.map +0 -1
- package/dist/chunk-CXM35TEC.cjs +0 -1
- package/dist/chunk-CXM35TEC.cjs.map +0 -1
- package/dist/chunk-GIVD2CQ3.js +0 -1
- package/dist/chunk-GIVD2CQ3.js.map +0 -1
- package/dist/chunk-LTKMTXUR.cjs.map +0 -1
- package/dist/chunk-MHBMSBTA.js +0 -1
- package/dist/chunk-MHBMSBTA.js.map +0 -1
- package/dist/chunk-NZUFSSIZ.cjs +0 -1
- package/dist/chunk-NZUFSSIZ.cjs.map +0 -1
- package/dist/chunk-OYHKIYVR.cjs.map +0 -1
- package/dist/chunk-QJU2N32V.js.map +0 -1
- package/dist/chunk-RWLPTU67.cjs.map +0 -1
- package/dist/chunk-UDWV4VVD.js.map +0 -1
- package/dist/chunk-UYJ5V262.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/operations/index.cjs.map +0 -1
- package/dist/operations/index.js.map +0 -1
- package/dist/pool.cjs.map +0 -1
- package/dist/pool.js.map +0 -1
- package/dist/resources/index.cjs.map +0 -1
- package/dist/resources/index.js.map +0 -1
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/untrusted.cjs.map +0 -1
- package/dist/untrusted.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/appointments.ts","../src/resources/authenticate.ts","../src/resources/billing_codes.ts","../src/resources/special/dateWindow.ts","../src/resources/special/billing_items.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/operations/compositeNames.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 * 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 * Shared timezone-anchored date-window machinery (issue #66, sub-ask 3).\n *\n * The time-entry window family pinned its bounds to UTC; the n8n node\n * computes them in the configured timezone. This module makes the zone EXPLICIT and\n * OPTIONAL: every window op takes `opts.tz` (an IANA zone, e.g.\n * 'Australia/Sydney'). Omitted `tz` is the EXACT current UTC behaviour,\n * bit-for-bit (the regression pin); with a zone, the window's calendar\n * day/period is computed in that zone's LOCAL calendar and converted to UTC\n * for the wire (the vendor filter values are second-precision UTC ISO\n * strings either way — the API is UTC).\n *\n * Pinned semantics (unit-pinned in test/resources/date-window.test.ts):\n * - `last24h` is ROLLING (`now - 86400000 → now`): TZ-INVARIANT by\n * construction — a zone never changes it.\n * - DST transitions: local day boundaries are inverted to UTC instants\n * (local midnight → UTC via the wall-clock offset, ≤ 2 correction passes\n * — the offset is piecewise-constant); a local day that gains/loses an\n * hour still has both boundaries pinned to its true midnights (the bounds\n * are UTC instants, never clock-hour arithmetic).\n * - `validateZone` fails closed pre-request (zero wire): a zone that\n * `Intl.DateTimeFormat` rejects is a typed `CONFIG_ERROR` (official Node\n * builds ship full ICU — every IANA zone resolves).\n * - `dateWindowQuery` is the shared bounded server-filtered read: ONE\n * `POST {path}/query` with `{ MaxRecords: limit, filter: [gte, lte] }` on\n * the pinned field — `items[]` result (the plain window-family shape, no\n * counts).\n */\nimport { AutotaskConfigError } from '../../errors.js';\nimport { unwrapItems } from '../../http.js';\nimport type { HttpClient } from '../../http.js';\n\n/** The 11 window kinds (the time-entry family — `TimeEntriesWindowKind` is\n * this type under its historical name). */\nexport type DateWindowKind =\n | 'today'\n | 'yesterday'\n | 'last24h'\n | 'last7'\n | 'last14'\n | 'last30'\n | 'last90'\n | 'lastFullWeek'\n | 'lastFullFortnight'\n | 'lastFullMonth'\n | 'lastFullQuarter';\n\n/** The shared window opts shape (`TimeEntriesWindowOptions` is an alias of\n * this type — `tz` is the issue #66 addition). */\nexport interface DateWindowOptions {\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 /** IANA timezone (e.g. 'Australia/Sydney') — the window's calendar day/period is computed in that zone's local calendar and converted to UTC for the wire; omitted = UTC (the current behaviour, bit-for-bit). `last24h` is rolling and TZ-invariant (a zone never changes it). */\n tz?: string;\n}\n\nconst DAY_MS = 86_400_000;\nconst DEFAULT_LIMIT = 25;\nconst MAX_LIMIT = 500;\n\n/** Clamp the window limit to the plan bound (1..500, default 25). */\nexport function clampWindowLimit(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\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\ninterface WallParts {\n y: number;\n m: number; // 1-based\n d: number;\n h: number;\n mi: number;\n s: number;\n weekday: number; // 0 = Sunday … 6 = Saturday (the getUTCDay convention)\n}\n\nconst WEEKDAYS: Record<string, number> = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };\n\n/** The local (wall-clock) parts of an instant in `tz` — full-ICU Node\n * builds resolve every IANA zone via `Intl.DateTimeFormat`. */\nfunction wallParts(tz: string, ms: number): WallParts {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone: tz,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n weekday: 'short',\n }).formatToParts(new Date(ms));\n const w: Partial<WallParts> = {};\n let weekday = -1;\n for (const p of parts) {\n switch (p.type) {\n case 'year':\n w.y = Number(p.value);\n break;\n case 'month':\n w.m = Number(p.value);\n break;\n case 'day':\n w.d = Number(p.value);\n break;\n case 'hour':\n w.h = Number(p.value) % 24; // some ICU builds emit '24' at midnight\n break;\n case 'minute':\n w.mi = Number(p.value);\n break;\n case 'second':\n w.s = Number(p.value);\n break;\n case 'weekday':\n weekday = WEEKDAYS[p.value] ?? -1;\n break;\n }\n }\n if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === undefined || Number.isNaN(v))) {\n throw new AutotaskConfigError(`dateWindow: could not read the wall-clock parts for timezone \"${tz}\" (the Intl format returned an incomplete or unmapped part)`);\n }\n return { y: w.y!, m: w.m!, d: w.d!, h: w.h!, mi: w.mi!, s: w.s!, weekday };\n}\n\n/** The zone offset at an instant (wall-clock minus UTC, ms; may be\n * negative) — the standard wall-clock-diff via the same Intl format. */\nexport function tzOffsetMs(tz: string, ms: number): number {\n const p = wallParts(tz, ms);\n return Date.UTC(p.y, p.m - 1, p.d, p.h, p.mi, p.s) - ms;\n}\n\n/** The UTC instant of LOCAL MIDNIGHT of (y, m 1-based, d) in `tz`.\n * Inversion: `candidate = Date.UTC(y, m, d)` (UTC midnight of the same\n * numeric date); `start = candidate - offset(tz, candidate)`; a second\n * correction pass when the offset at `start` differs (the DST-transition\n * case — the offset is piecewise-constant, so ≤ 2 passes always converge).\n * `tz` omitted = the plain UTC midnight (`Date.UTC` — bit-for-bit the\n * current behaviour). */\nexport function localDayStartMs(y: number, m: number, d: number, tz?: string): number {\n if (tz === undefined) return Date.UTC(y, m - 1, d);\n const candidate = Date.UTC(y, m - 1, d);\n const offset = tzOffsetMs(tz, candidate);\n let start = candidate - offset;\n if (tzOffsetMs(tz, start) !== offset) {\n start = candidate - tzOffsetMs(tz, start);\n }\n // A DST gap AT midnight (local midnight does not exist): the inversion lands\n // on the previous local day — step to the first valid instant of day `d`.\n const p = wallParts(tz, start);\n if (p.d !== d) start += 86_400_000 - ((p.h * 60 + p.mi) * 60 + p.s) * 1000;\n return start;\n}\n\n/** The UTC instant of the END of local day (y, m 1-based, d): the NEXT\n * local midnight minus 1 ms (DST-safe — a 23-hour spring-forward day ends\n * 23 hours after its start, not 24). `tz` omitted = start + DAY_MS - 1\n * (bit-for-bit the current UTC-day convention). */\nexport function localDayEndMs(y: number, m: number, d: number, tz?: string): number {\n if (tz === undefined) return Date.UTC(y, m - 1, d) + DAY_MS - 1;\n const next = new Date(Date.UTC(y, m - 1, d + 1));\n return localDayStartMs(next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate(), tz) - 1;\n}\n\n/** Validate an IANA zone (pre-request, zero wire, fail-closed): a non-empty\n * string that `Intl.DateTimeFormat` accepts — otherwise a typed\n * `CONFIG_ERROR` (the house fail-closed config-error class). */\nexport function validateZone(tz: unknown, opName = 'dateWindow'): string {\n if (typeof tz !== 'string' || tz.length === 0) {\n throw new AutotaskConfigError(\n `${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' — omitted tz = UTC)`,\n { operation: opName },\n );\n }\n try {\n new Intl.DateTimeFormat('en-US', { timeZone: tz });\n } catch {\n throw new AutotaskConfigError(\n `${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' — omitted tz = UTC)`,\n { operation: opName },\n );\n }\n return tz;\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\n/** The EXACT current UTC window math (moved verbatim from the time-entry\n * family — the regression pin for the omitted-`tz` path). */\nfunction utcDateWindowBounds(kind: DateWindowKind, 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\n/** The window bounds (inclusive, second-precision UTC ISO) for `kind`\n * anchored at `now`: `tz` omitted = the EXACT current UTC math (the\n * regression pin); `tz` given (validated pre-request, zero wire) = the\n * calendar math in the zone's LOCAL calendar — local day boundaries\n * inverted to UTC instants (DST-safe). `last24h` is rolling and\n * TZ-invariant either way. */\nexport function dateWindowBounds(kind: DateWindowKind, now: Date, tz?: string): { from: string; to: string } {\n if (tz === undefined) return utcDateWindowBounds(kind, now);\n const zone = validateZone(tz);\n const t = now.getTime();\n if (kind === 'last24h') {\n // ROLLING (now − 86400000 → now): TZ-INVARIANT by construction — a zone\n // never changes it (the R11 pin).\n return { from: iso(t - DAY_MS), to: iso(t) };\n }\n const { y, m, d, weekday } = wallParts(zone, t);\n const shifted = (dy: number): Date => new Date(Date.UTC(y, m - 1, d + dy));\n const dayStart = (dy: number): number => {\n const dt = shifted(dy);\n return localDayStartMs(dt.getUTCFullYear(), dt.getUTCMonth() + 1, dt.getUTCDate(), zone);\n };\n // The local day start/end of the day CONTAINING an instant (`today`).\n const dayStartAt = (instant: number): number => {\n const p = wallParts(zone, instant);\n return localDayStartMs(p.y, p.m, p.d, zone);\n };\n const dayEndAt = (instant: number): number => {\n const p = wallParts(zone, instant);\n return localDayEndMs(p.y, p.m, p.d, zone);\n };\n let from: number;\n let to: number;\n switch (kind) {\n case 'today':\n from = dayStartAt(t);\n to = dayEndAt(t);\n break;\n case 'yesterday':\n // calendar-day starts, never `t - 24h` (a 23/25-hour DST day would land in the wrong day)\n from = dayStart(-1);\n to = dayStart(0) - 1;\n break;\n case 'last7':\n case 'last14':\n case 'last30':\n case 'last90': {\n const days = Number(kind.slice(4));\n from = dayStart(-days);\n to = dayEndAt(t);\n break;\n }\n case 'lastFullWeek':\n case 'lastFullFortnight': {\n const daysSinceMonday = (weekday + 6) % 7; // ISO week starts Monday (the getUTCDay convention: Sun = 0)\n const daysBack = kind === 'lastFullWeek' ? 7 : 14;\n from = dayStart(-(daysSinceMonday + daysBack));\n to = dayStart(-daysSinceMonday) - 1;\n break;\n }\n case 'lastFullMonth': {\n const prev = new Date(Date.UTC(y, m - 2, 1)); // the 1st of the PREVIOUS month (January wraps to December)\n from = localDayStartMs(prev.getUTCFullYear(), prev.getUTCMonth() + 1, 1, zone);\n to = localDayStartMs(y, m, 1, zone) - 1;\n break;\n }\n case 'lastFullQuarter': {\n const q = Math.floor((m - 1) / 3); // 0-based quarter of the LOCAL current month\n const prevQ = q - 1 < 0 ? 3 : q - 1;\n const prevY = q - 1 < 0 ? y - 1 : y;\n from = localDayStartMs(prevY, prevQ * 3 + 1, 1, zone);\n to = localDayStartMs(y, q * 3 + 1, 1, zone) - 1;\n break;\n }\n }\n return { from: iso(from), to: iso(to) };\n}\n\n/** The shared bounded server-filtered window read: ONE `POST {path}/query`\n * with `{ MaxRecords: limit, filter: [{ field, gte, from }, { field, lte,\n * to }] }` — the pinned `field` rides the WIRE (not just the op name). The\n * result is the plain `items[]` array (the window-family shape — no\n * counts). `tz` omitted = the UTC bounds (bit-for-bit); `tz` given = the\n * zone-anchored bounds (validated pre-request, zero wire). */\nexport async function dateWindowQuery<T>(\n http: HttpClient,\n path: string,\n field: string,\n kind: DateWindowKind,\n limit: number,\n operation: string,\n now: Date,\n tz?: string,\n): Promise<T[]> {\n const zone = tz === undefined ? undefined : validateZone(tz, operation);\n const { from, to } = dateWindowBounds(kind, now, zone);\n const filter = [\n { field, op: 'gte', value: from },\n { field, op: 'lte', value: to },\n ];\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body: { MaxRecords: limit, filter },\n operation,\n });\n return unwrapItems<T>(res).items;\n}\n\n/** Second-precision UTC timestamp (exported for the customRange bounds). */\nexport const isoUtc = (ms: number): string => new Date(ms).toISOString().slice(0, 19) + 'Z';\n\n/** Parse a 'YYYY-MM-DD' calendar-day bound (UTC, or the local calendar day\n * in `zone`) → `{ y, mo, d, ms }` with `ms` = the day START in UTC\n * (zone omitted = the UTC day start — bit-for-bit `Date.UTC`). Typed\n * `CONFIG_ERROR` pre-request (zero wire), the `opName`-prefixed messages. */\nexport function customRangeDay(\n value: string,\n label: 'from' | 'to',\n zone: string | undefined,\n opName: string,\n): { y: number; mo: number; d: number; ms: number } {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value.trim());\n if (!m) {\n throw new AutotaskConfigError(\n zone === undefined\n ? `${opName}: ${label} must be a UTC 'YYYY-MM-DD' date (got ${JSON.stringify(value)})`\n : `${opName}: ${label} must be a 'YYYY-MM-DD' local calendar day in ${zone} (got ${JSON.stringify(value)})`,\n { operation: opName },\n );\n }\n const y = Number(m[1]);\n const mo = Number(m[2]);\n const d = Number(m[3]);\n // Date.UTC rolls an impossible day over (2026-02-31 -> Mar 3): refuse it.\n const probe = new Date(Date.UTC(y, mo - 1, d));\n const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;\n const ms = !real ? NaN : zone === undefined ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);\n if (!Number.isFinite(ms)) {\n throw new AutotaskConfigError(\n zone === undefined\n ? `${opName}: ${label} is not a valid UTC date (${JSON.stringify(value)})`\n : `${opName}: ${label} is not a valid calendar day in ${zone} (${JSON.stringify(value)})`,\n { operation: opName },\n );\n }\n return { y, mo, d, ms };\n}\n\n/** The shared explicit-range bounded read (customRange): ONE\n * `POST {path}/query` with the pinned field's gte/lte over the inclusive\n * [from, to] calendar days (UTC 'YYYY-MM-DD' days, or the local calendar\n * days in `zone` — the to-day END, DST-safe). `items[]` result. */\nexport async function customRangeQuery<T>(\n http: HttpClient,\n path: string,\n field: string,\n from: string,\n to: string,\n limit: number,\n operation: string,\n zone: string | undefined,\n): Promise<T[]> {\n const fromB = customRangeDay(from, 'from', zone, operation);\n const toB = customRangeDay(to, 'to', zone, operation);\n if (fromB.ms > toB.ms) {\n throw new AutotaskConfigError(\n `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,\n { operation },\n );\n }\n const toEndMs = zone === undefined ? toB.ms + DAY_MS - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);\n const filter = [\n { field, op: 'gte', value: isoUtc(fromB.ms) },\n { field, op: 'lte', value: isoUtc(toEndMs) },\n ];\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body: { MaxRecords: limit, filter },\n operation,\n });\n return unwrapItems<T>(res).items;\n}\n","/**\n * Billing item special ops — timezone-anchored date windows (issue #66,\n * sub-ask 3).\n *\n * The full mirror of the time-entry window family (the 11 kinds +\n * customRange) pinned to the billing item's own date field `itemDate` —\n * \"matching the time-entry helpers\" (issue #66): the same 12 ops, the same\n * shared machinery (src/resources/special/dateWindow.ts), the same plain\n * `items[]` result (no counts — the family-parity shape), the same limits\n * (1-500, default 25), the same zone contract (explicit IANA `opts.tz`\n * anchor — the window's calendar day/period is computed in that zone and\n * converted to UTC for the wire; omitted `tz` = UTC, the current behaviour\n * bit-for-bit; `last24h` is rolling and TZ-invariant).\n *\n * Wire: ONE bounded `POST /V1.0/BillingItems/query` per op (the `itemDate`\n * gte/lte filter is server-side). Tests are synthetic-only (no live reads).\n */\nimport type { HttpClient } from '../../http.js';\nexport type { DateWindowKind, DateWindowOptions } from './dateWindow.js';\nimport type { BillingItems } from '../../types/billing_items.js';\nimport type { BillingItemsResource } from '../billing_items.js';\nimport {\n clampWindowLimit,\n customRangeQuery,\n dateWindowQuery,\n validateZone,\n type DateWindowKind,\n type DateWindowOptions,\n} from './dateWindow.js';\n\n/** Window op: bounded `itemDate` gte/lte query over the pinned window. */\nexport async function windowQuery(\n _resource: BillingItemsResource,\n kind: DateWindowKind,\n http: HttpClient,\n opts?: DateWindowOptions,\n): Promise<BillingItems[]> {\n const now = opts?.now ?? new Date();\n const tz = opts?.tz === undefined ? undefined : validateZone(opts.tz, `billing_items.${kind}`);\n return dateWindowQuery<BillingItems>(\n http,\n '/V1.0/BillingItems/query',\n 'itemDate',\n kind,\n clampWindowLimit(opts?.limit),\n `billing_items.${kind}`,\n now,\n tz,\n );\n}\n\n/** customRange: explicit inclusive [from, to] `itemDate` bounds (both\n * required; UTC 'YYYY-MM-DD' days, or the local calendar days in `opts.tz`). */\nexport async function customRange(\n _resource: BillingItemsResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: DateWindowOptions,\n): Promise<BillingItems[]> {\n const zone = opts?.tz === undefined ? undefined : validateZone(opts.tz, 'billing_items.customRange');\n return customRangeQuery<BillingItems>(\n http,\n '/V1.0/BillingItems/query',\n 'itemDate',\n from,\n to,\n clampWindowLimit(opts?.limit),\n 'billing_items.customRange',\n zone,\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';\nimport * as billingitemsSpecial from './special/billing_items.js';\nimport type { DateWindowOptions } from './special/billing_items.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 /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n customRange(from: string, to: string, opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.customRange(this, from, to, this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n last14(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'last14', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n last24h(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'last24h', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n last30(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'last30', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n last7(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'last7', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n last90(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'last90', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n lastFullFortnight(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'lastFullFortnight', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n lastFullMonth(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'lastFullMonth', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n lastFullQuarter(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'lastFullQuarter', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n lastFullWeek(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'lastFullWeek', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n today(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'today', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/billing_items.ts). */\n yesterday(opts?: DateWindowOptions): Promise<BillingItems[]> {\n return billingitemsSpecial.windowQuery(this, 'yesterday', this.http, opts);\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 * `compositeNames` — the opt-in name/label sibling resolution shared by the\n * full-context composites (issue #77).\n *\n * The composites serve names/labels on TOP of the caches the SDK already has\n * (issue #80 default-on channels; NO new cache class, TTL table or store):\n * - resource ids (creator / owner / lead / the time-entry resource) ride\n * `operations.expandResourceNames` (name cache -> ReadCache -> one wire\n * read per distinct id);\n * - record-name FKs (role / billing code / contract) ride the per-resource\n * single-record gets (get -> getGlobal -> cachedGet; the ReadCache, the\n * per-resource TTLs, the #36 absent-marker contract untouched);\n * - the closed picklist scope (issue #77 OQ1, owner-approved: the ticket\n * fields status / priority / ticketType / issueType / subIssueType /\n * source / queue ONLY) rides ONE `operations.fieldCatalog`\n * `labels: true` call per distinct resource whose picklist fields are\n * served (zero extra wire on a warm fieldCache; the metadata read is a\n * catalog channel, NOT counted against the name-read budget).\n *\n * Pinned semantics:\n * - DEFAULT OFF: `names` absent = the sibling keys are ABSENT (not null)\n * from every served row and no name/label resolution runs (zero added\n * wire, zero added state — the composite output is byte-identical).\n * - Budget (`maxNameReads`, default {@link DEFAULT_MAX_NAME_READS} = 20,\n * owner-approved OQ2): counts COLD wire name reads only (name-cache,\n * ReadCache and fieldCache hits are free of the budget). The caller may\n * LOWER the budget, never raise it above the default. Over-budget ids are\n * refused NOTHING, fail NOTHING: `name: null, capped: true` on the\n * composite's name row (a NEW field — the composite's row shape is NOT\n * `expandResourceNames`' row shape) + the section's `truncated` marker.\n * - Blind, never an error: an unresolvable id serves the row with\n * `blind: true` (the `expandResourceNames` blind marker for resource ids;\n * the NotFoundError for a record FK); a transient per-id fault serves an\n * `error` row and never aborts the composite (ABORTED / non-SDK faults\n * propagate — swallowing would fake a partial result).\n * - Unexposed picklist (the W-A4 wall): the vendor does not expose the\n * picklist values to this API user (the fieldCatalog row carries no\n * `picklistValues`) -> the `<field>Label` sibling is `null` and the\n * section carries the SAME reason row the fieldCatalog op serves\n * ({@link FIELD_CATALOG_HONESTY_NOTE}) — never an error.\n * - De-duplication: ids are de-duplicated ACROSS THE WHOLE COMPOSITE\n * (all rows/parts, first-occurrence order) before any wire; each distinct\n * id costs at most one cold wire read.\n */\nimport { AutotaskConfigError, NotFoundError, isAutotaskError } from '../errors.js';\nimport type { AutotaskClient } from '../client.js';\nimport type { HttpClient } from '../http.js';\nimport type { Identifier } from '../types/common.js';\nimport type { PickListValue } from '../types/common.js';\nimport { expandResourceNames } from './expandResourceNames.js';\nimport { fieldCatalog, FIELD_CATALOG_HONESTY_NOTE } from './fieldCatalog.js';\n\n/** The pinned default name-read budget (issue #77 OQ2, owner-approved): the\n * per-composite-call count of COLD wire reads issued for name resolution\n * (resource ids via the sliced `expandResourceNames` call + record-FK\n * single-record gets that miss the ReadCache). Cache hits are free; the\n * caller may lower it (`maxNameReads`), never raise it. */\nexport const DEFAULT_MAX_NAME_READS = 20;\n\n/** The CLOSED picklist label scope (issue #77 OQ1, owner-approved): the\n * ticket picklist fields ONLY. Project/company picklists are out of scope\n * for this slice (the shared fieldCatalog mechanism makes a later\n * extension cheap). */\nexport const TICKET_LABEL_FIELDS = ['status', 'priority', 'ticketType', 'issueType', 'subIssueType', 'source', 'queueID'] as const;\n\n/** The record-name FK tables (the per-resource single-record gets). */\nexport type CompositeNameTable = 'role' | 'billingCode' | 'contract';\n\n/** One name row of the composite section (per distinct id). A NEW row shape\n * — `capped` is the composite's field; `expandResourceNames`' row shape is\n * `{ id, name, blind, error? }` (no `capped`). */\nexport interface CompositeNameRow {\n /** The resolved display name (the composed resource name, or the vendor\n * `name`/`contractName` of the record FK). Null when blind, a vendor data\n * gap, or over budget. */\n name: string | null;\n /** True when the vendor cannot resolve the id (the true not-found — the\n * blind marker for resource ids; the record FK's NotFoundError). */\n blind: boolean;\n /** True when the id was over the name-read budget and was NEVER fetched\n * (name: null by cap, not by vendor). */\n capped: boolean;\n /** A transient per-id fault (never aborts the composite, never cached). */\n error?: { code: string; message: string; httpStatus?: number };\n}\n\n/** The top-level `names` section (present on the composite result EXACTLY\n * when the caller passed `names: true`). */\nexport interface CompositeNamesSection {\n /** True when any id hit the name-read budget (its row carries\n * `capped: true`). */\n truncated: boolean;\n /** One row per distinct id resolved by this call, keyed `${table}:${id}`\n * (table: resource | role | billingCode | contract; the canonical id). */\n rows: Record<string, CompositeNameRow>;\n /** One reason row per picklist field whose label could not be resolved\n * (the vendor does not expose the picklist values to this API user — the\n * W-A4 wall): field key -> the fieldCatalog honesty note (the same reason\n * row the op serves). */\n reasons: Record<string, string>;\n}\n\n/** One record-FK id in the caller's plan. */\nexport interface CompositeNameFk {\n table: CompositeNameTable;\n id: Identifier;\n}\n\n/** The caller's de-duplicated plan (first-occurrence order across the whole\n * composite). */\nexport interface CompositeNamePlan {\n /** Resource ids (creator / owner / lead / time-entry resource). */\n resourceIds: Identifier[];\n /** Record-FK single-record gets. */\n recordFks: CompositeNameFk[];\n /** The picklist fields whose label siblings this call serves (the closed\n * scope; empty = no label resolution, zero metadata wire). */\n labelFields: readonly string[];\n}\n\nexport interface CompositeNameOptions {\n /** May LOWER the {@link DEFAULT_MAX_NAME_READS} budget (integer >= 1) —\n * never raise it. */\n maxNameReads?: number;\n}\n\n/** The additive options bag for the getContext-style composite (issue #77;\n * no-arg calls are unchanged). */\nexport interface CompositeContextOptions {\n /** Opt-in name siblings on the served row + the top-level `names` section\n * (default OFF — the sibling keys are ABSENT and the section is absent). */\n names?: boolean;\n /** May LOWER the {@link DEFAULT_MAX_NAME_READS} budget (integer >= 1) —\n * never raise it. */\n maxNameReads?: number;\n}\n\n/** The resolved names + the sibling appliers (the composite attaches\n * `section` to the result and uses the appliers on the served rows). */\nexport interface CompositeNames {\n /** The top-level section (attach to the composite result). */\n section: CompositeNamesSection;\n /** The resolved name for a resource id (null when blind / capped /\n * faulted / not in the plan). */\n resourceName: (id: Identifier) => string | null;\n /** The resolved name for a record-FK id (null when blind / capped /\n * faulted / not in the plan). */\n recordName: (table: CompositeNameTable, id: Identifier) => string | null;\n /** The resolved label for a picklist field value (null when the value is\n * absent or the vendor does not expose it — the unresolvable cases land\n * on `section.reasons`). */\n labelFor: (field: string, value: unknown) => string | null;\n}\n\n/** A vendor numeric id (safe integer or the canonical integer string form). */\nfunction isVendorId(value: unknown): value is Identifier {\n if (typeof value === 'number') return Number.isSafeInteger(value) && value >= 0;\n if (typeof value === 'string') return /^\\d+$/.test(value);\n return false;\n}\n\n/**\n * Accumulate the de-duplicated name plan for one composite call (ids across\n * ALL rows/parts, first-occurrence order; malformed / absent values are\n * skipped — no sibling is added for a field the row does not carry a vendor\n * id in).\n */\nexport function createNamePlan(labelFields: readonly string[] = []): {\n plan: () => CompositeNamePlan;\n addResource: (value: unknown) => void;\n addFk: (table: CompositeNameTable, value: unknown) => void;\n} {\n const resourceIds: Identifier[] = [];\n const resSeen = new Set<string>();\n const recordFks: CompositeNameFk[] = [];\n const fkSeen = new Set<string>();\n return {\n plan: () => ({ resourceIds, recordFks, labelFields }),\n addResource: (value) => {\n if (!isVendorId(value)) return;\n const k = String(value);\n if (!resSeen.has(k)) {\n resSeen.add(k);\n resourceIds.push(value);\n }\n },\n addFk: (table, value) => {\n if (!isVendorId(value)) return;\n const k = `${table}:${String(value)}`;\n if (!fkSeen.has(k)) {\n fkSeen.add(k);\n recordFks.push({ table, id: value });\n }\n },\n };\n}\n\n/** Add the `<field>Name` sibling to a served row (absent field key -> no\n * sibling; a non-id value -> null sibling). */\nexport function addNameSibling(\n row: Record<string, unknown>,\n field: string,\n resolve: (id: Identifier) => string | null,\n): void {\n const value = row[field];\n if (value === undefined) return;\n row[`${field}Name`] = isVendorId(value) ? resolve(value) : null;\n}\n\n/** Add the `<field>Label` sibling to a served row (absent field key -> no\n * sibling; an unresolvable value -> null + the reason row). */\nexport function addLabelSibling(row: Record<string, unknown>, field: string, names: CompositeNames): void {\n const value = row[field];\n if (value === undefined) return;\n row[`${field}Label`] = names.labelFor(field, value);\n}\n\nconst FK_TABLE_PATH: Record<CompositeNameTable, string> = {\n role: '/V1.0/Roles',\n billingCode: '/V1.0/BillingCodes',\n contract: '/V1.0/Contracts',\n};\n\nconst FK_NAME_FIELD: Record<CompositeNameTable, string> = {\n role: 'name',\n billingCode: 'name',\n contract: 'contractName',\n};\n\nfunction fkName(record: Record<string, unknown>, table: CompositeNameTable): string | null {\n const value = record[FK_NAME_FIELD[table]];\n return typeof value === 'string' && value.trim() !== '' ? value : null;\n}\n\nfunction faultRow(err: Parameters<typeof isAutotaskError>[0]): { code: string; message: string; httpStatus?: number } {\n const e = err as { code: string; message: string; httpStatus?: number };\n return e.httpStatus !== undefined ? { code: e.code, message: e.message, httpStatus: e.httpStatus } : { code: e.code, message: e.message };\n}\n\n/**\n * Resolve the names/labels for one composite call (the issue #77 wiring; the\n * caches are the caller client's — NO new cache). See the module JSDoc for\n * the pinned semantics (budget, blind, W-A4 reason rows, never an error).\n */\nexport async function resolveCompositeNames(\n http: HttpClient,\n plan: CompositeNamePlan,\n opts: CompositeNameOptions = {},\n): Promise<CompositeNames> {\n // Pre-request (zero wire): the budget may be lowered, never raised.\n if (opts.maxNameReads !== undefined && (!Number.isInteger(opts.maxNameReads) || opts.maxNameReads < 1)) {\n throw new AutotaskConfigError(`composite names: maxNameReads must be an integer >= 1 (got ${String(opts.maxNameReads)})`);\n }\n const budget = Math.min(DEFAULT_MAX_NAME_READS, opts.maxNameReads ?? DEFAULT_MAX_NAME_READS);\n const client: AutotaskClient | undefined = http.client;\n if (client === undefined) {\n // The transport is only built by the AutotaskClient; a composite that\n // runs outside it is a wiring fault (name it, never guess).\n throw new AutotaskConfigError('composite names: the transport is not wired to an AutotaskClient (the composite must run through the client)');\n }\n const readCache = http.readCache;\n const nameCache = http.resourceNameCache;\n const section: CompositeNamesSection = { truncated: false, rows: {}, reasons: {} };\n let remaining = budget;\n\n // --- resource ids: name cache (free) -> ReadCache (free) -> wire (budget)\n const coldResource: Identifier[] = [];\n for (const id of plan.resourceIds) {\n if (nameCache !== undefined && nameCache.get(id) !== undefined) continue; // free: the name cache (incl. the blind marker)\n if (readCache !== undefined && readCache.get(`/V1.0/Resources/${id}`) !== undefined) continue; // free: the op's per-id get rides the ReadCache\n coldResource.push(id);\n }\n const withinBudget = coldResource.slice(0, remaining);\n const overBudgetResource = coldResource.slice(remaining);\n remaining -= withinBudget.length;\n for (const id of overBudgetResource) {\n section.rows[`resource:${id}`] = { name: null, blind: false, capped: true };\n section.truncated = true;\n }\n const overSet = new Set(overBudgetResource.map((id) => String(id)));\n const opIds = plan.resourceIds.filter((id) => !overSet.has(String(id)));\n if (opIds.length > 0) {\n // The op THROWS pre-request over its 500-id cap — the composite's part\n // caps make this unreachable (<= a few dozen distinct ids); the guard\n // keeps the op's contract unconditionally (cap the overflow, never error).\n let pass = opIds;\n if (pass.length > 500) {\n for (const id of pass.slice(500)) {\n section.rows[`resource:${id}`] = { name: null, blind: false, capped: true };\n section.truncated = true;\n }\n pass = pass.slice(0, 500);\n }\n const res = await expandResourceNames(client, pass);\n for (const r of res.results) {\n const row: CompositeNameRow = { name: r.name, blind: r.blind, capped: false };\n if (r.error !== undefined) row.error = faultRow(r.error);\n section.rows[`resource:${r.id}`] = row;\n }\n }\n\n // --- record-FK gets: ReadCache (free) -> wire (budget) — the per-resource\n // gets ride getGlobal -> cachedGet (the existing channel, untouched).\n const holders: Record<CompositeNameTable, { get: (id: Identifier) => Promise<unknown> }> = {\n role: client.roles as unknown as { get: (id: Identifier) => Promise<unknown> },\n billingCode: client.billingCodes as unknown as { get: (id: Identifier) => Promise<unknown> },\n contract: client.contracts as unknown as { get: (id: Identifier) => Promise<unknown> },\n };\n for (const fk of plan.recordFks) {\n const key = `${fk.table}:${fk.id}`;\n const cold = readCache === undefined || readCache.get(`${FK_TABLE_PATH[fk.table]}/${fk.id}`) === undefined;\n if (cold) {\n if (remaining < 1) {\n section.rows[key] = { name: null, blind: false, capped: true };\n section.truncated = true;\n continue;\n }\n remaining -= 1;\n }\n try {\n const record = (await holders[fk.table].get(fk.id)) as unknown as Record<string, unknown>;\n section.rows[key] = { name: fkName(record, fk.table), blind: false, capped: false };\n } catch (err) {\n if (err instanceof NotFoundError) {\n // The vendor's true not-found (404 or `200 item: null`): blind,\n // never an error (the sibling is null; the row keeps the id).\n section.rows[key] = { name: null, blind: true, capped: false };\n } else if (isAutotaskError(err) && err.code !== 'ABORTED') {\n // A transient typed fault: a per-row error — never cached, never\n // aborting the composite.\n section.rows[key] = { name: null, blind: false, capped: false, error: faultRow(err) };\n } else {\n throw err; // ABORTED / non-SDK: propagate (swallowing fakes a partial result)\n }\n }\n }\n\n // --- labels (the closed ticket-picklist scope): ONE fieldCatalog\n // `labels: true` call (zero extra wire on a warm fieldCache; the\n // metadata channel is NOT counted against the name-read budget).\n const picklists: Record<string, PickListValue[] | undefined> = {};\n if (plan.labelFields.length > 0) {\n let usable = true;\n try {\n const catalog = await fieldCatalog(client, { resources: ['tickets'], labels: true, fields: [...plan.labelFields] });\n const row = catalog.rows.find((r) => r.resource === 'tickets');\n if (row === undefined || row.error !== null || row.fields === undefined) {\n usable = false;\n } else {\n for (const f of plan.labelFields) {\n const frow = row.fields.find((x) => x.name === f);\n picklists[f] = frow?.picklistValues;\n }\n }\n } catch (err) {\n if (isAutotaskError(err) && err.code !== 'ABORTED') usable = false; // a catalog fault degrades to the reason rows, never an error\n else throw err;\n }\n if (!usable) for (const f of plan.labelFields) section.reasons[f] = FIELD_CATALOG_HONESTY_NOTE;\n }\n\n return {\n section,\n resourceName: (id) => section.rows[`resource:${id}`]?.name ?? null,\n recordName: (table, id) => section.rows[`${table}:${id}`]?.name ?? null,\n labelFor: (field, value) => {\n if (value === null || value === undefined) return null; // no value to resolve\n const values = picklists[field];\n if (values === undefined) {\n // The vendor does not expose the picklist values (the W-A4 wall —\n // or the field is not a picklist to this API user): null + the SAME\n // reason row the fieldCatalog op serves.\n section.reasons[field] = FIELD_CATALOG_HONESTY_NOTE;\n return null;\n }\n // the vendor serves `value` as a string; the record carries a number\n const hit = values.find((v) => String(v.value) === String(value));\n if (hit === undefined) {\n // A value the vendor does not expose in the list: the same wall.\n section.reasons[field] = FIELD_CATALOG_HONESTY_NOTE;\n return null;\n }\n return typeof hit.label === 'string' ? hit.label : null;\n },\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, FilterCondition, Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport { clampPageSize } from '../../pagination.js';\nimport { buildFilter } from '../../query.js';\nimport { blindStampFor, buildDryRunResult, truncateNoteChars, type MutationOpts } from '../base.js';\nimport { BLIND_SURFACE_STAMPS, UNTRUSTED_FIELDS_BY_RESOURCE } 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';\nimport { addLabelSibling, addNameSibling, createNamePlan, resolveCompositeNames, TICKET_LABEL_FIELDS, type CompositeNamesSection } from '../../operations/compositeNames.js';\nimport { resolveFieldsPreset } from '../../field-presets.js';\nimport type { BillingItems } from '../../types/billing_items.js';\nimport type { TimeEntry } from '../../types/time_entries.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// Issue #59 PR-B — the first-class `includeFamily` option on companies.search\n// (the fuzzy channel per the amendment — no new op, no new tool). Exact\n// match stays the default everywhere (resolve is untouched).\n// =============================================================================\n\n/** The per-match child-query bound (one bounded single-page query per match). */\nexport const COMPANIES_FAMILY_CHILD_CAP = 50;\n\n/**\n * The blind-surface caveat that travels IN the family block (the plan-pinned\n * companies.query blind class — `unowned-blind`, plan `blindSurfaces`): a\n * family is reported as SEEN BY THIS API USER, never as complete (get is the\n * authority).\n */\nexport const COMPANIES_FAMILY_BLIND_NOTE =\n 'the family is reported as SEEN BY THIS API USER, never as complete: childIDs (and the search hits themselves) are scoped to the caller-visible enumeration (companies.query is the plan-pinned unowned-blind surface — get is the authority)';\n\n/** The closed opts bag for `companies.search` (an unknown key is refused pre-request, zero wire). */\nconst COMPANY_SEARCH_OPT_KEYS: readonly string[] = ['limit', 'includeFamily'];\n\nexport interface CompanySearchOptions {\n /** Max companies to return (default 25, clamped to 1..500). */\n limit?: number;\n /** Per-match family block: parentID (zero extra wire) + childIDs (one bounded query per match, capped at 50 with a truncation flag) + the blind-surface caveat. */\n includeFamily?: boolean;\n}\n\n/** The per-match family block (present on EVERY row iff includeFamily: true). */\nexport interface CompanyFamily {\n /** The match's own parentCompanyID (zero extra wire — the field is on the returned row; null when absent). */\n parentID: number | null;\n /** The ids of the children the bounded child query returns (vendor `parentCompanyID` eq; capped at {@link COMPANIES_FAMILY_CHILD_CAP}). */\n childIDs: number[];\n /** True when the single child page came back FULL (50 rows) with a live `pageDetails.nextPageUrl` (a short page, or a full page with a null cursor, is complete). */\n childIDsTruncated?: boolean;\n /** The plan-pinned blind-surface caveat (the family is seen by this API user, never complete). */\n blindNote: string;\n}\n\n/** A search row: the full Company record (CompanySummary is a structural alias of it) + the family block when includeFamily was set. */\nexport interface CompanyFamilyRow extends Company {\n family?: CompanyFamily;\n}\n\n/**\n * One bounded single-page child query (`parentCompanyID` eq, MaxRecords =\n * the cap). Returns the rows + the truncation signal (the LIVE next cursor —\n * the existing row-only helpers drop `pageDetails`, and the truncation\n * detection NEEDS it: a full 50-row page with a live next cursor ⇒\n * truncated; a short page, or a full page with a null cursor ⇒ complete).\n */\nasync function familyChildPage(http: HttpClient, parentID: number): Promise<{ rows: Company[]; hasNext: boolean }> {\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Companies/query',\n body: {\n MaxRecords: COMPANIES_FAMILY_CHILD_CAP,\n filter: buildFilter([{ field: 'parentCompanyID', op: 'eq', value: parentID }]).filter,\n },\n operation: 'companies.search',\n });\n const { items, pageDetails } = unwrapItems<Company>(res, 'companies.search');\n return { rows: items, hasNext: pageDetails.nextPageUrl !== null };\n}\n\n/**\n * `companies.search` with the first-class `includeFamily` option (issue #59\n * PR-B). Default (includeFamily absent/false) is bit-for-bit today's\n * behaviour — the bounded contains on companyName over the EXACT wire shape\n * the existing search op sends (ONE POST /V1.0/Companies/query,\n * `MaxRecords` = limit, default 25). With `includeFamily: true` each match\n * gains the family block (parentID — zero extra wire; childIDs — ONE bounded\n * single-page query per match, capped at `COMPANIES_FAMILY_CHILD_CAP` with\n * the truncation flag; the blind-surface caveat). Wire cost: 1 (the search)\n * + matches × 1 (the child queries). The closed opts bag is validated\n * pre-request (unknown key → typed CONFIG_ERROR, zero wire).\n */\nexport async function searchWithFamily(\n _resource: CompaniesResource,\n query: string,\n opts: CompanySearchOptions = {},\n http: HttpClient,\n): Promise<CompanyFamilyRow[]> {\n // Closed opts bag (the fieldCatalog house pattern): the unknown key is\n // refused pre-request, never silently dropped (zero wire).\n if (opts !== undefined && (typeof opts !== 'object' || opts === null || Array.isArray(opts))) {\n throw new AutotaskConfigError('companies.search: opts must be an object { limit?: number, includeFamily?: boolean }');\n }\n for (const key of Object.keys(opts ?? {})) {\n if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {\n throw new AutotaskConfigError(\n `companies.search: unknown opts key \"${key}\" — the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(', ')}`,\n { operation: 'companies.search' },\n );\n }\n }\n if (opts.includeFamily !== undefined && typeof opts.includeFamily !== 'boolean') {\n throw new AutotaskConfigError(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {\n operation: 'companies.search',\n });\n }\n const text = query.trim();\n if (text === '') throw new AutotaskConfigError('search: empty query', { operation: 'companies.search' });\n const limit = opts.limit === undefined ? 25 : clampPageSize(opts.limit);\n // The base hits — the exact wire shape the existing search op sends\n // (contains on the single searchFields field companyName, MaxRecords =\n // limit): one wire, behaviour-identical rows.\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path: '/V1.0/Companies/query',\n body: { MaxRecords: limit, filter: buildFilter([{ field: 'companyName', op: 'contains', value: text }]).filter },\n operation: 'companies.search',\n });\n const hits = unwrapItems<Company>(res, 'companies.search').items;\n if (opts.includeFamily !== true) return hits;\n // The family assembly: parentID rides the returned row (zero extra wire);\n // childIDs = ONE bounded single-page query per match (a match row without\n // a numeric id is unaddressable — no children reported, no wire).\n const rows: CompanyFamilyRow[] = [];\n for (const hit of hits) {\n const family: CompanyFamily = {\n parentID: hit.parentCompanyID ?? null,\n childIDs: [],\n blindNote: COMPANIES_FAMILY_BLIND_NOTE,\n };\n if (typeof hit.id === 'number') {\n const { rows: children, hasNext } = await familyChildPage(http, hit.id);\n family.childIDs = children.map((c) => c.id).filter((id): id is number => typeof id === 'number');\n if (children.length >= COMPANIES_FAMILY_CHILD_CAP && hasNext) family.childIDsTruncated = true;\n }\n rows.push({ ...hit, family });\n }\n return rows;\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 /** Opt-in name/label siblings (issue #77; default OFF — the sibling keys are ABSENT, not null, and no name/label resolution runs: zero added wire, byte-identical output). ON: the company row (owner / created-by resource names), the openTickets rows (the same ticket-field siblings as tickets.fullContext) and the projects rows (lead / creator resource names + the contract name — project picklists are OUT of the closed label scope, OQ1) carry the siblings + the top-level `names` section. */\n names?: boolean;\n /** May LOWER the composite's name-read budget (default 20 — the count of COLD wire reads issued for name resolution; cache hits are free of the budget). The caller may lower it, never raise it; over-budget ids serve `name: null, capped: true` (never an error). */\n maxNameReads?: 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 /** The opt-in name/label section (issue #77) — present EXACTLY when `names: true` (the sibling keys are absent from the rows otherwise). */\n names?: CompositeNamesSection;\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 const result: CompanyFullProfile = {\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 // The opt-in name/label siblings (issue #77; default OFF — the ABSENT\n // sibling keys keep the byte-identical shape, zero added wire). The\n // closed scope (OQ1): the openTickets rows carry the fullContext\n // ticket-field siblings (incl. the ticket picklist labels); the company +\n // projects rows carry the resource names + the contract name (project /\n // company picklists are OUT of the closed label scope). Ids are\n // de-duplicated ACROSS THE WHOLE COMPOSITE; the budget (`maxNameReads`,\n // default 20) counts COLD wire name reads only — over-budget ids serve\n // name: null + capped, never an error.\n if (opts.names === true) {\n const builder = createNamePlan(TICKET_LABEL_FIELDS);\n const c = company as unknown as Record<string, unknown>;\n builder.addResource(c['ownerResourceID']);\n builder.addResource(c['createdByResourceID']);\n for (const row of openTickets.items) {\n const r = row as unknown as Record<string, unknown>;\n builder.addResource(r['creatorResourceID']);\n builder.addFk('contract', r['contractID']);\n builder.addFk('billingCode', r['billingCodeID']);\n builder.addFk('role', r['assignedResourceRoleID']);\n }\n for (const row of projects) {\n const r = row as unknown as Record<string, unknown>;\n builder.addResource(r['projectLeadResourceID']);\n builder.addResource(r['creatorResourceID']);\n builder.addFk('contract', r['contractID']);\n }\n const names = await resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });\n // The company record may be a ReadCache-stored object: the siblings ride\n // a SHALLOW COPY (they must never leak into the cached record).\n const companyRow = { ...(company as unknown as Record<string, unknown>) };\n addNameSibling(companyRow, 'ownerResourceID', (v) => names.resourceName(v));\n addNameSibling(companyRow, 'createdByResourceID', (v) => names.resourceName(v));\n result.company = companyRow as unknown as Company;\n result.openTickets = {\n ...openTickets,\n items: openTickets.items.map((row) => {\n const r = { ...(row as unknown as Record<string, unknown>) };\n addNameSibling(r, 'creatorResourceID', (v) => names.resourceName(v));\n addNameSibling(r, 'contractID', (v) => names.recordName('contract', v));\n addNameSibling(r, 'billingCodeID', (v) => names.recordName('billingCode', v));\n addNameSibling(r, 'assignedResourceRoleID', (v) => names.recordName('role', v));\n for (const f of TICKET_LABEL_FIELDS) addLabelSibling(r, f, names);\n return r as unknown as Ticket;\n }),\n };\n result.projects = {\n ...result.projects,\n items: result.projects.items.map((row) => {\n const r = { ...(row as unknown as Record<string, unknown>) };\n addNameSibling(r, 'projectLeadResourceID', (v) => names.resourceName(v));\n addNameSibling(r, 'creatorResourceID', (v) => names.resourceName(v));\n addNameSibling(r, 'contractID', (v) => names.recordName('contract', v));\n return r as unknown as Project;\n }),\n };\n result.names = names.section;\n }\n return result;\n}\n\n\n// =============================================================================\n// Issue #62 — companies.unbilledWork: the unbilled-work composite.\n// =============================================================================\n//\n// One call for a company's posted-but-uninvoiced work: the company's billing\n// items (per `source`), the time behind them (joined through the company's\n// tickets AND tasks — the vendored time_entries model carries NO company\n// field, so the join goes through the company's tickets (ticketID) and the\n// company's projects' tasks (taskID); the vendored tasks model carries no\n// companyID/ticketID either — tasks are reached through the company's\n// projects), the per-ticket rollup, the unposted anti-join section, ex-tax\n// totals + hours, and the billing-vs-time warnings.\n//\n// Pinned semantics:\n// - `source` (closed 4-set, default 'posted_uninvoiced' — the billing\n// items' invoiceID absent, the uninvoiced mark; \"posted\" = already in the\n// billing-items table): 'invoice' → invoiceID = invoiceId (the invoice\n// record itself is NOT fetched in v1 — the items already carry\n// invoiceID/itemDate/amounts); 'date_range' → the itemDate window (both\n// dates REQUIRED, pre-request); 'tickets' → ticketID in ticketIds (the\n// time-entries part additionally joins those tickets directly).\n// - dateFrom/dateTo (YYYY-MM-DD) narrow the itemDate window on the\n// billing-items part in EVERY source (and dateWorked on the time-entries\n// part); REQUIRED when source is 'date_range'.\n// - includeParent (default true): ONE level only — the parent's own parent\n// is NOT pulled; a dangling parentCompanyID → parent: null, parent parts\n// empty, NOT an error (dangling-FK → null house rule).\n// - Wire budget: 6 bounded reads without a parent (company get + tickets +\n// projects + tasks + billing + time queries), 7 with a parent present +\n// includeParent. Zero mutating. includeNotes/noteChars/rollup add ZERO\n// wire (response-side / projection). The join-set queries skip the tasks\n// query when the company (set) has no projects, and the time query is\n// skipped with the part 'skipped' when the join set is empty (zero wire —\n// no tasks/tickets to join against is NOT evidence of no time entries).\n// - noteChars (default 400, applied only when includeNotes is true) caps the\n// note fields (time_entries summaryNotes; billing_items description) via\n// the #75 pure helper + the UNTRUSTED_FIELDS_BY_RESOURCE stamp — the SAME\n// `… [+N chars truncated]` marker contract as the queryBounded chokepoint\n// (zero new truncation code); the cap runs at result-build, BEFORE the\n// server-side untrusted wrapper (the src/untrusted.ts ordering contract).\n// - Per-part status 'ok' | 'blind' | 'skipped': the blind stamp is the SAME\n// filter-aware predicate the base wraps use (blindStampFor on the filter\n// this call actually sent) — on the pinned ww29 stamps every part query\n// is ALWAYS filtered, so a filtered empty part is a TRUE zero, never a\n// sentinel (the unfiltered-blind tickets surface is the pinned case: the\n// companyID-filtered query returns data when the company has tickets).\n// - The join sets are capped at UNBILLED_WORK_JOIN_SET_CAP ids per `in`\n// list (deterministic: sorted, first N) so the serialised filter stays\n// under the 8000-char vendor cap — a company with a huge ticket/task set\n// truncates the JOIN SET (not the results) with a documented part note\n// (the honest alternative is refused by the wire caps; the per-query\n// `limit` is the first, softer bound).\n// - rollup 'ticket' (default): the per-ticket fold (billing items by their\n// ticketID; time entries by their own ticketID — a null/absent ticket →\n// the `unassigned` bucket — the vendored TaskModel carries no ticket\n// field, so the entry's own ticketID is the only resolvable ticket link);\n// 'entry': the capped per-entry detail list. Totals derive from the SAME\n// folded rows (one source of truth — no second fold).\n// - Warnings (client-side; capped lists + full counts): noTimeEntry (the\n// billing items whose timeEntryID is empty/0) and hourDelta (the billing\n// items WITH a resolvable time entry where |billed quantity -\n// hoursWorked| > 0 — strict: the vendor data is exact decimal hours, any\n// mismatch is real).\n// - NOT_FOUND on the company get propagates (zero further wire). The parent\n// get's NOT_FOUND is the dangling-FK case (parent: null, not an error).\n// - Closed opts bag: an unknown key → typed CONFIG_ERROR naming the key +\n// the valid keys; the one-round complete problem list is pre-request\n// (zero wire).\n\n/** The closed `source` set for `companies.unbilledWork`. */\nexport type UnbilledWorkSource = 'posted_uninvoiced' | 'invoice' | 'date_range' | 'tickets';\n\n/** Options for `unbilledWork` (closed bag; the pinned defaults). */\nexport interface UnbilledWorkOptions {\n /** Which billing-items population to read (default `'posted_uninvoiced'` = no invoiceID, the uninvoiced mark). */\n source?: UnbilledWorkSource;\n /** Include the parent company's data via company.parentCompanyID (default true; ONE level only). */\n includeParent?: boolean;\n /** Window start (YYYY-MM-DD) on the billing items' itemDate — applied in EVERY source (required for source 'date_range'). */\n dateFrom?: string;\n /** Window end (YYYY-MM-DD) on the billing items' itemDate — applied in EVERY source (required for source 'date_range'). */\n dateTo?: string;\n /** The invoice id (required shape when source is 'invoice'). */\n invoiceId?: Identifier;\n /** The ticket ids (required non-empty shape when source is 'tickets'). */\n ticketIds?: Identifier[];\n /** Request the note fields (time_entries summaryNotes; billing_items description) (default false — notes EXCLUDED). */\n includeNotes?: boolean;\n /** Per-field char cap on the note fields (default 400, integer >= 1; applied only when includeNotes is true). */\n noteChars?: number;\n /** The rollup mode (default `'ticket'` — per-ticket rows; `'entry'` — the capped per-entry list). */\n rollup?: 'ticket' | 'entry';\n /** The per-part record cap (default 50, clamped 1..500 — the fullProfile house clamp). */\n limit?: number;\n}\n\n/** One capped part (the single-page bounded read's shape + status). */\nexport interface UnbilledWorkPart<TItem> {\n items: TItem[];\n /** True when the page came back FULL (the cap rows) — more may exist. */\n capped: boolean;\n /** The part's hasMore (a live next cursor at the full page). */\n hasMore: boolean;\n /** An honest note (the skipped-join-set / truncation / blind-sentinel / true-zero cases). */\n note?: string;\n /** The S12-C typed sentinel, present exactly when the filter-aware predicate stamps the empty answer. */\n blindSurface?: BlindSurfaceInfo;\n status: 'ok' | 'blind' | 'skipped';\n}\n\n/** One per-ticket rollup row (the `unassigned` bucket carries ticketId null). */\nexport interface UnbilledWorkRollupRow {\n ticketId: number | null;\n itemCount: number;\n hours: number;\n preTax: number;\n entryCount: number;\n}\n\n/** The rollup part (discriminated by mode). */\nexport type UnbilledWorkRollup =\n | { mode: 'ticket'; rows: UnbilledWorkRollupRow[] }\n | { mode: 'entry'; items: TimeEntry[]; capped: boolean; hasMore: boolean };\n\n/** The headline totals (derived from the folded rows — one source of truth). */\nexport interface UnbilledWorkTotals {\n /** Σ extendedPrice over the billing-items part (the pre-tax extended line). */\n preTax: number;\n /** Σ hoursWorked over the time-entries part (the time that actually worked). */\n hours: number;\n /** The time-entries part row count. */\n entryCount: number;\n /** Σ totalAmount over the billing-items part (surfaced for reconciliation). */\n totalAmount: number;\n /** Σ taxDollars over the billing-items part (surfaced for reconciliation). */\n taxDollars: number;\n}\n\n/** The warnings block (capped lists + the full counts). */\nexport interface UnbilledWorkWarnings {\n /** The billing items whose timeEntryID is empty/0 (list capped at `limit` + the full count). */\n noTimeEntry: { items: Array<{ billingItemId: number }>; count: number };\n /** The billing items WITH a resolvable time entry where |billed quantity − hoursWorked| > 0 (strict; list capped at `limit` + the full count). */\n hourDelta: { items: Array<{ billingItemId: number; timeEntryId: number; billedQuantity: number; entryHours: number }>; count: number };\n}\n\n/** The unbilled-work composite result (ONE call, 6(+1) bounded reads). */\nexport interface UnbilledWorkResult {\n company: Company;\n /** The parent company (null when absent / dangling — includeParent is one level only). */\n parent: Company | null;\n billingItems: UnbilledWorkPart<BillingItems>;\n timeEntries: UnbilledWorkPart<TimeEntry>;\n rollup: UnbilledWorkRollup;\n /** The anti-join section: the fetched time entries whose id is in no fetched billing item's timeEntryID (client-side, zero wire). */\n unposted: UnbilledWorkPart<TimeEntry>;\n totals: UnbilledWorkTotals;\n warnings: UnbilledWorkWarnings;\n /** Per-part status (the typed blind/skipped vocabulary). */\n parts: {\n company: 'ok';\n parent: 'ok' | 'skipped';\n billingItems: 'ok' | 'blind';\n timeEntries: 'ok' | 'blind' | 'skipped';\n unposted: 'ok';\n };\n}\n\n/** The noteChars default (applied only when includeNotes is true — the #75 bag key itself has no default; the two compose). */\nexport const UNBILLED_WORK_NOTE_CHARS_DEFAULT = 400;\n/** The join-set cap PER `in` list (deterministic: sorted, first N; fits the 8000-char serialised filter cap: 2 × 300 × 11-digit ids + the or wrapper < 8000). */\nexport const UNBILLED_WORK_JOIN_SET_CAP = 300;\n\nconst UNBILLED_WORK_OPT_KEYS: readonly string[] = [\n 'source',\n 'includeParent',\n 'dateFrom',\n 'dateTo',\n 'invoiceId',\n 'ticketIds',\n 'includeNotes',\n 'noteChars',\n 'rollup',\n 'limit',\n];\n\nconst UNBILLED_WORK_SOURCE_SET: readonly string[] = ['posted_uninvoiced', 'invoice', 'date_range', 'tickets'];\nconst DATE_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/** A non-finite/absent numeric field contributes 0 (the documented fold rule). */\nfunction num(v: unknown): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : 0;\n}\n\nfunction isDateYMD(v: unknown): v is string {\n return typeof v === 'string' && DATE_RE.test(v) && !Number.isNaN(Date.parse(v));\n}\n\ninterface ValidatedUnbilledWork {\n source: UnbilledWorkSource;\n includeParent: boolean;\n dateFrom?: string;\n dateTo?: string;\n invoiceId?: Identifier;\n ticketIds?: Identifier[];\n includeNotes: boolean;\n noteChars: number;\n rollup: 'ticket' | 'entry';\n limit: number;\n}\n\n/** The closed-bag + source-shape validation (ONE complete problem list, pre-request, zero wire). */\nfunction validateUnbilledWorkOptions(companyId: Identifier, opts: UnbilledWorkOptions): ValidatedUnbilledWork {\n if (opts !== undefined && (typeof opts !== 'object' || opts === null || Array.isArray(opts))) {\n throw new AutotaskConfigError(\n `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? 'an array' : typeof opts})`,\n { operation: 'companies.unbilledWork' },\n );\n }\n const problems: string[] = [];\n for (const key of Object.keys(opts ?? {})) {\n if (!UNBILLED_WORK_OPT_KEYS.includes(key)) {\n problems.push(`unknown opts key \"${key}\" — the bag is closed: ${UNBILLED_WORK_OPT_KEYS.join(', ')}`);\n }\n }\n const source: UnbilledWorkSource = opts.source ?? 'posted_uninvoiced';\n if (!UNBILLED_WORK_SOURCE_SET.includes(source)) {\n problems.push(`source must be one of: ${UNBILLED_WORK_SOURCE_SET.join(', ')} (got ${String(source)})`);\n }\n if (opts.includeParent !== undefined && typeof opts.includeParent !== 'boolean') {\n problems.push(`includeParent must be a boolean (got ${String(opts.includeParent)})`);\n }\n if (opts.includeNotes !== undefined && typeof opts.includeNotes !== 'boolean') {\n problems.push(`includeNotes must be a boolean (got ${String(opts.includeNotes)})`);\n }\n const noteChars = opts.noteChars ?? UNBILLED_WORK_NOTE_CHARS_DEFAULT;\n if (!Number.isInteger(noteChars) || noteChars < 1) problems.push(`noteChars must be an integer >= 1 (got ${String(opts.noteChars)})`);\n const rollup = opts.rollup ?? 'ticket';\n if (rollup !== 'ticket' && rollup !== 'entry') problems.push(`rollup must be 'ticket' or 'entry' (got ${String(opts.rollup)})`);\n let limit: number;\n try {\n limit = clampLimit(opts.limit); // the file's existing clamp: default 50, integer >= 1, capped 500\n } catch (err) {\n problems.push(err instanceof AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);\n limit = 50;\n }\n if (source === 'date_range') {\n if (!isDateYMD(opts.dateFrom)) problems.push(`dateFrom is required (YYYY-MM-DD) when source is \"date_range\" (got ${String(opts.dateFrom)})`);\n if (!isDateYMD(opts.dateTo)) problems.push(`dateTo is required (YYYY-MM-DD) when source is \"date_range\" (got ${String(opts.dateTo)})`);\n } else {\n if (opts.dateFrom !== undefined && !isDateYMD(opts.dateFrom)) problems.push(`dateFrom must be YYYY-MM-DD (got ${String(opts.dateFrom)})`);\n if (opts.dateTo !== undefined && !isDateYMD(opts.dateTo)) problems.push(`dateTo must be YYYY-MM-DD (got ${String(opts.dateTo)})`);\n }\n if (source === 'invoice') {\n if (opts.invoiceId === undefined) {\n problems.push('invoiceId is required (the vendor invoice id) when source is \"invoice\"');\n } else {\n try {\n parseIdentifier(opts.invoiceId, 'opts.invoiceId');\n } catch (err) {\n problems.push(err instanceof AutotaskError ? err.message : 'invoiceId must be a vendor numeric id');\n }\n }\n }\n if (source === 'tickets') {\n if (!Array.isArray(opts.ticketIds) || opts.ticketIds.length === 0) {\n problems.push('ticketIds is required (a non-empty array of vendor ticket ids) when source is \"tickets\"');\n } else {\n opts.ticketIds.forEach((tid, i) => {\n try {\n parseIdentifier(tid, `opts.ticketIds[${i}]`);\n } catch (err) {\n problems.push(err instanceof AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);\n }\n });\n }\n }\n // The root identifier (the identifier contract: safe integers / canonical digit strings).\n try {\n parseIdentifier(companyId, 'companyId');\n } catch (err) {\n problems.push(err instanceof AutotaskError ? err.message : 'companyId must be a vendor numeric id');\n }\n if (problems.length > 0) {\n throw new AutotaskConfigError(\n `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)\\n- ` + problems.join('\\n- '),\n { operation: 'companies.unbilledWork' },\n );\n }\n return {\n source,\n includeParent: opts.includeParent ?? true,\n dateFrom: isDateYMD(opts.dateFrom) ? opts.dateFrom : undefined,\n dateTo: isDateYMD(opts.dateTo) ? opts.dateTo : undefined,\n invoiceId: source === 'invoice' ? opts.invoiceId : undefined,\n ticketIds: source === 'tickets' ? opts.ticketIds : undefined,\n includeNotes: opts.includeNotes ?? false,\n noteChars,\n rollup,\n limit,\n };\n}\n\n/** ONE bounded single-page read (the fullProfile scopedCompanyQuery wire shape, generalised):\n * MaxRecords = the cap; the raw conditions array rides the wire (top-level\n * conditions AND at the vendor); a full page + live next cursor = hasMore. */\nasync function boundedPart<TItem>(\n http: HttpClient,\n path: string,\n conditions: FilterCondition[],\n limit: number,\n includeFields?: string[],\n): Promise<{ items: TItem[]; capped: boolean; hasMore: boolean }> {\n const body: Record<string, unknown> = { MaxRecords: limit, filter: conditions };\n if (includeFields !== undefined) body.IncludeFields = includeFields;\n const res = await http.request<unknown>({\n method: 'POST',\n idempotent: true,\n path,\n body,\n operation: 'companies.unbilledWork',\n });\n const { items, pageDetails } = unwrapItems<TItem>(res, 'companies.unbilledWork');\n const capped = items.length >= limit;\n return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };\n}\n\n/** The join-set cap (deterministic: sorted, first N; a flag when the set was larger). */\nfunction capJoinSet(ids: number[], cap: number): { ids: number[]; truncated: boolean } {\n const sorted = [...new Set(ids)].sort((a, b) => a - b);\n if (sorted.length <= cap) return { ids: sorted, truncated: false };\n return { ids: sorted.slice(0, cap), truncated: true };\n}\n\n/** The per-part blind/true-zero status decision (the SAME filter-aware predicate the base wraps\n * use — one helper so the op and its tests share the one code path). */\n/**\n * The per-part blind/true-zero status decision (issue #62) — the SAME\n * filter-aware predicate the base wraps use (`blindStampFor` on the filter\n * the call actually sent), exported so the op and its tests share the one\n * code path: a non-empty answer is data ('ok'); an empty answer is 'blind'\n * with the S12-C sentinel exactly when the pinned stamp + filter say so\n * (an `unfiltered-blind` surface stamps only the unfiltered call — a\n * filtered empty is a TRUE zero with the honest note).\n */\nexport function unbilledWorkPartStatus(\n key: string,\n conditions: FilterCondition[],\n items: unknown[],\n): { status: 'ok' | 'blind'; blindSurface?: BlindSurfaceInfo; note?: string } {\n if (items.length !== 0) return { status: 'ok' };\n const stamp = blindStampFor(BLIND_SURFACE_STAMPS[key]?.query, conditions);\n if (stamp !== undefined) return { status: 'blind', blindSurface: stamp, note: stamp.note };\n return {\n status: 'ok',\n note: `0 rows on ${key}.query for this filter (a filtered empty is a TRUE zero — the pinned blind surfaces stamp only their blind shape, and this call is always filtered)`,\n };\n}\n\n/**\n * `unbilledWork` — the unbilled-work composite (issue #62): the company's\n * posted billing items (per source), the time behind them (joined through\n * the company's tickets and tasks — time entries carry no companyID), the\n * per-ticket rollup, the unposted anti-join section, ex-tax totals + hours,\n * and the billing-vs-time warnings. 6(+1) bounded reads, zero mutating;\n * the client-side folds (rollup / unposted / totals / warnings) add zero\n * wire. See the section header for the pinned semantics.\n */\nexport async function unbilledWork(\n resource: CompaniesResource,\n companyId: Identifier,\n opts: UnbilledWorkOptions = {},\n http: HttpClient,\n): Promise<UnbilledWorkResult> {\n const v = validateUnbilledWorkOptions(companyId, opts);\n const id = parseIdentifier(companyId, 'companyId');\n // 1) the company record (get is the authority even on the blind companies\n // surface — company missing → NOT_FOUND propagates, zero further wire).\n const company = await resource.get(id);\n const companyIds: number[] = [num(company.id)];\n // 2) the parent (ONE level; dangling → null, NOT an error).\n let parent: Company | null = null;\n let parentStatus: 'ok' | 'skipped' = 'skipped';\n if (v.includeParent) {\n const parentID = company.parentCompanyID;\n if (typeof parentID === 'number' && parentID > 0) {\n try {\n parent = await resource.get(parentID);\n parentStatus = 'ok';\n companyIds.push(num(parent.id));\n } catch (err) {\n if (err instanceof NotFoundError) parent = null; // dangling FK → null (the parent parts are empty; not an error)\n else throw err;\n }\n }\n }\n // 3) the join sets: the company's tickets + the company's projects' tasks\n // (the vendored tasks model has no companyID/ticketID — tasks are\n // reached via the company's projects).\n const ticketsCond: FilterCondition[] = [{ field: 'companyID', op: 'in', value: companyIds }];\n const ticketsRaw = await boundedPart<Record<string, unknown>>(http, '/V1.0/Tickets/query', ticketsCond, v.limit);\n const projectsCond: FilterCondition[] = [{ field: 'companyID', op: 'in', value: companyIds }];\n const projectsRaw = await boundedPart<Record<string, unknown>>(http, '/V1.0/Projects/query', projectsCond, v.limit);\n const projectIds = projectsRaw.items.map((p) => num(p.id)).filter((n) => n > 0);\n let taskIds: number[] = [];\n let tasksHasMore = false;\n if (projectIds.length > 0) {\n const tasksRaw = await boundedPart<Record<string, unknown>>(http, '/V1.0/Tasks/query', [{ field: 'projectID', op: 'in', value: projectIds }], v.limit);\n taskIds = tasksRaw.items.map((t) => num(t.id)).filter((n) => n > 0);\n tasksHasMore = tasksRaw.hasMore;\n }\n const ticketJoinIds = ticketsRaw.items.map((t) => num(t.id)).filter((n) => n > 0);\n // source 'tickets' adds the caller's ticket ids to the join set (the\n // billing part already filters ticketID in ticketIds).\n if (v.source === 'tickets' && v.ticketIds !== undefined) {\n for (const tid of v.ticketIds) ticketJoinIds.push(typeof tid === 'number' ? tid : parseInt(tid, 10));\n }\n // 4) the billing-items part (the #75 billing_join preset pins the join's\n // columns — the vendor's column selection rides the existing\n // IncludeFields wire path; id is named for the raw read).\n const billingConditions: FilterCondition[] = [{ field: 'companyID', op: 'in', value: companyIds }];\n if (v.source === 'posted_uninvoiced') billingConditions.push({ field: 'invoiceID', op: 'notExist' }); // live-verified: an uninvoiced item has NO invoiceID (eq 0 matches nothing)\n if (v.source === 'invoice' && v.invoiceId !== undefined) billingConditions.push({ field: 'invoiceID', op: 'eq', value: v.invoiceId });\n if (v.source === 'date_range') {\n billingConditions.push({ field: 'itemDate', op: 'gte', value: v.dateFrom }, { field: 'itemDate', op: 'lte', value: v.dateTo });\n }\n if (v.source === 'tickets' && v.ticketIds !== undefined) billingConditions.push({ field: 'ticketID', op: 'in', value: v.ticketIds });\n if (v.source !== 'date_range') {\n if (v.dateFrom !== undefined) billingConditions.push({ field: 'itemDate', op: 'gte', value: v.dateFrom });\n if (v.dateTo !== undefined) billingConditions.push({ field: 'itemDate', op: 'lte', value: v.dateTo });\n }\n const billingFields = resolveFieldsPreset('billing_join', 'billing_items');\n const billingIncludeFields = [...billingFields, 'id', ...(v.includeNotes ? ['description'] : [])];\n const billingRaw = await boundedPart<Record<string, unknown>>(http, '/V1.0/BillingItems/query', billingConditions, v.limit, billingIncludeFields);\n // 5) the time-entries part (the join: or [taskID in, ticketID in] —\n // skipped with zero wire when the join set is empty). The part's\n // IncludeFields = the join + measure fields (taskID/ticketID/\n // hoursWorked/dateWorked + id) — the NOTE fields (summaryNotes) are\n // EXCLUDED by default (AC3 first clause) and ride the wire only with\n // includeNotes (capped at noteChars with the #75 marker).\n const taskCap = capJoinSet(taskIds, UNBILLED_WORK_JOIN_SET_CAP);\n const ticketCap = capJoinSet(ticketJoinIds, UNBILLED_WORK_JOIN_SET_CAP);\n const joinNotes: string[] = [];\n // Each join query is ONE page of `limit` rows: a live next-page cursor means time on the unread tickets/tasks is not fetched.\n for (const [what, more] of [['ticket', ticketsRaw.hasMore], ['project', projectsRaw.hasMore], ['task', tasksHasMore]] as const) {\n if (more) joinNotes.push(`${what} join read hit the limit of ${v.limit} — time entries are joined against the first ${v.limit} ${what}s only (raise limit to widen it)`);\n }\n if (taskCap.truncated) joinNotes.push(`task join set truncated to ${UNBILLED_WORK_JOIN_SET_CAP} of ${taskIds.length} ids (the 8000-char filter cap — the results cover the returned join set only)`);\n if (ticketCap.truncated) joinNotes.push(`ticket join set truncated to ${UNBILLED_WORK_JOIN_SET_CAP} of ${ticketJoinIds.length} ids (the 8000-char filter cap — the results cover the returned join set only)`);\n let timePart: UnbilledWorkPart<TimeEntry>;\n let entries: Record<string, unknown>[] = [];\n if (taskCap.ids.length === 0 && ticketCap.ids.length === 0) {\n timePart = {\n items: [],\n capped: false,\n hasMore: false,\n status: 'skipped',\n note: 'skipped: the company (set) has no tickets or tasks in the returned join set — no tasks/tickets to join against is NOT evidence of no time entries (zero wire)',\n };\n } else {\n const timeConditions: FilterCondition[] =\n taskCap.ids.length > 0 && ticketCap.ids.length > 0\n ? [{ op: 'or', items: [{ field: 'taskID', op: 'in', value: taskCap.ids }, { field: 'ticketID', op: 'in', value: ticketCap.ids }] }]\n : taskCap.ids.length > 0\n ? [{ field: 'taskID', op: 'in', value: taskCap.ids }]\n : [{ field: 'ticketID', op: 'in', value: ticketCap.ids }];\n if (v.dateFrom !== undefined) timeConditions.push({ field: 'dateWorked', op: 'gte', value: v.dateFrom });\n if (v.dateTo !== undefined) timeConditions.push({ field: 'dateWorked', op: 'lte', value: v.dateTo });\n const timeFields = ['taskID', 'ticketID', 'hoursWorked', 'dateWorked', 'id', ...(v.includeNotes ? ['summaryNotes'] : [])];\n const raw = await boundedPart<Record<string, unknown>>(http, '/V1.0/TimeEntries/query', timeConditions, v.limit, timeFields);\n entries = raw.items;\n // The #75 noteChars cap at result-build (the house pure helper + the\n // untrusted-class stamp — the SAME marker contract as the queryBounded\n // chokepoint; BEFORE the server-side untrusted wrapper).\n let cappedItems = entries;\n let noteCharsTruncated = 0;\n if (v.includeNotes) {\n [cappedItems, noteCharsTruncated] = truncateNoteChars(entries, v.noteChars, ['summaryNotes']);\n }\n const st = unbilledWorkPartStatus('time_entries', timeConditions, entries);\n timePart = {\n items: cappedItems as unknown as TimeEntry[],\n capped: raw.capped,\n hasMore: raw.hasMore,\n status: st.status,\n blindSurface: st.blindSurface,\n note: [...joinNotes, ...(st.note !== undefined ? [st.note] : []), ...(noteCharsTruncated > 0 ? [`noteChars: ${noteCharsTruncated} note field value(s) truncated at ${v.noteChars} chars`] : [])].filter(Boolean).join(' | ') || undefined,\n };\n }\n // The billing part's noteChars (the untrusted fields the preset actually\n // requests — description when includeNotes) + status.\n let billingItems = billingRaw.items;\n let billingNoteCharsTruncated = 0;\n if (v.includeNotes) {\n const noteFields = (UNTRUSTED_FIELDS_BY_RESOURCE['billing_items'] ?? []).filter((f) => billingIncludeFields.includes(f));\n [billingItems, billingNoteCharsTruncated] = truncateNoteChars(billingRaw.items, v.noteChars, noteFields);\n }\n const billingSt = unbilledWorkPartStatus('billing_items', billingConditions, billingRaw.items);\n const billingItemsPart: UnbilledWorkPart<BillingItems> = {\n items: billingItems as unknown as BillingItems[],\n capped: billingRaw.capped,\n hasMore: billingRaw.hasMore,\n status: billingSt.status,\n blindSurface: billingSt.blindSurface,\n note: [...(billingSt.note !== undefined ? [billingSt.note] : []), ...(billingNoteCharsTruncated > 0 ? [`noteChars: ${billingNoteCharsTruncated} note field value(s) truncated at ${v.noteChars} chars`] : [])].filter(Boolean).join(' | ') || undefined,\n };\n // 6) the client-side folds (zero wire) — one folded source of truth.\n const entryByTimeId = new Map<number, Record<string, unknown>>();\n for (const e of entries) entryByTimeId.set(num(e.id), e);\n // the per-ticket fold (billing by ticketID; entries by their own ticketID —\n // null → the unassigned bucket; the vendored TaskModel carries no ticket\n // field, so the entry's own ticketID is the only resolvable ticket link).\n const fold = new Map<number | 'unassigned', UnbilledWorkRollupRow>();\n const rowFor = (key: number | 'unassigned'): UnbilledWorkRollupRow => {\n let r = fold.get(key);\n if (r === undefined) {\n r = { ticketId: key === 'unassigned' ? null : key, itemCount: 0, hours: 0, preTax: 0, entryCount: 0 };\n fold.set(key, r);\n }\n return r;\n };\n for (const item of billingItems) {\n const t = num(item.ticketID);\n const r = rowFor(t > 0 ? t : 'unassigned');\n r.itemCount += 1;\n r.preTax += num(item.extendedPrice);\n }\n for (const e of entries) {\n const t = num(e.ticketID);\n const r = rowFor(t > 0 ? t : 'unassigned');\n r.entryCount += 1;\n r.hours += num(e.hoursWorked);\n }\n // the headline totals — derived from the folded rows (one source of\n // truth); totalAmount/taxDollars are the reconciliation pass over the\n // same billing rows (surfaced alongside per the plan's Q2 field choice).\n const totals: UnbilledWorkTotals = { preTax: 0, hours: 0, entryCount: 0, totalAmount: 0, taxDollars: 0 };\n for (const row of fold.values()) {\n totals.preTax += row.preTax;\n totals.hours += row.hours;\n totals.entryCount += row.entryCount;\n }\n for (const item of billingItems) {\n totals.totalAmount += num(item.totalAmount);\n totals.taxDollars += num(item.taxDollars);\n }\n const rollupRows = [...fold.values()].sort((a, b) => {\n if (a.ticketId === null) return 1;\n if (b.ticketId === null) return -1;\n return a.ticketId - b.ticketId;\n });\n const rollup: UnbilledWorkRollup =\n v.rollup === 'entry' ? { mode: 'entry', items: timePart.items, capped: timePart.capped, hasMore: timePart.hasMore } : { mode: 'ticket', rows: rollupRows };\n // the unposted anti-join (the fetched entries whose id is in no fetched\n // billing item's timeEntryID — client-side, zero wire).\n const billedEntryIds = new Set(billingItems.map((i) => num(i.timeEntryID)).filter((n) => n > 0));\n const unpostedAll = entries.filter((e) => num(e.id) > 0 && !billedEntryIds.has(num(e.id)));\n const unpostedCapped = unpostedAll.length > v.limit;\n const unposted: UnbilledWorkPart<TimeEntry> = {\n items: unpostedAll.slice(0, v.limit) as unknown as TimeEntry[],\n capped: unpostedCapped,\n hasMore: unpostedCapped,\n status: 'ok',\n note: unpostedCapped ? `unposted list capped at ${v.limit} of ${unpostedAll.length} (the full anti-join set is larger)` : undefined,\n };\n // the warnings (capped at limit + full counts; hourDelta strict > 0 — the\n // vendor data is exact decimal hours, any mismatch is real).\n const noTimeEntryAll = billingItems.filter((i) => !num(i.timeEntryID));\n const hourDeltaAll: UnbilledWorkWarnings['hourDelta']['items'] = [];\n for (const item of billingItems) {\n const teId = num(item.timeEntryID);\n if (teId <= 0) continue;\n const entry = entryByTimeId.get(teId);\n if (entry === undefined) continue;\n const billed = num(item.quantity);\n const worked = num(entry.hoursWorked);\n if (Math.abs(billed - worked) > 0) {\n hourDeltaAll.push({ billingItemId: num(item.id), timeEntryId: teId, billedQuantity: billed, entryHours: worked });\n }\n }\n const warnings: UnbilledWorkWarnings = {\n noTimeEntry: { items: noTimeEntryAll.slice(0, v.limit).map((i) => ({ billingItemId: num(i.id) })), count: noTimeEntryAll.length },\n hourDelta: { items: hourDeltaAll.slice(0, v.limit), count: hourDeltaAll.length },\n };\n return {\n company,\n parent,\n billingItems: billingItemsPart,\n timeEntries: timePart,\n rollup,\n unposted,\n totals,\n warnings,\n parts: {\n company: 'ok',\n parent: parentStatus,\n billingItems: billingSt.status,\n timeEntries: timePart.status,\n unposted: '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, UnbilledWorkOptions, UnbilledWorkResult, CompanySearchOptions, CompanyFamilyRow } 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. The closed opts bag { limit?, includeFamily? }:\n * includeFamily: true adds the per-match family block (parentID — zero extra wire —\n * the record's own parentCompanyID; childIDs — one bounded single-page query per match,\n * capped at 50 with the childIDsTruncated flag; the blind-surface blindNote — the\n * family is reported as SEEN BY THIS API USER, never as complete). */\n async search(query: string, opts?: CompanySearchOptions): Promise<CompanyFamilyRow[]> {\n return companiesSpecial.searchWithFamily(this, query, opts, this.http);\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 /** Node-parity special op (hand-written in src/resources/special/companies.ts). */\n unbilledWork(id: Identifier, opts?: UnbilledWorkOptions): Promise<UnbilledWorkResult> {\n return companiesSpecial.unbilledWork(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';\nimport { addNameSibling, createNamePlan, resolveCompositeNames, type CompositeNamesSection } from '../../operations/compositeNames.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 /** Opt-in name/label siblings (issue #77; default OFF — the sibling keys are ABSENT, not null, and no name/label resolution runs: zero added wire, byte-identical output). ON: the ci row carries the closed-scope sibling (the contract name — the CI row has NO issue-listed picklist fields, so no labels) + the top-level `names` section. */\n names?: boolean;\n /** May LOWER the composite's name-read budget (default 20 — the count of COLD wire reads issued for name resolution; cache hits are free of the budget). The caller may lower it, never raise it; over-budget ids serve `name: null, capped: true` (never an error). */\n maxNameReads?: 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 /** The opt-in name/label section (issue #77) — present EXACTLY when `names: true` (the sibling keys are absent from the rows otherwise). */\n names?: CompositeNamesSection;\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 const result: ConfigurationItemProfile = {\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 // The opt-in name sibling (issue #77; default OFF — the ABSENT sibling key\n // keeps the byte-identical shape, zero added wire). The closed scope (OQ1)\n // on the CI row: the contract name ONLY (the CI row has no issue-listed\n // picklist fields — no label resolution, zero metadata wire).\n if (opts.names === true) {\n const builder = createNamePlan();\n builder.addFk('contract', root['contractID']);\n const names = await resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });\n // The ci record rides a SHALLOW COPY (it may be a ReadCache-stored\n // object — the sibling must never leak into the cached record).\n const ciRow = { ...(ci as unknown as Record<string, unknown>) };\n addNameSibling(ciRow, 'contractID', (v) => names.recordName('contract', v));\n result.ci = ciRow as unknown as ConfigurationItem;\n result.names = names.section;\n }\n return result;\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 * timezone-anchored date windows (issue #66, sub-ask 3).\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 *\n * The window family (the 11 kinds + customRange) mirrors the time-entry\n * helpers (issue #66) pinned to the invoice's date-time field\n * `invoiceDateTime` (the invoices model has no plain `invoiceDate` — its\n * date fields are `invoiceDateTime` + the range fields `fromDate`/`toDate`\n * + `dueDate`/`paidDate`/`voidedDate`). Same shared machinery\n * (src/resources/special/dateWindow.ts), same plain `items[]` shape, same\n * limits, same zone contract (explicit IANA `opts.tz` anchor; omitted `tz`\n * = UTC, bit-for-bit; `last24h` rolling and TZ-invariant). One bounded\n * `POST /V1.0/Invoices/query` per op (server-side `invoiceDateTime`\n * gte/lte); tests are synthetic-only.\n */\nimport { AutotaskError } from '../../errors.js';\nimport { decodeFileData } from '../base.js';\nimport type { HttpClient } from '../../http.js';\nexport type { DateWindowKind, DateWindowOptions } from './dateWindow.js';\nimport type { Invoice } from '../../types/invoices.js';\nimport type { Identifier } from '../../types/common.js';\nimport { parseIdentifier } from '../../utils/index.js';\nimport type { InvoicesResource } from '../invoices.js';\nimport {\n clampWindowLimit,\n customRangeQuery,\n dateWindowQuery,\n validateZone,\n type DateWindowKind,\n type DateWindowOptions,\n} from './dateWindow.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// =============================================================================\n// Timezone-anchored date windows (issue #66, sub-ask 3) — the full mirror of\n// the time-entry window family pinned to `invoiceDateTime` (the invoice's\n// date-time field — the model has no plain `invoiceDate`).\n// =============================================================================\n\n/** Window op: bounded `invoiceDateTime` gte/lte query over the pinned window. */\nexport async function windowQuery(\n _resource: InvoicesResource,\n kind: DateWindowKind,\n http: HttpClient,\n opts?: DateWindowOptions,\n): Promise<Invoice[]> {\n const now = opts?.now ?? new Date();\n const tz = opts?.tz === undefined ? undefined : validateZone(opts.tz, `invoices.${kind}`);\n return dateWindowQuery<Invoice>(\n http,\n '/V1.0/Invoices/query',\n 'invoiceDateTime',\n kind,\n clampWindowLimit(opts?.limit),\n `invoices.${kind}`,\n now,\n tz,\n );\n}\n\n/** customRange: explicit inclusive [from, to] `invoiceDateTime` bounds (both\n * required; UTC 'YYYY-MM-DD' days, or the local calendar days in `opts.tz`). */\nexport async function customRange(\n _resource: InvoicesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: DateWindowOptions,\n): Promise<Invoice[]> {\n const zone = opts?.tz === undefined ? undefined : validateZone(opts.tz, 'invoices.customRange');\n return customRangeQuery<Invoice>(\n http,\n '/V1.0/Invoices/query',\n 'invoiceDateTime',\n from,\n to,\n clampWindowLimit(opts?.limit),\n 'invoices.customRange',\n zone,\n );\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';\nimport type { DateWindowOptions } 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 customRange(from: string, to: string, opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.customRange(this, from, to, this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n last14(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'last14', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n last24h(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'last24h', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n last30(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'last30', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n last7(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'last7', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n last90(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'last90', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n lastFullFortnight(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'lastFullFortnight', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n lastFullMonth(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'lastFullMonth', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n lastFullQuarter(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'lastFullQuarter', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n lastFullWeek(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'lastFullWeek', this.http, opts);\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 /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n today(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'today', this.http, opts);\n }\n\n /** Node-parity special op (hand-written in src/resources/special/invoices.ts). */\n yesterday(opts?: DateWindowOptions): Promise<Invoice[]> {\n return invoicesSpecial.windowQuery(this, 'yesterday', this.http, opts);\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 { addNameSibling, createNamePlan, resolveCompositeNames, type CompositeContextOptions } from '../operations/compositeNames.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). `names: true` (issue #77)\n * adds the opt-in name siblings on the project row (creator name, contract name — the\n * closed scope; project picklists stay label-less) + the top-level `names` section;\n * `maxNameReads` may lower the name-read budget (default 20), never raise it. */\n async getContext(id: Identifier, opts: CompositeContextOptions = {}): 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 const result: ProjectContext = { project, company, opportunity, leadResource };\n if (opts.names === true) {\n const builder = createNamePlan();\n builder.addResource(root['creatorResourceID']);\n builder.addFk('contract', root['contractID']);\n const names = await resolveCompositeNames(this.http, builder.plan(), { maxNameReads: opts.maxNameReads });\n // The project record may be a ReadCache-stored object: the siblings ride a\n // SHALLOW COPY (they must never leak into the cached record).\n const row = { ...(project as unknown as Record<string, unknown>) };\n addNameSibling(row, 'creatorResourceID', (v) => names.resourceName(v));\n addNameSibling(row, 'contractID', (v) => names.recordName('contract', v));\n result.project = row as unknown as Project;\n result.names = names.section;\n }\n return result;\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 * `fresh: true` in the opts bag bypasses AND refreshes the ReadCache entry for this id\n * (the per-id authority read of operations.expandResourceNames with fresh: true — issue #77);\n * a plain get is the bit-for-bit cached read. */\n async get(id: Identifier, opts: { fresh?: boolean } = {}): Promise<Resource> {\n return this.getGlobal(id, opts.fresh === true);\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 *\n * Known vendor drift (issue #55): webservices29 answers this collection with\n * the singular item envelope `{ item }` where the spec prescribes\n * `{ items, pageDetails }`. A body that is EXACTLY `{ item: object | null }`\n * (no `items`, no other key) is mapped to `[item]` / `[]`; every other shape\n * still fails closed through unwrapItems (INVALID_RESPONSE).\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 if (typeof res === 'object' && res !== null && !Array.isArray(res)) {\n const keys = Object.keys(res);\n if (keys.length === 1 && keys[0] === 'item') {\n const item = (res as { item: unknown }).item;\n if (item === null) return [];\n if (typeof item === 'object' && !Array.isArray(item)) return [item as ResourceTimeOffAdditional];\n }\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';\nimport { addLabelSibling, addNameSibling, createNamePlan, resolveCompositeNames, TICKET_LABEL_FIELDS, type CompositeNamesSection } from '../../operations/compositeNames.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// validates targetStatus against the tenant's LIVE status picklist + the\n// live-discovered per-status required-field map). Both follow the\n// 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 tenant's LIVE entity metadata — the entity's\n// /entityInformation/fields through the cache-aware trio; tenant-specific,\n// never pinned in source) + the per-status required-field map\n// (LIVE-DISCOVERED by the S12-A discovery protocol; pinned as a DATA\n// 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 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 tenant's LIVE status picklist (zero record wire). */\nexport class StatusUnknownError extends AutotaskError {\n /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */\n readonly picklistCount: number;\n\n constructor(message: string, options: { operation?: string; picklistCount?: number } = {}) {\n super(message, {\n code: 'STATUS_UNKNOWN',\n category: 'validation',\n suggestedAction: 'Pass one of the tenant\\'s live status values (discover the current values + labels with operations.fieldCatalog({ resources: [\"tickets\"], fields: [\"status\"], labels: true })).',\n ...options,\n });\n this.name = 'StatusUnknownError';\n this.picklistCount = options.picklistCount ?? 0;\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/** The tenant's LIVE ticket status picklist from ONE `getFieldInfo` read\n * (empty set when the status row is missing or exposes no values — the\n * caller degrades to the vendor's own validation). */\nasync function readLiveStatusSet(resource: TicketsResource): Promise<ReadonlySet<number>> {\n const raw = await resource.getFieldInfo();\n const row = raw.find((f) => f.name === 'status');\n const values = row !== undefined && row.isPickList === true ? row.picklistValues : undefined;\n const ids = new Set<number>();\n if (Array.isArray(values)) {\n for (const pv of values) {\n const n = Number(pv.value);\n if (Number.isFinite(n)) ids.add(n);\n }\n }\n return ids;\n}\n\n/**\n * `changeStatus` — the status-composition write op (S12-A plan T2).\n *\n * (1) targetStatus is validated pre-request against the tenant's LIVE\n * status picklist — one cache-aware entity-metadata read (a fieldCache hit\n * costs zero wire; a cold cache costs one GET on the entity's\n * /entityInformation/fields): a value the live picklist lacks →\n * STATUS_UNKNOWN (zero record wire; issue #80: before the refusal the\n * guard invalidates the entity's field-cache entries and re-reads ONCE —\n * one extra metadata wire on the error path only, so a status added in\n * the UI is not refused against a cached picklist); the metadata\n * UNAVAILABLE (the read\n * failed, the status row is missing, or the vendor exposes no values — the\n * W-A4 wall) → the local guard degrades and the vendor's own validation\n * decides (the degradation is named in the dry-run warnings);\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 on a warm cache, 4 on a cold one; +2 per\n * discovery merge ≤3 → 6 max warm / 7 cold).\n * `dryRun: true` performs the metadata read + the one merge GET\n * (2 cold / 1 warm) and returns the simulated envelope with the resolved\n * merge body (zero mutating wire).\n */\n/** The dry-run warning naming the degraded live-status guard (the metadata\n * unavailable or vendor-walled — the vendor's own validation decides). */\nconst GUARD_DEGRADED_WARNING =\n 'the tenant\\'s live status picklist metadata was unavailable (the local guard is degraded for this call — the W-A4 wall or a metadata failure); the vendor\\'s own validation is the final authority on the status value';\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 LIVE picklist guard (the tenant's entity metadata is the oracle —\n // one cache-aware metadata read: zero wire on a fieldCache hit, one on a\n // cold cache; a non-numeric targetStatus is refused BEFORE the read, zero\n // wire). When the metadata is UNAVAILABLE the local guard degrades and the\n // vendor's own validation decides (the documented fallback — the degradation\n // is named in the dry-run warnings).\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 let liveStatus: ReadonlySet<number> | null = null;\n try {\n const ids = await readLiveStatusSet(resource);\n if (ids.size > 0) liveStatus = ids;\n } catch (err) {\n // a vendor/network failure of the metadata read: liveStatus stays null —\n // the vendor's own validation decides. A cancel or a programming error\n // is NOT a degraded guard: it propagates.\n if (!isAutotaskError(err) || err.code === 'ABORTED') throw err;\n }\n if (liveStatus !== null && !liveStatus.has(targetStatus)) {\n // Issue #80 (the fieldCache is default-on): a status ADDED IN THE UI\n // may be missing from a CACHED picklist (up to one TTL) — a wrong\n // refusal. Before throwing: drop the entity's field-cache entries and\n // re-read ONCE. A genuinely unknown status still refuses (one extra\n // metadata wire on the error path only); `fieldCache: false` makes the\n // invalidate a no-op and the re-read a plain wire read (today's\n // behaviour). A re-read that FAILS lets the first answer stand.\n http.fieldCache?.invalidate('tickets');\n let freshStatus: ReadonlySet<number> | null = null;\n let reReadFailed = false;\n try {\n const freshIds = await readLiveStatusSet(resource);\n if (freshIds.size > 0) freshStatus = freshIds;\n } catch (err) {\n // a cancel or a programming error is NOT a failed re-read: it\n // propagates (the #85 guard-catch semantics). A vendor/network\n // failure lets the first answer stand.\n if (!isAutotaskError(err) || err.code === 'ABORTED') throw err;\n freshStatus = null; // the re-read failed — the first answer stands\n reReadFailed = true;\n }\n if (freshStatus !== null && freshStatus.has(targetStatus)) {\n liveStatus = freshStatus; // the vendor now names it — continue\n } else {\n const verdict = freshStatus ?? liveStatus;\n // When the re-read produced no authoritative picklist (it failed, or\n // it succeeded with no values — an empty vendor response is not an\n // oracle), the verdict is the INITIAL answer, which under the\n // default-on fieldCache may be up to one TTL stale: the error names\n // it (the count is diagnostic, not a fresh oracle reading).\n const staleNote = freshStatus === null\n ? `; the live re-read ${reReadFailed ? 'failed' : 'returned no values'}, so this picklist count is from the initial read (up to one field-cache TTL old)`\n : '';\n throw new StatusUnknownError(\n `changeStatus: targetStatus ${targetStatus} is not in the tenant's live status picklist (live: ${verdict.size} values — the entity metadata is the oracle; the values + labels are discoverable with operations.fieldCatalog({ resources: [\"tickets\"], fields: [\"status\"], labels: true })${staleNote})`,\n { operation: OP_STATUS, picklistCount: verdict.size },\n );\n }\n }\n const guardDegraded = liveStatus === null;\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: [\n ...(guardDegraded ? [GUARD_DEGRADED_WARNING] : []),\n `NO_CHANGE: the ticket is already in the target status ${targetStatus} — the apply would be a zero-wire no-op.`,\n ],\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 (guardDegraded) warnings.push(GUARD_DEGRADED_WARNING);\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 /** Opt-in name/label siblings (issue #77; default OFF — the sibling keys are ABSENT, not null, and no name/label resolution runs: zero added wire, byte-identical output). ON: the ticket row and each time-entry row carry the closed-scope siblings (the ticket picklist labels — status / priority / ticketType / issueType / subIssueType / source / queue — plus the contract / billing-code / role record-FK names and the resource names — creator + the time-entry resource) and the top-level `names` section. */\n names?: boolean;\n /** May LOWER the composite's name-read budget (default 20 — the count of COLD wire reads issued for name resolution; cache hits are free of the budget). The caller may lower it, never raise it; over-budget ids serve `name: null, capped: true` (never an error). */\n maxNameReads?: 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) — or any name read hit the name-read budget (issue #77, `names: true`). */\n truncated: boolean;\n /** The opt-in name/label section (issue #77) — present EXACTLY when `names: true` (the sibling keys are absent from the rows otherwise). */\n names?: CompositeNamesSection;\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 // 3) The opt-in name/label siblings (issue #77; default OFF — the ABSENT\n // sibling keys keep the byte-identical shape, zero added wire). The\n // closed scope (OQ1): the ticket picklist labels + the record-FK names\n // (contract / billing code / role) + the resource names (creator + the\n // time-entry resource), de-duplicated ACROSS THE WHOLE COMPOSITE. The\n // budget (`maxNameReads`, default 20) counts COLD wire name reads only\n // (cache hits are free); over-budget ids serve name: null + capped —\n // never an error (the section's truncated marker rides `truncated`).\n if (opts.names === true) {\n const builder = createNamePlan(TICKET_LABEL_FIELDS);\n const t = ctx.ticket as unknown as Record<string, unknown>;\n builder.addResource(t['creatorResourceID']);\n builder.addFk('contract', t['contractID']);\n builder.addFk('billingCode', t['billingCodeID']);\n builder.addFk('role', t['assignedResourceRoleID']);\n for (const e of entriesPart.items) {\n builder.addResource(e['resourceID']);\n builder.addFk('role', e['roleID']);\n builder.addFk('billingCode', e['billingCodeID']);\n builder.addFk('contract', e['contractID']);\n }\n const names = await resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });\n // The ticket row rides a SHALLOW COPY: the ctx record is the ReadCache\n // envelope's item — the siblings must never leak into the cached record.\n const ticketRow = { ...(ctx.ticket as unknown as Record<string, unknown>) };\n addNameSibling(ticketRow, 'creatorResourceID', (v) => names.resourceName(v));\n addNameSibling(ticketRow, 'contractID', (v) => names.recordName('contract', v));\n addNameSibling(ticketRow, 'billingCodeID', (v) => names.recordName('billingCode', v));\n addNameSibling(ticketRow, 'assignedResourceRoleID', (v) => names.recordName('role', v));\n for (const f of TICKET_LABEL_FIELDS) addLabelSibling(ticketRow, f, names);\n result.ticket = ticketRow as unknown as Ticket;\n // The time-entry rows stay raw records — siblings added per row (copies:\n // the entries part is query-served, but the rule is uniform).\n result.timeEntries.items = entriesPart.items.map((e) => {\n const row = { ...e };\n addNameSibling(row, 'resourceID', (v) => names.resourceName(v));\n addNameSibling(row, 'roleID', (v) => names.recordName('role', v));\n addNameSibling(row, 'billingCodeID', (v) => names.recordName('billingCode', v));\n addNameSibling(row, 'contractID', (v) => names.recordName('contract', v));\n return row;\n });\n result.names = names.section;\n result.truncated = result.truncated || names.section.truncated;\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. Issue #66 (sub-ask 3) makes the zone\n * OPT-IN: `opts.tz` (an IANA zone) anchors the window's calendar day/period\n * in that zone — computed locally and converted to UTC for the wire —\n * while omitted `tz` keeps the UTC behaviour bit-for-bit (the node-parity\n * timezone behaviour is now available on demand).\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';\nimport {\n clampWindowLimit,\n customRangeDay,\n dateWindowBounds,\n localDayEndMs,\n validateZone,\n type DateWindowKind,\n type DateWindowOptions,\n} from './dateWindow.js';\n\n/** The shared window opts (issue #66: the `DateWindowOptions` shape — `now`,\n * `limit`, and the `tz` IANA-zone anchor; omitted `tz` = UTC, the current\n * behaviour bit-for-bit) under its historical name. */\nexport type TimeEntriesWindowOptions = DateWindowOptions;\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;\n\n/** The 11 window kinds under their historical name (the shared\n * `DateWindowKind` from src/resources/special/dateWindow.ts — issue #66). */\nexport type TimeEntriesWindowKind = DateWindowKind;\n\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 (inclusive, second-precision UTC ISO) — delegates to the\n * shared `dateWindowBounds` (issue #66): rolling windows start at the day\n * start N days back; full-period windows cover the last COMPLETE ISO week /\n * fortnight / month / quarter. The exported signature `(kind, now)` is\n * unchanged — the tz-anchored variant is the shared function\n * (`dateWindowBounds(kind, now, tz)`), which `windowQuery`/`customRange` /\n * `postedWithin` reach through `opts.tz`.\n */\nexport function timeEntriesWindowBounds(kind: TimeEntriesWindowKind, now: Date): { from: string; to: string } {\n return dateWindowBounds(kind, now);\n}\n\nasync function queryTimeEntries(\n _resource: TimeEntriesResource,\n filter: unknown,\n limit: number,\n operation: string,\n http: HttpClient,\n): Promise<{ items: TimeEntry[]; hasMore: boolean }> {\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 const { items, pageDetails } = unwrapItems<TimeEntry>(res);\n // `pageDetails.requestCount` echoes the requested MaxRecords, NOT a match\n // count (live-verified: MaxRecords 5 -> requestCount 5 over 13k matches) —\n // the truncated signal is a live next-page cursor (issue #66).\n // The window-family callers keep consuming `.items` (zero behaviour change).\n return { items, hasMore: pageDetails.nextPageUrl != null };\n}\n\n/** Window op: bounded `dateWorked` gte/lte query over the pinned window (zone-anchored via `opts.tz` — the window's calendar day/period in that zone, converted to UTC; omitted `tz` = UTC, bit-for-bit). */\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 tz = opts?.tz === undefined ? undefined : validateZone(opts.tz, `time_entries.${kind}`);\n const { from, to } = dateWindowBounds(kind, now, tz);\n const filter = [\n { field: 'dateWorked', op: 'gte', value: from },\n { field: 'dateWorked', op: 'lte', value: to },\n ];\n const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(opts?.limit), `time_entries.${kind}`, http);\n return items;\n}\n\n/** customRange: explicit inclusive [from, to] `dateWorked` bounds (both\n * required; UTC 'YYYY-MM-DD' days — or the local calendar days in `opts.tz`,\n * converted to UTC; omitted `tz` = the current UTC-day semantics, bit-for-bit). */\nexport async function customRange(\n _resource: TimeEntriesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: TimeEntriesWindowOptions,\n): Promise<TimeEntry[]> {\n const zone = opts?.tz === undefined ? undefined : validateZone(opts.tz, 'time_entries.customRange');\n const fromB = customRangeDay(from, 'from', zone, 'customRange');\n const toB = customRangeDay(to, 'to', zone, 'customRange');\n if (fromB.ms > toB.ms) {\n throw new AutotaskConfigError('customRange: from must not be after to');\n }\n const toEndMs = zone === undefined ? toB.ms + DAY_MS - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);\n const filter = [\n { field: 'dateWorked', op: 'gte', value: iso(fromB.ms) },\n { field: 'dateWorked', op: 'lte', value: iso(toEndMs) },\n ];\n const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(opts?.limit), 'time_entries.customRange', http);\n return items;\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 const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(opts?.limit), operation, http);\n return items;\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 /** IANA timezone (e.g. 'Australia/Sydney') — the from/to bounds are the LOCAL calendar days in that zone (from-day start / to-day end, converted to UTC for the wire); omitted = UTC days (the current behaviour, bit-for-bit). */\n tz?: string;\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 /** True when the vendor reports more matching records than the bounded read returned (a live `pageDetails.nextPageUrl` cursor) — the posted/unposted counts then cover the returned rows ONLY (at most `limit`); re-query with a wider window or a narrowing filter to reconcile the totals. */\n truncated: boolean;\n}\n\n/**\n * postedWithin: a bounded read over an inclusive `dateWorked` window\n * [from, to] that reports what is posted — the window is ON the `dateWorked`\n * field (the `posted` narrowing is a server-side `postedDate exist|notExist`\n * predicate, not a second query) and the posted/unposted counts are counted\n * over the returned items in that same pass — ONE server-filtered query.\n * `from`/`to` are `YYYY-MM-DD` date strings (the customRange convention —\n * string positionals keep the S1c signature/schema contract; UTC calendar\n * days, or the local calendar days in `opts.tz` when a zone is given); the\n * window is inclusive on both bounds (gte the from-day start, lte the to-day\n * end). No vendor values are invented: the counts cover the returned rows\n * ONLY (at most `limit`) — `truncated` is true when the vendor still\n * has a next page (`pageDetails.nextPageUrl`) past the bound.\n */\nexport async function postedWithin(\n _resource: TimeEntriesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: TimeEntriesPostedWindowOptions,\n opLabel = 'time_entries.postedWithin',\n): Promise<TimeEntriesPostedWindowResult> {\n // The op label drives ONLY the `http.request` operation identity (governor\n // / invoke / live-coverage op-call identity) + the error prefixes — the\n // wire body, filters, counts and result are identical (the alias\n // `dateWorkedWindow` passes its own label).\n const OP = opLabel;\n // Issue #66 (sub-ask 3): the bounds are UTC calendar days, or the LOCAL\n // calendar days in `opts.tz` (from-day start / to-day end, converted to\n // UTC) — omitted `tz` keeps the UTC math bit-for-bit.\n const zone = opts?.tz === undefined ? undefined : validateZone(opts.tz, OP);\n const fromB = customRangeDay(from, 'from', zone, OP);\n const toB = customRangeDay(to, 'to', zone, OP);\n if (fromB.ms > toB.ms) {\n throw new AutotaskConfigError(`${OP}: from (${iso(fromB.ms)}) must not be after to (${iso(toB.ms)})`, { operation: OP });\n }\n // Inclusive to-day end (the customRange convention) — the NEXT local\n // midnight minus 1 ms in the zone (DST-safe); UTC: start + DAY_MS - 1.\n const windowToMs = zone === undefined ? toB.ms + DAY_MS - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);\n const filter: Array<{ field: string; op: string; value?: unknown }> = [\n { field: 'dateWorked', op: 'gte', value: iso(fromB.ms) },\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, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(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(fromB.ms), to: iso(windowToMs) },\n // A live next-page cursor past the bounded read: the counts above cover\n // the returned rows ONLY when this is true (issue #66 AC1 — the 500-row cap case is the general case).\n truncated: hasMore,\n };\n}\n\n/**\n * dateWorkedWindow: the clearer-named alias for `postedWithin` (issue #66) —\n * the same implementation (same wire: ONE bounded query over the inclusive\n * dateWorked window, same result including `truncated`). Its only difference\n * is the op identity: the `operation` label is `time_entries.dateWorkedWindow`\n * (the governor / invoke / live-coverage op-call identity) and it carries its\n * own plan row / MCP tool (`autotask_timeEntry_date_worked_window`). The name\n * names the field the window is on — the `posted` narrowing is a server-side\n * predicate, not the window's anchor.\n */\nexport async function dateWorkedWindow(\n resource: TimeEntriesResource,\n from: string,\n to: string,\n http: HttpClient,\n opts?: TimeEntriesPostedWindowOptions,\n): Promise<TimeEntriesPostedWindowResult> {\n return postedWithin(resource, from, to, http, opts, 'time_entries.dateWorkedWindow');\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 (operations.fieldCatalog, 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, TimeEntriesPostedWindowOptions, TimeEntriesPostedWindowResult, TimeEntriesStatusOptions } 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 dateWorkedWindow(from: string, to: string, opts?: TimeEntriesPostedWindowOptions): Promise<TimeEntriesPostedWindowResult> {\n return timeentriesSpecial.dateWorkedWindow(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,uBAAN,cAAmC,aAAgE;AAAA,EACxG,YAAY,MAAkB,UAAkB;AAC9C,UAAM,MAAM;AAAA,MACV,KAAK;AAAA,MACL,cAAc;AAAA,MACd,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,kBAAkB;AAAA;AAAA,IACpB,GAAG,QAAQ;AAAA,EACb;AAAA;AAAA,EAGA,MAAM,QAAsE;AAC1E,WAAO,KAAK,WAAW,MAAM;AAAA,EAC/B;AAAA;AAAA,EAGA,MAAM,SAAS,QAAkE;AAC/E,WAAO,KAAK,cAAc,MAAM;AAAA,EAClC;AAAA;AAAA,EAGA,MAA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MAAsB;AAAA,EACV;AAAA,EAEjB,YAAY,MAAkB;AAC5B,SAAK,OAAO;AAAA,EACd;AAAA;AAAA,EAGA,MAA2C;AACzC,WAAO,KAAK,KAAK,QAAoC;AAAA,MACnD,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,IACb,CAAC;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":["DEFAULT_LIMIT","MAX_LIMIT","PROFILE_PART_LIMIT","profilePartLimit","fetchRecord","windowQuery","customRange","customRange","windowQuery","getByResource","getByResource","num","DAY_MS","iso","windowQuery","customRange","DAY_MS","iso","OP","MAX_DISCOVERY_MERGES","fetchItem","customRange","windowQuery"]}
|