contensis-cli 1.0.0-beta.15 → 1.0.0-beta.17
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.
|
@@ -47,7 +47,10 @@ class CredentialProvider {
|
|
|
47
47
|
import_keytar.default.findCredentials(this.serviceId)
|
|
48
48
|
);
|
|
49
49
|
if (err && this.passwordFallback) {
|
|
50
|
-
this.current = {
|
|
50
|
+
this.current = {
|
|
51
|
+
account: this.userId,
|
|
52
|
+
password: this.passwordFallback
|
|
53
|
+
};
|
|
51
54
|
}
|
|
52
55
|
if (!err) {
|
|
53
56
|
this.remarks = { secure: true };
|
|
@@ -57,6 +60,10 @@ class CredentialProvider {
|
|
|
57
60
|
return ((_a = u == null ? void 0 : u.account) == null ? void 0 : _a.toLowerCase()) === this.userId.toLowerCase();
|
|
58
61
|
}
|
|
59
62
|
)) || null;
|
|
63
|
+
if (!this.current && this.passwordFallback) {
|
|
64
|
+
await this.Save(this.passwordFallback);
|
|
65
|
+
return await this.Init();
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
return [err, this];
|
|
62
69
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/providers/CredentialProvider.ts"],
|
|
4
|
-
"sourcesContent": ["import keytar from 'keytar';\nimport to from 'await-to-js';\nimport { Logger } from '~/util/logger';\n\nconst SERVICE_NAME = 'contensis-cli';\n\ninterface Remarks {\n secure: boolean;\n}\n\nclass CredentialProvider {\n private serviceId: string;\n private userId: string = '';\n private passwordFallback?: string;\n\n current: {\n account: string;\n password: string;\n } | null = null;\n remarks: Remarks = { secure: false };\n\n constructor(\n { userId, alias }: { userId: string; alias?: string },\n passwordFallback?: string\n ) {\n this.serviceId =\n typeof alias !== 'undefined' ? `${SERVICE_NAME}_${alias}` : SERVICE_NAME;\n this.userId = userId;\n this.passwordFallback = passwordFallback;\n }\n\n Init = async (): Promise<[Error, CredentialProvider]> => {\n const [err, stored] = (await to(\n keytar.findCredentials(this.serviceId)\n )) as [\n Error,\n {\n account: string;\n password: string;\n }[]\n ];\n if (err && this.passwordFallback) {\n this.current = {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,yBAAe;AACf,oBAAuB;AAEvB,MAAM,eAAe;AAMrB,MAAM,mBAAmB;AAAA,EACf;AAAA,EACA,SAAiB;AAAA,EACjB;AAAA,EAER,UAGW;AAAA,EACX,UAAmB,EAAE,QAAQ,MAAM;AAAA,EAEnC,YACE,EAAE,QAAQ,MAAM,GAChB,kBACA;AACA,SAAK,YACH,OAAO,UAAU,cAAc,GAAG,gBAAgB,UAAU;AAC9D,SAAK,SAAS;AACd,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,OAAO,YAAkD;AACvD,UAAM,CAAC,KAAK,MAAM,IAAK,UAAM,mBAAAA;AAAA,MAC3B,cAAAC,QAAO,gBAAgB,KAAK,SAAS;AAAA,IACvC;AAOA,QAAI,OAAO,KAAK,kBAAkB;AAChC,WAAK,UAAU,
|
|
4
|
+
"sourcesContent": ["import keytar from 'keytar';\nimport to from 'await-to-js';\nimport { Logger } from '~/util/logger';\n\nconst SERVICE_NAME = 'contensis-cli';\n\ninterface Remarks {\n secure: boolean;\n}\n\nclass CredentialProvider {\n private serviceId: string;\n private userId: string = '';\n private passwordFallback?: string;\n\n current: {\n account: string;\n password: string;\n } | null = null;\n remarks: Remarks = { secure: false };\n\n constructor(\n { userId, alias }: { userId: string; alias?: string },\n passwordFallback?: string\n ) {\n this.serviceId =\n typeof alias !== 'undefined' ? `${SERVICE_NAME}_${alias}` : SERVICE_NAME;\n this.userId = userId;\n this.passwordFallback = passwordFallback;\n }\n\n Init = async (): Promise<[Error, CredentialProvider]> => {\n const [err, stored] = (await to(\n keytar.findCredentials(this.serviceId)\n )) as [\n Error,\n {\n account: string;\n password: string;\n }[]\n ];\n if (err && this.passwordFallback) {\n this.current = {\n account: this.userId,\n password: this.passwordFallback,\n };\n }\n if (!err) {\n this.remarks = { secure: true };\n this.current =\n stored?.find(\n u => u?.account?.toLowerCase() === this.userId.toLowerCase()\n ) || null;\n\n if (!this.current && this.passwordFallback) {\n await this.Save(this.passwordFallback);\n return await this.Init();\n }\n }\n return [err, this];\n };\n\n Save = async (password: string) => {\n const [err] = await to(\n keytar.setPassword(this.serviceId, this.userId, password)\n );\n\n // if (!err) Logger.info(`${this.serviceId} - credentials saved`);\n return err && !this.passwordFallback ? err : true;\n };\n\n Delete = async () => {\n if (this.passwordFallback) {\n this.passwordFallback = undefined;\n return true;\n } else {\n const [err] = await to(\n keytar.deletePassword(this.serviceId, this.userId)\n );\n\n Logger.warning(`${this.serviceId} - invalid credentials removed`);\n return err || true;\n }\n };\n\n // GetPassword = async () => {\n // const [err, password] = await to(\n // keytar.getPassword(this.serviceId, this.userId)\n // );\n\n // return err || password;\n // };\n}\n\nexport default CredentialProvider;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,yBAAe;AACf,oBAAuB;AAEvB,MAAM,eAAe;AAMrB,MAAM,mBAAmB;AAAA,EACf;AAAA,EACA,SAAiB;AAAA,EACjB;AAAA,EAER,UAGW;AAAA,EACX,UAAmB,EAAE,QAAQ,MAAM;AAAA,EAEnC,YACE,EAAE,QAAQ,MAAM,GAChB,kBACA;AACA,SAAK,YACH,OAAO,UAAU,cAAc,GAAG,gBAAgB,UAAU;AAC9D,SAAK,SAAS;AACd,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,OAAO,YAAkD;AACvD,UAAM,CAAC,KAAK,MAAM,IAAK,UAAM,mBAAAA;AAAA,MAC3B,cAAAC,QAAO,gBAAgB,KAAK,SAAS;AAAA,IACvC;AAOA,QAAI,OAAO,KAAK,kBAAkB;AAChC,WAAK,UAAU;AAAA,QACb,SAAS,KAAK;AAAA,QACd,UAAU,KAAK;AAAA,MACjB;AAAA,IACF;AACA,QAAI,CAAC,KAAK;AACR,WAAK,UAAU,EAAE,QAAQ,KAAK;AAC9B,WAAK,WACH,iCAAQ;AAAA,QACN,OAAE;AAnDZ;AAmDe,+CAAG,YAAH,mBAAY,mBAAkB,KAAK,OAAO,YAAY;AAAA;AAAA,YACxD;AAEP,UAAI,CAAC,KAAK,WAAW,KAAK,kBAAkB;AAC1C,cAAM,KAAK,KAAK,KAAK,gBAAgB;AACrC,eAAO,MAAM,KAAK,KAAK;AAAA,MACzB;AAAA,IACF;AACA,WAAO,CAAC,KAAK,IAAI;AAAA,EACnB;AAAA,EAEA,OAAO,OAAO,aAAqB;AACjC,UAAM,CAAC,GAAG,IAAI,UAAM,mBAAAD;AAAA,MAClB,cAAAC,QAAO,YAAY,KAAK,WAAW,KAAK,QAAQ,QAAQ;AAAA,IAC1D;AAGA,WAAO,OAAO,CAAC,KAAK,mBAAmB,MAAM;AAAA,EAC/C;AAAA,EAEA,SAAS,YAAY;AACnB,QAAI,KAAK,kBAAkB;AACzB,WAAK,mBAAmB;AACxB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,CAAC,GAAG,IAAI,UAAM,mBAAAD;AAAA,QAClB,cAAAC,QAAO,eAAe,KAAK,WAAW,KAAK,MAAM;AAAA,MACnD;AAEA,2BAAO,QAAQ,GAAG,KAAK,yCAAyC;AAChE,aAAO,OAAO;AAAA,IAChB;AAAA,EACF;AASF;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["to", "keytar"]
|
|
7
7
|
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.17";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.17\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.17",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
5
|
"repository": "https://github.com/contensis/node-cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -40,8 +40,10 @@ class CredentialProvider {
|
|
|
40
40
|
}[]
|
|
41
41
|
];
|
|
42
42
|
if (err && this.passwordFallback) {
|
|
43
|
-
this.current = {
|
|
44
|
-
|
|
43
|
+
this.current = {
|
|
44
|
+
account: this.userId,
|
|
45
|
+
password: this.passwordFallback,
|
|
46
|
+
};
|
|
45
47
|
}
|
|
46
48
|
if (!err) {
|
|
47
49
|
this.remarks = { secure: true };
|
|
@@ -49,6 +51,11 @@ class CredentialProvider {
|
|
|
49
51
|
stored?.find(
|
|
50
52
|
u => u?.account?.toLowerCase() === this.userId.toLowerCase()
|
|
51
53
|
) || null;
|
|
54
|
+
|
|
55
|
+
if (!this.current && this.passwordFallback) {
|
|
56
|
+
await this.Save(this.passwordFallback);
|
|
57
|
+
return await this.Init();
|
|
58
|
+
}
|
|
52
59
|
}
|
|
53
60
|
return [err, this];
|
|
54
61
|
};
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.17";
|