@smithy/shared-ini-file-loader 4.1.1 → 4.2.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.
- package/dist-cjs/externalDataInterceptor.js +1 -0
- package/dist-cjs/getSSOTokenFromFile.js +5 -1
- package/dist-cjs/index.js +24 -2
- package/dist-cjs/slurpFile.js +9 -5
- package/dist-es/externalDataInterceptor.js +16 -0
- package/dist-es/getSSOTokenFromFile.js +4 -0
- package/dist-es/index.js +2 -1
- package/dist-es/slurpFile.js +5 -1
- package/dist-types/externalDataInterceptor.d.ts +9 -0
- package/dist-types/getSSOTokenFromFile.d.ts +5 -1
- package/dist-types/index.d.ts +2 -1
- package/dist-types/slurpFile.d.ts +2 -0
- package/dist-types/ts3.4/externalDataInterceptor.d.ts +9 -0
- package/dist-types/ts3.4/getSSOTokenFromFile.d.ts +5 -1
- package/dist-types/ts3.4/index.d.ts +2 -1
- package/dist-types/ts3.4/slurpFile.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -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
|
@@ -24,7 +24,10 @@ __export(index_exports, {
|
|
|
24
24
|
CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR,
|
|
25
25
|
DEFAULT_PROFILE: () => DEFAULT_PROFILE,
|
|
26
26
|
ENV_PROFILE: () => ENV_PROFILE,
|
|
27
|
+
SSOToken: () => import_getSSOTokenFromFile2.SSOToken,
|
|
28
|
+
externalDataInterceptor: () => externalDataInterceptor,
|
|
27
29
|
getProfileName: () => getProfileName,
|
|
30
|
+
getSSOTokenFromFile: () => import_getSSOTokenFromFile2.getSSOTokenFromFile,
|
|
28
31
|
loadSharedConfigFiles: () => loadSharedConfigFiles,
|
|
29
32
|
loadSsoSessionData: () => loadSsoSessionData,
|
|
30
33
|
parseKnownFiles: () => parseKnownFiles
|
|
@@ -39,7 +42,7 @@ var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.en
|
|
|
39
42
|
|
|
40
43
|
// src/index.ts
|
|
41
44
|
__reExport(index_exports, require("././getSSOTokenFilepath"), module.exports);
|
|
42
|
-
|
|
45
|
+
var import_getSSOTokenFromFile2 = require("././getSSOTokenFromFile");
|
|
43
46
|
|
|
44
47
|
// src/loadSharedConfigFiles.ts
|
|
45
48
|
|
|
@@ -189,15 +192,34 @@ var parseKnownFiles = /* @__PURE__ */ __name(async (init) => {
|
|
|
189
192
|
const parsedFiles = await loadSharedConfigFiles(init);
|
|
190
193
|
return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
|
|
191
194
|
}, "parseKnownFiles");
|
|
195
|
+
|
|
196
|
+
// src/externalDataInterceptor.ts
|
|
197
|
+
var import_getSSOTokenFromFile = require("././getSSOTokenFromFile");
|
|
198
|
+
var import_slurpFile3 = require("././slurpFile");
|
|
199
|
+
var externalDataInterceptor = {
|
|
200
|
+
getFileRecord() {
|
|
201
|
+
return import_slurpFile3.fileIntercept;
|
|
202
|
+
},
|
|
203
|
+
interceptFile(path, contents) {
|
|
204
|
+
import_slurpFile3.fileIntercept[path] = Promise.resolve(contents);
|
|
205
|
+
},
|
|
206
|
+
getTokenRecord() {
|
|
207
|
+
return import_getSSOTokenFromFile.tokenIntercept;
|
|
208
|
+
},
|
|
209
|
+
interceptToken(id, contents) {
|
|
210
|
+
import_getSSOTokenFromFile.tokenIntercept[id] = contents;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
192
213
|
// Annotate the CommonJS export names for ESM import in node:
|
|
193
214
|
|
|
194
215
|
0 && (module.exports = {
|
|
216
|
+
getSSOTokenFromFile,
|
|
217
|
+
externalDataInterceptor,
|
|
195
218
|
getHomeDir,
|
|
196
219
|
ENV_PROFILE,
|
|
197
220
|
DEFAULT_PROFILE,
|
|
198
221
|
getProfileName,
|
|
199
222
|
getSSOTokenFilepath,
|
|
200
|
-
getSSOTokenFromFile,
|
|
201
223
|
CONFIG_PREFIX_SEPARATOR,
|
|
202
224
|
loadSharedConfigFiles,
|
|
203
225
|
loadSsoSessionData,
|
package/dist-cjs/slurpFile.js
CHANGED
|
@@ -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
|
-
|
|
6
|
+
exports.filePromisesHash = {};
|
|
7
|
+
exports.fileIntercept = {};
|
|
7
8
|
const slurpFile = (path, options) => {
|
|
8
|
-
if (
|
|
9
|
-
|
|
9
|
+
if (exports.fileIntercept[path] !== undefined) {
|
|
10
|
+
return exports.fileIntercept[path];
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
if (!exports.filePromisesHash[path] || (options === null || options === void 0 ? void 0 : 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
|
|
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";
|
package/dist-es/slurpFile.js
CHANGED
|
@@ -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<
|
|
50
|
+
export declare const getSSOTokenFromFile: (id: string) => Promise<any>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from "./getHomeDir";
|
|
2
2
|
export * from "./getProfileName";
|
|
3
3
|
export * from "./getSSOTokenFilepath";
|
|
4
|
-
export
|
|
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";
|
|
@@ -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<
|
|
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
|
|
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";
|