@simpleview/sv-auth-client 5.0.1 → 5.0.3
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/Dockerfile +1 -1
- package/package.json +14 -13
- package/src/prefixes/AuthPrefix.js +90 -1
package/Dockerfile
CHANGED
package/package.json
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleview/sv-auth-client",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Client for communicating with sv-auth",
|
|
5
5
|
"author": "Owen Allen <owenallenaz@gmail.com>",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@graphql-tools/utils": "
|
|
7
|
+
"@graphql-tools/utils": "9.2.1",
|
|
8
8
|
"@simpleview/sv-graphql-client": ">=2.0.3",
|
|
9
9
|
"@simpleview/express-async-handler": "1.0.2",
|
|
10
|
-
"axios": "
|
|
10
|
+
"axios": "1.3.4",
|
|
11
11
|
"graphql-tag": "2.12.6",
|
|
12
|
-
"jsonwebtoken": "
|
|
12
|
+
"jsonwebtoken": "9.0.0"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"graphql": ">=16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@babel/
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
18
|
+
"@apollo/server": "4.5.0",
|
|
19
|
+
"@babel/core": "7.21.3",
|
|
20
|
+
"@babel/eslint-parser": "7.21.3",
|
|
21
|
+
"@graphql-tools/schema": "9.0.17",
|
|
22
|
+
"@simpleview/mochalib": "2.0.2",
|
|
22
23
|
"@simpleview/assertlib": "1.2.0",
|
|
23
|
-
"apollo-server": "3.10.0",
|
|
24
24
|
"cookie": "0.5.0",
|
|
25
25
|
"cookie-session": "2.0.0",
|
|
26
|
-
"eslint": "
|
|
27
|
-
"graphql": "16.
|
|
28
|
-
"
|
|
29
|
-
"
|
|
26
|
+
"eslint": "8.36.0",
|
|
27
|
+
"graphql": "16.6.0",
|
|
28
|
+
"graphql-tag": "2.12.6",
|
|
29
|
+
"mocha": "10.2.0",
|
|
30
|
+
"supertest": "6.3.3"
|
|
30
31
|
},
|
|
31
32
|
"main": "src/index.js",
|
|
32
33
|
"browser": "src/browser.js",
|
|
@@ -28,15 +28,19 @@ class AuthPrefix {
|
|
|
28
28
|
graphServer
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
|
+
|
|
31
32
|
async accounts(...args) {
|
|
32
33
|
return this._accounts.find(...args);
|
|
33
34
|
}
|
|
35
|
+
|
|
34
36
|
async accounts_upsert(...args) {
|
|
35
37
|
return this._accounts.upsert(...args);
|
|
36
38
|
}
|
|
39
|
+
|
|
37
40
|
async accounts_remove(...args) {
|
|
38
41
|
return this._accounts.remove(...args);
|
|
39
42
|
}
|
|
43
|
+
|
|
40
44
|
async account_public({ filter, fields, context }) {
|
|
41
45
|
context = context || this._graphServer.context;
|
|
42
46
|
|
|
@@ -62,6 +66,7 @@ class AuthPrefix {
|
|
|
62
66
|
|
|
63
67
|
return returnData;
|
|
64
68
|
}
|
|
69
|
+
|
|
65
70
|
async accounts_sync({ fields, context }) {
|
|
66
71
|
context = context || this._graphServer.context;
|
|
67
72
|
|
|
@@ -85,6 +90,7 @@ class AuthPrefix {
|
|
|
85
90
|
|
|
86
91
|
return returnData;
|
|
87
92
|
}
|
|
93
|
+
|
|
88
94
|
async accounts_email_setup({ fields, context = this._graphServer.context }) {
|
|
89
95
|
return query({
|
|
90
96
|
query : `
|
|
@@ -102,15 +108,19 @@ class AuthPrefix {
|
|
|
102
108
|
clean : true
|
|
103
109
|
});
|
|
104
110
|
}
|
|
111
|
+
|
|
105
112
|
async oauth_clients(...args) {
|
|
106
113
|
return this._oauthClients.find(...args);
|
|
107
114
|
}
|
|
115
|
+
|
|
108
116
|
async oauth_clients_upsert(...args) {
|
|
109
117
|
return this._oauthClients.upsert(...args);
|
|
110
118
|
}
|
|
119
|
+
|
|
111
120
|
async oauth_clients_remove(...args) {
|
|
112
121
|
return this._oauthClients.remove(...args);
|
|
113
122
|
}
|
|
123
|
+
|
|
114
124
|
async current({ acct_id, fields, context }) {
|
|
115
125
|
context = context || this._graphServer.context;
|
|
116
126
|
|
|
@@ -137,6 +147,7 @@ class AuthPrefix {
|
|
|
137
147
|
|
|
138
148
|
return returnData;
|
|
139
149
|
}
|
|
150
|
+
|
|
140
151
|
async reset_password_start({ input, fields }) {
|
|
141
152
|
const result = await query({
|
|
142
153
|
query : `
|
|
@@ -160,6 +171,7 @@ class AuthPrefix {
|
|
|
160
171
|
|
|
161
172
|
return returnData;
|
|
162
173
|
}
|
|
174
|
+
|
|
163
175
|
async update_password({ token, new_pass, fields }) {
|
|
164
176
|
const result = await query({
|
|
165
177
|
query : `
|
|
@@ -180,6 +192,7 @@ class AuthPrefix {
|
|
|
180
192
|
|
|
181
193
|
return result.auth.update_password;
|
|
182
194
|
}
|
|
195
|
+
|
|
183
196
|
async refresh_token({ refresh_token, fields }) {
|
|
184
197
|
const result = await query({
|
|
185
198
|
query : `
|
|
@@ -200,6 +213,7 @@ class AuthPrefix {
|
|
|
200
213
|
|
|
201
214
|
return result.auth.refresh_token;
|
|
202
215
|
}
|
|
216
|
+
|
|
203
217
|
async login({ input, fields }) {
|
|
204
218
|
const result = await query({
|
|
205
219
|
query : `
|
|
@@ -220,6 +234,7 @@ class AuthPrefix {
|
|
|
220
234
|
|
|
221
235
|
return result.auth.login;
|
|
222
236
|
}
|
|
237
|
+
|
|
223
238
|
async login_google({ token, fields }) {
|
|
224
239
|
const result = await query({
|
|
225
240
|
query : `
|
|
@@ -239,6 +254,7 @@ class AuthPrefix {
|
|
|
239
254
|
|
|
240
255
|
return result.auth.login_google;
|
|
241
256
|
}
|
|
257
|
+
|
|
242
258
|
async login_service_account({ input, fields }) {
|
|
243
259
|
const result = await query({
|
|
244
260
|
query : `
|
|
@@ -258,6 +274,7 @@ class AuthPrefix {
|
|
|
258
274
|
|
|
259
275
|
return result.auth.login_service_account;
|
|
260
276
|
}
|
|
277
|
+
|
|
261
278
|
async login_sso_token({ input, fields }) {
|
|
262
279
|
const result = await query({
|
|
263
280
|
query : `
|
|
@@ -277,6 +294,7 @@ class AuthPrefix {
|
|
|
277
294
|
|
|
278
295
|
return result.auth.login_sso_token;
|
|
279
296
|
}
|
|
297
|
+
|
|
280
298
|
async check_token_cache({ date, acct_id, fields, context }) {
|
|
281
299
|
context = context || this._graphServer.context;
|
|
282
300
|
|
|
@@ -300,6 +318,74 @@ class AuthPrefix {
|
|
|
300
318
|
|
|
301
319
|
return result.auth.check_token_cache;
|
|
302
320
|
}
|
|
321
|
+
|
|
322
|
+
async verify_mfa_code({ input, fields }) {
|
|
323
|
+
const result = await query({
|
|
324
|
+
query : `
|
|
325
|
+
query($input: auth_verify_mfa_code_input!) {
|
|
326
|
+
auth {
|
|
327
|
+
verify_mfa_code(input: $input) {
|
|
328
|
+
${fields}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
`,
|
|
333
|
+
variables : {
|
|
334
|
+
input
|
|
335
|
+
},
|
|
336
|
+
url : this._graphUrl
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
return result.auth.verify_mfa_code;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async send_email_mfa_code({ input, fields }) {
|
|
343
|
+
const result = await query({
|
|
344
|
+
query : `
|
|
345
|
+
mutation($input: auth_send_email_mfa_code_input!) {
|
|
346
|
+
auth {
|
|
347
|
+
send_email_mfa_code(input: $input) {
|
|
348
|
+
${fields}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
`,
|
|
353
|
+
variables : {
|
|
354
|
+
input
|
|
355
|
+
},
|
|
356
|
+
url : this._graphUrl
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
return result.auth.send_email_mfa_code;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async update_root_user({ input, fields, context}) {
|
|
363
|
+
context = context || this._graphServer.context;
|
|
364
|
+
|
|
365
|
+
const result = await query({
|
|
366
|
+
query: `
|
|
367
|
+
mutation($input: auth_update_root_user_input!) {
|
|
368
|
+
auth {
|
|
369
|
+
update_root_user(input: $input) {
|
|
370
|
+
${fields}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
`,
|
|
375
|
+
variables: {
|
|
376
|
+
input
|
|
377
|
+
},
|
|
378
|
+
url: this._graphUrl,
|
|
379
|
+
token: context.token
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
const returnData = result.auth.update_root_user;
|
|
383
|
+
|
|
384
|
+
nullToUndefined(returnData)
|
|
385
|
+
|
|
386
|
+
return returnData;
|
|
387
|
+
}
|
|
388
|
+
|
|
303
389
|
async test_reset_data({ fields, context }) {
|
|
304
390
|
context = context || this._graphServer.context;
|
|
305
391
|
|
|
@@ -323,6 +409,7 @@ class AuthPrefix {
|
|
|
323
409
|
|
|
324
410
|
return returnData;
|
|
325
411
|
}
|
|
412
|
+
|
|
326
413
|
async test_clear_data({ fields, context }) {
|
|
327
414
|
context = context || this._graphServer.context;
|
|
328
415
|
|
|
@@ -346,9 +433,11 @@ class AuthPrefix {
|
|
|
346
433
|
|
|
347
434
|
return returnData;
|
|
348
435
|
}
|
|
436
|
+
|
|
349
437
|
async test_items(...args) {
|
|
350
438
|
return this._testItems.find(...args);
|
|
351
439
|
}
|
|
440
|
+
|
|
352
441
|
async setup({ context, fields }) {
|
|
353
442
|
context = context || this._graphServer.context;
|
|
354
443
|
|
|
@@ -374,4 +463,4 @@ class AuthPrefix {
|
|
|
374
463
|
}
|
|
375
464
|
}
|
|
376
465
|
|
|
377
|
-
module.exports = AuthPrefix;
|
|
466
|
+
module.exports = AuthPrefix;
|