@sudoplatform/sudo-user 9.1.1 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
39
39
 
40
40
  class DefaultSudoUserClient {
41
41
  constructor(options) {
42
- var _options$logger, _options$config, _options$authenticati, _options$identityProv, _this$config, _options$apiClient;
42
+ var _this$config;
43
43
 
44
44
  _defineProperty(this, "config", void 0);
45
45
 
@@ -59,9 +59,9 @@ class DefaultSudoUserClient {
59
59
 
60
60
  _defineProperty(this, "launchUriFn", void 0);
61
61
 
62
- this.logger = (_options$logger = options === null || options === void 0 ? void 0 : options.logger) !== null && _options$logger !== void 0 ? _options$logger : new _sudoCommon.DefaultLogger('SudoUser', 'warn');
63
- this.config = (_options$config = options === null || options === void 0 ? void 0 : options.config) !== null && _options$config !== void 0 ? _options$config : (0, _sdkConfig.getIdentityServiceConfig)();
64
- this.authenticationStore = (_options$authenticati = options === null || options === void 0 ? void 0 : options.authenticationStore) !== null && _options$authenticati !== void 0 ? _options$authenticati : new _authStore.AuthenticationStore();
62
+ this.logger = (options === null || options === void 0 ? void 0 : options.logger) ?? new _sudoCommon.DefaultLogger('SudoUser', 'warn');
63
+ this.config = (options === null || options === void 0 ? void 0 : options.config) ?? (0, _sdkConfig.getIdentityServiceConfig)();
64
+ this.authenticationStore = (options === null || options === void 0 ? void 0 : options.authenticationStore) ?? new _authStore.AuthenticationStore();
65
65
 
66
66
  if (options !== null && options !== void 0 && options.sudoKeyManager) {
67
67
  this.sudoUserKeyManager = options === null || options === void 0 ? void 0 : options.sudoKeyManager;
@@ -72,16 +72,14 @@ class DefaultSudoUserClient {
72
72
 
73
73
  this.keyManager = new _keyManager.KeyManager(this.sudoUserKeyManager);
74
74
  this.launchUriFn = options === null || options === void 0 ? void 0 : options.launchUriFn;
75
- this.identityProvider = (_options$identityProv = options === null || options === void 0 ? void 0 : options.identityProvider) !== null && _options$identityProv !== void 0 ? _options$identityProv : new _identityProvider.CognitoUserPoolIdentityProvider(this.keyManager, this.config, this.logger);
75
+ this.identityProvider = (options === null || options === void 0 ? void 0 : options.identityProvider) ?? new _identityProvider.CognitoUserPoolIdentityProvider(this.keyManager, this.config, this.logger);
76
76
  const federatedSignInConfig = (_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.federatedSignIn;
77
77
 
78
78
  if (federatedSignInConfig) {
79
- var _options$authUI;
80
-
81
- this.authUI = (_options$authUI = options === null || options === void 0 ? void 0 : options.authUI) !== null && _options$authUI !== void 0 ? _options$authUI : new _auth.CognitoAuthUI(this.authenticationStore, federatedSignInConfig, this.keyManager, this.logger, this.launchUriFn);
79
+ this.authUI = (options === null || options === void 0 ? void 0 : options.authUI) ?? new _auth.CognitoAuthUI(this.authenticationStore, federatedSignInConfig, this.keyManager, this.logger, this.launchUriFn);
82
80
  }
83
81
 
84
- this.apiClient = (_options$apiClient = options === null || options === void 0 ? void 0 : options.apiClient) !== null && _options$apiClient !== void 0 ? _options$apiClient : new _apiClient.ApiClient(this.config.identityService.region, this.config.identityService.apiUrl, this, this.logger);
82
+ this.apiClient = (options === null || options === void 0 ? void 0 : options.apiClient) ?? new _apiClient.ApiClient(this.config.identityService.region, this.config.identityService.apiUrl, this, this.logger);
85
83
  }
86
84
 
87
85
  get sudoKeyManager() {
@@ -243,6 +241,26 @@ class DefaultSudoUserClient {
243
241
  }
244
242
  }
245
243
 
244
+ async signOut() {
245
+ let refreshToken;
246
+
247
+ try {
248
+ refreshToken = await this.getRefreshToken();
249
+ } catch (err) {
250
+ if (err instanceof _sudoCommon.KeyNotFoundError) {
251
+ throw new _sudoCommon.NotSignedInError();
252
+ } else {
253
+ throw err;
254
+ }
255
+ }
256
+
257
+ if (refreshToken) {
258
+ await this.identityProvider.signOut(refreshToken);
259
+ } else {
260
+ throw new _sudoCommon.NotSignedInError();
261
+ }
262
+ }
263
+
246
264
  async globalSignOut() {
247
265
  if (!(await this.isSignedIn())) {
248
266
  throw new _sudoCommon.NotSignedInError();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudoplatform/sudo-user",
3
- "version": "9.1.1",
3
+ "version": "10.1.0",
4
4
  "author": "Anonyome Labs, Inc.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,34 +32,37 @@
32
32
  "./lib/runtimes/node/node-crypto.js": "./lib/runtimes/browser/browser-crypto.js"
33
33
  },
34
34
  "dependencies": {
35
- "@aws-sdk/client-cognito-identity-provider": "^3.37.0",
36
- "@graphql-typed-document-node/core": "^3.1.0",
37
- "@sudoplatform/sudo-web-crypto-provider": "^2.1.0",
35
+ "@aws-sdk/client-cognito-identity-provider": "^3.80.0",
36
+ "@graphql-typed-document-node/core": "^3.1.1",
37
+ "@sudoplatform/sudo-web-crypto-provider": "^3.1.0",
38
38
  "amazon-cognito-auth-js": "^1.3.3",
39
39
  "apollo-cache-inmemory": "^1.6.6",
40
- "asn1js": "^2.1.1",
41
- "aws-appsync": "4.0.3",
42
- "fp-ts": "^2.11.5",
40
+ "asn1js": "^2.4.0",
41
+ "aws-appsync": "4.1.5",
42
+ "fp-ts": "^2.12.1",
43
43
  "graphql": "^15.6.1",
44
- "io-ts": "^2.2.11",
45
- "jsonwebtoken": "^8.5.0",
46
- "lodash": "^4.17.20",
47
- "monocle-ts": "^2.3.11",
48
- "newtype-ts": "^0.3.2",
49
- "tslib": "^2.3.1",
50
- "uuid": "^8.3.1"
44
+ "io-ts": "^2.2.16",
45
+ "jsonwebtoken": "^8.5.1",
46
+ "lodash": "^4.17.21",
47
+ "monocle-ts": "^2.3.13",
48
+ "newtype-ts": "^0.3.5",
49
+ "tslib": "^2.4.0",
50
+ "uuid": "^8.3.2"
51
51
  },
52
52
  "resolutions": {
53
53
  "apollo-cache-inmemory": "^1.6.6",
54
- "@graphql-codegen/**/ansi-regex": "^5.0.1"
54
+ "@graphql-codegen/**/ansi-regex": "^5.0.1",
55
+ "cross-fetch": "^3.1.5",
56
+ "node-fetch": "^2.6.7",
57
+ "minimist": "^1.2.6"
55
58
  },
56
59
  "devDependencies": {
57
- "@babel/cli": "^7.15.7",
58
- "@babel/core": "^7.15.8",
59
- "@babel/plugin-proposal-class-properties": "^7.14.5",
60
- "@babel/plugin-proposal-private-methods": "^7.14.5",
61
- "@babel/preset-env": "^7.15.8",
62
- "@babel/preset-typescript": "^7.15.0",
60
+ "@babel/cli": "^7.16.0",
61
+ "@babel/core": "^7.16.0",
62
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
63
+ "@babel/plugin-proposal-private-methods": "^7.16.0",
64
+ "@babel/preset-env": "^7.16.0",
65
+ "@babel/preset-typescript": "^7.16.0",
63
66
  "@graphql-codegen/add": "^3.1.0",
64
67
  "@graphql-codegen/cli": "^2.2.1",
65
68
  "@graphql-codegen/plugin-helpers": "^2.2.0",
@@ -67,33 +70,34 @@
67
70
  "@graphql-codegen/typescript": "^2.2.4",
68
71
  "@graphql-codegen/typescript-operations": "^2.1.8",
69
72
  "@graphql-typed-document-node/apollo-client-2": "^1.0.0",
70
- "@sudoplatform/sudo-common": "^5.10.1",
73
+ "@sudoplatform/sudo-common": "^6.2.0",
71
74
  "@types/amazon-cognito-auth-js": "^1.3.0",
72
- "@types/jest": "^27.0.2",
73
- "@types/jsonwebtoken": "^8.5.5",
74
- "@types/lodash": "^4.14.176",
75
+ "@types/firefox-webext-browser": "^82.0.1",
76
+ "@types/jest": "^27.4.1",
77
+ "@types/jsonwebtoken": "^8.5.8",
78
+ "@types/lodash": "^4.14.182",
75
79
  "@types/node": "^14.17.27",
76
- "@types/uuid": "^8.3.1",
77
- "@typescript-eslint/eslint-plugin": "^5.1.0",
78
- "@typescript-eslint/parser": "^5.1.0",
80
+ "@types/uuid": "^8.3.4",
81
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
82
+ "@typescript-eslint/parser": "^5.21.0",
79
83
  "apollo-client": "^2.6.10",
80
- "eslint": "^8.0.1",
81
- "eslint-config-prettier": "^8.3.0",
82
- "eslint-plugin-import": "^2.25.2",
84
+ "eslint": "^8.14.0",
85
+ "eslint-config-prettier": "^8.5.0",
86
+ "eslint-plugin-import": "^2.26.0",
83
87
  "eslint-plugin-prettier": "^4.0.0",
84
88
  "isomorphic-fetch": "^3.0.0",
85
89
  "isomorphic-webcrypto": "^2.3.8",
86
90
  "jest": "27.3.1",
87
- "prettier": "^2.4.1",
91
+ "prettier": "^2.6.2",
88
92
  "react": "16.13.1",
89
- "subscriptions-transport-ws": "^0.9.19",
93
+ "subscriptions-transport-ws": "^0.11.0",
90
94
  "ts-mockito": "^2.6.1",
91
- "typedoc": "^0.22.6",
92
- "typescript": "^4.4.4",
95
+ "typedoc": "^0.22.15",
96
+ "typescript": "^4.6.4",
93
97
  "websocket": "^1.0.34"
94
98
  },
95
99
  "peerDependencies": {
96
- "@sudoplatform/sudo-common": "^5.7.0",
100
+ "@sudoplatform/sudo-common": "^6.0.0",
97
101
  "io-ts": "^2.2.11"
98
102
  }
99
103
  }