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.
- package/ARCHITECTURE.md +54 -12
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/README.md +9 -3
- package/dist/{chunk-C7U3ZRRK.js → chunk-2QLOK7PX.js} +27 -31
- package/dist/{chunk-C7U3ZRRK.js.map → chunk-2QLOK7PX.js.map} +1 -1
- package/dist/{chunk-LDKIIVFV.cjs → chunk-CQIZDSBE.cjs} +272 -276
- package/dist/chunk-CQIZDSBE.cjs.map +1 -0
- package/dist/{chunk-QUFEIJEB.cjs → chunk-DA73ALND.cjs} +136 -138
- package/dist/chunk-DA73ALND.cjs.map +1 -0
- package/dist/{chunk-GNS47RBV.js → chunk-IUJJPWUX.js} +612 -18
- package/dist/chunk-IUJJPWUX.js.map +1 -0
- package/dist/{chunk-RFXGG37L.cjs → chunk-IV2Z3JLR.cjs} +680 -86
- package/dist/chunk-IV2Z3JLR.cjs.map +1 -0
- package/dist/{chunk-ONPT4PIV.js → chunk-PAQXQFGG.js} +4 -6
- package/dist/{chunk-ONPT4PIV.js.map → chunk-PAQXQFGG.js.map} +1 -1
- package/dist/index.cjs +120 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -3
- package/dist/index.d.ts +129 -3
- package/dist/index.js +156 -63
- package/dist/index.js.map +1 -1
- package/dist/operations/index.cjs +113 -116
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.js +9 -12
- package/dist/operations/index.js.map +1 -1
- package/dist/pool.cjs +8 -11
- package/dist/pool.cjs.map +1 -1
- package/dist/pool.js +4 -7
- package/dist/pool.js.map +1 -1
- package/dist/resources/index.cjs +3 -5
- package/dist/resources/index.cjs.map +1 -1
- package/dist/resources/index.js +2 -4
- package/package.json +9 -3
- package/dist/chunk-5QVXRT3A.cjs +0 -580
- package/dist/chunk-5QVXRT3A.cjs.map +0 -1
- package/dist/chunk-FE225M76.js +0 -580
- package/dist/chunk-FE225M76.js.map +0 -1
- package/dist/chunk-GNS47RBV.js.map +0 -1
- package/dist/chunk-IFXFOYDU.cjs +0 -32
- package/dist/chunk-IFXFOYDU.cjs.map +0 -1
- package/dist/chunk-LDKIIVFV.cjs.map +0 -1
- package/dist/chunk-OOEVTGP4.js +0 -121
- package/dist/chunk-OOEVTGP4.js.map +0 -1
- package/dist/chunk-PBBFMRI5.cjs +0 -121
- package/dist/chunk-PBBFMRI5.cjs.map +0 -1
- package/dist/chunk-QF4K3XTK.js +0 -32
- package/dist/chunk-QF4K3XTK.js.map +0 -1
- package/dist/chunk-QUFEIJEB.cjs.map +0 -1
- package/dist/chunk-RFXGG37L.cjs.map +0 -1
- package/dist/credential-shape.cjs +0 -15
- package/dist/credential-shape.cjs.map +0 -1
- package/dist/credential-shape.d.cts +0 -52
- package/dist/credential-shape.d.ts +0 -52
- package/dist/credential-shape.js +0 -15
- package/dist/credential-shape.js.map +0 -1
- package/dist/credentials.cjs +0 -17
- package/dist/credentials.cjs.map +0 -1
- package/dist/credentials.d.cts +0 -78
- package/dist/credentials.d.ts +0 -78
- package/dist/credentials.js +0 -17
- package/dist/credentials.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkIFXFOYDUcjs = require('./chunk-IFXFOYDU.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.CREDENTIAL_ENV_LOAD_ACTION = _chunkIFXFOYDUcjs.CREDENTIAL_ENV_LOAD_ACTION; exports.MIN_PREFIX_SUMMARY_LENGTH = _chunkIFXFOYDUcjs.MIN_PREFIX_SUMMARY_LENGTH; exports.credentialShapeProblem = _chunkIFXFOYDUcjs.credentialShapeProblem; exports.credentialValueSummary = _chunkIFXFOYDUcjs.credentialValueSummary; exports.hasSurroundingQuotes = _chunkIFXFOYDUcjs.hasSurroundingQuotes;
|
|
15
|
-
//# sourceMappingURL=credential-shape.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/maxs/gitrepos/node-autotask/dist/credential-shape.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,gYAAC","file":"/Users/maxs/gitrepos/node-autotask/dist/credential-shape.cjs"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential VALUE shape checks — the intake guard for the 2026-10-07 incident class.
|
|
3
|
-
*
|
|
4
|
-
* A `.env` file may SINGLE-QUOTE a value on purpose (a secret containing `$` must be
|
|
5
|
-
* single-quoted so the shell does not expand it). The shell strips those quotes when the file
|
|
6
|
-
* is loaded with `set -a; . ./.env; set +a`; a quote-PRESERVING loader (most `dotenv` variants,
|
|
7
|
-
* a hand-rolled `split('=')`) hands the value over with its quotes intact. Such a value is
|
|
8
|
-
* printable ASCII, so it passes every check in the transport, reaches the vendor as
|
|
9
|
-
* `Secret: 'a$b'` and comes back as an opaque 401 that looks like bad credentials. The
|
|
10
|
-
* incidents this guards against cost three probe cycles before anyone suspected the load.
|
|
11
|
-
*
|
|
12
|
-
* `credentialShapeProblem()` names the artifact WITHOUT ever repeating the value; callers turn it
|
|
13
|
-
* into a typed, value-free error (construction) or a value-free `diagnostic` (401 annotation).
|
|
14
|
-
*
|
|
15
|
-
* Two knobs match the two call sites:
|
|
16
|
-
* - interior CR/LF is always reported (a leak risk and a fetch `TypeError` risk, unhealthy for a
|
|
17
|
-
* value however it was loaded);
|
|
18
|
-
* - edge whitespace and surrounding quotes are reported by default and only skipped where the
|
|
19
|
-
* caller legitimately normalizes blank/trim (`skipEdgeWhitespace`, `skipSurroundingQuotes`).
|
|
20
|
-
*/
|
|
21
|
-
/** The shape artifacts a loaded credential value can carry. */
|
|
22
|
-
type CredentialShapeProblem = 'leading whitespace' | 'trailing whitespace' | 'single- or double-quote surrounding the value' | 'carriage return';
|
|
23
|
-
/** Where the guards do not apply, because the caller normalizes that artifact itself. */
|
|
24
|
-
interface CredentialShapeOptions {
|
|
25
|
-
/** Skip the edge-whitespace check (call sites that refuse whitespace-only values). */
|
|
26
|
-
skipEdgeWhitespace?: boolean;
|
|
27
|
-
/** Skip the surrounding-quote check (call sites that refuse whitespace-only values). */
|
|
28
|
-
skipSurroundingQuotes?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/** True when `value` starts AND ends with a quote character (one shell-quote artifact). */
|
|
31
|
-
declare function hasSurroundingQuotes(value: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* The FIRST shape problem in `value`, or `undefined` when its shape is clean. Value-free by
|
|
34
|
-
* construction: the result is one of the fixed strings in {@link CredentialShapeProblem}.
|
|
35
|
-
* A CR is reported even in the middle of a value; CRLF is caught by the same check.
|
|
36
|
-
*/
|
|
37
|
-
declare function credentialShapeProblem(value: string, options?: CredentialShapeOptions): CredentialShapeProblem | undefined;
|
|
38
|
-
/** The env-load pitfall every shape rejection points at, without claiming which loader was used. */
|
|
39
|
-
declare const CREDENTIAL_ENV_LOAD_ACTION: string;
|
|
40
|
-
/**
|
|
41
|
-
* Shortest value the 2-character prefix summary is printed for. Below it a prefix is a large
|
|
42
|
-
* fraction of the secret, so the summary prints `(short)` instead of two characters.
|
|
43
|
-
*/
|
|
44
|
-
declare const MIN_PREFIX_SUMMARY_LENGTH = 4;
|
|
45
|
-
/**
|
|
46
|
-
* A value-free summary of a credential value: its LENGTH and its FIRST TWO CHARACTERS only, or
|
|
47
|
-
* `(short)` when the value is too short for a 2-character prefix to be safe. The rest of the
|
|
48
|
-
* value is never reproduced, so the summary is safe to print in a log, a CLI report or a test.
|
|
49
|
-
*/
|
|
50
|
-
declare function credentialValueSummary(value: string): string;
|
|
51
|
-
|
|
52
|
-
export { CREDENTIAL_ENV_LOAD_ACTION, type CredentialShapeOptions, type CredentialShapeProblem, MIN_PREFIX_SUMMARY_LENGTH, credentialShapeProblem, credentialValueSummary, hasSurroundingQuotes };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential VALUE shape checks — the intake guard for the 2026-10-07 incident class.
|
|
3
|
-
*
|
|
4
|
-
* A `.env` file may SINGLE-QUOTE a value on purpose (a secret containing `$` must be
|
|
5
|
-
* single-quoted so the shell does not expand it). The shell strips those quotes when the file
|
|
6
|
-
* is loaded with `set -a; . ./.env; set +a`; a quote-PRESERVING loader (most `dotenv` variants,
|
|
7
|
-
* a hand-rolled `split('=')`) hands the value over with its quotes intact. Such a value is
|
|
8
|
-
* printable ASCII, so it passes every check in the transport, reaches the vendor as
|
|
9
|
-
* `Secret: 'a$b'` and comes back as an opaque 401 that looks like bad credentials. The
|
|
10
|
-
* incidents this guards against cost three probe cycles before anyone suspected the load.
|
|
11
|
-
*
|
|
12
|
-
* `credentialShapeProblem()` names the artifact WITHOUT ever repeating the value; callers turn it
|
|
13
|
-
* into a typed, value-free error (construction) or a value-free `diagnostic` (401 annotation).
|
|
14
|
-
*
|
|
15
|
-
* Two knobs match the two call sites:
|
|
16
|
-
* - interior CR/LF is always reported (a leak risk and a fetch `TypeError` risk, unhealthy for a
|
|
17
|
-
* value however it was loaded);
|
|
18
|
-
* - edge whitespace and surrounding quotes are reported by default and only skipped where the
|
|
19
|
-
* caller legitimately normalizes blank/trim (`skipEdgeWhitespace`, `skipSurroundingQuotes`).
|
|
20
|
-
*/
|
|
21
|
-
/** The shape artifacts a loaded credential value can carry. */
|
|
22
|
-
type CredentialShapeProblem = 'leading whitespace' | 'trailing whitespace' | 'single- or double-quote surrounding the value' | 'carriage return';
|
|
23
|
-
/** Where the guards do not apply, because the caller normalizes that artifact itself. */
|
|
24
|
-
interface CredentialShapeOptions {
|
|
25
|
-
/** Skip the edge-whitespace check (call sites that refuse whitespace-only values). */
|
|
26
|
-
skipEdgeWhitespace?: boolean;
|
|
27
|
-
/** Skip the surrounding-quote check (call sites that refuse whitespace-only values). */
|
|
28
|
-
skipSurroundingQuotes?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/** True when `value` starts AND ends with a quote character (one shell-quote artifact). */
|
|
31
|
-
declare function hasSurroundingQuotes(value: string): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* The FIRST shape problem in `value`, or `undefined` when its shape is clean. Value-free by
|
|
34
|
-
* construction: the result is one of the fixed strings in {@link CredentialShapeProblem}.
|
|
35
|
-
* A CR is reported even in the middle of a value; CRLF is caught by the same check.
|
|
36
|
-
*/
|
|
37
|
-
declare function credentialShapeProblem(value: string, options?: CredentialShapeOptions): CredentialShapeProblem | undefined;
|
|
38
|
-
/** The env-load pitfall every shape rejection points at, without claiming which loader was used. */
|
|
39
|
-
declare const CREDENTIAL_ENV_LOAD_ACTION: string;
|
|
40
|
-
/**
|
|
41
|
-
* Shortest value the 2-character prefix summary is printed for. Below it a prefix is a large
|
|
42
|
-
* fraction of the secret, so the summary prints `(short)` instead of two characters.
|
|
43
|
-
*/
|
|
44
|
-
declare const MIN_PREFIX_SUMMARY_LENGTH = 4;
|
|
45
|
-
/**
|
|
46
|
-
* A value-free summary of a credential value: its LENGTH and its FIRST TWO CHARACTERS only, or
|
|
47
|
-
* `(short)` when the value is too short for a 2-character prefix to be safe. The rest of the
|
|
48
|
-
* value is never reproduced, so the summary is safe to print in a log, a CLI report or a test.
|
|
49
|
-
*/
|
|
50
|
-
declare function credentialValueSummary(value: string): string;
|
|
51
|
-
|
|
52
|
-
export { CREDENTIAL_ENV_LOAD_ACTION, type CredentialShapeOptions, type CredentialShapeProblem, MIN_PREFIX_SUMMARY_LENGTH, credentialShapeProblem, credentialValueSummary, hasSurroundingQuotes };
|
package/dist/credential-shape.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CREDENTIAL_ENV_LOAD_ACTION,
|
|
3
|
-
MIN_PREFIX_SUMMARY_LENGTH,
|
|
4
|
-
credentialShapeProblem,
|
|
5
|
-
credentialValueSummary,
|
|
6
|
-
hasSurroundingQuotes
|
|
7
|
-
} from "./chunk-QF4K3XTK.js";
|
|
8
|
-
export {
|
|
9
|
-
CREDENTIAL_ENV_LOAD_ACTION,
|
|
10
|
-
MIN_PREFIX_SUMMARY_LENGTH,
|
|
11
|
-
credentialShapeProblem,
|
|
12
|
-
credentialValueSummary,
|
|
13
|
-
hasSurroundingQuotes
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=credential-shape.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/credentials.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkPBBFMRI5cjs = require('./chunk-PBBFMRI5.cjs');
|
|
8
|
-
require('./chunk-5QVXRT3A.cjs');
|
|
9
|
-
require('./chunk-IFXFOYDU.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.loadAutotaskCredentialEnvFile = _chunkPBBFMRI5cjs.loadAutotaskCredentialEnvFile; exports.loadAutotaskCredentialsFromEnv = _chunkPBBFMRI5cjs.loadAutotaskCredentialsFromEnv; exports.normalizeCredentialValue = _chunkPBBFMRI5cjs.normalizeCredentialValue; exports.parseCredentialEnvText = _chunkPBBFMRI5cjs.parseCredentialEnvText; exports.readCredentialEnvFile = _chunkPBBFMRI5cjs.readCredentialEnvFile;
|
|
17
|
-
//# sourceMappingURL=credentials.cjs.map
|
package/dist/credentials.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/maxs/gitrepos/node-autotask/dist/credentials.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,sZAAC","file":"/Users/maxs/gitrepos/node-autotask/dist/credentials.cjs"}
|
package/dist/credentials.d.cts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The variable names an Autotask host loads. The three credential names are the canonical
|
|
3
|
-
* spellings (the official API-User-Security terms: Tracking Identifier / Username /
|
|
4
|
-
* Password-Secret). The two DEPRECATED aliases the live scripts still accept
|
|
5
|
-
* (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE` for the tracking identifier,
|
|
6
|
-
* `AUTOTASK_USER` for the username) are read as fall-backs, canonical first.
|
|
7
|
-
*/
|
|
8
|
-
interface AutotaskCredentialNames {
|
|
9
|
-
/** Tracking-identifier variable. Default `AUTOTASK_TRACKING_IDENTIFIER`. */
|
|
10
|
-
apiCodeVar?: string;
|
|
11
|
-
/** Username variable. Default `AUTOTASK_USERNAME`. */
|
|
12
|
-
userVar?: string;
|
|
13
|
-
/** Password/secret variable. Default `AUTOTASK_SECRET`. */
|
|
14
|
-
secretVar?: string;
|
|
15
|
-
/** Optional impersonation resource id variable. Default `AUTOTASK_IMPERSONATION_ID`. */
|
|
16
|
-
impersonationVar?: string;
|
|
17
|
-
}
|
|
18
|
-
/** A loaded, shape-validated Autotask credential set. */
|
|
19
|
-
interface AutotaskCredentials {
|
|
20
|
-
/** The tracking identifier (header `ApiIntegrationCode`), shell-equivalent loaded. */
|
|
21
|
-
apiIntegrationCode: string;
|
|
22
|
-
/** The username (header `UserName`), shell-equivalent loaded. */
|
|
23
|
-
userName: string;
|
|
24
|
-
/** The secret (header `Secret`), with ONE pair of surrounding quotes removed when quoted. */
|
|
25
|
-
secret: string;
|
|
26
|
-
/** The optional impersonation resource id (header `ImpersonationResourceId`), when set. */
|
|
27
|
-
impersonationResourceId?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Shell-equivalent value handling: strip ONE pair of matching surrounding single OR double quotes
|
|
31
|
-
* (only `'x'`/`"x"`, never `'x"`), drop a `\r` left by a CRLF file, and trim edge whitespace.
|
|
32
|
-
* The inner characters are never unescaped or expanded — a `$` inside single quotes is literal,
|
|
33
|
-
* exactly as the shell delivers it.
|
|
34
|
-
*/
|
|
35
|
-
declare function normalizeCredentialValue(raw: string): string;
|
|
36
|
-
/** One parsed `key=value` line from an env file. */
|
|
37
|
-
interface CredentialEnvLine {
|
|
38
|
-
key: string;
|
|
39
|
-
value: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Minimal shell-sourcing-equivalent `.env` parser: `key=value` per line, `#` comments, an optional
|
|
43
|
-
* `export ` prefix, and ONE pair of matching surrounding quotes stripped from the value. Blank
|
|
44
|
-
* lines are skipped. This is deliberately NOT a general dotenv implementation: no `$` expansion,
|
|
45
|
-
* no multi-line values, no command substitution — a credential file should need none of them.
|
|
46
|
-
*/
|
|
47
|
-
declare function parseCredentialEnvText(text: string): CredentialEnvLine[];
|
|
48
|
-
/**
|
|
49
|
-
* Read a `key=value` env file with shell-equivalent value handling and return its own key/value
|
|
50
|
-
* map. Use it when the host wants the whole file; {@link loadAutotaskCredentialsFromEnv} uses it to
|
|
51
|
-
* read the AUTOTASK_* variables. Throws `AutotaskConfigError` (code `CONFIG_ERROR`) when the path
|
|
52
|
-
* does not exist or is not a regular file.
|
|
53
|
-
*/
|
|
54
|
-
declare function readCredentialEnvFile(path: string): Record<string, string>;
|
|
55
|
-
/**
|
|
56
|
-
* Load the Autotask credentials from an env FILE with the shell's own value handling (the
|
|
57
|
-
* single-quote contract above). Pass the result to
|
|
58
|
-
* `new AutotaskClient({ ...creds })`.
|
|
59
|
-
*
|
|
60
|
-
* The values go through {@link normalizeCredentialValue} and then the shape check, so a
|
|
61
|
-
* quote-preserving load is impossible here; a contaminated value fails `AutotaskConfigError` with
|
|
62
|
-
* code `INVALID_CREDENTIAL_SHAPE` and NO request is ever sent.
|
|
63
|
-
*/
|
|
64
|
-
declare function loadAutotaskCredentialEnvFile(path: string, names?: AutotaskCredentialNames): AutotaskCredentials;
|
|
65
|
-
/**
|
|
66
|
-
* Load the Autotask credentials from a process-env-shaped record (default `process.env`) using the
|
|
67
|
-
* SAME shell-equivalent value handling and shape checks as the file loader — the one path the
|
|
68
|
-
* live scripts, a shell-sourced env and a caller-supplied record all share.
|
|
69
|
-
*
|
|
70
|
-
* Values already correct in `process.env` are returned unchanged; a value that was placed there
|
|
71
|
-
* with its quotes intact (e.g. by a quote-preserving loader) is repaired by the same ONE-pair
|
|
72
|
-
* strip, and a value that no load can repair fails closed. The two DEPRECATED aliases
|
|
73
|
-
* (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE`, `AUTOTASK_USER`) are read as fall-backs
|
|
74
|
-
* when the canonical variable is unset or blank — canonical first.
|
|
75
|
-
*/
|
|
76
|
-
declare function loadAutotaskCredentialsFromEnv(env?: Record<string, string | undefined>, names?: AutotaskCredentialNames): AutotaskCredentials;
|
|
77
|
-
|
|
78
|
-
export { type AutotaskCredentialNames, type AutotaskCredentials, type CredentialEnvLine, loadAutotaskCredentialEnvFile, loadAutotaskCredentialsFromEnv, normalizeCredentialValue, parseCredentialEnvText, readCredentialEnvFile };
|
package/dist/credentials.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The variable names an Autotask host loads. The three credential names are the canonical
|
|
3
|
-
* spellings (the official API-User-Security terms: Tracking Identifier / Username /
|
|
4
|
-
* Password-Secret). The two DEPRECATED aliases the live scripts still accept
|
|
5
|
-
* (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE` for the tracking identifier,
|
|
6
|
-
* `AUTOTASK_USER` for the username) are read as fall-backs, canonical first.
|
|
7
|
-
*/
|
|
8
|
-
interface AutotaskCredentialNames {
|
|
9
|
-
/** Tracking-identifier variable. Default `AUTOTASK_TRACKING_IDENTIFIER`. */
|
|
10
|
-
apiCodeVar?: string;
|
|
11
|
-
/** Username variable. Default `AUTOTASK_USERNAME`. */
|
|
12
|
-
userVar?: string;
|
|
13
|
-
/** Password/secret variable. Default `AUTOTASK_SECRET`. */
|
|
14
|
-
secretVar?: string;
|
|
15
|
-
/** Optional impersonation resource id variable. Default `AUTOTASK_IMPERSONATION_ID`. */
|
|
16
|
-
impersonationVar?: string;
|
|
17
|
-
}
|
|
18
|
-
/** A loaded, shape-validated Autotask credential set. */
|
|
19
|
-
interface AutotaskCredentials {
|
|
20
|
-
/** The tracking identifier (header `ApiIntegrationCode`), shell-equivalent loaded. */
|
|
21
|
-
apiIntegrationCode: string;
|
|
22
|
-
/** The username (header `UserName`), shell-equivalent loaded. */
|
|
23
|
-
userName: string;
|
|
24
|
-
/** The secret (header `Secret`), with ONE pair of surrounding quotes removed when quoted. */
|
|
25
|
-
secret: string;
|
|
26
|
-
/** The optional impersonation resource id (header `ImpersonationResourceId`), when set. */
|
|
27
|
-
impersonationResourceId?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Shell-equivalent value handling: strip ONE pair of matching surrounding single OR double quotes
|
|
31
|
-
* (only `'x'`/`"x"`, never `'x"`), drop a `\r` left by a CRLF file, and trim edge whitespace.
|
|
32
|
-
* The inner characters are never unescaped or expanded — a `$` inside single quotes is literal,
|
|
33
|
-
* exactly as the shell delivers it.
|
|
34
|
-
*/
|
|
35
|
-
declare function normalizeCredentialValue(raw: string): string;
|
|
36
|
-
/** One parsed `key=value` line from an env file. */
|
|
37
|
-
interface CredentialEnvLine {
|
|
38
|
-
key: string;
|
|
39
|
-
value: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Minimal shell-sourcing-equivalent `.env` parser: `key=value` per line, `#` comments, an optional
|
|
43
|
-
* `export ` prefix, and ONE pair of matching surrounding quotes stripped from the value. Blank
|
|
44
|
-
* lines are skipped. This is deliberately NOT a general dotenv implementation: no `$` expansion,
|
|
45
|
-
* no multi-line values, no command substitution — a credential file should need none of them.
|
|
46
|
-
*/
|
|
47
|
-
declare function parseCredentialEnvText(text: string): CredentialEnvLine[];
|
|
48
|
-
/**
|
|
49
|
-
* Read a `key=value` env file with shell-equivalent value handling and return its own key/value
|
|
50
|
-
* map. Use it when the host wants the whole file; {@link loadAutotaskCredentialsFromEnv} uses it to
|
|
51
|
-
* read the AUTOTASK_* variables. Throws `AutotaskConfigError` (code `CONFIG_ERROR`) when the path
|
|
52
|
-
* does not exist or is not a regular file.
|
|
53
|
-
*/
|
|
54
|
-
declare function readCredentialEnvFile(path: string): Record<string, string>;
|
|
55
|
-
/**
|
|
56
|
-
* Load the Autotask credentials from an env FILE with the shell's own value handling (the
|
|
57
|
-
* single-quote contract above). Pass the result to
|
|
58
|
-
* `new AutotaskClient({ ...creds })`.
|
|
59
|
-
*
|
|
60
|
-
* The values go through {@link normalizeCredentialValue} and then the shape check, so a
|
|
61
|
-
* quote-preserving load is impossible here; a contaminated value fails `AutotaskConfigError` with
|
|
62
|
-
* code `INVALID_CREDENTIAL_SHAPE` and NO request is ever sent.
|
|
63
|
-
*/
|
|
64
|
-
declare function loadAutotaskCredentialEnvFile(path: string, names?: AutotaskCredentialNames): AutotaskCredentials;
|
|
65
|
-
/**
|
|
66
|
-
* Load the Autotask credentials from a process-env-shaped record (default `process.env`) using the
|
|
67
|
-
* SAME shell-equivalent value handling and shape checks as the file loader — the one path the
|
|
68
|
-
* live scripts, a shell-sourced env and a caller-supplied record all share.
|
|
69
|
-
*
|
|
70
|
-
* Values already correct in `process.env` are returned unchanged; a value that was placed there
|
|
71
|
-
* with its quotes intact (e.g. by a quote-preserving loader) is repaired by the same ONE-pair
|
|
72
|
-
* strip, and a value that no load can repair fails closed. The two DEPRECATED aliases
|
|
73
|
-
* (`AUTOTASK_API_CODE` / `AUTOTASK_API_INTEGRATION_CODE`, `AUTOTASK_USER`) are read as fall-backs
|
|
74
|
-
* when the canonical variable is unset or blank — canonical first.
|
|
75
|
-
*/
|
|
76
|
-
declare function loadAutotaskCredentialsFromEnv(env?: Record<string, string | undefined>, names?: AutotaskCredentialNames): AutotaskCredentials;
|
|
77
|
-
|
|
78
|
-
export { type AutotaskCredentialNames, type AutotaskCredentials, type CredentialEnvLine, loadAutotaskCredentialEnvFile, loadAutotaskCredentialsFromEnv, normalizeCredentialValue, parseCredentialEnvText, readCredentialEnvFile };
|
package/dist/credentials.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadAutotaskCredentialEnvFile,
|
|
3
|
-
loadAutotaskCredentialsFromEnv,
|
|
4
|
-
normalizeCredentialValue,
|
|
5
|
-
parseCredentialEnvText,
|
|
6
|
-
readCredentialEnvFile
|
|
7
|
-
} from "./chunk-OOEVTGP4.js";
|
|
8
|
-
import "./chunk-FE225M76.js";
|
|
9
|
-
import "./chunk-QF4K3XTK.js";
|
|
10
|
-
export {
|
|
11
|
-
loadAutotaskCredentialEnvFile,
|
|
12
|
-
loadAutotaskCredentialsFromEnv,
|
|
13
|
-
normalizeCredentialValue,
|
|
14
|
-
parseCredentialEnvText,
|
|
15
|
-
readCredentialEnvFile
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=credentials.js.map
|
package/dist/credentials.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|