Skip to content

Commit

Permalink
Merge pull request #378 from wavesplatform/release/v0.36.0
Browse files Browse the repository at this point in the history
Release/v0.36.0
  • Loading branch information
dvshur authored Jan 25, 2023
2 parents 64a718e + 3497489 commit 6120daf
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 36 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:10-alpine

# pg-native
RUN apk --no-cache add make python gcc postgresql-dev g++

# enable node_modules caching layer
RUN apk add --no-cache tini git
ADD package.json /tmp/package.json
Expand All @@ -18,5 +21,4 @@ ENTRYPOINT ["/sbin/tini", "--"]

# NodeJS launch
USER node
ENV NODE_ENV production
CMD ["node", "--max-old-space-size=2048", "dist/index.js"]
CMD ["npm", "start"]
3 changes: 0 additions & 3 deletions nodemon.json

This file was deleted.

64 changes: 58 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 7 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
{
"name": "data-service",
"version": "0.35.0",
"version": "0.36.0",
"description": "Waves data service",
"main": "src/index.js",
"repository": "[email protected]:wavesplatform/data-service.git",
"author": "Dmitry Shuranov <[email protected]>",
"license": "MIT",
"scripts": {
"build": "rm -rf dist/ && tsc",
"start": "export $(cat variables.env | xargs) && NODE_ENV=production node dist/index.js",
"candles": "export $(cat variables.env | xargs) && NODE_ENV=production node dist/daemons/candles/index.js",
"dev:candles": "export $(cat variables.stage.env | xargs) && NODE_ENV=development LOG_LEVEL=debug nodemon --inspect dist/daemons/candles/index.js",
"dev:candles:t": "export $(cat variables.testnet.env | xargs) && NODE_ENV=development LOG_LEVEL=debug nodemon --inspect dist/daemons/candles/index.js",
"pairs": "export $(cat variables.env | xargs) && NODE_ENV=production node dist/daemons/pairs/index.js",
"dev:pairs": "export $(cat variables.stage.env | xargs) && NODE_ENV=development LOG_LEVEL=debug nodemon --inspect dist/daemons/pairs/index.js",
"dev:pairs:t": "export $(cat variables.testnet.env | xargs) && NODE_ENV=development LOG_LEVEL=debug nodemon --inspect dist/daemons/pairs/index.js",
"start": "NODE_PG_FORCE_NATIVE=1 node dist/index.js",
"dev": "NODE_PG_FORCE_NATIVE=1 NODE_ENV=development LOG_LEVEL=debug node dist/index.js",
"candles": "NODE_PG_FORCE_NATIVE=1 node dist/daemons/candles/index.js",
"pairs": "NODE_PG_FORCE_NATIVE=1 node dist/daemons/pairs/index.js",
"lint": "eslint src",
"dev": "NODE_ENV=development LOG_LEVEL=debug nodemon --inspect dist/index.js",
"test": "npm run test:u && npm run test:i",
"test:t": "npm run test:u && npm run test:it",
"test:u": "jest --runInBand --detectOpenHandles --config=config/jest.config.unit.json",
"test": "jest --runInBand --detectOpenHandles --config=config/jest.config.unit.json",
"test:i": "export $(cat variables.env | xargs) && jest --runInBand --detectOpenHandles --config=config/jest.config.integration.json",
"test:is": "export $(cat variables.stage.env | xargs) && jest --runInBand --detectOpenHandles --config=config/jest.config.integration.json",
"test:it": "export $(cat variables.testnet.env | xargs) && jest --runInBand --detectOpenHandles --config=config/jest.config.integration.testnet.json"
},
"devDependencies": {
Expand All @@ -37,7 +30,6 @@
"@types/ramda": "^0.25.43",
"eslint": "^5.15.1",
"jest": "^24.5.0",
"nodemon": "^1.18.8",
"pg-monitor": "^1.3.1",
"ts-jest": "^23.10.5",
"ts-node": "^7.0.1",
Expand All @@ -61,6 +53,7 @@
"koa-router": "^7.4.0",
"lru-cache": "^5.1.1",
"merge-descriptors": "^1.0.1",
"pg-native": "^3.0.1",
"pg-promise": "^8.2.3",
"qs": "^6.5.2",
"ramda": "^0.25.0",
Expand Down
6 changes: 4 additions & 2 deletions src/daemons/candles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:10-alpine

# pg-native
RUN apk --no-cache add make python gcc postgresql-dev g++

# enable node_modules caching layer
RUN apk add --no-cache tini git
ADD package.json /tmp/package.json
Expand All @@ -18,5 +21,4 @@ ENTRYPOINT ["/sbin/tini", "--"]

# NodeJS launch
USER node
ENV NODE_ENV production
CMD ["node", "--max-old-space-size=2048", "dist/daemons/candles/index.js"]
CMD ["npm", "run", "candles"]
6 changes: 4 additions & 2 deletions src/daemons/pairs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:10-alpine

# pg-native
RUN apk --no-cache add make python gcc postgresql-dev g++

# enable node_modules caching layer
RUN apk add --no-cache tini git
ADD package.json /tmp/package.json
Expand All @@ -18,5 +21,4 @@ ENTRYPOINT ["/sbin/tini", "--"]

# NodeJS launch
USER node
ENV NODE_ENV production
CMD ["node", "--max-old-space-size=2048", "dist/daemons/pairs/index.js"]
CMD ["npm", "run", "pairs"]
12 changes: 6 additions & 6 deletions src/http/_common/filters/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DEFAULT_MAX_LIMIT } from './';
import { CommonFilters } from './types';

// default limit is 100
const limitFilter =
export const limit =
(max: number): CommonFilters['limit'] =>
(raw) => {
if (isNil(raw)) {
Expand All @@ -30,25 +30,25 @@ const limitFilter =
};

// default sort is SortOrder.Descending
const sortFilter: CommonFilters['sort'] = (s) =>
const sort: CommonFilters['sort'] = (s) =>
typeof s === 'undefined'
? ok(undefined)
: isSortOrder(s)
? ok(s)
: error(new ParseError(new Error('Invalid sort value')));

const afterFilter: CommonFilters['after'] = parseTrimmedStringIfDefined;
const after: CommonFilters['after'] = parseTrimmedStringIfDefined;

export default {
timeStart: parseDate,
timeEnd: parseDate,
blockTimeStart: parseDate,
blockTimeEnd: parseDate,
limit: limitFilter(DEFAULT_MAX_LIMIT),
limit: limit(DEFAULT_MAX_LIMIT),
sender: parseTrimmedStringIfDefined,
senders: parseArrayQuery,
sort: sortFilter,
after: afterFilter,
sort,
after,
ids: parseArrayQuery,
query: parseTrimmedStringIfDefined,
};
5 changes: 4 additions & 1 deletion src/http/pairs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import { parseArrayQuery, parseBool, parsePairs } from '../../utils/parsers';
import { ParseArrayQuery } from '../../utils/parsers/parseArrayQuery';
import { parseFilterValues } from '../_common/filters';
import { ParsedFilterValues, Parser } from '../_common/filters/types';
import commonFilters from '../_common/filters/filters';
import commonFilters, { limit } from '../_common/filters/filters';
import { withMatcher } from '../_common/utils';

const PAIRS_MAX_LIMIT = 1000;

export type ParseMatchExactly = Parser<boolean[]>;
export const parseMatchExactly: ParseMatchExactly = (
matchExactlyRaw?: string
Expand All @@ -40,6 +42,7 @@ export const mgetOrSearchParser = parseFilterValues({
match_exactly: parseMatchExactly,
search_by_asset: commonFilters.query,
search_by_assets: parseArrayQuery as ParseArrayQuery, // merge function type and overloads
limit: limit(PAIRS_MAX_LIMIT),
});

type ParserFnType = typeof mgetOrSearchParser;
Expand Down

0 comments on commit 6120daf

Please sign in to comment.