node-autotask 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/ARCHITECTURE.md +54 -12
  2. package/N8N_MCP_MANIFEST.json +2 -2
  3. package/N8N_MCP_MANIFEST.md +3 -3
  4. package/README.md +9 -3
  5. package/dist/{chunk-C7U3ZRRK.js → chunk-2QLOK7PX.js} +27 -31
  6. package/dist/{chunk-C7U3ZRRK.js.map → chunk-2QLOK7PX.js.map} +1 -1
  7. package/dist/{chunk-LDKIIVFV.cjs → chunk-CQIZDSBE.cjs} +272 -276
  8. package/dist/chunk-CQIZDSBE.cjs.map +1 -0
  9. package/dist/{chunk-QUFEIJEB.cjs → chunk-DA73ALND.cjs} +136 -138
  10. package/dist/chunk-DA73ALND.cjs.map +1 -0
  11. package/dist/{chunk-GNS47RBV.js → chunk-IUJJPWUX.js} +612 -18
  12. package/dist/chunk-IUJJPWUX.js.map +1 -0
  13. package/dist/{chunk-RFXGG37L.cjs → chunk-IV2Z3JLR.cjs} +680 -86
  14. package/dist/chunk-IV2Z3JLR.cjs.map +1 -0
  15. package/dist/{chunk-ONPT4PIV.js → chunk-PAQXQFGG.js} +4 -6
  16. package/dist/{chunk-ONPT4PIV.js.map → chunk-PAQXQFGG.js.map} +1 -1
  17. package/dist/index.cjs +120 -27
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +129 -3
  20. package/dist/index.d.ts +129 -3
  21. package/dist/index.js +156 -63
  22. package/dist/index.js.map +1 -1
  23. package/dist/operations/index.cjs +113 -116
  24. package/dist/operations/index.cjs.map +1 -1
  25. package/dist/operations/index.js +9 -12
  26. package/dist/operations/index.js.map +1 -1
  27. package/dist/pool.cjs +8 -11
  28. package/dist/pool.cjs.map +1 -1
  29. package/dist/pool.js +4 -7
  30. package/dist/pool.js.map +1 -1
  31. package/dist/resources/index.cjs +3 -5
  32. package/dist/resources/index.cjs.map +1 -1
  33. package/dist/resources/index.js +2 -4
  34. package/package.json +9 -3
  35. package/dist/chunk-5QVXRT3A.cjs +0 -580
  36. package/dist/chunk-5QVXRT3A.cjs.map +0 -1
  37. package/dist/chunk-FE225M76.js +0 -580
  38. package/dist/chunk-FE225M76.js.map +0 -1
  39. package/dist/chunk-GNS47RBV.js.map +0 -1
  40. package/dist/chunk-IFXFOYDU.cjs +0 -32
  41. package/dist/chunk-IFXFOYDU.cjs.map +0 -1
  42. package/dist/chunk-LDKIIVFV.cjs.map +0 -1
  43. package/dist/chunk-OOEVTGP4.js +0 -121
  44. package/dist/chunk-OOEVTGP4.js.map +0 -1
  45. package/dist/chunk-PBBFMRI5.cjs +0 -121
  46. package/dist/chunk-PBBFMRI5.cjs.map +0 -1
  47. package/dist/chunk-QF4K3XTK.js +0 -32
  48. package/dist/chunk-QF4K3XTK.js.map +0 -1
  49. package/dist/chunk-QUFEIJEB.cjs.map +0 -1
  50. package/dist/chunk-RFXGG37L.cjs.map +0 -1
  51. package/dist/credential-shape.cjs +0 -15
  52. package/dist/credential-shape.cjs.map +0 -1
  53. package/dist/credential-shape.d.cts +0 -52
  54. package/dist/credential-shape.d.ts +0 -52
  55. package/dist/credential-shape.js +0 -15
  56. package/dist/credential-shape.js.map +0 -1
  57. package/dist/credentials.cjs +0 -17
  58. package/dist/credentials.cjs.map +0 -1
  59. package/dist/credentials.d.cts +0 -78
  60. package/dist/credentials.d.ts +0 -78
  61. package/dist/credentials.js +0 -17
  62. package/dist/credentials.js.map +0 -1
@@ -1,121 +0,0 @@
1
- import {
2
- AutotaskConfigError
3
- } from "./chunk-FE225M76.js";
4
- import {
5
- CREDENTIAL_ENV_LOAD_ACTION,
6
- credentialShapeProblem,
7
- credentialValueSummary
8
- } from "./chunk-QF4K3XTK.js";
9
-
10
- // src/credentials.ts
11
- import { existsSync, readFileSync } from "fs";
12
- var DEFAULT_NAMES = {
13
- apiCodeVar: "AUTOTASK_TRACKING_IDENTIFIER",
14
- userVar: "AUTOTASK_USERNAME",
15
- secretVar: "AUTOTASK_SECRET",
16
- impersonationVar: "AUTOTASK_IMPERSONATION_ID"
17
- };
18
- var ALIASES = {
19
- AUTOTASK_TRACKING_IDENTIFIER: ["AUTOTASK_API_CODE", "AUTOTASK_API_INTEGRATION_CODE"],
20
- AUTOTASK_USERNAME: ["AUTOTASK_USER"]
21
- };
22
- function presenceError(name, source) {
23
- return new AutotaskConfigError(
24
- `${source}: ${name} is not set (or is empty after shell-equivalent loading)`,
25
- {
26
- suggestedAction: `Set ${name} before running (see the "Credentials & env files" section of the README).`
27
- }
28
- );
29
- }
30
- function shapeError(name, value, source) {
31
- return new AutotaskConfigError(
32
- `${source}: ${name} ${CREDENTIAL_ENV_LOAD_ACTION} [${credentialValueSummary(value)}]`,
33
- {
34
- code: "INVALID_CREDENTIAL_SHAPE",
35
- suggestedAction: "Load the credential file with the shell (`set -a; . ./.env; set +a`), use loadAutotaskCredentialEnvFile(path), or fix the quoted/contaminated value; no request was sent."
36
- }
37
- );
38
- }
39
- function normalizeCredentialValue(raw) {
40
- const dequoted = raw.replace(/^'([\s\S]*)'$/, "$1").replace(/^"([\s\S]*)"$/, "$1");
41
- return dequoted.replace(/^\r+|\r+$/g, "").trim();
42
- }
43
- function parseCredentialEnvText(text) {
44
- const out = [];
45
- for (const rawLine of text.split(/\r?\n/)) {
46
- const line = rawLine.trim();
47
- if (line.length === 0 || line.startsWith("#")) continue;
48
- const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*([^]*)$/.exec(line);
49
- if (!match) continue;
50
- out.push({ key: match[1], value: normalizeCredentialValue(match[2]) });
51
- }
52
- return out;
53
- }
54
- function readCredentialEnvFile(path) {
55
- if (!existsSync(path)) {
56
- throw new AutotaskConfigError(`credential env file not found: ${path}`, {
57
- suggestedAction: "Check the path, or create the file with the credentials your host needs."
58
- });
59
- }
60
- const out = /* @__PURE__ */ Object.create(null);
61
- for (const { key, value } of parseCredentialEnvText(readFileSync(path, "utf8"))) out[key] = value;
62
- return out;
63
- }
64
- function pickAlias(values, canonical) {
65
- for (const name of [canonical, ...ALIASES[canonical] ?? []]) {
66
- const raw = values[name];
67
- if (raw !== void 0 && raw.trim().length > 0) return { name, raw };
68
- }
69
- return void 0;
70
- }
71
- function loadAutotaskCredentialEnvFile(path, names = {}) {
72
- const resolved = { ...DEFAULT_NAMES, ...names };
73
- const values = readCredentialEnvFile(path);
74
- return pickCredentials(values, resolved, `credential env file ${path}`, true);
75
- }
76
- function loadAutotaskCredentialsFromEnv(env = process.env, names = {}) {
77
- const resolved = { ...DEFAULT_NAMES, ...names };
78
- return pickCredentials(env, resolved, "environment", false);
79
- }
80
- function pickCredentials(values, names, source, canonical) {
81
- const picked = {};
82
- for (const variable of [names.apiCodeVar, names.userVar, names.secretVar, names.impersonationVar]) {
83
- const chosen = canonical ? values[variable] !== void 0 ? { name: variable, raw: values[variable] } : void 0 : pickAlias(values, variable);
84
- picked[variable] = chosen;
85
- }
86
- const apiCode = picked[names.apiCodeVar];
87
- const user = picked[names.userVar];
88
- const secret = picked[names.secretVar];
89
- if (apiCode === void 0) throw presenceError(names.apiCodeVar, source);
90
- if (user === void 0) throw presenceError(names.userVar, source);
91
- if (secret === void 0) throw presenceError(names.secretVar, source);
92
- const out = {};
93
- for (const [name, entry] of [
94
- [names.apiCodeVar, apiCode],
95
- [names.userVar, user],
96
- [names.secretVar, secret],
97
- [names.impersonationVar, picked[names.impersonationVar]]
98
- ]) {
99
- if (entry === void 0) continue;
100
- const value = normalizeCredentialValue(entry.raw);
101
- if (credentialShapeProblem(value, { skipEdgeWhitespace: true }) !== void 0) {
102
- throw shapeError(name, value, source);
103
- }
104
- out[name] = value;
105
- }
106
- return {
107
- apiIntegrationCode: out[names.apiCodeVar],
108
- userName: out[names.userVar],
109
- secret: out[names.secretVar],
110
- ...out[names.impersonationVar] !== void 0 ? { impersonationResourceId: out[names.impersonationVar] } : {}
111
- };
112
- }
113
-
114
- export {
115
- normalizeCredentialValue,
116
- parseCredentialEnvText,
117
- readCredentialEnvFile,
118
- loadAutotaskCredentialEnvFile,
119
- loadAutotaskCredentialsFromEnv
120
- };
121
- //# sourceMappingURL=chunk-OOEVTGP4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/credentials.ts"],"sourcesContent":["/**\n * Canonical credential loading for node-autotask hosts (live scripts, MCP servers, test harnesses).\n *\n * The SDK itself never reads `process.env` for a request: env-override is a host concern. These\n * helpers are the HOST half, exported so no host has to hand-roll a parser — the hand-rolled,\n * quote-preserving parser is exactly what produced the 2026-10-07 incident.\n *\n * ## The single-quote contract\n *\n * A `.env` value may be SINGLE-QUOTED on purpose, because a secret containing `$` must be\n * single-quoted so the shell does not expand it (`AUTOTASK_SECRET='a$b c'`). The canonical load is\n * the shell's own — the recipe `loadAutotaskCredentialEnvFile` implements, and the one the docs\n * recommend:\n *\n * ```sh\n * set -a; . ./.env; set +a\n * ```\n *\n * The shell strips ONE pair of matching surrounding quotes (single or double) and leaves the\n * inner characters alone: `'a$b c'` loads as `a$b c`, literally. A quote-preserving loader (most\n * `dotenv` variants, `split('=')`) hands `'a$b c'` to the SDK with the quotes intact; that value\n * is printable ASCII, passes the transport's checks, reaches the vendor, and comes back as an\n * opaque 401 that looks like bad credentials.\n *\n * `loadAutotaskCredentialsFromEnv` therefore strips ONE pair of matching surrounding single OR\n * double quotes, is CRLF-safe, strips edge whitespace, and then refuses a value that still looks\n * shell-quoted or line-break contaminated (see `src/credential-shape.ts`) with\n * `AutotaskConfigError`. A `$` inside single quotes is NOT expanded: this loader is neither a\n * shell nor an expander.\n *\n * Failures are value-free: a message names the variable, never the value; a summary is a length\n * plus a two-character prefix only.\n */\nimport { existsSync, readFileSync } from 'node:fs';\nimport {\n CREDENTIAL_ENV_LOAD_ACTION,\n credentialShapeProblem,\n credentialValueSummary,\n} from './credential-shape.js';\nimport { AutotaskConfigError } from './errors.js';\n\n/**\n * The variable names an Autotask host loads. The three credential names are the canonical\n * spellings (the official API-User-Security terms: Tracking Identifier / Username /\n * Password-Secret). The two DEPRECATED aliases the live scripts still accept\n * (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE` for the tracking identifier,\n * `AUTOTASK_USER` for the username) are read as fall-backs, canonical first.\n */\nexport interface AutotaskCredentialNames {\n /** Tracking-identifier variable. Default `AUTOTASK_TRACKING_IDENTIFIER`. */\n apiCodeVar?: string;\n /** Username variable. Default `AUTOTASK_USERNAME`. */\n userVar?: string;\n /** Password/secret variable. Default `AUTOTASK_SECRET`. */\n secretVar?: string;\n /** Optional impersonation resource id variable. Default `AUTOTASK_IMPERSONATION_ID`. */\n impersonationVar?: string;\n}\n\n/** A loaded, shape-validated Autotask credential set. */\nexport interface AutotaskCredentials {\n /** The tracking identifier (header `ApiIntegrationCode`), shell-equivalent loaded. */\n apiIntegrationCode: string;\n /** The username (header `UserName`), shell-equivalent loaded. */\n userName: string;\n /** The secret (header `Secret`), with ONE pair of surrounding quotes removed when quoted. */\n secret: string;\n /** The optional impersonation resource id (header `ImpersonationResourceId`), when set. */\n impersonationResourceId?: string;\n}\n\n/** The canonical variable names (the first entry of each alias list is the default). */\nconst DEFAULT_NAMES: Required<AutotaskCredentialNames> = {\n apiCodeVar: 'AUTOTASK_TRACKING_IDENTIFIER',\n userVar: 'AUTOTASK_USERNAME',\n secretVar: 'AUTOTASK_SECRET',\n impersonationVar: 'AUTOTASK_IMPERSONATION_ID',\n};\n\n/** The DEPRECATED aliases the live scripts still accept, per canonical variable. */\nconst ALIASES: Record<string, readonly string[]> = {\n AUTOTASK_TRACKING_IDENTIFIER: ['AUTOTASK_API_CODE', 'AUTOTASK_API_INTEGRATION_CODE'],\n AUTOTASK_USERNAME: ['AUTOTASK_USER'],\n};\n\n/** Fail closed, value-free: the variable is named, its value never is. */\nfunction presenceError(name: string, source: string): AutotaskConfigError {\n return new AutotaskConfigError(\n `${source}: ${name} is not set (or is empty after shell-equivalent loading)`,\n {\n suggestedAction: `Set ${name} before running (see the \"Credentials & env files\" section of the README).`,\n },\n );\n}\n\n/**\n * Refuse a value that still carries a shell-quoting or line-break artifact after loading, with the\n * env-load pitfall appended. Value-free: the message names the variable and the summary carries a\n * length plus a two-character prefix only.\n */\nfunction shapeError(name: string, value: string, source: string): AutotaskConfigError {\n return new AutotaskConfigError(\n `${source}: ${name} ${CREDENTIAL_ENV_LOAD_ACTION} [${credentialValueSummary(value)}]`,\n {\n code: 'INVALID_CREDENTIAL_SHAPE',\n suggestedAction:\n 'Load the credential file with the shell (`set -a; . ./.env; set +a`), use ' +\n 'loadAutotaskCredentialEnvFile(path), or fix the quoted/contaminated value; no request was sent.',\n },\n );\n}\n\n/**\n * Shell-equivalent value handling: strip ONE pair of matching surrounding single OR double quotes\n * (only `'x'`/`\"x\"`, never `'x\"`), drop a `\\r` left by a CRLF file, and trim edge whitespace.\n * The inner characters are never unescaped or expanded — a `$` inside single quotes is literal,\n * exactly as the shell delivers it.\n */\nexport function normalizeCredentialValue(raw: string): string {\n const dequoted = raw.replace(/^'([\\s\\S]*)'$/, '$1').replace(/^\"([\\s\\S]*)\"$/, '$1');\n return dequoted.replace(/^\\r+|\\r+$/g, '').trim();\n}\n\n/** One parsed `key=value` line from an env file. */\nexport interface CredentialEnvLine {\n key: string;\n value: string;\n}\n\n/**\n * Minimal shell-sourcing-equivalent `.env` parser: `key=value` per line, `#` comments, an optional\n * `export ` prefix, and ONE pair of matching surrounding quotes stripped from the value. Blank\n * lines are skipped. This is deliberately NOT a general dotenv implementation: no `$` expansion,\n * no multi-line values, no command substitution — a credential file should need none of them.\n */\nexport function parseCredentialEnvText(text: string): CredentialEnvLine[] {\n const out: CredentialEnvLine[] = [];\n for (const rawLine of text.split(/\\r?\\n/)) {\n const line = rawLine.trim();\n if (line.length === 0 || line.startsWith('#')) continue;\n // `[^]*` (any character, newlines included), not `.`: a bare CR is a line terminator for `.`,\n // so a value with an interior CR would fail the match and the variable would be reported as\n // MISSING instead of as shape-contaminated. The CR must reach the value, where the shape check\n // names it. (CRLF is already split into lines above; this is the stray-CR case.)\n const match = /^(?:export\\s+)?([A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*([^]*)$/.exec(line);\n if (!match) continue;\n out.push({ key: match[1] as string, value: normalizeCredentialValue(match[2] as string) });\n }\n return out;\n}\n\n/**\n * Read a `key=value` env file with shell-equivalent value handling and return its own key/value\n * map. Use it when the host wants the whole file; {@link loadAutotaskCredentialsFromEnv} uses it to\n * read the AUTOTASK_* variables. Throws `AutotaskConfigError` (code `CONFIG_ERROR`) when the path\n * does not exist or is not a regular file.\n */\nexport function readCredentialEnvFile(path: string): Record<string, string> {\n if (!existsSync(path)) {\n throw new AutotaskConfigError(`credential env file not found: ${path}`, {\n suggestedAction: 'Check the path, or create the file with the credentials your host needs.',\n });\n }\n const out: Record<string, string> = Object.create(null) as Record<string, string>;\n for (const { key, value } of parseCredentialEnvText(readFileSync(path, 'utf8'))) out[key] = value;\n return out;\n}\n\n/** The FIRST alias (plus the canonical name) that carries a non-empty value, or `undefined`. */\nfunction pickAlias(\n values: Record<string, string | undefined>,\n canonical: string,\n): { name: string; raw: string } | undefined {\n for (const name of [canonical, ...(ALIASES[canonical] ?? [])]) {\n const raw = values[name];\n if (raw !== undefined && raw.trim().length > 0) return { name, raw };\n }\n return undefined;\n}\n\n/**\n * Load the Autotask credentials from an env FILE with the shell's own value handling (the\n * single-quote contract above). Pass the result to\n * `new AutotaskClient({ ...creds })`.\n *\n * The values go through {@link normalizeCredentialValue} and then the shape check, so a\n * quote-preserving load is impossible here; a contaminated value fails `AutotaskConfigError` with\n * code `INVALID_CREDENTIAL_SHAPE` and NO request is ever sent.\n */\nexport function loadAutotaskCredentialEnvFile(\n path: string,\n names: AutotaskCredentialNames = {},\n): AutotaskCredentials {\n const resolved = { ...DEFAULT_NAMES, ...names };\n const values = readCredentialEnvFile(path);\n return pickCredentials(values, resolved, `credential env file ${path}`, true);\n}\n\n/**\n * Load the Autotask credentials from a process-env-shaped record (default `process.env`) using the\n * SAME shell-equivalent value handling and shape checks as the file loader — the one path the\n * live scripts, a shell-sourced env and a caller-supplied record all share.\n *\n * Values already correct in `process.env` are returned unchanged; a value that was placed there\n * with its quotes intact (e.g. by a quote-preserving loader) is repaired by the same ONE-pair\n * strip, and a value that no load can repair fails closed. The two DEPRECATED aliases\n * (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE`, `AUTOTASK_USER`) are read as fall-backs\n * when the canonical variable is unset or blank — canonical first.\n */\nexport function loadAutotaskCredentialsFromEnv(\n env: Record<string, string | undefined> = process.env as Record<string, string | undefined>,\n names: AutotaskCredentialNames = {},\n): AutotaskCredentials {\n const resolved = { ...DEFAULT_NAMES, ...names };\n return pickCredentials(env as Record<string, string | undefined>, resolved, 'environment', false);\n}\n\n/**\n * Presence + shape gates shared by both loaders, so neither can drift from the other. `canonical`\n * is true for the file loader (exact canonical names only — a file is read by name, not aliased).\n */\nfunction pickCredentials(\n values: Record<string, string | undefined>,\n names: Required<AutotaskCredentialNames>,\n source: string,\n canonical: boolean,\n): AutotaskCredentials {\n const picked: Record<string, { name: string; raw: string } | undefined> = {};\n for (const variable of [names.apiCodeVar, names.userVar, names.secretVar, names.impersonationVar]) {\n const chosen = canonical\n ? (values[variable] !== undefined ? { name: variable, raw: values[variable] as string } : undefined)\n : pickAlias(values, variable);\n picked[variable] = chosen;\n }\n const apiCode = picked[names.apiCodeVar];\n const user = picked[names.userVar];\n const secret = picked[names.secretVar];\n if (apiCode === undefined) throw presenceError(names.apiCodeVar, source);\n if (user === undefined) throw presenceError(names.userVar, source);\n if (secret === undefined) throw presenceError(names.secretVar, source);\n\n // A CR keeps an inner one (CRLF is gone after the normalizer): only quotes and edge whitespace\n // can survive the loader, so those are the checks it owns.\n const out: Record<string, string> = {};\n for (const [name, entry] of [\n [names.apiCodeVar, apiCode],\n [names.userVar, user],\n [names.secretVar, secret],\n [names.impersonationVar, picked[names.impersonationVar]],\n ] as const) {\n if (entry === undefined) continue;\n const value = normalizeCredentialValue(entry.raw);\n if (credentialShapeProblem(value, { skipEdgeWhitespace: true }) !== undefined) {\n throw shapeError(name, value, source);\n }\n out[name] = value;\n }\n return {\n apiIntegrationCode: out[names.apiCodeVar] as string,\n userName: out[names.userVar] as string,\n secret: out[names.secretVar] as string,\n ...(out[names.impersonationVar] !== undefined\n ? { impersonationResourceId: out[names.impersonationVar] as string }\n : {}),\n };\n}\n"],"mappings":";;;;;;;;;;AAiCA,SAAS,YAAY,oBAAoB;AAuCzC,IAAM,gBAAmD;AAAA,EACvD,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,kBAAkB;AACpB;AAGA,IAAM,UAA6C;AAAA,EACjD,8BAA8B,CAAC,qBAAqB,+BAA+B;AAAA,EACnF,mBAAmB,CAAC,eAAe;AACrC;AAGA,SAAS,cAAc,MAAc,QAAqC;AACxE,SAAO,IAAI;AAAA,IACT,GAAG,MAAM,KAAK,IAAI;AAAA,IAClB;AAAA,MACE,iBAAiB,OAAO,IAAI;AAAA,IAC9B;AAAA,EACF;AACF;AAOA,SAAS,WAAW,MAAc,OAAe,QAAqC;AACpF,SAAO,IAAI;AAAA,IACT,GAAG,MAAM,KAAK,IAAI,IAAI,0BAA0B,KAAK,uBAAuB,KAAK,CAAC;AAAA,IAClF;AAAA,MACE,MAAM;AAAA,MACN,iBACE;AAAA,IAEJ;AAAA,EACF;AACF;AAQO,SAAS,yBAAyB,KAAqB;AAC5D,QAAM,WAAW,IAAI,QAAQ,iBAAiB,IAAI,EAAE,QAAQ,iBAAiB,IAAI;AACjF,SAAO,SAAS,QAAQ,cAAc,EAAE,EAAE,KAAK;AACjD;AAcO,SAAS,uBAAuB,MAAmC;AACxE,QAAM,MAA2B,CAAC;AAClC,aAAW,WAAW,KAAK,MAAM,OAAO,GAAG;AACzC,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,KAAK,WAAW,KAAK,KAAK,WAAW,GAAG,EAAG;AAK/C,UAAM,QAAQ,wDAAwD,KAAK,IAAI;AA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SAAY,EAAE,MAAM,UAAU,KAAK,OAAO,QAAQ,EAAY,IAAI,SACxF,UAAU,QAAQ,QAAQ;AAC9B,WAAO,QAAQ,IAAI;AAAA,EACrB;AACA,QAAM,UAAU,OAAO,MAAM,UAAU;AACvC,QAAM,OAAO,OAAO,MAAM,OAAO;AACjC,QAAM,SAAS,OAAO,MAAM,SAAS;AACrC,MAAI,YAAY,OAAW,OAAM,cAAc,MAAM,YAAY,MAAM;AACvE,MAAI,SAAS,OAAW,OAAM,cAAc,MAAM,SAAS,MAAM;AACjE,MAAI,WAAW,OAAW,OAAM,cAAc,MAAM,WAAW,MAAM;AAIrE,QAAM,MAA8B,CAAC;AACrC,aAAW,CAAC,MAAM,KAAK,KAAK;AAAA,IAC1B,CAAC,MAAM,YAAY,OAAO;AAAA,IAC1B,CAAC,MAAM,SAAS,IAAI;AAAA,IACpB,CAAC,MAAM,WAAW,MAAM;AAAA,IACxB,CAAC,MAAM,kBAAkB,OAAO,MAAM,gBAAgB,CAAC;AAAA,EACzD,GAAY;AACV,QAAI,UAAU,OAAW;AACzB,UAAM,QAAQ,yBAAyB,MAAM,GAAG;AAChD,QAAI,uBAAuB,OAAO,EAAE,oBAAoB,KAAK,CAAC,MAAM,QAAW;AAC7E,YAAM,WAAW,MAAM,OAAO,MAAM;AAAA,IACtC;AACA,QAAI,IAAI,IAAI;AAAA,EACd;AACA,SAAO;AAAA,IACL,oBAAoB,IAAI,MAAM,UAAU;AAAA,IACxC,UAAU,IAAI,MAAM,OAAO;AAAA,IAC3B,QAAQ,IAAI,MAAM,SAAS;AAAA,IAC3B,GAAI,IAAI,MAAM,gBAAgB,MAAM,SAChC,EAAE,yBAAyB,IAAI,MAAM,gBAAgB,EAAY,IACjE,CAAC;AAAA,EACP;AACF;","names":[]}
@@ -1,121 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunk5QVXRT3Acjs = require('./chunk-5QVXRT3A.cjs');
4
-
5
-
6
-
7
-
8
- var _chunkIFXFOYDUcjs = require('./chunk-IFXFOYDU.cjs');
9
-
10
- // src/credentials.ts
11
- var _fs = require('fs');
12
- var DEFAULT_NAMES = {
13
- apiCodeVar: "AUTOTASK_TRACKING_IDENTIFIER",
14
- userVar: "AUTOTASK_USERNAME",
15
- secretVar: "AUTOTASK_SECRET",
16
- impersonationVar: "AUTOTASK_IMPERSONATION_ID"
17
- };
18
- var ALIASES = {
19
- AUTOTASK_TRACKING_IDENTIFIER: ["AUTOTASK_API_CODE", "AUTOTASK_API_INTEGRATION_CODE"],
20
- AUTOTASK_USERNAME: ["AUTOTASK_USER"]
21
- };
22
- function presenceError(name, source) {
23
- return new (0, _chunk5QVXRT3Acjs.AutotaskConfigError)(
24
- `${source}: ${name} is not set (or is empty after shell-equivalent loading)`,
25
- {
26
- suggestedAction: `Set ${name} before running (see the "Credentials & env files" section of the README).`
27
- }
28
- );
29
- }
30
- function shapeError(name, value, source) {
31
- return new (0, _chunk5QVXRT3Acjs.AutotaskConfigError)(
32
- `${source}: ${name} ${_chunkIFXFOYDUcjs.CREDENTIAL_ENV_LOAD_ACTION} [${_chunkIFXFOYDUcjs.credentialValueSummary.call(void 0, value)}]`,
33
- {
34
- code: "INVALID_CREDENTIAL_SHAPE",
35
- suggestedAction: "Load the credential file with the shell (`set -a; . ./.env; set +a`), use loadAutotaskCredentialEnvFile(path), or fix the quoted/contaminated value; no request was sent."
36
- }
37
- );
38
- }
39
- function normalizeCredentialValue(raw) {
40
- const dequoted = raw.replace(/^'([\s\S]*)'$/, "$1").replace(/^"([\s\S]*)"$/, "$1");
41
- return dequoted.replace(/^\r+|\r+$/g, "").trim();
42
- }
43
- function parseCredentialEnvText(text) {
44
- const out = [];
45
- for (const rawLine of text.split(/\r?\n/)) {
46
- const line = rawLine.trim();
47
- if (line.length === 0 || line.startsWith("#")) continue;
48
- const match = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*([^]*)$/.exec(line);
49
- if (!match) continue;
50
- out.push({ key: match[1], value: normalizeCredentialValue(match[2]) });
51
- }
52
- return out;
53
- }
54
- function readCredentialEnvFile(path) {
55
- if (!_fs.existsSync.call(void 0, path)) {
56
- throw new (0, _chunk5QVXRT3Acjs.AutotaskConfigError)(`credential env file not found: ${path}`, {
57
- suggestedAction: "Check the path, or create the file with the credentials your host needs."
58
- });
59
- }
60
- const out = /* @__PURE__ */ Object.create(null);
61
- for (const { key, value } of parseCredentialEnvText(_fs.readFileSync.call(void 0, path, "utf8"))) out[key] = value;
62
- return out;
63
- }
64
- function pickAlias(values, canonical) {
65
- for (const name of [canonical, ..._nullishCoalesce(ALIASES[canonical], () => ( []))]) {
66
- const raw = values[name];
67
- if (raw !== void 0 && raw.trim().length > 0) return { name, raw };
68
- }
69
- return void 0;
70
- }
71
- function loadAutotaskCredentialEnvFile(path, names = {}) {
72
- const resolved = { ...DEFAULT_NAMES, ...names };
73
- const values = readCredentialEnvFile(path);
74
- return pickCredentials(values, resolved, `credential env file ${path}`, true);
75
- }
76
- function loadAutotaskCredentialsFromEnv(env = process.env, names = {}) {
77
- const resolved = { ...DEFAULT_NAMES, ...names };
78
- return pickCredentials(env, resolved, "environment", false);
79
- }
80
- function pickCredentials(values, names, source, canonical) {
81
- const picked = {};
82
- for (const variable of [names.apiCodeVar, names.userVar, names.secretVar, names.impersonationVar]) {
83
- const chosen = canonical ? values[variable] !== void 0 ? { name: variable, raw: values[variable] } : void 0 : pickAlias(values, variable);
84
- picked[variable] = chosen;
85
- }
86
- const apiCode = picked[names.apiCodeVar];
87
- const user = picked[names.userVar];
88
- const secret = picked[names.secretVar];
89
- if (apiCode === void 0) throw presenceError(names.apiCodeVar, source);
90
- if (user === void 0) throw presenceError(names.userVar, source);
91
- if (secret === void 0) throw presenceError(names.secretVar, source);
92
- const out = {};
93
- for (const [name, entry] of [
94
- [names.apiCodeVar, apiCode],
95
- [names.userVar, user],
96
- [names.secretVar, secret],
97
- [names.impersonationVar, picked[names.impersonationVar]]
98
- ]) {
99
- if (entry === void 0) continue;
100
- const value = normalizeCredentialValue(entry.raw);
101
- if (_chunkIFXFOYDUcjs.credentialShapeProblem.call(void 0, value, { skipEdgeWhitespace: true }) !== void 0) {
102
- throw shapeError(name, value, source);
103
- }
104
- out[name] = value;
105
- }
106
- return {
107
- apiIntegrationCode: out[names.apiCodeVar],
108
- userName: out[names.userVar],
109
- secret: out[names.secretVar],
110
- ...out[names.impersonationVar] !== void 0 ? { impersonationResourceId: out[names.impersonationVar] } : {}
111
- };
112
- }
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
- exports.normalizeCredentialValue = normalizeCredentialValue; exports.parseCredentialEnvText = parseCredentialEnvText; exports.readCredentialEnvFile = readCredentialEnvFile; exports.loadAutotaskCredentialEnvFile = loadAutotaskCredentialEnvFile; exports.loadAutotaskCredentialsFromEnv = loadAutotaskCredentialsFromEnv;
121
- //# sourceMappingURL=chunk-PBBFMRI5.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/maxs/gitrepos/node-autotask/dist/chunk-PBBFMRI5.cjs","../src/credentials.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACwBA,wBAAyC;AAuCzC,IAAM,cAAA,EAAmD;AAAA,EACvD,UAAA,EAAY,8BAAA;AAAA,EACZ,OAAA,EAAS,mBAAA;AAAA,EACT,SAAA,EAAW,iBAAA;AAAA,EACX,gBAAA,EAAkB;AACpB,CAAA;AAGA,IAAM,QAAA,EAA6C;AAAA,EACjD,4BAAA,EAA8B,CAAC,mBAAA,EAAqB,+BAA+B,CAAA;AAAA,EACnF,iBAAA,EAAmB,CAAC,eAAe;AACrC,CAAA;AAGA,SAAS,aAAA,CAAc,IAAA,EAAc,MAAA,EAAqC;AACxE,EAAA,OAAO,IAAI,0CAAA;AAAA,IACT,CAAA,EAAA;AACA,IAAA;AAAA,MAAA;AAEA,IAAA;AACF,EAAA;AACF;AAOA;AACE,EAAA;AACE,IAAA;AACA,IAAA;AAAA,MAAA;AACQ,MAAA;AAIR,IAAA;AACF,EAAA;AACF;AAQO;AACL,EAAA;AACA,EAAA;AACF;AAcO;AACL,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AAKA,IAAA;AACA,IAAA;AACA,IAAA;AACF,EAAA;AACA,EAAA;AACF;AAQO;AACL,EAAA;AACE,IAAA;AAAwE,MAAA;AAEvE,IAAA;AACH,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AAGA;AAIE,EAAA;AACE,IAAA;AACA,IAAA;AACF,EAAA;AACA,EAAA;AACF;AAWO;AAIL,EAAA;AACA,EAAA;AACA,EAAA;AACF;AAaO;AAIL,EAAA;AACA,EAAA;AACF;AAMA;AAME,EAAA;AACA,EAAA;AACE,IAAA;AAGA,IAAA;AACF,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAIA,EAAA;AACA,EAAA;AACG,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACS,EAAA;AACV,IAAA;AACA,IAAA;AACA,IAAA;AACE,MAAA;AACF,IAAA;AACA,IAAA;AACF,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAGF,EAAA;AACF;ADzJK;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/maxs/gitrepos/node-autotask/dist/chunk-PBBFMRI5.cjs","sourcesContent":[null,"/**\n * Canonical credential loading for node-autotask hosts (live scripts, MCP servers, test harnesses).\n *\n * The SDK itself never reads `process.env` for a request: env-override is a host concern. These\n * helpers are the HOST half, exported so no host has to hand-roll a parser — the hand-rolled,\n * quote-preserving parser is exactly what produced the 2026-10-07 incident.\n *\n * ## The single-quote contract\n *\n * A `.env` value may be SINGLE-QUOTED on purpose, because a secret containing `$` must be\n * single-quoted so the shell does not expand it (`AUTOTASK_SECRET='a$b c'`). The canonical load is\n * the shell's own — the recipe `loadAutotaskCredentialEnvFile` implements, and the one the docs\n * recommend:\n *\n * ```sh\n * set -a; . ./.env; set +a\n * ```\n *\n * The shell strips ONE pair of matching surrounding quotes (single or double) and leaves the\n * inner characters alone: `'a$b c'` loads as `a$b c`, literally. A quote-preserving loader (most\n * `dotenv` variants, `split('=')`) hands `'a$b c'` to the SDK with the quotes intact; that value\n * is printable ASCII, passes the transport's checks, reaches the vendor, and comes back as an\n * opaque 401 that looks like bad credentials.\n *\n * `loadAutotaskCredentialsFromEnv` therefore strips ONE pair of matching surrounding single OR\n * double quotes, is CRLF-safe, strips edge whitespace, and then refuses a value that still looks\n * shell-quoted or line-break contaminated (see `src/credential-shape.ts`) with\n * `AutotaskConfigError`. A `$` inside single quotes is NOT expanded: this loader is neither a\n * shell nor an expander.\n *\n * Failures are value-free: a message names the variable, never the value; a summary is a length\n * plus a two-character prefix only.\n */\nimport { existsSync, readFileSync } from 'node:fs';\nimport {\n CREDENTIAL_ENV_LOAD_ACTION,\n credentialShapeProblem,\n credentialValueSummary,\n} from './credential-shape.js';\nimport { AutotaskConfigError } from './errors.js';\n\n/**\n * The variable names an Autotask host loads. The three credential names are the canonical\n * spellings (the official API-User-Security terms: Tracking Identifier / Username /\n * Password-Secret). The two DEPRECATED aliases the live scripts still accept\n * (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE` for the tracking identifier,\n * `AUTOTASK_USER` for the username) are read as fall-backs, canonical first.\n */\nexport interface AutotaskCredentialNames {\n /** Tracking-identifier variable. Default `AUTOTASK_TRACKING_IDENTIFIER`. */\n apiCodeVar?: string;\n /** Username variable. Default `AUTOTASK_USERNAME`. */\n userVar?: string;\n /** Password/secret variable. Default `AUTOTASK_SECRET`. */\n secretVar?: string;\n /** Optional impersonation resource id variable. Default `AUTOTASK_IMPERSONATION_ID`. */\n impersonationVar?: string;\n}\n\n/** A loaded, shape-validated Autotask credential set. */\nexport interface AutotaskCredentials {\n /** The tracking identifier (header `ApiIntegrationCode`), shell-equivalent loaded. */\n apiIntegrationCode: string;\n /** The username (header `UserName`), shell-equivalent loaded. */\n userName: string;\n /** The secret (header `Secret`), with ONE pair of surrounding quotes removed when quoted. */\n secret: string;\n /** The optional impersonation resource id (header `ImpersonationResourceId`), when set. */\n impersonationResourceId?: string;\n}\n\n/** The canonical variable names (the first entry of each alias list is the default). */\nconst DEFAULT_NAMES: Required<AutotaskCredentialNames> = {\n apiCodeVar: 'AUTOTASK_TRACKING_IDENTIFIER',\n userVar: 'AUTOTASK_USERNAME',\n secretVar: 'AUTOTASK_SECRET',\n impersonationVar: 'AUTOTASK_IMPERSONATION_ID',\n};\n\n/** The DEPRECATED aliases the live scripts still accept, per canonical variable. */\nconst ALIASES: Record<string, readonly string[]> = {\n AUTOTASK_TRACKING_IDENTIFIER: ['AUTOTASK_API_CODE', 'AUTOTASK_API_INTEGRATION_CODE'],\n AUTOTASK_USERNAME: ['AUTOTASK_USER'],\n};\n\n/** Fail closed, value-free: the variable is named, its value never is. */\nfunction presenceError(name: string, source: string): AutotaskConfigError {\n return new AutotaskConfigError(\n `${source}: ${name} is not set (or is empty after shell-equivalent loading)`,\n {\n suggestedAction: `Set ${name} before running (see the \"Credentials & env files\" section of the README).`,\n },\n );\n}\n\n/**\n * Refuse a value that still carries a shell-quoting or line-break artifact after loading, with the\n * env-load pitfall appended. Value-free: the message names the variable and the summary carries a\n * length plus a two-character prefix only.\n */\nfunction shapeError(name: string, value: string, source: string): AutotaskConfigError {\n return new AutotaskConfigError(\n `${source}: ${name} ${CREDENTIAL_ENV_LOAD_ACTION} [${credentialValueSummary(value)}]`,\n {\n code: 'INVALID_CREDENTIAL_SHAPE',\n suggestedAction:\n 'Load the credential file with the shell (`set -a; . ./.env; set +a`), use ' +\n 'loadAutotaskCredentialEnvFile(path), or fix the quoted/contaminated value; no request was sent.',\n },\n );\n}\n\n/**\n * Shell-equivalent value handling: strip ONE pair of matching surrounding single OR double quotes\n * (only `'x'`/`\"x\"`, never `'x\"`), drop a `\\r` left by a CRLF file, and trim edge whitespace.\n * The inner characters are never unescaped or expanded — a `$` inside single quotes is literal,\n * exactly as the shell delivers it.\n */\nexport function normalizeCredentialValue(raw: string): string {\n const dequoted = raw.replace(/^'([\\s\\S]*)'$/, '$1').replace(/^\"([\\s\\S]*)\"$/, '$1');\n return dequoted.replace(/^\\r+|\\r+$/g, '').trim();\n}\n\n/** One parsed `key=value` line from an env file. */\nexport interface CredentialEnvLine {\n key: string;\n value: string;\n}\n\n/**\n * Minimal shell-sourcing-equivalent `.env` parser: `key=value` per line, `#` comments, an optional\n * `export ` prefix, and ONE pair of matching surrounding quotes stripped from the value. Blank\n * lines are skipped. This is deliberately NOT a general dotenv implementation: no `$` expansion,\n * no multi-line values, no command substitution — a credential file should need none of them.\n */\nexport function parseCredentialEnvText(text: string): CredentialEnvLine[] {\n const out: CredentialEnvLine[] = [];\n for (const rawLine of text.split(/\\r?\\n/)) {\n const line = rawLine.trim();\n if (line.length === 0 || line.startsWith('#')) continue;\n // `[^]*` (any character, newlines included), not `.`: a bare CR is a line terminator for `.`,\n // so a value with an interior CR would fail the match and the variable would be reported as\n // MISSING instead of as shape-contaminated. The CR must reach the value, where the shape check\n // names it. (CRLF is already split into lines above; this is the stray-CR case.)\n const match = /^(?:export\\s+)?([A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*([^]*)$/.exec(line);\n if (!match) continue;\n out.push({ key: match[1] as string, value: normalizeCredentialValue(match[2] as string) });\n }\n return out;\n}\n\n/**\n * Read a `key=value` env file with shell-equivalent value handling and return its own key/value\n * map. Use it when the host wants the whole file; {@link loadAutotaskCredentialsFromEnv} uses it to\n * read the AUTOTASK_* variables. Throws `AutotaskConfigError` (code `CONFIG_ERROR`) when the path\n * does not exist or is not a regular file.\n */\nexport function readCredentialEnvFile(path: string): Record<string, string> {\n if (!existsSync(path)) {\n throw new AutotaskConfigError(`credential env file not found: ${path}`, {\n suggestedAction: 'Check the path, or create the file with the credentials your host needs.',\n });\n }\n const out: Record<string, string> = Object.create(null) as Record<string, string>;\n for (const { key, value } of parseCredentialEnvText(readFileSync(path, 'utf8'))) out[key] = value;\n return out;\n}\n\n/** The FIRST alias (plus the canonical name) that carries a non-empty value, or `undefined`. */\nfunction pickAlias(\n values: Record<string, string | undefined>,\n canonical: string,\n): { name: string; raw: string } | undefined {\n for (const name of [canonical, ...(ALIASES[canonical] ?? [])]) {\n const raw = values[name];\n if (raw !== undefined && raw.trim().length > 0) return { name, raw };\n }\n return undefined;\n}\n\n/**\n * Load the Autotask credentials from an env FILE with the shell's own value handling (the\n * single-quote contract above). Pass the result to\n * `new AutotaskClient({ ...creds })`.\n *\n * The values go through {@link normalizeCredentialValue} and then the shape check, so a\n * quote-preserving load is impossible here; a contaminated value fails `AutotaskConfigError` with\n * code `INVALID_CREDENTIAL_SHAPE` and NO request is ever sent.\n */\nexport function loadAutotaskCredentialEnvFile(\n path: string,\n names: AutotaskCredentialNames = {},\n): AutotaskCredentials {\n const resolved = { ...DEFAULT_NAMES, ...names };\n const values = readCredentialEnvFile(path);\n return pickCredentials(values, resolved, `credential env file ${path}`, true);\n}\n\n/**\n * Load the Autotask credentials from a process-env-shaped record (default `process.env`) using the\n * SAME shell-equivalent value handling and shape checks as the file loader — the one path the\n * live scripts, a shell-sourced env and a caller-supplied record all share.\n *\n * Values already correct in `process.env` are returned unchanged; a value that was placed there\n * with its quotes intact (e.g. by a quote-preserving loader) is repaired by the same ONE-pair\n * strip, and a value that no load can repair fails closed. The two DEPRECATED aliases\n * (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE`, `AUTOTASK_USER`) are read as fall-backs\n * when the canonical variable is unset or blank — canonical first.\n */\nexport function loadAutotaskCredentialsFromEnv(\n env: Record<string, string | undefined> = process.env as Record<string, string | undefined>,\n names: AutotaskCredentialNames = {},\n): AutotaskCredentials {\n const resolved = { ...DEFAULT_NAMES, ...names };\n return pickCredentials(env as Record<string, string | undefined>, resolved, 'environment', false);\n}\n\n/**\n * Presence + shape gates shared by both loaders, so neither can drift from the other. `canonical`\n * is true for the file loader (exact canonical names only — a file is read by name, not aliased).\n */\nfunction pickCredentials(\n values: Record<string, string | undefined>,\n names: Required<AutotaskCredentialNames>,\n source: string,\n canonical: boolean,\n): AutotaskCredentials {\n const picked: Record<string, { name: string; raw: string } | undefined> = {};\n for (const variable of [names.apiCodeVar, names.userVar, names.secretVar, names.impersonationVar]) {\n const chosen = canonical\n ? (values[variable] !== undefined ? { name: variable, raw: values[variable] as string } : undefined)\n : pickAlias(values, variable);\n picked[variable] = chosen;\n }\n const apiCode = picked[names.apiCodeVar];\n const user = picked[names.userVar];\n const secret = picked[names.secretVar];\n if (apiCode === undefined) throw presenceError(names.apiCodeVar, source);\n if (user === undefined) throw presenceError(names.userVar, source);\n if (secret === undefined) throw presenceError(names.secretVar, source);\n\n // A CR keeps an inner one (CRLF is gone after the normalizer): only quotes and edge whitespace\n // can survive the loader, so those are the checks it owns.\n const out: Record<string, string> = {};\n for (const [name, entry] of [\n [names.apiCodeVar, apiCode],\n [names.userVar, user],\n [names.secretVar, secret],\n [names.impersonationVar, picked[names.impersonationVar]],\n ] as const) {\n if (entry === undefined) continue;\n const value = normalizeCredentialValue(entry.raw);\n if (credentialShapeProblem(value, { skipEdgeWhitespace: true }) !== undefined) {\n throw shapeError(name, value, source);\n }\n out[name] = value;\n }\n return {\n apiIntegrationCode: out[names.apiCodeVar] as string,\n userName: out[names.userVar] as string,\n secret: out[names.secretVar] as string,\n ...(out[names.impersonationVar] !== undefined\n ? { impersonationResourceId: out[names.impersonationVar] as string }\n : {}),\n };\n}\n"]}
@@ -1,32 +0,0 @@
1
- // src/credential-shape.ts
2
- var QUOTE_CHARS = /* @__PURE__ */ new Set(["'", '"']);
3
- function hasSurroundingQuotes(value) {
4
- if (value.length < 2) return false;
5
- const first = value[0];
6
- return QUOTE_CHARS.has(first) && value[value.length - 1] === first;
7
- }
8
- function credentialShapeProblem(value, options = {}) {
9
- if (!options.skipEdgeWhitespace) {
10
- if (/^\s/.test(value)) return "leading whitespace";
11
- if (/\s$/.test(value)) return "trailing whitespace";
12
- }
13
- if (!options.skipSurroundingQuotes && hasSurroundingQuotes(value)) {
14
- return "single- or double-quote surrounding the value";
15
- }
16
- if (value.includes("\r")) return "carriage return";
17
- return void 0;
18
- }
19
- var CREDENTIAL_ENV_LOAD_ACTION = "value appears shell-quoted or line-break contaminated \u2014 check how your env file was loaded (single-quoted values must be shell-sourced, not parsed by a quote-preserving loader)";
20
- var MIN_PREFIX_SUMMARY_LENGTH = 4;
21
- function credentialValueSummary(value) {
22
- return value.length >= MIN_PREFIX_SUMMARY_LENGTH ? `len ${value.length}, starts "${value.slice(0, 2)}"` : "short value (length withheld)";
23
- }
24
-
25
- export {
26
- hasSurroundingQuotes,
27
- credentialShapeProblem,
28
- CREDENTIAL_ENV_LOAD_ACTION,
29
- MIN_PREFIX_SUMMARY_LENGTH,
30
- credentialValueSummary
31
- };
32
- //# sourceMappingURL=chunk-QF4K3XTK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/credential-shape.ts"],"sourcesContent":["/**\n * Credential VALUE shape checks — the intake guard for the 2026-10-07 incident class.\n *\n * A `.env` file may SINGLE-QUOTE a value on purpose (a secret containing `$` must be\n * single-quoted so the shell does not expand it). The shell strips those quotes when the file\n * is loaded with `set -a; . ./.env; set +a`; a quote-PRESERVING loader (most `dotenv` variants,\n * a hand-rolled `split('=')`) hands the value over with its quotes intact. Such a value is\n * printable ASCII, so it passes every check in the transport, reaches the vendor as\n * `Secret: 'a$b'` and comes back as an opaque 401 that looks like bad credentials. The\n * incidents this guards against cost three probe cycles before anyone suspected the load.\n *\n * `credentialShapeProblem()` names the artifact WITHOUT ever repeating the value; callers turn it\n * into a typed, value-free error (construction) or a value-free `diagnostic` (401 annotation).\n *\n * Two knobs match the two call sites:\n * - interior CR/LF is always reported (a leak risk and a fetch `TypeError` risk, unhealthy for a\n * value however it was loaded);\n * - edge whitespace and surrounding quotes are reported by default and only skipped where the\n * caller legitimately normalizes blank/trim (`skipEdgeWhitespace`, `skipSurroundingQuotes`).\n */\n\n/** The shape artifacts a loaded credential value can carry. */\nexport type CredentialShapeProblem =\n | 'leading whitespace'\n | 'trailing whitespace'\n | 'single- or double-quote surrounding the value'\n | 'carriage return';\n\n/** Where the guards do not apply, because the caller normalizes that artifact itself. */\nexport interface CredentialShapeOptions {\n /** Skip the edge-whitespace check (call sites that refuse whitespace-only values). */\n skipEdgeWhitespace?: boolean;\n /** Skip the surrounding-quote check (call sites that refuse whitespace-only values). */\n skipSurroundingQuotes?: boolean;\n}\n\nconst QUOTE_CHARS = new Set([\"'\", '\"']);\n\n/** True when `value` starts AND ends with a quote character (one shell-quote artifact). */\nexport function hasSurroundingQuotes(value: string): boolean {\n if (value.length < 2) return false;\n const first = value[0] as string;\n return QUOTE_CHARS.has(first) && value[value.length - 1] === first;\n}\n\n/**\n * The FIRST shape problem in `value`, or `undefined` when its shape is clean. Value-free by\n * construction: the result is one of the fixed strings in {@link CredentialShapeProblem}.\n * A CR is reported even in the middle of a value; CRLF is caught by the same check.\n */\nexport function credentialShapeProblem(\n value: string,\n options: CredentialShapeOptions = {},\n): CredentialShapeProblem | undefined {\n if (!options.skipEdgeWhitespace) {\n if (/^\\s/.test(value)) return 'leading whitespace';\n if (/\\s$/.test(value)) return 'trailing whitespace';\n }\n if (!options.skipSurroundingQuotes && hasSurroundingQuotes(value)) {\n return 'single- or double-quote surrounding the value';\n }\n if (value.includes('\\r')) return 'carriage return';\n return undefined;\n}\n\n/** The env-load pitfall every shape rejection points at, without claiming which loader was used. */\nexport const CREDENTIAL_ENV_LOAD_ACTION =\n 'value appears shell-quoted or line-break contaminated — check how your env file was loaded ' +\n '(single-quoted values must be shell-sourced, not parsed by a quote-preserving loader)';\n\n/**\n * Shortest value the 2-character prefix summary is printed for. Below it a prefix is a large\n * fraction of the secret, so the summary prints `(short)` instead of two characters.\n */\nexport const MIN_PREFIX_SUMMARY_LENGTH = 4;\n\n/**\n * A value-free summary of a credential value: its LENGTH and its FIRST TWO CHARACTERS only, or\n * `(short)` when the value is too short for a 2-character prefix to be safe. The rest of the\n * value is never reproduced, so the summary is safe to print in a log, a CLI report or a test.\n */\nexport function credentialValueSummary(value: string): string {\n return value.length >= MIN_PREFIX_SUMMARY_LENGTH\n ? `len ${value.length}, starts \"${value.slice(0, 2)}\"`\n : 'short value (length withheld)';\n}\n"],"mappings":";AAoCA,IAAM,cAAc,oBAAI,IAAI,CAAC,KAAK,GAAG,CAAC;AAG/B,SAAS,qBAAqB,OAAwB;AAC3D,MAAI,MAAM,SAAS,EAAG,QAAO;AAC7B,QAAM,QAAQ,MAAM,CAAC;AACrB,SAAO,YAAY,IAAI,KAAK,KAAK,MAAM,MAAM,SAAS,CAAC,MAAM;AAC/D;AAOO,SAAS,uBACd,OACA,UAAkC,CAAC,GACC;AACpC,MAAI,CAAC,QAAQ,oBAAoB;AAC/B,QAAI,MAAM,KAAK,KAAK,EAAG,QAAO;AAC9B,QAAI,MAAM,KAAK,KAAK,EAAG,QAAO;AAAA,EAChC;AACA,MAAI,CAAC,QAAQ,yBAAyB,qBAAqB,KAAK,GAAG;AACjE,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS,IAAI,EAAG,QAAO;AACjC,SAAO;AACT;AAGO,IAAM,6BACX;AAOK,IAAM,4BAA4B;AAOlC,SAAS,uBAAuB,OAAuB;AAC5D,SAAO,MAAM,UAAU,4BACnB,OAAO,MAAM,MAAM,aAAa,MAAM,MAAM,GAAG,CAAC,CAAC,MACjD;AACN;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/maxs/gitrepos/node-autotask/dist/chunk-QUFEIJEB.cjs","../src/client.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,IAAM,eAAA,EAAN,MAAqB;AAAA;AAAA,EAEjB;AAAA;AAAA,EAEA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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F,CAAA;ADrCA;AACA;AACE;AACF,wCAAC","file":"/Users/maxs/gitrepos/node-autotask/dist/chunk-QUFEIJEB.cjs","sourcesContent":[null,"/**\n * AutotaskClient — top-level facade (ARCHITECTURE sections 5, 6).\n *\n * G3 wires config + transport + auth only; resource accessors (companies,\n * tickets, ...) land at G4/G5, and the cross-resource `operations` layer at\n * G6. The constructor validates fail-closed BEFORE anything is wired —\n * invalid configuration throws `AutotaskConfigError` and construction issues\n * no request.\n */\nimport { resolveConfig, type AutotaskConfig, type ResolvedAutotaskConfig } from './config.js';\nimport { AutotaskConfigError } from './errors.js';\nimport { HttpClient, runWithSignal } from './http.js';\nimport type { AuthTokenResultModel } from './types/common.js';\n\n// [GENERATED:RESOURCE_IMPORTS:START]\nimport { AppointmentsResource } from './resources/appointments.js';\nimport { AuthenticateResource } from './resources/authenticate.js';\nimport { BillingCodesResource } from './resources/billing_codes.js';\nimport { BillingItemsResource } from './resources/billing_items.js';\nimport { ChangeRequestLinksResource } from './resources/change_request_links.js';\nimport { ChecklistLibrariesResource } from './resources/checklist_libraries.js';\nimport { ChecklistLibraryChecklistItemsResource } from './resources/checklist_library_checklist_items.js';\nimport { ClassificationIconsResource } from './resources/classification_icons.js';\nimport { CompaniesResource } from './resources/companies.js';\nimport { CompanyAlertsResource } from './resources/company_alerts.js';\nimport { CompanyLocationsResource } from './resources/company_locations.js';\nimport { CompanyNotesResource } from './resources/company_notes.js';\nimport { CompanySiteConfigurationsResource } from './resources/company_site_configurations.js';\nimport { CompanyWebhooksResource } from './resources/company_webhooks.js';\nimport { ConfigurationItemBillingProductAssociationsResource } from './resources/configuration_item_billing_product_associations.js';\nimport { ConfigurationItemCategoriesResource } from './resources/configuration_item_categories.js';\nimport { ConfigurationItemCategoryUdfAssociationsResource } from './resources/configuration_item_category_udf_associations.js';\nimport { ConfigurationItemDnsRecordsResource } from './resources/configuration_item_dns_records.js';\nimport { ConfigurationItemNotesResource } from './resources/configuration_item_notes.js';\nimport { ConfigurationItemRelatedItemsResource } from './resources/configuration_item_related_items.js';\nimport { ConfigurationItemsResource } from './resources/configuration_items.js';\nimport { ConfigurationItemSslSubjectAlternativeNamesResource } from './resources/configuration_item_ssl_subject_alternative_names.js';\nimport { ConfigurationItemTypesResource } from './resources/configuration_item_types.js';\nimport { ConfigurationItemWebhooksResource } from './resources/configuration_item_webhooks.js';\nimport { ContactGroupContactsResource } from './resources/contact_group_contacts.js';\nimport { ContactGroupsResource } from './resources/contact_groups.js';\nimport { ContactsResource } from './resources/contacts.js';\nimport { ContactWebhooksResource } from './resources/contact_webhooks.js';\nimport { ContractBillingRulesResource } from './resources/contract_billing_rules.js';\nimport { ContractBlockHourFactorsResource } from './resources/contract_block_hour_factors.js';\nimport { ContractBlocksResource } from './resources/contract_blocks.js';\nimport { ContractChargesResource } from './resources/contract_charges.js';\nimport { ContractExclusionBillingCodesResource } from './resources/contract_exclusion_billing_codes.js';\nimport { ContractExclusionRolesResource } from './resources/contract_exclusion_roles.js';\nimport { ContractExclusionSetExcludedRolesResource } from './resources/contract_exclusion_set_excluded_roles.js';\nimport { ContractExclusionSetExcludedWorkTypesResource } from './resources/contract_exclusion_set_excluded_work_types.js';\nimport { ContractExclusionSetsResource } from './resources/contract_exclusion_sets.js';\nimport { ContractMilestonesResource } from './resources/contract_milestones.js';\nimport { ContractNotesResource } from './resources/contract_notes.js';\nimport { ContractRatesResource } from './resources/contract_rates.js';\nimport { ContractRetainersResource } from './resources/contract_retainers.js';\nimport { ContractRoleCostsResource } from './resources/contract_role_costs.js';\nimport { ContractServiceAdjustmentsResource } from './resources/contract_service_adjustments.js';\nimport { ContractServiceBundleAdjustmentsResource } from './resources/contract_service_bundle_adjustments.js';\nimport { ContractServiceBundlesResource } from './resources/contract_service_bundles.js';\nimport { ContractServiceBundleUnitsResource } from './resources/contract_service_bundle_units.js';\nimport { ContractServicesResource } from './resources/contract_services.js';\nimport { ContractServiceUnitsResource } from './resources/contract_service_units.js';\nimport { ContractsResource } from './resources/contracts.js';\nimport { ContractTicketPurchasesResource } from './resources/contract_ticket_purchases.js';\nimport { CountriesResource } from './resources/countries.js';\nimport { DepartmentsResource } from './resources/departments.js';\nimport { DomainRegistrarsResource } from './resources/domain_registrars.js';\nimport { EntityInformationResource } from './resources/entity_information.js';\nimport { ExpenseItemAttachmentsResource } from './resources/expense_item_attachments.js';\nimport { ExpenseItemsResource } from './resources/expense_items.js';\nimport { ExpenseReportsResource } from './resources/expense_reports.js';\nimport { HolidaySetsResource } from './resources/holiday_sets.js';\nimport { HolidaysResource } from './resources/holidays.js';\nimport { InventoryProductsResource } from './resources/inventory_products.js';\nimport { InvoicesResource } from './resources/invoices.js';\nimport { ModulesResource } from './resources/modules.js';\nimport { NotificationHistoryResource } from './resources/notification_history.js';\nimport { OpportunitiesResource } from './resources/opportunities.js';\nimport { OpportunityAttachmentsResource } from './resources/opportunity_attachments.js';\nimport { OpportunityCategoriesResource } from './resources/opportunity_categories.js';\nimport { PhasesResource } from './resources/phases.js';\nimport { ProductsResource } from './resources/products.js';\nimport { ProductVendorsResource } from './resources/product_vendors.js';\nimport { ProjectChargesResource } from './resources/project_charges.js';\nimport { ProjectNotesResource } from './resources/project_notes.js';\nimport { ProjectsResource } from './resources/projects.js';\nimport { PurchaseApprovalsResource } from './resources/purchase_approvals.js';\nimport { PurchaseOrderItemReceivingResource } from './resources/purchase_order_item_receiving.js';\nimport { PurchaseOrderItemsResource } from './resources/purchase_order_items.js';\nimport { PurchaseOrdersResource } from './resources/purchase_orders.js';\nimport { QuoteItemsResource } from './resources/quote_items.js';\nimport { QuoteLocationsResource } from './resources/quote_locations.js';\nimport { QuotesResource } from './resources/quotes.js';\nimport { QuoteTemplatesResource } from './resources/quote_templates.js';\nimport { ResourceRoleQueuesResource } from './resources/resource_role_queues.js';\nimport { ResourceRolesResource } from './resources/resource_roles.js';\nimport { ResourceSkillsResource } from './resources/resource_skills.js';\nimport { ResourcesResource } from './resources/resources.js';\nimport { ResourceTimeOffAdditionalResource } from './resources/resource_time_off_additional.js';\nimport { ResourceTimeOffApproversResource } from './resources/resource_time_off_approvers.js';\nimport { ResourceTimeOffBalancesResource } from './resources/resource_time_off_balances.js';\nimport { RolesResource } from './resources/roles.js';\nimport { ServiceCallsResource } from './resources/service_calls.js';\nimport { ServiceCallTaskResourcesResource } from './resources/service_call_task_resources.js';\nimport { ServiceCallTasksResource } from './resources/service_call_tasks.js';\nimport { ServiceCallTicketResourcesResource } from './resources/service_call_ticket_resources.js';\nimport { ServiceCallTicketsResource } from './resources/service_call_tickets.js';\nimport { ServiceLevelAgreementResultsResource } from './resources/service_level_agreement_results.js';\nimport { ServicesResource } from './resources/services.js';\nimport { SkillsResource } from './resources/skills.js';\nimport { SubscriptionPeriodsResource } from './resources/subscription_periods.js';\nimport { SubscriptionsResource } from './resources/subscriptions.js';\nimport { SurveyResultsResource } from './resources/survey_results.js';\nimport { SurveysResource } from './resources/surveys.js';\nimport { TagAliasesResource } from './resources/tag_aliases.js';\nimport { TagGroupsResource } from './resources/tag_groups.js';\nimport { TagsResource } from './resources/tags.js';\nimport { TaskSecondaryResourcesResource } from './resources/task_secondary_resources.js';\nimport { TasksResource } from './resources/tasks.js';\nimport { ThresholdInformationResource } from './resources/threshold_information.js';\nimport { TicketAdditionalConfigurationItemsResource } from './resources/ticket_additional_configuration_items.js';\nimport { TicketAdditionalContactsResource } from './resources/ticket_additional_contacts.js';\nimport { TicketAttachmentsResource } from './resources/ticket_attachments.js';\nimport { TicketCategoriesResource } from './resources/ticket_categories.js';\nimport { TicketCategoryFieldDefaultsResource } from './resources/ticket_category_field_defaults.js';\nimport { TicketChangeRequestApprovalsResource } from './resources/ticket_change_request_approvals.js';\nimport { TicketChargesResource } from './resources/ticket_charges.js';\nimport { TicketChecklistItemsResource } from './resources/ticket_checklist_items.js';\nimport { TicketChecklistLibrariesResource } from './resources/ticket_checklist_libraries.js';\nimport { TicketHistoryResource } from './resources/ticket_history.js';\nimport { TicketNoteAttachmentsResource } from './resources/ticket_note_attachments.js';\nimport { TicketNotesResource } from './resources/ticket_notes.js';\nimport { TicketNoteWebhooksResource } from './resources/ticket_note_webhooks.js';\nimport { TicketSecondaryResourcesResource } from './resources/ticket_secondary_resources.js';\nimport { TicketsResource } from './resources/tickets.js';\nimport { TicketWebhooksResource } from './resources/ticket_webhooks.js';\nimport { TimeEntriesResource } from './resources/time_entries.js';\nimport { TimeEntryAttachmentsResource } from './resources/time_entry_attachments.js';\nimport { TimeOffRequestsResource } from './resources/time_off_requests.js';\nimport { VersionInformationResource } from './resources/version_information.js';\nimport { VersionResource } from './resources/version.js';\nimport { ZoneInformationResource } from './resources/zone_information.js';\n// [GENERATED:RESOURCE_IMPORTS:END]\n\nexport class AutotaskClient {\n /** The validated config (resolved defaults; final values). */\n readonly config: ResolvedAutotaskConfig;\n /** The transport (shared by every resource; the only fetch site). */\n readonly http: HttpClient;\n\n// [GENERATED:RESOURCE_ACCESSORS:START]\n readonly appointments: AppointmentsResource;\n readonly authenticateResource: AuthenticateResource;\n readonly billingCodes: BillingCodesResource;\n readonly billingItems: BillingItemsResource;\n readonly changeRequestLinks: ChangeRequestLinksResource;\n readonly checklistLibraries: ChecklistLibrariesResource;\n readonly checklistLibraryChecklistItems: ChecklistLibraryChecklistItemsResource;\n readonly classificationIcons: ClassificationIconsResource;\n readonly companies: CompaniesResource;\n readonly companyAlerts: CompanyAlertsResource;\n readonly companyLocations: CompanyLocationsResource;\n readonly companyNotes: CompanyNotesResource;\n readonly companySiteConfigurations: CompanySiteConfigurationsResource;\n readonly companyWebhooks: CompanyWebhooksResource;\n readonly configurationItemBillingProductAssociations: ConfigurationItemBillingProductAssociationsResource;\n readonly configurationItemCategories: ConfigurationItemCategoriesResource;\n readonly configurationItemCategoryUdfAssociations: ConfigurationItemCategoryUdfAssociationsResource;\n readonly configurationItemDnsRecords: ConfigurationItemDnsRecordsResource;\n readonly configurationItemNotes: ConfigurationItemNotesResource;\n readonly configurationItemRelatedItems: ConfigurationItemRelatedItemsResource;\n readonly configurationItems: ConfigurationItemsResource;\n readonly configurationItemSslSubjectAlternativeNames: ConfigurationItemSslSubjectAlternativeNamesResource;\n readonly configurationItemTypes: ConfigurationItemTypesResource;\n readonly configurationItemWebhooks: ConfigurationItemWebhooksResource;\n readonly contactGroupContacts: ContactGroupContactsResource;\n readonly contactGroups: ContactGroupsResource;\n readonly contacts: ContactsResource;\n readonly contactWebhooks: ContactWebhooksResource;\n readonly contractBillingRules: ContractBillingRulesResource;\n readonly contractBlockHourFactors: ContractBlockHourFactorsResource;\n readonly contractBlocks: ContractBlocksResource;\n readonly contractCharges: ContractChargesResource;\n readonly contractExclusionBillingCodes: ContractExclusionBillingCodesResource;\n readonly contractExclusionRoles: ContractExclusionRolesResource;\n readonly contractExclusionSetExcludedRoles: ContractExclusionSetExcludedRolesResource;\n readonly contractExclusionSetExcludedWorkTypes: ContractExclusionSetExcludedWorkTypesResource;\n readonly contractExclusionSets: ContractExclusionSetsResource;\n readonly contractMilestones: ContractMilestonesResource;\n readonly contractNotes: ContractNotesResource;\n readonly contractRates: ContractRatesResource;\n readonly contractRetainers: ContractRetainersResource;\n readonly contractRoleCosts: ContractRoleCostsResource;\n readonly contractServiceAdjustments: ContractServiceAdjustmentsResource;\n readonly contractServiceBundleAdjustments: ContractServiceBundleAdjustmentsResource;\n readonly contractServiceBundles: ContractServiceBundlesResource;\n readonly contractServiceBundleUnits: ContractServiceBundleUnitsResource;\n readonly contractServices: ContractServicesResource;\n readonly contractServiceUnits: ContractServiceUnitsResource;\n readonly contracts: ContractsResource;\n readonly contractTicketPurchases: ContractTicketPurchasesResource;\n readonly countries: CountriesResource;\n readonly departments: DepartmentsResource;\n readonly domainRegistrars: DomainRegistrarsResource;\n readonly entityInformation: EntityInformationResource;\n readonly expenseItemAttachments: ExpenseItemAttachmentsResource;\n readonly expenseItems: ExpenseItemsResource;\n readonly expenseReports: ExpenseReportsResource;\n readonly holidaySets: HolidaySetsResource;\n readonly holidays: HolidaysResource;\n readonly inventoryProducts: InventoryProductsResource;\n readonly invoices: InvoicesResource;\n readonly modules: ModulesResource;\n readonly notificationHistory: NotificationHistoryResource;\n readonly opportunities: OpportunitiesResource;\n readonly opportunityAttachments: OpportunityAttachmentsResource;\n readonly opportunityCategories: OpportunityCategoriesResource;\n readonly phases: PhasesResource;\n readonly products: ProductsResource;\n readonly productVendors: ProductVendorsResource;\n readonly projectCharges: ProjectChargesResource;\n readonly projectNotes: ProjectNotesResource;\n readonly projects: ProjectsResource;\n readonly purchaseApprovals: PurchaseApprovalsResource;\n readonly purchaseOrderItemReceiving: PurchaseOrderItemReceivingResource;\n readonly purchaseOrderItems: PurchaseOrderItemsResource;\n readonly purchaseOrders: PurchaseOrdersResource;\n readonly quoteItems: QuoteItemsResource;\n readonly quoteLocations: QuoteLocationsResource;\n readonly quotes: QuotesResource;\n readonly quoteTemplates: QuoteTemplatesResource;\n readonly resourceRoleQueues: ResourceRoleQueuesResource;\n readonly resourceRoles: ResourceRolesResource;\n readonly resourceSkills: ResourceSkillsResource;\n readonly resources: ResourcesResource;\n readonly resourceTimeOffAdditional: ResourceTimeOffAdditionalResource;\n readonly resourceTimeOffApprovers: ResourceTimeOffApproversResource;\n readonly resourceTimeOffBalances: ResourceTimeOffBalancesResource;\n readonly roles: RolesResource;\n readonly serviceCalls: ServiceCallsResource;\n readonly serviceCallTaskResources: ServiceCallTaskResourcesResource;\n readonly serviceCallTasks: ServiceCallTasksResource;\n readonly serviceCallTicketResources: ServiceCallTicketResourcesResource;\n readonly serviceCallTickets: ServiceCallTicketsResource;\n readonly serviceLevelAgreementResults: ServiceLevelAgreementResultsResource;\n readonly services: ServicesResource;\n readonly skills: SkillsResource;\n readonly subscriptionPeriods: SubscriptionPeriodsResource;\n readonly subscriptions: SubscriptionsResource;\n readonly surveyResults: SurveyResultsResource;\n readonly surveys: SurveysResource;\n readonly tagAliases: TagAliasesResource;\n readonly tagGroups: TagGroupsResource;\n readonly tags: TagsResource;\n readonly taskSecondaryResources: TaskSecondaryResourcesResource;\n readonly tasks: TasksResource;\n readonly thresholdInformation: ThresholdInformationResource;\n readonly ticketAdditionalConfigurationItems: TicketAdditionalConfigurationItemsResource;\n readonly ticketAdditionalContacts: TicketAdditionalContactsResource;\n readonly ticketAttachments: TicketAttachmentsResource;\n readonly ticketCategories: TicketCategoriesResource;\n readonly ticketCategoryFieldDefaults: TicketCategoryFieldDefaultsResource;\n readonly ticketChangeRequestApprovals: TicketChangeRequestApprovalsResource;\n readonly ticketCharges: TicketChargesResource;\n readonly ticketChecklistItems: TicketChecklistItemsResource;\n readonly ticketChecklistLibraries: TicketChecklistLibrariesResource;\n readonly ticketHistory: TicketHistoryResource;\n readonly ticketNoteAttachments: TicketNoteAttachmentsResource;\n readonly ticketNotes: TicketNotesResource;\n readonly ticketNoteWebhooks: TicketNoteWebhooksResource;\n readonly ticketSecondaryResources: TicketSecondaryResourcesResource;\n readonly tickets: TicketsResource;\n readonly ticketWebhooks: TicketWebhooksResource;\n readonly timeEntries: TimeEntriesResource;\n readonly timeEntryAttachments: TimeEntryAttachmentsResource;\n readonly timeOffRequests: TimeOffRequestsResource;\n readonly versionInformation: VersionInformationResource;\n readonly version: VersionResource;\n readonly zoneInformation: ZoneInformationResource;\n// [GENERATED:RESOURCE_ACCESSORS:END]\n /**\n * Fail-closed: invalid configuration throws `AutotaskConfigError` before\n * anything is wired. Construction issues NO request.\n */\n constructor(options: AutotaskConfig) {\n this.config = resolveConfig(options);\n this.http = new HttpClient(this.config);\n\n// [GENERATED:RESOURCE_CONSTRUCTORS:START]\n this.appointments = new AppointmentsResource(this.http, this.config.pageSize);\n this.authenticateResource = new AuthenticateResource(this.http);\n this.billingCodes = new BillingCodesResource(this.http, this.config.pageSize);\n this.billingItems = new BillingItemsResource(this.http, this.config.pageSize);\n this.changeRequestLinks = new ChangeRequestLinksResource(this.http, this.config.pageSize);\n this.checklistLibraries = new ChecklistLibrariesResource(this.http, this.config.pageSize);\n this.checklistLibraryChecklistItems = new ChecklistLibraryChecklistItemsResource(this.http, this.config.pageSize);\n this.classificationIcons = new ClassificationIconsResource(this.http, this.config.pageSize);\n this.companies = new CompaniesResource(this.http, this.config.pageSize);\n this.companyAlerts = new CompanyAlertsResource(this.http, this.config.pageSize);\n this.companyLocations = new CompanyLocationsResource(this.http, this.config.pageSize);\n this.companyNotes = new CompanyNotesResource(this.http, this.config.pageSize);\n this.companySiteConfigurations = new CompanySiteConfigurationsResource(this.http, this.config.pageSize);\n this.companyWebhooks = new CompanyWebhooksResource(this.http, this.config.pageSize);\n this.configurationItemBillingProductAssociations = new ConfigurationItemBillingProductAssociationsResource(this.http, this.config.pageSize);\n this.configurationItemCategories = new ConfigurationItemCategoriesResource(this.http, this.config.pageSize);\n this.configurationItemCategoryUdfAssociations = new ConfigurationItemCategoryUdfAssociationsResource(this.http, this.config.pageSize);\n this.configurationItemDnsRecords = new ConfigurationItemDnsRecordsResource(this.http, this.config.pageSize);\n this.configurationItemNotes = new ConfigurationItemNotesResource(this.http, this.config.pageSize);\n this.configurationItemRelatedItems = new ConfigurationItemRelatedItemsResource(this.http, this.config.pageSize);\n this.configurationItems = new ConfigurationItemsResource(this.http, this.config.pageSize);\n this.configurationItemSslSubjectAlternativeNames = new ConfigurationItemSslSubjectAlternativeNamesResource(this.http, this.config.pageSize);\n this.configurationItemTypes = new ConfigurationItemTypesResource(this.http, this.config.pageSize);\n this.configurationItemWebhooks = new ConfigurationItemWebhooksResource(this.http, this.config.pageSize);\n this.contactGroupContacts = new ContactGroupContactsResource(this.http, this.config.pageSize);\n this.contactGroups = new ContactGroupsResource(this.http, this.config.pageSize);\n this.contacts = new ContactsResource(this.http, this.config.pageSize);\n this.contactWebhooks = new ContactWebhooksResource(this.http, this.config.pageSize);\n this.contractBillingRules = new ContractBillingRulesResource(this.http, this.config.pageSize);\n this.contractBlockHourFactors = new ContractBlockHourFactorsResource(this.http, this.config.pageSize);\n this.contractBlocks = new ContractBlocksResource(this.http, this.config.pageSize);\n this.contractCharges = new ContractChargesResource(this.http, this.config.pageSize);\n this.contractExclusionBillingCodes = new ContractExclusionBillingCodesResource(this.http, this.config.pageSize);\n this.contractExclusionRoles = new ContractExclusionRolesResource(this.http, this.config.pageSize);\n this.contractExclusionSetExcludedRoles = new ContractExclusionSetExcludedRolesResource(this.http, this.config.pageSize);\n this.contractExclusionSetExcludedWorkTypes = new ContractExclusionSetExcludedWorkTypesResource(this.http, this.config.pageSize);\n this.contractExclusionSets = new ContractExclusionSetsResource(this.http, this.config.pageSize);\n this.contractMilestones = new ContractMilestonesResource(this.http, this.config.pageSize);\n this.contractNotes = new ContractNotesResource(this.http, this.config.pageSize);\n this.contractRates = new ContractRatesResource(this.http, this.config.pageSize);\n this.contractRetainers = new ContractRetainersResource(this.http, this.config.pageSize);\n this.contractRoleCosts = new ContractRoleCostsResource(this.http, this.config.pageSize);\n this.contractServiceAdjustments = new ContractServiceAdjustmentsResource(this.http, this.config.pageSize);\n this.contractServiceBundleAdjustments = new ContractServiceBundleAdjustmentsResource(this.http, this.config.pageSize);\n this.contractServiceBundles = new ContractServiceBundlesResource(this.http, this.config.pageSize);\n this.contractServiceBundleUnits = new ContractServiceBundleUnitsResource(this.http, this.config.pageSize);\n this.contractServices = new ContractServicesResource(this.http, this.config.pageSize);\n this.contractServiceUnits = new ContractServiceUnitsResource(this.http, this.config.pageSize);\n this.contracts = new ContractsResource(this.http, this.config.pageSize);\n this.contractTicketPurchases = new ContractTicketPurchasesResource(this.http, this.config.pageSize);\n this.countries = new CountriesResource(this.http, this.config.pageSize);\n this.departments = new DepartmentsResource(this.http, this.config.pageSize);\n this.domainRegistrars = new DomainRegistrarsResource(this.http, this.config.pageSize);\n this.entityInformation = new EntityInformationResource(this.http);\n this.expenseItemAttachments = new ExpenseItemAttachmentsResource(this.http, this.config.pageSize);\n this.expenseItems = new ExpenseItemsResource(this.http, this.config.pageSize);\n this.expenseReports = new ExpenseReportsResource(this.http, this.config.pageSize);\n this.holidaySets = new HolidaySetsResource(this.http, this.config.pageSize);\n this.holidays = new HolidaysResource(this.http, this.config.pageSize);\n this.inventoryProducts = new InventoryProductsResource(this.http, this.config.pageSize);\n this.invoices = new InvoicesResource(this.http, this.config.pageSize);\n this.modules = new ModulesResource(this.http);\n this.notificationHistory = new NotificationHistoryResource(this.http, this.config.pageSize);\n this.opportunities = new OpportunitiesResource(this.http, this.config.pageSize);\n this.opportunityAttachments = new OpportunityAttachmentsResource(this.http, this.config.pageSize);\n this.opportunityCategories = new OpportunityCategoriesResource(this.http, this.config.pageSize);\n this.phases = new PhasesResource(this.http, this.config.pageSize);\n this.products = new ProductsResource(this.http, this.config.pageSize);\n this.productVendors = new ProductVendorsResource(this.http, this.config.pageSize);\n this.projectCharges = new ProjectChargesResource(this.http, this.config.pageSize);\n this.projectNotes = new ProjectNotesResource(this.http, this.config.pageSize);\n this.projects = new ProjectsResource(this.http, this.config.pageSize);\n this.purchaseApprovals = new PurchaseApprovalsResource(this.http, this.config.pageSize);\n this.purchaseOrderItemReceiving = new PurchaseOrderItemReceivingResource(this.http, this.config.pageSize);\n this.purchaseOrderItems = new PurchaseOrderItemsResource(this.http, this.config.pageSize);\n this.purchaseOrders = new PurchaseOrdersResource(this.http, this.config.pageSize);\n this.quoteItems = new QuoteItemsResource(this.http, this.config.pageSize);\n this.quoteLocations = new QuoteLocationsResource(this.http, this.config.pageSize);\n this.quotes = new QuotesResource(this.http, this.config.pageSize);\n this.quoteTemplates = new QuoteTemplatesResource(this.http, this.config.pageSize);\n this.resourceRoleQueues = new ResourceRoleQueuesResource(this.http, this.config.pageSize);\n this.resourceRoles = new ResourceRolesResource(this.http, this.config.pageSize);\n this.resourceSkills = new ResourceSkillsResource(this.http, this.config.pageSize);\n this.resources = new ResourcesResource(this.http, this.config, this.config.pageSize);\n this.resourceTimeOffAdditional = new ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);\n this.resourceTimeOffApprovers = new ResourceTimeOffApproversResource(this.http, this.config.pageSize);\n this.resourceTimeOffBalances = new ResourceTimeOffBalancesResource(this.http, this.config.pageSize);\n this.roles = new RolesResource(this.http, this.config.pageSize);\n this.serviceCalls = new ServiceCallsResource(this.http, this.config.pageSize);\n this.serviceCallTaskResources = new ServiceCallTaskResourcesResource(this.http, this.config.pageSize);\n this.serviceCallTasks = new ServiceCallTasksResource(this.http, this.config.pageSize);\n this.serviceCallTicketResources = new ServiceCallTicketResourcesResource(this.http, this.config.pageSize);\n this.serviceCallTickets = new ServiceCallTicketsResource(this.http, this.config.pageSize);\n this.serviceLevelAgreementResults = new ServiceLevelAgreementResultsResource(this.http, this.config.pageSize);\n this.services = new ServicesResource(this.http, this.config.pageSize);\n this.skills = new SkillsResource(this.http, this.config.pageSize);\n this.subscriptionPeriods = new SubscriptionPeriodsResource(this.http, this.config.pageSize);\n this.subscriptions = new SubscriptionsResource(this.http, this.config.pageSize);\n this.surveyResults = new SurveyResultsResource(this.http, this.config.pageSize);\n this.surveys = new SurveysResource(this.http, this.config.pageSize);\n this.tagAliases = new TagAliasesResource(this.http, this.config.pageSize);\n this.tagGroups = new TagGroupsResource(this.http, this.config.pageSize);\n this.tags = new TagsResource(this.http, this.config.pageSize);\n this.taskSecondaryResources = new TaskSecondaryResourcesResource(this.http, this.config.pageSize);\n this.tasks = new TasksResource(this.http, this.config.pageSize);\n this.thresholdInformation = new ThresholdInformationResource(this.http);\n this.ticketAdditionalConfigurationItems = new TicketAdditionalConfigurationItemsResource(this.http, this.config.pageSize);\n this.ticketAdditionalContacts = new TicketAdditionalContactsResource(this.http, this.config.pageSize);\n this.ticketAttachments = new TicketAttachmentsResource(this.http, this.config.pageSize);\n this.ticketCategories = new TicketCategoriesResource(this.http, this.config.pageSize);\n this.ticketCategoryFieldDefaults = new TicketCategoryFieldDefaultsResource(this.http, this.config.pageSize);\n this.ticketChangeRequestApprovals = new TicketChangeRequestApprovalsResource(this.http, this.config.pageSize);\n this.ticketCharges = new TicketChargesResource(this.http, this.config.pageSize);\n this.ticketChecklistItems = new TicketChecklistItemsResource(this.http, this.config.pageSize);\n this.ticketChecklistLibraries = new TicketChecklistLibrariesResource(this.http, this.config.pageSize);\n this.ticketHistory = new TicketHistoryResource(this.http, this.config.pageSize);\n this.ticketNoteAttachments = new TicketNoteAttachmentsResource(this.http, this.config.pageSize);\n this.ticketNotes = new TicketNotesResource(this.http, this.config.pageSize);\n this.ticketNoteWebhooks = new TicketNoteWebhooksResource(this.http, this.config.pageSize);\n this.ticketSecondaryResources = new TicketSecondaryResourcesResource(this.http, this.config.pageSize);\n this.tickets = new TicketsResource(this.http, this.config.pageSize);\n this.ticketWebhooks = new TicketWebhooksResource(this.http, this.config.pageSize);\n this.timeEntries = new TimeEntriesResource(this.http, this.config.pageSize);\n this.timeEntryAttachments = new TimeEntryAttachmentsResource(this.http, this.config.pageSize);\n this.timeOffRequests = new TimeOffRequestsResource(this.http, this.config.pageSize);\n this.versionInformation = new VersionInformationResource(this.http);\n this.version = new VersionResource(this.http);\n this.zoneInformation = new ZoneInformationResource(this.http);\n// [GENERATED:RESOURCE_CONSTRUCTORS:END]\n }\n\n /**\n * `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does\n * NOT store, refresh, or send the token automatically — it is a\n * probe/alternative for integrations that front the API with a\n * token-accepting layer. The default transport always uses the 3-header\n * scheme.\n */\n async authenticate(): Promise<AuthTokenResultModel> {\n return this.http.request<AuthTokenResultModel>({\n method: 'GET',\n path: '/V1.0/Authenticate',\n operation: 'authenticate',\n });\n }\n\n /**\n * The client-side hourly budget state (issue #4) — the LOCAL count only:\n * `{ perHour, used, remaining }`, or `undefined` when `rateLimit.perHour`\n * is off. The limiter is per process and cannot see other instances or\n * integrations on the tenant; the tenant-wide count is\n * `client.thresholdInformation.get()`.\n */\n hourlyBudget(): { perHour: number; used: number; remaining: number } | undefined {\n return this.http.hourlyBudget();\n }\n\n /**\n * Run `fn` with `signal` cancelling every SDK request it starts, retry\n * waits included (aborting throws `AutotaskAbortError`, code `ABORTED`, never\n * retried). The way a host propagates request cancellation (an MCP handler's\n * `extra.signal`) through `invoke` or any resource method without a signal\n * parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.\n */\n withSignal<T>(signal: AbortSignal, fn: () => Promise<T>): Promise<T> {\n return runWithSignal(signal, fn);\n }\n\n /**\n * Bounded-parallel bulk helper (ARCHITECTURE section 10, `concurrency`):\n * runs `fn` over `items` with at most `opts.concurrency` in flight\n * (default: this client's `maxConcurrent`). Results are in INPUT order. A\n * rejection stops new items from starting and rejects the batch with the\n * first error once the in-flight items settle. `opts.signal` stops new items\n * from starting once aborted (the batch then rejects with the abort reason)\n * and cancels the SDK requests `fn` has in flight (via `withSignal`). `opts.settle: true` runs every item and\n * resolves to per-item `{ status: 'fulfilled', value } | { status:\n * 'rejected', reason }` results instead of rejecting.\n */\n async batch<T, R>(\n fn: (item: T) => Promise<R>,\n items: readonly T[],\n opts?: { concurrency?: number; signal?: AbortSignal; settle?: false },\n ): Promise<R[]>;\n async batch<T, R>(\n fn: (item: T) => Promise<R>,\n items: readonly T[],\n opts: { concurrency?: number; signal?: AbortSignal; settle: true },\n ): Promise<PromiseSettledResult<R>[]>;\n async batch<T, R>(\n fn: (item: T) => Promise<R>,\n items: readonly T[],\n opts: { concurrency?: number; signal?: AbortSignal; settle?: boolean } = {},\n ): Promise<R[] | PromiseSettledResult<R>[]> {\n const concurrency = opts.concurrency ?? this.config.maxConcurrent;\n if (!Number.isInteger(concurrency) || concurrency <= 0) {\n throw new AutotaskConfigError('batch concurrency must be a positive integer');\n }\n const { signal, settle } = opts;\n const results = new Array<R | PromiseSettledResult<R>>(items.length);\n let next = 0;\n let failure: { error: unknown } | undefined;\n const worker = async (): Promise<void> => {\n while (failure === undefined && next < items.length) {\n if (signal?.aborted) {\n failure ??= { error: signal.reason };\n return;\n }\n const i = next++;\n try {\n const item = items[i] as T;\n const value = await (signal === undefined ? fn(item) : runWithSignal(signal, () => fn(item)));\n results[i] = settle ? { status: 'fulfilled', value } : value;\n } catch (error) {\n if (settle) results[i] = { status: 'rejected', reason: error };\n else failure ??= { error };\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));\n if (failure !== undefined) throw failure.error;\n return results as R[] | PromiseSettledResult<R>[];\n }\n}\n"]}