From 035c87451180d75d16dddb2e702480e1408f06f2 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 08:44:53 +0800 Subject: [PATCH 1/8] start the vue project --- packages/vue/package.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/vue/package.json diff --git a/packages/vue/package.json b/packages/vue/package.json new file mode 100644 index 00000000..76d1f71f --- /dev/null +++ b/packages/vue/package.json @@ -0,0 +1,17 @@ +{ + "name": "@jsonql/vue", + "version": "0.0.1", + "description": "Collection of jsonql modules for Vue", + "main": "index.js", + "scripts": { + "test": "ava" + }, + "keywords": [ + "jsonql", + "vue", + "plugin", + "vuex" + ], + "author": "Joel Chu ", + "license": "ISC" +} -- Gitee From 05ccda6d4a06608fe2f1a055422f74dd87a4c041 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 11:58:31 +0800 Subject: [PATCH 2/8] solve the problem with typescript type problem with the new version --- packages/contract-console/package.json | 33 ++++++++++--------- packages/contract-console/src/main.ts | 3 ++ .../{src => tests}/jsonql-client.d.ts | 0 packages/http-client/package.json | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) rename packages/contract-console/{src => tests}/jsonql-client.d.ts (100%) diff --git a/packages/contract-console/package.json b/packages/contract-console/package.json index 8d34702f..c6814461 100644 --- a/packages/contract-console/package.json +++ b/packages/contract-console/package.json @@ -11,26 +11,29 @@ "dev": "npm run be & npm run serve" }, "dependencies": { - "core-js": "^2.6.5", + "@types/debug": "^4.1.4", + "core-js": "^3.1.4", + "debug": "^4.1.1", + "flyio": "^0.6.14", "vue": "^2.6.10", - "vue-class-component": "^7.0.2", - "vue-property-decorator": "^8.1.0", - "vuex": "^3.0.1" + "vue-class-component": "^7.1.0", + "vue-property-decorator": "^8.2.1", + "vuex": "^3.1.1" }, "devDependencies": { - "@types/chai": "^4.1.0", - "@types/mocha": "^5.2.4", - "@vue/cli-plugin-babel": "^3.8.0", - "@vue/cli-plugin-typescript": "^3.8.0", - "@vue/cli-plugin-unit-mocha": "^3.8.0", - "@vue/cli-service": "^3.8.0", + "@types/chai": "^4.1.7", + "@types/mocha": "^5.2.7", + "@vue/cli-plugin-babel": "^3.9.2", + "@vue/cli-plugin-typescript": "^3.9.0", + "@vue/cli-plugin-unit-mocha": "^3.9.0", + "@vue/cli-service": "^3.9.3", "@vue/test-utils": "1.0.0-beta.29", - "chai": "^4.1.2", - "jsonql-client": "^1.2.1", - "jsonql-koa": "^1.3.2", - "lint-staged": "^8.1.5", + "chai": "^4.2.0", + "jsonql-client": "^1.2.2", + "jsonql-koa": "^1.3.3", + "lint-staged": "^9.2.0", "server-io-core": "^1.2.0-beta.2", - "typescript": "^3.4.3", + "typescript": "^3.5.3", "vue-template-compiler": "^2.6.10" }, "postcss": { diff --git a/packages/contract-console/src/main.ts b/packages/contract-console/src/main.ts index 1dad1c7f..675955ba 100644 --- a/packages/contract-console/src/main.ts +++ b/packages/contract-console/src/main.ts @@ -1,3 +1,6 @@ +import debug from 'debug' +import flyio from 'flyio' + import Vue from 'vue'; import App from './App.vue'; import store from './store'; diff --git a/packages/contract-console/src/jsonql-client.d.ts b/packages/contract-console/tests/jsonql-client.d.ts similarity index 100% rename from packages/contract-console/src/jsonql-client.d.ts rename to packages/contract-console/tests/jsonql-client.d.ts diff --git a/packages/http-client/package.json b/packages/http-client/package.json index df5f55a6..dae40493 100755 --- a/packages/http-client/package.json +++ b/packages/http-client/package.json @@ -62,7 +62,7 @@ "debug": "^4.1.1", "esm": "^3.2.25", "glob": "^7.1.4", - "jsonql-koa": "^1.3.2", + "jsonql-koa": "^1.3.3", "koa-favicon": "^2.0.1", "nyc": "^14.1.1", "promise-polyfill": "8.1.3", -- Gitee From 7ce5c44a0c8ab9d062b219d8871bde5227f6115b Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 12:19:52 +0800 Subject: [PATCH 3/8] remove debug --- packages/http-client/src/lib/utils.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/http-client/src/lib/utils.js b/packages/http-client/src/lib/utils.js index 63f797c3..b3035a80 100644 --- a/packages/http-client/src/lib/utils.js +++ b/packages/http-client/src/lib/utils.js @@ -1,18 +1,11 @@ // move some of the functions were in the class // but it just some util function should not be there -import debug from 'debug'; import { isObject, isKeyInObject } from 'jsonql-params-validator' import { QUERY_NAME, MUTATION_NAME } from 'jsonql-constants' // since it's only use here there is no point of adding it to the constants module // or may be we add it back later export const ENDPOINT_TABLE = 'endpoint'; export const USERDATA_TABLE = 'userdata'; -/** - * reusable debug function - * @param {string} name add to the main name - * @return {function} debug function - */ -export const getDebug = name => debug('jsonql-client').extend(name) /** * @return {number} timestamp -- Gitee From 94038ea255c9a7832ecf27dbdf36ba21d643e0f2 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 12:21:36 +0800 Subject: [PATCH 4/8] remove the debug references --- packages/http-client/src/lib/base/contract-cls.js | 13 ------------- packages/http-client/src/lib/base/http-cls.js | 4 +--- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/http-client/src/lib/base/contract-cls.js b/packages/http-client/src/lib/base/contract-cls.js index 24a00fb0..a4409340 100644 --- a/packages/http-client/src/lib/base/contract-cls.js +++ b/packages/http-client/src/lib/base/contract-cls.js @@ -10,19 +10,6 @@ export default class ContractClass extends HttpClass { super(opts) } - /** - * Set if we want to debug or not - * @return {undefined} nothing - */ - debug() { - const key = 'debug'; - if (this.opts.debugOn) { - localStore.set(key, 'jsonql-client*') - } else { - localStore.remove(key) - } - } - /** * return the contract public api * @return {object} contract diff --git a/packages/http-client/src/lib/base/http-cls.js b/packages/http-client/src/lib/base/http-cls.js index 4e82adb8..dad24849 100644 --- a/packages/http-client/src/lib/base/http-cls.js +++ b/packages/http-client/src/lib/base/http-cls.js @@ -37,14 +37,12 @@ export default class HttpClass { constructor(opts) { // change the way how we init Fly // flyio now become external depedencies and it makes it easier to switch - // to a different environment like WeChat mini app + // to a different environment like WeChat mini app this.fly = new Fly() this.opts = opts; this.extraHeader = {}; // @1.2.1 for adding query to the call on the fly this.extraParams = {}; - // run the set debug - this.debug() // console.info('start up opts', opts); this.reqInterceptor() this.resInterceptor() -- Gitee From 8779ae0dc0666a04225d87bddaa2faaa4ac828a6 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 12:22:32 +0800 Subject: [PATCH 5/8] add a throw to test out where the problem happens --- packages/http-client/src/lib/base/http-cls.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/http-client/src/lib/base/http-cls.js b/packages/http-client/src/lib/base/http-cls.js index dad24849..8bbfb6a6 100644 --- a/packages/http-client/src/lib/base/http-cls.js +++ b/packages/http-client/src/lib/base/http-cls.js @@ -38,7 +38,13 @@ export default class HttpClass { // change the way how we init Fly // flyio now become external depedencies and it makes it easier to switch // to a different environment like WeChat mini app - this.fly = new Fly() + try { + this.fly = new Fly() + } catch(e) { + console.error('Init fly error!', e) + throw e; + } + this.opts = opts; this.extraHeader = {}; // @1.2.1 for adding query to the call on the fly -- Gitee From 561c118eb24c1ffff9c69efff668da4eb92a55e8 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Tue, 23 Jul 2019 15:53:03 +0800 Subject: [PATCH 6/8] clean up the http-client --- packages/contract-console/public/index.html | 6 +- .../http-client/dist/jsonql-client.cls.js | 9113 ----------------- .../http-client/dist/jsonql-client.cls.js.map | 1 - .../http-client/dist/jsonql-client.umd.js | 2 +- .../http-client/dist/jsonql-client.umd.js.map | 2 +- packages/http-client/dist/jsonql-stores.js | 1235 --- .../http-client/dist/jsonql-stores.js.map | 1 - packages/http-client/package.json | 2 +- 8 files changed, 8 insertions(+), 10354 deletions(-) delete mode 100644 packages/http-client/dist/jsonql-client.cls.js delete mode 100644 packages/http-client/dist/jsonql-client.cls.js.map delete mode 100644 packages/http-client/dist/jsonql-stores.js delete mode 100644 packages/http-client/dist/jsonql-stores.js.map diff --git a/packages/contract-console/public/index.html b/packages/contract-console/public/index.html index 71671d1e..3780d6ee 100644 --- a/packages/contract-console/public/index.html +++ b/packages/contract-console/public/index.html @@ -5,7 +5,11 @@ - contract-console + + + + + contract-console development