@simpleview/sv-auth-client 6.10.0 → 6.13.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.10.0",
3
+ "version": "6.13.0",
4
4
  "description": "Client for communicating with sv-auth",
5
5
  "author": "Owen Allen <owenallenaz@gmail.com>",
6
6
  "dependencies": {
@@ -139,19 +139,22 @@ class AuthPrefix {
139
139
  return returnData;
140
140
  }
141
141
 
142
- async account_products_sync({ fields, context }) {
142
+ async account_products_sync({ filter, fields, context }) {
143
143
  context = context || this._graphServer.context;
144
144
 
145
145
  const result = await query({
146
146
  query : `
147
- mutation {
147
+ mutation($filter: auth_account_products_sync_filter) {
148
148
  auth {
149
- account_products_sync {
149
+ account_products_sync(filter: $filter) {
150
150
  ${fields}
151
151
  }
152
152
  }
153
153
  }
154
154
  `,
155
+ variables : {
156
+ filter
157
+ },
155
158
  url : this._graphUrl,
156
159
  token : context.token
157
160
  });
@@ -801,6 +804,30 @@ class AuthPrefix {
801
804
  return returnData;
802
805
  }
803
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
+
804
831
  async test_items(...args) {
805
832
  return this._testItems.find(...args);
806
833
  }
@@ -1,3 +1,107 @@
1
- const GraphAdminApi = require("./GraphAdminApi");
1
+ const { query, nullToUndefined } = require("@simpleview/sv-graphql-client");
2
2
 
3
- module.exports = GraphAdminApi;
3
+ class ProductInstances {
4
+ constructor({ graphUrl, graphServer }) {
5
+ this._graphUrl = graphUrl;
6
+ this._graphServer = graphServer;
7
+ }
8
+ async find({ filter, options, fields, context, headers }) {
9
+ const method = "product_instances";
10
+
11
+ context = context || this._graphServer.context;
12
+
13
+ const variables = {
14
+ filter,
15
+ options,
16
+ acct_id : context.acct_id
17
+ };
18
+
19
+ const response = await query({
20
+ query : `
21
+ query($acct_id: String!, $filter: admin_${method}_filter, $options: admin_${method}_options) {
22
+ admin(acct_id: $acct_id) {
23
+ ${method}(filter: $filter, options: $options) {
24
+ ${fields}
25
+ }
26
+ }
27
+ }
28
+ `,
29
+ variables,
30
+ url : this._graphUrl,
31
+ token : context.token,
32
+ headers
33
+ });
34
+
35
+ const returnData = response.admin[this._name];
36
+
37
+ nullToUndefined(returnData)
38
+
39
+ return returnData;
40
+ }
41
+ async upsert({ input, fields, context, headers }) {
42
+ const method = "product_instances_upsert";
43
+
44
+ context = context || this._graphServer.context;
45
+
46
+ const variables = {
47
+ input,
48
+ acct_id : context.acct_id
49
+ }
50
+
51
+ const response = await query({
52
+ query : `
53
+ mutation($acct_id: String!, $input: admin_${method}!) {
54
+ admin(acct_id: $acct_id) {
55
+ ${method}(input: $input) {
56
+ ${fields}
57
+ }
58
+ }
59
+ }
60
+ `,
61
+ variables,
62
+ url : this._graphUrl,
63
+ token : context.token,
64
+ headers
65
+ });
66
+
67
+ const returnData = response.admin[method];
68
+
69
+ nullToUndefined(returnData);
70
+
71
+ return returnData;
72
+ }
73
+ async remove({ filter, fields, context, headers }) {
74
+ const method = "product_instances_remove";
75
+
76
+ context = context || this._graphServer.context;
77
+
78
+ const variables = {
79
+ filter,
80
+ acct_id : context.acct_id
81
+ }
82
+
83
+ const response = await query({
84
+ query : `
85
+ mutation($acct_id: String!, $filter: admin_${method}_filter!) {
86
+ admin(acct_id: $acct_id) {
87
+ ${method}(filter: $filter) {
88
+ ${fields}
89
+ }
90
+ }
91
+ }
92
+ `,
93
+ variables,
94
+ url : this._graphUrl,
95
+ token : context.token,
96
+ headers
97
+ });
98
+
99
+ const returnData = response.admin[method];
100
+
101
+ nullToUndefined(returnData);
102
+
103
+ return returnData;
104
+ }
105
+ }
106
+
107
+ module.exports = ProductInstances;