@simpleview/sv-auth-client 6.0.0 → 6.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleview/sv-auth-client",
3
- "version": "6.0.0",
3
+ "version": "6.7.0",
4
4
  "description": "Client for communicating with sv-auth",
5
5
  "author": "Owen Allen <owenallenaz@gmail.com>",
6
6
  "dependencies": {
@@ -25,7 +25,8 @@ class AdminPrefix {
25
25
  this[`${name}_remove`] = api.remove.bind(api);
26
26
  }
27
27
  }
28
- async users_import({fields, context }) {
28
+
29
+ async users_import({ fields, context }) {
29
30
  context = context || this._graphServer.context;
30
31
 
31
32
  const variables = {
@@ -53,6 +54,7 @@ class AdminPrefix {
53
54
 
54
55
  return returnData;
55
56
  }
57
+
56
58
  async users_send_invitation({ input, fields, context }) {
57
59
  context = context || this._graphServer.context;
58
60
 
@@ -72,8 +74,8 @@ class AdminPrefix {
72
74
  }
73
75
  `,
74
76
  variables,
75
- url : this._graphUrl,
76
- token : context.token
77
+ url: this._graphUrl,
78
+ token: context.token
77
79
  });
78
80
 
79
81
  const returnData = response.admin.users_send_invitation;
@@ -82,6 +84,58 @@ class AdminPrefix {
82
84
 
83
85
  return returnData;
84
86
  }
87
+
88
+ async account_global_settings_upsert({ input, fields, context }) {
89
+ context = context || this._graphServer.context;
90
+
91
+ const variables = {
92
+ input,
93
+ acct_id: context.acct_id
94
+ }
95
+
96
+ return query({
97
+ query: `
98
+ mutation($acct_id: String!, $input: admin_account_global_settings_upsert!) {
99
+ admin(acct_id: $acct_id) {
100
+ account_global_settings_upsert(input: $input) {
101
+ ${fields}
102
+ }
103
+ }
104
+ }
105
+ `,
106
+ variables,
107
+ url: this._graphUrl,
108
+ token: context.token,
109
+ key: "admin.account_global_settings_upsert",
110
+ clean: true
111
+ });
112
+ }
113
+
114
+ async account_global_settings_remove({ fields, context }) {
115
+ context = context || this._graphServer.context;
116
+
117
+ const variables = {
118
+ acct_id: context.acct_id
119
+ }
120
+
121
+ return query({
122
+ query: `
123
+ mutation($acct_id: String!) {
124
+ admin(acct_id: $acct_id) {
125
+ account_global_settings_remove {
126
+ ${fields}
127
+ }
128
+ }
129
+ }
130
+ `,
131
+ variables,
132
+ url: this._graphUrl,
133
+ token: context.token,
134
+ key: "admin.account_global_settings_remove",
135
+ clean: true
136
+ });
137
+ }
138
+
85
139
  async setup({ context, fields }) {
86
140
  context = context || this._graphServer.context;
87
141
 
@@ -110,6 +164,7 @@ class AdminPrefix {
110
164
 
111
165
  return returnData;
112
166
  }
167
+
113
168
  /**
114
169
  * @param {object} args
115
170
  * @param {object} [args.filter]
@@ -151,4 +206,4 @@ class AdminPrefix {
151
206
  }
152
207
  }
153
208
 
154
- module.exports = AdminPrefix;
209
+ module.exports = AdminPrefix;
@@ -1,5 +1,7 @@
1
1
  const Accounts = require("./auth/Accounts");
2
2
  const OauthClients = require("./auth/OauthClients");
3
+ const SamlClients = require("./auth/SamlClients");
4
+ const SVProducts = require("./auth/SVProducts");
3
5
  const TestItems = require("./auth/TestItems");
4
6
  const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
5
7
 
@@ -12,19 +14,31 @@ class AuthPrefix {
12
14
 
13
15
  this._accounts = new Accounts({
14
16
  graphUrl,
15
- name : "accounts",
17
+ name: "accounts",
16
18
  graphServer
17
19
  });
18
20
 
19
21
  this._oauthClients = new OauthClients({
20
22
  graphUrl,
21
- name : "oauth_clients",
23
+ name: "oauth_clients",
24
+ graphServer
25
+ });
26
+
27
+ this._samlClients = new SamlClients({
28
+ graphUrl,
29
+ name: "saml_clients",
30
+ graphServer
31
+ });
32
+
33
+ this._sv_products = new SVProducts({
34
+ graphUrl,
35
+ name: "sv_products",
22
36
  graphServer
23
37
  });
24
38
 
25
39
  this._testItems = new TestItems({
26
40
  graphUrl,
27
- name : "test_items",
41
+ name: "test_items",
28
42
  graphServer
29
43
  })
30
44
  }
@@ -121,6 +135,30 @@ class AuthPrefix {
121
135
  return this._oauthClients.remove(...args);
122
136
  }
123
137
 
138
+ async saml_clients(...args) {
139
+ return this._samlClients.find(...args);
140
+ }
141
+
142
+ async saml_clients_upsert(...args) {
143
+ return this._samlClients.upsert(...args);
144
+ }
145
+
146
+ async saml_clients_remove(...args) {
147
+ return this._samlClients.remove(...args);
148
+ }
149
+
150
+ async sv_products(...args) {
151
+ return this._sv_products.find(...args);
152
+ }
153
+
154
+ async sv_products_upsert(...args) {
155
+ return this._sv_products.upsert(...args);
156
+ }
157
+
158
+ async sv_products_remove(...args) {
159
+ return this._sv_products.remove(...args);
160
+ }
161
+
124
162
  async current({ acct_id, fields, context }) {
125
163
  context = context || this._graphServer.context;
126
164
 
@@ -1,3 +1,3 @@
1
1
  const GraphAuthApi = require("./GraphAuthApi");
2
2
 
3
- module.exports = GraphAuthApi;
3
+ module.exports = GraphAuthApi();
@@ -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, $options: auth_${method}_options) {
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;
@@ -1,3 +1,3 @@
1
1
  const GraphAuthApi = require("./GraphAuthApi");
2
2
 
3
- module.exports = GraphAuthApi;
3
+ module.exports = GraphAuthApi();
@@ -0,0 +1,3 @@
1
+ const GraphAuthApi = require("./GraphAuthApi");
2
+
3
+ module.exports = GraphAuthApi({ excludeFilterOptions: true });
@@ -0,0 +1,3 @@
1
+ const GraphAuthApi = require("./GraphAuthApi");
2
+
3
+ module.exports = GraphAuthApi({ excludeFilterOptions: true });