@sudoplatform/sudo-user 15.1.4 → 16.0.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/cjs/client/amplifyClient.js +226 -0
- package/cjs/client/amplifyClient.js.map +1 -0
- package/cjs/client/apiClient.js +50 -59
- package/cjs/client/apiClient.js.map +1 -1
- package/cjs/client/graphqlClient.js +10 -0
- package/cjs/client/graphqlClient.js.map +1 -0
- package/cjs/client/transformer/ErrorTransformer.js +1 -2
- package/cjs/client/transformer/ErrorTransformer.js.map +1 -1
- package/cjs/core/sdk-config.js +2 -2
- package/cjs/core/sdk-config.js.map +1 -1
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/sdk.js +3 -0
- package/cjs/sdk.js.map +1 -1
- package/cjs/utils/parse-token.js +1 -2
- package/cjs/utils/parse-token.js.map +1 -1
- package/cjs/utils/resolvable-promise.js +1 -2
- package/cjs/utils/resolvable-promise.js.map +1 -1
- package/cjs/utils/sign-options-builder.js +1 -2
- package/cjs/utils/sign-options-builder.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +56 -0
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +251 -228
- package/docs/classes/AlreadyRegisteredError.html +33 -12
- package/docs/classes/DefaultSudoUserClient.html +75 -75
- package/docs/classes/IdentityServiceConfigNotFoundError.html +33 -12
- package/docs/classes/LocalAuthenticationProvider.html +12 -12
- package/docs/classes/TESTAuthenticationProvider.html +13 -13
- package/docs/classes/internal.AmplifyClient.html +21 -0
- package/docs/enums/GraphQLClientAuthMode.html +4 -0
- package/docs/functions/internal.getIdentityServiceConfig.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +5 -5
- package/docs/interfaces/AuthenticationProvider.html +5 -5
- package/docs/interfaces/AuthenticationTokens.html +10 -10
- package/docs/interfaces/GraphQLClient.html +20 -0
- package/docs/interfaces/GraphQLClientOptions.html +13 -0
- package/docs/interfaces/SudoUserClient.html +66 -66
- package/docs/interfaces/internal.SudoUserOptions.html +9 -9
- package/docs/modules/internal.html +1 -1
- package/docs/modules.html +1 -1
- package/docs/types/IAMCredentials.html +4 -0
- package/docs/types/TokenProvider.html +1 -0
- package/docs/types/internal.Config.html +1 -1
- package/docs/types/internal.FederatedSignInConfig.html +1 -1
- package/docs/types/internal.IdentityServiceConfig.html +1 -1
- package/docs/variables/internal.Config.html +1 -0
- package/docs/variables/internal.FederatedSignInConfigCodec.html +1 -1
- package/docs/variables/internal.IdentityServiceConfigCodec.html +1 -1
- package/lib/client/amplifyClient.js +222 -0
- package/lib/client/amplifyClient.js.map +1 -0
- package/lib/client/apiClient.js +50 -59
- package/lib/client/apiClient.js.map +1 -1
- package/lib/client/graphqlClient.js +7 -0
- package/lib/client/graphqlClient.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/sdk.js +1 -0
- package/lib/sdk.js.map +1 -1
- package/package.json +54 -37
- package/types/client/amplifyClient.d.ts +60 -0
- package/types/client/graphqlClient.d.ts +84 -0
- package/types/gen/graphql-types.d.ts +4 -12
- package/types/index.d.ts +1 -0
- package/types/sdk.d.ts +1 -0
- package/docs/variables/internal.Config-1.html +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmplifyClient = void 0;
|
|
4
|
+
const core_1 = require("@aws-amplify/core");
|
|
5
|
+
// Ideally we would import from 'aws-amplify' but that prevents us from a
|
|
6
|
+
// multi-client solution because it uses a singleton amplify instance.
|
|
7
|
+
const internals_1 = require("@aws-amplify/api-graphql/internals");
|
|
8
|
+
const graphqlClient_1 = require("./graphqlClient");
|
|
9
|
+
var GraphQLAuthMode;
|
|
10
|
+
(function (GraphQLAuthMode) {
|
|
11
|
+
GraphQLAuthMode["OpenIDConnect"] = "oidc";
|
|
12
|
+
GraphQLAuthMode["IAM"] = "iam";
|
|
13
|
+
GraphQLAuthMode["ApiKey"] = "apiKey";
|
|
14
|
+
})(GraphQLAuthMode || (GraphQLAuthMode = {}));
|
|
15
|
+
/**
|
|
16
|
+
* We provide a default IAMCredentialsProvider which accesses
|
|
17
|
+
* the required environment variables for the IAM auth mode, if the values are not provided
|
|
18
|
+
*/
|
|
19
|
+
class IAMCredentialsProvider {
|
|
20
|
+
constructor(credentials) {
|
|
21
|
+
this.credentials = undefined;
|
|
22
|
+
if (credentials) {
|
|
23
|
+
this.credentials = { credentials, identityId: '' };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
clearCredentialsAndIdentityId() { }
|
|
27
|
+
getCredentialsAndIdentityId(
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
+
_) {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
if (!this.credentials) {
|
|
32
|
+
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
|
33
|
+
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
|
34
|
+
if (!accessKeyId || !secretAccessKey) {
|
|
35
|
+
throw new Error('AWS IAM credentials are not set');
|
|
36
|
+
}
|
|
37
|
+
this.credentials = {
|
|
38
|
+
credentials: {
|
|
39
|
+
accessKeyId: accessKeyId,
|
|
40
|
+
secretAccessKey: secretAccessKey,
|
|
41
|
+
sessionToken: process.env.AWS_SESSION_TOKEN,
|
|
42
|
+
},
|
|
43
|
+
identityId: '', // Amplify expects this but it's empty for IAM
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return resolve(this.credentials);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Convenience wrapper for GraphQL API using Amplify SDK.
|
|
52
|
+
*/
|
|
53
|
+
class AmplifyClient {
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.options = options;
|
|
56
|
+
this.amplify = new core_1.AmplifyClassV6();
|
|
57
|
+
this.configure(options);
|
|
58
|
+
// @ts-expect-error complex typings not manageable by tsc
|
|
59
|
+
this.client = (0, internals_1.generateClient)({
|
|
60
|
+
amplify: this.amplify,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
configure(options) {
|
|
64
|
+
const authModeToUse = options.authMode ?? graphqlClient_1.GraphQLClientAuthMode.OpenIDConnect;
|
|
65
|
+
switch (authModeToUse) {
|
|
66
|
+
case graphqlClient_1.GraphQLClientAuthMode.OpenIDConnect:
|
|
67
|
+
if (!options.tokenProvider) {
|
|
68
|
+
throw new Error('tokenProvider must be provided when using OPENID_CONNECT authentication mode');
|
|
69
|
+
}
|
|
70
|
+
// In order to use a Cognito user pool issued ID token for
|
|
71
|
+
// authentication, we have to pretend that we are using
|
|
72
|
+
// a custom Lambda authentication provider. Otherwise,
|
|
73
|
+
// Amplify SDK attempts to sign into Cognito user pool
|
|
74
|
+
// or perform FSSO to OIDC provider. We have tried to use
|
|
75
|
+
// a generic GraphQL endpoint with OIDC authentication type
|
|
76
|
+
// but that breaks subscriptions as AppSync's subscription
|
|
77
|
+
// implementation is proprietary.
|
|
78
|
+
this.amplify.configure({
|
|
79
|
+
API: {
|
|
80
|
+
GraphQL: {
|
|
81
|
+
region: options.region,
|
|
82
|
+
endpoint: options.graphqlUrl,
|
|
83
|
+
defaultAuthMode: 'lambda',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
break;
|
|
88
|
+
case graphqlClient_1.GraphQLClientAuthMode.ApiKey:
|
|
89
|
+
if (!options.apiKey) {
|
|
90
|
+
throw new Error('apiKey must be provided when using API_KEY authentication mode');
|
|
91
|
+
}
|
|
92
|
+
this.amplify.configure({
|
|
93
|
+
API: {
|
|
94
|
+
GraphQL: {
|
|
95
|
+
region: options.region,
|
|
96
|
+
endpoint: options.graphqlUrl,
|
|
97
|
+
defaultAuthMode: this.transformAuthMode(authModeToUse),
|
|
98
|
+
apiKey: options.apiKey,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
break;
|
|
103
|
+
case graphqlClient_1.GraphQLClientAuthMode.IAM:
|
|
104
|
+
this.amplify.configure({
|
|
105
|
+
API: {
|
|
106
|
+
GraphQL: {
|
|
107
|
+
region: options.region,
|
|
108
|
+
endpoint: options.graphqlUrl,
|
|
109
|
+
defaultAuthMode: this.transformAuthMode(authModeToUse),
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
}, {
|
|
113
|
+
Auth: {
|
|
114
|
+
credentialsProvider: new IAMCredentialsProvider(options.credentials),
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Performs GraphQL query operation.
|
|
122
|
+
*
|
|
123
|
+
* @param options query document, query variables and authentication
|
|
124
|
+
* token (optional). If authentication token is provided then the
|
|
125
|
+
* token provided via the constructor will be ignored.
|
|
126
|
+
* @returns query result.
|
|
127
|
+
*/
|
|
128
|
+
async query(options) {
|
|
129
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
130
|
+
try {
|
|
131
|
+
return (await this.client.graphql({
|
|
132
|
+
query: options.query,
|
|
133
|
+
variables: options.variables,
|
|
134
|
+
...authOptions,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
throw err.errors?.pop() ?? err;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Performs GraphQL mutation operation.
|
|
143
|
+
*
|
|
144
|
+
* @param options mutation document, mutation variables and authentication
|
|
145
|
+
* token (optional). If authentication token is provided then the
|
|
146
|
+
* token provided via the constructor will be ignored.
|
|
147
|
+
* @returns mutation result.
|
|
148
|
+
*/
|
|
149
|
+
async mutate(options) {
|
|
150
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
151
|
+
try {
|
|
152
|
+
return (await this.client.graphql({
|
|
153
|
+
query: options.mutation,
|
|
154
|
+
variables: options.variables,
|
|
155
|
+
...authOptions,
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
throw err.errors?.pop() ?? err;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Performs GraphQL subscription operation.
|
|
164
|
+
*
|
|
165
|
+
* @param options subscription document, subscription variables and
|
|
166
|
+
* authentication token (optional). If authentication token is provided
|
|
167
|
+
* then the token provided via the constructor will be ignored.
|
|
168
|
+
* @returns observable for receiving subscription notifications.
|
|
169
|
+
*/
|
|
170
|
+
async subscribe(options) {
|
|
171
|
+
if (this.options.authMode === graphqlClient_1.GraphQLClientAuthMode.IAM) {
|
|
172
|
+
throw new Error('Subscriptions are not supported with IAM authentication mode');
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
176
|
+
const result = this.client.graphql({
|
|
177
|
+
query: options.subscription,
|
|
178
|
+
variables: options.variables,
|
|
179
|
+
...authOptions,
|
|
180
|
+
});
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
throw err.errors?.pop() ?? err;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Resolves a TokenProvider into its actual token value.
|
|
189
|
+
* Handles both string tokens and async/sync function providers.
|
|
190
|
+
*/
|
|
191
|
+
async resolveToken(tokenProvider) {
|
|
192
|
+
if (typeof tokenProvider === 'string') {
|
|
193
|
+
return tokenProvider;
|
|
194
|
+
}
|
|
195
|
+
// tokenProvider is a function, call it and await the result
|
|
196
|
+
return tokenProvider();
|
|
197
|
+
}
|
|
198
|
+
transformAuthMode(input) {
|
|
199
|
+
switch (input) {
|
|
200
|
+
case graphqlClient_1.GraphQLClientAuthMode.OpenIDConnect:
|
|
201
|
+
return GraphQLAuthMode.OpenIDConnect;
|
|
202
|
+
case graphqlClient_1.GraphQLClientAuthMode.IAM:
|
|
203
|
+
return GraphQLAuthMode.IAM;
|
|
204
|
+
case graphqlClient_1.GraphQLClientAuthMode.ApiKey:
|
|
205
|
+
return GraphQLAuthMode.ApiKey;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async resolveAuthOptions(token) {
|
|
209
|
+
if (this.options.tokenProvider &&
|
|
210
|
+
(this.options.authMode ??
|
|
211
|
+
graphqlClient_1.GraphQLClientAuthMode.OpenIDConnect ===
|
|
212
|
+
graphqlClient_1.GraphQLClientAuthMode.OpenIDConnect)) {
|
|
213
|
+
return {
|
|
214
|
+
authToken: token ?? (await this.resolveToken(this.options.tokenProvider)),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (this.options.authMode == graphqlClient_1.GraphQLClientAuthMode.ApiKey && token) {
|
|
218
|
+
return {
|
|
219
|
+
apiKey: token,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.AmplifyClient = AmplifyClient;
|
|
226
|
+
//# sourceMappingURL=amplifyClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplifyClient.js","sourceRoot":"","sources":["../../src/client/amplifyClient.ts"],"names":[],"mappings":";;;AACA,4CAK0B;AAC1B,yEAAyE;AACzE,sEAAsE;AACtE,kEAAmE;AAGnE,mDAMwB;AAExB,IAAK,eAIJ;AAJD,WAAK,eAAe;IAClB,yCAAsB,CAAA;IACtB,8BAAW,CAAA;IACX,oCAAiB,CAAA;AACnB,CAAC,EAJI,eAAe,KAAf,eAAe,QAInB;AACD;;;GAGG;AACH,MAAM,sBAAsB;IAE1B,YAAY,WAA4B;QADhC,gBAAW,GAAyC,SAAS,CAAA;QAEnE,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,WAAW,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE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AC,OAAO,CAAC,aAAa,CAAC,CAAC;aACjE,CAAA;QACH,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,qCAAqB,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;YACnE,OAAO;gBACL,MAAM,EAAE,KAAK;aACd,CAAA;QACH,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAnND,sCAmNC"}
|
package/cjs/client/apiClient.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.ApiClient = void 0;
|
|
9
|
-
const aws_appsync_1 = require("aws-appsync");
|
|
10
9
|
const graphql_types_1 = require("../gen/graphql-types");
|
|
11
10
|
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
12
11
|
const ErrorTransformer_1 = require("./transformer/ErrorTransformer");
|
|
12
|
+
const amplifyClient_1 = require("./amplifyClient");
|
|
13
13
|
/**
|
|
14
14
|
* AppSync wrapper to use to invoke Identity Service APIs.
|
|
15
15
|
*/
|
|
@@ -19,14 +19,10 @@ class ApiClient {
|
|
|
19
19
|
this.graphqlUrl = graphqlUrl;
|
|
20
20
|
this.sudoUserClient = sudoUserClient;
|
|
21
21
|
this.logger = logger;
|
|
22
|
-
this.client = new
|
|
23
|
-
|
|
22
|
+
this.client = new amplifyClient_1.AmplifyClient({
|
|
23
|
+
graphqlUrl,
|
|
24
24
|
region: region,
|
|
25
|
-
|
|
26
|
-
type: aws_appsync_1.AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
|
|
27
|
-
jwtToken: async () => await sudoUserClient.getLatestAuthToken(),
|
|
28
|
-
},
|
|
29
|
-
disableOffline: true,
|
|
25
|
+
tokenProvider: async () => await sudoUserClient.getLatestAuthToken(),
|
|
30
26
|
});
|
|
31
27
|
}
|
|
32
28
|
async resetUserData() {
|
|
@@ -37,25 +33,25 @@ class ApiClient {
|
|
|
37
33
|
try {
|
|
38
34
|
result = await this.client.mutate({
|
|
39
35
|
mutation: graphql_types_1.ResetDocument,
|
|
40
|
-
fetchPolicy: 'no-cache',
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
38
|
catch (err) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
if ('graphQLErrors' in err) {
|
|
40
|
+
const error = err.graphQLErrors?.[0];
|
|
41
|
+
if (error) {
|
|
42
|
+
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
46
|
+
}
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
|
-
const error = result
|
|
49
|
+
const error = result?.errors?.[0];
|
|
54
50
|
if (error) {
|
|
55
51
|
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
56
52
|
}
|
|
57
|
-
if (result
|
|
58
|
-
return { success: result.data.reset?.success
|
|
53
|
+
if (result?.data) {
|
|
54
|
+
return { success: !!result.data.reset?.success };
|
|
59
55
|
}
|
|
60
56
|
else {
|
|
61
57
|
throw new sudo_common_1.FatalError('reset did not return any result.');
|
|
@@ -69,25 +65,25 @@ class ApiClient {
|
|
|
69
65
|
try {
|
|
70
66
|
result = await this.client.mutate({
|
|
71
67
|
mutation: graphql_types_1.DeregisterDocument,
|
|
72
|
-
fetchPolicy: 'no-cache',
|
|
73
68
|
});
|
|
74
69
|
}
|
|
75
70
|
catch (err) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
if ('graphQLErrors' in err) {
|
|
72
|
+
const error = err.graphQLErrors?.[0];
|
|
73
|
+
if (error) {
|
|
74
|
+
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
78
|
+
}
|
|
83
79
|
}
|
|
84
80
|
}
|
|
85
|
-
const error = result
|
|
81
|
+
const error = result?.errors?.[0];
|
|
86
82
|
if (error) {
|
|
87
83
|
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
88
84
|
}
|
|
89
|
-
if (result
|
|
90
|
-
return { success: result
|
|
85
|
+
if (result?.data) {
|
|
86
|
+
return { success: !!result?.data.deregister?.success };
|
|
91
87
|
}
|
|
92
88
|
else {
|
|
93
89
|
throw new sudo_common_1.FatalError('deregister did not return any result.');
|
|
@@ -101,25 +97,25 @@ class ApiClient {
|
|
|
101
97
|
try {
|
|
102
98
|
result = await this.client.mutate({
|
|
103
99
|
mutation: graphql_types_1.GlobalSignOutDocument,
|
|
104
|
-
fetchPolicy: 'no-cache',
|
|
105
100
|
});
|
|
106
101
|
}
|
|
107
102
|
catch (err) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
if ('graphQLErrors' in err) {
|
|
104
|
+
const error = err.graphQLErrors?.[0];
|
|
105
|
+
if (error) {
|
|
106
|
+
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
110
|
+
}
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
|
-
const error = result
|
|
113
|
+
const error = result?.errors?.[0];
|
|
118
114
|
if (error) {
|
|
119
115
|
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
120
116
|
}
|
|
121
|
-
if (result
|
|
122
|
-
return { success: result
|
|
117
|
+
if (result?.data) {
|
|
118
|
+
return { success: result?.data.globalSignOut?.success ?? false };
|
|
123
119
|
}
|
|
124
120
|
else {
|
|
125
121
|
throw new sudo_common_1.FatalError('globalSignOut did not return any result.');
|
|
@@ -131,24 +127,24 @@ class ApiClient {
|
|
|
131
127
|
result = await this.client.mutate({
|
|
132
128
|
mutation: graphql_types_1.RegisterFederatedIdDocument,
|
|
133
129
|
variables: { input },
|
|
134
|
-
fetchPolicy: 'no-cache',
|
|
135
130
|
});
|
|
136
131
|
}
|
|
137
132
|
catch (err) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
133
|
+
if ('graphQLErrors' in err) {
|
|
134
|
+
const error = err.graphQLErrors?.[0];
|
|
135
|
+
if (error) {
|
|
136
|
+
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
140
|
+
}
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
|
-
const error = result
|
|
143
|
+
const error = result?.errors?.[0];
|
|
148
144
|
if (error) {
|
|
149
145
|
throw (0, ErrorTransformer_1.graphQLErrorsToClientError)(error, this.logger);
|
|
150
146
|
}
|
|
151
|
-
const identityId = result
|
|
147
|
+
const identityId = result?.data?.registerFederatedId?.identityId;
|
|
152
148
|
if (identityId) {
|
|
153
149
|
return {
|
|
154
150
|
identityId,
|
|
@@ -159,15 +155,10 @@ class ApiClient {
|
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
async reset() {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
url: this.graphqlUrl,
|
|
158
|
+
this.client = new amplifyClient_1.AmplifyClient({
|
|
159
|
+
graphqlUrl: this.graphqlUrl,
|
|
165
160
|
region: this.region,
|
|
166
|
-
|
|
167
|
-
type: aws_appsync_1.AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
|
|
168
|
-
jwtToken: async () => await this.sudoUserClient.getLatestAuthToken(),
|
|
169
|
-
},
|
|
170
|
-
disableOffline: true,
|
|
161
|
+
tokenProvider: async () => await this.sudoUserClient.getLatestAuthToken(),
|
|
171
162
|
});
|
|
172
163
|
}
|
|
173
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/client/apiClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/client/apiClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wDAU6B;AAC7B,2DAKkC;AAGlC,qEAA2E;AAC3E,mDAA+C;AAE/C;;GAEG;AACH,MAAa,SAAS;IAOpB,YACE,MAAc,EACd,UAAkB,EAClB,cAA8B,EAC9B,MAAc;QAEd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAEpB,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,CAAC;YAC9B,UAAU;YACV,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,cAAc,CAAC,kBAAkB,EAAE;SACrE,CAAC,CAAA;IACJ,CAAC;IAEM,KAAK,CAAC,aAAa;QACxB,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,8BAAgB,EAAE,CAAA;QAC9B,CAAC;QAED,IAAI,MAAM,CAAA;QACV,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAgB;gBAC/C,QAAQ,EAAE,6BAAa;aACxB,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,eAAe,IAAK,GAAW,EAAE,CAAC;gBACpC,MA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ACtD,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,CAAA;QAChE,IAAI,UAAU,EAAE,CAAC;YACf,OAAO;gBACL,UAAU;aACX,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,wBAAU,CAClB,qDAAqD,CACtD,CAAA;QACH,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,CAAC;YAC9B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE;SAC1E,CAAC,CAAA;IACJ,CAAC;CACF;AAxKD,8BAwKC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphQLClientAuthMode = void 0;
|
|
4
|
+
var GraphQLClientAuthMode;
|
|
5
|
+
(function (GraphQLClientAuthMode) {
|
|
6
|
+
GraphQLClientAuthMode["OpenIDConnect"] = "OPENID_CONNECT";
|
|
7
|
+
GraphQLClientAuthMode["IAM"] = "AWS_IAM";
|
|
8
|
+
GraphQLClientAuthMode["ApiKey"] = "API_KEY";
|
|
9
|
+
})(GraphQLClientAuthMode || (exports.GraphQLClientAuthMode = GraphQLClientAuthMode = {}));
|
|
10
|
+
//# sourceMappingURL=graphqlClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphqlClient.js","sourceRoot":"","sources":["../../src/client/graphqlClient.ts"],"names":[],"mappings":";;;AAIA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,yDAAgC,CAAA;IAChC,wCAAe,CAAA;IACf,2CAAkB,CAAA;AACpB,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.graphQLErrorsToClientError =
|
|
8
|
+
exports.graphQLErrorsToClientError = graphQLErrorsToClientError;
|
|
9
9
|
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
10
10
|
function graphQLErrorsToClientError(error, logger) {
|
|
11
11
|
logger.error('GraphQL call failed.', { error });
|
|
@@ -19,5 +19,4 @@ function graphQLErrorsToClientError(error, logger) {
|
|
|
19
19
|
return new sudo_common_1.UnknownGraphQLError(error);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.graphQLErrorsToClientError = graphQLErrorsToClientError;
|
|
23
22
|
//# sourceMappingURL=ErrorTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorTransformer.js","sourceRoot":"","sources":["../../../src/client/transformer/ErrorTransformer.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"ErrorTransformer.js","sourceRoot":"","sources":["../../../src/client/transformer/ErrorTransformer.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAUH,gEAaC;AArBD,2DAMkC;AAElC,SAAgB,0BAA0B,CACxC,KAAmB,EACnB,MAAc;IAEd,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAE/C,IAAI,KAAK,CAAC,SAAS,KAAK,2BAA2B,EAAE,CAAC;QACpD,OAAO,IAAI,0BAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,KAAK,CAAC,SAAS,KAAK,4CAA4C,EAAE,CAAC;QAC5E,OAAO,IAAI,gCAAkB,EAAE,CAAA;IACjC,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,iCAAmB,CAAC,KAAK,CAAC,CAAA;IACvC,CAAC;AACH,CAAC"}
|
package/cjs/core/sdk-config.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
8
|
+
exports.Config = exports.FederatedSignInConfigCodec = exports.IdentityServiceConfigCodec = void 0;
|
|
9
|
+
exports.getIdentityServiceConfig = getIdentityServiceConfig;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
11
|
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
11
12
|
const t = tslib_1.__importStar(require("io-ts"));
|
|
@@ -61,5 +62,4 @@ function getIdentityServiceConfig() {
|
|
|
61
62
|
}
|
|
62
63
|
return sudo_common_1.DefaultConfigurationManager.getInstance().bindConfigSet(exports.Config, undefined);
|
|
63
64
|
}
|
|
64
|
-
exports.getIdentityServiceConfig = getIdentityServiceConfig;
|
|
65
65
|
//# sourceMappingURL=sdk-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-config.js","sourceRoot":"","sources":["../../src/core/sdk-config.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"sdk-config.js","sourceRoot":"","sources":["../../src/core/sdk-config.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAgEH,4DAWC;;AAzED,2DAAuE;AACvE,iDAA0B;AAC1B,yCAAkE;AAElE,0EAA0E;AAC7D,QAAA,0BAA0B,GAAG,CAAC,CAAC,YAAY,CACtD;IACE,0EAA0E;IAC1E,CAAC,CAAC,IAAI,CAAC;QACL,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,cAAc,EAAE,CAAC,CAAC,MAAM;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,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|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.internal = exports.LocalAuthenticationProvider = exports.TESTAuthenticationProvider = exports.DefaultSudoUserClient = void 0;
|
|
8
|
+
exports.internal = exports.LocalAuthenticationProvider = exports.TESTAuthenticationProvider = exports.GraphQLClientAuthMode = exports.DefaultSudoUserClient = void 0;
|
|
9
9
|
const tslib_1 = require("tslib");
|
|
10
10
|
/* Everything exported here is considered public API and is documented by typedoc. */
|
|
11
11
|
var user_client_1 = require("./user/user-client");
|
|
12
12
|
Object.defineProperty(exports, "DefaultSudoUserClient", { enumerable: true, get: function () { return user_client_1.DefaultSudoUserClient; } });
|
|
13
|
+
var graphqlClient_1 = require("./client/graphqlClient");
|
|
14
|
+
Object.defineProperty(exports, "GraphQLClientAuthMode", { enumerable: true, get: function () { return graphqlClient_1.GraphQLClientAuthMode; } });
|
|
13
15
|
tslib_1.__exportStar(require("./user/user-client-interface"), exports);
|
|
14
16
|
var auth_provider_1 = require("./user/auth-provider");
|
|
15
17
|
Object.defineProperty(exports, "TESTAuthenticationProvider", { enumerable: true, get: function () { return auth_provider_1.TESTAuthenticationProvider; } });
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,qFAAqF;AACrF,kDAA0D;AAAjD,oHAAA,qBAAqB,OAAA;AAC9B,uEAA4C;AAC5C,sDAI6B;AAH3B,2HAAA,0BAA0B,OAAA;AAC1B,4HAAA,2BAA2B,OAAA;AAI7B,uDAA4B;AAE5B;;;GAGG;AACH,0DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,qFAAqF;AACrF,kDAA0D;AAAjD,oHAAA,qBAAqB,OAAA;AAC9B,wDAM+B;AAJ7B,sHAAA,qBAAqB,OAAA;AAMvB,uEAA4C;AAC5C,sDAI6B;AAH3B,2HAAA,0BAA0B,OAAA;AAC1B,4HAAA,2BAA2B,OAAA;AAI7B,uDAA4B;AAE5B;;;GAGG;AACH,0DAAiC"}
|
package/cjs/sdk.js
CHANGED
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AmplifyClient = void 0;
|
|
8
9
|
const tslib_1 = require("tslib");
|
|
9
10
|
/*
|
|
10
11
|
* Private interfaces for support for other Sudo Platform
|
|
11
12
|
* SDKs.
|
|
12
13
|
*/
|
|
13
14
|
tslib_1.__exportStar(require("./core/sdk-config"), exports);
|
|
15
|
+
var amplifyClient_1 = require("./client/amplifyClient");
|
|
16
|
+
Object.defineProperty(exports, "AmplifyClient", { enumerable: true, get: function () { return amplifyClient_1.AmplifyClient; } });
|
|
14
17
|
//# sourceMappingURL=sdk.js.map
|
package/cjs/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH;;;GAGG;AACH,4DAAiC;AAGjC,wDAAsD;AAA7C,8GAAA,aAAa,OAAA"}
|
package/cjs/utils/parse-token.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.parseToken =
|
|
8
|
+
exports.parseToken = parseToken;
|
|
9
9
|
function parseToken(token) {
|
|
10
10
|
let parsed;
|
|
11
11
|
try {
|
|
@@ -17,5 +17,4 @@ function parseToken(token) {
|
|
|
17
17
|
catch { }
|
|
18
18
|
return parsed;
|
|
19
19
|
}
|
|
20
|
-
exports.parseToken = parseToken;
|
|
21
20
|
//# sourceMappingURL=parse-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-token.js","sourceRoot":"","sources":["../../src/utils/parse-token.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"parse-token.js","sourceRoot":"","sources":["../../src/utils/parse-token.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH,gCAWC;AAXD,SAAgB,UAAU,CAAC,KAAa;IACtC,IAAI,MAAM,CAAA;IAEV,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAChC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,GAAG,MAAM,CAAA;QACjB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createResolvablePromise =
|
|
8
|
+
exports.createResolvablePromise = createResolvablePromise;
|
|
9
9
|
/**
|
|
10
10
|
* A promise that can be resolved externally
|
|
11
11
|
*/
|
|
@@ -21,5 +21,4 @@ function createResolvablePromise() {
|
|
|
21
21
|
resolve,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
exports.createResolvablePromise = createResolvablePromise;
|
|
25
24
|
//# sourceMappingURL=resolvable-promise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvable-promise.js","sourceRoot":"","sources":["../../src/utils/resolvable-promise.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"resolvable-promise.js","sourceRoot":"","sources":["../../src/utils/resolvable-promise.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AASH,0DAaC;AAhBD;;GAEG;AACH,SAAgB,uBAAuB;IACrC,IAAI,OAAoB,CAAA;IAExB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,EAAE;QACnC,OAAO,GAAG,CAAC,CAAA;IACb,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;QAC5B,6DAA6D;QAC7D,gCAAgC;QAChC,6DAA6D;QAC7D,OAAO;KACR,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getSignOptions =
|
|
8
|
+
exports.getSignOptions = getSignOptions;
|
|
9
9
|
const uuid_1 = require("uuid");
|
|
10
10
|
function getSignOptions({ aud, sub, iss, keyId, privateKey, attributes, }) {
|
|
11
11
|
const now = Math.floor(Date.now() / 1000);
|
|
@@ -30,5 +30,4 @@ function getSignOptions({ aud, sub, iss, keyId, privateKey, attributes, }) {
|
|
|
30
30
|
}
|
|
31
31
|
return signOptions;
|
|
32
32
|
}
|
|
33
|
-
exports.getSignOptions = getSignOptions;
|
|
34
33
|
//# sourceMappingURL=sign-options-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-options-builder.js","sourceRoot":"","sources":["../../src/utils/sign-options-builder.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"sign-options-builder.js","sourceRoot":"","sources":["../../src/utils/sign-options-builder.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,wCAsCC;AAxCD,+BAAyB;AAEzB,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