eip-cloud-services 1.0.14 → 1.0.15
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 +2 -2
- package/src/cdn.js +6 -1
- package/src/lambda.js +0 -1
- package/src/mysql.js +6 -1
- package/src/redis.js +6 -1
- package/src/s3.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eip-cloud-services",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Houses a collection of helpers for connecting with Cloud services.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
"mysql": "^2.18.1",
|
|
23
23
|
"redis": "^4.6.7"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
package/src/cdn.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
const { CloudFrontClient, CreateInvalidationCommand } = require ( '@aws-sdk/client-cloudfront' );
|
|
2
2
|
const { GoogleAuth } = require ( 'google-auth-library' );
|
|
3
3
|
const { initialiseGoogleAuth } = require ( './gcp' );
|
|
4
|
-
const
|
|
4
|
+
const fs = require ( 'fs' );
|
|
5
|
+
let config = {};
|
|
6
|
+
const configDirPath = `${ process.cwd ()}/config`;
|
|
7
|
+
if ( fs.existsSync ( configDirPath ) && fs.statSync ( configDirPath ).isDirectory () ) {
|
|
8
|
+
config = require ( 'config' ); // require the config directory if it exists
|
|
9
|
+
}
|
|
5
10
|
const packageJson = require ( '../package.json' );
|
|
6
11
|
const { cwd } = require ( 'process' );
|
|
7
12
|
const { log } = config?.s3?.logsFunction ? require ( `${ cwd ()}/${config.s3.logsFunction}` ) : console;
|
package/src/lambda.js
CHANGED
package/src/mysql.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const mysql = require ( 'mysql' );
|
|
2
|
-
const
|
|
2
|
+
const fs = require ( 'fs' );
|
|
3
|
+
let config = {};
|
|
4
|
+
const configDirPath = `${ process.cwd ()}/config`;
|
|
5
|
+
if ( fs.existsSync ( configDirPath ) && fs.statSync ( configDirPath ).isDirectory () ) {
|
|
6
|
+
config = require ( 'config' ); // require the config directory if it exists
|
|
7
|
+
}
|
|
3
8
|
|
|
4
9
|
let pool = null;
|
|
5
10
|
|
package/src/redis.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const redis = require ( 'redis' );
|
|
2
|
-
const
|
|
2
|
+
const fs = require ( 'fs' );
|
|
3
|
+
let config = {};
|
|
4
|
+
const configDirPath = `${ process.cwd ()}/config`;
|
|
5
|
+
if ( fs.existsSync ( configDirPath ) && fs.statSync ( configDirPath ).isDirectory () ) {
|
|
6
|
+
config = require ( 'config' ); // require the config directory if it exists
|
|
7
|
+
}
|
|
3
8
|
let redisClient;
|
|
4
9
|
|
|
5
10
|
const getClient = async () => {
|
package/src/s3.js
CHANGED
|
@@ -39,7 +39,12 @@
|
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
const { S3Client, HeadObjectCommand, GetObjectCommand, PutObjectCommand, DeleteObjectCommand, CopyObjectCommand, DeleteObjectsCommand } = require ( '@aws-sdk/client-s3' );
|
|
42
|
-
const
|
|
42
|
+
const fs = require ( 'fs' );
|
|
43
|
+
let config = {};
|
|
44
|
+
const configDirPath = `${ process.cwd ()}/config`;
|
|
45
|
+
if ( fs.existsSync ( configDirPath ) && fs.statSync ( configDirPath ).isDirectory () ) {
|
|
46
|
+
config = require ( 'config' ); // require the config directory if it exists
|
|
47
|
+
}
|
|
43
48
|
const zlib = require ( 'zlib' );
|
|
44
49
|
const crypto = require ( 'crypto' );
|
|
45
50
|
const { cwd } = require ( 'process' );
|
|
@@ -207,7 +212,8 @@ exports.set = async ( key, body, options = {} ) => {
|
|
|
207
212
|
ContentType: contentType,
|
|
208
213
|
ACL: acl,
|
|
209
214
|
CacheControl: cacheControl,
|
|
210
|
-
Metadata: metadata
|
|
215
|
+
Metadata: metadata,
|
|
216
|
+
ContentLength: Buffer.byteLength ( body )
|
|
211
217
|
} );
|
|
212
218
|
|
|
213
219
|
const data = await S3.send ( command );
|