@simpleview/sv-auth-client 6.9.3 → 6.11.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 +98 -2
- package/src/testServers.js +25 -1
package/Dockerfile
CHANGED
package/package.json
CHANGED
|
@@ -115,14 +115,14 @@ class AuthPrefix {
|
|
|
115
115
|
return returnData;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
async
|
|
118
|
+
async accounts_camber_sync({ fields, context }) {
|
|
119
119
|
context = context || this._graphServer.context;
|
|
120
120
|
|
|
121
121
|
const result = await query({
|
|
122
122
|
query : `
|
|
123
123
|
mutation {
|
|
124
124
|
auth {
|
|
125
|
-
|
|
125
|
+
accounts_camber_sync {
|
|
126
126
|
${fields}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -132,6 +132,33 @@ class AuthPrefix {
|
|
|
132
132
|
token : context.token
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
+
const returnData = result.auth.accounts_camber_sync;
|
|
136
|
+
|
|
137
|
+
nullToUndefined(returnData);
|
|
138
|
+
|
|
139
|
+
return returnData;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async account_products_sync({ filter, fields, context }) {
|
|
143
|
+
context = context || this._graphServer.context;
|
|
144
|
+
|
|
145
|
+
const result = await query({
|
|
146
|
+
query : `
|
|
147
|
+
mutation($filter: auth_account_products_sync_filter) {
|
|
148
|
+
auth {
|
|
149
|
+
account_products_sync(filter: $filter) {
|
|
150
|
+
${fields}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`,
|
|
155
|
+
variables : {
|
|
156
|
+
filter
|
|
157
|
+
},
|
|
158
|
+
url : this._graphUrl,
|
|
159
|
+
token : context.token
|
|
160
|
+
});
|
|
161
|
+
|
|
135
162
|
const returnData = result.auth.account_products_sync;
|
|
136
163
|
|
|
137
164
|
nullToUndefined(returnData);
|
|
@@ -683,6 +710,51 @@ class AuthPrefix {
|
|
|
683
710
|
return returnData;
|
|
684
711
|
}
|
|
685
712
|
|
|
713
|
+
async send_email_code({ fields, context }) {
|
|
714
|
+
context = context || this._graphServer.context;
|
|
715
|
+
|
|
716
|
+
return query({
|
|
717
|
+
query : `
|
|
718
|
+
mutation {
|
|
719
|
+
auth {
|
|
720
|
+
send_email_code {
|
|
721
|
+
${fields}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
`,
|
|
726
|
+
url: this._graphUrl,
|
|
727
|
+
token: context.token,
|
|
728
|
+
key: "auth.send_email_code",
|
|
729
|
+
clean: true
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
async update_password_with_verification({ input, fields, context }) {
|
|
734
|
+
context = context || this._graphServer.context;
|
|
735
|
+
|
|
736
|
+
const variables = {
|
|
737
|
+
input,
|
|
738
|
+
acct_id: context.acct_id
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return query({
|
|
742
|
+
query: `
|
|
743
|
+
mutation($input: auth_update_password_with_verification_input!) {
|
|
744
|
+
auth {
|
|
745
|
+
update_password_with_verification(input: $input) {
|
|
746
|
+
${fields}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
`,
|
|
751
|
+
variables,
|
|
752
|
+
url: this._graphUrl,
|
|
753
|
+
token: context.token,
|
|
754
|
+
key: "auth.update_password_with_verification",
|
|
755
|
+
clean: true
|
|
756
|
+
});
|
|
757
|
+
}
|
|
686
758
|
|
|
687
759
|
async test_reset_data({ fields, context }) {
|
|
688
760
|
context = context || this._graphServer.context;
|
|
@@ -732,6 +804,30 @@ class AuthPrefix {
|
|
|
732
804
|
return returnData;
|
|
733
805
|
}
|
|
734
806
|
|
|
807
|
+
async uninstrument({ fields, context }) {
|
|
808
|
+
context = context || this._graphServer.context;
|
|
809
|
+
|
|
810
|
+
const result = await query({
|
|
811
|
+
query : `
|
|
812
|
+
mutation {
|
|
813
|
+
auth {
|
|
814
|
+
uninstrument {
|
|
815
|
+
${fields}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
`,
|
|
820
|
+
url : this._graphUrl,
|
|
821
|
+
token : context.token
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
const returnData = result.auth.uninstrument;
|
|
825
|
+
|
|
826
|
+
nullToUndefined(returnData);
|
|
827
|
+
|
|
828
|
+
return returnData;
|
|
829
|
+
}
|
|
830
|
+
|
|
735
831
|
async test_items(...args) {
|
|
736
832
|
return this._testItems.find(...args);
|
|
737
833
|
}
|
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;
|