@rockcarver/frodo-lib 0.15.0 → 0.15.1
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/CHANGELOG.md +11 -1
- package/cjs/ops/utils/ExportImportUtils.js +15 -0
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/storage/SessionStorage.js +2 -0
- package/cjs/storage/SessionStorage.js.map +1 -1
- package/esm/ops/utils/ExportImportUtils.mjs +13 -0
- package/esm/storage/SessionStorage.mjs +2 -0
- package/package.json +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +6 -0
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/storage/SessionStorage.d.ts +2 -0
- package/types/storage/SessionStorage.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.15.1] - 2022-10-16
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Backend support for rockcarver/frodo-cli#86:
|
|
15
|
+
- Added field and getters/setters for outputFile to session
|
|
16
|
+
- Added function to append text to file to ExportImportUtils.ts
|
|
17
|
+
|
|
10
18
|
## [0.15.0] - 2022-10-14
|
|
11
19
|
|
|
12
20
|
### Added
|
|
@@ -639,7 +647,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
639
647
|
- Fixed problem with adding connection profiles
|
|
640
648
|
- Miscellaneous bug fixes
|
|
641
649
|
|
|
642
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.15.
|
|
650
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.15.1...HEAD
|
|
651
|
+
|
|
652
|
+
[0.15.1]: https://github.com/rockcarver/frodo-lib/compare/v0.15.0...v0.15.1
|
|
643
653
|
|
|
644
654
|
[0.15.0]: https://github.com/rockcarver/frodo-lib/compare/v0.14.2-0...v0.15.0
|
|
645
655
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.appendTextToFile = appendTextToFile;
|
|
6
7
|
exports.convertBase64TextToArray = convertBase64TextToArray;
|
|
7
8
|
exports.convertBase64UrlTextToArray = convertBase64UrlTextToArray;
|
|
8
9
|
exports.convertTextArrayToBase64 = convertTextArrayToBase64;
|
|
@@ -166,4 +167,18 @@ function saveTextToFile(data, filename) {
|
|
|
166
167
|
return true;
|
|
167
168
|
});
|
|
168
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Append text data to file
|
|
172
|
+
* @param {String} data text data
|
|
173
|
+
* @param {String} filename file name
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
function appendTextToFile(data, filename) {
|
|
178
|
+
try {
|
|
179
|
+
_fs.default.appendFileSync(filename, data);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
(0, _Console.printMessage)("".concat(error.message), 'error');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
169
184
|
//# sourceMappingURL=ExportImportUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportImportUtils.js","names":["getCurrentTimestamp","ts","Date","toISOString","getMetadata","metadata","origin","storage","session","getTenant","originAmVersion","getAmVersion","exportedBy","getUsername","exportDate","exportTool","FRODO_METADATA_ID","exportToolVersion","getFrodoVersion","titleCase","input","str","toString","splitStr","toLowerCase","split","i","length","charAt","toUpperCase","slice","join","getRealmString","realm","getRealm","reduce","result","item","convertBase64TextToArray","b64text","arrayOut","plainText","decode","replace","convertBase64UrlTextToArray","b64UTF8Text","decodeBase64Url","convertTextArrayToBase64","textArray","joinedText","b64encodedScript","encode","convertTextArrayToBase64Url","encodeBase64Url","validateImport","getTypedFilename","name","type","suffix","slug","slugify","saveToFile","data","identifier","filename","exportData","Array","isArray","forEach","element","fs","writeFile","JSON","stringify","err","printMessage","saveJsonToFile","meta","saveTextToFile"],"sources":["ops/utils/ExportImportUtils.ts"],"sourcesContent":["import fs from 'fs';\nimport slugify from 'slugify';\nimport storage from '../../storage/SessionStorage';\nimport { FRODO_METADATA_ID } from '../../storage/StaticStorage';\nimport {\n encode,\n decode,\n encodeBase64Url,\n decodeBase64Url,\n} from '../../api/utils/Base64';\nimport { printMessage } from './Console';\nimport { ExportMetaData } from '../OpsTypes';\n\nexport function getCurrentTimestamp() {\n const ts = new Date();\n return ts.toISOString();\n}\n\nfunction getMetadata(): ExportMetaData {\n const metadata: ExportMetaData = {\n origin: storage.session.getTenant(),\n originAmVersion: storage.session.getAmVersion(),\n exportedBy: storage.session.getUsername(),\n exportDate: getCurrentTimestamp(),\n exportTool: FRODO_METADATA_ID,\n exportToolVersion: storage.session.getFrodoVersion(),\n };\n return metadata;\n}\n\n/*\n * Output str in title case\n *\n * e.g.: 'ALL UPPERCASE AND all lowercase' = 'All Uppercase And All Lowercase'\n */\nexport function titleCase(input) {\n const str = input.toString();\n const splitStr = str.toLowerCase().split(' ');\n for (let i = 0; i < splitStr.length; i += 1) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n }\n return splitStr.join(' ');\n}\n\nexport function getRealmString() {\n const realm = storage.session.getRealm();\n return realm\n .split('/')\n .reduce((result, item) => `${result}${titleCase(item)}`, '');\n}\n\nexport function convertBase64TextToArray(b64text) {\n let arrayOut = [];\n let plainText = decode(b64text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertBase64UrlTextToArray(b64UTF8Text) {\n let arrayOut = [];\n let plainText = decodeBase64Url(b64UTF8Text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertTextArrayToBase64(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encode(joinedText);\n return b64encodedScript;\n}\n\nexport function convertTextArrayToBase64Url(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encodeBase64Url(joinedText);\n return b64encodedScript;\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function validateImport(metadata): boolean {\n return metadata || true;\n}\n\nexport function getTypedFilename(name, type, suffix = 'json') {\n const slug = slugify(name.replace(/^http(s?):\\/\\//, ''));\n return `${slug}.${type}.${suffix}`;\n}\n\nexport function saveToFile(type, data, identifier, filename) {\n const exportData = {};\n exportData['meta'] = getMetadata();\n exportData[type] = {};\n if (Array.isArray(data)) {\n data.forEach((element) => {\n exportData[type][element[identifier]] = element;\n });\n } else {\n exportData[type][data[identifier]] = data;\n }\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${type} to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save JSON object to file\n * @param {Object} data data object\n * @param {String} filename file name\n */\nexport function saveJsonToFile(data, filename) {\n const exportData = data;\n exportData.meta = getMetadata();\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${filename}`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function saveTextToFile(data, filename) {\n fs.writeFile(filename, data, (err) => {\n if (err) {\n printMessage(`ERROR - can't save ${filename}`, 'error');\n return false;\n }\n return true;\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExportImportUtils.js","names":["getCurrentTimestamp","ts","Date","toISOString","getMetadata","metadata","origin","storage","session","getTenant","originAmVersion","getAmVersion","exportedBy","getUsername","exportDate","exportTool","FRODO_METADATA_ID","exportToolVersion","getFrodoVersion","titleCase","input","str","toString","splitStr","toLowerCase","split","i","length","charAt","toUpperCase","slice","join","getRealmString","realm","getRealm","reduce","result","item","convertBase64TextToArray","b64text","arrayOut","plainText","decode","replace","convertBase64UrlTextToArray","b64UTF8Text","decodeBase64Url","convertTextArrayToBase64","textArray","joinedText","b64encodedScript","encode","convertTextArrayToBase64Url","encodeBase64Url","validateImport","getTypedFilename","name","type","suffix","slug","slugify","saveToFile","data","identifier","filename","exportData","Array","isArray","forEach","element","fs","writeFile","JSON","stringify","err","printMessage","saveJsonToFile","meta","saveTextToFile","appendTextToFile","appendFileSync","error","message"],"sources":["ops/utils/ExportImportUtils.ts"],"sourcesContent":["import fs from 'fs';\nimport slugify from 'slugify';\nimport storage from '../../storage/SessionStorage';\nimport { FRODO_METADATA_ID } from '../../storage/StaticStorage';\nimport {\n encode,\n decode,\n encodeBase64Url,\n decodeBase64Url,\n} from '../../api/utils/Base64';\nimport { printMessage } from './Console';\nimport { ExportMetaData } from '../OpsTypes';\n\nexport function getCurrentTimestamp() {\n const ts = new Date();\n return ts.toISOString();\n}\n\nfunction getMetadata(): ExportMetaData {\n const metadata: ExportMetaData = {\n origin: storage.session.getTenant(),\n originAmVersion: storage.session.getAmVersion(),\n exportedBy: storage.session.getUsername(),\n exportDate: getCurrentTimestamp(),\n exportTool: FRODO_METADATA_ID,\n exportToolVersion: storage.session.getFrodoVersion(),\n };\n return metadata;\n}\n\n/*\n * Output str in title case\n *\n * e.g.: 'ALL UPPERCASE AND all lowercase' = 'All Uppercase And All Lowercase'\n */\nexport function titleCase(input) {\n const str = input.toString();\n const splitStr = str.toLowerCase().split(' ');\n for (let i = 0; i < splitStr.length; i += 1) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n }\n return splitStr.join(' ');\n}\n\nexport function getRealmString() {\n const realm = storage.session.getRealm();\n return realm\n .split('/')\n .reduce((result, item) => `${result}${titleCase(item)}`, '');\n}\n\nexport function convertBase64TextToArray(b64text) {\n let arrayOut = [];\n let plainText = decode(b64text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertBase64UrlTextToArray(b64UTF8Text) {\n let arrayOut = [];\n let plainText = decodeBase64Url(b64UTF8Text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertTextArrayToBase64(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encode(joinedText);\n return b64encodedScript;\n}\n\nexport function convertTextArrayToBase64Url(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encodeBase64Url(joinedText);\n return b64encodedScript;\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function validateImport(metadata): boolean {\n return metadata || true;\n}\n\nexport function getTypedFilename(name, type, suffix = 'json') {\n const slug = slugify(name.replace(/^http(s?):\\/\\//, ''));\n return `${slug}.${type}.${suffix}`;\n}\n\nexport function saveToFile(type, data, identifier, filename) {\n const exportData = {};\n exportData['meta'] = getMetadata();\n exportData[type] = {};\n if (Array.isArray(data)) {\n data.forEach((element) => {\n exportData[type][element[identifier]] = element;\n });\n } else {\n exportData[type][data[identifier]] = data;\n }\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${type} to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save JSON object to file\n * @param {Object} data data object\n * @param {String} filename file name\n */\nexport function saveJsonToFile(data, filename) {\n const exportData = data;\n exportData.meta = getMetadata();\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${filename}`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function saveTextToFile(data, filename) {\n fs.writeFile(filename, data, (err) => {\n if (err) {\n printMessage(`ERROR - can't save ${filename}`, 'error');\n return false;\n }\n return true;\n });\n}\n\n/**\n * Append text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function appendTextToFile(data, filename) {\n try {\n fs.appendFileSync(filename, data);\n } catch (error) {\n printMessage(`${error.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W,EAA7B;;EACAkE,WAAA,CAAGC,SAAH,CAAaP,QAAb,EAAuBQ,IAAI,CAACC,SAAL,CAAeR,UAAf,EAA2B,IAA3B,EAAiC,CAAjC,CAAvB,EAA6DS,GAAD,IAAS;IACnE,IAAIA,GAAJ,EAAS;MACP,OAAO,IAAAC,qBAAA,+BAAmCX,QAAnC,GAA+C,OAA/C,CAAP;IACD;;IACD,OAAO,EAAP;EACD,CALD;AAMD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASc,cAAT,CAAwBhB,IAAxB,EAA8BE,QAA9B,EAAwC;EAC7CM,WAAA,CAAGC,SAAH,CAAaP,QAAb,EAAuBF,IAAvB,EAA8BY,GAAD,IAAS;IACpC,IAAIA,GAAJ,EAAS;MACP,IAAAC,qBAAA,+BAAmCX,QAAnC,GAA+C,OAA/C;MACA,OAAO,KAAP;IACD;;IACD,OAAO,IAAP;EACD,CAND;AAOD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASe,gBAAT,CAA0BjB,IAA1B,EAAgCE,QAAhC,EAA0C;EAC/C,IAAI;IACFM,WAAA,CAAGU,cAAH,CAAkBhB,QAAlB,EAA4BF,IAA5B;EACD,CAFD,CAEE,OAAOmB,KAAP,EAAc;IACd,IAAAN,qBAAA,YAAgBM,KAAK,CAACC,OAAtB,GAAiC,OAAjC;EACD;AACF"}
|
|
@@ -59,6 +59,8 @@ var _default = {
|
|
|
59
59
|
getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],
|
|
60
60
|
setMasterKeyPath: value => _sessionStorage['masterKeyPath'] = value,
|
|
61
61
|
getMasterKeyPath: () => _sessionStorage['masterKeyPath'],
|
|
62
|
+
setOutputFile: value => _sessionStorage['outputFile'] = value,
|
|
63
|
+
getOutputFile: () => _sessionStorage['outputFile'],
|
|
62
64
|
setPrintHandler: printHandler => _sessionStorage['printHandler'] = printHandler,
|
|
63
65
|
getPrintHandler: () => _sessionStorage['printHandler'],
|
|
64
66
|
setErrorHandler: errorHandler => _sessionStorage['errorHandler'] = errorHandler,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStorage.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","_sessionStorage","authenticationHeaderOverrides","session","setItem","key","value","getItem","removeItem","raw","setUsername","getUsername","setPassword","getPassword","setTenant","getTenant","setDeploymentType","getDeploymentType","setRealm","getRealm","setCookieName","getCookieName","setCookieValue","getCookieValue","setAuthenticationService","getAuthenticationService","setAuthenticationHeaderOverrides","getAuthenticationHeaderOverrides","setBearerToken","getBearerToken","setLogApiKey","getLogApiKey","setLogApiSecret","getLogApiSecret","setAmVersion","getAmVersion","setFrodoVersion","getFrodoVersion","version","process","setAllowInsecureConnection","getAllowInsecureConnection","setConnectionProfilesPath","getConnectionProfilesPath","setMasterKeyPath","getMasterKeyPath","setPrintHandler","printHandler","getPrintHandler","setErrorHandler","errorHandler","getErrorHandler","setVerboseHandler","verboseHandler","getVerboseHandler","setVerbose","verbose","getVerbose","setDebugHandler","debugHandler","getDebugHandler","setDebug","debug","getDebug","setCreateProgressHandler","handler","getCreateProgressHandler","setUpdateProgressHandler","getUpdateProgressHandler","setStopProgressHandler","getStopProgressHandler"],"sources":["storage/SessionStorage.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst _sessionStorage = {\n authenticationHeaderOverrides: {},\n};\n\nexport default {\n session: {\n setItem: (key, value) => (_sessionStorage[key] = value),\n getItem: (key) => _sessionStorage[key],\n removeItem: (key) => delete _sessionStorage[key],\n raw: _sessionStorage,\n setUsername: (value) => (_sessionStorage['username'] = value),\n getUsername: () => _sessionStorage['username'],\n setPassword: (value) => (_sessionStorage['password'] = value),\n getPassword: () => _sessionStorage['password'],\n setTenant: (value) => (_sessionStorage['tenant'] = value),\n getTenant: () => _sessionStorage['tenant'],\n setDeploymentType: (value) => (_sessionStorage['deploymentType'] = value),\n getDeploymentType: () => _sessionStorage['deploymentType'],\n setRealm: (value) => (_sessionStorage['realm'] = value),\n getRealm: () => _sessionStorage['realm'],\n setCookieName: (value) => (_sessionStorage['cookieName'] = value),\n getCookieName: () => _sessionStorage['cookieName'],\n setCookieValue: (value) => (_sessionStorage['cookieValue'] = value),\n getCookieValue: () => _sessionStorage['cookieValue'],\n setAuthenticationService: (value) =>\n (_sessionStorage['authenticationService'] = value),\n getAuthenticationService: () => _sessionStorage['authenticationService'],\n setAuthenticationHeaderOverrides: (value) =>\n (_sessionStorage['authenticationHeaderOverrides'] = value),\n getAuthenticationHeaderOverrides: () =>\n _sessionStorage['authenticationHeaderOverrides'],\n setBearerToken: (value) => (_sessionStorage['bearerToken'] = value),\n getBearerToken: () => _sessionStorage['bearerToken'],\n setLogApiKey: (value) => (_sessionStorage['logApiKey'] = value),\n getLogApiKey: () => _sessionStorage['logApiKey'],\n setLogApiSecret: (value) => (_sessionStorage['logApiSecret'] = value),\n getLogApiSecret: () => _sessionStorage['logApiSecret'],\n setAmVersion: (value) => (_sessionStorage['amVersion'] = value),\n getAmVersion: () => _sessionStorage['amVersion'],\n setFrodoVersion: (value) => (_sessionStorage['frodoVersion'] = value),\n getFrodoVersion: () =>\n _sessionStorage['frodoVersion'] || `v${pkg.version} [${process.version}]`,\n setAllowInsecureConnection: (value) =>\n (_sessionStorage['insecure'] = value),\n getAllowInsecureConnection: () => _sessionStorage['insecure'],\n setConnectionProfilesPath: (value) =>\n (_sessionStorage['connectionProfilesPath'] = value),\n getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],\n setMasterKeyPath: (value) => (_sessionStorage['masterKeyPath'] = value),\n getMasterKeyPath: () => _sessionStorage['masterKeyPath'],\n setPrintHandler: (printHandler) =>\n (_sessionStorage['printHandler'] = printHandler),\n getPrintHandler: () => _sessionStorage['printHandler'],\n setErrorHandler: (errorHandler) =>\n (_sessionStorage['errorHandler'] = errorHandler),\n getErrorHandler: () => _sessionStorage['errorHandler'],\n setVerboseHandler: (verboseHandler) =>\n (_sessionStorage['verboseHandler'] = verboseHandler),\n getVerboseHandler: () => _sessionStorage['verboseHandler'],\n setVerbose: (verbose: boolean) => (_sessionStorage['verbose'] = verbose),\n getVerbose: (): boolean => _sessionStorage['verbose'],\n setDebugHandler: (debugHandler) =>\n (_sessionStorage['debugHandler'] = debugHandler),\n getDebugHandler: () => _sessionStorage['debugHandler'],\n setDebug: (debug: boolean) => (_sessionStorage['debug'] = debug),\n getDebug: (): boolean => _sessionStorage['debug'],\n setCreateProgressHandler: (handler) =>\n (_sessionStorage['createProgressHandler'] = handler),\n getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],\n setUpdateProgressHandler: (handler) =>\n (_sessionStorage['updateProgressHandler'] = handler),\n getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],\n setStopProgressHandler: (handler) =>\n (_sessionStorage['stopProgressHandler'] = handler),\n getStopProgressHandler: () => _sessionStorage['stopProgressHandler'],\n },\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA,IAAMA,QAAS,GAAGC,aAAA,CAAKC,OAAL,CAAa,IAAAC,kBAAA,sDAAb,CAAlB;;AAEA,IAAMC,GAAG,GAAGC,IAAI,CAACC,KAAL,CACVC,WAAA,CAAGC,YAAH,CAAgBP,aAAA,CAAKQ,OAAL,CAAaT,QAAb,EAAwB,oBAAxB,CAAhB,EAA+D,MAA/D,CADU,CAAZ;AAIA,IAAMU,eAAe,GAAG;EACtBC,6BAA6B,EAAE;AADT,CAAxB;eAIe;EACbC,OAAO,EAAE;IACPC,OAAO,EAAE,CAACC,GAAD,EAAMC,KAAN,KAAiBL,eAAe,CAACI,GAAD,CAAf,GAAuBC,KAD1C;IAEPC,OAAO,EAAGF,GAAD,IAASJ,eAAe,CAACI,GAAD,CAF1B;IAGPG,UAAU,EAAGH,GAAD,IAA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names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","_sessionStorage","authenticationHeaderOverrides","session","setItem","key","value","getItem","removeItem","raw","setUsername","getUsername","setPassword","getPassword","setTenant","getTenant","setDeploymentType","getDeploymentType","setRealm","getRealm","setCookieName","getCookieName","setCookieValue","getCookieValue","setAuthenticationService","getAuthenticationService","setAuthenticationHeaderOverrides","getAuthenticationHeaderOverrides","setBearerToken","getBearerToken","setLogApiKey","getLogApiKey","setLogApiSecret","getLogApiSecret","setAmVersion","getAmVersion","setFrodoVersion","getFrodoVersion","version","process","setAllowInsecureConnection","getAllowInsecureConnection","setConnectionProfilesPath","getConnectionProfilesPath","setMasterKeyPath","getMasterKeyPath","setOutputFile","getOutputFile","setPrintHandler","printHandler","getPrintHandler","setErrorHandler","errorHandler","getErrorHandler","setVerboseHandler","verboseHandler","getVerboseHandler","setVerbose","verbose","getVerbose","setDebugHandler","debugHandler","getDebugHandler","setDebug","debug","getDebug","setCreateProgressHandler","handler","getCreateProgressHandler","setUpdateProgressHandler","getUpdateProgressHandler","setStopProgressHandler","getStopProgressHandler"],"sources":["storage/SessionStorage.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst _sessionStorage = {\n authenticationHeaderOverrides: {},\n};\n\nexport default {\n session: {\n setItem: (key, value) => (_sessionStorage[key] = value),\n getItem: (key) => _sessionStorage[key],\n removeItem: (key) => delete _sessionStorage[key],\n raw: _sessionStorage,\n setUsername: (value) => (_sessionStorage['username'] = value),\n getUsername: () => _sessionStorage['username'],\n setPassword: (value) => (_sessionStorage['password'] = value),\n getPassword: () => _sessionStorage['password'],\n setTenant: (value) => (_sessionStorage['tenant'] = value),\n getTenant: () => _sessionStorage['tenant'],\n setDeploymentType: (value) => (_sessionStorage['deploymentType'] = value),\n getDeploymentType: () => _sessionStorage['deploymentType'],\n setRealm: (value) => (_sessionStorage['realm'] = value),\n getRealm: () => _sessionStorage['realm'],\n setCookieName: (value) => (_sessionStorage['cookieName'] = value),\n getCookieName: () => _sessionStorage['cookieName'],\n setCookieValue: (value) => (_sessionStorage['cookieValue'] = value),\n getCookieValue: () => _sessionStorage['cookieValue'],\n setAuthenticationService: (value) =>\n (_sessionStorage['authenticationService'] = value),\n getAuthenticationService: () => _sessionStorage['authenticationService'],\n setAuthenticationHeaderOverrides: (value) =>\n (_sessionStorage['authenticationHeaderOverrides'] = value),\n getAuthenticationHeaderOverrides: () =>\n _sessionStorage['authenticationHeaderOverrides'],\n setBearerToken: (value) => (_sessionStorage['bearerToken'] = value),\n getBearerToken: () => _sessionStorage['bearerToken'],\n setLogApiKey: (value) => (_sessionStorage['logApiKey'] = value),\n getLogApiKey: () => _sessionStorage['logApiKey'],\n setLogApiSecret: (value) => (_sessionStorage['logApiSecret'] = value),\n getLogApiSecret: () => _sessionStorage['logApiSecret'],\n setAmVersion: (value) => (_sessionStorage['amVersion'] = value),\n getAmVersion: () => _sessionStorage['amVersion'],\n setFrodoVersion: (value) => (_sessionStorage['frodoVersion'] = value),\n getFrodoVersion: () =>\n _sessionStorage['frodoVersion'] || `v${pkg.version} [${process.version}]`,\n setAllowInsecureConnection: (value) =>\n (_sessionStorage['insecure'] = value),\n getAllowInsecureConnection: () => _sessionStorage['insecure'],\n setConnectionProfilesPath: (value) =>\n (_sessionStorage['connectionProfilesPath'] = value),\n getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],\n setMasterKeyPath: (value) => (_sessionStorage['masterKeyPath'] = value),\n getMasterKeyPath: () => _sessionStorage['masterKeyPath'],\n setOutputFile: (value) => (_sessionStorage['outputFile'] = value),\n getOutputFile: () => _sessionStorage['outputFile'],\n setPrintHandler: (printHandler) =>\n (_sessionStorage['printHandler'] = printHandler),\n getPrintHandler: () => _sessionStorage['printHandler'],\n setErrorHandler: (errorHandler) =>\n (_sessionStorage['errorHandler'] = errorHandler),\n getErrorHandler: () => _sessionStorage['errorHandler'],\n setVerboseHandler: (verboseHandler) =>\n (_sessionStorage['verboseHandler'] = verboseHandler),\n getVerboseHandler: () => _sessionStorage['verboseHandler'],\n setVerbose: (verbose: boolean) => (_sessionStorage['verbose'] = verbose),\n getVerbose: (): boolean => _sessionStorage['verbose'],\n setDebugHandler: (debugHandler) =>\n (_sessionStorage['debugHandler'] = debugHandler),\n getDebugHandler: () => _sessionStorage['debugHandler'],\n setDebug: (debug: boolean) => (_sessionStorage['debug'] = debug),\n getDebug: (): boolean => _sessionStorage['debug'],\n setCreateProgressHandler: (handler) =>\n (_sessionStorage['createProgressHandler'] = handler),\n getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],\n setUpdateProgressHandler: (handler) =>\n (_sessionStorage['updateProgressHandler'] = handler),\n getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],\n setStopProgressHandler: (handler) =>\n (_sessionStorage['stopProgressHandler'] = handler),\n getStopProgressHandler: () => _sessionStorage['stopProgressHandler'],\n },\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA,IAAMA,QAAS,GAAGC,aAAA,CAAKC,OAAL,CAAa,IAAAC,kBAAA,sDAAb,CAAlB;;AAEA,IAAMC,GAAG,GAAGC,IAAI,CAACC,KAAL,CACVC,WAAA,CAAGC,YAAH,CAAgBP,aAAA,CAAKQ,OAAL,CAAaT,QAAb,EAAwB,oBAAxB,CAAhB,EAA+D,MAA/D,CADU,CAAZ;AAIA,IAAMU,eAAe,GAAG;EACtBC,6BAA6B,EAAE;AADT,CAAxB;eAIe;EACbC,OAAO,EAAE;IACPC,OAAO,EAAE,CAACC,GAAD,EAAMC,KAAN,KAAiBL,eAAe,CAACI,GAAD,CAAf,GAAuBC,KAD1C;IAEPC,OAAO,EAAGF,GAAD,IAASJ,eAAe,CAACI,GAAD,CAF1B;IAGPG,UAAU,EAAGH,GAAD,I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,GAAyCkE,OAtErC;IAuEPK,sBAAsB,EAAE,MAAMvE,eAAe,CAAC,qBAAD;EAvEtC;AADI,C"}
|
|
@@ -127,4 +127,17 @@ export function saveTextToFile(data, filename) {
|
|
|
127
127
|
return true;
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Append text data to file
|
|
132
|
+
* @param {String} data text data
|
|
133
|
+
* @param {String} filename file name
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
export function appendTextToFile(data, filename) {
|
|
137
|
+
try {
|
|
138
|
+
fs.appendFileSync(filename, data);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
printMessage(`${error.message}`, 'error');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
130
143
|
//# sourceMappingURL=ExportImportUtils.js.map
|
|
@@ -48,6 +48,8 @@ export default {
|
|
|
48
48
|
getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],
|
|
49
49
|
setMasterKeyPath: value => _sessionStorage['masterKeyPath'] = value,
|
|
50
50
|
getMasterKeyPath: () => _sessionStorage['masterKeyPath'],
|
|
51
|
+
setOutputFile: value => _sessionStorage['outputFile'] = value,
|
|
52
|
+
getOutputFile: () => _sessionStorage['outputFile'],
|
|
51
53
|
setPrintHandler: printHandler => _sessionStorage['printHandler'] = printHandler,
|
|
52
54
|
getPrintHandler: () => _sessionStorage['printHandler'],
|
|
53
55
|
setErrorHandler: errorHandler => _sessionStorage['errorHandler'] = errorHandler,
|
package/package.json
CHANGED
|
@@ -20,3 +20,9 @@ export declare function saveJsonToFile(data: any, filename: any): void;
|
|
|
20
20
|
* @param {String} filename file name
|
|
21
21
|
*/
|
|
22
22
|
export declare function saveTextToFile(data: any, filename: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* Append text data to file
|
|
25
|
+
* @param {String} data text data
|
|
26
|
+
* @param {String} filename file name
|
|
27
|
+
*/
|
|
28
|
+
export declare function appendTextToFile(data: any, filename: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ops/utils/ExportImportUtils.ts"],"names":[],"mappings":"AAaA,wBAAgB,mBAAmB,WAGlC;AAmBD,wBAAgB,SAAS,CAAC,KAAK,KAAA,OAO9B;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,KAAA,SAM/C;AAED,wBAAgB,2BAA2B,CAAC,WAAW,KAAA,SAMtD;AAED,wBAAgB,wBAAwB,CAAC,SAAS,KAAA,UAIjD;AAED,wBAAgB,2BAA2B,CAAC,SAAS,KAAA,OAIpD;AAGD,wBAAgB,cAAc,CAAC,QAAQ,KAAA,GAAG,OAAO,CAEhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,SAAS,UAG3D;AAED,wBAAgB,UAAU,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,UAAU,KAAA,EAAE,QAAQ,KAAA,QAiB1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,QAS5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,QAQ5C","file":"ExportImportUtils.d.ts","sourcesContent":["import fs from 'fs';\nimport slugify from 'slugify';\nimport storage from '../../storage/SessionStorage';\nimport { FRODO_METADATA_ID } from '../../storage/StaticStorage';\nimport {\n encode,\n decode,\n encodeBase64Url,\n decodeBase64Url,\n} from '../../api/utils/Base64';\nimport { printMessage } from './Console';\nimport { ExportMetaData } from '../OpsTypes';\n\nexport function getCurrentTimestamp() {\n const ts = new Date();\n return ts.toISOString();\n}\n\nfunction getMetadata(): ExportMetaData {\n const metadata: ExportMetaData = {\n origin: storage.session.getTenant(),\n originAmVersion: storage.session.getAmVersion(),\n exportedBy: storage.session.getUsername(),\n exportDate: getCurrentTimestamp(),\n exportTool: FRODO_METADATA_ID,\n exportToolVersion: storage.session.getFrodoVersion(),\n };\n return metadata;\n}\n\n/*\n * Output str in title case\n *\n * e.g.: 'ALL UPPERCASE AND all lowercase' = 'All Uppercase And All Lowercase'\n */\nexport function titleCase(input) {\n const str = input.toString();\n const splitStr = str.toLowerCase().split(' ');\n for (let i = 0; i < splitStr.length; i += 1) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n }\n return splitStr.join(' ');\n}\n\nexport function getRealmString() {\n const realm = storage.session.getRealm();\n return realm\n .split('/')\n .reduce((result, item) => `${result}${titleCase(item)}`, '');\n}\n\nexport function convertBase64TextToArray(b64text) {\n let arrayOut = [];\n let plainText = decode(b64text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertBase64UrlTextToArray(b64UTF8Text) {\n let arrayOut = [];\n let plainText = decodeBase64Url(b64UTF8Text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertTextArrayToBase64(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encode(joinedText);\n return b64encodedScript;\n}\n\nexport function convertTextArrayToBase64Url(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encodeBase64Url(joinedText);\n return b64encodedScript;\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function validateImport(metadata): boolean {\n return metadata || true;\n}\n\nexport function getTypedFilename(name, type, suffix = 'json') {\n const slug = slugify(name.replace(/^http(s?):\\/\\//, ''));\n return `${slug}.${type}.${suffix}`;\n}\n\nexport function saveToFile(type, data, identifier, filename) {\n const exportData = {};\n exportData['meta'] = getMetadata();\n exportData[type] = {};\n if (Array.isArray(data)) {\n data.forEach((element) => {\n exportData[type][element[identifier]] = element;\n });\n } else {\n exportData[type][data[identifier]] = data;\n }\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${type} to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save JSON object to file\n * @param {Object} data data object\n * @param {String} filename file name\n */\nexport function saveJsonToFile(data, filename) {\n const exportData = data;\n exportData.meta = getMetadata();\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${filename}`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function saveTextToFile(data, filename) {\n fs.writeFile(filename, data, (err) => {\n if (err) {\n printMessage(`ERROR - can't save ${filename}`, 'error');\n return false;\n }\n return true;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ops/utils/ExportImportUtils.ts"],"names":[],"mappings":"AAaA,wBAAgB,mBAAmB,WAGlC;AAmBD,wBAAgB,SAAS,CAAC,KAAK,KAAA,OAO9B;AAED,wBAAgB,cAAc,QAK7B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,KAAA,SAM/C;AAED,wBAAgB,2BAA2B,CAAC,WAAW,KAAA,SAMtD;AAED,wBAAgB,wBAAwB,CAAC,SAAS,KAAA,UAIjD;AAED,wBAAgB,2BAA2B,CAAC,SAAS,KAAA,OAIpD;AAGD,wBAAgB,cAAc,CAAC,QAAQ,KAAA,GAAG,OAAO,CAEhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,SAAS,UAG3D;AAED,wBAAgB,UAAU,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,UAAU,KAAA,EAAE,QAAQ,KAAA,QAiB1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,QAS5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,QAQ5C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA,QAM9C","file":"ExportImportUtils.d.ts","sourcesContent":["import fs from 'fs';\nimport slugify from 'slugify';\nimport storage from '../../storage/SessionStorage';\nimport { FRODO_METADATA_ID } from '../../storage/StaticStorage';\nimport {\n encode,\n decode,\n encodeBase64Url,\n decodeBase64Url,\n} from '../../api/utils/Base64';\nimport { printMessage } from './Console';\nimport { ExportMetaData } from '../OpsTypes';\n\nexport function getCurrentTimestamp() {\n const ts = new Date();\n return ts.toISOString();\n}\n\nfunction getMetadata(): ExportMetaData {\n const metadata: ExportMetaData = {\n origin: storage.session.getTenant(),\n originAmVersion: storage.session.getAmVersion(),\n exportedBy: storage.session.getUsername(),\n exportDate: getCurrentTimestamp(),\n exportTool: FRODO_METADATA_ID,\n exportToolVersion: storage.session.getFrodoVersion(),\n };\n return metadata;\n}\n\n/*\n * Output str in title case\n *\n * e.g.: 'ALL UPPERCASE AND all lowercase' = 'All Uppercase And All Lowercase'\n */\nexport function titleCase(input) {\n const str = input.toString();\n const splitStr = str.toLowerCase().split(' ');\n for (let i = 0; i < splitStr.length; i += 1) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n }\n return splitStr.join(' ');\n}\n\nexport function getRealmString() {\n const realm = storage.session.getRealm();\n return realm\n .split('/')\n .reduce((result, item) => `${result}${titleCase(item)}`, '');\n}\n\nexport function convertBase64TextToArray(b64text) {\n let arrayOut = [];\n let plainText = decode(b64text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertBase64UrlTextToArray(b64UTF8Text) {\n let arrayOut = [];\n let plainText = decodeBase64Url(b64UTF8Text);\n plainText = plainText.replace(/\\t/g, ' ');\n arrayOut = plainText.split('\\n');\n return arrayOut;\n}\n\nexport function convertTextArrayToBase64(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encode(joinedText);\n return b64encodedScript;\n}\n\nexport function convertTextArrayToBase64Url(textArray) {\n const joinedText = textArray.join('\\n');\n const b64encodedScript = encodeBase64Url(joinedText);\n return b64encodedScript;\n}\n\n// eslint-disable-next-line no-unused-vars\nexport function validateImport(metadata): boolean {\n return metadata || true;\n}\n\nexport function getTypedFilename(name, type, suffix = 'json') {\n const slug = slugify(name.replace(/^http(s?):\\/\\//, ''));\n return `${slug}.${type}.${suffix}`;\n}\n\nexport function saveToFile(type, data, identifier, filename) {\n const exportData = {};\n exportData['meta'] = getMetadata();\n exportData[type] = {};\n if (Array.isArray(data)) {\n data.forEach((element) => {\n exportData[type][element[identifier]] = element;\n });\n } else {\n exportData[type][data[identifier]] = data;\n }\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${type} to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save JSON object to file\n * @param {Object} data data object\n * @param {String} filename file name\n */\nexport function saveJsonToFile(data, filename) {\n const exportData = data;\n exportData.meta = getMetadata();\n fs.writeFile(filename, JSON.stringify(exportData, null, 2), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${filename}`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Save text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function saveTextToFile(data, filename) {\n fs.writeFile(filename, data, (err) => {\n if (err) {\n printMessage(`ERROR - can't save ${filename}`, 'error');\n return false;\n }\n return true;\n });\n}\n\n/**\n * Append text data to file\n * @param {String} data text data\n * @param {String} filename file name\n */\nexport function appendTextToFile(data, filename) {\n try {\n fs.appendFileSync(filename, data);\n } catch (error) {\n printMessage(`${error.message}`, 'error');\n }\n}\n"]}
|
|
@@ -40,6 +40,8 @@ declare const _default: {
|
|
|
40
40
|
getConnectionProfilesPath: () => any;
|
|
41
41
|
setMasterKeyPath: (value: any) => any;
|
|
42
42
|
getMasterKeyPath: () => any;
|
|
43
|
+
setOutputFile: (value: any) => any;
|
|
44
|
+
getOutputFile: () => any;
|
|
43
45
|
setPrintHandler: (printHandler: any) => any;
|
|
44
46
|
getPrintHandler: () => any;
|
|
45
47
|
setErrorHandler: (errorHandler: any) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/storage/SessionStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/storage/SessionStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAuE0B,OAAO;0BACb,OAAO;;;0BAIL,OAAO;wBACX,OAAO;;;;;;;;;AA/DzB,wBA0EE","file":"SessionStorage.d.ts","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst _sessionStorage = {\n authenticationHeaderOverrides: {},\n};\n\nexport default {\n session: {\n setItem: (key, value) => (_sessionStorage[key] = value),\n getItem: (key) => _sessionStorage[key],\n removeItem: (key) => delete _sessionStorage[key],\n raw: _sessionStorage,\n setUsername: (value) => (_sessionStorage['username'] = value),\n getUsername: () => _sessionStorage['username'],\n setPassword: (value) => (_sessionStorage['password'] = value),\n getPassword: () => _sessionStorage['password'],\n setTenant: (value) => (_sessionStorage['tenant'] = value),\n getTenant: () => _sessionStorage['tenant'],\n setDeploymentType: (value) => (_sessionStorage['deploymentType'] = value),\n getDeploymentType: () => _sessionStorage['deploymentType'],\n setRealm: (value) => (_sessionStorage['realm'] = value),\n getRealm: () => _sessionStorage['realm'],\n setCookieName: (value) => (_sessionStorage['cookieName'] = value),\n getCookieName: () => _sessionStorage['cookieName'],\n setCookieValue: (value) => (_sessionStorage['cookieValue'] = value),\n getCookieValue: () => _sessionStorage['cookieValue'],\n setAuthenticationService: (value) =>\n (_sessionStorage['authenticationService'] = value),\n getAuthenticationService: () => _sessionStorage['authenticationService'],\n setAuthenticationHeaderOverrides: (value) =>\n (_sessionStorage['authenticationHeaderOverrides'] = value),\n getAuthenticationHeaderOverrides: () =>\n _sessionStorage['authenticationHeaderOverrides'],\n setBearerToken: (value) => (_sessionStorage['bearerToken'] = value),\n getBearerToken: () => _sessionStorage['bearerToken'],\n setLogApiKey: (value) => (_sessionStorage['logApiKey'] = value),\n getLogApiKey: () => _sessionStorage['logApiKey'],\n setLogApiSecret: (value) => (_sessionStorage['logApiSecret'] = value),\n getLogApiSecret: () => _sessionStorage['logApiSecret'],\n setAmVersion: (value) => (_sessionStorage['amVersion'] = value),\n getAmVersion: () => _sessionStorage['amVersion'],\n setFrodoVersion: (value) => (_sessionStorage['frodoVersion'] = value),\n getFrodoVersion: () =>\n _sessionStorage['frodoVersion'] || `v${pkg.version} [${process.version}]`,\n setAllowInsecureConnection: (value) =>\n (_sessionStorage['insecure'] = value),\n getAllowInsecureConnection: () => _sessionStorage['insecure'],\n setConnectionProfilesPath: (value) =>\n (_sessionStorage['connectionProfilesPath'] = value),\n getConnectionProfilesPath: () => _sessionStorage['connectionProfilesPath'],\n setMasterKeyPath: (value) => (_sessionStorage['masterKeyPath'] = value),\n getMasterKeyPath: () => _sessionStorage['masterKeyPath'],\n setOutputFile: (value) => (_sessionStorage['outputFile'] = value),\n getOutputFile: () => _sessionStorage['outputFile'],\n setPrintHandler: (printHandler) =>\n (_sessionStorage['printHandler'] = printHandler),\n getPrintHandler: () => _sessionStorage['printHandler'],\n setErrorHandler: (errorHandler) =>\n (_sessionStorage['errorHandler'] = errorHandler),\n getErrorHandler: () => _sessionStorage['errorHandler'],\n setVerboseHandler: (verboseHandler) =>\n (_sessionStorage['verboseHandler'] = verboseHandler),\n getVerboseHandler: () => _sessionStorage['verboseHandler'],\n setVerbose: (verbose: boolean) => (_sessionStorage['verbose'] = verbose),\n getVerbose: (): boolean => _sessionStorage['verbose'],\n setDebugHandler: (debugHandler) =>\n (_sessionStorage['debugHandler'] = debugHandler),\n getDebugHandler: () => _sessionStorage['debugHandler'],\n setDebug: (debug: boolean) => (_sessionStorage['debug'] = debug),\n getDebug: (): boolean => _sessionStorage['debug'],\n setCreateProgressHandler: (handler) =>\n (_sessionStorage['createProgressHandler'] = handler),\n getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],\n setUpdateProgressHandler: (handler) =>\n (_sessionStorage['updateProgressHandler'] = handler),\n getUpdateProgressHandler: () => _sessionStorage['updateProgressHandler'],\n setStopProgressHandler: (handler) =>\n (_sessionStorage['stopProgressHandler'] = handler),\n getStopProgressHandler: () => _sessionStorage['stopProgressHandler'],\n },\n};\n"]}
|