@rockcarver/frodo-lib 0.16.2-10 → 0.16.2-11
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 +9 -1
- package/cjs/api/BaseApi.js +6 -1
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/index.js +1 -5
- package/cjs/index.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +19 -2
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +35 -311
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
- package/cjs/ops/JourneyOps.js +7 -7
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +231 -348
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/ThemeOps.test.js.map +1 -0
- package/cjs/ops/utils/ExportImportUtils.js +1 -0
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/test/mocks/snapshotResolve.js +0 -2
- package/cjs/test/mocks/snapshotResolve.js.map +1 -1
- package/esm/api/BaseApi.mjs +5 -0
- package/esm/index.mjs +0 -2
- package/esm/ops/ConnectionProfileOps.mjs +19 -2
- package/esm/ops/EmailTemplateOps.mjs +18 -250
- package/esm/ops/EmailTemplateOps.test.mjs +14 -39
- package/esm/ops/JourneyOps.mjs +2 -2
- package/esm/ops/ThemeOps.mjs +180 -254
- package/esm/{api/ThemeApi.test.mjs → ops/ThemeOps.test.mjs} +48 -48
- package/esm/ops/utils/ExportImportUtils.mjs +1 -1
- package/esm/test/mocks/snapshotResolve.mjs +0 -2
- package/package.json +1 -1
- package/types/api/BaseApi.d.ts.map +1 -1
- package/types/index.d.ts +0 -2
- package/types/index.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/EmailTemplateOps.d.ts +14 -33
- package/types/ops/EmailTemplateOps.d.ts.map +1 -1
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts +35 -50
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +2 -0
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/test/mocks/snapshotResolve.d.ts +1 -1
- package/types/test/mocks/snapshotResolve.d.ts.map +1 -1
- package/cjs/api/EmailTemplateApi.js +0 -61
- package/cjs/api/EmailTemplateApi.js.map +0 -1
- package/cjs/api/ThemeApi.js +0 -305
- package/cjs/api/ThemeApi.js.map +0 -1
- package/cjs/api/ThemeApi.test.js.map +0 -1
- package/esm/api/EmailTemplateApi.mjs +0 -34
- package/esm/api/ThemeApi.mjs +0 -241
- package/types/api/EmailTemplateApi.d.ts +0 -22
- package/types/api/EmailTemplateApi.d.ts.map +0 -1
- package/types/api/ThemeApi.d.ts +0 -56
- package/types/api/ThemeApi.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.16.2-11] - 2022-11-22
|
|
11
|
+
|
|
12
|
+
- \#154: Add frodo specific transactionId to all API requests
|
|
13
|
+
- rockcarver/frodo-cli#110: Migrate from .frodorc to Connections.json
|
|
14
|
+
- Refactored Email Template and Theme functionality in lib to remove fs operations
|
|
15
|
+
|
|
10
16
|
## [0.16.2-10] - 2022-11-22
|
|
11
17
|
|
|
12
18
|
## [0.16.2-9] - 2022-11-21
|
|
@@ -702,7 +708,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
702
708
|
- Fixed problem with adding connection profiles
|
|
703
709
|
- Miscellaneous bug fixes
|
|
704
710
|
|
|
705
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-
|
|
711
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-11...HEAD
|
|
712
|
+
|
|
713
|
+
[0.16.2-11]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-10...v0.16.2-11
|
|
706
714
|
|
|
707
715
|
[0.16.2-10]: https://github.com/rockcarver/frodo-lib/compare/v0.16.2-9...v0.16.2-10
|
|
708
716
|
|
package/cjs/api/BaseApi.js
CHANGED
|
@@ -20,6 +20,7 @@ var _SessionStorage = _interopRequireDefault(require("../storage/SessionStorage"
|
|
|
20
20
|
var _path = _interopRequireDefault(require("path"));
|
|
21
21
|
var _Console = require("../ops/utils/Console");
|
|
22
22
|
var _curlirize2 = _interopRequireDefault(require("../ext/axios-curlirize/curlirize"));
|
|
23
|
+
var _crypto = require("crypto");
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -43,6 +44,7 @@ var maxSockets = 100;
|
|
|
43
44
|
var maxFreeSockets = 10;
|
|
44
45
|
var freeSocketTimeout = 30000;
|
|
45
46
|
var userAgent = "".concat(pkg.name, "/").concat(pkg.version);
|
|
47
|
+
var transactionId = "frodo-".concat((0, _crypto.randomUUID)());
|
|
46
48
|
var httpAgent, httpsAgent;
|
|
47
49
|
function getHttpAgent() {
|
|
48
50
|
if (httpAgent) return httpAgent;
|
|
@@ -123,6 +125,7 @@ function generateAmApi(resource) {
|
|
|
123
125
|
var requestOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
124
126
|
var headers = _objectSpread(_objectSpread({
|
|
125
127
|
'User-Agent': userAgent,
|
|
128
|
+
'X-ForgeRock-TransactionId': transactionId,
|
|
126
129
|
'Content-Type': 'application/json'
|
|
127
130
|
}, resource.apiVersion && {
|
|
128
131
|
'Accept-API-Version': resource.apiVersion
|
|
@@ -161,7 +164,8 @@ function generateAmApi(resource) {
|
|
|
161
164
|
function generateOauth2Api(resource) {
|
|
162
165
|
var requestOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
163
166
|
var headers = _objectSpread(_objectSpread({
|
|
164
|
-
'User-Agent': userAgent
|
|
167
|
+
'User-Agent': userAgent,
|
|
168
|
+
'X-ForgeRock-TransactionId': transactionId
|
|
165
169
|
}, resource.apiVersion && {
|
|
166
170
|
'Accept-API-Version': resource.apiVersion
|
|
167
171
|
}), _SessionStorage.default.session.getCookieName() && _SessionStorage.default.session.getCookieValue() && {
|
|
@@ -202,6 +206,7 @@ function generateIdmApi() {
|
|
|
202
206
|
timeout,
|
|
203
207
|
headers: {
|
|
204
208
|
'User-Agent': userAgent,
|
|
209
|
+
'X-ForgeRock-TransactionId': transactionId,
|
|
205
210
|
'Content-Type': 'application/json'
|
|
206
211
|
}
|
|
207
212
|
}, requestOverride), {}, {
|
package/cjs/api/BaseApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApi.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","axiosRetry","axios","retries","shouldResetTimeout","retryCondition","_error","timeout","maxSockets","maxFreeSockets","freeSocketTimeout","userAgent","name","version","httpAgent","httpsAgent","getHttpAgent","Agent","getHttpsAgent","options","rejectUnauthorized","storage","session","getAllowInsecureConnection","httpsProxy","process","env","HTTPS_PROXY","https_proxy","console","error","parsed","url","hostname","port","protocol","HttpsProxyAgent","HttpsAgent","getProxy","curlirize","request","_curlirize","result","err","command","printMessage","curlirizeMessage","generateAmApi","resource","requestOverride","headers","apiVersion","getCookieName","getCookieValue","Cookie","requestDetails","getAuthenticationHeaderOverrides","proxy","create","getCurlirize","generateOauth2Api","generateIdmApi","getBearerToken","generateLogKeysApi","generateLogApi","getLogApiKey","getLogApiSecret","generateESVApi","generateReleaseApi","baseUrl","baseURL"],"sources":["api/BaseApi.ts"],"sourcesContent":["import Agent from 'agentkeepalive';\nimport axios, { AxiosProxyConfig } from 'axios';\nimport axiosRetry from 'axios-retry';\nimport HttpsProxyAgent from 'https-proxy-agent';\nimport url from 'url';\nimport fs from 'fs';\nimport storage from '../storage/SessionStorage';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { curlirizeMessage, printMessage } from '../ops/utils/Console';\nimport _curlirize from '../ext/axios-curlirize/curlirize';\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\naxiosRetry(axios, {\n retries: 3,\n shouldResetTimeout: true,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n retryCondition: (_error) => true, // retry no matter what\n});\n\n// all agents\nconst timeout = 30000;\n\n// agentkeepalive\nconst maxSockets = 100;\nconst maxFreeSockets = 10;\nconst freeSocketTimeout = 30000;\n\nconst userAgent = `${pkg.name}/${pkg.version}`;\nlet httpAgent, httpsAgent;\n\nfunction getHttpAgent() {\n if (httpAgent) return httpAgent;\n httpAgent = new Agent({\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpAgent;\n}\n\n/**\n * Helper method to create properly configured httpsAgent\n * @returns {any} appropriate httpsAgent\n */\nfunction getHttpsAgent() {\n if (httpsAgent) return httpsAgent;\n const options = {\n rejectUnauthorized: !storage.session.getAllowInsecureConnection(),\n };\n const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;\n if (httpsProxy) {\n // https://github.com/axios/axios/issues/3459\n console.error(`Using proxy ${httpsProxy}`['yellow']);\n const parsed = url.parse(httpsProxy);\n options['host'] = parsed.hostname;\n options['port'] = parsed.port;\n options['protocol'] = parsed.protocol;\n options.rejectUnauthorized = !storage.session.getAllowInsecureConnection();\n httpsAgent = HttpsProxyAgent(options);\n return httpsAgent;\n }\n httpsAgent = new Agent.HttpsAgent({\n ...options,\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpsAgent;\n}\n\n/**\n * Get Proxy config\n * @returns {AxiosProxyConfig | false} axios proxy config or false\n */\nfunction getProxy(): AxiosProxyConfig | false {\n if (process.env.HTTPS_PROXY || process.env.https_proxy) return false;\n return null;\n}\n\n/**\n * Customize curlirize output\n * @param request axios request object\n */\nfunction curlirize(request) {\n _curlirize(request, (result, err) => {\n const { command } = result;\n if (err) {\n printMessage(err, 'error');\n } else {\n curlirizeMessage(command);\n }\n });\n}\n\n/**\n * Generates an AM Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateAmApi(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n // only send session cookie if we know its name and value\n ...(storage.session.getCookieName() &&\n storage.session.getCookieValue() && {\n Cookie: `${storage.session.getCookieName()}=${storage.session.getCookieValue()}`,\n }),\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n // baseURL: `${storage.session.getTenant()}/json`,\n timeout,\n ...requestOverride,\n headers: {\n ...headers,\n ...storage.session.getAuthenticationHeaderOverrides(),\n },\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an OAuth2 Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateOauth2Api(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n // only send session cookie if we know its name and value\n ...(storage.session.getCookieName() &&\n storage.session.getCookieValue() && {\n Cookie: `${storage.session.getCookieName()}=${storage.session.getCookieValue()}`,\n }),\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n // baseURL: `${storage.session.getTenant()}/json${resource.path}`,\n timeout,\n ...requestOverride,\n headers: {\n ...headers,\n ...storage.session.getAuthenticationHeaderOverrides(),\n },\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an IDM Axios API instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateIdmApi(requestOverride = {}) {\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers: {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n },\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a LogKeys API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogKeysApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a Log API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'X-API-Key': storage.session.getLogApiKey(),\n 'X-API-Secret': storage.session.getLogApiSecret(),\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an ESV Axios API instance for Environment Secrets and Variables\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateESVApi(resource, requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a release (Github or Npm) Axios API instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateReleaseApi(baseUrl, requestOverride = {}) {\n const requestDetails = {\n baseURL: baseUrl,\n timeout,\n headers: {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n },\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAA0D;AAAA;AAAA;AAAA;AAAA;AAAA;AAE1D,IAAMA,QAAS,GAAGC,aAAI,CAACC,OAAO,CAAC,IAAAC,kBAAa,s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;IAClBnC,SAAS,EAAEE,YAAY,EAAE;IACzBD,UAAU,EAAEG,aAAa,EAAE;IAC3BuC,KAAK,EAAEnB,QAAQ;EAAE,EAClB;EAED,IAAME,OAAO,GAAGtC,cAAK,CAACwD,MAAM,CAACH,cAAc,CAAC;;EAE5C;EACA,IAAIlC,uBAAO,CAACC,OAAO,CAACqC,YAAY,EAAE,EAAE;IAClCpB,SAAS,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOA,OAAO;AAChB"}
|
|
1
|
+
{"version":3,"file":"BaseApi.js","names":["__dirname","path","dirname","fileURLToPath","pkg","JSON","parse","fs","readFileSync","resolve","axiosRetry","axios","retries","shouldResetTimeout","retryCondition","_error","timeout","maxSockets","maxFreeSockets","freeSocketTimeout","userAgent","name","version","transactionId","randomUUID","httpAgent","httpsAgent","getHttpAgent","Agent","getHttpsAgent","options","rejectUnauthorized","storage","session","getAllowInsecureConnection","httpsProxy","process","env","HTTPS_PROXY","https_proxy","console","error","parsed","url","hostname","port","protocol","HttpsProxyAgent","HttpsAgent","getProxy","curlirize","request","_curlirize","result","err","command","printMessage","curlirizeMessage","generateAmApi","resource","requestOverride","headers","apiVersion","getCookieName","getCookieValue","Cookie","requestDetails","getAuthenticationHeaderOverrides","proxy","create","getCurlirize","generateOauth2Api","generateIdmApi","getBearerToken","generateLogKeysApi","generateLogApi","getLogApiKey","getLogApiSecret","generateESVApi","generateReleaseApi","baseUrl","baseURL"],"sources":["api/BaseApi.ts"],"sourcesContent":["import Agent from 'agentkeepalive';\nimport axios, { AxiosProxyConfig } from 'axios';\nimport axiosRetry from 'axios-retry';\nimport HttpsProxyAgent from 'https-proxy-agent';\nimport url from 'url';\nimport fs from 'fs';\nimport storage from '../storage/SessionStorage';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { curlirizeMessage, printMessage } from '../ops/utils/Console';\nimport _curlirize from '../ext/axios-curlirize/curlirize';\nimport { randomUUID } from 'crypto';\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\naxiosRetry(axios, {\n retries: 3,\n shouldResetTimeout: true,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n retryCondition: (_error) => true, // retry no matter what\n});\n\n// all agents\nconst timeout = 30000;\n\n// agentkeepalive\nconst maxSockets = 100;\nconst maxFreeSockets = 10;\nconst freeSocketTimeout = 30000;\n\nconst userAgent = `${pkg.name}/${pkg.version}`;\nconst transactionId = `frodo-${randomUUID()}`;\nlet httpAgent, httpsAgent;\n\nfunction getHttpAgent() {\n if (httpAgent) return httpAgent;\n httpAgent = new Agent({\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpAgent;\n}\n\n/**\n * Helper method to create properly configured httpsAgent\n * @returns {any} appropriate httpsAgent\n */\nfunction getHttpsAgent() {\n if (httpsAgent) return httpsAgent;\n const options = {\n rejectUnauthorized: !storage.session.getAllowInsecureConnection(),\n };\n const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;\n if (httpsProxy) {\n // https://github.com/axios/axios/issues/3459\n console.error(`Using proxy ${httpsProxy}`['yellow']);\n const parsed = url.parse(httpsProxy);\n options['host'] = parsed.hostname;\n options['port'] = parsed.port;\n options['protocol'] = parsed.protocol;\n options.rejectUnauthorized = !storage.session.getAllowInsecureConnection();\n httpsAgent = HttpsProxyAgent(options);\n return httpsAgent;\n }\n httpsAgent = new Agent.HttpsAgent({\n ...options,\n maxSockets,\n maxFreeSockets,\n timeout,\n freeSocketTimeout,\n });\n return httpsAgent;\n}\n\n/**\n * Get Proxy config\n * @returns {AxiosProxyConfig | false} axios proxy config or false\n */\nfunction getProxy(): AxiosProxyConfig | false {\n if (process.env.HTTPS_PROXY || process.env.https_proxy) return false;\n return null;\n}\n\n/**\n * Customize curlirize output\n * @param request axios request object\n */\nfunction curlirize(request) {\n _curlirize(request, (result, err) => {\n const { command } = result;\n if (err) {\n printMessage(err, 'error');\n } else {\n curlirizeMessage(command);\n }\n });\n}\n\n/**\n * Generates an AM Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateAmApi(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n 'X-ForgeRock-TransactionId': transactionId,\n 'Content-Type': 'application/json',\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n // only send session cookie if we know its name and value\n ...(storage.session.getCookieName() &&\n storage.session.getCookieValue() && {\n Cookie: `${storage.session.getCookieName()}=${storage.session.getCookieValue()}`,\n }),\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n // baseURL: `${storage.session.getTenant()}/json`,\n timeout,\n ...requestOverride,\n headers: {\n ...headers,\n ...storage.session.getAuthenticationHeaderOverrides(),\n },\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an OAuth2 Axios API instance\n * @param {object} resource Takes an object takes a resource object. example:\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either\n * add on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateOauth2Api(resource, requestOverride = {}) {\n let headers = {\n 'User-Agent': userAgent,\n 'X-ForgeRock-TransactionId': transactionId,\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n // only send session cookie if we know its name and value\n ...(storage.session.getCookieName() &&\n storage.session.getCookieValue() && {\n Cookie: `${storage.session.getCookieName()}=${storage.session.getCookieValue()}`,\n }),\n };\n if (requestOverride['headers']) {\n headers = {\n ...headers,\n ...requestOverride['headers'],\n };\n }\n\n const requestDetails = {\n // baseURL: `${storage.session.getTenant()}/json${resource.path}`,\n timeout,\n ...requestOverride,\n headers: {\n ...headers,\n ...storage.session.getAuthenticationHeaderOverrides(),\n },\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an IDM Axios API instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateIdmApi(requestOverride = {}) {\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers: {\n 'User-Agent': userAgent,\n 'X-ForgeRock-TransactionId': transactionId,\n 'Content-Type': 'application/json',\n },\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a LogKeys API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogKeysApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a Log API Axios instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateLogApi(requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'X-API-Key': storage.session.getLogApiKey(),\n 'X-API-Secret': storage.session.getLogApiSecret(),\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates an ESV Axios API instance for Environment Secrets and Variables\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateESVApi(resource, requestOverride = {}) {\n const headers = {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n // only add API version if we have it\n ...(resource.apiVersion && { 'Accept-API-Version': resource.apiVersion }),\n };\n const requestDetails = {\n // baseURL: getTenantURL(storage.session.getTenant()),\n timeout,\n headers,\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n if (storage.session.getBearerToken()) {\n requestDetails.headers[\n 'Authorization'\n ] = `Bearer ${storage.session.getBearerToken()}`;\n }\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n\n/**\n * Generates a release (Github or Npm) Axios API instance\n * @param {object} requestOverride Takes an object of AXIOS parameters that can be used to either add\n * on extra information or override default properties https://github.com/axios/axios#request-config\n *\n * @returns {AxiosInstance}\n */\nexport function generateReleaseApi(baseUrl, requestOverride = {}) {\n const requestDetails = {\n baseURL: baseUrl,\n timeout,\n headers: {\n 'User-Agent': userAgent,\n 'Content-Type': 'application/json',\n },\n ...requestOverride,\n httpAgent: getHttpAgent(),\n httpsAgent: getHttpsAgent(),\n proxy: getProxy(),\n };\n\n const request = axios.create(requestDetails);\n\n // enable curlirizer output in debug mode\n if (storage.session.getCurlirize()) {\n curlirize(request);\n }\n\n return request;\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAEpC,IAAMA,QAAS,GAAGC,aAAI,CAACC,OAAO,CAAC,IAAAC,kBAAa,sDAAiB,CAAC;AAE9D,IAAMC,GAAG,GAAGC,IAAI,CAACC,KAAK,CACpBC,WAAE,CAACC,YAAY,CAACP,aAAI,CAACQ,OAAO,CAACT,QAAS,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,CACvE;AAED,IAAAU,mBAAU,EAACC,cAAK,EAAE;EAChBC,OAAO,EAAE,CAAC;EACVC,kBAAkB,EAAE,IAAI;EACxB;EACAC,cAAc,EAAGC,MAAM,IAAK,IAAI,CAAE;AACpC,CAAC,CAAC;;AAEF;AACA,IAAMC,OAAO,GAAG,KAAK;;AAErB;AACA,IAAMC,UAAU,GAAG,GAAG;AACtB,IAAMC,cAAc,GAAG,EAAE;AACzB,IAAMC,iBAAiB,GAAG,KAAK;AAE/B,IAAMC,SAAS,aAAMhB,GAAG,CAACiB,IAAI,cAAIjB,GAAG,CAACkB,OAAO,CAAE;AAC9C,IAAMC,aAAa,mBAAY,IAAAC,kBAAU,GAAE,CAAE;AAC7C,IAAIC,SAAS,EAAEC,UAAU;AAEzB,SAASC,YAAY,GAAG;EACtB,IAAIF,SAAS,EAAE,OAAOA,SAAS;E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EG,aAAa,EAAE;IAC3BuC,KAAK,EAAEnB,QAAQ;EAAE,EAClB;EAED,IAAIjB,uBAAO,CAACC,OAAO,CAACwC,cAAc,EAAE,EAAE;IACpCP,cAAc,CAACL,OAAO,CACpB,eAAe,CAChB,oBAAa7B,uBAAO,CAACC,OAAO,CAACwC,cAAc,EAAE,CAAE;EAClD;EAEA,IAAMtB,OAAO,GAAGxC,cAAK,CAAC0D,MAAM,CAACH,cAAc,CAAC;;EAE5C;EACA,IAAIlC,uBAAO,CAACC,OAAO,CAACqC,YAAY,EAAE,EAAE;IAClCpB,SAAS,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOA,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4B,kBAAkB,CAACC,OAAO,EAAwB;EAAA,IAAtBpB,eAAe,uEAAG,CAAC,CAAC;EAC9D,IAAMM,cAAc;IAClBe,OAAO,EAAED,OAAO;IAChBhE,OAAO;IACP6C,OAAO,EAAE;MACP,YAAY,EAAEzC,SAAS;MACvB,cAAc,EAAE;IAClB;EAAC,GACEwC,eAAe;IAClBnC,SAAS,EAAEE,YAAY,EAAE;IACzBD,UAAU,EAAEG,aAAa,EAAE;IAC3BuC,KAAK,EAAEnB,QAAQ;EAAE,EAClB;EAED,IAAME,OAAO,GAAGxC,cAAK,CAAC0D,MAAM,CAACH,cAAc,CAAC;;EAE5C;EACA,IAAIlC,uBAAO,CAACC,OAAO,CAACqC,YAAY,EAAE,EAAE;IAClCpB,SAAS,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOA,OAAO;AAChB"}
|
package/cjs/index.js
CHANGED
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.state = exports.VariablesRaw = exports.Variables = exports.Utils = exports.TypesRaw = exports.Types = exports.TreeRaw = exports.
|
|
6
|
+
exports.state = exports.VariablesRaw = exports.Variables = exports.Utils = exports.TypesRaw = exports.Types = exports.TreeRaw = exports.Theme = exports.StartupRaw = exports.Startup = exports.Service = exports.SecretsRaw = exports.Secrets = exports.Script = exports.Saml2 = exports.Realm = exports.Organization = exports.OAuth2OIDCApi = exports.OAuth2Client = exports.NodeRaw = exports.Node = exports.ManagedObject = exports.Log = exports.LibVersion = exports.Journey = exports.Idp = exports.Idm = exports.ExportImportUtils = exports.EmailTemplate = exports.ConnectionProfile = exports.CirclesOfTrust = exports.Authenticate = exports.AgentRaw = exports.Agent = exports.Admin = void 0;
|
|
7
7
|
var _colors = _interopRequireDefault(require("colors"));
|
|
8
8
|
var _AgentRaw = _interopRequireWildcard(require("./api/AgentApi"));
|
|
9
9
|
exports.AgentRaw = _AgentRaw;
|
|
10
|
-
var _EmailTemplateRaw = _interopRequireWildcard(require("./api/EmailTemplateApi"));
|
|
11
|
-
exports.EmailTemplateRaw = _EmailTemplateRaw;
|
|
12
10
|
var _NodeRaw = _interopRequireWildcard(require("./api/NodeApi"));
|
|
13
11
|
exports.NodeRaw = _NodeRaw;
|
|
14
12
|
var _SecretsRaw = _interopRequireWildcard(require("./api/SecretsApi"));
|
|
15
13
|
exports.SecretsRaw = _SecretsRaw;
|
|
16
14
|
var _StartupRaw = _interopRequireWildcard(require("./api/StartupApi"));
|
|
17
15
|
exports.StartupRaw = _StartupRaw;
|
|
18
|
-
var _ThemeRaw = _interopRequireWildcard(require("./api/ThemeApi"));
|
|
19
|
-
exports.ThemeRaw = _ThemeRaw;
|
|
20
16
|
var _TreeRaw = _interopRequireWildcard(require("./api/TreeApi"));
|
|
21
17
|
exports.TreeRaw = _TreeRaw;
|
|
22
18
|
var _TypesRaw = _interopRequireWildcard(require("./api/ApiTypes"));
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Color","enable"],"sources":["index.ts"],"sourcesContent":["import Color from 'colors';\n\nColor.enable();\n\n// Api Layer\nexport * as AgentRaw from './api/AgentApi';\nexport * as
|
|
1
|
+
{"version":3,"file":"index.js","names":["Color","enable"],"sources":["index.ts"],"sourcesContent":["import Color from 'colors';\n\nColor.enable();\n\n// Api Layer\nexport * as AgentRaw from './api/AgentApi';\nexport * as NodeRaw from './api/NodeApi';\nexport * as SecretsRaw from './api/SecretsApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as TypesRaw from './api/ApiTypes';\nexport * as VariablesRaw from './api/VariablesApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Agent from './ops/AgentOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdpOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as Node from './ops/NodeOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml2 from './ops/Saml2Ops';\nexport * as Script from './ops/ScriptOps';\nexport * as Service from './ops/ServiceOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Types from './ops/OpsTypes';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\nexport * as LibVersion from './ops/utils/Version';\nexport * as ExportImportUtils from './ops/utils/ExportImportUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"],"mappings":";;;;;;AAAA;AAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3BA,eAAK,CAACC,MAAM,EAAE;;AAEd"}
|
|
@@ -25,13 +25,14 @@ var dataProtection = new _DataProtection.default();
|
|
|
25
25
|
var fileOptions = {
|
|
26
26
|
indentation: 4
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
var legacyProfileFilename = '.frodorc';
|
|
29
|
+
var newProfileFilename = 'Connections.json';
|
|
29
30
|
/**
|
|
30
31
|
* Get connection profiles file name
|
|
31
32
|
* @returns {String} connection profiles file name
|
|
32
33
|
*/
|
|
33
34
|
function getConnectionProfilesPath() {
|
|
34
|
-
return _SessionStorage.default.session.getConnectionProfilesPath() || process.env[_StaticStorage.FRODO_CONNECTION_PROFILES_PATH_KEY] || "".concat(_os.default.homedir(), "/.frodo
|
|
35
|
+
return _SessionStorage.default.session.getConnectionProfilesPath() || process.env[_StaticStorage.FRODO_CONNECTION_PROFILES_PATH_KEY] || "".concat(_os.default.homedir(), "/.frodo/").concat(newProfileFilename);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -79,6 +80,21 @@ function listConnectionProfiles() {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Migrate from .frodorc to Connections.json
|
|
85
|
+
* @returns {String} connections profile filename
|
|
86
|
+
*/
|
|
87
|
+
function migrateFromLegacyProfile() {
|
|
88
|
+
var legacyPath = "".concat(_os.default.homedir(), "/.frodo/").concat(legacyProfileFilename);
|
|
89
|
+
if (_fs.default.existsSync(legacyPath)) {
|
|
90
|
+
_fs.default.copyFileSync(legacyPath, "".concat(_os.default.homedir(), "/.frodo/").concat(newProfileFilename));
|
|
91
|
+
// for now, just add a "deprecated" suffix. May delete the old file
|
|
92
|
+
// in a future release
|
|
93
|
+
_fs.default.renameSync(legacyPath, "".concat(legacyPath, ".deprecated"));
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
82
98
|
/**
|
|
83
99
|
* Initialize connection profiles
|
|
84
100
|
*/
|
|
@@ -96,6 +112,7 @@ function initConnectionProfiles() {
|
|
|
96
112
|
}
|
|
97
113
|
// encrypt the password from clear text to aes-256-GCM
|
|
98
114
|
else {
|
|
115
|
+
migrateFromLegacyProfile();
|
|
99
116
|
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
100
117
|
var connectionsData = JSON.parse(data);
|
|
101
118
|
var convert = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProfileOps.js","names":["dataProtection","DataProtection","fileOptions","indentation","getConnectionProfilesPath","storage","session","process","env","FRODO_CONNECTION_PROFILES_PATH_KEY","os","homedir","findConnectionProfile","connectionProfiles","host","profiles","tenant","includes","foundProfile","push","listConnectionProfiles","long","filename","data","fs","readFileSync","connectionsData","JSON","parse","table","createTable","Object","keys","forEach","c","username","logApiKey","printMessage","toString","e","message","initConnectionProfiles","folderName","path","dirname","existsSync","mkdirSync","recursive","writeFileSync","stringify","convert","conn","password","encodedPassword","encrypt","getConnectionProfileByHost","length","p","decrypt","key","secret","logApiSecret","authenticationService","authenticationHeaderOverrides","getConnectionProfile","getTenant","saveConnectionProfile","existingData","statSync","getUsername","getPassword","getLogApiKey","getLogApiSecret","getAuthenticationService","getAuthenticationHeaderOverrides","deleteConnectionProfile","stat","err","code","describeConnectionProfile","showSecrets","profile","keyMap","createObjectTable"],"sources":["ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport storage from '../storage/SessionStorage';\nimport DataProtection from './utils/DataProtection';\nimport { createObjectTable, createTable, printMessage } from './utils/Console';\nimport { FRODO_CONNECTION_PROFILES_PATH_KEY } from '../storage/StaticStorage';\nimport { profile } from 'console';\n\nconst dataProtection = new DataProtection();\n\nconst fileOptions = {\n indentation: 4,\n};\n\n/**\n * Get connection profiles file name\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath(): string {\n return (\n storage.session.getConnectionProfilesPath() ||\n process.env[FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/.frodorc`\n );\n}\n\n/**\n * Find connection profile\n * @param {Object} connectionProfiles connection profile object\n * @param {String} host tenant host url or unique substring\n * @returns {Object} connection profile object or null\n */\nfunction findConnectionProfile(connectionProfiles, host) {\n const profiles = [];\n for (const tenant in connectionProfiles) {\n if (tenant.includes(host)) {\n const foundProfile = connectionProfiles[tenant];\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * List connection profiles\n * @param {boolean} long Long list format with details\n */\nexport function listConnectionProfiles(long = false) {\n const filename = getConnectionProfilesPath();\n try {\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n if (long) {\n const table = createTable(['Host', 'Username', 'Log API Key']);\n Object.keys(connectionsData).forEach((c) => {\n table.push([\n c,\n connectionsData[c].username,\n connectionsData[c].logApiKey,\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n Object.keys(connectionsData).forEach((c) => {\n printMessage(`${c}`, 'data');\n });\n }\n printMessage(\n 'Any unique substring of a saved host can be used as the value for host parameter in all commands',\n 'info'\n );\n } catch (e) {\n printMessage(`No connections found in ${filename} (${e.message})`, 'error');\n }\n}\n\n/**\n * Initialize connection profiles\n */\nexport function initConnectionProfiles() {\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath();\n const folderName = path.dirname(filename);\n if (!fs.existsSync(folderName)) {\n fs.mkdirSync(folderName, { recursive: true });\n if (!fs.existsSync(filename)) {\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password from clear text to aes-256-GCM\n else {\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n let convert = false;\n Object.keys(connectionsData).forEach(async (conn) => {\n if (connectionsData[conn].password) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn].password\n ); // Buffer.from(connectionsData[conn].password).toString('base64');\n delete connectionsData[conn].password;\n }\n });\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost(host) {\n try {\n const filename = getConnectionProfilesPath();\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfile(connectionsData, host);\n if (profiles.length == 0) {\n printMessage(\n `Profile for ${host} not found. Please specify credentials on command line`,\n 'error'\n );\n return null;\n }\n if (profiles.length > 1) {\n printMessage(`Multiple matching profiles found.`, 'error');\n profiles.forEach((p) => {\n printMessage(`- ${p.tenant}`, 'error');\n });\n printMessage(`Please specify a unique sub-string`, 'error');\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n key: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n secret: profiles[0].logApiSecret ? profiles[0].logApiSecret : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n };\n } catch (e) {\n printMessage(\n `Can not read saved connection info, please specify credentials on command line: ${e}`,\n 'error'\n );\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile() {\n return getConnectionProfileByHost(storage.session.getTenant());\n}\n\n/**\n * Save connection profile\n */\nexport async function saveConnectionProfile() {\n const filename = getConnectionProfilesPath();\n printMessage(`Saving creds in ${filename}...`);\n let connectionsData = {};\n let existingData = {};\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n if (connectionsData[storage.session.getTenant()]) {\n existingData = connectionsData[storage.session.getTenant()];\n printMessage(\n `Updating connection profile ${storage.session.getTenant()}`\n );\n } else\n printMessage(`Adding connection profile ${storage.session.getTenant()}`);\n } catch (e) {\n printMessage(\n `Creating connection profiles file ${filename} with ${storage.session.getTenant()}`\n );\n }\n if (storage.session.getUsername())\n existingData['username'] = storage.session.getUsername();\n if (storage.session.getPassword())\n existingData['encodedPassword'] = await dataProtection.encrypt(\n storage.session.getPassword()\n );\n if (storage.session.getLogApiKey())\n existingData['logApiKey'] = storage.session.getLogApiKey();\n if (storage.session.getLogApiSecret())\n existingData['logApiSecret'] = storage.session.getLogApiSecret();\n\n // advanced settings\n if (storage.session.getAuthenticationService()) {\n existingData['authenticationService'] =\n storage.session.getAuthenticationService();\n printMessage(\n 'Advanced setting: Authentication Service: ' +\n storage.session.getAuthenticationService(),\n 'info'\n );\n }\n if (storage.session.getAuthenticationHeaderOverrides()) {\n existingData['authenticationHeaderOverrides'] =\n storage.session.getAuthenticationHeaderOverrides();\n printMessage('Advanced setting: Authentication Header Overrides: ', 'info');\n printMessage(storage.session.getAuthenticationHeaderOverrides(), 'info');\n }\n\n connectionsData[storage.session.getTenant()] = existingData;\n\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile(host) {\n const filename = getConnectionProfilesPath();\n let connectionsData = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfile(connectionsData, host);\n if (profiles.length == 1) {\n printMessage(`Deleting connection profile ${profiles[0].tenant}`);\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n } else {\n if (profiles.length > 1) {\n printMessage(`Multiple matching profiles found.`, 'error');\n profiles.forEach((p) => {\n printMessage(`- ${p.tenant}`, 'error');\n });\n printMessage(`Please specify a unique sub-string`, 'error');\n return null;\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage(`Connection profile file ${filename} not found`);\n } else {\n printMessage(\n `Error in deleting connection profile: ${err.code}`,\n 'error'\n );\n }\n });\n}\n\nexport async function describeConnectionProfile(host, showSecrets) {\n const profile = await getConnectionProfileByHost(host);\n if (profile) {\n if (!showSecrets) {\n delete profile.password;\n delete profile.secret;\n }\n if (!profile.key) {\n delete profile.key;\n delete profile.secret;\n }\n const keyMap = {\n tenant: 'Host',\n username: 'Username',\n password: 'Password',\n key: 'Log API Key',\n secret: 'Log API Secret',\n authenticationService: 'Authentication Service',\n authenticationHeaderOverrides: 'Authentication Header Overrides',\n };\n const table = createObjectTable(profile, keyMap);\n printMessage(table.toString(), 'data');\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAA8E;AAAA;AAAA;AAG9E,IAAMA,cAAc,GAAG,IAAIC,uBAAc,EAAE;AAE3C,IAAMC,WAAW,GAAG;EAClBC,WAAW,EAAE;AACf,CAAC;;AAED;AACA;AACA;AACA;AACO,SAASC,yBAAyB,GAAW;EAClD,O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OAAOC,OAAO,CAAC7B,QAAQ;QACvB,OAAO6B,OAAO,CAACrB,MAAM;MACvB;MACA,IAAI,CAACqB,OAAO,CAACtB,GAAG,EAAE;QAChB,OAAOsB,OAAO,CAACtB,GAAG;QAClB,OAAOsB,OAAO,CAACrB,MAAM;MACvB;MACA,IAAMsB,MAAM,GAAG;QACblE,MAAM,EAAE,MAAM;QACdmB,QAAQ,EAAE,UAAU;QACpBiB,QAAQ,EAAE,UAAU;QACpBO,GAAG,EAAE,aAAa;QAClBC,MAAM,EAAE,gBAAgB;QACxBE,qBAAqB,EAAE,wBAAwB;QAC/CC,6BAA6B,EAAE;MACjC,CAAC;MACD,IAAMlC,KAAK,GAAG,IAAAsD,0BAAiB,EAACF,OAAO,EAAEC,MAAM,CAAC;MAChD,IAAA7C,qBAAY,EAACR,KAAK,CAACS,QAAQ,EAAE,EAAE,MAAM,CAAC;IACxC,CAAC,MAAM;MACL,IAAAD,qBAAY,kCAA0BvB,IAAI,YAAS;IACrD;EACF,CAAC;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"ConnectionProfileOps.js","names":["dataProtection","DataProtection","fileOptions","indentation","legacyProfileFilename","newProfileFilename","getConnectionProfilesPath","storage","session","process","env","FRODO_CONNECTION_PROFILES_PATH_KEY","os","homedir","findConnectionProfile","connectionProfiles","host","profiles","tenant","includes","foundProfile","push","listConnectionProfiles","long","filename","data","fs","readFileSync","connectionsData","JSON","parse","table","createTable","Object","keys","forEach","c","username","logApiKey","printMessage","toString","e","message","migrateFromLegacyProfile","legacyPath","existsSync","copyFileSync","renameSync","initConnectionProfiles","folderName","path","dirname","mkdirSync","recursive","writeFileSync","stringify","convert","conn","password","encodedPassword","encrypt","getConnectionProfileByHost","length","p","decrypt","key","secret","logApiSecret","authenticationService","authenticationHeaderOverrides","getConnectionProfile","getTenant","saveConnectionProfile","existingData","statSync","getUsername","getPassword","getLogApiKey","getLogApiSecret","getAuthenticationService","getAuthenticationHeaderOverrides","deleteConnectionProfile","stat","err","code","describeConnectionProfile","showSecrets","profile","keyMap","createObjectTable"],"sources":["ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport storage from '../storage/SessionStorage';\nimport DataProtection from './utils/DataProtection';\nimport { createObjectTable, createTable, printMessage } from './utils/Console';\nimport { FRODO_CONNECTION_PROFILES_PATH_KEY } from '../storage/StaticStorage';\n\nconst dataProtection = new DataProtection();\n\nconst fileOptions = {\n indentation: 4,\n};\n\nconst legacyProfileFilename = '.frodorc';\nconst newProfileFilename = 'Connections.json';\n/**\n * Get connection profiles file name\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath(): string {\n return (\n storage.session.getConnectionProfilesPath() ||\n process.env[FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/${newProfileFilename}`\n );\n}\n\n/**\n * Find connection profile\n * @param {Object} connectionProfiles connection profile object\n * @param {String} host tenant host url or unique substring\n * @returns {Object} connection profile object or null\n */\nfunction findConnectionProfile(connectionProfiles, host) {\n const profiles = [];\n for (const tenant in connectionProfiles) {\n if (tenant.includes(host)) {\n const foundProfile = connectionProfiles[tenant];\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * List connection profiles\n * @param {boolean} long Long list format with details\n */\nexport function listConnectionProfiles(long = false) {\n const filename = getConnectionProfilesPath();\n try {\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n if (long) {\n const table = createTable(['Host', 'Username', 'Log API Key']);\n Object.keys(connectionsData).forEach((c) => {\n table.push([\n c,\n connectionsData[c].username,\n connectionsData[c].logApiKey,\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n Object.keys(connectionsData).forEach((c) => {\n printMessage(`${c}`, 'data');\n });\n }\n printMessage(\n 'Any unique substring of a saved host can be used as the value for host parameter in all commands',\n 'info'\n );\n } catch (e) {\n printMessage(`No connections found in ${filename} (${e.message})`, 'error');\n }\n}\n\n/**\n * Migrate from .frodorc to Connections.json\n * @returns {String} connections profile filename\n */\nfunction migrateFromLegacyProfile() {\n const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;\n if (fs.existsSync(legacyPath)) {\n fs.copyFileSync(legacyPath, `${os.homedir()}/.frodo/${newProfileFilename}`);\n // for now, just add a \"deprecated\" suffix. May delete the old file\n // in a future release\n fs.renameSync(legacyPath, `${legacyPath}.deprecated`);\n }\n return;\n}\n\n/**\n * Initialize connection profiles\n */\nexport function initConnectionProfiles() {\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath();\n const folderName = path.dirname(filename);\n if (!fs.existsSync(folderName)) {\n fs.mkdirSync(folderName, { recursive: true });\n if (!fs.existsSync(filename)) {\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password from clear text to aes-256-GCM\n else {\n migrateFromLegacyProfile();\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData = JSON.parse(data);\n let convert = false;\n Object.keys(connectionsData).forEach(async (conn) => {\n if (connectionsData[conn].password) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn].password\n ); // Buffer.from(connectionsData[conn].password).toString('base64');\n delete connectionsData[conn].password;\n }\n });\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost(host) {\n try {\n const filename = getConnectionProfilesPath();\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfile(connectionsData, host);\n if (profiles.length == 0) {\n printMessage(\n `Profile for ${host} not found. Please specify credentials on command line`,\n 'error'\n );\n return null;\n }\n if (profiles.length > 1) {\n printMessage(`Multiple matching profiles found.`, 'error');\n profiles.forEach((p) => {\n printMessage(`- ${p.tenant}`, 'error');\n });\n printMessage(`Please specify a unique sub-string`, 'error');\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n key: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n secret: profiles[0].logApiSecret ? profiles[0].logApiSecret : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n };\n } catch (e) {\n printMessage(\n `Can not read saved connection info, please specify credentials on command line: ${e}`,\n 'error'\n );\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile() {\n return getConnectionProfileByHost(storage.session.getTenant());\n}\n\n/**\n * Save connection profile\n */\nexport async function saveConnectionProfile() {\n const filename = getConnectionProfilesPath();\n printMessage(`Saving creds in ${filename}...`);\n let connectionsData = {};\n let existingData = {};\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n if (connectionsData[storage.session.getTenant()]) {\n existingData = connectionsData[storage.session.getTenant()];\n printMessage(\n `Updating connection profile ${storage.session.getTenant()}`\n );\n } else\n printMessage(`Adding connection profile ${storage.session.getTenant()}`);\n } catch (e) {\n printMessage(\n `Creating connection profiles file ${filename} with ${storage.session.getTenant()}`\n );\n }\n if (storage.session.getUsername())\n existingData['username'] = storage.session.getUsername();\n if (storage.session.getPassword())\n existingData['encodedPassword'] = await dataProtection.encrypt(\n storage.session.getPassword()\n );\n if (storage.session.getLogApiKey())\n existingData['logApiKey'] = storage.session.getLogApiKey();\n if (storage.session.getLogApiSecret())\n existingData['logApiSecret'] = storage.session.getLogApiSecret();\n\n // advanced settings\n if (storage.session.getAuthenticationService()) {\n existingData['authenticationService'] =\n storage.session.getAuthenticationService();\n printMessage(\n 'Advanced setting: Authentication Service: ' +\n storage.session.getAuthenticationService(),\n 'info'\n );\n }\n if (storage.session.getAuthenticationHeaderOverrides()) {\n existingData['authenticationHeaderOverrides'] =\n storage.session.getAuthenticationHeaderOverrides();\n printMessage('Advanced setting: Authentication Header Overrides: ', 'info');\n printMessage(storage.session.getAuthenticationHeaderOverrides(), 'info');\n }\n\n connectionsData[storage.session.getTenant()] = existingData;\n\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile(host) {\n const filename = getConnectionProfilesPath();\n let connectionsData = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfile(connectionsData, host);\n if (profiles.length == 1) {\n printMessage(`Deleting connection profile ${profiles[0].tenant}`);\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n } else {\n if (profiles.length > 1) {\n printMessage(`Multiple matching profiles found.`, 'error');\n profiles.forEach((p) => {\n printMessage(`- ${p.tenant}`, 'error');\n });\n printMessage(`Please specify a unique sub-string`, 'error');\n return null;\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage(`Connection profile file ${filename} not found`);\n } else {\n printMessage(\n `Error in deleting connection profile: ${err.code}`,\n 'error'\n );\n }\n });\n}\n\nexport async function describeConnectionProfile(host, showSecrets) {\n const profile = await getConnectionProfileByHost(host);\n if (profile) {\n if (!showSecrets) {\n delete profile.password;\n delete profile.secret;\n }\n if (!profile.key) {\n delete profile.key;\n delete profile.secret;\n }\n const keyMap = {\n tenant: 'Host',\n username: 'Username',\n password: 'Password',\n key: 'Log API Key',\n secret: 'Log API Secret',\n authenticationService: 'Authentication Service',\n authenticationHeaderOverrides: 'Authentication Header Overrides',\n };\n const table = createObjectTable(profile, keyMap);\n printMessage(table.toString(), 'data');\n } else {\n printMessage(`No connection profile ${host} found`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAA8E;AAAA;AAAA;AAE9E,IAAMA,cAAc,GAAG,IAAIC,uBAAc,EAAE;AAE3C,IAAMC,WAAW,GAAG;EAClBC,WAAW,EAAE;AACf,CAAC;AAED,IAAMC,qBAAqB,GAAG,UAAU;AACxC,IAAMC,kBAAkB,GAAG,kBAAkB;AAC7C;AACA;AACA;AACA;AACO,SAASC,yBAAyB,GAAW;EAClD,OACEC,uBAAO,CAACC,OAAO,CAACF,yBAAyB,EAAE,IAC3CG,OAAO,CAACC,GAAG,CAACC,iDAAkC,CAAC,cAC5CC,WAAE,CAACC,OAAO,EAAE,qBAAWR,kBAAkB,CAAE;AAElD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,qBAAqB,CAACC,kBAAkB,EAAEC,IAAI,EAAE;EACvD,IAAMC,QAAQ,GAAG,EAAE;EACnB,KAAK,IAAMC,MAAM,IAAIH,kBAAkB,EAAE;IACvC,IAAIG,MAAM,CAACC,QAAQ,CAACH,IAAI,CAAC,EAAE;MACzB,IAAMI,YAAY,GAAGL,kBAAkB,CAACG,MAAM,CAAC;MAC/CE,YAAY,CAACF,MAAM,GAAGA,MAAM;MAC5BD,QAAQ,CAACI,IAAI,CAACD,YAAY,CAAC;IAC7B;EACF;EACA,OAAOH,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACO,SAASK,sBAAsB,GAAe;EAAA,IAAdC,IAAI,uEAAG,KAAK;EACjD,IAAMC,QAAQ,GAAGlB,yBAAyB,EAAE;EAC5C,IAAI;IACF,IAAMmB,IAAI,GAAGC,WAAE,CAACC,YAAY,CAACH,QAAQ,EAAE,MAAM,CAAC;IAC9C,IAAMI,eAAe,GAAGC,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC;IACxC,IAAIF,IAAI,EAAE;MACR,IAAMQ,KAAK,GAAG,I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