Skip to content

Commit c6213ee

Browse files
committed
Initial commit
0 parents  commit c6213ee

16 files changed

+7602
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.log
2+
.DS_Store
3+
node_modules
4+
dist

.idea/.gitignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/aws-elasticsearch-model.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Dmitriy Nevzorov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# TSDX Bootstrap
2+
3+
This project was bootstrapped with [TSDX](https://github.com/jaredpalmer/tsdx).
4+
5+
## Local Development
6+
7+
Below is a list of commands you will probably find useful.
8+
9+
### `npm start` or `yarn start`
10+
11+
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.
12+
13+
<img src="https://user-images.githubusercontent.com/4060187/52168303-574d3a00-26f6-11e9-9f3b-71dbec9ebfcb.gif" width="600" />
14+
15+
Your library will be rebuilt if you make edits.
16+
17+
### `npm run build` or `yarn build`
18+
19+
Bundles the package to the `dist` folder.
20+
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).
21+
22+
<img src="https://user-images.githubusercontent.com/4060187/52168322-a98e5b00-26f6-11e9-8cf6-222d716b75ef.gif" width="600" />
23+
24+
### `npm test` or `yarn test`
25+
26+
Runs the test watcher (Jest) in an interactive mode.
27+
By default, runs tests related to files changed since the last commit.

__mocks__/elasticsearch.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// tslint:disable-next-line:variable-name
2+
export const Client = jest.fn().mockImplementation(function() {
3+
// @ts-ignore
4+
this.indices = {
5+
create: jest.fn(async ({index}) => ({acknowledged: true, shards_acknowledged: true, index})),
6+
exists: jest.fn(async ({index}) => index === 'existing-index'),
7+
putMapping: jest.fn(async () => ({acknowledged: true})),
8+
delete: jest.fn(async () => ({acknowledged: true}))
9+
};
10+
// @ts-ignore
11+
this.bulk = jest.fn(async ({body}) => ({
12+
took: 6,
13+
errors: false,
14+
items: [body[0]]
15+
}));
16+
// @ts-ignore
17+
this.search = jest.fn(async ({index, type, body}) => {
18+
const items = new Array(body.size || 25).fill(undefined);
19+
return {
20+
took: 6,
21+
timed_out: false,
22+
_shards: {total: 5, successful: 5, skipped: 0, failed: 0},
23+
hits: {
24+
total: items.length * 5,
25+
max_score: 0,
26+
hits: items.map((_, i) => ({
27+
_index: index,
28+
_type: type,
29+
_id: i,
30+
_score: 0,
31+
_source: {
32+
id: i
33+
}
34+
}))
35+
}
36+
};
37+
});
38+
});

jest.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const {createJestConfig} = require('tsdx/dist/createJestConfig');
2+
const {paths} = require('tsdx/dist/constants');
3+
4+
process.env.BABEL_ENV = 'test';
5+
process.env.NODE_ENV = 'test';
6+
7+
module.exports = createJestConfig(undefined, paths.appRoot);

package.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"version": "0.1.0",
3+
"license": "MIT",
4+
"main": "dist/index.js",
5+
"typings": "dist/index.d.ts",
6+
"files": [
7+
"dist"
8+
],
9+
"scripts": {
10+
"start": "tsdx watch",
11+
"build": "tsdx build",
12+
"test": "tsdx test",
13+
"lint": "tsdx lint",
14+
"prepare": "tsdx build"
15+
},
16+
"peerDependencies": {},
17+
"husky": {
18+
"hooks": {
19+
"pre-commit": "tsdx lint"
20+
}
21+
},
22+
"prettier": {
23+
"singleQuote": true,
24+
"bracketSpacing": false,
25+
"printWidth": 100
26+
},
27+
"release-it": {
28+
"github": {
29+
"release": true
30+
},
31+
"npm": {
32+
"publish": false
33+
}
34+
},
35+
"name": "aws-elasticsearch-model",
36+
"author": "Dmitriy Nevzorov",
37+
"module": "dist/aws-elasticsearch-model.esm.js",
38+
"devDependencies": {
39+
"@types/aws-lambda": "^8.10.39",
40+
"@types/elasticsearch": "^5.0.36",
41+
"@types/http-aws-es": "^6.0.0",
42+
"@types/jest": "^24.0.25",
43+
"aws-lambda": "latest",
44+
"husky": "^3.1.0",
45+
"release-it": "^12.4.3",
46+
"tsdx": "^0.12.1",
47+
"tslib": "^1.10.0",
48+
"typescript": "^3.7.4"
49+
},
50+
"dependencies": {
51+
"bodybuilder": "latest",
52+
"dynamodb-data-types": "latest",
53+
"elasticsearch": "latest",
54+
"http-aws-es": "latest"
55+
}
56+
}

0 commit comments

Comments
 (0)