@simpleview/sv-auth-client 6.0.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 +1 -1
- package/readme.md +1 -1
- package/src/prefixes/AdminPrefix.js +61 -4
- package/src/prefixes/AuthPrefix.js +71 -3
- package/src/prefixes/admin/ProductInstances.js +3 -0
- package/src/prefixes/auth/Accounts.js +1 -1
- package/src/prefixes/auth/GraphAuthApi.js +3 -5
- package/src/prefixes/auth/OauthClients.js +1 -1
- package/src/prefixes/auth/SVProducts.js +70 -0
- package/src/prefixes/auth/SamlClients.js +3 -0
- package/src/prefixes/auth/Users.js +38 -0
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
|
}
|
|
@@ -25,7 +27,8 @@ class AdminPrefix {
|
|
|
25
27
|
this[`${name}_remove`] = api.remove.bind(api);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
async users_import({ fields, context }) {
|
|
29
32
|
context = context || this._graphServer.context;
|
|
30
33
|
|
|
31
34
|
const variables = {
|
|
@@ -53,6 +56,7 @@ class AdminPrefix {
|
|
|
53
56
|
|
|
54
57
|
return returnData;
|
|
55
58
|
}
|
|
59
|
+
|
|
56
60
|
async users_send_invitation({ input, fields, context }) {
|
|
57
61
|
context = context || this._graphServer.context;
|
|
58
62
|
|
|
@@ -72,8 +76,8 @@ class AdminPrefix {
|
|
|
72
76
|
}
|
|
73
77
|
`,
|
|
74
78
|
variables,
|
|
75
|
-
url
|
|
76
|
-
token
|
|
79
|
+
url: this._graphUrl,
|
|
80
|
+
token: context.token
|
|
77
81
|
});
|
|
78
82
|
|
|
79
83
|
const returnData = response.admin.users_send_invitation;
|
|
@@ -82,6 +86,58 @@ class AdminPrefix {
|
|
|
82
86
|
|
|
83
87
|
return returnData;
|
|
84
88
|
}
|
|
89
|
+
|
|
90
|
+
async account_global_settings_upsert({ input, fields, context }) {
|
|
91
|
+
context = context || this._graphServer.context;
|
|
92
|
+
|
|
93
|
+
const variables = {
|
|
94
|
+
input,
|
|
95
|
+
acct_id: context.acct_id
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return query({
|
|
99
|
+
query: `
|
|
100
|
+
mutation($acct_id: String!, $input: admin_account_global_settings_upsert!) {
|
|
101
|
+
admin(acct_id: $acct_id) {
|
|
102
|
+
account_global_settings_upsert(input: $input) {
|
|
103
|
+
${fields}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`,
|
|
108
|
+
variables,
|
|
109
|
+
url: this._graphUrl,
|
|
110
|
+
token: context.token,
|
|
111
|
+
key: "admin.account_global_settings_upsert",
|
|
112
|
+
clean: true
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async account_global_settings_remove({ fields, context }) {
|
|
117
|
+
context = context || this._graphServer.context;
|
|
118
|
+
|
|
119
|
+
const variables = {
|
|
120
|
+
acct_id: context.acct_id
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return query({
|
|
124
|
+
query: `
|
|
125
|
+
mutation($acct_id: String!) {
|
|
126
|
+
admin(acct_id: $acct_id) {
|
|
127
|
+
account_global_settings_remove {
|
|
128
|
+
${fields}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`,
|
|
133
|
+
variables,
|
|
134
|
+
url: this._graphUrl,
|
|
135
|
+
token: context.token,
|
|
136
|
+
key: "admin.account_global_settings_remove",
|
|
137
|
+
clean: true
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
85
141
|
async setup({ context, fields }) {
|
|
86
142
|
context = context || this._graphServer.context;
|
|
87
143
|
|
|
@@ -110,6 +166,7 @@ class AdminPrefix {
|
|
|
110
166
|
|
|
111
167
|
return returnData;
|
|
112
168
|
}
|
|
169
|
+
|
|
113
170
|
/**
|
|
114
171
|
* @param {object} args
|
|
115
172
|
* @param {object} [args.filter]
|
|
@@ -151,4 +208,4 @@ class AdminPrefix {
|
|
|
151
208
|
}
|
|
152
209
|
}
|
|
153
210
|
|
|
154
|
-
module.exports = AdminPrefix;
|
|
211
|
+
module.exports = AdminPrefix;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const Accounts = require("./auth/Accounts");
|
|
2
|
+
const Users = require("./auth/Users");
|
|
2
3
|
const OauthClients = require("./auth/OauthClients");
|
|
4
|
+
const SamlClients = require("./auth/SamlClients");
|
|
5
|
+
const SVProducts = require("./auth/SVProducts");
|
|
3
6
|
const TestItems = require("./auth/TestItems");
|
|
4
7
|
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
5
8
|
|
|
@@ -12,19 +15,36 @@ class AuthPrefix {
|
|
|
12
15
|
|
|
13
16
|
this._accounts = new Accounts({
|
|
14
17
|
graphUrl,
|
|
15
|
-
name
|
|
18
|
+
name: "accounts",
|
|
19
|
+
graphServer
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this._users = new Users({
|
|
23
|
+
graphUrl,
|
|
16
24
|
graphServer
|
|
17
25
|
});
|
|
18
26
|
|
|
19
27
|
this._oauthClients = new OauthClients({
|
|
20
28
|
graphUrl,
|
|
21
|
-
name
|
|
29
|
+
name: "oauth_clients",
|
|
30
|
+
graphServer
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
this._samlClients = new SamlClients({
|
|
34
|
+
graphUrl,
|
|
35
|
+
name: "saml_clients",
|
|
36
|
+
graphServer
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
this._sv_products = new SVProducts({
|
|
40
|
+
graphUrl,
|
|
41
|
+
name: "sv_products",
|
|
22
42
|
graphServer
|
|
23
43
|
});
|
|
24
44
|
|
|
25
45
|
this._testItems = new TestItems({
|
|
26
46
|
graphUrl,
|
|
27
|
-
name
|
|
47
|
+
name: "test_items",
|
|
28
48
|
graphServer
|
|
29
49
|
})
|
|
30
50
|
}
|
|
@@ -41,6 +61,10 @@ class AuthPrefix {
|
|
|
41
61
|
return this._accounts.remove(...args);
|
|
42
62
|
}
|
|
43
63
|
|
|
64
|
+
async users(...args) {
|
|
65
|
+
return this._users.find(...args);
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
async account_public({ filter, fields, context }) {
|
|
45
69
|
context = context || this._graphServer.context;
|
|
46
70
|
|
|
@@ -91,6 +115,30 @@ class AuthPrefix {
|
|
|
91
115
|
return returnData;
|
|
92
116
|
}
|
|
93
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
|
+
|
|
94
142
|
async accounts_email_setup({ fields, context = this._graphServer.context }) {
|
|
95
143
|
return query({
|
|
96
144
|
query : `
|
|
@@ -121,6 +169,26 @@ class AuthPrefix {
|
|
|
121
169
|
return this._oauthClients.remove(...args);
|
|
122
170
|
}
|
|
123
171
|
|
|
172
|
+
async saml_clients(...args) {
|
|
173
|
+
return this._samlClients.find(...args);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async saml_clients_upsert(...args) {
|
|
177
|
+
return this._samlClients.upsert(...args);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async saml_clients_remove(...args) {
|
|
181
|
+
return this._samlClients.remove(...args);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async sv_products(...args) {
|
|
185
|
+
return this._sv_products.find(...args);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async sv_products_sync(...args) {
|
|
189
|
+
return this._sv_products.sync(...args);
|
|
190
|
+
}
|
|
191
|
+
|
|
124
192
|
async current({ acct_id, fields, context }) {
|
|
125
193
|
context = context || this._graphServer.context;
|
|
126
194
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
2
|
|
|
3
|
-
class GraphAuthApi {
|
|
3
|
+
module.exports = ({ excludeFilterOptions = false } = {}) => class GraphAuthApi {
|
|
4
4
|
constructor({ graphUrl, name, graphServer }) {
|
|
5
5
|
this._graphUrl = graphUrl;
|
|
6
6
|
this._name = name;
|
|
@@ -18,9 +18,9 @@ class GraphAuthApi {
|
|
|
18
18
|
|
|
19
19
|
const response = await query({
|
|
20
20
|
query : `
|
|
21
|
-
query($filter: auth_${method}_filter
|
|
21
|
+
query($filter: auth_${method}_filter${excludeFilterOptions ? "" : `, $options: auth_${method}_options`}) {
|
|
22
22
|
auth {
|
|
23
|
-
${method}(filter: $filter, options: $options) {
|
|
23
|
+
${method}(filter: $filter${excludeFilterOptions ? "" : ", options: $options"}) {
|
|
24
24
|
${fields}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -101,5 +101,3 @@ class GraphAuthApi {
|
|
|
101
101
|
return returnData;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
module.exports = GraphAuthApi;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
|
|
2
|
+
|
|
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
|
+
}
|