Skip to content

Commit

Permalink
Merge pull request #16 from tonlabs/0.17.0-rc
Browse files Browse the repository at this point in the history
0.17.0 rc
  • Loading branch information
melsomino authored Nov 25, 2019
2 parents 7916737 + 0eb22d1 commit 519ab55
Show file tree
Hide file tree
Showing 35 changed files with 8,565 additions and 433 deletions.
73 changes: 0 additions & 73 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,81 +1,8 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*

; Ignore graphql
.*/node_modules/graphql/.*
.*/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow.*

; Ignore Electron packager
.*/node_modules/electron-packager/.*

[untyped]
; Ignore react-native-tab-view
.*/node_modules/react-native-tab-view/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/

[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]

13 changes: 11 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
G_promoted_version = "master"
G_promoted_version = "0.16.0-rc"
G_promoted_branch = "origin/${G_promoted_version}"

if (G_promoted_version == "master") {
G_promoted_tag = "latest"
} else {
G_promoted_tag = "${G_promoted_version}_latest"
}

// echo "G_promoted_tag: ${G_promoted_tag}"

G_giturl = "https://github.com/tonlabs/ton-q-server.git"
G_gitcred = "LaninSSHgit"
G_dockerCred = 'dockerhubLanin'
Expand Down Expand Up @@ -152,7 +161,7 @@ pipeline {
steps {
script {
docker.withRegistry('', "${G_dockerCred}") {
builtImage.push("latest")
builtImage.push("${G_promoted_tag}")
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ This will regenerate file in `dist` folder.

**SECOND**. If you want to modify scheme of database, you must do it only in one place `db.scheme.js`.
After that you need to generate source code for a graphql type definitions and for resolvers JavaScript code.
You can do it with:
You must do it with:
```bash
npm run babel
npm run gen-ql
npm run babel
```
Yes, you need too run babel twice :(.
4 changes: 0 additions & 4 deletions __tests__/arango.js

This file was deleted.

91 changes: 91 additions & 0 deletions __tests__/resolvers-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

import { convertBigUInt, QLContext, resolveBigUInt } from "../server/arango-types";
import { Transaction, Account } from "../server/arango-resolvers.v2";

test("BigUInt", () => {
expect(convertBigUInt(1, 0x1)).toEqual('11');
expect(convertBigUInt(1, 0x100)).toEqual('3100');
expect(convertBigUInt(1, 0x1000000000)).toEqual('a1000000000');
expect(convertBigUInt(1, 256)).toEqual('3100');
expect(convertBigUInt(1, '256')).toEqual('3100');
expect(convertBigUInt(1, '0x256')).toEqual('3256');
expect(convertBigUInt(1, '0x3100')).toEqual('43100');
expect(convertBigUInt(1, '3100')).toEqual('3c1c');

expect(convertBigUInt(2, 0x1)).toEqual('011');
expect(convertBigUInt(2, 0x100)).toEqual('03100');
expect(convertBigUInt(2, 0x1000000000)).toEqual('0a1000000000');
expect(convertBigUInt(2, 256)).toEqual('03100');
expect(convertBigUInt(2, '0x3100')).toEqual('043100');
expect(convertBigUInt(2, '3100')).toEqual('03c1c');
expect(convertBigUInt(2, '0x10000000000000000')).toEqual('1110000000000000000');

expect(resolveBigUInt(1, '11')).toEqual('0x1');
expect(resolveBigUInt(1, '3100')).toEqual('0x100');
expect(resolveBigUInt(1, 'a1000000000')).toEqual('0x1000000000');
expect(resolveBigUInt(1, '43100')).toEqual('0x3100');
expect(resolveBigUInt(2, '011')).toEqual('0x1');

expect(resolveBigUInt(2, '03100')).toEqual('0x100');
expect(resolveBigUInt(2, '0a1000000000')).toEqual('0x1000000000');
expect(resolveBigUInt(2, '043100')).toEqual('0x3100');
expect(resolveBigUInt(2, '1110000000000000000')).toEqual('0x10000000000000000');
});

const resolvers = require('../server/arango-resolvers.v1');

test("Filter test", () => {
const filter = {
"id": { "eq": "01d7acd8d454d33c95199346683ef1938d994e6432f1b8a0b11b8eea2556f3b2" },
"storage": {
"state": {
"AccountActive": {
"code": { "gt": "" },
"data": { "gt": "" }
}
}
}
};
const doc = {
"id": "01d7acd8d454d33c95199346683ef1938d994e6432f1b8a0b11b8eea2556f3b2",
"_key": "01d7acd8d454d33c95199346683ef1938d994e6432f1b8a0b11b8eea2556f3b2",
"storage": {
"state": {
"AccountActive": {
"code": "1",
"data": "1",
},
"AccountUninit": {
"None": null,
"__typename": "None"
},
"__typename": "AccountStorageStateAccountUninitVariant"
}, "__typename": "AccountStorage"
}, "__typename": "Account"
};

console.log('>>>', resolvers.Account.test(doc, filter));
});

test("Generate AQL", () => {
const context = new QLContext();
let ql = Transaction.ql(context, 'doc', { in_msg: { ne: "1" } });
expect(ql).toEqual(`doc.in_msg != @v1`);
expect(context.vars.v1).toEqual('1');

context.clear();
ql = Transaction.ql(context, 'doc', { out_msgs: { any: { ne: "1" } } });
expect(ql).toEqual(`LENGTH(doc.out_msgs[* FILTER CURRENT != @v1]) > 0`);
expect(context.vars.v1).toEqual('1');

context.clear();
ql = Account.ql(context, 'doc', { id: { gt: 'fff' } });
expect(ql).toEqual(`TO_STRING(doc._key) > @v1`);
expect(context.vars.v1).toEqual('fff');

context.clear();
ql = Account.ql(context, 'doc', { id: { gt: 'fff' }, last_paid: { ge: 20 } });
expect(ql).toEqual(`(TO_STRING(doc._key) > @v1) AND (doc.last_paid >= @v2)`);
expect(context.vars.v1).toEqual('fff');
expect(context.vars.v2).toEqual(20);
});
Loading

0 comments on commit 519ab55

Please sign in to comment.