@simpleview/sv-auth-client 6.9.2 → 6.10.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  FROM node:18.15.0
2
2
 
3
+ # load custom granicus certs
4
+ ENV NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/netskope.crt
5
+ COPY netskope.crt /usr/local/share/ca-certificates/
6
+ RUN update-ca-certificates
7
+
3
8
  COPY package.json /app/package.json
4
9
  COPY package-lock.json /app/package-lock.json
5
10
 
package/netskope.crt ADDED
@@ -0,0 +1,52 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIID/DCCAuSgAwIBAgICATgwDQYJKoZIhvcNAQELBQAwgZcxCzAJBgNVBAYTAlVT
3
+ MQswCQYDVQQIEwJDQTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDU5l
4
+ dHNrb3BlIEluYy4xEjAQBgNVBAsTCWNlcnRhZG1pbjESMBAGA1UEAxMJY2VydGFk
5
+ bWluMSUwIwYJKoZIhvcNAQkBFhZjZXJ0YWRtaW5AbmV0c2tvcGUuY29tMB4XDTE5
6
+ MTAyNTE4MTg1MFoXDTI5MTAyMjE4MTg1MFowgZcxCzAJBgNVBAYTAlVTMQswCQYD
7
+ VQQIEwJDQTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDU5ldHNrb3Bl
8
+ IEluYy4xEjAQBgNVBAsTCWNlcnRhZG1pbjESMBAGA1UEAxMJY2VydGFkbWluMSUw
9
+ IwYJKoZIhvcNAQkBFhZjZXJ0YWRtaW5AbmV0c2tvcGUuY29tMIIBIjANBgkqhkiG
10
+ 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuYamgJifcWI3j9zv6OHI0hCQnZHj8uuzZ6sw
11
+ nfbediwij9X7MTbQZmswXZt4EgJ58uPN8Opt3+eh+XGP1wbQemUIm9ZkL5WzM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YWRtaW4xJTAj
45
+ BgkqhkiG9w0BCQEWFmNlcnRhZG1pbkBuZXRza29wZS5jb22CAgE4MA0GCSqGSIb3
46
+ DQEBCwUAA4IBAQAA6rh5K+9ujj0U0/uR2PVglN9K0y0PcRl9wJEyk3QeC8Z8xnbr
47
+ YXslQ+E3hxiOr5WeyHMSF8b2W6xdYmjtyt/kpfLaxBFOy6STExrPkEBDxorfP6i/
48
+ hFTKmgjeM8w0BXTO9TEC+4N82blsofUPGUt8M4Rq9TEQwlJaDfODPjNcnC80sPs4
49
+ 2mqRmPArYLjpH7gwUKc20tDPqNCAUhMxExYYK8VDQmL0Oa/OUvBxjEEEfzWfidrq
50
+ tducpp8YK9f5lodEl37S88ym7RV7RvC1VLXcsxBWQPYswKC7OzddaUgS1DaAWQ7o
51
+ byAY952sz7FxUETlCMU1OCgsxrcjWerMCUFm
52
+ -----END CERTIFICATE-----
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@simpleview/sv-auth-client",
3
- "version": "6.9.2",
3
+ "version": "6.10.0",
4
4
  "description": "Client for communicating with sv-auth",
5
5
  "author": "Owen Allen <owenallenaz@gmail.com>",
6
6
  "dependencies": {
7
7
  "@graphql-tools/utils": "9.2.1",
8
- "@simpleview/sv-graphql-client": ">=2.0.3",
8
+ "@simpleview/sv-graphql-client": ">=4.1.3",
9
9
  "@simpleview/express-async-handler": "1.0.2",
10
10
  "axios": "1.3.4",
11
11
  "expiry-map": "2.0.0",
12
12
  "graphql-tag": "2.12.6",
13
- "jsonwebtoken": "9.0.0",
13
+ "jsonwebtoken": "9.0.2",
14
14
  "p-memoize-cjs": "7.1.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "graphql": ">=16.0.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@apollo/server": "4.5.0",
20
+ "@apollo/server": "4.11.3",
21
21
  "@babel/core": "7.21.3",
22
22
  "@babel/eslint-parser": "7.21.3",
23
23
  "@graphql-tools/schema": "9.0.17",
@@ -87,6 +87,66 @@ class AdminPrefix {
87
87
  return returnData;
88
88
  }
89
89
 
90
+ async users_instance_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
+ const response = await query({
99
+ query : `
100
+ mutation($acct_id: String!, $input: admin_users_instance_upsert_input!) {
101
+ admin(acct_id: $acct_id) {
102
+ users_instance_upsert(input: $input){
103
+ ${fields}
104
+ }
105
+ }
106
+ }
107
+ `,
108
+ variables,
109
+ url: this._graphUrl,
110
+ token: context.token
111
+ });
112
+
113
+ const returnData = response.admin.users_instance_upsert;
114
+
115
+ nullToUndefined(returnData);
116
+
117
+ return returnData;
118
+ }
119
+
120
+ async users_instance_remove({ input, fields, context }) {
121
+ context = context || this._graphServer.context;
122
+
123
+ const variables = {
124
+ input,
125
+ acct_id : context.acct_id
126
+ }
127
+
128
+ const response = await query({
129
+ query : `
130
+ mutation($acct_id: String!, $input: admin_users_instance_remove_input!) {
131
+ admin(acct_id: $acct_id) {
132
+ users_instance_remove(input: $input){
133
+ ${fields}
134
+ }
135
+ }
136
+ }
137
+ `,
138
+ variables,
139
+ url: this._graphUrl,
140
+ token: context.token
141
+ });
142
+
143
+ const returnData = response.admin.users_instance_remove;
144
+
145
+ nullToUndefined(returnData);
146
+
147
+ return returnData;
148
+ }
149
+
90
150
  async account_global_settings_upsert({ input, fields, context }) {
91
151
  context = context || this._graphServer.context;
92
152
 
@@ -115,6 +115,30 @@ class AuthPrefix {
115
115
  return returnData;
116
116
  }
117
117
 
118
+ async accounts_camber_sync({ fields, context }) {
119
+ context = context || this._graphServer.context;
120
+
121
+ const result = await query({
122
+ query : `
123
+ mutation {
124
+ auth {
125
+ accounts_camber_sync {
126
+ ${fields}
127
+ }
128
+ }
129
+ }
130
+ `,
131
+ url : this._graphUrl,
132
+ token : context.token
133
+ });
134
+
135
+ const returnData = result.auth.accounts_camber_sync;
136
+
137
+ nullToUndefined(returnData);
138
+
139
+ return returnData;
140
+ }
141
+
118
142
  async account_products_sync({ fields, context }) {
119
143
  context = context || this._graphServer.context;
120
144
 
@@ -564,6 +588,30 @@ class AuthPrefix {
564
588
  return returnData;
565
589
  }
566
590
 
591
+ async sv_user({ fields, context }) {
592
+ context = context || this._graphServer.context;
593
+
594
+ const result = await query({
595
+ query: `
596
+ query {
597
+ auth {
598
+ sv_user {
599
+ ${fields}
600
+ }
601
+ }
602
+ }
603
+ `,
604
+ url: this._graphUrl,
605
+ token: context.token
606
+ });
607
+
608
+ const returnData = result.auth.sv_user;
609
+
610
+ nullToUndefined(returnData)
611
+
612
+ return returnData;
613
+ }
614
+
567
615
  async create_totp_factor({ fields, context }) {
568
616
  context = context || this._graphServer.context;
569
617
 
@@ -635,6 +683,76 @@ class AuthPrefix {
635
683
  return result.auth.verified_totp_factor;
636
684
  }
637
685
 
686
+ async ui_products({ fields, context }) {
687
+ context = context || this._graphServer.context;
688
+
689
+ const result = await query({
690
+ query: `
691
+ query {
692
+ auth {
693
+ ui_products {
694
+ ${fields}
695
+ }
696
+ }
697
+ }
698
+ `,
699
+ url: this._graphUrl,
700
+ token: context.token
701
+ });
702
+
703
+ const returnData = result.auth.ui_products;
704
+
705
+ nullToUndefined(returnData)
706
+
707
+ return returnData;
708
+ }
709
+
710
+ async send_email_code({ fields, context }) {
711
+ context = context || this._graphServer.context;
712
+
713
+ return query({
714
+ query : `
715
+ mutation {
716
+ auth {
717
+ send_email_code {
718
+ ${fields}
719
+ }
720
+ }
721
+ }
722
+ `,
723
+ url: this._graphUrl,
724
+ token: context.token,
725
+ key: "auth.send_email_code",
726
+ clean: true
727
+ });
728
+ }
729
+
730
+ async update_password_with_verification({ input, fields, context }) {
731
+ context = context || this._graphServer.context;
732
+
733
+ const variables = {
734
+ input,
735
+ acct_id: context.acct_id
736
+ }
737
+
738
+ return query({
739
+ query: `
740
+ mutation($input: auth_update_password_with_verification_input!) {
741
+ auth {
742
+ update_password_with_verification(input: $input) {
743
+ ${fields}
744
+ }
745
+ }
746
+ }
747
+ `,
748
+ variables,
749
+ url: this._graphUrl,
750
+ token: context.token,
751
+ key: "auth.update_password_with_verification",
752
+ clean: true
753
+ });
754
+ }
755
+
638
756
  async test_reset_data({ fields, context }) {
639
757
  context = context || this._graphServer.context;
640
758
 
@@ -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;