@smithy/shared-ini-file-loader 1.0.1 → 1.0.3

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.
@@ -0,0 +1,2 @@
1
+ export declare const ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
2
+ export declare const getConfigFilepath: () => string;
@@ -0,0 +1,2 @@
1
+ export declare const ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
2
+ export declare const getCredentialsFilepath: () => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get the HOME directory for the current runtime.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare const getHomeDir: () => string;
@@ -0,0 +1,7 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ /**
3
+ * Returns the profile data from parsed ini data.
4
+ * * Returns data for `default`
5
+ * * Reads profileName after profile prefix including/excluding quotes
6
+ */
7
+ export declare const getProfileData: (data: ParsedIniData) => ParsedIniData;
@@ -0,0 +1,5 @@
1
+ export declare const ENV_PROFILE = "AWS_PROFILE";
2
+ export declare const DEFAULT_PROFILE = "default";
3
+ export declare const getProfileName: (init: {
4
+ profile?: string;
5
+ }) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns the filepath of the file where SSO token is stored.
3
+ */
4
+ export declare const getSSOTokenFilepath: (id: string) => string;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Cached SSO token retrieved from SSO login flow.
3
+ */
4
+ export interface SSOToken {
5
+ /**
6
+ * A base64 encoded string returned by the sso-oidc service.
7
+ */
8
+ accessToken: string;
9
+ /**
10
+ * The expiration time of the accessToken as an RFC 3339 formatted timestamp.
11
+ */
12
+ expiresAt: string;
13
+ /**
14
+ * The token used to obtain an access token in the event that the accessToken is invalid or expired.
15
+ */
16
+ refreshToken?: string;
17
+ /**
18
+ * The unique identifier string for each client. The client ID generated when performing the registration
19
+ * portion of the OIDC authorization flow. This is used to refresh the accessToken.
20
+ */
21
+ clientId?: string;
22
+ /**
23
+ * A secret string generated when performing the registration portion of the OIDC authorization flow.
24
+ * This is used to refresh the accessToken.
25
+ */
26
+ clientSecret?: string;
27
+ /**
28
+ * The expiration time of the client registration (clientId and clientSecret) as an RFC 3339 formatted timestamp.
29
+ */
30
+ registrationExpiresAt?: string;
31
+ /**
32
+ * The configured sso_region for the profile that credentials are being resolved for.
33
+ */
34
+ region?: string;
35
+ /**
36
+ * The configured sso_start_url for the profile that credentials are being resolved for.
37
+ */
38
+ startUrl?: string;
39
+ }
40
+ /**
41
+ * @param id - can be either a start URL or the SSO session name.
42
+ * Returns the SSO token from the file system.
43
+ */
44
+ export declare const getSSOTokenFromFile: (id: string) => Promise<SSOToken>;
@@ -0,0 +1,6 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ /**
3
+ * Returns the sso-session data from parsed ini data by reading
4
+ * ssoSessionName after sso-session prefix including/excluding quotes
5
+ */
6
+ export declare const getSsoSessionData: (data: ParsedIniData) => ParsedIniData;
@@ -0,0 +1,8 @@
1
+ export * from "./getHomeDir";
2
+ export * from "./getProfileName";
3
+ export * from "./getSSOTokenFilepath";
4
+ export * from "./getSSOTokenFromFile";
5
+ export * from "./loadSharedConfigFiles";
6
+ export * from "./loadSsoSessionData";
7
+ export * from "./parseKnownFiles";
8
+ export * from "./types";
@@ -0,0 +1,21 @@
1
+ import { SharedConfigFiles } from "@smithy/types";
2
+ export interface SharedConfigInit {
3
+ /**
4
+ * The path at which to locate the ini credentials file. Defaults to the
5
+ * value of the `AWS_SHARED_CREDENTIALS_FILE` environment variable (if
6
+ * defined) or `~/.aws/credentials` otherwise.
7
+ */
8
+ filepath?: string;
9
+ /**
10
+ * The path at which to locate the ini config file. Defaults to the value of
11
+ * the `AWS_CONFIG_FILE` environment variable (if defined) or
12
+ * `~/.aws/config` otherwise.
13
+ */
14
+ configFilepath?: string;
15
+ /**
16
+ * Configuration files are normally cached after the first time they are loaded. When this
17
+ * property is set, the provider will always reload any configuration files loaded before.
18
+ */
19
+ ignoreCache?: boolean;
20
+ }
21
+ export declare const loadSharedConfigFiles: (init?: SharedConfigInit) => Promise<SharedConfigFiles>;
@@ -0,0 +1,10 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ export interface SsoSessionInit {
3
+ /**
4
+ * The path at which to locate the ini config file. Defaults to the value of
5
+ * the `AWS_CONFIG_FILE` environment variable (if defined) or
6
+ * `~/.aws/config` otherwise.
7
+ */
8
+ configFilepath?: string;
9
+ }
10
+ export declare const loadSsoSessionData: (init?: SsoSessionInit) => Promise<ParsedIniData>;
@@ -0,0 +1,7 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ /**
3
+ * Merge multiple profile config files such that settings each file are kept together
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const mergeConfigFiles: (...files: ParsedIniData[]) => ParsedIniData;
@@ -0,0 +1,2 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ export declare const parseIni: (iniData: string) => ParsedIniData;
@@ -0,0 +1,15 @@
1
+ import { ParsedIniData } from "@smithy/types";
2
+ import { SharedConfigInit } from "./loadSharedConfigFiles";
3
+ export interface SourceProfileInit extends SharedConfigInit {
4
+ /**
5
+ * The configuration profile to use.
6
+ */
7
+ profile?: string;
8
+ }
9
+ /**
10
+ * Load profiles from credentials and config INI files and normalize them into a
11
+ * single profile list.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const parseKnownFiles: (init: SourceProfileInit) => Promise<ParsedIniData>;
@@ -0,0 +1,5 @@
1
+ interface SlurpFileOptions {
2
+ ignoreCache?: boolean;
3
+ }
4
+ export declare const slurpFile: (path: string, options?: SlurpFileOptions) => Promise<string>;
5
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ParsedIniData as __ParsedIniData, Profile as __Profile, SharedConfigFiles as __SharedConfigFiles } from "@smithy/types";
2
+ /**
3
+ * @deprecated Use Profile from "@smithy/types" instead
4
+ */
5
+ export type Profile = __Profile;
6
+ /**
7
+ * @deprecated Use ParsedIniData from "@smithy/types" instead
8
+ */
9
+ export type ParsedIniData = __ParsedIniData;
10
+ /**
11
+ * @deprecated Use SharedConfigFiles from "@smithy/types" instead
12
+ */
13
+ export type SharedConfigFiles = __SharedConfigFiles;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@smithy/shared-ini-file-loader",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "dependencies": {
5
- "@smithy/types": "^1.1.0",
5
+ "@smithy/types": "^2.0.0",
6
6
  "tslib": "^2.5.0"
7
7
  },
8
8
  "devDependencies": {
@@ -16,7 +16,7 @@
16
16
  "typescript": "~4.9.5"
17
17
  },
18
18
  "scripts": {
19
- "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
19
+ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
20
20
  "build:cjs": "tsc -p tsconfig.cjs.json",
21
21
  "build:es": "tsc -p tsconfig.es.json",
22
22
  "build:types": "tsc -p tsconfig.types.json",