From 33dbdb0184a08a1a1748c234669b5b7758ad308b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Nov 2018 13:44:24 +0100 Subject: Move connect schemas to JSON Schemas --- packages/connect/src/http_client.ts | 29 +++++++++++----------- .../src/schemas/asset_pairs_request_opts_schema.ts | 8 ------ .../src/schemas/order_config_request_schema.ts | 24 ------------------ .../src/schemas/orderbook_request_schema.ts | 9 ------- .../src/schemas/orders_request_opts_schema.ts | 19 -------------- .../src/schemas/paged_request_opts_schema.ts | 8 ------ .../connect/src/schemas/request_opts_schema.ts | 7 ------ packages/connect/src/schemas/schemas.ts | 15 ----------- 8 files changed, 14 insertions(+), 105 deletions(-) delete mode 100644 packages/connect/src/schemas/asset_pairs_request_opts_schema.ts delete mode 100644 packages/connect/src/schemas/order_config_request_schema.ts delete mode 100644 packages/connect/src/schemas/orderbook_request_schema.ts delete mode 100644 packages/connect/src/schemas/orders_request_opts_schema.ts delete mode 100644 packages/connect/src/schemas/paged_request_opts_schema.ts delete mode 100644 packages/connect/src/schemas/request_opts_schema.ts delete mode 100644 packages/connect/src/schemas/schemas.ts (limited to 'packages/connect') diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index b6c031fa8..c52425431 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -19,7 +19,6 @@ import { fetchAsync } from '@0x/utils'; import * as _ from 'lodash'; import * as queryString from 'query-string'; -import { schemas as clientSchemas } from './schemas/schemas'; import { Client, HttpRequestOptions, HttpRequestType } from './types'; import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers'; @@ -61,9 +60,9 @@ export class HttpClient implements Client { requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts, ): Promise { if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.assetPairsRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.assetPairsRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } const httpRequestOpts = { params: requestOpts, @@ -81,9 +80,9 @@ export class HttpClient implements Client { requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts, ): Promise { if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.ordersRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } const httpRequestOpts = { params: requestOpts, @@ -99,7 +98,7 @@ export class HttpClient implements Client { */ public async getOrderAsync(orderHash: string, requestOpts?: RequestOpts): Promise { if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const httpRequestOpts = { @@ -119,10 +118,10 @@ export class HttpClient implements Client { request: OrderbookRequest, requestOpts?: RequestOpts & PagedRequestOpts, ): Promise { - assert.doesConformToSchema('request', request, clientSchemas.orderBookRequestSchema); + assert.doesConformToSchema('request', request, schemas.orderBookRequestSchema); if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } const httpRequestOpts = { params: _.defaults({}, request, requestOpts), @@ -142,9 +141,9 @@ export class HttpClient implements Client { requestOpts?: RequestOpts, ): Promise { if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } - assert.doesConformToSchema('request', request, clientSchemas.orderConfigRequestSchema); + assert.doesConformToSchema('request', request, schemas.orderConfigRequestSchema); const httpRequestOpts = { params: requestOpts, payload: request, @@ -160,8 +159,8 @@ export class HttpClient implements Client { */ public async getFeeRecipientsAsync(requestOpts?: RequestOpts & PagedRequestOpts): Promise { if (!_.isUndefined(requestOpts)) { - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema); - assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema); + assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema); } const httpRequestOpts = { params: requestOpts, diff --git a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts deleted file mode 100644 index a9e3942a4..000000000 --- a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts +++ /dev/null @@ -1,8 +0,0 @@ -export const assetPairsRequestOptsSchema = { - id: '/AssetPairsRequestOpts', - type: 'object', - properties: { - assetDataA: { $ref: '/hexSchema' }, - assetDataB: { $ref: '/hexSchema' }, - }, -}; diff --git a/packages/connect/src/schemas/order_config_request_schema.ts b/packages/connect/src/schemas/order_config_request_schema.ts deleted file mode 100644 index 0eda430e8..000000000 --- a/packages/connect/src/schemas/order_config_request_schema.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const orderConfigRequestSchema = { - id: '/OrderConfigRequest', - type: 'object', - properties: { - makerAddress: { $ref: '/addressSchema' }, - takerAddress: { $ref: '/addressSchema' }, - makerAssetAmount: { $ref: '/numberSchema' }, - takerAssetAmount: { $ref: '/numberSchema' }, - makerAssetData: { $ref: '/hexSchema' }, - takerAssetData: { $ref: '/hexSchema' }, - exchangeAddress: { $ref: '/addressSchema' }, - expirationTimeSeconds: { $ref: '/numberSchema' }, - }, - required: [ - 'makerAddress', - 'takerAddress', - 'makerAssetAmount', - 'takerAssetAmount', - 'makerAssetData', - 'takerAssetData', - 'exchangeAddress', - 'expirationTimeSeconds', - ], -}; diff --git a/packages/connect/src/schemas/orderbook_request_schema.ts b/packages/connect/src/schemas/orderbook_request_schema.ts deleted file mode 100644 index 0c9389d50..000000000 --- a/packages/connect/src/schemas/orderbook_request_schema.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const orderBookRequestSchema = { - id: '/OrderBookRequest', - type: 'object', - properties: { - baseAssetData: { $ref: '/hexSchema' }, - quoteAssetData: { $ref: '/hexSchema' }, - }, - required: ['baseAssetData', 'quoteAssetData'], -}; diff --git a/packages/connect/src/schemas/orders_request_opts_schema.ts b/packages/connect/src/schemas/orders_request_opts_schema.ts deleted file mode 100644 index 71ce3d06f..000000000 --- a/packages/connect/src/schemas/orders_request_opts_schema.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const ordersRequestOptsSchema = { - id: '/OrdersRequestOpts', - type: 'object', - properties: { - makerAssetProxyId: { $ref: '/hexSchema' }, - takerAssetProxyId: { $ref: '/hexSchema' }, - makerAssetAddress: { $ref: '/addressSchema' }, - takerAssetAddress: { $ref: '/addressSchema' }, - exchangeAddress: { $ref: '/addressSchema' }, - senderAddress: { $ref: '/addressSchema' }, - makerAssetData: { $ref: '/hexSchema' }, - takerAssetData: { $ref: '/hexSchema' }, - traderAssetData: { $ref: '/hexSchema' }, - makerAddress: { $ref: '/addressSchema' }, - takerAddress: { $ref: '/addressSchema' }, - traderAddress: { $ref: '/addressSchema' }, - feeRecipientAddress: { $ref: '/addressSchema' }, - }, -}; diff --git a/packages/connect/src/schemas/paged_request_opts_schema.ts b/packages/connect/src/schemas/paged_request_opts_schema.ts deleted file mode 100644 index eb2e52100..000000000 --- a/packages/connect/src/schemas/paged_request_opts_schema.ts +++ /dev/null @@ -1,8 +0,0 @@ -export const pagedRequestOptsSchema = { - id: '/PagedRequestOpts', - type: 'object', - properties: { - page: { type: 'number' }, - perPage: { type: 'number' }, - }, -}; diff --git a/packages/connect/src/schemas/request_opts_schema.ts b/packages/connect/src/schemas/request_opts_schema.ts deleted file mode 100644 index a51e98069..000000000 --- a/packages/connect/src/schemas/request_opts_schema.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const requestOptsSchema = { - id: '/RequestOpts', - type: 'object', - properties: { - networkId: { type: 'number' }, - }, -}; diff --git a/packages/connect/src/schemas/schemas.ts b/packages/connect/src/schemas/schemas.ts deleted file mode 100644 index 8d101ed6f..000000000 --- a/packages/connect/src/schemas/schemas.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { assetPairsRequestOptsSchema } from './asset_pairs_request_opts_schema'; -import { orderConfigRequestSchema } from './order_config_request_schema'; -import { orderBookRequestSchema } from './orderbook_request_schema'; -import { ordersRequestOptsSchema } from './orders_request_opts_schema'; -import { pagedRequestOptsSchema } from './paged_request_opts_schema'; -import { requestOptsSchema } from './request_opts_schema'; - -export const schemas = { - orderConfigRequestSchema, - orderBookRequestSchema, - ordersRequestOptsSchema, - pagedRequestOptsSchema, - requestOptsSchema, - assetPairsRequestOptsSchema, -}; -- cgit v1.2.3 From 085d34834b8af5a96090d078929fedcabba95a9a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Nov 2018 14:30:14 +0100 Subject: Updated CHANGELOGS --- packages/connect/CHANGELOG.json | 9 +++++++++ packages/connect/CHANGELOG.md | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'packages/connect') diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 52ad9d575..583c55cfc 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1542028948, + "version": "3.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.3", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 8e38e16de..7a57c1f88 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.4 - _November 12, 2018_ + + * Dependencies updated + ## v3.0.3 - _November 9, 2018_ * Dependencies updated -- cgit v1.2.3 From 0ebbbdfca49028f196853bbfb082a1378c09f441 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Nov 2018 14:30:26 +0100 Subject: Publish - 0x.js@2.0.2 - @0x/abi-gen-wrappers@1.0.3 - @0x/assert@1.0.16 - @0x/asset-buyer@2.2.1 - @0x/base-contract@3.0.4 - @0x/connect@3.0.4 - @0x/contract-wrappers@4.0.0 - contracts@2.1.52 - @0x/dev-tools-pages@0.0.4 - @0x/dev-utils@1.0.15 - @0x/fill-scenarios@1.0.10 - @0x/instant@0.0.5 - @0x/json-schemas@2.1.0 - @0x/metacoin@0.0.26 - @0x/migrations@2.0.2 - @0x/order-utils@3.0.0 - @0x/order-watcher@2.2.2 - @0x/react-docs@1.0.16 - @0x/react-shared@1.0.19 - @0x/sol-compiler@1.1.10 - @0x/sol-cov@2.1.10 - @0x/sol-doc@1.0.5 - @0x/sra-spec@1.0.9 - @0x/subproviders@2.1.2 - @0x/testnet-faucets@1.0.54 - @0x/web3-wrapper@3.1.2 - @0x/website@0.0.57 --- packages/connect/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/connect') diff --git a/packages/connect/package.json b/packages/connect/package.json index 527ac5bdc..09d8334a7 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0x/connect", - "version": "3.0.3", + "version": "3.0.4", "engines": { "node": ">=6.12" }, @@ -44,9 +44,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0x/assert": "^1.0.15", - "@0x/json-schemas": "^2.0.1", - "@0x/order-utils": "^2.0.1", + "@0x/assert": "^1.0.16", + "@0x/json-schemas": "^2.1.0", + "@0x/order-utils": "^3.0.0", "@0x/types": "^1.2.1", "@0x/typescript-typings": "^3.0.4", "@0x/utils": "^2.0.4", -- cgit v1.2.3