@simpleview/sv-auth-client 6.9.3 → 6.10.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.
- package/Dockerfile +0 -1
- package/package.json +1 -1
- package/src/prefixes/AuthPrefix.js +69 -0
- package/src/testServers.js +25 -1
package/Dockerfile
CHANGED
package/package.json
CHANGED
|
@@ -115,6 +115,30 @@ class AuthPrefix {
|
|
|
115
115
|
return returnData;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
async accounts_camber_sync({ fields, context }) {
|
|
119
|
+
context = context || this._graphServer.context;
|
|
120
|
+
|
|
121
|
+
const result = await query({
|
|
122
|
+
query : `
|
|
123
|
+
mutation {
|
|
124
|
+
auth {
|
|
125
|
+
accounts_camber_sync {
|
|
126
|
+
${fields}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`,
|
|
131
|
+
url : this._graphUrl,
|
|
132
|
+
token : context.token
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const returnData = result.auth.accounts_camber_sync;
|
|
136
|
+
|
|
137
|
+
nullToUndefined(returnData);
|
|
138
|
+
|
|
139
|
+
return returnData;
|
|
140
|
+
}
|
|
141
|
+
|
|
118
142
|
async account_products_sync({ fields, context }) {
|
|
119
143
|
context = context || this._graphServer.context;
|
|
120
144
|
|
|
@@ -683,6 +707,51 @@ class AuthPrefix {
|
|
|
683
707
|
return returnData;
|
|
684
708
|
}
|
|
685
709
|
|
|
710
|
+
async send_email_code({ fields, context }) {
|
|
711
|
+
context = context || this._graphServer.context;
|
|
712
|
+
|
|
713
|
+
return query({
|
|
714
|
+
query : `
|
|
715
|
+
mutation {
|
|
716
|
+
auth {
|
|
717
|
+
send_email_code {
|
|
718
|
+
${fields}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
`,
|
|
723
|
+
url: this._graphUrl,
|
|
724
|
+
token: context.token,
|
|
725
|
+
key: "auth.send_email_code",
|
|
726
|
+
clean: true
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
async update_password_with_verification({ input, fields, context }) {
|
|
731
|
+
context = context || this._graphServer.context;
|
|
732
|
+
|
|
733
|
+
const variables = {
|
|
734
|
+
input,
|
|
735
|
+
acct_id: context.acct_id
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
return query({
|
|
739
|
+
query: `
|
|
740
|
+
mutation($input: auth_update_password_with_verification_input!) {
|
|
741
|
+
auth {
|
|
742
|
+
update_password_with_verification(input: $input) {
|
|
743
|
+
${fields}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
`,
|
|
748
|
+
variables,
|
|
749
|
+
url: this._graphUrl,
|
|
750
|
+
token: context.token,
|
|
751
|
+
key: "auth.update_password_with_verification",
|
|
752
|
+
clean: true
|
|
753
|
+
});
|
|
754
|
+
}
|
|
686
755
|
|
|
687
756
|
async test_reset_data({ fields, context }) {
|
|
688
757
|
context = context || this._graphServer.context;
|
package/src/testServers.js
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
const assert = require("assert");
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const { GraphServer } = require("@simpleview/sv-graphql-client");
|
|
4
|
+
const { request: axios } = require("axios");
|
|
4
5
|
|
|
5
6
|
const { AdminPrefix, AuthPrefix } = require("../");
|
|
6
7
|
|
|
7
8
|
const prefixes = [AdminPrefix, AuthPrefix];
|
|
8
9
|
const authGraphServer = new GraphServer({ graphUrl: process.env.GRAPHQL_URL, prefixes })
|
|
9
10
|
|
|
11
|
+
const delay = delayMs => new Promise(res => setTimeout(res, delayMs));
|
|
12
|
+
|
|
10
13
|
const init = async function() {
|
|
14
|
+
for (let i = 1; i <= 5; i++) {
|
|
15
|
+
try {
|
|
16
|
+
const { status, data } = await axios({
|
|
17
|
+
url: `${process.env.GRAPHQL_URL}/?query=%7B__typename%7D`,
|
|
18
|
+
headers: {
|
|
19
|
+
"apollo-require-preflight": true
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (status !== 200 || data?.data?.__typename !== "Query") {
|
|
24
|
+
throw new Error(`Health check returned status ${status}`, { data });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
break;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
await delay(1000 * i);
|
|
30
|
+
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
11
35
|
const serviceJson = JSON.parse(fs.readFileSync("/var/lib/credentials/auth_test.serviceAccount.json"));
|
|
12
36
|
const serviceLogin = await authGraphServer.auth.login_service_account({
|
|
13
37
|
input : {
|
|
@@ -55,4 +79,4 @@ const servers = {
|
|
|
55
79
|
})
|
|
56
80
|
}
|
|
57
81
|
|
|
58
|
-
module.exports = servers;
|
|
82
|
+
module.exports = servers;
|