flex-dev-utils
Advanced tools
Comparing version 4.2.0-alpha.0 to 4.2.2-alpha.0
@@ -9,2 +9,6 @@ export interface AuthConfig { | ||
} | ||
interface KeytarCredential { | ||
account: string; | ||
password: string; | ||
} | ||
/** | ||
@@ -30,3 +34,3 @@ * Fetches the API Key/Secret and stores them in keychain. | ||
*/ | ||
export declare const _getService: () => Promise<Credential[]>; | ||
export declare const _getService: () => Promise<KeytarCredential[]>; | ||
/** | ||
@@ -33,0 +37,0 @@ * Saves the credential |
@@ -51,2 +51,3 @@ "use strict"; | ||
catch (e) { | ||
/* istanbul ignore next */ | ||
if (!process.env.CI) { | ||
@@ -147,3 +148,3 @@ index_1.logger.debug('Failed to require keytar', e); | ||
credentials = _a.sent(); | ||
promises = credentials.map(function (cred) { return exports._getKeytar().deletePassword(SERVICE_NAME, cred.username); }); | ||
promises = credentials.map(function (cred) { return exports._getKeytar().deletePassword(SERVICE_NAME, cred.account); }); | ||
return [4 /*yield*/, Promise.all(promises)]; | ||
@@ -163,17 +164,22 @@ case 2: | ||
exports._findCredential = function (accountSid) { return __awaiter(_this, void 0, void 0, function () { | ||
var credentials, match, accounts, selectedAccount; | ||
var convertCredential, credentials, match, accounts, selectedAccount; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, exports._getService()]; | ||
case 0: | ||
convertCredential = function (credential) { return ({ | ||
username: credential.account, | ||
password: credential.password, | ||
}); }; | ||
return [4 /*yield*/, exports._getService()]; | ||
case 1: | ||
credentials = _a.sent(); | ||
if (accountSid) { | ||
match = credentials.find(function (cred) { return cred.username === accountSid; }); | ||
match = credentials.find(function (cred) { return cred.account === accountSid; }); | ||
if (match) { | ||
return [2 /*return*/, match]; | ||
return [2 /*return*/, convertCredential(match)]; | ||
} | ||
} | ||
accounts = credentials | ||
.map(function (cred) { return cred.username; }) | ||
.filter(function (acc) { return acc.substr(0, 2).toLowerCase() === 'ac' && acc.length === 34; }); | ||
.map(function (cred) { return cred.account; }) | ||
.filter(function (acc) { return acc.length === 34 && (acc.substr(0, 2) === 'AC' || acc.substr(0, 2) === 'SK'); }); | ||
if (credentials.length === 0) { | ||
@@ -183,3 +189,3 @@ return [2 /*return*/, null]; | ||
if (credentials.length === 1) { | ||
return [2 /*return*/, credentials[0]]; | ||
return [2 /*return*/, convertCredential(credentials[0])]; | ||
} | ||
@@ -191,3 +197,3 @@ if (accounts.length === 0) { | ||
if (accounts.length === 1) { | ||
return [2 /*return*/, credentials.find(function (cred) { return cred.username === accounts[0]; })]; | ||
return [2 /*return*/, convertCredential(credentials.find(function (cred) { return cred.account === accounts[0]; }))]; | ||
} | ||
@@ -197,3 +203,3 @@ return [4 /*yield*/, inquirer_1.choose(chooseAccount, accounts)]; | ||
selectedAccount = _a.sent(); | ||
return [2 /*return*/, credentials.find(function (cred) { return cred.username === selectedAccount; })]; | ||
return [2 /*return*/, convertCredential(credentials.find(function (cred) { return cred.account === selectedAccount; }))]; | ||
} | ||
@@ -200,0 +206,0 @@ }); |
@@ -25,3 +25,5 @@ "use strict"; | ||
function FlexPluginError(msg) { | ||
var _this = _super.call(this, msg) || this; | ||
var _this = | ||
/* istanbul ignore next */ | ||
_super.call(this, msg) || this; | ||
_this.print = function () { | ||
@@ -28,0 +30,0 @@ logger_1.default.error(_this.message); |
@@ -20,3 +20,5 @@ "use strict"; | ||
function UserActionError(reason, message) { | ||
var _this = _super.call(this, message || reason) || this; | ||
var _this = | ||
/* istanbul ignore next */ | ||
_super.call(this, message || reason) || this; | ||
_this.reason = reason; | ||
@@ -23,0 +25,0 @@ Object.setPrototypeOf(_this, UserActionError.prototype); |
{ | ||
"name": "flex-dev-utils", | ||
"version": "4.2.0-alpha.0", | ||
"version": "4.2.2-alpha.0", | ||
"description": "Common development utility for creating a Flex plugin", | ||
@@ -43,5 +43,4 @@ "keywords": [ | ||
"execa": "^2.1.0", | ||
"flex-plugins-utils-exception": "^0.4.1", | ||
"flex-plugins-utils-logger": "^0.3.1", | ||
"globby": "^11.0.0", | ||
"flex-plugins-utils-exception": "^0.7.0", | ||
"flex-plugins-utils-logger": "^0.7.1", | ||
"inquirer": "7.0.0", | ||
@@ -75,3 +74,3 @@ "lodash": "^4.17.15", | ||
}, | ||
"gitHead": "cd221fc8c416b909cf87defbc6de66607786ffbe" | ||
"gitHead": "a2eed0746459d11b0b0e22ae18c594894ca0f6e1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118067
24
2175
923
1
+ Added@types/lodash@4.17.14(transitive)
+ Added@types/lodash.get@4.4.9(transitive)
+ Addedes-object-atoms@1.0.1(transitive)
+ Addedflex-plugins-utils-env@0.7.3(transitive)
+ Addedflex-plugins-utils-exception@0.7.0(transitive)
+ Addedflex-plugins-utils-logger@0.7.3(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedqs@6.13.1(transitive)
- Removedglobby@^11.0.0
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedbraces@3.0.3(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedfast-glob@3.3.3(transitive)
- Removedfastq@1.18.0(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedflex-plugins-utils-exception@0.4.1(transitive)
- Removedflex-plugins-utils-logger@0.3.1(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobby@11.1.0(transitive)
- Removedignore@5.3.2(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedqs@6.14.0(transitive)
- Removedreusify@1.0.4(transitive)
- Removedslash@3.0.0(transitive)
- Removedto-regex-range@5.0.1(transitive)