@things-factory/aws-base 10.1.277 → 10.1.279

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,7 +1,23 @@
1
1
  {
2
2
  "name": "@things-factory/aws-base",
3
- "version": "10.1.277",
3
+ "version": "10.1.279",
4
4
  "main": "dist-server/index.js",
5
+ "files": [
6
+ "README.md",
7
+ "config",
8
+ "dist-server",
9
+ "helps",
10
+ "things-factory.config.js",
11
+ "translations",
12
+ "!**/*.map",
13
+ "!**/*.test.*",
14
+ "!**/*.spec.*",
15
+ "!**/test/**",
16
+ "!**/tests/**",
17
+ "!**/__tests__/**",
18
+ "!**/*.tsbuildinfo",
19
+ "!**/.DS_Store"
20
+ ],
5
21
  "things-factory": true,
6
22
  "author": "heartyoh <heartyoh@hatiolab.com>",
7
23
  "description": "aws service utils",
@@ -23,10 +39,10 @@
23
39
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
24
40
  },
25
41
  "dependencies": {
26
- "@things-factory/auth-base": "^10.1.277",
27
- "@things-factory/shell": "^10.1.277",
42
+ "@things-factory/auth-base": "^10.1.279",
43
+ "@things-factory/shell": "^10.1.279",
28
44
  "athena-express": "^7.1.4",
29
45
  "aws-sdk": "^2.1096.0"
30
46
  },
31
- "gitHead": "85f409e7ea43686a4cda52924247d9e7a6b0bfa7"
47
+ "gitHead": "666c08055c408b408fde961ad10da080941b147c"
32
48
  }
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
- and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
-
8
- <!-- ## [Unreleased] -->
@@ -1 +0,0 @@
1
- {"version":3,"file":"athena-controller.js","sourceRoot":"","sources":["../../server/controllers/athena-controller.ts"],"names":[],"mappings":";;;;AAAA,mDAA8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G;gBACf,GAAG,QAAQ;aACZ,CAAA;YAED,0CAA0C;YAC1C,IACE,QAAQ,CAAC,UAAU,GAAG,CAAC;gBACvB,IAAI,CAAC,mBAAmB,CAAC,SAAS,KAAK,EAAE;gBACzC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,KAAK,EAAE,EAChD,CAAC;gBACD,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAA;gBACzD,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAA;YACzE,CAAC;YAED,gBAAgB;YAChB,WAAW,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;YAE9D,iEAAiE;YACjE,IAAI,CAAC,mBAAmB,CAAC,SAAS,GAAG,WAAW,EAAE,SAAS,IAAI,EAAE,CAAA;YACjE,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,GAAG,WAAW,EAAE,gBAAgB,IAAI,EAAE,CAAA;QACjF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;QAED,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AAzED,4CAyEC","sourcesContent":["import { AthenaExpress } from 'athena-express'\nimport AWS from 'aws-sdk'\n\nimport { config, logger } from '@things-factory/env'\n\nconst athenaConfig = config.get('athena', {})\nconst awsCredentials = {\n region: athenaConfig.region,\n accessKeyId: athenaConfig.accessKeyId,\n secretAccessKey: athenaConfig.secretAccessKey\n}\n\nif (!athenaConfig.region) {\n console.log(`\\\napplication config for 'athena' required like following\n/*\nathena: {\naccessKeyId: 'YOUR ACCESS KEY ID',\nsecretAccessKey: 'YOUR SECRET ACCESS KEY',\nregion: 'YOUR S3 REGION'\noptions: { athenaExpressConfig\n retry: 200,\n getStats: true,\n formatJson: true\n}\n}\n*/\nplease, refer to https://github.com/ghdna/athena-express#advance-config-parameters for about more detail configuration parameters\n`)\n}\n\nexport class AthenaController {\n private athenaExpressClient\n private queryPaginationInfo = {\n NextToken: '',\n QueryExecutionId: ''\n }\n\n constructor() {\n if (!athenaConfig.region) {\n return\n }\n\n try {\n AWS.config.update(awsCredentials)\n } catch (err) {\n // missing config\n logger.error(err)\n }\n\n // refer to https://github.com/ghdna/athena-express#advance-config-parameters\n // about more detail configuration parameters\n let athenaExpressConfig = {\n aws: AWS,\n ...athenaConfig.options\n }\n\n this.athenaExpressClient = new AthenaExpress(athenaExpressConfig)\n }\n\n // query parameters: https://github.com/ghdna/athena-express#advance-query-parameters\n /* SAMPLE QUERY PARAMTERS\n {\n sql: \"SELECT * FROM elb_logs LIMIT 3\" // required,\n db: \"sampledb\", // optional.\n pagination: 5, //optional\n NextToken: \"ARfCDXRjMk...\", //optional\n QueryExecutionId: \"c274843b-4c5c-4ccf-ac8b-e33d595b927d\", //optional\n catalog: \"hive\" //optional\n }; */\n\n // pagination: https://github.com/ghdna/athena-express#pagination\n async query(reqQuery) {\n var queryResult\n try {\n // check if sql key is available in the input parameter\n if (reqQuery.sql === undefined || reqQuery.sql === '') return {}\n\n let queryInput = {\n ...reqQuery\n }\n\n // check if pagination would be available.\n if (\n reqQuery.pagination > 0 &&\n this.queryPaginationInfo.NextToken !== '' &&\n this.queryPaginationInfo.QueryExecutionId !== ''\n ) {\n queryInput.NextToken = this.queryPaginationInfo.NextToken\n queryInput.QueryExecutionId = this.queryPaginationInfo.QueryExecutionId\n }\n\n // run the query\n queryResult = await this.athenaExpressClient.query(queryInput)\n\n // keep pagination parameters if they are available in the result\n this.queryPaginationInfo.NextToken = queryResult?.NextToken || ''\n this.queryPaginationInfo.QueryExecutionId = queryResult?.QueryExecutionId || ''\n } catch (error) {\n logger.error(error)\n }\n\n return queryResult\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;AACA,8DAAmC","sourcesContent":["\nexport * from './athena-controller'"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,uDAA4B;AAC5B,wDAA6B;AAC7B,oDAAyB;AACzB,0EAA+C;AAE/C,oBAAiB","sourcesContent":["export * from './controllers'\nexport * from './migrations'\nexport * from './middlewares'\nexport * from './service'\nexport * from './controllers/athena-controller'\n\nimport './routes'\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;AAEA,0CAEC;AAFD,SAAgB,eAAe,CAAC,IAAS;IACvC,kCAAkC;AACpC,CAAC","sourcesContent":["import Koa from 'koa'\n\nexport function initMiddlewares(_app: Koa) {\n /* can add middlewares into app */\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"athena-query.js","sourceRoot":"","sources":["../../../server/service/athena/athena-query.ts"],"names":[],"mappings":";;;;AAAA,qCAAkC,CAAC,sBAAsB;AAEzD,+CAAoD;AAEpD,iDAA+D;AAE/D,mDAAoD;AAEpD,MAAM,YAAY,GAAG,IAAI,8BAAgB,EAAE,CAAA;AAE3C,MAAa,WAAW;IAEhB,AAAN,KAAK,CAAC,eAAe,CACX,CAAC,EAC+B,SAAc,EAC/C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEtC,IAAI,WAAW,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAErD,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AAbD,kCAaC;AAXO;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;IAEzF,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,oBAAY,CAAC,CAAA;IACtC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kDAOP","sourcesContent":["import '@things-factory/auth-base' // for ResolverContext\n\nimport { Arg, Ctx, Query, Root } from 'type-graphql'\n\nimport { ScalarAny, ScalarObject } from '@things-factory/shell'\n\nimport { AthenaController } from '../../controllers'\n\nconst athenaClient = new AthenaController()\n\nexport class AthenaQuery {\n @Query(returns => ScalarAny, { description: 'To query data in S3 using Amazon Athena SDK' })\n async queryFromAthena(\n @Root() _,\n @Arg('queryData', type => ScalarObject) queryData: any,\n @Ctx() context: ResolverContext\n ): Promise<any> {\n const { domain, user } = context.state\n\n var queryResult = await athenaClient.query(queryData)\n\n return queryResult\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/athena/index.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE/B,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,0BAAW,CAAC,CAAA","sourcesContent":["import { AthenaQuery } from './athena-query'\n\nexport const entities = []\nexport const resolvers = [AthenaQuery]\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,qCAAuD;AAE1C,QAAA,QAAQ,GAAG;AACtB,cAAc;CACf,CAAA;AAGY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,kBAAe;KACjB;CACF,CAAA","sourcesContent":["/* IMPORT ENTITIES AND RESOLVERS */\nimport { resolvers as AthenaResolvers } from './athena'\n\nexport const entities = [ \n /* ENTITIES */\n] \n\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...AthenaResolvers,\n ] \n}\n"]}