@8ms/helpers 1.37.0 → 1.37.1

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.
Files changed (2) hide show
  1. package/initClients.js +17 -17
  2. package/package.json +1 -1
package/initClients.js CHANGED
@@ -22,7 +22,7 @@ const initClient_14 = __importDefault(require("./prisma/initClient"));
22
22
  * Function to simplify initialising the clients.
23
23
  */
24
24
  const initClients = async (props) => {
25
- if (props.athenaExpress) {
25
+ if (props?.athenaExpress) {
26
26
  (0, initClient_1.default)({
27
27
  config: props.awsConfig,
28
28
  database: props.athenaExpress.database,
@@ -30,38 +30,38 @@ const initClients = async (props) => {
30
30
  s3Key: props.athenaExpress.s3Key,
31
31
  });
32
32
  }
33
- if (props.awsEc2) {
33
+ if (props?.awsEc2) {
34
34
  (0, initClient_2.initClient)({
35
35
  config: props.awsConfig,
36
36
  });
37
37
  }
38
- if (props.awsGlue) {
38
+ if (props?.awsGlue) {
39
39
  (0, initClient_3.default)({
40
40
  config: props.awsConfig,
41
41
  });
42
42
  }
43
- if (props.awsLambda) {
43
+ if (props?.awsLambda) {
44
44
  (0, initClient_4.default)({
45
45
  config: props.awsConfig,
46
46
  });
47
47
  }
48
- if (props.awsS3) {
48
+ if (props?.awsS3) {
49
49
  (0, initClient_5.default)({
50
50
  config: props.awsConfig,
51
51
  });
52
52
  }
53
- if (props.awsSes) {
53
+ if (props?.awsSes) {
54
54
  (0, initClient_6.default)({
55
55
  config: props.awsConfig,
56
56
  });
57
57
  }
58
- if (props.awsSsm || props.lumarApi || props.lumarGraphql || props.googleAds || props.googleConfig) {
58
+ if (props?.awsSsm || props?.lumarApi || props?.lumarGraphql || props?.googleAds || props?.googleConfig) {
59
59
  (0, initClient_7.default)({
60
60
  config: props.awsConfig,
61
61
  });
62
62
  }
63
63
  // Lumar (API) authentication using SSM Parameter
64
- if (props.lumarApi) {
64
+ if (props?.lumarApi) {
65
65
  const lumarApiParameter = await (0, getParameter_1.default)({
66
66
  name: props.lumarApi.parameterName,
67
67
  });
@@ -70,7 +70,7 @@ const initClients = async (props) => {
70
70
  });
71
71
  }
72
72
  // Lumar (GraphQL) authentication using SSM Parameter
73
- if (props.lumarGraphql) {
73
+ if (props?.lumarGraphql) {
74
74
  const lumarGraphqlParameter = await (0, getParameter_1.default)({
75
75
  name: props.lumarGraphql.parameterName,
76
76
  });
@@ -79,26 +79,26 @@ const initClients = async (props) => {
79
79
  });
80
80
  }
81
81
  // Google authentication using SSM
82
- if (props.googleConfig) {
82
+ if (props?.googleConfig) {
83
83
  // Google Parameter
84
84
  const googleParameter = await (0, getParameter_1.default)({
85
85
  name: props.googleConfig.parameterName,
86
86
  });
87
87
  // BigQuery
88
- if (props.googleBigQuery && props.googleConfig.projectId) {
88
+ if (props?.googleBigQuery && props?.googleConfig?.projectId) {
89
89
  (0, initClient_10.default)({
90
90
  parameter: googleParameter,
91
91
  projectId: props.googleConfig.projectId,
92
92
  });
93
93
  }
94
94
  // Google Sheets
95
- if (props.googleSheets) {
95
+ if (props?.googleSheets) {
96
96
  (0, initClient_11.default)({
97
97
  parameter: googleParameter,
98
98
  });
99
99
  }
100
100
  // Google Storage
101
- if (props.googleStorage && props.googleConfig.projectId) {
101
+ if (props?.googleStorage && props?.googleConfig?.projectId) {
102
102
  (0, initClient_12.default)({
103
103
  parameter: googleParameter,
104
104
  projectId: props.googleConfig.projectId,
@@ -106,7 +106,7 @@ const initClients = async (props) => {
106
106
  }
107
107
  }
108
108
  // Google Ads authentication using SSM Parameter
109
- if (props.googleAds) {
109
+ if (props?.googleAds) {
110
110
  const googleAdsParameter = await (0, getParameter_1.default)({
111
111
  name: props.googleAds.parameterName,
112
112
  });
@@ -115,10 +115,10 @@ const initClients = async (props) => {
115
115
  });
116
116
  }
117
117
  // Initialise Prisma
118
- if (prisma) {
118
+ if (props?.prisma) {
119
119
  (0, initClient_14.default)({
120
- debug: prisma ? false : prisma?.debug ?? false,
121
- planetScale: prisma ? false : prisma?.planetScale ?? false,
120
+ debug: props?.prisma?.debug ?? false,
121
+ planetScale: props?.prisma?.planetScale ?? false,
122
122
  });
123
123
  }
124
124
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.37.0",
4
+ "version": "1.37.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"