@8ms/helpers 1.1.55 → 1.1.58

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.
@@ -1,10 +1,12 @@
1
1
  import { Config } from '../config';
2
+ declare type InitClient = {
3
+ config: Config;
4
+ database: string;
5
+ s3Bucket: string;
6
+ s3Key: string;
7
+ };
2
8
  /**
3
9
  * Initialise the database using manually provided credentials.
4
10
  */
5
- declare const initClient: ({ athenaS3, config, database }: {
6
- athenaS3?: string;
7
- config?: Config;
8
- database?: string;
9
- }) => void;
11
+ declare const initClient: ({ config, database, s3Bucket, s3Key }: InitClient) => void;
10
12
  export default initClient;
@@ -9,7 +9,7 @@ global.awsAthenaExpressClient = null;
9
9
  * Initialise the database using manually provided credentials.
10
10
  */
11
11
  var initClient = function (_a) {
12
- var athenaS3 = _a.athenaS3, config = _a.config, database = _a.database;
12
+ var config = _a.config, database = _a.database, s3Bucket = _a.s3Bucket, s3Key = _a.s3Key;
13
13
  if (!global.awsAthenaExpressClient) {
14
14
  var athenaExpress = require('athena-express');
15
15
  var awsSdk = require('aws-sdk');
@@ -18,7 +18,7 @@ var initClient = function (_a) {
18
18
  awsSdk.config.update(formattedConfig);
19
19
  global.awsAthenaExpressClient = new athenaExpress.AthenaExpress({
20
20
  aws: awsSdk,
21
- s3: athenaS3,
21
+ s3: "s3://".concat(s3Bucket, "/").concat(s3Key),
22
22
  db: database,
23
23
  formatJson: true,
24
24
  retry: 200,
@@ -1,12 +1,8 @@
1
- import { Config } from '../config';
2
1
  declare type Request = {
3
- athenaS3?: string;
4
- config?: Config;
5
- database?: string;
6
2
  query: string;
7
3
  };
8
4
  /**
9
5
  * Build the query and return the data.
10
6
  */
11
- declare const request: ({ athenaS3, config, database, query }: Request) => Promise<any>;
7
+ declare const request: ({ query }: Request) => Promise<any>;
12
8
  export default request;
@@ -35,23 +35,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
38
  Object.defineProperty(exports, "__esModule", { value: true });
42
- var initClient_1 = __importDefault(require("./initClient"));
43
39
  /**
44
40
  * Build the query and return the data.
45
41
  */
46
42
  var request = function (_a) {
47
- var athenaS3 = _a.athenaS3, config = _a.config, database = _a.database, query = _a.query;
43
+ var query = _a.query;
48
44
  return __awaiter(void 0, void 0, void 0, function () {
49
45
  return __generator(this, function (_b) {
50
46
  switch (_b.label) {
51
- case 0:
52
- (0, initClient_1.default)({ athenaS3: athenaS3, config: config, database: database });
53
- return [4 /*yield*/, global.awsAthenaExpressClient.query(query)
54
- .then(function (data) { return undefined === data['Items'] ? [] : data['Items']; })];
47
+ case 0: return [4 /*yield*/, global.awsAthenaExpressClient.query(query)
48
+ .then(function (data) { return undefined === data['Items'] ? [] : data['Items']; })];
55
49
  case 1: return [2 /*return*/, _b.sent()];
56
50
  }
57
51
  });
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
1
  {
2
- "name": "@8ms/helpers",
3
- "license": "UNLICENSED",
4
- "version": "1.1.55",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
8
- },
9
- "main": "index.js",
10
- "types": "index.d.ts",
11
- "scripts": {
12
- "build": "rimraf dist && tsc",
13
- "jest": "jest --watch"
14
- },
15
- "dependencies": {
16
- "axios": "0.27.2",
17
- "date-fns": "2.29.2",
18
- "date-fns-tz": "1.3.6",
19
- "lodash": "4.17.21"
20
- },
21
- "devDependencies": {
22
- "@aws-sdk/client-s3": "3.157.0",
23
- "@aws-sdk/client-ses": "3.154.0",
24
- "@aws-sdk/client-ssm": "3.154.0",
25
- "@aws-sdk/s3-request-presigner": "3.157.0",
26
- "@babel/preset-env": "7.18.10",
27
- "@babel/preset-flow": "7.18.6",
28
- "@babel/preset-typescript": "7.18.6",
29
- "@google-cloud/storage": "6.4.1",
30
- "@prisma/client": "4.2.1",
31
- "@types/jest": "28.1.8",
32
- "@types/lodash": "4.14.184",
33
- "@types/node": "18.7.13",
34
- "babel-jest": "28.1.3",
35
- "crypto-js": "4.1.1",
36
- "jest": "28.1.3",
37
- "node-fetch": "3.2.10",
38
- "numbro": "2.3.6",
39
- "prisma-query-log": "3.2.0",
40
- "timezone-mock": "1.3.4",
41
- "ts-node": "10.9.1",
42
- "tslib": "2.4.0",
43
- "typescript": "4.7.4"
44
- }
2
+ "name": "@8ms/helpers",
3
+ "license": "UNLICENSED",
4
+ "version": "1.1.58",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
8
+ },
9
+ "main": "index.js",
10
+ "types": "index.d.ts",
11
+ "scripts": {
12
+ "build": "rimraf dist && tsc",
13
+ "jest": "jest --watch"
14
+ },
15
+ "dependencies": {
16
+ "axios": "0.27.2",
17
+ "crypto-js": "4.1.1",
18
+ "date-fns": "2.29.2",
19
+ "date-fns-tz": "1.3.6",
20
+ "lodash": "4.17.21"
21
+ },
22
+ "devDependencies": {
23
+ "@aws-sdk/client-s3": "3.157.0",
24
+ "@aws-sdk/client-ses": "3.154.0",
25
+ "@aws-sdk/client-ssm": "3.154.0",
26
+ "@aws-sdk/s3-request-presigner": "3.157.0",
27
+ "@babel/preset-env": "7.18.10",
28
+ "@babel/preset-flow": "7.18.6",
29
+ "@babel/preset-typescript": "7.18.6",
30
+ "@google-cloud/storage": "6.4.1",
31
+ "@prisma/client": "4.2.1",
32
+ "@types/jest": "28.1.8",
33
+ "@types/lodash": "4.14.184",
34
+ "@types/node": "18.7.13",
35
+ "babel-jest": "28.1.3",
36
+ "jest": "28.1.3",
37
+ "node-fetch": "3.2.10",
38
+ "numbro": "2.3.6",
39
+ "prisma-query-log": "3.2.0",
40
+ "timezone-mock": "1.3.4",
41
+ "ts-node": "10.9.1",
42
+ "tslib": "2.4.0",
43
+ "typescript": "4.7.4"
44
+ }
45
45
  }