@simpleview/sv-auth-client 6.7.0 → 6.9.2
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/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -421,4 +421,4 @@ This is a helper method which registers the `callback` and `logout` functions on
|
|
|
421
421
|
|
|
422
422
|
## Troubleshooting
|
|
423
423
|
|
|
424
|
-
For any assistance please reach out on the [
|
|
424
|
+
For any assistance please reach out on the [Microservices Support](https://teams.microsoft.com/l/channel/19%3A0QyLUigUKgmuRY-RfRJIVzq3y8_oURvRVvV5IC67-0w1%40thread.tacv2/General?groupId=42dd24e6-f6ae-4520-9092-cc21b3b3b730&tenantId=cc1eb3c2-fc0c-4a83-8e6a-8d886b4faeab) Teams channel.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const ObjectBindings = require("./admin/ObjectBindings");
|
|
2
2
|
const Products = require("./admin/Products");
|
|
3
|
+
const ProductInstances = require("./admin/ProductInstances");
|
|
3
4
|
const Roles = require("./admin/Roles");
|
|
4
5
|
const Users = require("./admin/Users");
|
|
5
6
|
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
@@ -7,6 +8,7 @@ const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
|
7
8
|
const apis = {
|
|
8
9
|
object_bindings : ObjectBindings,
|
|
9
10
|
products : Products,
|
|
11
|
+
product_instances : ProductInstances,
|
|
10
12
|
roles : Roles,
|
|
11
13
|
users : Users
|
|
12
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const Accounts = require("./auth/Accounts");
|
|
2
|
+
const Users = require("./auth/Users");
|
|
2
3
|
const OauthClients = require("./auth/OauthClients");
|
|
3
4
|
const SamlClients = require("./auth/SamlClients");
|
|
4
5
|
const SVProducts = require("./auth/SVProducts");
|
|
@@ -18,6 +19,11 @@ class AuthPrefix {
|
|
|
18
19
|
graphServer
|
|
19
20
|
});
|
|
20
21
|
|
|
22
|
+
this._users = new Users({
|
|
23
|
+
graphUrl,
|
|
24
|
+
graphServer
|
|
25
|
+
});
|
|
26
|
+
|
|
21
27
|
this._oauthClients = new OauthClients({
|
|
22
28
|
graphUrl,
|
|
23
29
|
name: "oauth_clients",
|
|
@@ -55,6 +61,10 @@ class AuthPrefix {
|
|
|
55
61
|
return this._accounts.remove(...args);
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
async users(...args) {
|
|
65
|
+
return this._users.find(...args);
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
async account_public({ filter, fields, context }) {
|
|
59
69
|
context = context || this._graphServer.context;
|
|
60
70
|
|
|
@@ -105,6 +115,30 @@ class AuthPrefix {
|
|
|
105
115
|
return returnData;
|
|
106
116
|
}
|
|
107
117
|
|
|
118
|
+
async account_products_sync({ fields, context }) {
|
|
119
|
+
context = context || this._graphServer.context;
|
|
120
|
+
|
|
121
|
+
const result = await query({
|
|
122
|
+
query : `
|
|
123
|
+
mutation {
|
|
124
|
+
auth {
|
|
125
|
+
account_products_sync {
|
|
126
|
+
${fields}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`,
|
|
131
|
+
url : this._graphUrl,
|
|
132
|
+
token : context.token
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const returnData = result.auth.account_products_sync;
|
|
136
|
+
|
|
137
|
+
nullToUndefined(returnData);
|
|
138
|
+
|
|
139
|
+
return returnData;
|
|
140
|
+
}
|
|
141
|
+
|
|
108
142
|
async accounts_email_setup({ fields, context = this._graphServer.context }) {
|
|
109
143
|
return query({
|
|
110
144
|
query : `
|
|
@@ -151,12 +185,8 @@ class AuthPrefix {
|
|
|
151
185
|
return this._sv_products.find(...args);
|
|
152
186
|
}
|
|
153
187
|
|
|
154
|
-
async
|
|
155
|
-
return this._sv_products.
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
async sv_products_remove(...args) {
|
|
159
|
-
return this._sv_products.remove(...args);
|
|
188
|
+
async sv_products_sync(...args) {
|
|
189
|
+
return this._sv_products.sync(...args);
|
|
160
190
|
}
|
|
161
191
|
|
|
162
192
|
async current({ acct_id, fields, context }) {
|
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class SVProducts {
|
|
4
|
+
constructor({ graphUrl, name, graphServer }) {
|
|
5
|
+
this._graphUrl = graphUrl;
|
|
6
|
+
this._name = name;
|
|
7
|
+
this._graphServer = graphServer;
|
|
8
|
+
}
|
|
9
|
+
async find({ filter, options, fields, context, headers }) {
|
|
10
|
+
context = context || this._graphServer.context;
|
|
11
|
+
|
|
12
|
+
const variables = {
|
|
13
|
+
filter,
|
|
14
|
+
options
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const response = await query({
|
|
18
|
+
query: `
|
|
19
|
+
query($filter: auth_sv_products_filter) {
|
|
20
|
+
auth {
|
|
21
|
+
sv_products(filter: $filter) {
|
|
22
|
+
${fields}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
variables,
|
|
28
|
+
url: this._graphUrl,
|
|
29
|
+
token: context.token,
|
|
30
|
+
headers
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const returnData = response.auth.sv_products;
|
|
34
|
+
|
|
35
|
+
nullToUndefined(returnData)
|
|
36
|
+
|
|
37
|
+
return returnData;
|
|
38
|
+
}
|
|
39
|
+
async sync({ input, fields, context, headers }) {
|
|
40
|
+
context = context || this._graphServer.context;
|
|
41
|
+
|
|
42
|
+
const variables = {
|
|
43
|
+
input
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const response = await query({
|
|
47
|
+
query: `
|
|
48
|
+
mutation {
|
|
49
|
+
auth {
|
|
50
|
+
sv_products_sync {
|
|
51
|
+
${fields}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`,
|
|
56
|
+
variables,
|
|
57
|
+
url: this._graphUrl,
|
|
58
|
+
token: context.token,
|
|
59
|
+
headers
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const returnData = response.auth.sv_products_sync;
|
|
63
|
+
|
|
64
|
+
nullToUndefined(returnData);
|
|
65
|
+
|
|
66
|
+
return returnData;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = SVProducts;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
|
+
|
|
3
|
+
module.exports = class Users {
|
|
4
|
+
constructor({ graphUrl, graphServer }) {
|
|
5
|
+
this._graphUrl = graphUrl;
|
|
6
|
+
this._graphServer = graphServer;
|
|
7
|
+
}
|
|
8
|
+
async find({ filter, options, fields, context, headers }) {
|
|
9
|
+
context = context || this._graphServer.context;
|
|
10
|
+
|
|
11
|
+
const variables = {
|
|
12
|
+
filter,
|
|
13
|
+
options
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const response = await query({
|
|
17
|
+
query : `
|
|
18
|
+
query($filter: auth_users_filter, $options: auth_users_options) {
|
|
19
|
+
auth {
|
|
20
|
+
users(filter: $filter, options: $options) {
|
|
21
|
+
${fields}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
variables,
|
|
27
|
+
url : this._graphUrl,
|
|
28
|
+
token : context.token,
|
|
29
|
+
headers
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const returnData = response.auth.users;
|
|
33
|
+
|
|
34
|
+
nullToUndefined(returnData)
|
|
35
|
+
|
|
36
|
+
return returnData;
|
|
37
|
+
}
|
|
38
|
+
}
|