@ts-cloud/core 0.16.90 → 0.16.92

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.
@@ -6,11 +6,11 @@ export interface AWSCredentials {
6
6
  region?: string;
7
7
  }
8
8
  export interface CredentialProviderOptions {
9
- /** Profile name for shared credentials file (default: 'default' or AWS_PROFILE env var) */
9
+ /** Profile name (default: AWS_PROFILE, then AWS_DEFAULT_PROFILE, then 'default') */
10
10
  profile?: string;
11
- /** Path to credentials file (default: ~/.aws/credentials) */
11
+ /** Path to credentials file (default: AWS_SHARED_CREDENTIALS_FILE, then ~/.aws/credentials) */
12
12
  credentialsFile?: string;
13
- /** Path to config file (default: ~/.aws/config) */
13
+ /** Path to config file (default: AWS_CONFIG_FILE, then ~/.aws/config) */
14
14
  configFile?: string;
15
15
  /** Timeout for metadata requests in ms (default: 1000) */
16
16
  timeout?: number;
@@ -21,9 +21,17 @@ export interface CredentialProviderOptions {
21
21
  */
22
22
  export declare function fromEnvironment(): AWSCredentials | null;
23
23
  /**
24
- * Get credentials from shared credentials file (~/.aws/credentials)
24
+ * Get credentials from the shared files: static keys in `~/.aws/credentials`
25
+ * (or the profile's section of `~/.aws/config`). A `credential_process` is not
26
+ * run here, since this is synchronous; see `fromCredentialProcess`.
25
27
  */
26
28
  export declare function fromSharedCredentials(options?: CredentialProviderOptions): AWSCredentials | null;
29
+ /**
30
+ * Get credentials from the profile's `credential_process` (in `~/.aws/config`
31
+ * or `~/.aws/credentials`), the way `aws --profile` does. `null` when the
32
+ * profile has none; a helper that fails, hangs or prints junk throws.
33
+ */
34
+ export declare function fromCredentialProcess(options?: CredentialProviderOptions): Promise<AWSCredentials | null>;
27
35
  /**
28
36
  * Get credentials from EC2 instance metadata service (IMDSv2)
29
37
  */
@@ -38,7 +46,7 @@ export declare function fromECSMetadata(options?: CredentialProviderOptions): Pr
38
46
  export declare function fromWebIdentity(options?: CredentialProviderOptions): Promise<AWSCredentials | null>;
39
47
  /**
40
48
  * Get credentials using the default credential chain
41
- * Tries providers in order: Environment -> Shared Credentials -> Web Identity -> ECS -> EC2
49
+ * Tries providers in order: Environment -> Shared Credentials -> credential_process -> Web Identity -> ECS -> EC2
42
50
  */
43
51
  export declare function getCredentials(options?: CredentialProviderOptions): Promise<AWSCredentials>;
44
52
  /**
@@ -1,7 +1,9 @@
1
1
  export { signRequest, signRequestAsync, makeAWSRequest, makeAWSRequestAsync, makeAWSRequestOnce, createPresignedUrl, createPresignedUrlAsync, detectServiceRegion, clearSigningKeyCache, getSigningKeyCacheSize, parseXMLResponse, parseJSONResponse, isNodeCryptoAvailable, isWebCryptoAvailable, } from './signature';
2
2
  export type { SignatureOptions, SignedRequest, PresignedUrlOptions, RetryOptions } from './signature';
3
- export { fromEnvironment, fromSharedCredentials, fromEC2Metadata, fromECSMetadata, fromWebIdentity, getCredentials, createCredentialProvider, resolveCredentials, resolveRegion, getAccountId, } from './credentials';
3
+ export { fromEnvironment, fromSharedCredentials, fromCredentialProcess, fromEC2Metadata, fromECSMetadata, fromWebIdentity, getCredentials, createCredentialProvider, resolveCredentials, resolveRegion, getAccountId, } from './credentials';
4
4
  export type { AWSCredentials, AWSProfile, CredentialProviderOptions } from './credentials';
5
+ export { CREDENTIAL_PROCESS_TIMEOUT_MS, CredentialProcessError, clearCredentialProcessCache, loadProfileCredentials, loadProfileCredentialsSync, loadStaticProfileCredentials, profileCredentialProcess, readSharedProfile, resolveProfileName, sharedConfigPath, sharedCredentialsPath, splitCommandLine, } from './shared-config';
6
+ export type { ProfileCredentials, SharedConfigOptions } from './shared-config';
5
7
  export { CloudFormationClient } from './cloudformation';
6
8
  export type { CloudFormationStack, CreateStackOptions, UpdateStackOptions, StackEvent } from './cloudformation';
7
9
  export { S3Client, S3Error, createS3Client } from './s3';
@@ -0,0 +1,58 @@
1
+ export interface ProfileCredentials {
2
+ accessKeyId: string;
3
+ secretAccessKey: string;
4
+ sessionToken?: string;
5
+ /** Set when the credentials expire (a `credential_process` that reported one). */
6
+ expiration?: Date;
7
+ }
8
+ export interface SharedConfigOptions {
9
+ /** Profile name; falls back to AWS_PROFILE, AWS_DEFAULT_PROFILE, then `default`. */
10
+ profile?: string;
11
+ /** Credentials file path; falls back to AWS_SHARED_CREDENTIALS_FILE, then ~/.aws/credentials. */
12
+ credentialsFile?: string;
13
+ /** Config file path; falls back to AWS_CONFIG_FILE, then ~/.aws/config. */
14
+ configFile?: string;
15
+ /** How long a `credential_process` may run before it is killed (default 30 000 ms). */
16
+ timeoutMs?: number;
17
+ }
18
+ /** Default budget for a `credential_process`. */
19
+ export declare const CREDENTIAL_PROCESS_TIMEOUT_MS = 30000;
20
+ /** Raised when a `credential_process` fails, times out or prints something unusable. */
21
+ export declare class CredentialProcessError extends Error {
22
+ readonly code = "CredentialProcessError";
23
+ readonly profile: string;
24
+ readonly command: string;
25
+ constructor(profile: string, command: string, reason: string);
26
+ }
27
+ /** The profile in effect: explicit, AWS_PROFILE, AWS_DEFAULT_PROFILE, `default`. */
28
+ export declare function resolveProfileName(explicit?: string): string;
29
+ export declare function sharedCredentialsPath(override?: string): string;
30
+ export declare function sharedConfigPath(override?: string): string;
31
+ /**
32
+ * Every setting of a profile, from the config and credentials files merged (the
33
+ * credentials file wins). `undefined` when neither file defines the profile.
34
+ */
35
+ export declare function readSharedProfile(options?: SharedConfigOptions): Record<string, string> | undefined;
36
+ /** Static keys from the profile, without running anything. */
37
+ export declare function loadStaticProfileCredentials(options?: SharedConfigOptions): ProfileCredentials | null;
38
+ /** The profile's `credential_process` command line, if it has one. */
39
+ export declare function profileCredentialProcess(options?: SharedConfigOptions): string | null;
40
+ /**
41
+ * Split a command line into argv the way a POSIX shell would: whitespace
42
+ * separates words, single quotes are literal, double quotes allow `\"` and `\\`,
43
+ * and a backslash outside quotes escapes the next character. No variable,
44
+ * glob, tilde or command expansion happens: the result is spawned directly.
45
+ * On Windows a backslash outside quotes stays literal, so paths survive.
46
+ */
47
+ export declare function splitCommandLine(command: string, platform?: string): string[];
48
+ /** Forget every credential a `credential_process` issued (for tests and sign-out). */
49
+ export declare function clearCredentialProcessCache(): void;
50
+ /**
51
+ * Credentials for the profile, running its `credential_process` when it has one
52
+ * and no static keys. `null` when the profile defines neither. A failing helper
53
+ * throws a CredentialProcessError rather than returning null: it was configured,
54
+ * so falling through to some other source would hide the real problem.
55
+ */
56
+ export declare function loadProfileCredentials(options?: SharedConfigOptions): Promise<ProfileCredentials | null>;
57
+ /** Synchronous twin of loadProfileCredentials, for the callers that cannot await. */
58
+ export declare function loadProfileCredentialsSync(options?: SharedConfigOptions): ProfileCredentials | null;
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export * from './presets/management-dashboard';
37
37
  export * from './presets/extend';
38
38
  export * from './aws/signature';
39
39
  export * from './aws/credentials';
40
+ export * from './aws/shared-config';
40
41
  export * from './aws/cloudformation';
41
42
  export { S3Client, S3Error, createS3Client, type S3ClientOptions, type GetObjectOptions, type PutObjectOptions, type ListObjectsOptions, type ListObjectsResult, type S3Object, type HeadObjectResult, type CopyObjectOptions, type MultipartUploadOptions, type MultipartProgress, type PresignedUrlOptions as S3PresignedUrlOptions, } from './aws/s3';
42
43
  export * from './aws/cloudfront';