diff --git a/packages/constants/constants.json b/packages/constants/constants.json index 9a4a7658972779d25310f0d0859308e5b8102e0c..30fcf7dfadce1254d493595b03f86580580b387b 100644 --- a/packages/constants/constants.json +++ b/packages/constants/constants.json @@ -69,6 +69,9 @@ "CLIENT_AUTH_KEY": "authKey", "INDEX_KEY": "index", "CONTRACT_KEY_NAME": "X-JSONQL-CV-KEY", + "SHOW_CONTRACT_DESC_PARAM": { + "desc": "y" + }, "DEFAULT_RESOLVER_DIR": "resolvers", "DEFAULT_CONTRACT_DIR": "contracts", "DEFAULT_KEYS_DIR": "keys", diff --git a/packages/constants/main.js b/packages/constants/main.js index 0a8ace766a788cc3da343b492faaf813550fea06..9bfda742b6694cc807bb33a6265b9119f2f9897d 100644 --- a/packages/constants/main.js +++ b/packages/constants/main.js @@ -80,6 +80,7 @@ export const CLIENT_AUTH_KEY = 'authKey'; export const INDEX_KEY = 'index'; // contract key export const CONTRACT_KEY_NAME = 'X-JSONQL-CV-KEY'; +export const SHOW_CONTRACT_DESC_PARAM = {desc: 'y'}; // directories export const DEFAULT_RESOLVER_DIR = 'resolvers'; export const DEFAULT_CONTRACT_DIR = 'contracts'; diff --git a/packages/constants/package.json b/packages/constants/package.json index 52459d70a525bc373c3dcb81a2e463e6ac7f850b..7c7d615f1c52fb0bbc8c440954cf3099dc916ab7 100755 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-constants", - "version": "1.7.8", + "version": "1.7.9", "description": "All the share constants for json:ql tools", "main": "index.js", "module": "main.js", diff --git a/packages/contract-console/tests/fixtures/server.js b/packages/contract-console/tests/fixtures/server.js new file mode 100644 index 0000000000000000000000000000000000000000..0933d312aa3fa3399b94004b6ca05e8aafd795c5 --- /dev/null +++ b/packages/contract-console/tests/fixtures/server.js @@ -0,0 +1,2 @@ +const serverIo = require('server-io-core') +const jsonqlKoa = require('jsonql-koa') diff --git a/packages/http-client/package.json b/packages/http-client/package.json index 418070d2b3850610338b7fd8abd1eb2862eb0837..2255b4b976f103830f1937adf0dc3726678f391c 100755 --- a/packages/http-client/package.json +++ b/packages/http-client/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-client", - "version": "1.2.0", + "version": "1.2.1", "description": "json:ql client package for javascript using superagent", "main": "index.js", "module": "src/index.js", diff --git a/packages/http-client/src/lib/base/http-cls.js b/packages/http-client/src/lib/base/http-cls.js index a36343209574395058be5d07079171ed03554256..4a34102b104925008fb4152146e01b7ff7cd5430 100644 --- a/packages/http-client/src/lib/base/http-cls.js +++ b/packages/http-client/src/lib/base/http-cls.js @@ -29,6 +29,8 @@ export default class HttpClass { this.fly = flyio; 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); @@ -50,7 +52,7 @@ export default class HttpClass { */ request(payload, options = {}, headers = {}) { this.headers = headers; - let params = cacheBurst() + let params = merge({}, cacheBurst(), this.extraParams) // @TODO need to add a jsonp url and payload if (this.opts.enableJsonp) { let resolverName = getNameFromPayload(payload) @@ -132,12 +134,16 @@ export default class HttpClass { */ cleanUp() { this.extraHeader = {} + this.extraParams = {} } /** * GET for contract only */ get() { + if (this.opts.showContractDesc) { + this.extraParams = merge(this.extraParams, {desc: 'y'}) + } return this.request({}, {method: 'GET'}, this.contractHeader) .then(clientErrorsHandler) .then(result => { @@ -148,7 +154,7 @@ export default class HttpClass { if (result.cache && result.contract) { return result.contract; } - // just the normal result + // just the normal result return result }) } diff --git a/packages/http-client/src/lib/options/base-options.js b/packages/http-client/src/lib/options/base-options.js index c62f78d1d375a1dff4329fdf78befb199ac017c7..fd742749f34e403b17f3f1f0f51f09819b08ff8e 100644 --- a/packages/http-client/src/lib/options/base-options.js +++ b/packages/http-client/src/lib/options/base-options.js @@ -50,8 +50,10 @@ export const appProps = { contractExpired: createConfig(0, [NUMBER_TYPE]),// -1 always fetch contract, // 0 never expired, // > 0 then compare the timestamp with the current one to see if we need to get contract again - // useful during development + // useful during development keepContract: createConfig(true, [BOOLEAN_TYPE]), + // @1.2.1 new option for the contract-console to fetch the contract with description + showContractDesc: createConfig(false, [BOOLEAN_TYPE]), contractKey: createConfig(false, [BOOLEAN_TYPE]), // if the server side is lock by the key you need this contractKeyName: createConfig(CONTRACT_KEY_NAME, [STRING_TYPE]), // same as above they go in pairs enableTimeout: createConfig(false, [BOOLEAN_TYPE]), // @TODO