sdk-environment 0.1.5 → 0.1.7

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 (42) hide show
  1. package/bin/run.bun.sdk-environment.bc +1 -1
  2. package/dist/domain.operations/getEnvironment/getEnvironment.d.ts +11 -3
  3. package/dist/domain.operations/getEnvironment/getEnvironment.js +6 -5
  4. package/dist/domain.operations/getEnvironment/getEnvironment.js.map +1 -1
  5. package/dist/domain.operations/parsers/access/asCacheKeyFromAccessKeyId.d.ts +8 -0
  6. package/dist/domain.operations/parsers/access/asCacheKeyFromAccessKeyId.js +12 -0
  7. package/dist/domain.operations/parsers/access/asCacheKeyFromAccessKeyId.js.map +1 -0
  8. package/dist/domain.operations/parsers/access/getAccessKeyIdFromAccountClient.d.ts +15 -0
  9. package/dist/domain.operations/parsers/access/getAccessKeyIdFromAccountClient.js +18 -0
  10. package/dist/domain.operations/parsers/access/getAccessKeyIdFromAccountClient.js.map +1 -0
  11. package/dist/domain.operations/parsers/access/getEnvAccess.d.ts +4 -0
  12. package/dist/domain.operations/parsers/access/getEnvAccessFromAwsAccountName.d.ts +23 -0
  13. package/dist/domain.operations/parsers/access/getEnvAccessFromAwsAccountName.js +67 -30
  14. package/dist/domain.operations/parsers/access/getEnvAccessFromAwsAccountName.js.map +1 -1
  15. package/dist/domain.operations/parsers/access/isCredentialError.d.ts +9 -0
  16. package/dist/domain.operations/parsers/access/isCredentialError.js +38 -0
  17. package/dist/domain.operations/parsers/access/isCredentialError.js.map +1 -0
  18. package/dist/domain.operations/parsers/access/isModuleNotFoundError.d.ts +8 -0
  19. package/dist/domain.operations/parsers/access/isModuleNotFoundError.js +15 -0
  20. package/dist/domain.operations/parsers/access/isModuleNotFoundError.js.map +1 -0
  21. package/dist/domain.operations/parsers/access/isServerTransientError.d.ts +11 -0
  22. package/dist/domain.operations/parsers/access/isServerTransientError.js +22 -0
  23. package/dist/domain.operations/parsers/access/isServerTransientError.js.map +1 -0
  24. package/dist/domain.operations/parsers/access/isThrottleError.d.ts +10 -0
  25. package/dist/domain.operations/parsers/access/isThrottleError.js +30 -0
  26. package/dist/domain.operations/parsers/access/isThrottleError.js.map +1 -0
  27. package/dist/domain.operations/parsers/access/sleep.d.ts +6 -0
  28. package/dist/domain.operations/parsers/access/sleep.js +11 -0
  29. package/dist/domain.operations/parsers/access/sleep.js.map +1 -0
  30. package/dist/domain.operations/parsers/access/withCacheAcrossProcesses.d.ts +29 -0
  31. package/dist/domain.operations/parsers/access/withCacheAcrossProcesses.js +451 -0
  32. package/dist/domain.operations/parsers/access/withCacheAcrossProcesses.js.map +1 -0
  33. package/dist/domain.operations/parsers/access/withRetryOnThrottle.d.ts +11 -0
  34. package/dist/domain.operations/parsers/access/withRetryOnThrottle.js +44 -0
  35. package/dist/domain.operations/parsers/access/withRetryOnThrottle.js.map +1 -0
  36. package/dist/domain.operations/parsers/factories.d.ts +2 -1
  37. package/dist/domain.operations/parsers/factories.js +4 -1
  38. package/dist/domain.operations/parsers/factories.js.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/package.json +14 -9
  42. package/readme.md +25 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/run.bun.sdk-environment.bc
3
3
  size: 104400419 bytes
4
- sha256: 8a41a0a77fe0f7595a371087e7eb8f87fc3ea557eec80780a656338654b4fc0d
4
+ sha256: d350e9f6e1747dd38d343f11c421b28fbb2d07fa0939499ec3c246d20a4db0f7
@@ -9,12 +9,20 @@ import type { EnvironmentServerTier } from '../../domain.objects/EnvironmentServ
9
9
  * .why = enables custom parser configuration
10
10
  */
11
11
  export type SyncParser<T> = () => T | null;
12
- export type AsyncParser<T> = () => T | null | Promise<T | null>;
12
+ export type AsyncParser<T> = (context?: ParserContext) => T | null | Promise<T | null>;
13
+ /**
14
+ * .what = what getEnvironment.filled() hands each async parser
15
+ * .why = a parser with a cache of its own (e.g. the shared aws account name file)
16
+ * honors the caller's cache: 'skip'; a parser that takes no arg ignores it
17
+ */
18
+ export interface ParserContext {
19
+ cache: 'skip' | null;
20
+ }
13
21
  /**
14
22
  * .what = union parser type for public API
15
- * .why = matches README: type Parser<T> = () => T | null | Promise<T | null>
23
+ * .why = matches README: type Parser<T> = (context?) => T | null | Promise<T | null>
16
24
  */
17
- export type Parser<T> = () => T | null | Promise<T | null>;
25
+ export type Parser<T> = (context?: ParserContext) => T | null | Promise<T | null>;
18
26
  /**
19
27
  * .what = cached version of _filled
20
28
  * .why = avoid repeated parser invocations
@@ -82,9 +82,9 @@ const shouldBypassCacheGet = (input) => input?.cache === 'skip';
82
82
  * .what = run parser chain until first non-null result
83
83
  * .why = first-wins precedence
84
84
  */
85
- const getOneFromParsersAsync = async (parsers, validate, attributeName) => {
85
+ const getOneFromParsersAsync = async (parsers, validate, attributeName, context) => {
86
86
  for (const { parser, name } of parsers) {
87
- const result = await parser();
87
+ const result = await parser(context);
88
88
  if (result !== null) {
89
89
  if (!validate(result)) {
90
90
  throw new helpful_errors_1.BadRequestError(`invalid ${attributeName} value: ${JSON.stringify(result)}. parser: ${name}`);
@@ -115,13 +115,13 @@ const getOneFromParsersSync = (parsers, validate, attributeName) => {
115
115
  * .why = separated to enable cache wrapper
116
116
  */
117
117
  const computeFilledEnvironment = async (input) => {
118
- const access = await getOneFromParsersAsync(asParsersNamed(input.accessParsers), isEnvironmentAccessTier_1.isEnvironmentAccessTier, 'access');
118
+ const access = await getOneFromParsersAsync(asParsersNamed(input.accessParsers), isEnvironmentAccessTier_1.isEnvironmentAccessTier, 'access', input.context);
119
119
  // config depends on access
120
120
  const configParsers = input.configParsersFactory(access);
121
121
  const config = getOneFromParsersSync(asParsersNamed(configParsers), isEnvironmentConfigSlug_1.isEnvironmentConfigSlug, 'config');
122
122
  (0, isValidConfigForAccess_1.isValidConfigForAccess)({ config, access });
123
- const server = await getOneFromParsersAsync(asParsersNamed(input.serverParsers), isEnvironmentServerTier_1.isEnvironmentServerTier, 'server');
124
- const commit = await getOneFromParsersAsync(asParsersNamed(input.commitParsers), isEnvironmentCommitSlug_1.isEnvironmentCommitSlug, 'commit');
123
+ const server = await getOneFromParsersAsync(asParsersNamed(input.serverParsers), isEnvironmentServerTier_1.isEnvironmentServerTier, 'server', input.context);
124
+ const commit = await getOneFromParsersAsync(asParsersNamed(input.commitParsers), isEnvironmentCommitSlug_1.isEnvironmentCommitSlug, 'commit', input.context);
125
125
  return { access, config, server, commit };
126
126
  };
127
127
  /**
@@ -134,6 +134,7 @@ const _filled = async (input) => {
134
134
  configParsersFactory: input?.parsers?.config ?? DEFAULT_CONFIG_PARSERS,
135
135
  serverParsers: input?.parsers?.server ?? DEFAULT_SERVER_PARSERS,
136
136
  commitParsers: input?.parsers?.commit ?? DEFAULT_COMMIT_PARSERS,
137
+ context: { cache: input?.cache === 'skip' ? 'skip' : null }, // a parser's own cache honors the skip too
137
138
  };
138
139
  return computeFilledEnvironment(parsersConfig);
139
140
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getEnvironment.js","sourceRoot":"","sources":["../../../src/domain.operations/getEnvironment/getEnvironment.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAC1E,mEAA+E;AAC/E,yDAAoD;AAOpD,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,uGAAoG;AACpG,uGAAoG;AACpG,uGAAoG;AACpG,uGAAoG;AACpG,qGAAkG;AAelG;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAG1B,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,UAAU,KAAK,CAAC,KAAK,GAAG,CAAC;AAE5D;;;GAGG;AACH,MAAM,cAAc,GAAG,CACrB,OAAuB,EACmB,EAAE,CAC5C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,MAAM;IACN,IAAI,EAAE,iBAAiB,CAAC,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;IACf,MAAM,aAAa,GAAG;QACpB,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,2BAA2B;QACpE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,sBAAsB;QACtE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,sBAAsB;QAC/D,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,2BAA2B;KACrE,CAAC;IACF,OAAO,wBAAwB,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,SAAS,GAAG,IAAA,mCAAe,EAAC,UAAU,EAAE;IAC5C,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,UAAU,GAAG,KAAK,EAAE,KAAK,CAAC;QAChC,IAAI,UAAU,KAAK,MAAM;YAAE,OAAO,kBAAkB,CAAC,CAAC,iCAAiC;QACvF,OAAO,UAAU,IAAI,kBAAkB,CAAC;IAC1C,CAAC;IACD,MAAM,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE;IACrC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAYH,MAAM,gBAAgB,GAAmB,MAAM,CAAC,MAAM;AACpD,kCAAkC;AAClC,CAAC,KAAoC,EAAwB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7E;IACE;;OAEG;IACH,MAAM;IAEN;;OAEG;IACH,MAAM,EAAE,SAAS;CAClB,CACF,CAAC;AAEW,QAAA,cAAc,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"getEnvironment.js","sourceRoot":"","sources":["../../../src/domain.operations/getEnvironment/getEnvironment.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAC1E,mEAA+E;AAC/E,yDAAoD;AAOpD,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,uGAAoG;AACp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CAAC;IAC1C,CAAC;IACD,MAAM,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE;IACrC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAYH,MAAM,gBAAgB,GAAmB,MAAM,CAAC,MAAM;AACpD,kCAAkC;AAClC,CAAC,KAAoC,EAAwB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAC7E;IACE;;OAEG;IACH,MAAM;IAEN;;OAEG;IACH,MAAM,EAAE,SAAS;CAClB,CACF,CAAC;AAEW,QAAA,cAAc,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * .what = derive a filesystem-safe cache key from an aws access key id
3
+ * .why = names the caller with no network call; the hash keeps the key id off disk,
4
+ * and other credentials always map to another key, so no caller reads another's name
5
+ */
6
+ export declare const asCacheKeyFromAccessKeyId: (input: {
7
+ accessKeyId: string;
8
+ }) => string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asCacheKeyFromAccessKeyId = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ /**
6
+ * .what = derive a filesystem-safe cache key from an aws access key id
7
+ * .why = names the caller with no network call; the hash keeps the key id off disk,
8
+ * and other credentials always map to another key, so no caller reads another's name
9
+ */
10
+ const asCacheKeyFromAccessKeyId = (input) => (0, node_crypto_1.createHash)('sha256').update(input.accessKeyId).digest('hex').slice(0, 32);
11
+ exports.asCacheKeyFromAccessKeyId = asCacheKeyFromAccessKeyId;
12
+ //# sourceMappingURL=asCacheKeyFromAccessKeyId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asCacheKeyFromAccessKeyId.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/asCacheKeyFromAccessKeyId.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;;GAIG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAEzC,EAAU,EAAE,CACX,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAH/D,QAAA,yBAAyB,6BAGsC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * .what = read the caller's access key id from an aws account client
3
+ * .why = names the caller for the shared cache with no aws api call; a client
4
+ * built by a module-level mock of the sdk holds no config, so no key names
5
+ * the caller and the parser asks aws direct
6
+ */
7
+ export declare const getAccessKeyIdFromAccountClient: (input: {
8
+ client: {
9
+ config?: {
10
+ credentials?: () => Promise<{
11
+ accessKeyId: string;
12
+ }>;
13
+ };
14
+ };
15
+ }) => Promise<string | null>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccessKeyIdFromAccountClient = void 0;
4
+ /**
5
+ * .what = read the caller's access key id from an aws account client
6
+ * .why = names the caller for the shared cache with no aws api call; a client
7
+ * built by a module-level mock of the sdk holds no config, so no key names
8
+ * the caller and the parser asks aws direct
9
+ */
10
+ const getAccessKeyIdFromAccountClient = async (input) => {
11
+ // a module-level mock of the sdk builds a client with no config; it holds no key
12
+ const credentials = input.client.config?.credentials;
13
+ if (typeof credentials !== 'function')
14
+ return null;
15
+ return (await credentials()).accessKeyId;
16
+ };
17
+ exports.getAccessKeyIdFromAccountClient = getAccessKeyIdFromAccountClient;
18
+ //# sourceMappingURL=getAccessKeyIdFromAccountClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccessKeyIdFromAccountClient.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/getAccessKeyIdFromAccountClient.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,+BAA+B,GAAG,KAAK,EAAE,KAIrD,EAA0B,EAAE;IAC3B,iFAAiF;IACjF,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IACrD,IAAI,OAAO,WAAW,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;AAC3C,CAAC,CAAC;AATW,QAAA,+BAA+B,mCAS1C"}
@@ -9,6 +9,10 @@ export declare const getEnvAccess: {
9
9
  } | undefined) => Promise<import("../../..").EnvironmentAccessTier | null>;
10
10
  fromAwsAccountName: (input?: {
11
11
  map?: import("./getEnvAccessFromAwsAccountName").AwsAccountPatternMap | undefined;
12
+ cache?: "skip" | null | undefined;
13
+ } | undefined, context?: {
14
+ sdkAwsAccount?: import("./getEnvAccessFromAwsAccountName").SdkAwsAccount | undefined;
15
+ cacheDir?: string | undefined;
12
16
  } | undefined) => Promise<import("../../..").EnvironmentAccessTier | null>;
13
17
  fromNodeEnv: () => import("../../..").EnvironmentAccessTier | null;
14
18
  };
@@ -12,10 +12,33 @@ export interface AwsAccountPatternMap {
12
12
  * .why = exact match wins, then glob match in order
13
13
  */
14
14
  export declare const matchNameToAccess: (name: string, map: AwsAccountPatternMap) => EnvironmentAccessTier | null;
15
+ /**
16
+ * .what = the aws account calls this parser needs
17
+ * .why = one seam for the real sdk and for a test double
18
+ */
19
+ export interface SdkAwsAccount {
20
+ /**
21
+ * reads the caller's access key id from its loaded credentials. no aws api call
22
+ * for static (env) credentials; a profile provider (sso, assume-role, instance role)
23
+ * loads them from its own source, once per process
24
+ * null = the client holds no credential provider (e.g. a module-level mock), so no key names the caller
25
+ */
26
+ getAccessKeyId: () => Promise<string | null>;
27
+ /** calls GetAccountInformation */
28
+ getAccountName: () => Promise<string | null>;
29
+ }
15
30
  /**
16
31
  * .what = parse access tier from aws account name
17
32
  * .why = fallback when alias not set (name is always present)
33
+ * .note = the name is shared across processes via a file cache keyed by the
34
+ * caller's access key id, so N cold processes make one aws call;
35
+ * a throttle reply backs off and retries
36
+ * .note = cache 'skip' asks aws fresh past the shared file, then rewrites it
18
37
  */
19
38
  export declare const getEnvAccessFromAwsAccountName: (input?: {
20
39
  map?: AwsAccountPatternMap;
40
+ cache?: 'skip' | null;
41
+ }, context?: {
42
+ sdkAwsAccount?: SdkAwsAccount;
43
+ cacheDir?: string;
21
44
  }) => Promise<EnvironmentAccessTier | null>;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEnvAccessFromAwsAccountName = exports.matchNameToAccess = void 0;
4
+ const os_1 = require("os");
5
+ const path_1 = require("path");
6
+ const asCacheKeyFromAccessKeyId_1 = require("./asCacheKeyFromAccessKeyId");
7
+ const getAccessKeyIdFromAccountClient_1 = require("./getAccessKeyIdFromAccountClient");
8
+ const isCredentialError_1 = require("./isCredentialError");
9
+ const isModuleNotFoundError_1 = require("./isModuleNotFoundError");
10
+ const isServerTransientError_1 = require("./isServerTransientError");
11
+ const withCacheAcrossProcesses_1 = require("./withCacheAcrossProcesses");
12
+ const withRetryOnThrottle_1 = require("./withRetryOnThrottle");
4
13
  const DEFAULT_MAP = {
5
14
  '*-prod': 'prod',
6
15
  '*-prep': 'prep',
@@ -25,47 +34,75 @@ const matchNameToAccess = (name, map) => {
25
34
  return null;
26
35
  };
27
36
  exports.matchNameToAccess = matchNameToAccess;
37
+ /**
38
+ * .what = build the real aws account sdk
39
+ * .why = dynamic import keeps the optional peer dep out of the bundle when unused
40
+ */
41
+ const getSdkAwsAccountDefault = async () => {
42
+ const { AccountClient, GetAccountInformationCommand } = await import('@aws-sdk/client-account');
43
+ const client = new AccountClient({});
44
+ return {
45
+ getAccessKeyId: () => (0, getAccessKeyIdFromAccountClient_1.getAccessKeyIdFromAccountClient)({ client }),
46
+ getAccountName: async () => (await client.send(new GetAccountInformationCommand({}))).AccountName ??
47
+ null,
48
+ };
49
+ };
50
+ /**
51
+ * .what = where the shared account-name cache lives on this host
52
+ * .why = one dir per os account (uid) under the os temp dir, so accounts never share or block each other
53
+ */
54
+ const getCacheDirDefault = () => (0, path_1.join)((0, os_1.tmpdir)(), `sdk-environment.uid=${process.getuid?.() ?? 'na'}`, 'aws-account-name');
55
+ /**
56
+ * .what = shared cache + throttle retry tune
57
+ * .why = ttl bounds how long a rename takes to show: an access key id belongs to one
58
+ * principal in one account for life, so a key never maps to another account's name,
59
+ * and only a rare rename ages; retry outlasts the sdk's own 3 attempts;
60
+ * a live holder's lock is never broken before the stale bound
61
+ */
62
+ const CACHE_TTL_MS = 60 * 60 * 1000;
63
+ const LOCK_STALE_MS = 60 * 1000;
64
+ const LOCK_POLL_MS = 75;
65
+ const RETRY = { attempts: 6, baseMs: 250, capMs: 4000 };
28
66
  /**
29
67
  * .what = parse access tier from aws account name
30
68
  * .why = fallback when alias not set (name is always present)
69
+ * .note = the name is shared across processes via a file cache keyed by the
70
+ * caller's access key id, so N cold processes make one aws call;
71
+ * a throttle reply backs off and retries
72
+ * .note = cache 'skip' asks aws fresh past the shared file, then rewrites it
31
73
  */
32
- const getEnvAccessFromAwsAccountName = async (input) => {
74
+ const getEnvAccessFromAwsAccountName = async (input, context) => {
33
75
  const map = input?.map ?? DEFAULT_MAP;
34
76
  try {
35
- // dynamic import to avoid bundle size when not used
36
- const { AccountClient, GetAccountInformationCommand } = await import('@aws-sdk/client-account');
37
- const client = new AccountClient({});
38
- const response = await client.send(new GetAccountInformationCommand({}));
39
- const accountName = response.AccountName;
77
+ const sdkAwsAccount = context?.sdkAwsAccount ?? (await getSdkAwsAccountDefault());
78
+ // fetch once per host per caller; retry on throttle
79
+ const getAccountNameDirect = (0, withRetryOnThrottle_1.withRetryOnThrottle)(() => sdkAwsAccount.getAccountName(), // bound at the seam, so a class-based double keeps its `this`
80
+ RETRY);
81
+ const getAccountNameShared = (0, withCacheAcrossProcesses_1.withCacheAcrossProcesses)(getAccountNameDirect, {
82
+ dir: context?.cacheDir ?? getCacheDirDefault(),
83
+ ttlMs: CACHE_TTL_MS,
84
+ staleMs: LOCK_STALE_MS,
85
+ pollMs: LOCK_POLL_MS,
86
+ isQueueKeptOnError: isServerTransientError_1.isServerTransientError, // a throttle or a 5xx keeps one caller at a time; any other error frees the waiters to see it at once
87
+ });
88
+ // with no key to name the caller, ask direct and share naught
89
+ const accessKeyId = await sdkAwsAccount.getAccessKeyId();
90
+ const accountName = accessKeyId === null
91
+ ? await getAccountNameDirect()
92
+ : await getAccountNameShared({
93
+ key: (0, asCacheKeyFromAccessKeyId_1.asCacheKeyFromAccessKeyId)({ accessKeyId }),
94
+ cache: input?.cache ?? null,
95
+ });
40
96
  if (!accountName)
41
97
  return null;
42
98
  return (0, exports.matchNameToAccess)(accountName, map);
43
99
  }
44
100
  catch (error) {
45
- // allowlist: config/credential/auth errors return null (parser should be skipped)
46
- if (error instanceof Error) {
47
- const message = error.message.toLowerCase();
48
- const errorName = error.name.toLowerCase();
49
- const code = error.code;
50
- // sdk not installed — gracefully skip
51
- if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') {
52
- return null;
53
- }
54
- if (message.includes('region') ||
55
- message.includes('could not load credentials') ||
56
- message.includes('no credentials') ||
57
- message.includes('credential') ||
58
- message.includes('access denied') ||
59
- message.includes('not authorized') ||
60
- message.includes('security token') ||
61
- message.includes('session') ||
62
- message.includes('expired') ||
63
- message.includes('reauthentimate') ||
64
- errorName.includes('invalidclienttokenid') ||
65
- errorName.includes('credentialsprovider')) {
66
- return null;
67
- }
68
- }
101
+ // allowlist: sdk not installed, or config/credential/auth errors, skip this parser
102
+ if ((0, isModuleNotFoundError_1.isModuleNotFoundError)({ error }))
103
+ return null;
104
+ if ((0, isCredentialError_1.isCredentialError)({ error }))
105
+ return null;
69
106
  // rethrow unexpected errors
70
107
  throw error;
71
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getEnvAccessFromAwsAccountName.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/getEnvAccessFromAwsAccountName.ts"],"names":[],"mappings":";;;AAWA,MAAM,WAAW,G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AY;YACpB,kBAAkB,EAAE,+CAAsB,EAAE,sGAAsG;SACnJ,CACF,CAAC;QACF,8DAA8D;QAC9D,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,cAAc,EAAE,CAAC;QACzD,MAAM,WAAW,GACf,WAAW,KAAK,IAAI;YAClB,CAAC,CAAC,MAAM,oBAAoB,EAAE;YAC9B,CAAC,CAAC,MAAM,oBAAoB,CAAC;gBACzB,GAAG,EAAE,IAAA,qDAAyB,EAAC,EAAE,WAAW,EAAE,CAAC;gBAC/C,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,IAAI;aAC5B,CAAC,CAAC;QAET,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,IAAA,yBAAiB,EAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mFAAmF;QACnF,IAAI,IAAA,6CAAqB,EAAC,EAAE,KAAK,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QAClD,IAAI,IAAA,qCAAiB,EAAC,EAAE,KAAK,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QAE9C,4BAA4B;QAC5B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAnDW,QAAA,8BAA8B,kCAmDzC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * .what = decide whether an aws error says the caller's credentials or config are absent or refused
3
+ * .why = such an error means this parser cannot answer for these credentials, so the
4
+ * parser reads it as "skip this parser" and the next parser in the chain is tried
5
+ * .note = matched by shape (message, name), never `instanceof`: jest runs code in another realm
6
+ */
7
+ export declare const isCredentialError: (input: {
8
+ error: unknown;
9
+ }) => boolean;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCredentialError = void 0;
4
+ /**
5
+ * .what = decide whether an aws error says the caller's credentials or config are absent or refused
6
+ * .why = such an error means this parser cannot answer for these credentials, so the
7
+ * parser reads it as "skip this parser" and the next parser in the chain is tried
8
+ * .note = matched by shape (message, name), never `instanceof`: jest runs code in another realm
9
+ */
10
+ const isCredentialError = (input) => {
11
+ if (!(typeof input.error === 'object' && input.error !== null))
12
+ return false;
13
+ // a TypeError is a code defect (e.g. a property of undefined named `credentials`), never a refusal
14
+ if ('name' in input.error && input.error.name === 'TypeError')
15
+ return false;
16
+ const message = String('message' in input.error ? input.error.message : '').toLowerCase();
17
+ const name = String('name' in input.error ? input.error.name : '').toLowerCase();
18
+ return (MESSAGE_SIGNS.some((sign) => message.includes(sign)) ||
19
+ NAME_SIGNS.some((sign) => name.includes(sign)));
20
+ };
21
+ exports.isCredentialError = isCredentialError;
22
+ const MESSAGE_SIGNS = [
23
+ 'region',
24
+ 'could not load credentials',
25
+ 'no credentials',
26
+ 'credential',
27
+ 'access denied',
28
+ 'not authorized',
29
+ 'security token',
30
+ 'session',
31
+ 'expired',
32
+ 'reauthenticate',
33
+ ];
34
+ const NAME_SIGNS = [
35
+ 'invalidclienttokenid',
36
+ 'credentialsprovider',
37
+ ];
38
+ //# sourceMappingURL=isCredentialError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCredentialError.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/isCredentialError.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAyB,EAAW,EAAE;IACtE,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAE7E,mGAAmG;IACnG,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAE5E,MAAM,OAAO,GAAG,MAAM,CACpB,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CACpD,CAAC,WAAW,EAAE,CAAC;IAChB,MAAM,IAAI,GAAG,MAAM,CACjB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAC9C,CAAC,WAAW,EAAE,CAAC;IAChB,OAAO,CACL,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpD,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAC/C,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B;AAEF,MAAM,aAAa,GAAsB;IACvC,QAAQ;IACR,4BAA4B;IAC5B,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,SAAS;IACT,SAAS;IACT,gBAAgB;CACjB,CAAC;AAEF,MAAM,UAAU,GAAsB;IACpC,sBAAsB;IACtB,qBAAqB;CACtB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * .what = decide whether an error says an import could not be found
3
+ * .why = the aws sdk is an optional peer dep; when it is absent, the parser is skipped
4
+ * .note = matched by shape (`code`), never `instanceof`: jest runs code in another realm
5
+ */
6
+ export declare const isModuleNotFoundError: (input: {
7
+ error: unknown;
8
+ }) => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isModuleNotFoundError = void 0;
4
+ /**
5
+ * .what = decide whether an error says an import could not be found
6
+ * .why = the aws sdk is an optional peer dep; when it is absent, the parser is skipped
7
+ * .note = matched by shape (`code`), never `instanceof`: jest runs code in another realm
8
+ */
9
+ const isModuleNotFoundError = (input) => typeof input.error === 'object' &&
10
+ input.error !== null &&
11
+ 'code' in input.error &&
12
+ (input.error.code === 'ERR_MODULE_NOT_FOUND' ||
13
+ input.error.code === 'MODULE_NOT_FOUND');
14
+ exports.isModuleNotFoundError = isModuleNotFoundError;
15
+ //# sourceMappingURL=isModuleNotFoundError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isModuleNotFoundError.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/isModuleNotFoundError.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAyB,EAAW,EAAE,CAC1E,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;IAC/B,KAAK,CAAC,KAAK,KAAK,IAAI;IACpB,MAAM,IAAI,KAAK,CAAC,KAAK;IACrB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAsB;QAC1C,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC;AALhC,QAAA,qBAAqB,yBAKW"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * .what = decide whether an aws error says the service is briefly unable to answer
3
+ * .why = such an error may clear for the next caller, so the shared cache keeps its
4
+ * waiters in a queue, one call at a time; any other error (a credential refusal,
5
+ * an unknown host, a refused connection) fails each caller the same way, so the
6
+ * waiters are freed to see their own error at once
7
+ * .note = a throttle, or a server fault: the sdk marks a 5xx with `$fault: 'server'`
8
+ */
9
+ export declare const isServerTransientError: (input: {
10
+ error: unknown;
11
+ }) => boolean;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isServerTransientError = void 0;
4
+ const isThrottleError_1 = require("./isThrottleError");
5
+ /**
6
+ * .what = decide whether an aws error says the service is briefly unable to answer
7
+ * .why = such an error may clear for the next caller, so the shared cache keeps its
8
+ * waiters in a queue, one call at a time; any other error (a credential refusal,
9
+ * an unknown host, a refused connection) fails each caller the same way, so the
10
+ * waiters are freed to see their own error at once
11
+ * .note = a throttle, or a server fault: the sdk marks a 5xx with `$fault: 'server'`
12
+ */
13
+ const isServerTransientError = (input) => {
14
+ if ((0, isThrottleError_1.isThrottleError)(input))
15
+ return true;
16
+ return (typeof input.error === 'object' &&
17
+ input.error !== null &&
18
+ '$fault' in input.error &&
19
+ input.error.$fault === 'server');
20
+ };
21
+ exports.isServerTransientError = isServerTransientError;
22
+ //# sourceMappingURL=isServerTransientError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isServerTransientError.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/isServerTransientError.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD;;;;;;;GAOG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAyB,EAAW,EAAE;IAC3E,IAAI,IAAA,iCAAe,EAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,CACL,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,KAAK,CAAC,KAAK,KAAK,IAAI;QACpB,QAAQ,IAAI,KAAK,CAAC,KAAK;QACvB,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAChC,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * .what = decide whether an error is an aws throttle reply
3
+ * .why = only a throttle earns a retry; all other errors surface at once
4
+ * .note = reads `name` and the http status by shape, never `instanceof Error`: errors may
5
+ * cross realms. the name is what the account api sends; a 429 status covers a
6
+ * throttle that arrives under another name
7
+ */
8
+ export declare const isThrottleError: (input: {
9
+ error: unknown;
10
+ }) => boolean;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isThrottleError = void 0;
4
+ /**
5
+ * .what = decide whether an error is an aws throttle reply
6
+ * .why = only a throttle earns a retry; all other errors surface at once
7
+ * .note = reads `name` and the http status by shape, never `instanceof Error`: errors may
8
+ * cross realms. the name is what the account api sends; a 429 status covers a
9
+ * throttle that arrives under another name
10
+ */
11
+ const isThrottleError = (input) => {
12
+ if (!(typeof input.error === 'object' && input.error !== null))
13
+ return false;
14
+ if ('name' in input.error && input.error.name === 'TooManyRequestsException')
15
+ return true;
16
+ return getHttpStatusCode({ error: input.error }) === 429;
17
+ };
18
+ exports.isThrottleError = isThrottleError;
19
+ /**
20
+ * .what = read the http status an aws sdk v3 error carries, if any
21
+ * .why = the sdk sets `$metadata.httpStatusCode` on every service error
22
+ */
23
+ const getHttpStatusCode = (input) => {
24
+ const metadata = '$metadata' in input.error ? input.error.$metadata : null;
25
+ if (!(typeof metadata === 'object' && metadata !== null))
26
+ return null;
27
+ const status = 'httpStatusCode' in metadata ? metadata.httpStatusCode : null;
28
+ return typeof status === 'number' ? status : null;
29
+ };
30
+ //# sourceMappingURL=isThrottleError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isThrottleError.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/isThrottleError.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAW,EAAE;IACpE,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7E,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,0BAA0B;QAC1E,OAAO,IAAI,CAAC;IACd,OAAO,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC;AAC3D,CAAC,CAAC;AALW,QAAA,eAAe,mBAK1B;AAEF;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAwB,EAAiB,EAAE;IACpE,MAAM,QAAQ,GAAG,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,IAAI,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACtE,MAAM,MAAM,GAAG,gBAAgB,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * .what = wait for the given milliseconds
3
+ * .why = the parsers load at import time for every caller, so they use only apis
4
+ * every supported node holds; `timers/promises` needs node 15+
5
+ */
6
+ export declare const sleep: (ms: number) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ /**
5
+ * .what = wait for the given milliseconds
6
+ * .why = the parsers load at import time for every caller, so they use only apis
7
+ * every supported node holds; `timers/promises` needs node 15+
8
+ */
9
+ const sleep = (ms) => new Promise((done) => setTimeout(done, ms));
10
+ exports.sleep = sleep;
11
+ //# sourceMappingURL=sleep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../../src/domain.operations/parsers/access/sleep.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CACjD,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AADjC,QAAA,KAAK,SAC4B"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * .what = wrap an async fetch with a file cache shared by every process on this host
3
+ * .why = N cold processes make one fetch: one takes the lock and fetches; the rest
4
+ * wait, then read its file
5
+ * .note = the caller's `isQueueKeptOnError` sorts a holder's failure. one it rejects
6
+ * marks the failure, and every waiter fetches direct, in parallel. one it keeps,
7
+ * or a holder's death, leaves the next waiter to take the lock, so the api
8
+ * sees one caller at a time.
9
+ * a wait never passes the stale bound; past it, the waiter fetches direct
10
+ * .note = a lock is deleted only by pid match, so neither a holder nor a waiter
11
+ * frees a lock taken since it looked. the residual race (two waiters that
12
+ * break one dead lock within the same instant) costs one extra fetch,
13
+ * benign since the fetch is a read and the write is atomic
14
+ * .note = any fs fault, or a cache dir that is not ours, runs the fetch direct, as before
15
+ * .note = cache 'skip' never reads the shared file: it fetches fresh, then writes
16
+ * the file, so later callers on this host read the fresh value
17
+ */
18
+ export declare const withCacheAcrossProcesses: <T>(fetch: () => Promise<T>, options: {
19
+ dir: string;
20
+ ttlMs: number;
21
+ staleMs: number;
22
+ pollMs: number;
23
+ isQueueKeptOnError: (input: {
24
+ error: unknown;
25
+ }) => boolean;
26
+ }) => ((input: {
27
+ key: string;
28
+ cache: 'skip' | null;
29
+ }) => Promise<T>);