@smithy/shared-ini-file-loader 4.1.1 → 4.3.0

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.
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSSOTokenFromFile = void 0;
3
+ exports.getSSOTokenFromFile = exports.tokenIntercept = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const getSSOTokenFilepath_1 = require("./getSSOTokenFilepath");
6
6
  const { readFile } = fs_1.promises;
7
+ exports.tokenIntercept = {};
7
8
  const getSSOTokenFromFile = async (id) => {
9
+ if (exports.tokenIntercept[id]) {
10
+ return exports.tokenIntercept[id];
11
+ }
8
12
  const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id);
9
13
  const ssoTokenText = await readFile(ssoTokenFilepath, "utf8");
10
14
  return JSON.parse(ssoTokenText);
package/dist-cjs/index.js CHANGED
@@ -1,206 +1,189 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR,
25
- DEFAULT_PROFILE: () => DEFAULT_PROFILE,
26
- ENV_PROFILE: () => ENV_PROFILE,
27
- getProfileName: () => getProfileName,
28
- loadSharedConfigFiles: () => loadSharedConfigFiles,
29
- loadSsoSessionData: () => loadSsoSessionData,
30
- parseKnownFiles: () => parseKnownFiles
31
- });
32
- module.exports = __toCommonJS(index_exports);
33
- __reExport(index_exports, require("././getHomeDir"), module.exports);
1
+ 'use strict';
34
2
 
35
- // src/getProfileName.ts
36
- var ENV_PROFILE = "AWS_PROFILE";
37
- var DEFAULT_PROFILE = "default";
38
- var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName");
3
+ var getHomeDir = require('./getHomeDir');
4
+ var getSSOTokenFilepath = require('./getSSOTokenFilepath');
5
+ var getSSOTokenFromFile = require('./getSSOTokenFromFile');
6
+ var path = require('path');
7
+ var types = require('@smithy/types');
8
+ var slurpFile = require('./slurpFile');
39
9
 
40
- // src/index.ts
41
- __reExport(index_exports, require("././getSSOTokenFilepath"), module.exports);
42
- __reExport(index_exports, require("././getSSOTokenFromFile"), module.exports);
10
+ const ENV_PROFILE = "AWS_PROFILE";
11
+ const DEFAULT_PROFILE = "default";
12
+ const getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
43
13
 
44
- // src/loadSharedConfigFiles.ts
45
-
46
-
47
- // src/getConfigData.ts
48
- var import_types = require("@smithy/types");
49
- var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => {
50
- const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
51
- if (indexOfSeparator === -1) {
52
- return false;
53
- }
54
- return Object.values(import_types.IniSectionType).includes(key.substring(0, indexOfSeparator));
55
- }).reduce(
56
- (acc, [key, value]) => {
14
+ const getConfigData = (data) => Object.entries(data)
15
+ .filter(([key]) => {
16
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
17
+ if (indexOfSeparator === -1) {
18
+ return false;
19
+ }
20
+ return Object.values(types.IniSectionType).includes(key.substring(0, indexOfSeparator));
21
+ })
22
+ .reduce((acc, [key, value]) => {
57
23
  const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
58
- const updatedKey = key.substring(0, indexOfSeparator) === import_types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
24
+ const updatedKey = key.substring(0, indexOfSeparator) === types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
59
25
  acc[updatedKey] = value;
60
26
  return acc;
61
- },
62
- {
63
- // Populate default profile, if present.
64
- ...data.default && { default: data.default }
65
- }
66
- ), "getConfigData");
67
-
68
- // src/getConfigFilepath.ts
69
- var import_path = require("path");
70
- var import_getHomeDir = require("././getHomeDir");
71
- var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
72
- var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath");
73
-
74
- // src/getCredentialsFilepath.ts
75
-
76
- var import_getHomeDir2 = require("././getHomeDir");
77
- var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
78
- var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath");
79
-
80
- // src/loadSharedConfigFiles.ts
81
- var import_getHomeDir3 = require("././getHomeDir");
82
-
83
- // src/parseIni.ts
27
+ }, {
28
+ ...(data.default && { default: data.default }),
29
+ });
84
30
 
85
- var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
86
- var profileNameBlockList = ["__proto__", "profile __proto__"];
87
- var parseIni = /* @__PURE__ */ __name((iniData) => {
88
- const map = {};
89
- let currentSection;
90
- let currentSubSection;
91
- for (const iniLine of iniData.split(/\r?\n/)) {
92
- const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
93
- const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
94
- if (isSection) {
95
- currentSection = void 0;
96
- currentSubSection = void 0;
97
- const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
98
- const matches = prefixKeyRegex.exec(sectionName);
99
- if (matches) {
100
- const [, prefix, , name] = matches;
101
- if (Object.values(import_types.IniSectionType).includes(prefix)) {
102
- currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
31
+ const ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
32
+ const getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path.join(getHomeDir.getHomeDir(), ".aws", "config");
33
+
34
+ const ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
35
+ const getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path.join(getHomeDir.getHomeDir(), ".aws", "credentials");
36
+
37
+ const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
38
+ const profileNameBlockList = ["__proto__", "profile __proto__"];
39
+ const parseIni = (iniData) => {
40
+ const map = {};
41
+ let currentSection;
42
+ let currentSubSection;
43
+ for (const iniLine of iniData.split(/\r?\n/)) {
44
+ const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
45
+ const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
46
+ if (isSection) {
47
+ currentSection = undefined;
48
+ currentSubSection = undefined;
49
+ const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
50
+ const matches = prefixKeyRegex.exec(sectionName);
51
+ if (matches) {
52
+ const [, prefix, , name] = matches;
53
+ if (Object.values(types.IniSectionType).includes(prefix)) {
54
+ currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
55
+ }
56
+ }
57
+ else {
58
+ currentSection = sectionName;
59
+ }
60
+ if (profileNameBlockList.includes(sectionName)) {
61
+ throw new Error(`Found invalid profile name "${sectionName}"`);
62
+ }
103
63
  }
104
- } else {
105
- currentSection = sectionName;
106
- }
107
- if (profileNameBlockList.includes(sectionName)) {
108
- throw new Error(`Found invalid profile name "${sectionName}"`);
109
- }
110
- } else if (currentSection) {
111
- const indexOfEqualsSign = trimmedLine.indexOf("=");
112
- if (![0, -1].includes(indexOfEqualsSign)) {
113
- const [name, value] = [
114
- trimmedLine.substring(0, indexOfEqualsSign).trim(),
115
- trimmedLine.substring(indexOfEqualsSign + 1).trim()
116
- ];
117
- if (value === "") {
118
- currentSubSection = name;
119
- } else {
120
- if (currentSubSection && iniLine.trimStart() === iniLine) {
121
- currentSubSection = void 0;
122
- }
123
- map[currentSection] = map[currentSection] || {};
124
- const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
125
- map[currentSection][key] = value;
64
+ else if (currentSection) {
65
+ const indexOfEqualsSign = trimmedLine.indexOf("=");
66
+ if (![0, -1].includes(indexOfEqualsSign)) {
67
+ const [name, value] = [
68
+ trimmedLine.substring(0, indexOfEqualsSign).trim(),
69
+ trimmedLine.substring(indexOfEqualsSign + 1).trim(),
70
+ ];
71
+ if (value === "") {
72
+ currentSubSection = name;
73
+ }
74
+ else {
75
+ if (currentSubSection && iniLine.trimStart() === iniLine) {
76
+ currentSubSection = undefined;
77
+ }
78
+ map[currentSection] = map[currentSection] || {};
79
+ const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
80
+ map[currentSection][key] = value;
81
+ }
82
+ }
126
83
  }
127
- }
128
84
  }
129
- }
130
- return map;
131
- }, "parseIni");
132
-
133
- // src/loadSharedConfigFiles.ts
134
- var import_slurpFile = require("././slurpFile");
135
- var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError");
136
- var CONFIG_PREFIX_SEPARATOR = ".";
137
- var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => {
138
- const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
139
- const homeDir = (0, import_getHomeDir3.getHomeDir)();
140
- const relativeHomeDirPrefix = "~/";
141
- let resolvedFilepath = filepath;
142
- if (filepath.startsWith(relativeHomeDirPrefix)) {
143
- resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2));
144
- }
145
- let resolvedConfigFilepath = configFilepath;
146
- if (configFilepath.startsWith(relativeHomeDirPrefix)) {
147
- resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2));
148
- }
149
- const parsedFiles = await Promise.all([
150
- (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, {
151
- ignoreCache: init.ignoreCache
152
- }).then(parseIni).then(getConfigData).catch(swallowError),
153
- (0, import_slurpFile.slurpFile)(resolvedFilepath, {
154
- ignoreCache: init.ignoreCache
155
- }).then(parseIni).catch(swallowError)
156
- ]);
157
- return {
158
- configFile: parsedFiles[0],
159
- credentialsFile: parsedFiles[1]
160
- };
161
- }, "loadSharedConfigFiles");
162
-
163
- // src/getSsoSessionData.ts
164
-
165
- var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData");
85
+ return map;
86
+ };
166
87
 
167
- // src/loadSsoSessionData.ts
168
- var import_slurpFile2 = require("././slurpFile");
169
- var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError");
170
- var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData");
88
+ const swallowError$1 = () => ({});
89
+ const CONFIG_PREFIX_SEPARATOR = ".";
90
+ const loadSharedConfigFiles = async (init = {}) => {
91
+ const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
92
+ const homeDir = getHomeDir.getHomeDir();
93
+ const relativeHomeDirPrefix = "~/";
94
+ let resolvedFilepath = filepath;
95
+ if (filepath.startsWith(relativeHomeDirPrefix)) {
96
+ resolvedFilepath = path.join(homeDir, filepath.slice(2));
97
+ }
98
+ let resolvedConfigFilepath = configFilepath;
99
+ if (configFilepath.startsWith(relativeHomeDirPrefix)) {
100
+ resolvedConfigFilepath = path.join(homeDir, configFilepath.slice(2));
101
+ }
102
+ const parsedFiles = await Promise.all([
103
+ slurpFile.slurpFile(resolvedConfigFilepath, {
104
+ ignoreCache: init.ignoreCache,
105
+ })
106
+ .then(parseIni)
107
+ .then(getConfigData)
108
+ .catch(swallowError$1),
109
+ slurpFile.slurpFile(resolvedFilepath, {
110
+ ignoreCache: init.ignoreCache,
111
+ })
112
+ .then(parseIni)
113
+ .catch(swallowError$1),
114
+ ]);
115
+ return {
116
+ configFile: parsedFiles[0],
117
+ credentialsFile: parsedFiles[1],
118
+ };
119
+ };
171
120
 
172
- // src/mergeConfigFiles.ts
173
- var mergeConfigFiles = /* @__PURE__ */ __name((...files) => {
174
- const merged = {};
175
- for (const file of files) {
176
- for (const [key, values] of Object.entries(file)) {
177
- if (merged[key] !== void 0) {
178
- Object.assign(merged[key], values);
179
- } else {
180
- merged[key] = values;
181
- }
121
+ const getSsoSessionData = (data) => Object.entries(data)
122
+ .filter(([key]) => key.startsWith(types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR))
123
+ .reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});
124
+
125
+ const swallowError = () => ({});
126
+ const loadSsoSessionData = async (init = {}) => slurpFile.slurpFile(init.configFilepath ?? getConfigFilepath())
127
+ .then(parseIni)
128
+ .then(getSsoSessionData)
129
+ .catch(swallowError);
130
+
131
+ const mergeConfigFiles = (...files) => {
132
+ const merged = {};
133
+ for (const file of files) {
134
+ for (const [key, values] of Object.entries(file)) {
135
+ if (merged[key] !== undefined) {
136
+ Object.assign(merged[key], values);
137
+ }
138
+ else {
139
+ merged[key] = values;
140
+ }
141
+ }
182
142
  }
183
- }
184
- return merged;
185
- }, "mergeConfigFiles");
143
+ return merged;
144
+ };
186
145
 
187
- // src/parseKnownFiles.ts
188
- var parseKnownFiles = /* @__PURE__ */ __name(async (init) => {
189
- const parsedFiles = await loadSharedConfigFiles(init);
190
- return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
191
- }, "parseKnownFiles");
192
- // Annotate the CommonJS export names for ESM import in node:
146
+ const parseKnownFiles = async (init) => {
147
+ const parsedFiles = await loadSharedConfigFiles(init);
148
+ return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
149
+ };
193
150
 
194
- 0 && (module.exports = {
195
- getHomeDir,
196
- ENV_PROFILE,
197
- DEFAULT_PROFILE,
198
- getProfileName,
199
- getSSOTokenFilepath,
200
- getSSOTokenFromFile,
201
- CONFIG_PREFIX_SEPARATOR,
202
- loadSharedConfigFiles,
203
- loadSsoSessionData,
204
- parseKnownFiles
205
- });
151
+ const externalDataInterceptor = {
152
+ getFileRecord() {
153
+ return slurpFile.fileIntercept;
154
+ },
155
+ interceptFile(path, contents) {
156
+ slurpFile.fileIntercept[path] = Promise.resolve(contents);
157
+ },
158
+ getTokenRecord() {
159
+ return getSSOTokenFromFile.tokenIntercept;
160
+ },
161
+ interceptToken(id, contents) {
162
+ getSSOTokenFromFile.tokenIntercept[id] = contents;
163
+ },
164
+ };
206
165
 
166
+ Object.defineProperty(exports, "getSSOTokenFromFile", {
167
+ enumerable: true,
168
+ get: function () { return getSSOTokenFromFile.getSSOTokenFromFile; }
169
+ });
170
+ exports.CONFIG_PREFIX_SEPARATOR = CONFIG_PREFIX_SEPARATOR;
171
+ exports.DEFAULT_PROFILE = DEFAULT_PROFILE;
172
+ exports.ENV_PROFILE = ENV_PROFILE;
173
+ exports.externalDataInterceptor = externalDataInterceptor;
174
+ exports.getProfileName = getProfileName;
175
+ exports.loadSharedConfigFiles = loadSharedConfigFiles;
176
+ exports.loadSsoSessionData = loadSsoSessionData;
177
+ exports.parseKnownFiles = parseKnownFiles;
178
+ Object.keys(getHomeDir).forEach(function (k) {
179
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
180
+ enumerable: true,
181
+ get: function () { return getHomeDir[k]; }
182
+ });
183
+ });
184
+ Object.keys(getSSOTokenFilepath).forEach(function (k) {
185
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
186
+ enumerable: true,
187
+ get: function () { return getSSOTokenFilepath[k]; }
188
+ });
189
+ });
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.slurpFile = void 0;
3
+ exports.slurpFile = exports.fileIntercept = exports.filePromisesHash = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const { readFile } = fs_1.promises;
6
- const filePromisesHash = {};
6
+ exports.filePromisesHash = {};
7
+ exports.fileIntercept = {};
7
8
  const slurpFile = (path, options) => {
8
- if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) {
9
- filePromisesHash[path] = readFile(path, "utf8");
9
+ if (exports.fileIntercept[path] !== undefined) {
10
+ return exports.fileIntercept[path];
10
11
  }
11
- return filePromisesHash[path];
12
+ if (!exports.filePromisesHash[path] || options?.ignoreCache) {
13
+ exports.filePromisesHash[path] = readFile(path, "utf8");
14
+ }
15
+ return exports.filePromisesHash[path];
12
16
  };
13
17
  exports.slurpFile = slurpFile;
@@ -0,0 +1,16 @@
1
+ import { tokenIntercept } from "./getSSOTokenFromFile";
2
+ import { fileIntercept } from "./slurpFile";
3
+ export const externalDataInterceptor = {
4
+ getFileRecord() {
5
+ return fileIntercept;
6
+ },
7
+ interceptFile(path, contents) {
8
+ fileIntercept[path] = Promise.resolve(contents);
9
+ },
10
+ getTokenRecord() {
11
+ return tokenIntercept;
12
+ },
13
+ interceptToken(id, contents) {
14
+ tokenIntercept[id] = contents;
15
+ },
16
+ };
@@ -1,7 +1,11 @@
1
1
  import { promises as fsPromises } from "fs";
2
2
  import { getSSOTokenFilepath } from "./getSSOTokenFilepath";
3
3
  const { readFile } = fsPromises;
4
+ export const tokenIntercept = {};
4
5
  export const getSSOTokenFromFile = async (id) => {
6
+ if (tokenIntercept[id]) {
7
+ return tokenIntercept[id];
8
+ }
5
9
  const ssoTokenFilepath = getSSOTokenFilepath(id);
6
10
  const ssoTokenText = await readFile(ssoTokenFilepath, "utf8");
7
11
  return JSON.parse(ssoTokenText);
package/dist-es/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  export * from "./getHomeDir";
2
2
  export * from "./getProfileName";
3
3
  export * from "./getSSOTokenFilepath";
4
- export * from "./getSSOTokenFromFile";
4
+ export { getSSOTokenFromFile } from "./getSSOTokenFromFile";
5
5
  export * from "./loadSharedConfigFiles";
6
6
  export * from "./loadSsoSessionData";
7
7
  export * from "./parseKnownFiles";
8
+ export { externalDataInterceptor } from "./externalDataInterceptor";
8
9
  export * from "./types";
@@ -1,7 +1,11 @@
1
1
  import { promises as fsPromises } from "fs";
2
2
  const { readFile } = fsPromises;
3
- const filePromisesHash = {};
3
+ export const filePromisesHash = {};
4
+ export const fileIntercept = {};
4
5
  export const slurpFile = (path, options) => {
6
+ if (fileIntercept[path] !== undefined) {
7
+ return fileIntercept[path];
8
+ }
5
9
  if (!filePromisesHash[path] || options?.ignoreCache) {
6
10
  filePromisesHash[path] = readFile(path, "utf8");
7
11
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const externalDataInterceptor: {
5
+ getFileRecord(): Record<string, Promise<string>>;
6
+ interceptFile(path: string, contents: string): void;
7
+ getTokenRecord(): Record<string, any>;
8
+ interceptToken(id: string, contents: any): void;
9
+ };
@@ -38,9 +38,13 @@ export interface SSOToken {
38
38
  */
39
39
  startUrl?: string;
40
40
  }
41
+ /**
42
+ * @internal
43
+ */
44
+ export declare const tokenIntercept: Record<string, any>;
41
45
  /**
42
46
  * @internal
43
47
  * @param id - can be either a start URL or the SSO session name.
44
48
  * Returns the SSO token from the file system.
45
49
  */
46
- export declare const getSSOTokenFromFile: (id: string) => Promise<SSOToken>;
50
+ export declare const getSSOTokenFromFile: (id: string) => Promise<any>;
@@ -1,8 +1,9 @@
1
1
  export * from "./getHomeDir";
2
2
  export * from "./getProfileName";
3
3
  export * from "./getSSOTokenFilepath";
4
- export * from "./getSSOTokenFromFile";
4
+ export { getSSOTokenFromFile, SSOToken } from "./getSSOTokenFromFile";
5
5
  export * from "./loadSharedConfigFiles";
6
6
  export * from "./loadSsoSessionData";
7
7
  export * from "./parseKnownFiles";
8
+ export { externalDataInterceptor } from "./externalDataInterceptor";
8
9
  export * from "./types";
@@ -1,3 +1,5 @@
1
+ export declare const filePromisesHash: Record<string, Promise<string>>;
2
+ export declare const fileIntercept: Record<string, Promise<string>>;
1
3
  interface SlurpFileOptions {
2
4
  ignoreCache?: boolean;
3
5
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const externalDataInterceptor: {
5
+ getFileRecord(): Record<string, Promise<string>>;
6
+ interceptFile(path: string, contents: string): void;
7
+ getTokenRecord(): Record<string, any>;
8
+ interceptToken(id: string, contents: any): void;
9
+ };
@@ -38,9 +38,13 @@ export interface SSOToken {
38
38
  */
39
39
  startUrl?: string;
40
40
  }
41
+ /**
42
+ * @internal
43
+ */
44
+ export declare const tokenIntercept: Record<string, any>;
41
45
  /**
42
46
  * @internal
43
47
  * @param id - can be either a start URL or the SSO session name.
44
48
  * Returns the SSO token from the file system.
45
49
  */
46
- export declare const getSSOTokenFromFile: (id: string) => Promise<SSOToken>;
50
+ export declare const getSSOTokenFromFile: (id: string) => Promise<any>;
@@ -1,8 +1,9 @@
1
1
  export * from "./getHomeDir";
2
2
  export * from "./getProfileName";
3
3
  export * from "./getSSOTokenFilepath";
4
- export * from "./getSSOTokenFromFile";
4
+ export { getSSOTokenFromFile, SSOToken } from "./getSSOTokenFromFile";
5
5
  export * from "./loadSharedConfigFiles";
6
6
  export * from "./loadSsoSessionData";
7
7
  export * from "./parseKnownFiles";
8
+ export { externalDataInterceptor } from "./externalDataInterceptor";
8
9
  export * from "./types";
@@ -1,3 +1,5 @@
1
+ export declare const filePromisesHash: Record<string, Promise<string>>;
2
+ export declare const fileIntercept: Record<string, Promise<string>>;
1
3
  interface SlurpFileOptions {
2
4
  ignoreCache?: boolean;
3
5
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@smithy/shared-ini-file-loader",
3
- "version": "4.1.1",
3
+ "version": "4.3.0",
4
4
  "dependencies": {
5
- "@smithy/types": "^4.5.0",
5
+ "@smithy/types": "^4.6.0",
6
6
  "tslib": "^2.6.2"
7
7
  },
8
8
  "devDependencies": {
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
package/dist-cjs/types.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");